<ul>
<li>\ref adding_nodes_anchor "Nodes"</li>
+<li>\ref adding_0delems_anchor "0D Elements"</li>
<li>\ref adding_edges_anchor "Edges"</li>
<li>\ref adding_triangles_anchor "Triangles"</li>
<li>\ref adding_quadrangles_anchor "Quadrangles"</li>
\image html add_node.png
+<br>
+\anchor adding_0delems_anchor
+<h2>Adding 0D elements</h2>
+
+\image html add0delement.png
+
+In this dialog box specify the node which will form your 0d element by
+selecting it in the 3D viewer and click the \b Apply or
+<b>Apply and Close</b> button. Your 0D element will be created:
+
+\image html add_0delement.png
+
<br>
\anchor adding_edges_anchor
<h2>Adding edges</h2>
\image html add_polyhedron.png
-*/
\ No newline at end of file
+*/
enum log_command
{
ADD_NODE,
+ ADD_ELEM0D,
ADD_EDGE,
ADD_TRIANGLE,
ADD_QUADRANGLE,
{
ALL,
NODE,
+ ELEM0D,
EDGE,
FACE,
VOLUME
long NbElements()
raises (SALOME::SALOME_Exception);
+ long Nb0DElements()
+ raises (SALOME::SALOME_Exception);
+
long NbEdges()
raises (SALOME::SALOME_Exception);
long AddNode(in double x, in double y, in double z);
+ /*!
+ * Create 0D element on the given node.
+ * \param IdOfNode Node IDs for creation of element.
+ */
+ long Add0DElement(in long IDOfNode);
+
/*!
* Create edge, either linear and quadratic (this is determed
* by number of given nodes).
<parameter name="fill_color" value="0, 170, 255"/>
<parameter name="outline_color" value="0, 170, 255"/>
<parameter name="backface_color" value="0, 0, 255"/>
+ <parameter name="elem0d_color" value="0, 255, 0"/>
<parameter name="highlight_color" value="0, 255, 255"/>
<parameter name="node_size" value="3" />
+ <parameter name="elem0d_size" value="5" />
<parameter name="element_width" value="1" />
<parameter name="shrink_coeff" value="75"/>
<parameter name="orientation_color" value="255, 255, 255"/>
//MESSAGE("Try to create element # " << iElem << " with id = "
// << aCellInfo->GetElemNum(iElem));
switch(aGeom) {
+ case ePOINT1:
+ //anElement = FindNode(myMesh,aNodeIds[0]);
+ if(anIsElemNum)
+ anElement = myMesh->Add0DElementWithID
+ (aNodeIds[0], aCellInfo->GetElemNum(iElem));
+ if (!anElement) {
+ anElement = myMesh->Add0DElement(FindNode(myMesh,aNodeIds[0]));
+ isRenum = anIsElemNum;
+ }
+ break;
case eSEG2:
if(anIsElemNum)
anElement = myMesh->AddEdgeWithID(aNodeIds[0],
isRenum = anIsElemNum;
}
break;
-
- case ePOINT1:
- anElement = FindNode(myMesh,aNodeIds[0]);
- break;
}
+
#ifndef _DEXCEPT_
}catch(const std::exception& exc){
//INFOS("Follow exception was cought:\n\t"<<exc.what());
//-------------------------------------------------------
/*!
- * \brief Class helping to use either SMDS_EdgeIterator, SMDS_FaceIterator
- * or SMDS_VolumeIterator in the same code
+ * \brief Class helping to use either SMDS_0DElementIterator,
+ * SMDS_EdgeIterator, SMDS_FaceIterator or SMDS_VolumeIterator
+ * in the same code
*/
//-------------------------------------------------------
struct TElemIterator
else return 0;
}
};
+ typedef TypedElemIterator< SMDS_0DElementIteratorPtr > T0DElementIterator;
typedef TypedElemIterator< SMDS_EdgeIteratorPtr > TEdgeIterator;
typedef TypedElemIterator< SMDS_FaceIteratorPtr > TFaceIterator;
typedef TypedElemIterator< SMDS_VolumeIteratorPtr > TVolumeIterator;
// Storing SMDS groups and sub-meshes as med families
//----------------------------------------------------
int myNodesDefaultFamilyId = 0;
+ int my0DElementsDefaultFamilyId = 0;
int myEdgesDefaultFamilyId = 0;
int myFacesDefaultFamilyId = 0;
int myVolumesDefaultFamilyId = 0;
int nbNodes = myMesh->NbNodes();
+ int nb0DElements = myMesh->Nb0DElements();
int nbEdges = myMesh->NbEdges();
int nbFaces = myMesh->NbFaces();
int nbVolumes = myMesh->NbVolumes();
list< TElemTypeData > aTElemTypeDatas;
EEntiteMaillage anEntity = eMAILLE;
+#ifdef _ELEMENTS_BY_DIM_
+ anEntity = eNOEUD_ELEMENT;
+#endif
+ aTElemTypeDatas.push_back(TElemTypeData(anEntity,
+ ePOINT1,
+ nbElemInfo.Nb0DElements(),
+ SMDSAbs_0DElement));
#ifdef _ELEMENTS_BY_DIM_
anEntity = eARETE;
#endif
PElemIterator elemIterator;
int defaultFamilyId = 0;
switch ( aElemTypeData->_smdsType ) {
+ case SMDSAbs_0DElement:
+ elemIterator = PElemIterator( new T0DElementIterator( myMesh->elements0dIterator() ));
+ defaultFamilyId = my0DElementsDefaultFamilyId;
+ break;
case SMDSAbs_Edge:
elemIterator = PElemIterator( new TEdgeIterator( myMesh->edgesIterator() ));
defaultFamilyId = myEdgesDefaultFamilyId;
myControlsPrecision = -1;
SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
-
+
if ( mgr && mgr->booleanValue( "SMESH", "use_precision", false ) )
myControlsPrecision = mgr->integerValue( "SMESH", "controls_precision", -1);
- vtkFloatingPointType aPointSize = SMESH::GetFloat("SMESH:node_size",3);
- vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
-
+ vtkFloatingPointType aPointSize = SMESH::GetFloat("SMESH:node_size",3);
+ vtkFloatingPointType aElem0DSize = SMESH::GetFloat("SMESH:elem0d_size",5);
+ vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
+
vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
- //Definition 2D and 3D divices of the actor
+ //Definition 2D and 3D devices of the actor
//-----------------------------------------
vtkFloatingPointType anRGB[3] = {1,1,1};
mySurfaceProp = vtkProperty::New();
aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
- //Definition 1D divice of the actor
+ //Definition 1D device of the actor
//---------------------------------
myEdgeProp = vtkProperty::New();
myEdgeProp->SetAmbient(1.0);
aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
- //Definition 0D divice of the actor
- //---------------------------------
+ //Definition 0D device of the actor (0d elements)
+ //-----------------------------------------------
+ my0DProp = vtkProperty::New();
+ SMESH::GetColor( "SMESH", "elem0d_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 0 ) );
+ my0DProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+ my0DProp->SetPointSize(aElem0DSize);
+
+ my0DActor = SMESH_DeviceActor::New();
+ my0DActor->SetUserMatrix(aMatrix);
+ my0DActor->SetStoreClippingMapping(true);
+ my0DActor->PickableOff();
+ my0DActor->SetVisibility(false);
+ my0DActor->SetProperty(my0DProp);
+ my0DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
+ aFilter = my0DActor->GetExtractUnstructuredGrid();
+ //aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
+ aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
+ aFilter->RegisterCellsWithType(VTK_VERTEX);
+
+ //my0DExtProp = vtkProperty::New();
+ //my0DExtProp->DeepCopy(my0DProp);
+ //anRGB[0] = 1 - anRGB[0];
+ //anRGB[1] = 1 - anRGB[1];
+ //anRGB[2] = 1 - anRGB[2];
+ //my0DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+ //my0DExtProp->SetPointSize(aElem0DSize);
+ //
+ //my0DExtActor = SMESH_DeviceActor::New();
+ //my0DExtActor->SetUserMatrix(aMatrix);
+ //my0DExtActor->SetStoreClippingMapping(true);
+ //my0DExtActor->PickableOff();
+ //my0DExtActor->SetHighlited(true);
+ //my0DExtActor->SetVisibility(false);
+ //my0DExtActor->SetProperty(my0DExtProp);
+ //my0DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
+ //aFilter = my0DExtActor->GetExtractUnstructuredGrid();
+ ////aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
+ //aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
+ //aFilter->RegisterCellsWithType(VTK_VERTEX);
+
+
+ //Definition 0D device of the actor (nodes)
+ //-----------------------------------------
myNodeProp = vtkProperty::New();
SMESH::GetColor( "SMESH", "node_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 0, 0 ) );
myNodeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
myBaseActor->GetProperty()->SetOpacity(0.0);
myPickableActor = myBaseActor;
-
+
myHighlightProp = vtkProperty::New();
myHighlightProp->SetAmbient(1.0);
myHighlightProp->SetDiffuse(0.0);
myHighlightProp->SetSpecular(0.0);
SMESH::GetColor( "SMESH", "selection_object_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) );
myHighlightProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
- myHighlightProp->SetPointSize(aPointSize);
+ //myHighlightProp->SetPointSize(aPointSize);
+ myHighlightProp->SetPointSize(std::max(aElem0DSize,aPointSize)); // ??
myHighlightProp->SetRepresentation(1);
-
+
myPreselectProp = vtkProperty::New();
myPreselectProp->SetAmbient(1.0);
myPreselectProp->SetDiffuse(0.0);
myPreselectProp->SetSpecular(0.0);
SMESH::GetColor( "SMESH", "highlight_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 255 ) );
myPreselectProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
- myPreselectProp->SetPointSize(aPointSize);
+ //myPreselectProp->SetPointSize(aPointSize);
+ myPreselectProp->SetPointSize(std::max(aElem0DSize,aPointSize)); // ??
myPreselectProp->SetRepresentation(1);
myHighlitableActor = SMESH_DeviceActor::New();
myNodeProp->Delete();
myNodeExtProp->Delete();
+ my0DProp->Delete();
+ my0DActor->Delete();
+
+ //my0DExtProp->Delete();
+ //my0DExtActor->Delete();
+
my1DProp->Delete();
my1DActor->Delete();
myHighlitableActor->Delete();
- //Deleting of pints numbering pipeline
+ //Deleting of points numbering pipeline
//---------------------------------------
myPointsNumDataSet->Delete();
myControlMode = eNone;
theCheckEntityMode &= mgr->booleanValue( "SMESH", "display_entity", false );
+ my0DActor->GetMapper()->SetScalarVisibility(false);
my1DActor->GetMapper()->SetScalarVisibility(false);
my2DActor->GetMapper()->SetScalarVisibility(false);
my3DActor->GetMapper()->SetScalarVisibility(false);
theRenderer->AddActor(my1DActor);
theRenderer->AddActor(my1DExtActor);
+ theRenderer->AddActor(my0DActor);
+ //theRenderer->AddActor(my0DExtActor);
+
theRenderer->AddActor(myHighlitableActor);
theRenderer->AddActor2D(myScalarBarActor);
theRenderer->RemoveActor(myHighlitableActor);
+ theRenderer->RemoveActor(my0DActor);
+ //theRenderer->RemoveActor(my0DExtActor);
+
theRenderer->RemoveActor(my1DActor);
theRenderer->RemoveActor(my1DExtActor);
myNodeExtActor->Init(myVisualObj,myImplicitBoolean);
+ my0DActor->Init(myVisualObj,myImplicitBoolean);
+ //my0DExtActor->Init(myVisualObj,myImplicitBoolean);
+
my1DActor->Init(myVisualObj,myImplicitBoolean);
my1DExtActor->Init(myVisualObj,myImplicitBoolean);
my2DExtActor->Init(myVisualObj,myImplicitBoolean);
my3DActor->Init(myVisualObj,myImplicitBoolean);
+ my0DActor->GetMapper()->SetLookupTable(myLookupTable);
+ //my0DExtActor->GetMapper()->SetLookupTable(myLookupTable);
+
my1DActor->GetMapper()->SetLookupTable(myLookupTable);
my1DExtActor->GetMapper()->SetLookupTable(myLookupTable);
myNodeExtActor->SetTransform(theTransform);
+ my0DActor->SetTransform(theTransform);
+ //my0DExtActor->SetTransform(theTransform);
+
my1DActor->SetTransform(theTransform);
my1DExtActor->SetTransform(theTransform);
myNodeExtActor->VisibilityOff();
+ my0DActor->VisibilityOff();
+ //my0DExtActor->VisibilityOff();
+
my1DActor->VisibilityOff();
my1DExtActor->VisibilityOff();
myNodeActor->VisibilityOn();
}
+ if(myEntityMode & e0DElements){
+ my0DActor->VisibilityOn();
+ }
+
if(myEntityMode & eEdges){
my1DActor->VisibilityOn();
}
}
-void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
+void SMESH_ActorDef::SetEntityMode(unsigned int theMode)
+{
myEntityState = eAllEntity;
- if(!myVisualObj->GetNbEntities(SMDSAbs_Edge)){
+ if(!myVisualObj->GetNbEntities(SMDSAbs_0DElement)) {
+ myEntityState &= ~e0DElements;
+ theMode &= ~e0DElements;
+ }
+
+ if(!myVisualObj->GetNbEntities(SMDSAbs_Edge)) {
myEntityState &= ~eEdges;
theMode &= ~eEdges;
}
- if(!myVisualObj->GetNbEntities(SMDSAbs_Face)){
+ if(!myVisualObj->GetNbEntities(SMDSAbs_Face)) {
myEntityState &= ~eFaces;
theMode &= ~eFaces;
}
- if(!myVisualObj->GetNbEntities(SMDSAbs_Volume)){
+ if(!myVisualObj->GetNbEntities(SMDSAbs_Volume)) {
myEntityState &= ~eVolumes;
theMode &= ~eVolumes;
}
- if(!theMode){
+ if (!theMode) {
+ if(myVisualObj->GetNbEntities(SMDSAbs_0DElement))
+ theMode |= e0DElements;
+
if(myVisualObj->GetNbEntities(SMDSAbs_Edge))
theMode |= eEdges;
aHightFilter->ClearRegisteredCellsWithType();
aHightFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
-
- if(myEntityMode & eEdges){
+ if (myEntityMode & e0DElements) {
+ if (MYDEBUG) MESSAGE("0D ELEMENTS");
+ aFilter->RegisterCellsWithType(VTK_VERTEX);
+ aHightFilter->RegisterCellsWithType(VTK_VERTEX);
+ }
+
+ if (myEntityMode & eEdges) {
if (MYDEBUG) MESSAGE("EDGES");
aFilter->RegisterCellsWithType(VTK_LINE);
aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
}
- if(myEntityMode & eFaces){
+ if (myEntityMode & eFaces) {
if (MYDEBUG) MESSAGE("FACES");
aFilter->RegisterCellsWithType(VTK_TRIANGLE);
aFilter->RegisterCellsWithType(VTK_POLYGON);
aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
}
- if(myEntityMode & eVolumes){
+ if (myEntityMode & eVolumes) {
if (MYDEBUG) MESSAGE("VOLUMES");
aFilter->RegisterCellsWithType(VTK_TETRA);
aFilter->RegisterCellsWithType(VTK_VOXEL);
SetVisibility(GetVisibility(),false);
}
-void SMESH_ActorDef::SetRepresentation(int theMode){
+void SMESH_ActorDef::SetRepresentation (int theMode)
+{
int aNbEdges = myVisualObj->GetNbEntities(SMDSAbs_Edge);
int aNbFaces = myVisualObj->GetNbEntities(SMDSAbs_Face);
int aNbVolumes = myVisualObj->GetNbEntities(SMDSAbs_Volume);
- if(theMode < 0){
+
+ if (theMode < 0) {
myRepresentation = eSurface;
- if(!aNbFaces && !aNbVolumes && aNbEdges){
+ if (!aNbFaces && !aNbVolumes && aNbEdges) {
myRepresentation = eEdge;
- }else if(!aNbFaces && !aNbVolumes && !aNbEdges){
+ } else if (!aNbFaces && !aNbVolumes && !aNbEdges) {
myRepresentation = ePoint;
}
- }else{
- switch(theMode){
+ } else {
+ switch (theMode) {
case eEdge:
- if(!aNbFaces && !aNbVolumes && !aNbEdges) return;
+ if (!aNbFaces && !aNbVolumes && !aNbEdges) return;
break;
case eSurface:
- if(!aNbFaces && !aNbVolumes) return;
+ if (!aNbFaces && !aNbVolumes) return;
break;
}
myRepresentation = theMode;
}
- if(!GetUnstructuredGrid()->GetNumberOfCells())
+ if (!GetUnstructuredGrid()->GetNumberOfCells())
myRepresentation = ePoint;
- if(myIsShrunk){
- if(myRepresentation == ePoint){
+ if (myIsShrunk) {
+ if (myRepresentation == ePoint) {
UnShrink();
myIsShrunk = true;
- }else{
+ } else {
SetShrink();
}
}
vtkProperty *aProp = NULL, *aBackProp = NULL;
SMESH_DeviceActor::EReperesent aReperesent = SMESH_DeviceActor::EReperesent(-1);
SMESH_Actor::EQuadratic2DRepresentation aQuadraticMode = GetQuadratic2DRepresentation();
- switch(myRepresentation){
+ switch (myRepresentation) {
case ePoint:
myPickableActor = myNodeActor;
myNodeActor->SetVisibility(true);
aBackProp = myBackSurfaceProp;
aReperesent = SMESH_DeviceActor::eSurface;
break;
- }
+ }
my2DActor->SetProperty(aProp);
my2DActor->SetBackfaceProperty(aBackProp);
my3DActor->SetBackfaceProperty(aBackProp);
my3DActor->SetRepresentation(aReperesent);
+ //my0DExtActor->SetVisibility(false);
my1DExtActor->SetVisibility(false);
my2DExtActor->SetVisibility(false);
+ // ???
+ //my0DActor->SetProperty(aProp);
+ //my0DActor->SetBackfaceProperty(aBackProp);
+ my0DActor->SetRepresentation(aReperesent);
+ //my0DExtActor->SetRepresentation(aReperesent);
+
switch(myControlMode){
case eLength:
case eMultiConnection:
my1DActor->SetQuadraticArcMode(false);
else if(aQuadraticMode == SMESH_Actor::eArcs)
my1DActor->SetQuadraticArcMode(true);
-
-
+
my1DActor->SetProperty(aProp);
my1DActor->SetBackfaceProperty(aBackProp);
my1DActor->SetRepresentation(aReperesent);
my1DExtActor->SetRepresentation(aReperesent);
-
+
if(myIsPointsVisible)
myPickableActor = myNodeActor;
if(GetPointRepresentation())
void SMESH_ActorDef::SetNodeSize(vtkFloatingPointType theVal){
myNodeProp->SetPointSize(theVal);
myNodeExtProp->SetPointSize(theVal);
- myHighlightProp->SetPointSize(theVal);
- myPreselectProp->SetPointSize(theVal);
+
+ vtkFloatingPointType aPointSize = my0DProp->GetPointSize() > theVal ? my0DProp->GetPointSize() : theVal;
+ //myHighlightProp->SetPointSize(theVal);
+ myHighlightProp->SetPointSize(aPointSize); // ??
+ //myPreselectProp->SetPointSize(theVal);
+ myPreselectProp->SetPointSize(aPointSize); // ??
my1DProp->SetPointSize(theVal + aPointSizeInc);
my1DExtProp->SetPointSize(theVal + aPointSizeInc);
}
void
-SMESH_ActorDef::
-SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
+SMESH_ActorDef::SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
{
myNodeActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
myBaseActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
-
+
myHighlitableActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
myNodeExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
-
+
+ my0DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
+ //my0DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
+
my1DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
my1DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
-
+
my2DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
my2DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
my3DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
}
vtkIdType
-SMESH_ActorDef::
-AddClippingPlane(vtkPlane* thePlane)
+SMESH_ActorDef::AddClippingPlane(vtkPlane* thePlane)
{
if(thePlane){
myImplicitBoolean->GetFunction()->AddItem(thePlane);
enum EReperesent { ePoint, eEdge, eSurface};
- enum EEntityMode { eEdges = 0x01, eFaces = 0x02, eVolumes = 0x04, eAllEntity = 0x07};
+ enum EEntityMode { e0DElements = 0x01, eEdges = 0x02, eFaces = 0x04, eVolumes = 0x08, eAllEntity = 0x0f};
enum EQuadratic2DRepresentation { eLines = 0x01, eArcs = 0x02 };
vtkProperty* my1DExtProp;
SMESH_DeviceActor* my1DExtActor;
+ vtkProperty* my0DProp;
+ SMESH_DeviceActor* my0DActor;
+ vtkProperty* my0DExtProp;
+ SMESH_DeviceActor* my0DExtActor;
+
unsigned int myEntityMode;
unsigned int myEntityState;
bool myIsPointsVisible;
{
switch( theType )
{
+ case SMDSAbs_0DElement:
+ return VTK_VERTEX;
+
case SMDSAbs_Edge:
if( theNbNodes == 2 ) return VTK_LINE;
else if ( theNbNodes == 3 ) return VTK_QUADRATIC_EDGE;
// Calculate cells size
- static SMDSAbs_ElementType aTypes[ 3 ] = { SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Volume };
+ static SMDSAbs_ElementType aTypes[ 4 ] =
+ { SMDSAbs_0DElement, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Volume };
// get entity data
map<SMDSAbs_ElementType,int> nbEnts;
map<SMDSAbs_ElementType,TEntityList> anEnts;
- for ( int i = 0; i <= 2; i++ )
+ for ( int i = 0; i <= 3; i++ )
nbEnts[ aTypes[ i ] ] = GetEntities( aTypes[ i ], anEnts[ aTypes[ i ] ] );
// PAL16631: without swap, bad_alloc is not thrown but hung up and crash instead,
// so check remaining memory size for safety
SMDS_Mesh::CheckMemory(); // PAL16631
- vtkIdType aCellsSize = 3 * nbEnts[ SMDSAbs_Edge ];
+ vtkIdType aCellsSize = 2 * nbEnts[ SMDSAbs_0DElement ] + 3 * nbEnts[ SMDSAbs_Edge ];
- for ( int i = 1; i <= 2; i++ ) // iterate through faces and volumes
+ for ( int i = 2; i <= 3; i++ ) // iterate through faces and volumes
{
if ( nbEnts[ aTypes[ i ] ] )
{
}
}
- vtkIdType aNbCells = nbEnts[ SMDSAbs_Edge ] + nbEnts[ SMDSAbs_Face ] + nbEnts[ SMDSAbs_Volume ];
+ vtkIdType aNbCells = nbEnts[ SMDSAbs_0DElement ] + nbEnts[ SMDSAbs_Edge ] +
+ nbEnts[ SMDSAbs_Face ] + nbEnts[ SMDSAbs_Volume ];
if ( MYDEBUG )
MESSAGE( "Update - aNbCells = "<<aNbCells<<"; aCellsSize = "<<aCellsSize );
// Create cells
-
+
vtkCellArray* aConnectivity = vtkCellArray::New();
aConnectivity->Allocate( aCellsSize, 0 );
-
+
SMDS_Mesh::CheckMemory(); // PAL16631
vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
aCellTypesArray->SetNumberOfComponents( 1 );
aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
-
+
SMDS_Mesh::CheckMemory(); // PAL16631
vtkIdList *anIdList = vtkIdList::New();
SMDS_Mesh::CheckMemory(); // PAL16631
- for ( int i = 0; i <= 2; i++ ) // iterate through edges, faces and volumes
+ for ( int i = 0; i <= 3; i++ ) // iterate through 0d elements, edges, faces and volumes
{
- if( nbEnts[ aTypes[ i ] ] > 0 )
+ if ( nbEnts[ aTypes[ i ] ] > 0 )
{
const SMDSAbs_ElementType& aType = aTypes[ i ];
const TEntityList& aList = anEnts[ aType ];
for ( anIter = aList.begin(); anIter != aList.end(); ++anIter )
{
const SMDS_MeshElement* anElem = *anIter;
-
+
vtkIdType aNbNodes = anElem->NbNodes();
anIdList->SetNumberOfIds( aNbNodes );
myVTK2SMDSElems.insert( TMapOfIds::value_type( iElem, anId ) );
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
- switch(aType){
+ switch (aType) {
case SMDSAbs_Volume:{
aConnect.clear();
std::vector<int> aConnectivities;
int aType = anElem->GetType();
switch ( aType )
{
+ case SMDSAbs_0DElement : return 0;
case SMDSAbs_Edge : return 1;
case SMDSAbs_Face : return 2;
case SMDSAbs_Volume: return 3;
return myClient->NbNodes();
}
break;
+ case SMDSAbs_0DElement:
+ {
+ return myClient->Nb0DElements();
+ }
+ break;
case SMDSAbs_Edge:
{
return myClient->NbEdges();
while ( anIter->more() ) theObjs.push_back( anIter->next() );
}
break;
+ case SMDSAbs_0DElement:
+ {
+ SMDS_0DElementIteratorPtr anIter = myClient->elements0dIterator();
+ while ( anIter->more() ) theObjs.push_back( anIter->next() );
+ }
+ break;
case SMDSAbs_Edge:
{
SMDS_EdgeIteratorPtr anIter = myClient->edgesIterator();
return mySubMeshServer->GetNumberOfNodes( false );
}
break;
+ case SMDSAbs_0DElement:
case SMDSAbs_Edge:
case SMDSAbs_Face:
case SMDSAbs_Volume:
SMDS_ElemIterator.hxx \
SMDS_FacePosition.hxx \
SMDS_Mesh.hxx \
+ SMDS_Mesh0DElement.hxx \
SMDS_MeshEdge.hxx \
SMDS_MeshElement.hxx \
SMDS_MeshElementIDFactory.hxx \
SMDS_SpacePosition.cxx \
SMDS_VertexPosition.cxx \
SMDS_MeshNode.cxx \
+ SMDS_Mesh0DElement.cxx \
SMDS_MeshEdge.cxx \
SMDS_MeshFace.cxx \
SMDS_MeshVolume.cxx \
{
SMDSAbs_All,
SMDSAbs_Node,
+ SMDSAbs_0DElement,
SMDSAbs_Edge,
SMDSAbs_Face,
SMDSAbs_Volume,
// SMESH SMDS : implementaion of Salome mesh data structure
// File : SMDS_MeshElement.hxx
// Module : SMESH
-// Created: 12.01.05 18:02:52
-// Author: Michael Sazonov
-//
+// Created: 12.01.05 18:02:52
+// Author: Michael Sazonov
+
#ifndef SMDS_ElemIterator_HeaderFile
#define SMDS_ElemIterator_HeaderFile
class SMDS_MeshElement;
class SMDS_MeshNode;
+class SMDS_Mesh0DElement;
class SMDS_MeshEdge;
class SMDS_MeshFace;
class SMDS_MeshVolume;
typedef SMDS_Iterator<const SMDS_MeshNode *> SMDS_NodeIterator;
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshNode *> > SMDS_NodeIteratorPtr;
+typedef SMDS_Iterator<const SMDS_Mesh0DElement *> SMDS_0DElementIterator;
+typedef boost::shared_ptr<SMDS_Iterator<const SMDS_Mesh0DElement *> > SMDS_0DElementIteratorPtr;
+
typedef SMDS_Iterator<const SMDS_MeshEdge *> SMDS_EdgeIterator;
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshEdge *> > SMDS_EdgeIteratorPtr;
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMDS : implementaion of Salome mesh data structure
-//
+
#ifdef _MSC_VER
#pragma warning(disable:4786)
#endif
return NULL;
}
+///////////////////////////////////////////////////////////////////////////////
+/// create a Mesh0DElement and add it to the current Mesh
+/// @return : The created Mesh0DElement
+///////////////////////////////////////////////////////////////////////////////
+SMDS_Mesh0DElement* SMDS_Mesh::Add0DElementWithID(int idnode, int ID)
+{
+ SMDS_MeshNode * node = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode);
+ if (!node) return NULL;
+ return SMDS_Mesh::Add0DElementWithID(node, ID);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// create a Mesh0DElement and add it to the current Mesh
+/// @return : The created Mesh0DElement
+///////////////////////////////////////////////////////////////////////////////
+SMDS_Mesh0DElement* SMDS_Mesh::Add0DElement(const SMDS_MeshNode * node)
+{
+ return SMDS_Mesh::Add0DElementWithID(node, myElementIDFactory->GetFreeID());
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// Create a new Mesh0DElement and at it to the mesh
+/// @param idnode ID of the node
+/// @param ID ID of the 0D element to create
+/// @return The created 0D element or NULL if an element with this
+/// ID already exists or if input node is not found.
+///////////////////////////////////////////////////////////////////////////////
+SMDS_Mesh0DElement* SMDS_Mesh::Add0DElementWithID(const SMDS_MeshNode * n, int ID)
+{
+ if (!n) return 0;
+
+ if (my0DElements.Extent() % CHECKMEMORY_INTERVAL == 0) CheckMemory();
+
+ SMDS_Mesh0DElement * el0d = new SMDS_Mesh0DElement(n);
+ if (myElementIDFactory->BindID(ID, el0d)) {
+ SMDS_MeshNode *node = const_cast<SMDS_MeshNode*>(n);
+ node->AddInverseElement(el0d);
+ my0DElements.Add(el0d);
+ myInfo.myNb0DElements++;
+ return el0d;
+ }
+
+ delete el0d;
+ return NULL;
+}
+
///////////////////////////////////////////////////////////////////////////////
/// create a MeshEdge and add it to the current Mesh
/// @return : The created MeshEdge
///////////////////////////////////////////////////////////////////////////////
-SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(int idnode1, int idnode2, int ID)
+SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(int idnode1, int idnode2, int ID)
{
SMDS_MeshNode * node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1);
SMDS_MeshNode * node2 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode2);
///////////////////////////////////////////////////////////////////////////////
SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n2,
int ID)
{
if ( !n1 || !n2 ) return 0;
myEdges.Add(edge);
myInfo.myNbEdges++;
return edge;
- }
+ }
else {
delete edge;
return NULL;
/// Add a quadrangle defined by its nodes IDs
///////////////////////////////////////////////////////////////////////////////
-SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(int idnode1,
- int idnode2,
+SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(int idnode1,
+ int idnode2,
int idnode3,
- int idnode4,
+ int idnode4,
int ID)
{
SMDS_MeshNode *node1, *node2, *node3, *node4;
}
///////////////////////////////////////////////////////////////////////////////
-///Create a new tetrahedron and add it to the mesh.
-///@return The created tetrahedron
+///Create a new tetrahedron and add it to the mesh.
+///@return The created tetrahedron
///////////////////////////////////////////////////////////////////////////////
SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4)
{
}
///////////////////////////////////////////////////////////////////////////////
-///Create a new tetrahedron and add it to the mesh.
+///Create a new tetrahedron and add it to the mesh.
///@param ID The ID of the new volume
///@return The created tetrahedron or NULL if an element with this ID already exists
///or if input nodes are not found.
///////////////////////////////////////////////////////////////////////////////
-SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1,
+SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1,
int idnode2,
- int idnode3,
- int idnode4,
+ int idnode3,
+ int idnode4,
int ID)
{
SMDS_MeshNode *node1, *node2, *node3, *node4;
/// Remove an edge and all the elements which own this edge
///////////////////////////////////////////////////////////////////////////////
+void SMDS_Mesh::Remove0DElement(const SMDS_Mesh0DElement * elem0d)
+{
+ RemoveElement(elem0d,true);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// Remove an edge and all the elements which own this edge
+///////////////////////////////////////////////////////////////////////////////
+
void SMDS_Mesh::RemoveEdge(const SMDS_MeshEdge * edge)
{
RemoveElement(edge,true);
SMDS_MeshElement* elem = const_cast<SMDS_MeshElement*>(element);
switch ( elem->GetType() )
{
+ case SMDSAbs_0DElement: {
+ if ( SMDS_Mesh0DElement* elem0d = dynamic_cast<SMDS_Mesh0DElement*>( elem ))
+ Ok = elem0d->ChangeNode( nodes[0] );
+ break;
+ }
case SMDSAbs_Edge: {
if ( nbnodes == 2 ) {
if ( SMDS_MeshEdge* edge = dynamic_cast<SMDS_MeshEdge*>( elem ))
}
+//=======================================================================
+//function : Find0DElement
+//purpose :
+//=======================================================================
+const SMDS_Mesh0DElement* SMDS_Mesh::Find0DElement(int idnode) const
+{
+ const SMDS_MeshNode * node = FindNode(idnode);
+ if(node == NULL) return NULL;
+ return Find0DElement(node);
+}
+
+const SMDS_Mesh0DElement* SMDS_Mesh::Find0DElement(const SMDS_MeshNode * node)
+{
+ if (!node) return 0;
+ const SMDS_Mesh0DElement* toReturn = NULL;
+ SMDS_ElemIteratorPtr it1 = node->GetInverseElementIterator(SMDSAbs_0DElement);
+ while (it1->more() && (toReturn == NULL)) {
+ const SMDS_MeshElement* e = it1->next();
+ if (e->NbNodes() == 1) {
+ toReturn = static_cast<const SMDS_Mesh0DElement*>(e);
+ }
+ }
+ return toReturn;
+}
+
+//=======================================================================
+//function : Find0DElementOrCreate
+//purpose :
+//=======================================================================
+SMDS_Mesh0DElement* SMDS_Mesh::Find0DElementOrCreate(const SMDS_MeshNode * node)
+{
+ if (!node) return 0;
+ SMDS_Mesh0DElement * toReturn = NULL;
+ toReturn = const_cast<SMDS_Mesh0DElement*>(Find0DElement(node));
+ if (toReturn == NULL) {
+ if (my0DElements.Extent() % CHECKMEMORY_INTERVAL == 0) CheckMemory();
+ toReturn = new SMDS_Mesh0DElement(node);
+ my0DElements.Add(toReturn);
+ myInfo.myNb0DElements++;
+ }
+ return toReturn;
+}
+
+
//=======================================================================
//function : FindEdge
//purpose :
for (int inode = 0; inode < nbnodes; inode++) {
const SMDS_MeshNode * node = FindNode(nodes_ids[inode]);
if (node == NULL) return NULL;
+ poly_nodes[inode] = node;
}
return FindFace(poly_nodes);
}
while(itnode->more()) MESSAGE(itnode->next());
}
+//=======================================================================
+//function : Dump0DElements
+//purpose :
+//=======================================================================
+void SMDS_Mesh::Dump0DElements() const
+{
+ MESSAGE("dump 0D elements of mesh : ");
+ SMDS_0DElementIteratorPtr it0d = elements0dIterator();
+ while(it0d->more()) MESSAGE(it0d->next());
+}
+
//=======================================================================
//function : DumpEdges
//purpose :
MESSAGE("Debug stats of mesh : ");
MESSAGE("===== NODES ====="<<NbNodes());
+ MESSAGE("===== 0DELEMS ====="<<Nb0DElements());
MESSAGE("===== EDGES ====="<<NbEdges());
MESSAGE("===== FACES ====="<<NbFaces());
MESSAGE("===== VOLUMES ====="<<NbVolumes());
return myNodes.Size();
}
+///////////////////////////////////////////////////////////////////////////////
+/// Return the number of 0D elements
+///////////////////////////////////////////////////////////////////////////////
+int SMDS_Mesh::Nb0DElements() const
+{
+ return my0DElements.Size();
+}
+
///////////////////////////////////////////////////////////////////////////////
/// Return the number of edges (including construction edges)
///////////////////////////////////////////////////////////////////////////////
while (itn->more())
myNodeIDFactory->ReleaseID(itn->next()->GetID());
}
+
SetOfNodes::Iterator itn(myNodes);
for (; itn.More(); itn.Next())
delete itn.Value();
+ SetOf0DElements::Iterator it0d (my0DElements);
+ for (; it0d.More(); it0d.Next())
+ {
+ SMDS_MeshElement* elem = it0d.Value();
+ delete elem;
+ }
+
SetOfEdges::Iterator ite(myEdges);
for (; ite.More(); ite.Next())
{
SMDS_MeshElement* elem = itv.Value();
delete elem;
}
-
}
//================================================================================
delete ite->next();
myEdges.Clear();
+ SMDS_0DElementIteratorPtr it0d = elements0dIterator();
+ while (it0d->more())
+ delete it0d->next();
+ my0DElements.Clear();
+
SMDS_NodeIteratorPtr itn = nodesIterator();
while (itn->more())
delete itn->next();
}
};
+///////////////////////////////////////////////////////////////////////////////
+///Return an iterator on 0D elements of the current mesh.
+///////////////////////////////////////////////////////////////////////////////
+
+SMDS_0DElementIteratorPtr SMDS_Mesh::elements0dIterator() const
+{
+ typedef MYNCollection_Map_Iterator
+ < SetOf0DElements, const SMDS_Mesh0DElement*, SMDS_0DElementIterator > TIterator;
+ return SMDS_0DElementIteratorPtr(new TIterator(my0DElements));
+}
+
///////////////////////////////////////////////////////////////////////////////
///Return an iterator on edges of the current mesh.
///////////////////////////////////////////////////////////////////////////////
return SMDS_ElemIteratorPtr (new MYNCollection_Map_Iterator< SetOfFaces >(myFaces));
case SMDSAbs_Edge:
return SMDS_ElemIteratorPtr (new MYNCollection_Map_Iterator< SetOfEdges >(myEdges));
+ case SMDSAbs_0DElement:
+ return SMDS_ElemIteratorPtr (new MYNCollection_Map_Iterator< SetOf0DElements >(my0DElements));
case SMDSAbs_Node:
return myNodeIDFactory->elementsIterator();
default:;
///@param element The element were to search matching children
///@param nodes The nodes that the children must have to be selected
///////////////////////////////////////////////////////////////////////////////
-void SMDS_Mesh::addChildrenWithNodes(set<const SMDS_MeshElement*>& setOfChildren,
- const SMDS_MeshElement * element, set<const SMDS_MeshElement*>& nodes)
+void SMDS_Mesh::addChildrenWithNodes(set<const SMDS_MeshElement*>& setOfChildren,
+ const SMDS_MeshElement * element,
+ set<const SMDS_MeshElement*>& nodes)
{
-
- switch(element->GetType())
- {
- case SMDSAbs_Node:
- MESSAGE("Internal Error: This should not append");
- break;
- case SMDSAbs_Edge:
+ switch(element->GetType())
+ {
+ case SMDSAbs_Node:
+ MESSAGE("Internal Error: This should not happend");
+ break;
+ case SMDSAbs_0DElement:
+ {
+ }
+ break;
+ case SMDSAbs_Edge:
{
SMDS_ElemIteratorPtr itn=element->nodesIterator();
while(itn->more())
}
}
} break;
- case SMDSAbs_Face:
+ case SMDSAbs_Face:
{
SMDS_ElemIteratorPtr itn=element->nodesIterator();
while(itn->more())
addChildrenWithNodes(setOfChildren, ite->next(), nodes);
}
} break;
- case SMDSAbs_Volume:
+ case SMDSAbs_Volume:
{
if(hasConstructionFaces())
{
addChildrenWithNodes(setOfChildren, ite->next(), nodes);
}
}
- }
+ }
}
///////////////////////////////////////////////////////////////////////////////
///@param removenodes if true remaining nodes will be removed
///////////////////////////////////////////////////////////////////////////////
void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
- const bool removenodes)
+ const bool removenodes)
{
list<const SMDS_MeshElement *> removedElems;
list<const SMDS_MeshElement *> removedNodes;
{
// get finite elements built on elem
set<const SMDS_MeshElement*> * s1;
- if (!hasConstructionEdges() && elem->GetType() == SMDSAbs_Edge ||
- !hasConstructionFaces() && elem->GetType() == SMDSAbs_Face ||
+ if (elem->GetType() == SMDSAbs_0DElement ||
+ elem->GetType() == SMDSAbs_Edge && !hasConstructionEdges() ||
+ elem->GetType() == SMDSAbs_Face && !hasConstructionFaces() ||
elem->GetType() == SMDSAbs_Volume)
{
s1 = new set<const SMDS_MeshElement*>();
case SMDSAbs_Node:
MESSAGE("Internal Error: This should not happen");
break;
+ case SMDSAbs_0DElement:
+ my0DElements.Remove(static_cast<SMDS_Mesh0DElement*>
+ (const_cast<SMDS_MeshElement*>(*it)));
+ //myInfo.Remove0DElement(*it);
+ myInfo.remove(*it);
+ break;
case SMDSAbs_Edge:
myEdges.Remove(static_cast<SMDS_MeshEdge*>
(const_cast<SMDS_MeshElement*>(*it)));
// in meshes without descendants elements are always free
switch (aType) {
+ case SMDSAbs_0DElement:
+ my0DElements.Remove(static_cast<SMDS_Mesh0DElement*>
+ (const_cast<SMDS_MeshElement*>(elem)));
+ //myInfo.Remove0DElement(elem);
+ myInfo.remove(elem);
+ break;
case SMDSAbs_Edge:
myEdges.Remove(static_cast<SMDS_MeshEdge*>
(const_cast<SMDS_MeshElement*>(elem)));
while (itn->more())
if (elem == itn->next())
return true;
+ SMDS_0DElementIteratorPtr it0d = elements0dIterator();
+ while (it0d->more())
+ if (elem == it0d->next())
+ return true;
SMDS_EdgeIteratorPtr ite = edgesIterator();
while (ite->more())
if (elem == ite->next())
// SMESH SMDS : implementaion of Salome mesh data structure
// File : SMDS_Mesh.hxx
// Module : SMESH
-//
+
#ifndef _SMDS_Mesh_HeaderFile
#define _SMDS_Mesh_HeaderFile
#include "SMESH_SMDS.hxx"
#include "SMDS_MeshNode.hxx"
+#include "SMDS_Mesh0DElement.hxx"
#include "SMDS_MeshEdge.hxx"
#include "SMDS_MeshFace.hxx"
#include "SMDS_MeshVolume.hxx"
class SMDS_EXPORT SMDS_Mesh:public SMDS_MeshObject{
public:
-
+
SMDS_Mesh();
-
+
SMDS_NodeIteratorPtr nodesIterator() const;
+ SMDS_0DElementIteratorPtr elements0dIterator() const;
SMDS_EdgeIteratorPtr edgesIterator() const;
SMDS_FaceIteratorPtr facesIterator() const;
SMDS_VolumeIteratorPtr volumesIterator() const;
- SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type=SMDSAbs_All) const;
-
+ SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type=SMDSAbs_All) const;
+
SMDSAbs_ElementType GetElementType( const int id, const bool iselem ) const;
SMDS_Mesh *AddSubMesh();
-
+
virtual SMDS_MeshNode* AddNodeWithID(double x, double y, double z, int ID);
virtual SMDS_MeshNode* AddNode(double x, double y, double z);
-
+
+ virtual SMDS_Mesh0DElement* Add0DElementWithID(int n, int ID);
+ virtual SMDS_Mesh0DElement* Add0DElementWithID(const SMDS_MeshNode * n, int ID);
+ virtual SMDS_Mesh0DElement* Add0DElement (const SMDS_MeshNode * n);
+
virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int ID);
virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n2,
int ID);
virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2);
-
+
// 2d order edge with 3 nodes: n12 - node between n1 and n2
virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int n12, int ID);
virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
- const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n12,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n12,
int ID);
virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n3,
int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3);
-
+
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n4,
int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4);
-
+
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshEdge * e1,
const SMDS_MeshEdge * e2,
const SMDS_MeshEdge * e3, int ID);
int n12,int n23,int n31, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
- const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n3,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
- const SMDS_MeshNode * n31,
+ const SMDS_MeshNode * n31,
int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
- const SMDS_MeshNode * n41,
+ const SMDS_MeshNode * n41,
int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n4,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4);
-
+
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
int n5, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n5,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5);
-
+
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
int n5, int n6, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n6,
+ const SMDS_MeshNode * n6,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6);
-
+
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
int n5, int n6, int n7, int n8, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
- const SMDS_MeshNode * n8,
+ const SMDS_MeshNode * n8,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
- const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
- const SMDS_MeshNode * n14,
+ const SMDS_MeshNode * n14,
const SMDS_MeshNode * n24,
- const SMDS_MeshNode * n34,
+ const SMDS_MeshNode * n34,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
- const SMDS_MeshNode * n14,
+ const SMDS_MeshNode * n14,
const SMDS_MeshNode * n24,
const SMDS_MeshNode * n34);
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
- const SMDS_MeshNode * n5,
+ const SMDS_MeshNode * n5,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
- const SMDS_MeshNode * n41,
+ const SMDS_MeshNode * n41,
const SMDS_MeshNode * n15,
const SMDS_MeshNode * n25,
const SMDS_MeshNode * n35,
- const SMDS_MeshNode * n45,
+ const SMDS_MeshNode * n45,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
- const SMDS_MeshNode * n41,
+ const SMDS_MeshNode * n41,
const SMDS_MeshNode * n15,
const SMDS_MeshNode * n25,
const SMDS_MeshNode * n35,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n6,
+ const SMDS_MeshNode * n6,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
- const SMDS_MeshNode * n31,
+ const SMDS_MeshNode * n31,
const SMDS_MeshNode * n45,
const SMDS_MeshNode * n56,
- const SMDS_MeshNode * n64,
+ const SMDS_MeshNode * n64,
const SMDS_MeshNode * n14,
const SMDS_MeshNode * n25,
- const SMDS_MeshNode * n36,
+ const SMDS_MeshNode * n36,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
- const SMDS_MeshNode * n6,
+ const SMDS_MeshNode * n6,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
- const SMDS_MeshNode * n31,
+ const SMDS_MeshNode * n31,
const SMDS_MeshNode * n45,
const SMDS_MeshNode * n56,
- const SMDS_MeshNode * n64,
+ const SMDS_MeshNode * n64,
const SMDS_MeshNode * n14,
const SMDS_MeshNode * n25,
const SMDS_MeshNode * n36);
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
- const SMDS_MeshNode * n8,
+ const SMDS_MeshNode * n8,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
- const SMDS_MeshNode * n41,
+ const SMDS_MeshNode * n41,
const SMDS_MeshNode * n56,
const SMDS_MeshNode * n67,
const SMDS_MeshNode * n78,
- const SMDS_MeshNode * n85,
+ const SMDS_MeshNode * n85,
const SMDS_MeshNode * n15,
const SMDS_MeshNode * n26,
const SMDS_MeshNode * n37,
- const SMDS_MeshNode * n48,
+ const SMDS_MeshNode * n48,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
- const SMDS_MeshNode * n8,
+ const SMDS_MeshNode * n8,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
- const SMDS_MeshNode * n41,
+ const SMDS_MeshNode * n41,
const SMDS_MeshNode * n56,
const SMDS_MeshNode * n67,
const SMDS_MeshNode * n78,
- const SMDS_MeshNode * n85,
+ const SMDS_MeshNode * n85,
const SMDS_MeshNode * n15,
const SMDS_MeshNode * n26,
const SMDS_MeshNode * n37,
const bool removenodes = false);
virtual void RemoveElement(const SMDS_MeshElement * elem, bool removenodes = false);
virtual void RemoveNode(const SMDS_MeshNode * node);
+ virtual void Remove0DElement(const SMDS_Mesh0DElement * elem0d);
virtual void RemoveEdge(const SMDS_MeshEdge * edge);
virtual void RemoveFace(const SMDS_MeshFace * face);
virtual void RemoveVolume(const SMDS_MeshVolume * volume);
virtual void RemoveFreeElement(const SMDS_MeshElement * elem);
virtual void Clear();
-
+
virtual bool RemoveFromParent();
virtual bool RemoveSubMesh(const SMDS_Mesh * aMesh);
// Renumber all nodes or elements.
const SMDS_MeshNode *FindNode(int idnode) const;
+ const SMDS_Mesh0DElement* Find0DElement(int idnode) const;
const SMDS_MeshEdge *FindEdge(int idnode1, int idnode2) const;
const SMDS_MeshEdge *FindEdge(int idnode1, int idnode2, int idnode3) const;
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3) const;
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3, int idnode4,
int idnode5, int idnode6, int idnode7, int idnode8) const;
const SMDS_MeshElement *FindElement(int IDelem) const;
+ static const SMDS_Mesh0DElement* Find0DElement(const SMDS_MeshNode * n);
static const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2);
static const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1,
const SMDS_MeshInfo& GetMeshInfo() const { return myInfo; }
int NbNodes() const;
+ int Nb0DElements() const;
int NbEdges() const;
int NbFaces() const;
int NbVolumes() const;
int NbSubMesh() const;
void DumpNodes() const;
+ void Dump0DElements() const;
void DumpEdges() const;
void DumpFaces() const;
void DumpVolumes() const;
bool Contains (const SMDS_MeshElement* elem) const;
typedef NCollection_Map<SMDS_MeshNode *> SetOfNodes;
+ typedef NCollection_Map<SMDS_Mesh0DElement *> SetOf0DElements;
typedef NCollection_Map<SMDS_MeshEdge *> SetOfEdges;
typedef NCollection_Map<SMDS_MeshFace *> SetOfFaces;
typedef NCollection_Map<SMDS_MeshVolume *> SetOfVolumes;
private:
SMDS_Mesh(SMDS_Mesh * parent);
- SMDS_MeshFace * createTriangle(const SMDS_MeshNode * node1,
- const SMDS_MeshNode * node2,
+ SMDS_MeshFace * createTriangle(const SMDS_MeshNode * node1,
+ const SMDS_MeshNode * node2,
const SMDS_MeshNode * node3);
SMDS_MeshFace * createQuadrangle(const SMDS_MeshNode * node1,
- const SMDS_MeshNode * node2,
- const SMDS_MeshNode * node3,
+ const SMDS_MeshNode * node2,
+ const SMDS_MeshNode * node3,
const SMDS_MeshNode * node4);
+ SMDS_Mesh0DElement* Find0DElementOrCreate(const SMDS_MeshNode * n);
SMDS_MeshEdge* FindEdgeOrCreate(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2);
SMDS_MeshFace* FindFaceOrCreate(const SMDS_MeshNode *n1,
bool registerElement(int ID, SMDS_MeshElement * element);
- void addChildrenWithNodes(std::set<const SMDS_MeshElement*>& setOfChildren,
- const SMDS_MeshElement * element,
+ void addChildrenWithNodes(std::set<const SMDS_MeshElement*>& setOfChildren,
+ const SMDS_MeshElement * element,
std::set<const SMDS_MeshElement*>& nodes);
// Fields PRIVATE
-
+
SetOfNodes myNodes;
+ SetOf0DElements my0DElements;
SetOfEdges myEdges;
SetOfFaces myFaces;
SetOfVolumes myVolumes;
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// SMESH SMDS : implementaion of Salome mesh data structure
+// File : SMDS_Mesh0DElement.cxx
+// Author : Jean-Michel BOULCOURT
+// Module : SMESH
+
+#ifdef _MSC_VER
+#pragma warning(disable:4786)
+#endif
+
+#include "SMDS_Mesh0DElement.hxx"
+#include "SMDS_IteratorOfElements.hxx"
+#include "SMDS_MeshNode.hxx"
+
+using namespace std;
+
+//=======================================================================
+//function : SMDS_Mesh0DElement
+//purpose :
+//=======================================================================
+SMDS_Mesh0DElement::SMDS_Mesh0DElement (const SMDS_MeshNode * node)
+{
+ myNode = node;
+}
+
+//=======================================================================
+//function : Print
+//purpose :
+//=======================================================================
+void SMDS_Mesh0DElement::Print (ostream & OS) const
+{
+ OS << "0D Element <" << GetID() << "> : (" << myNode << ") " << endl;
+}
+
+//=======================================================================
+//function : NbNodes
+//purpose :
+//=======================================================================
+int SMDS_Mesh0DElement::NbNodes() const
+{
+ return 1;
+}
+
+//=======================================================================
+//function : NbEdges
+//purpose :
+//=======================================================================
+int SMDS_Mesh0DElement::NbEdges() const
+{
+ return 0;
+}
+
+//=======================================================================
+//function : GetType
+//purpose :
+//=======================================================================
+SMDSAbs_ElementType SMDS_Mesh0DElement::GetType() const
+{
+ return SMDSAbs_0DElement;
+}
+
+//=======================================================================
+//function : elementsIterator
+//purpose :
+//=======================================================================
+class SMDS_Mesh0DElement_MyNodeIterator: public SMDS_ElemIterator
+{
+ const SMDS_MeshNode * myNode;
+ int myIndex;
+ public:
+ SMDS_Mesh0DElement_MyNodeIterator(const SMDS_MeshNode * node):
+ myNode(node),myIndex(0) {}
+
+ bool more()
+ {
+ return myIndex < 1;
+ }
+
+ const SMDS_MeshElement* next()
+ {
+ myIndex++;
+ if (myIndex == 1)
+ return myNode;
+ return NULL;
+ }
+};
+
+SMDS_ElemIteratorPtr SMDS_Mesh0DElement::elementsIterator (SMDSAbs_ElementType type) const
+{
+ switch(type)
+ {
+ case SMDSAbs_0DElement:
+ return SMDS_MeshElement::elementsIterator(SMDSAbs_0DElement);
+ case SMDSAbs_Node:
+ return SMDS_ElemIteratorPtr(new SMDS_Mesh0DElement_MyNodeIterator(myNode));
+ default:
+ return SMDS_ElemIteratorPtr
+ (new SMDS_IteratorOfElements
+ (this,type, SMDS_ElemIteratorPtr(new SMDS_Mesh0DElement_MyNodeIterator(myNode))));
+ }
+}
+
+//=======================================================================
+//function : operator<
+//purpose :
+//=======================================================================
+bool operator< (const SMDS_Mesh0DElement & e1, const SMDS_Mesh0DElement & e2)
+{
+ int id1 = e1.myNode->GetID();
+ int id2 = e2.myNode->GetID();
+
+ return (id1 < id2);
+}
+
+/*!
+ * \brief Return node by its index
+ * \param ind - node index
+ * \retval const SMDS_MeshNode* - the node
+ */
+const SMDS_MeshNode* SMDS_Mesh0DElement::GetNode(const int ind) const
+{
+ if (ind == 0)
+ return myNode;
+ return NULL;
+}
+
+//=======================================================================
+//function : ChangeNode
+//purpose :
+//=======================================================================
+bool SMDS_Mesh0DElement::ChangeNode (const SMDS_MeshNode * node)
+{
+ myNode = node;
+ return true;
+}
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// SMESH SMDS : implementaion of Salome mesh data structure
+// File : SMDS_Mesh0DElement.hxx
+// Module : SMESH
+
+#ifndef _SMDS_Mesh0DElement_HeaderFile
+#define _SMDS_Mesh0DElement_HeaderFile
+
+#include "SMESH_SMDS.hxx"
+
+#include "SMDS_MeshElement.hxx"
+
+#include <iostream>
+
+class SMDS_EXPORT SMDS_Mesh0DElement: public SMDS_MeshElement
+{
+ public:
+ SMDS_Mesh0DElement (const SMDS_MeshNode * node);
+ bool ChangeNode (const SMDS_MeshNode * node);
+ void Print (std::ostream & OS) const;
+
+ SMDSAbs_ElementType GetType() const;
+ int NbNodes() const;
+ int NbEdges() const;
+ friend bool operator< (const SMDS_Mesh0DElement& e1, const SMDS_Mesh0DElement& e2);
+
+ /*!
+ * \brief Return node by its index
+ * \param ind - node index
+ * \retval const SMDS_MeshNode* - the node
+ */
+ virtual const SMDS_MeshNode* GetNode (const int ind) const;
+
+ protected:
+ SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const;
+
+ protected:
+ const SMDS_MeshNode* myNode;
+};
+
+#endif
int NbNodes() const { return myNbNodes; }
inline int NbElements(SMDSAbs_ElementType type=SMDSAbs_All) const;
+ int Nb0DElements() const { return myNb0DElements; }
inline int NbEdges (SMDSAbs_ElementOrder order = ORDER_ANY) const;
inline int NbFaces (SMDSAbs_ElementOrder order = ORDER_ANY) const;
inline int NbTriangles (SMDSAbs_ElementOrder order = ORDER_ANY) const;
int myNbNodes;
+ int myNb0DElements;
int myNbEdges , myNbQuadEdges ;
int myNbTriangles , myNbQuadTriangles ;
int myNbQuadrangles, myNbQuadQuadrangles;
inline SMDS_MeshInfo::SMDS_MeshInfo():
myNbNodes(0),
+ myNb0DElements(0),
myNbEdges (0), myNbQuadEdges (0),
myNbTriangles (0), myNbQuadTriangles (0),
myNbQuadrangles(0), myNbQuadQuadrangles(0),
myNbPolyhedrons(0)
{
// Number of nodes in standard element types
- // n v f e
- // o o a d
+ // n v f e 0
+ // o o a d d
// d l c g
// e e e
- // -----------
- // 1
+ // --------------
+ // 1 *
// 2 *
// 3 *
// 4 * * *
- // 5 *
+ // 5 *
// 6 * *
- // 7
+ // 7
// 8 * *
- // 9
- // 10 *
- // 11
- // 12
- // 13 *
- // 14
- // 15 *
- // 16
- // 17
- // 18
- // 19
+ // 9
+ // 10 *
+ // 11
+ // 12
+ // 13 *
+ // 14
+ // 15 *
+ // 16
+ // 17
+ // 18
+ // 19
// 20 *
//
// So to have a unique index for each type basing on nb of nodes, we use a shift:
myNb.resize( index( SMDSAbs_Volume,20 ) + 1, NULL);
myNb[ index( SMDSAbs_Node,1 )] = & myNbNodes;
+ myNb[ index( SMDSAbs_0DElement,1 )] = & myNb0DElements;
+
myNb[ index( SMDSAbs_Edge,2 )] = & myNbEdges;
myNb[ index( SMDSAbs_Edge,4 )] = & myNbQuadEdges;
*/
//================================================================================
+int SMESH_Mesh::Nb0DElements() throw(SALOME_Exception)
+{
+ Unexpect aCatch(SalomeException);
+ return _myMeshDS->GetMeshInfo().Nb0DElements();
+}
+
+//================================================================================
+/*!
+ * \brief Return number of edges of given order in the mesh
+ */
+//================================================================================
+
int SMESH_Mesh::NbEdges(SMDSAbs_ElementOrder order) throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
int NbNodes() throw(SALOME_Exception);
+ int Nb0DElements() throw(SALOME_Exception);
+
int NbEdges(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SALOME_Exception);
int NbFaces(SMDSAbs_ElementOrder order = ORDER_ANY) throw(SALOME_Exception);
}
+ //=======================================================================
+ //function : Add0DElementsWithID
+ //=======================================================================
+ inline void Add0DElementsWithID(SMDS_Mesh* theMesh,
+ SMESH::log_array_var& theSeq,
+ CORBA::Long theId)
+ {
+ const SMESH::long_array& anIndexes = theSeq[theId].indexes;
+ CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
+ if (2*aNbElems != anIndexes.length())
+ EXCEPTION(runtime_error,"AddEdgeWithID - 2*aNbElems != aCoords.length()");
+ CORBA::Long anIndexId = 0;
+ for (; anElemId < aNbElems; anElemId++, anIndexId+=2)
+ {
+ SMDS_MeshElement* anElem = theMesh->Add0DElementWithID(anIndexes[anIndexId+1],
+ anIndexes[anIndexId]);
+ if (!anElem)
+ EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot Add0DElementWithID for ID = "<<anElemId);
+ }
+ }
+
+
//=======================================================================
//function : AddEdgesWithID
//=======================================================================
switch(aCommand)
{
case SMESH::ADD_NODE : AddNodesWithID ( mySMDSMesh, aSeq, anId ); break;
+ case SMESH::ADD_ELEM0D : Add0DElementsWithID ( mySMDSMesh, aSeq, anId ); break;
case SMESH::ADD_EDGE : AddEdgesWithID ( mySMDSMesh, aSeq, anId ); break;
case SMESH::ADD_TRIANGLE : AddTriasWithID ( mySMDSMesh, aSeq, anId ); break;
case SMESH::ADD_QUADRANGLE : AddQuadsWithID ( mySMDSMesh, aSeq, anId ); break;
if ( MYDEBUG && mySMDSMesh )
{
MESSAGE("Update - mySMDSMesh->NbNodes() = "<<mySMDSMesh->NbNodes());
+ MESSAGE("Update - mySMDSMesh->Nb0DElements() = "<<mySMDSMesh->Nb0DElements());
MESSAGE("Update - mySMDSMesh->NbEdges() = "<<mySMDSMesh->NbEdges());
MESSAGE("Update - mySMDSMesh->NbFaces() = "<<mySMDSMesh->NbFaces());
MESSAGE("Update - mySMDSMesh->NbVolumes() = "<<mySMDSMesh->NbVolumes());
myNumber++;
}
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+void SMESHDS_Command::Add0DElement(int New0DElementID, int idnode)
+{
+ if (!myType == SMESHDS_Add0DElement)
+ {
+ MESSAGE("SMESHDS_Command::Add0DElement : Bad Type");
+ return;
+ }
+ myIntegers.push_back(New0DElementID);
+ myIntegers.push_back(idnode);
+ myNumber++;
+}
+
//=======================================================================
//function :
//purpose :
public:
SMESHDS_Command(const SMESHDS_CommandType aType);
void AddNode(int NewNodeID, double x, double y, double z);
+ void Add0DElement(int New0DElementID, int idnode);
void AddEdge(int NewEdgeID, int idnode1, int idnode2);
void AddFace(int NewFaceID, int idnode1, int idnode2, int idnode3);
void AddFace(int NewFaceID, int idnode1, int idnode2, int idnode3,
enum SMESHDS_CommandType {
SMESHDS_AddNode,
+ SMESHDS_Add0DElement,
SMESHDS_AddEdge,
SMESHDS_AddTriangle,
SMESHDS_AddQuadrangle,
myScript->Renumber( isNodes, startID, deltaID );
}
+//=======================================================================
+//function : Add0DElement
+//purpose :
+//=======================================================================
+SMDS_Mesh0DElement* SMESHDS_Mesh::Add0DElementWithID(int nodeID, int ID)
+{
+ SMDS_Mesh0DElement* anElem = SMDS_Mesh::Add0DElementWithID(nodeID, ID);
+ if (anElem) myScript->Add0DElement(ID, nodeID);
+ return anElem;
+}
+
+SMDS_Mesh0DElement* SMESHDS_Mesh::Add0DElementWithID
+ (const SMDS_MeshNode * node, int ID)
+{
+ return Add0DElementWithID(node->GetID(), ID);
+}
+
+SMDS_Mesh0DElement* SMESHDS_Mesh::Add0DElement(const SMDS_MeshNode * node)
+{
+ SMDS_Mesh0DElement* anElem = SMDS_Mesh::Add0DElement(node);
+ if (anElem) myScript->Add0DElement(anElem->GetID(), node->GetID());
+ return anElem;
+}
+
//=======================================================================
//function :AddEdgeWithID
//purpose :
#include "SMDS_Mesh.hxx"
#include "SMDS_MeshNode.hxx"
+#include "SMDS_Mesh0DElement.hxx"
#include "SMDS_MeshEdge.hxx"
#include "SMDS_MeshFace.hxx"
#include "SMDS_MeshVolume.hxx"
bool RemoveHypothesis(const TopoDS_Shape & S, const SMESHDS_Hypothesis * H);
virtual SMDS_MeshNode* AddNodeWithID(double x, double y, double z, int ID);
- virtual SMDS_MeshNode * AddNode(double x, double y, double z);
+ virtual SMDS_MeshNode* AddNode(double x, double y, double z);
+
+ virtual SMDS_Mesh0DElement* Add0DElementWithID(int nodeID, int ID);
+ virtual SMDS_Mesh0DElement* Add0DElementWithID(const SMDS_MeshNode * node, int ID);
+ virtual SMDS_Mesh0DElement* Add0DElement (const SMDS_MeshNode * node);
virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int ID);
virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
getCommand(SMESHDS_AddNode)->AddNode(NewNodeID, x, y, z);
}
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+void SMESHDS_Script::Add0DElement (int New0DElementID, int idnode)
+{
+ if (myIsEmbeddedMode) {
+ myIsModified = true;
+ return;
+ }
+ getCommand(SMESHDS_Add0DElement)->Add0DElement(New0DElementID, idnode);
+}
+
//=======================================================================
//function :
//purpose :
bool IsModified();
void AddNode(int NewNodeID, double x, double y, double z);
+ void Add0DElement(int New0DElementID, int idnode);
void AddEdge(int NewEdgeID, int idnode1, int idnode2);
void AddFace(int NewFaceID, int idnode1, int idnode2, int idnode3);
void AddFace(int NewFaceID, int idnode1, int idnode2, int idnode3,
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
unsigned int aMode = anActor->GetEntityMode();
switch(theCommandID){
+ case 216:
+ InverseEntityMode(aMode,SMESH_Actor::e0DElements);
+ break;
case 217:
InverseEntityMode(aMode,SMESH_Actor::eEdges);
break;
break;
// Display Entity
+ case 216: // 0D elements
case 217: // Edges
case 218: // Faces
case 219: // Volumes
break;
}
- case 400: // NODES
+ case 4000: // NODES
{
if(checkLock(aStudy)) break;
break;
}
- case 401: // GEOM::EDGE
+ case 4009: // ELEM0D
+ case 4010: // GEOM::EDGE
case 4021: // TRIANGLE
case 4022: // QUAD
case 4023: // POLYGON
SMDSAbs_ElementType type = SMDSAbs_Edge;
int nbNodes = 2;
switch (theCommandID) {
+ case 4009: // ELEM0D
+ type = SMDSAbs_0DElement; nbNodes = 1; break;
case 4021: // TRIANGLE
type = SMDSAbs_Face; nbNodes = 3; break;
case 4022: // QUAD
createSMESHAction( 6018, "LENGTH_2D", "ICON_LENGTH_2D", 0, true );
createSMESHAction( 6019, "CONNECTION_2D", "ICON_CONNECTION_2D", 0, true );
createSMESHAction( 6009, "VOLUME_3D", "ICON_VOLUME_3D", 0, true );
- createSMESHAction( 400, "NODE", "ICON_DLG_NODE" );
- createSMESHAction( 401, "EDGE", "ICON_DLG_EDGE" );
+ createSMESHAction( 4000, "NODE", "ICON_DLG_NODE" );
+ createSMESHAction( 4009, "ELEM0D", "ICON_DLG_ELEM0D" );
+ createSMESHAction( 4010, "EDGE", "ICON_DLG_EDGE" );
createSMESHAction( 4021, "TRIANGLE", "ICON_DLG_TRIANGLE" );
createSMESHAction( 4022, "QUAD", "ICON_DLG_QUADRANGLE" );
createSMESHAction( 4023, "POLYGON", "ICON_DLG_POLYGON" );
createSMESHAction( 213, "SHRINK", "ICON_SHRINK", 0, true );
createSMESHAction( 214, "UPDATE", "ICON_UPDATE" );
createSMESHAction( 215, "NODES", "ICON_POINTS", 0, true );
+ createSMESHAction( 216, "ELEMS0D", "ICON_DLG_ELEM0D", 0, true );
createSMESHAction( 217, "EDGES", "ICON_DLG_EDGE", 0, true );
createSMESHAction( 218, "FACES", "ICON_DLG_TRIANGLE", 0, true );
createSMESHAction( 219, "VOLUMES", "ICON_DLG_TETRAS", 0, true );
createMenu( 6021, ctrlId, -1 );
createMenu( separator(), ctrlId, -1 );
- createMenu( 400, addId, -1 );
- createMenu( 401, addId, -1 );
+ createMenu( 4000, addId, -1 );
+ createMenu( 4009, addId, -1 );
+ createMenu( 4010, addId, -1 );
createMenu( 4021, addId, -1 );
createMenu( 4022, addId, -1 );
createMenu( 4023, addId, -1 );
createTool( 6021, ctrlTb );
createTool( separator(), ctrlTb );
- createTool( 400, addRemTb );
- createTool( 401, addRemTb );
+ createTool( 4000, addRemTb );
+ createTool( 4009, addRemTb );
+ createTool( 4010, addRemTb );
createTool( 4021, addRemTb );
createTool( 4022, addRemTb );
createTool( 4023, addRemTb );
hasNodes("(numberOfNodes > 0 )"),//&& isVisible)"),
hasElems("(count( elemTypes ) > 0)"),
hasDifferentElems("(count( elemTypes ) > 1)"),
+ hasElems0d("({'Elem0d'} in elemTypes)"),
hasEdges("({'Edge'} in elemTypes)"),
hasFaces("({'Face'} in elemTypes)"),
hasVolumes("({'Volume'} in elemTypes)");
anId = popupMgr()->insert( tr( "MEN_DISP_ENT" ), -1, -1 );
+ popupMgr()->insert( action(216), anId, -1 ); // ELEMS 0D
+ popupMgr()->setRule(action(216), aDiffElemsInVTK + "&& isVisible &&" + hasElems0d, QtxPopupMgr::VisibleRule);
+ popupMgr()->setRule(action(216), "{'Elem0d'} in entityMode", QtxPopupMgr::ToggleRule);
+
popupMgr()->insert( action( 217 ), anId, -1 ); // EDGES
popupMgr()->setRule( action( 217 ), aDiffElemsInVTK + "&& isVisible &&" + hasEdges, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 217 ), "{'Edge'} in entityMode", QtxPopupMgr::ToggleRule );
int elemGroup = addPreference( tr( "PREF_GROUP_ELEMENTS" ), meshTab );
setPreferenceProperty( elemGroup, "columns", 2 );
- addPreference( tr( "PREF_FILL" ), elemGroup, LightApp_Preferences::Color, "SMESH", "fill_color" );
- addPreference( tr( "PREF_OUTLINE" ), elemGroup, LightApp_Preferences::Color, "SMESH", "outline_color" );
+ addPreference( tr( "PREF_FILL" ), elemGroup, LightApp_Preferences::Color, "SMESH", "fill_color" );
+ addPreference( tr( "PREF_OUTLINE" ), elemGroup, LightApp_Preferences::Color, "SMESH", "outline_color" );
addPreference( tr( "PREF_BACKFACE" ), elemGroup, LightApp_Preferences::Color, "SMESH", "backface_color" );
+ addPreference( tr( "PREF_COLOR_0D" ), elemGroup, LightApp_Preferences::Color, "SMESH", "elem0d_color" );
+
+ //int sp = addPreference( "", elemGroup, LightApp_Preferences::Space );
+ //setPreferenceProperty( sp, "hstretch", 0 );
+ //setPreferenceProperty( sp, "vstretch", 0 );
+
+ int size0d = addPreference(tr("PREF_SIZE_0D"), elemGroup,
+ LightApp_Preferences::IntSpin, "SMESH", "elem0d_size");
int sp = addPreference( "", elemGroup, LightApp_Preferences::Space );
+ int elemW = addPreference(tr("PREF_WIDTH"), elemGroup,
+ LightApp_Preferences::IntSpin, "SMESH", "element_width");
+ int shrink = addPreference(tr("PREF_SHRINK_COEFF"), elemGroup,
+ LightApp_Preferences::IntSpin, "SMESH", "shrink_coeff");
+
+ setPreferenceProperty( size0d, "min", 1 );
+ setPreferenceProperty( size0d, "max", 10 );
setPreferenceProperty( sp, "hstretch", 0 );
setPreferenceProperty( sp, "vstretch", 0 );
- int elemW = addPreference( tr( "PREF_WIDTH" ), elemGroup, LightApp_Preferences::IntSpin, "SMESH", "element_width" );
- int shrink = addPreference( tr( "PREF_SHRINK_COEFF" ), elemGroup, LightApp_Preferences::IntSpin, "SMESH", "shrink_coeff" );
-
setPreferenceProperty( elemW, "min", 1 );
setPreferenceProperty( elemW, "max", 5 );
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_AddMeshElementDlg.cxx
// Author : Nicolas REJNERI, Open CASCADE S.A.S.
+
// SMESH includes
-//
#include "SMESHGUI_AddMeshElementDlg.h"
#include "SMESHGUI.h"
// purpose : constructor
//=================================================================================
SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
- SMDSAbs_ElementType ElementType,
+ SMDSAbs_ElementType ElementType,
int nbNodes )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
myNbNodes = nbNodes;
myElementType = ElementType;
switch (ElementType) {
+ case SMDSAbs_0DElement:
+ if (myNbNodes != 1)
+ myNbNodes = 1;
+ break;
case SMDSAbs_Face:
// if (myNbNodes != 3 && myNbNodes != 4)
// myNbNodes = 3;
}
QString elemName;
- if (myNbNodes == 2) {
+ if (myNbNodes == 1) {
+ elemName = "ELEM0D";
+ myHelpFileName = "adding_nodes_and_elements_page.html#adding_0delems_anchor";
+ }
+ else if (myNbNodes == 2) {
elemName = "EDGE";
myHelpFileName = "adding_nodes_and_elements_page.html#adding_edges_anchor";
}
elemName = "TRIANGLE";
myHelpFileName = "adding_nodes_and_elements_page.html#adding_triangles_anchor";
}
- else if (myNbNodes == 4)
+ else if (myNbNodes == 4) {
if (myElementType == SMDSAbs_Face) {
elemName = "QUADRANGLE";
myHelpFileName = "adding_nodes_and_elements_page.html#adding_quadrangles_anchor";
elemName = "TETRAS";
myHelpFileName = "adding_nodes_and_elements_page.html#adding_tetrahedrons_anchor";
}
+ }
else if (myNbNodes == 8) {
elemName = "HEXAS";
myHelpFileName = "adding_nodes_and_elements_page.html#adding_hexahedrons_anchor";
else if (myElementType == SMDSAbs_Volume) {
myHelpFileName = "adding_nodes_and_elements_page.html#adding_polyhedrons_anchor";
}
-
+
QString iconName = tr(QString("ICON_DLG_%1").arg(elemName).toLatin1().data());
QString buttonGrTitle = tr(QString("SMESH_%1").arg(elemName).toLatin1().data());
QString caption = tr(QString("SMESH_ADD_%1_TITLE").arg(elemName).toLatin1().data());
{
if (myNbOkNodes && !mySMESHGUI->isActiveStudyLocked()) {
myBusy = true;
- SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
- anArrayOfIdeces->length(myNbNodes);
+ SMESH::long_array_var anArrayOfIndices = new SMESH::long_array;
+ anArrayOfIndices->length(myNbNodes);
bool reverse = (Reverse && Reverse->isChecked());
QStringList aListId = myEditCurrentArgument->text().split(" ", QString::SkipEmptyParts);
for (int i = 0; i < aListId.count(); i++)
if (reverse)
- anArrayOfIdeces[i] = aListId[ myNbNodes - i - 1 ].toInt();
+ anArrayOfIndices[i] = aListId[ myNbNodes - i - 1 ].toInt();
else
- anArrayOfIdeces[i] = aListId[ i ].toInt();
+ anArrayOfIndices[i] = aListId[ i ].toInt();
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
switch (myElementType) {
+ case SMDSAbs_0DElement:
+ aMeshEditor->Add0DElement(anArrayOfIndices[0]); break;
case SMDSAbs_Edge:
- aMeshEditor->AddEdge(anArrayOfIdeces.inout()); break;
- case SMDSAbs_Face:{
+ aMeshEditor->AddEdge(anArrayOfIndices.inout()); break;
+ case SMDSAbs_Face: {
if(myIsPoly)
- aMeshEditor->AddPolygonalFace(anArrayOfIdeces.inout());
+ aMeshEditor->AddPolygonalFace(anArrayOfIndices.inout());
else
- aMeshEditor->AddFace(anArrayOfIdeces.inout());
+ aMeshEditor->AddFace(anArrayOfIndices.inout());
break;
-
}
case SMDSAbs_Volume:
- aMeshEditor->AddVolume(anArrayOfIdeces.inout()); break;
+ aMeshEditor->AddVolume(anArrayOfIndices.inout()); break;
default:;
}
void SMESHGUI_AddMeshElementDlg::ClickOnHelp()
{
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
- if (app)
- app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
+ if (app)
+ app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""),
+ myHelpFileName);
else {
QString platform;
#ifdef WIN32
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
platform)).
arg(myHelpFileName));
}
if (aMesh) {
TColStd_MapOfInteger newIndices;
-
+
QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
bool allOk = true;
for (int i = 0; i < aListId.count(); i++) {
else
allOk = false;
}
-
+
mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->highlight( myActor->getIO(), true, true );
-
+
myNbOkNodes = ( allOk && myNbNodes == aListId.count() );
-
+
if (myIsPoly)
{
if ( !allOk || myElementType != SMDSAbs_Face || aListId.count() < 3 )
myNbOkNodes = aListId.count();
}
}
-
+
if(myNbOkNodes) {
buttonOk->setEnabled(true);
buttonApply->setEnabled(true);
displaySimulation();
}
-
+
myBusy = false;
}
QDialog::keyPressEvent( e );
if ( e->isAccepted() )
return;
-
+
if ( e->key() == Qt::Key_F1 ) {
e->accept();
ClickOnHelp();
// --> nodes
QLabel* myMeshNbNodesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), myMeshWidget);
- myMeshNbNodes = new QLabel(myMeshWidget);
+ myMeshNbNodes = new QLabel(myMeshWidget);
myMeshNbNodes->setMinimumWidth(100);
+ QFrame* line12 = new QFrame(myMeshWidget);
+ line12->setFrameStyle(QFrame::HLine | QFrame::Sunken);
+
+ // --> 0D elements
+ QLabel* myMeshNb0DElemsLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_0DELEMS")), myMeshWidget);
+ myMeshNb0DElems = new QLabel(myMeshWidget);
+ myMeshNb0DElems->setMinimumWidth(100);
// --> header with orders
QLabel* myMeshOrder0Lab = new QLabel(tr("SMESH_MESHINFO_ORDER0"), myMeshWidget);
aMeshLayout->addWidget(line1, 1, 0, 1, 2);
aMeshLayout->addWidget(myMeshNbNodesLab, 2, 0);
aMeshLayout->addWidget(myMeshNbNodes, 2, 1);
- aMeshLayout->addWidget(myMeshOrder0Lab, 3, 1);
- aMeshLayout->addWidget(myMeshOrder1Lab, 3, 2);
- aMeshLayout->addWidget(myMeshOrder2Lab, 3, 3);
- aMeshLayout->addWidget(myMeshNbEdgesLab, 4, 0);
- aMeshLayout->addWidget(myMeshNbEdges, 4, 1);
- aMeshLayout->addWidget(myMeshNbEdges1, 4, 2);
- aMeshLayout->addWidget(myMeshNbEdges2, 4, 3);
- aMeshLayout->addWidget(myMeshFacesGroup, 5, 0, 1, 4);
- aMeshLayout->addWidget(myMeshVolumesGroup, 6, 0, 1, 4);
- aMeshLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 7, 0);
+ aMeshLayout->addWidget(line12, 3, 0, 1, 2);
+ aMeshLayout->addWidget(myMeshNb0DElemsLab, 4, 0);
+ aMeshLayout->addWidget(myMeshNb0DElems, 4, 1);
+ aMeshLayout->addWidget(myMeshOrder0Lab, 5, 1);
+ aMeshLayout->addWidget(myMeshOrder1Lab, 5, 2);
+ aMeshLayout->addWidget(myMeshOrder2Lab, 5, 3);
+ aMeshLayout->addWidget(myMeshNbEdgesLab, 6, 0);
+ aMeshLayout->addWidget(myMeshNbEdges, 6, 1);
+ aMeshLayout->addWidget(myMeshNbEdges1, 6, 2);
+ aMeshLayout->addWidget(myMeshNbEdges2, 6, 3);
+ aMeshLayout->addWidget(myMeshFacesGroup, 7, 0, 1, 4);
+ aMeshLayout->addWidget(myMeshVolumesGroup, 8, 0, 1, 4);
+ aMeshLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 9, 0);
// submesh
mySubMeshWidget = new QWidget(myWGStack);
mySubMeshNbElements->setMinimumWidth(100);
mySubMeshNbElements->setFont(fnt);
+ // --> 0D elements
+ QLabel* mySubMeshNb0DElemsLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_0DELEMS")), mySubMeshElementsGroup);
+ mySubMeshNb0DElems = new QLabel(mySubMeshElementsGroup);
+ mySubMeshNb0DElems->setMinimumWidth(100);
+
// --> elements --> edges
QLabel* mySubMeshNbEdgesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), mySubMeshElementsGroup);
mySubMeshNbEdges = new QLabel(mySubMeshElementsGroup);
mySubMeshElementsGroupLayout->addWidget(mySubMeshNbElementsLab, 0, 0);
mySubMeshElementsGroupLayout->addWidget(mySubMeshNbElements, 0, 1);
- mySubMeshElementsGroupLayout->addWidget(mySubMeshNbEdgesLab, 1, 0);
- mySubMeshElementsGroupLayout->addWidget(mySubMeshNbEdges, 1, 1);
- mySubMeshElementsGroupLayout->addWidget(mySubMeshNbFacesLab, 2, 0);
- mySubMeshElementsGroupLayout->addWidget(mySubMeshNbFaces, 2, 1);
- mySubMeshElementsGroupLayout->addWidget(mySubMeshNbVolumesLab, 3, 0);
- mySubMeshElementsGroupLayout->addWidget(mySubMeshNbVolumes, 3, 1);
+ mySubMeshElementsGroupLayout->addWidget(mySubMeshNb0DElemsLab, 1, 0);
+ mySubMeshElementsGroupLayout->addWidget(mySubMeshNb0DElems, 1, 1);
+ mySubMeshElementsGroupLayout->addWidget(mySubMeshNbEdgesLab, 2, 0);
+ mySubMeshElementsGroupLayout->addWidget(mySubMeshNbEdges, 2, 1);
+ mySubMeshElementsGroupLayout->addWidget(mySubMeshNbFacesLab, 3, 0);
+ mySubMeshElementsGroupLayout->addWidget(mySubMeshNbFaces, 3, 1);
+ mySubMeshElementsGroupLayout->addWidget(mySubMeshNbVolumesLab, 4, 0);
+ mySubMeshElementsGroupLayout->addWidget(mySubMeshNbVolumes, 4, 1);
aSubMeshLayout->addWidget(mySubMeshNameLab, 0, 0);
aSubMeshLayout->addWidget(mySubMeshName, 0, 1);
setWindowTitle(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_OBJECT_MESH") + "]");
myMeshName->setText(aSO->GetName().c_str());
myMeshNbNodes->setNum((int)aMesh->NbNodes());
+ myMeshNb0DElems->setNum((int)aMesh->Nb0DElements());
myMeshNbEdges->setNum((int)aMesh->NbEdges());
myMeshNbEdges1->setNum((int)aMesh->NbEdgesOfOrder(SMESH::ORDER_LINEAR));
myMeshNbEdges2->setNum((int)aMesh->NbEdgesOfOrder(SMESH::ORDER_QUADRATIC));
mySubMeshName->setText(aSO->GetName().c_str());
mySubMeshNbNodes->setNum((int)aSubMesh->GetNumberOfNodes(true));
mySubMeshNbElements->setNum((int)aSubMesh->GetNumberOfElements());
+ mySubMeshNb0DElems->setNum((int)(aSubMesh->GetElementsByType(SMESH::ELEM0D)->length()));
mySubMeshNbEdges->setNum((int)(aSubMesh->GetElementsByType(SMESH::EDGE)->length()));
mySubMeshNbFaces->setNum((int)(aSubMesh->GetElementsByType(SMESH::FACE)->length()));
mySubMeshNbVolumes->setNum((int)(aSubMesh->GetElementsByType(SMESH::VOLUME)->length()));
switch (aType) {
case SMESH::NODE:
strType = "SMESH_MESHINFO_NODES"; break;
+ case SMESH::ELEM0D:
+ strType = "SMESH_MESHINFO_0DELEMS"; break;
case SMESH::EDGE:
strType = "SMESH_MESHINFO_EDGES"; break;
case SMESH::FACE:
QWidget* myMeshWidget;
QLabel* myMeshName;
QLabel* myMeshNbNodes;
+ QLabel* myMeshNb0DElems;
QLabel* myMeshNbEdges;
QLabel* myMeshNbEdges1;
QLabel* myMeshNbEdges2;
QLabel* mySubMeshNbNodes;
QGroupBox* mySubMeshElementsGroup;
QLabel* mySubMeshNbElements;
+ QLabel* mySubMeshNb0DElems;
QLabel* mySubMeshNbEdges;
QLabel* mySubMeshNbFaces;
QLabel* mySubMeshNbVolumes;
//=======================================================================
//function : elemTypes
-//purpose : may return {'Edge' 'Face' 'Volume'} at most
+//purpose : may return {'Elem0d' 'Edge' 'Face' 'Volume'} at most
//=======================================================================
QList<QVariant> SMESHGUI_Selection::elemTypes( int ind ) const
if ( actor ) {
TVisualObjPtr object = actor->GetObject();
if ( object ) {
+ if ( object->GetNbEntities( SMDSAbs_0DElement )) types.append( "Elem0d" );
if ( object->GetNbEntities( SMDSAbs_Edge )) types.append( "Edge" );
if ( object->GetNbEntities( SMDSAbs_Face )) types.append( "Face" );
if ( object->GetNbEntities( SMDSAbs_Volume )) types.append( "Volume" );
//=======================================================================
//function : entityMode
-//purpose : may return {'Edge' 'Face' 'Volume'} at most
+//purpose : may return {'Elem0d' 'Edge' 'Face' 'Volume'} at most
//=======================================================================
QList<QVariant> SMESHGUI_Selection::entityMode( int ind ) const
SMESH_Actor* actor = getActor( ind );
if ( actor ) {
unsigned int aMode = actor->GetEntityMode();
- if ( aMode & SMESH_Actor::eVolumes) types.append( "Volume");
- if ( aMode & SMESH_Actor::eFaces ) types.append( "Face" );
- if ( aMode & SMESH_Actor::eEdges ) types.append( "Edge" );
+ if ( aMode & SMESH_Actor::eVolumes ) types.append( "Volume" );
+ if ( aMode & SMESH_Actor::eFaces ) types.append( "Face" );
+ if ( aMode & SMESH_Actor::eEdges ) types.append( "Edge" );
+ if ( aMode & SMESH_Actor::e0DElements ) types.append( "Elem0d" );
}
return types;
}
int SW = mgr->integerValue( "SMESH", "selection_width", 5 ),
PW = mgr->integerValue( "SMESH", "highlight_width", 5 );
+ // adjust highlight_width to the width of mesh entities
+ int aPointSize = mgr->integerValue("SMESH", "node_size", 3);
+ int aElem0DSize = mgr->integerValue("SMESH", "elem0d_size", 5);
+ int aLineWidth = mgr->integerValue("SMESH", "element_width", 1);
+ int maxSize = aPointSize;
+ if (aElem0DSize > maxSize) maxSize = aElem0DSize;
+ if (aLineWidth > maxSize) maxSize = aLineWidth;
+ if (PW < maxSize + 2) PW = maxSize + 2;
+
double SP1 = mgr->doubleValue( "SMESH", "selection_precision_node", 0.025 ),
SP2 = mgr->doubleValue( "SMESH", "selection_precision_element", 0.001 ),
SP3 = mgr->doubleValue( "SMESH", "selection_precision_object", 0.025 );
if(e->GetType() == SMDSAbs_Node) {
anInfo+=tr("MESH_NODE")+"<br>";
//const SMDS_MeshNode *en = (SMDS_MeshNode*) e; // VSR: not used!
+ } else if (e->GetType() == SMDSAbs_0DElement) {
+ anInfo+=tr("SMESH_ELEM0D")+"<br>";
} else if(e->GetType() == SMDSAbs_Edge) {
anInfo+=tr("SMESH_EDGE")+"<br>";
anInfo+="<b>" + tr("SMESH_MESHINFO_TYPE")+":</b> ";
<source>ICON_DLG_BUILD_COMPOUND_MESH</source>
<translation>mesh_build_compound.png</translation>
</message>
+ <message>
+ <source>ICON_DLG_ELEM0D</source>
+ <translation>mesh_vertex.png</translation>
+ </message>
<message>
<source>ICON_DLG_EDGE</source>
<translation>mesh_line.png</translation>
<source>MEN_DISP_ENT</source>
<translation>Display Entity</translation>
</message>
+ <message>
+ <source>MEN_ELEM0D</source>
+ <translation>0D Element</translation>
+ </message>
+ <message>
+ <source>MEN_ELEMS0D</source>
+ <translation>0D Elements</translation>
+ </message>
<message>
<source>MEN_EDGE</source>
<translation>Edge</translation>
<source>SMESH_ADD_ALGORITHM_TITLE</source>
<translation>Algorithms Assignation</translation>
</message>
+ <message>
+ <source>SMESH_ADD_ELEM0D</source>
+ <translation>Add 0D Element</translation>
+ </message>
+ <message>
+ <source>SMESH_ADD_ELEM0D_TITLE</source>
+ <translation>Add 0D Element</translation>
+ </message>
<message>
<source>SMESH_ADD_EDGE</source>
<translation>Add Edge</translation>
<source>SMESH_DZ</source>
<translation>dZ</translation>
</message>
+ <message>
+ <source>SMESH_ELEM0D</source>
+ <translation>0D Element</translation>
+ </message>
<message>
<source>SMESH_EDGE</source>
<translation>Edge</translation>
<source>SMESH_MESH</source>
<translation>Mesh</translation>
</message>
+ <message>
+ <source>SMESH_MESHINFO_0DELEMS</source>
+ <translation>0D Elements</translation>
+ </message>
<message>
<source>SMESH_MESHINFO_ALL_TYPES</source>
<translation>Heterogenous</translation>
<source>STB_DISP_ENT</source>
<translation>Display entity</translation>
</message>
+ <message>
+ <source>STB_ELEM0D</source>
+ <translation>0D Element</translation>
+ </message>
+ <message>
+ <source>STB_ELEMS0D</source>
+ <translation>0D Elements</translation>
+ </message>
<message>
<source>STB_EDGE</source>
<translation>Edge</translation>
<source>TOP_DISP_ENT</source>
<translation>Display entity</translation>
</message>
+ <message>
+ <source>TOP_ELEM0D</source>
+ <translation>0D Element</translation>
+ </message>
+ <message>
+ <source>TOP_ELEMS0D</source>
+ <translation>0D Elements</translation>
+ </message>
<message>
<source>TOP_EDGE</source>
<translation>Edge</translation>
<source>PREF_TITLE_COLOR</source>
<translation>Title color</translation>
</message>
+ <message>
+ <source>PREF_COLOR_0D</source>
+ <translation>0D elements</translation>
+ </message>
+ <message>
+ <source>PREF_SIZE_0D</source>
+ <translation>Size of 0D elements</translation>
+ </message>
<message>
<source>PREF_WIDTH</source>
<translation>Width</translation>
static TStringSet sameMethods;
if ( sameMethods.empty() ) {
const char * names[] = {
- "RemoveElements","RemoveNodes","AddNode","AddEdge","AddFace","AddPolygonalFace",
+ "RemoveElements","RemoveNodes","AddNode","Add0DElement","AddEdge","AddFace","AddPolygonalFace",
"AddVolume","AddPolyhedralVolume","AddPolyhedralVolumeByFaces","MoveNode", "MoveClosestNodeToPoint",
"InverseDiag","DeleteDiag","Reorient","ReorientObject","TriToQuad","SplitQuad","SplitQuadObject",
"BestSplit","Smooth","SmoothObject","SmoothParametric","SmoothParametricObject",
#include "SMESH_MeshEditor_i.hxx"
+#include "SMDS_Mesh0DElement.hxx"
#include "SMDS_MeshEdge.hxx"
#include "SMDS_MeshFace.hxx"
#include "SMDS_MeshVolume.hxx"
*/
//=============================================================================
+CORBA::Long SMESH_MeshEditor_i::AddNode(CORBA::Double x,
+ CORBA::Double y, CORBA::Double z)
+{
+ initData();
+
+ const SMDS_MeshNode* N = GetMeshDS()->AddNode(x, y, z);
+
+ // Update Python script
+ TPythonDump() << "nodeID = " << this << ".AddNode( "
+ << x << ", " << y << ", " << z << " )";
+
+ return N->GetID();
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+CORBA::Long SMESH_MeshEditor_i::Add0DElement(CORBA::Long IDOfNode)
+{
+ initData();
+
+ const SMDS_MeshNode* aNode = GetMeshDS()->FindNode(IDOfNode);
+ SMDS_MeshElement* elem = GetMeshDS()->Add0DElement(aNode);
+
+ // Update Python script
+ TPythonDump() << "elem0d = " << this << ".Add0DElement( " << IDOfNode <<" )";
+
+ if (elem)
+ return elem->GetID();
+
+ return 0;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
CORBA::Long SMESH_MeshEditor_i::AddEdge(const SMESH::long_array & IDsOfNodes)
{
initData();
return 0;
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
-CORBA::Long SMESH_MeshEditor_i::AddNode(CORBA::Double x,
- CORBA::Double y, CORBA::Double z)
-{
- initData();
-
- const SMDS_MeshNode* N = GetMeshDS()->AddNode(x, y, z);
-
- // Update Python script
- TPythonDump() << "nodeID = " << this << ".AddNode( "
- << x << ", " << y << ", " << z << " )";
-
- return N->GetID();
-}
-
//=============================================================================
/*!
* AddFace
* Returns ID of created element or 0 if element not created
*/
CORBA::Long AddNode(CORBA::Double x, CORBA::Double y, CORBA::Double z);
+ CORBA::Long Add0DElement(CORBA::Long IDOfNode);
CORBA::Long AddEdge(const SMESH::long_array & IDsOfNodes);
CORBA::Long AddFace(const SMESH::long_array & IDsOfNodes);
CORBA::Long AddPolygonalFace(const SMESH::long_array & IDsOfNodes);
return NbEdges() + NbFaces() + NbVolumes();
}
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+CORBA::Long SMESH_Mesh_i::Nb0DElements()throw (SALOME::SALOME_Exception)
+{
+ Unexpect aCatch(SALOME_SalomeException);
+ return _impl->Nb0DElements();
+}
+
//=============================================================================
/*!
*
CORBA::Long NbElements()
throw (SALOME::SALOME_Exception);
+ CORBA::Long Nb0DElements()
+ throw (SALOME::SALOME_Exception);
+
CORBA::Long NbEdges()
throw (SALOME::SALOME_Exception);
def NbElements(self):
return self.mesh.NbElements()
+ ## Returns the number of 0d elements in the mesh
+ # @return an integer value
+ # @ingroup l1_meshinfo
+ def Nb0DElements(self):
+ return self.mesh.Nb0DElements()
+
## Returns the number of edges in the mesh
# @return an integer value
# @ingroup l1_meshinfo
self.mesh.SetParameters(Parameters)
return self.editor.AddNode( x, y, z)
+ ## Creates a 0D element on a node with given number.
+ # @param IDOfNode the ID of node for creation of the element.
+ # @return the Id of the new 0D element
+ # @ingroup l2_modif_add
+ def Add0DElement(self, IDOfNode):
+ return self.editor.Add0DElement(IDOfNode)
+
## Creates a linear or quadratic edge (this is determined
# by the number of given nodes).
# @param IDsOfNodes the list of node IDs for creation of the element.