+
+\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
+Apply and Close button. Your 0D element will be created:
+
+\image html add_0delement.png
+
\anchor adding_edges_anchor
Adding edges
@@ -137,4 +150,4 @@ button. If you've managed to obtain the necessary result, click the
\image html add_polyhedron.png
-*/
\ No newline at end of file
+*/
diff --git a/idl/SMESH_Mesh.idl b/idl/SMESH_Mesh.idl
index fa5180a24..b27bff80d 100644
--- a/idl/SMESH_Mesh.idl
+++ b/idl/SMESH_Mesh.idl
@@ -46,6 +46,7 @@ module SMESH
enum log_command
{
ADD_NODE,
+ ADD_ELEM0D,
ADD_EDGE,
ADD_TRIANGLE,
ADD_QUADRANGLE,
@@ -110,6 +111,7 @@ module SMESH
{
ALL,
NODE,
+ ELEM0D,
EDGE,
FACE,
VOLUME
@@ -532,6 +534,9 @@ module SMESH
long NbElements()
raises (SALOME::SALOME_Exception);
+ long Nb0DElements()
+ raises (SALOME::SALOME_Exception);
+
long NbEdges()
raises (SALOME::SALOME_Exception);
diff --git a/idl/SMESH_MeshEditor.idl b/idl/SMESH_MeshEditor.idl
index 21ea8a5dd..b1b36c257 100644
--- a/idl/SMESH_MeshEditor.idl
+++ b/idl/SMESH_MeshEditor.idl
@@ -41,6 +41,12 @@ module SMESH
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).
diff --git a/resources/SalomeApp.xml b/resources/SalomeApp.xml
index 37f3d3ab1..3dba06efd 100644
--- a/resources/SalomeApp.xml
+++ b/resources/SalomeApp.xml
@@ -31,8 +31,10 @@
+
+
diff --git a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx
index 99f892d14..145a13c93 100644
--- a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx
+++ b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx
@@ -395,6 +395,16 @@ DriverMED_R_SMESHDS_Mesh
//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],
@@ -680,11 +690,8 @@ DriverMED_R_SMESHDS_Mesh
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"< T0DElementIterator;
typedef TypedElemIterator< SMDS_EdgeIteratorPtr > TEdgeIterator;
typedef TypedElemIterator< SMDS_FaceIteratorPtr > TFaceIterator;
typedef TypedElemIterator< SMDS_VolumeIteratorPtr > TVolumeIterator;
@@ -422,10 +424,12 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
// 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();
@@ -533,6 +537,13 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
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
@@ -635,6 +646,10 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
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;
diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx
index 36a44924d..f86a577f1 100644
--- a/src/OBJECT/SMESH_Actor.cxx
+++ b/src/OBJECT/SMESH_Actor.cxx
@@ -120,17 +120,18 @@ SMESH_ActorDef::SMESH_ActorDef()
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();
@@ -194,7 +195,7 @@ SMESH_ActorDef::SMESH_ActorDef()
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);
@@ -242,8 +243,49 @@ SMESH_ActorDef::SMESH_ActorDef()
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]);
@@ -288,23 +330,25 @@ SMESH_ActorDef::SMESH_ActorDef()
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();
@@ -461,6 +505,12 @@ SMESH_ActorDef::~SMESH_ActorDef()
myNodeProp->Delete();
myNodeExtProp->Delete();
+ my0DProp->Delete();
+ my0DActor->Delete();
+
+ //my0DExtProp->Delete();
+ //my0DExtActor->Delete();
+
my1DProp->Delete();
my1DActor->Delete();
@@ -479,7 +529,7 @@ SMESH_ActorDef::~SMESH_ActorDef()
myHighlitableActor->Delete();
- //Deleting of pints numbering pipeline
+ //Deleting of points numbering pipeline
//---------------------------------------
myPointsNumDataSet->Delete();
@@ -621,6 +671,7 @@ SetControlMode(eControl theMode,
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);
@@ -806,6 +857,9 @@ void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
theRenderer->AddActor(my1DActor);
theRenderer->AddActor(my1DExtActor);
+ theRenderer->AddActor(my0DActor);
+ //theRenderer->AddActor(my0DExtActor);
+
theRenderer->AddActor(myHighlitableActor);
theRenderer->AddActor2D(myScalarBarActor);
@@ -827,6 +881,9 @@ void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){
theRenderer->RemoveActor(myHighlitableActor);
+ theRenderer->RemoveActor(my0DActor);
+ //theRenderer->RemoveActor(my0DExtActor);
+
theRenderer->RemoveActor(my1DActor);
theRenderer->RemoveActor(my1DExtActor);
@@ -859,6 +916,9 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
myNodeExtActor->Init(myVisualObj,myImplicitBoolean);
+ my0DActor->Init(myVisualObj,myImplicitBoolean);
+ //my0DExtActor->Init(myVisualObj,myImplicitBoolean);
+
my1DActor->Init(myVisualObj,myImplicitBoolean);
my1DExtActor->Init(myVisualObj,myImplicitBoolean);
@@ -866,6 +926,9 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
my2DExtActor->Init(myVisualObj,myImplicitBoolean);
my3DActor->Init(myVisualObj,myImplicitBoolean);
+ my0DActor->GetMapper()->SetLookupTable(myLookupTable);
+ //my0DExtActor->GetMapper()->SetLookupTable(myLookupTable);
+
my1DActor->GetMapper()->SetLookupTable(myLookupTable);
my1DExtActor->GetMapper()->SetLookupTable(myLookupTable);
@@ -931,6 +994,9 @@ void SMESH_ActorDef::SetTransform(VTKViewer_Transform* theTransform){
myNodeExtActor->SetTransform(theTransform);
+ my0DActor->SetTransform(theTransform);
+ //my0DExtActor->SetTransform(theTransform);
+
my1DActor->SetTransform(theTransform);
my1DExtActor->SetTransform(theTransform);
@@ -1060,6 +1126,9 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
myNodeExtActor->VisibilityOff();
+ my0DActor->VisibilityOff();
+ //my0DExtActor->VisibilityOff();
+
my1DActor->VisibilityOff();
my1DExtActor->VisibilityOff();
@@ -1102,6 +1171,10 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
myNodeActor->VisibilityOn();
}
+ if(myEntityMode & e0DElements){
+ my0DActor->VisibilityOn();
+ }
+
if(myEntityMode & eEdges){
my1DActor->VisibilityOn();
}
@@ -1127,25 +1200,34 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
}
-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;
@@ -1168,8 +1250,13 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
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);
@@ -1178,7 +1265,7 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
}
- if(myEntityMode & eFaces){
+ if (myEntityMode & eFaces) {
if (MYDEBUG) MESSAGE("FACES");
aFilter->RegisterCellsWithType(VTK_TRIANGLE);
aFilter->RegisterCellsWithType(VTK_POLYGON);
@@ -1193,7 +1280,7 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
}
- if(myEntityMode & eVolumes){
+ if (myEntityMode & eVolumes) {
if (MYDEBUG) MESSAGE("VOLUMES");
aFilter->RegisterCellsWithType(VTK_TETRA);
aFilter->RegisterCellsWithType(VTK_VOXEL);
@@ -1220,37 +1307,39 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
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();
}
}
@@ -1261,7 +1350,7 @@ void SMESH_ActorDef::SetRepresentation(int theMode){
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);
@@ -1278,7 +1367,7 @@ void SMESH_ActorDef::SetRepresentation(int theMode){
aBackProp = myBackSurfaceProp;
aReperesent = SMESH_DeviceActor::eSurface;
break;
- }
+ }
my2DActor->SetProperty(aProp);
my2DActor->SetBackfaceProperty(aBackProp);
@@ -1295,9 +1384,16 @@ void SMESH_ActorDef::SetRepresentation(int theMode){
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:
@@ -1311,14 +1407,13 @@ void SMESH_ActorDef::SetRepresentation(int theMode){
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())
@@ -1567,8 +1662,12 @@ void SMESH_ActorDef::SetLineWidth(vtkFloatingPointType theVal){
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);
@@ -1593,27 +1692,28 @@ IsImplicitFunctionUsed() const
}
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);
diff --git a/src/OBJECT/SMESH_Actor.h b/src/OBJECT/SMESH_Actor.h
index 111b55c16..99005dcf1 100644
--- a/src/OBJECT/SMESH_Actor.h
+++ b/src/OBJECT/SMESH_Actor.h
@@ -74,7 +74,7 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
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 };
diff --git a/src/OBJECT/SMESH_ActorDef.h b/src/OBJECT/SMESH_ActorDef.h
index 1dbb7435c..dbbe0a5bb 100644
--- a/src/OBJECT/SMESH_ActorDef.h
+++ b/src/OBJECT/SMESH_ActorDef.h
@@ -233,6 +233,11 @@ class SMESH_ActorDef : public SMESH_Actor
vtkProperty* my1DExtProp;
SMESH_DeviceActor* my1DExtActor;
+ vtkProperty* my0DProp;
+ SMESH_DeviceActor* my0DActor;
+ vtkProperty* my0DExtProp;
+ SMESH_DeviceActor* my0DExtActor;
+
unsigned int myEntityMode;
unsigned int myEntityState;
bool myIsPointsVisible;
diff --git a/src/OBJECT/SMESH_Object.cxx b/src/OBJECT/SMESH_Object.cxx
index c286fcc7e..5f12330ef 100644
--- a/src/OBJECT/SMESH_Object.cxx
+++ b/src/OBJECT/SMESH_Object.cxx
@@ -86,6 +86,9 @@ static inline vtkIdType getCellType( const SMDSAbs_ElementType theType,
{
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;
@@ -295,22 +298,23 @@ void SMESH_VisualObjDef::buildElemPrs()
// 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 nbEnts;
map 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 ] ] )
{
@@ -321,22 +325,23 @@ void SMESH_VisualObjDef::buildElemPrs()
}
}
- 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 = "<more()) MESSAGE(it0d->next());
+}
+
//=======================================================================
//function : DumpEdges
//purpose :
@@ -1750,6 +1866,7 @@ void SMDS_Mesh::DebugStats() const
MESSAGE("Debug stats of mesh : ");
MESSAGE("===== NODES ====="<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())
{
@@ -1883,7 +2016,6 @@ SMDS_Mesh::~SMDS_Mesh()
SMDS_MeshElement* elem = itv.Value();
delete elem;
}
-
}
//================================================================================
@@ -1921,6 +2053,11 @@ void SMDS_Mesh::Clear()
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();
@@ -2048,6 +2185,17 @@ struct MYNCollection_Map_Iterator: public FATHER
}
};
+///////////////////////////////////////////////////////////////////////////////
+///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.
///////////////////////////////////////////////////////////////////////////////
@@ -2095,6 +2243,8 @@ SMDS_ElemIteratorPtr SMDS_Mesh::elementsIterator(SMDSAbs_ElementType type) const
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:;
@@ -2184,16 +2334,20 @@ static set * getExclusiveNodes(
///@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& setOfChildren,
- const SMDS_MeshElement * element, set& nodes)
+void SMDS_Mesh::addChildrenWithNodes(set& setOfChildren,
+ const SMDS_MeshElement * element,
+ set& 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())
@@ -2206,7 +2360,7 @@ void SMDS_Mesh::addChildrenWithNodes(set& setOfChildren
}
}
} break;
- case SMDSAbs_Face:
+ case SMDSAbs_Face:
{
SMDS_ElemIteratorPtr itn=element->nodesIterator();
while(itn->more())
@@ -2225,7 +2379,7 @@ void SMDS_Mesh::addChildrenWithNodes(set& setOfChildren
addChildrenWithNodes(setOfChildren, ite->next(), nodes);
}
} break;
- case SMDSAbs_Volume:
+ case SMDSAbs_Volume:
{
if(hasConstructionFaces())
{
@@ -2240,7 +2394,7 @@ void SMDS_Mesh::addChildrenWithNodes(set& setOfChildren
addChildrenWithNodes(setOfChildren, ite->next(), nodes);
}
}
- }
+ }
}
///////////////////////////////////////////////////////////////////////////////
@@ -2248,7 +2402,7 @@ void SMDS_Mesh::addChildrenWithNodes(set& setOfChildren
///@param removenodes if true remaining nodes will be removed
///////////////////////////////////////////////////////////////////////////////
void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
- const bool removenodes)
+ const bool removenodes)
{
list removedElems;
list removedNodes;
@@ -2268,8 +2422,9 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
{
// get finite elements built on elem
set * 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();
@@ -2319,6 +2474,12 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
case SMDSAbs_Node:
MESSAGE("Internal Error: This should not happen");
break;
+ case SMDSAbs_0DElement:
+ my0DElements.Remove(static_cast
+ (const_cast(*it)));
+ //myInfo.Remove0DElement(*it);
+ myInfo.remove(*it);
+ break;
case SMDSAbs_Edge:
myEdges.Remove(static_cast
(const_cast(*it)));
@@ -2395,6 +2556,12 @@ void SMDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elem)
// in meshes without descendants elements are always free
switch (aType) {
+ case SMDSAbs_0DElement:
+ my0DElements.Remove(static_cast
+ (const_cast(elem)));
+ //myInfo.Remove0DElement(elem);
+ myInfo.remove(elem);
+ break;
case SMDSAbs_Edge:
myEdges.Remove(static_cast
(const_cast(elem)));
@@ -2430,6 +2597,10 @@ bool SMDS_Mesh::Contains (const SMDS_MeshElement* elem) const
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())
diff --git a/src/SMDS/SMDS_Mesh.hxx b/src/SMDS/SMDS_Mesh.hxx
index ab76e9b9c..df4a2b356 100644
--- a/src/SMDS/SMDS_Mesh.hxx
+++ b/src/SMDS/SMDS_Mesh.hxx
@@ -22,13 +22,14 @@
// 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"
@@ -43,34 +44,39 @@
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,
@@ -79,23 +85,23 @@ public:
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);
@@ -117,10 +123,10 @@ public:
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,
@@ -135,11 +141,11 @@ public:
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,
@@ -154,27 +160,27 @@ public:
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,
@@ -182,7 +188,7 @@ public:
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,
@@ -190,7 +196,7 @@ public:
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,
@@ -200,7 +206,7 @@ public:
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,
@@ -251,13 +257,13 @@ public:
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,
@@ -266,7 +272,7 @@ public:
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);
@@ -279,15 +285,15 @@ public:
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,
@@ -297,7 +303,7 @@ public:
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,
@@ -315,29 +321,29 @@ public:
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);
@@ -356,19 +362,19 @@ public:
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,
@@ -377,15 +383,15 @@ public:
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,
@@ -419,6 +425,7 @@ public:
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);
@@ -430,7 +437,7 @@ public:
virtual void RemoveFreeElement(const SMDS_MeshElement * elem);
virtual void Clear();
-
+
virtual bool RemoveFromParent();
virtual bool RemoveSubMesh(const SMDS_Mesh * aMesh);
@@ -445,6 +452,7 @@ public:
// 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;
@@ -454,6 +462,7 @@ public:
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,
@@ -499,11 +508,13 @@ public:
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;
@@ -527,6 +538,7 @@ public:
bool Contains (const SMDS_MeshElement* elem) const;
typedef NCollection_Map SetOfNodes;
+ typedef NCollection_Map SetOf0DElements;
typedef NCollection_Map SetOfEdges;
typedef NCollection_Map SetOfFaces;
typedef NCollection_Map SetOfVolumes;
@@ -534,13 +546,14 @@ public:
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,
@@ -553,13 +566,14 @@ private:
bool registerElement(int ID, SMDS_MeshElement * element);
- void addChildrenWithNodes(std::set& setOfChildren,
- const SMDS_MeshElement * element,
+ void addChildrenWithNodes(std::set& setOfChildren,
+ const SMDS_MeshElement * element,
std::set& nodes);
// Fields PRIVATE
-
+
SetOfNodes myNodes;
+ SetOf0DElements my0DElements;
SetOfEdges myEdges;
SetOfFaces myFaces;
SetOfVolumes myVolumes;
diff --git a/src/SMDS/SMDS_Mesh0DElement.cxx b/src/SMDS/SMDS_Mesh0DElement.cxx
new file mode 100644
index 000000000..b4fbe8bc4
--- /dev/null
+++ b/src/SMDS/SMDS_Mesh0DElement.cxx
@@ -0,0 +1,155 @@
+// 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;
+}
diff --git a/src/SMDS/SMDS_Mesh0DElement.hxx b/src/SMDS/SMDS_Mesh0DElement.hxx
new file mode 100644
index 000000000..93a204934
--- /dev/null
+++ b/src/SMDS/SMDS_Mesh0DElement.hxx
@@ -0,0 +1,61 @@
+// 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
+
+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
diff --git a/src/SMDS/SMDS_MeshInfo.hxx b/src/SMDS/SMDS_MeshInfo.hxx
index 91613bb5d..222782488 100644
--- a/src/SMDS/SMDS_MeshInfo.hxx
+++ b/src/SMDS/SMDS_MeshInfo.hxx
@@ -42,6 +42,7 @@ public:
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;
@@ -69,6 +70,7 @@ private:
int myNbNodes;
+ int myNb0DElements;
int myNbEdges , myNbQuadEdges ;
int myNbTriangles , myNbQuadTriangles ;
int myNbQuadrangles, myNbQuadQuadrangles;
@@ -86,6 +88,7 @@ private:
inline SMDS_MeshInfo::SMDS_MeshInfo():
myNbNodes(0),
+ myNb0DElements(0),
myNbEdges (0), myNbQuadEdges (0),
myNbTriangles (0), myNbQuadTriangles (0),
myNbQuadrangles(0), myNbQuadQuadrangles(0),
@@ -97,30 +100,30 @@ inline SMDS_MeshInfo::SMDS_MeshInfo():
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:
@@ -131,6 +134,8 @@ inline SMDS_MeshInfo::SMDS_MeshInfo():
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;
diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx
index 88bb601e0..bba940ee6 100644
--- a/src/SMESH/SMESH_Mesh.cxx
+++ b/src/SMESH/SMESH_Mesh.cxx
@@ -1192,6 +1192,18 @@ int SMESH_Mesh::NbNodes() throw(SALOME_Exception)
*/
//================================================================================
+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);
diff --git a/src/SMESH/SMESH_Mesh.hxx b/src/SMESH/SMESH_Mesh.hxx
index 0ece936c2..284bf89a7 100644
--- a/src/SMESH/SMESH_Mesh.hxx
+++ b/src/SMESH/SMESH_Mesh.hxx
@@ -202,6 +202,8 @@ public:
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);
diff --git a/src/SMESHClient/SMESH_Client.cxx b/src/SMESHClient/SMESH_Client.cxx
index af83fe041..e62753123 100644
--- a/src/SMESHClient/SMESH_Client.cxx
+++ b/src/SMESHClient/SMESH_Client.cxx
@@ -103,6 +103,28 @@ namespace
}
+ //=======================================================================
+ //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 = "<NbNodes() = "<NbNodes());
+ MESSAGE("Update - mySMDSMesh->Nb0DElements() = "<Nb0DElements());
MESSAGE("Update - mySMDSMesh->NbEdges() = "<NbEdges());
MESSAGE("Update - mySMDSMesh->NbFaces() = "<NbFaces());
MESSAGE("Update - mySMDSMesh->NbVolumes() = "<NbVolumes());
diff --git a/src/SMESHDS/SMESHDS_Command.cxx b/src/SMESHDS/SMESHDS_Command.cxx
index be0e5e632..ab46ee27b 100644
--- a/src/SMESHDS/SMESHDS_Command.cxx
+++ b/src/SMESHDS/SMESHDS_Command.cxx
@@ -84,6 +84,22 @@ void SMESHDS_Command::MoveNode(int NodeID, double x, double y, double z)
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 :
diff --git a/src/SMESHDS/SMESHDS_Command.hxx b/src/SMESHDS/SMESHDS_Command.hxx
index 09d720b9a..d425a054a 100644
--- a/src/SMESHDS/SMESHDS_Command.hxx
+++ b/src/SMESHDS/SMESHDS_Command.hxx
@@ -38,6 +38,7 @@ class SMESHDS_EXPORT SMESHDS_Command
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,
diff --git a/src/SMESHDS/SMESHDS_CommandType.hxx b/src/SMESHDS/SMESHDS_CommandType.hxx
index bafaba863..a033961bc 100644
--- a/src/SMESHDS/SMESHDS_CommandType.hxx
+++ b/src/SMESHDS/SMESHDS_CommandType.hxx
@@ -30,6 +30,7 @@
enum SMESHDS_CommandType {
SMESHDS_AddNode,
+ SMESHDS_Add0DElement,
SMESHDS_AddEdge,
SMESHDS_AddTriangle,
SMESHDS_AddQuadrangle,
diff --git a/src/SMESHDS/SMESHDS_Mesh.cxx b/src/SMESHDS/SMESHDS_Mesh.cxx
index 63ebf3dba..ff27ae915 100644
--- a/src/SMESHDS/SMESHDS_Mesh.cxx
+++ b/src/SMESHDS/SMESHDS_Mesh.cxx
@@ -248,6 +248,30 @@ void SMESHDS_Mesh::Renumber (const bool isNodes, const int startID, const int de
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 :
diff --git a/src/SMESHDS/SMESHDS_Mesh.hxx b/src/SMESHDS/SMESHDS_Mesh.hxx
index d3df2e688..4c1398fef 100644
--- a/src/SMESHDS/SMESHDS_Mesh.hxx
+++ b/src/SMESHDS/SMESHDS_Mesh.hxx
@@ -30,6 +30,7 @@
#include "SMDS_Mesh.hxx"
#include "SMDS_MeshNode.hxx"
+#include "SMDS_Mesh0DElement.hxx"
#include "SMDS_MeshEdge.hxx"
#include "SMDS_MeshFace.hxx"
#include "SMDS_MeshVolume.hxx"
@@ -66,7 +67,11 @@ public:
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,
diff --git a/src/SMESHDS/SMESHDS_Script.cxx b/src/SMESHDS/SMESHDS_Script.cxx
index 9b6daa8b1..3d379c4b0 100644
--- a/src/SMESHDS/SMESHDS_Script.cxx
+++ b/src/SMESHDS/SMESHDS_Script.cxx
@@ -95,6 +95,19 @@ void SMESHDS_Script::AddNode(int NewNodeID, double x, double y, double z)
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 :
diff --git a/src/SMESHDS/SMESHDS_Script.hxx b/src/SMESHDS/SMESHDS_Script.hxx
index 808066bc3..9e01fc01c 100644
--- a/src/SMESHDS/SMESHDS_Script.hxx
+++ b/src/SMESHDS/SMESHDS_Script.hxx
@@ -44,6 +44,7 @@ class SMESHDS_EXPORT SMESHDS_Script
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,
diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx
index 8904fb435..4561074f7 100644
--- a/src/SMESHGUI/SMESHGUI.cxx
+++ b/src/SMESHGUI/SMESHGUI.cxx
@@ -508,6 +508,9 @@
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;
@@ -1467,6 +1470,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
break;
// Display Entity
+ case 216: // 0D elements
case 217: // Edges
case 218: // Faces
case 219: // Volumes
@@ -1571,7 +1575,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
break;
}
- case 400: // NODES
+ case 4000: // NODES
{
if(checkLock(aStudy)) break;
@@ -2192,7 +2196,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
break;
}
- case 401: // GEOM::EDGE
+ case 4009: // ELEM0D
+ case 4010: // GEOM::EDGE
case 4021: // TRIANGLE
case 4022: // QUAD
case 4023: // POLYGON
@@ -2205,6 +2210,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
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
@@ -2729,8 +2736,9 @@ void SMESHGUI::initialize( CAM_Application* app )
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" );
@@ -2767,6 +2775,7 @@ void SMESHGUI::initialize( CAM_Application* app )
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 );
@@ -2883,8 +2892,9 @@ void SMESHGUI::initialize( CAM_Application* app )
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 );
@@ -2977,8 +2987,9 @@ void SMESHGUI::initialize( CAM_Application* app )
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 );
@@ -3111,6 +3122,7 @@ void SMESHGUI::initialize( CAM_Application* app )
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)");
@@ -3169,6 +3181,10 @@ void SMESHGUI::initialize( CAM_Application* app )
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 );
@@ -3580,17 +3596,29 @@ void SMESHGUI::createPreferences()
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 );
diff --git a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx
index 97e393a24..fd617e809 100644
--- a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx
+++ b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx
@@ -22,8 +22,8 @@
// 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"
@@ -236,7 +236,7 @@ namespace SMESH
// purpose : constructor
//=================================================================================
SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
- SMDSAbs_ElementType ElementType,
+ SMDSAbs_ElementType ElementType,
int nbNodes )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
@@ -255,6 +255,10 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* 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;
@@ -269,7 +273,11 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
}
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";
}
@@ -277,7 +285,7 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
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";
@@ -286,6 +294,7 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
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";
@@ -298,7 +307,7 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule,
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());
@@ -439,30 +448,31 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply()
{
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:;
}
@@ -515,8 +525,9 @@ void SMESHGUI_AddMeshElementDlg::ClickOnCancel()
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
@@ -526,7 +537,7 @@ void SMESHGUI_AddMeshElementDlg::ClickOnHelp()
#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));
}
@@ -555,7 +566,7 @@ void SMESHGUI_AddMeshElementDlg::onTextChange (const QString& theNewText)
if (aMesh) {
TColStd_MapOfInteger newIndices;
-
+
QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
bool allOk = true;
for (int i = 0; i < aListId.count(); i++) {
@@ -567,13 +578,13 @@ void SMESHGUI_AddMeshElementDlg::onTextChange (const QString& theNewText)
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 )
@@ -582,13 +593,13 @@ void SMESHGUI_AddMeshElementDlg::onTextChange (const QString& theNewText)
myNbOkNodes = aListId.count();
}
}
-
+
if(myNbOkNodes) {
buttonOk->setEnabled(true);
buttonApply->setEnabled(true);
displaySimulation();
}
-
+
myBusy = false;
}
@@ -795,7 +806,7 @@ void SMESHGUI_AddMeshElementDlg::keyPressEvent( QKeyEvent* e )
QDialog::keyPressEvent( e );
if ( e->isAccepted() )
return;
-
+
if ( e->key() == Qt::Key_F1 ) {
e->accept();
ClickOnHelp();
diff --git a/src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx
index 005183023..c8c3072d3 100644
--- a/src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx
+++ b/src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx
@@ -126,8 +126,15 @@ SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg(SMESHGUI* theModule):
// --> 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);
@@ -290,16 +297,19 @@ SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg(SMESHGUI* theModule):
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);
@@ -331,6 +341,11 @@ SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg(SMESHGUI* theModule):
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);
@@ -348,12 +363,14 @@ SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg(SMESHGUI* theModule):
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);
@@ -466,6 +483,7 @@ void SMESHGUI_MeshInfosDlg::DumpMeshInfos()
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));
@@ -504,6 +522,7 @@ void SMESHGUI_MeshInfosDlg::DumpMeshInfos()
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()));
@@ -519,6 +538,8 @@ void SMESHGUI_MeshInfosDlg::DumpMeshInfos()
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:
diff --git a/src/SMESHGUI/SMESHGUI_MeshInfosDlg.h b/src/SMESHGUI/SMESHGUI_MeshInfosDlg.h
index b2b84c9e6..c05a2c39a 100644
--- a/src/SMESHGUI/SMESHGUI_MeshInfosDlg.h
+++ b/src/SMESHGUI/SMESHGUI_MeshInfosDlg.h
@@ -75,6 +75,7 @@ private:
QWidget* myMeshWidget;
QLabel* myMeshName;
QLabel* myMeshNbNodes;
+ QLabel* myMeshNb0DElems;
QLabel* myMeshNbEdges;
QLabel* myMeshNbEdges1;
QLabel* myMeshNbEdges2;
@@ -112,6 +113,7 @@ private:
QLabel* mySubMeshNbNodes;
QGroupBox* mySubMeshElementsGroup;
QLabel* mySubMeshNbElements;
+ QLabel* mySubMeshNb0DElems;
QLabel* mySubMeshNbEdges;
QLabel* mySubMeshNbFaces;
QLabel* mySubMeshNbVolumes;
diff --git a/src/SMESHGUI/SMESHGUI_Selection.cxx b/src/SMESHGUI/SMESHGUI_Selection.cxx
index d3b80a7c4..ba08f5570 100644
--- a/src/SMESHGUI/SMESHGUI_Selection.cxx
+++ b/src/SMESHGUI/SMESHGUI_Selection.cxx
@@ -142,7 +142,7 @@ SMESH_Actor* SMESHGUI_Selection::getActor( int ind ) const
//=======================================================================
//function : elemTypes
-//purpose : may return {'Edge' 'Face' 'Volume'} at most
+//purpose : may return {'Elem0d' 'Edge' 'Face' 'Volume'} at most
//=======================================================================
QList SMESHGUI_Selection::elemTypes( int ind ) const
@@ -152,6 +152,7 @@ QList 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" );
@@ -231,7 +232,7 @@ QString SMESHGUI_Selection::shrinkMode( int ind ) const
//=======================================================================
//function : entityMode
-//purpose : may return {'Edge' 'Face' 'Volume'} at most
+//purpose : may return {'Elem0d' 'Edge' 'Face' 'Volume'} at most
//=======================================================================
QList SMESHGUI_Selection::entityMode( int ind ) const
@@ -240,9 +241,10 @@ QList 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;
}
diff --git a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx
index 9289f0108..f4c7e00ae 100644
--- a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx
+++ b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx
@@ -810,6 +810,15 @@ namespace SMESH
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 );
diff --git a/src/SMESHGUI/SMESHGUI_WhatIsDlg.cxx b/src/SMESHGUI/SMESHGUI_WhatIsDlg.cxx
index 1af954d48..57830cefb 100755
--- a/src/SMESHGUI/SMESHGUI_WhatIsDlg.cxx
+++ b/src/SMESHGUI/SMESHGUI_WhatIsDlg.cxx
@@ -443,6 +443,8 @@ void SMESHGUI_WhatIsDlg::SelectionIntoArgument()
if(e->GetType() == SMDSAbs_Node) {
anInfo+=tr("MESH_NODE")+" ";
//const SMDS_MeshNode *en = (SMDS_MeshNode*) e; // VSR: not used!
+ } else if (e->GetType() == SMDSAbs_0DElement) {
+ anInfo+=tr("SMESH_ELEM0D")+" ";
} else if(e->GetType() == SMDSAbs_Edge) {
anInfo+=tr("SMESH_EDGE")+" ";
anInfo+="" + tr("SMESH_MESHINFO_TYPE")+": ";
diff --git a/src/SMESHGUI/SMESH_images.ts b/src/SMESHGUI/SMESH_images.ts
index 0319ce689..c2569ba1a 100644
--- a/src/SMESHGUI/SMESH_images.ts
+++ b/src/SMESHGUI/SMESH_images.ts
@@ -109,6 +109,10 @@
mesh_build_compound.png
+
+
+ mesh_vertex.png
+ mesh_line.png
diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts
index edde69cc3..ab6fe272b 100644
--- a/src/SMESHGUI/SMESH_msg_en.ts
+++ b/src/SMESHGUI/SMESH_msg_en.ts
@@ -261,6 +261,14 @@
Display Entity
+
+
+ 0D Element
+
+
+
+ 0D Elements
+ Edge
@@ -739,6 +747,14 @@ Please enter correct values and try again
Algorithms Assignation
+
+
+ Add 0D Element
+
+
+
+ Add 0D Element
+ Add Edge
@@ -1063,6 +1079,10 @@ so that the application may crash. Do you wish to continue visualization?SMESH_DZ
dZ
+
+
+ 0D Element
+ Edge
@@ -1404,6 +1424,10 @@ Are you sure want to export to MED 2.1 ?
Mesh
+
+
+ 0D Elements
+ Heterogenous
@@ -2071,6 +2095,14 @@ Consider saving your work before application crash
Display entity
+
+
+ 0D Element
+
+
+
+ 0D Elements
+ Edge
@@ -2557,6 +2589,14 @@ Consider saving your work before application crash
Display entity
+
+
+ 0D Element
+
+
+
+ 0D Elements
+ Edge
@@ -3127,6 +3167,14 @@ Please, create VTK viewer and try again
Title color
+
+
+ 0D elements
+
+
+
+ Size of 0D elements
+ Width
diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx
index 82264dd10..077766762 100644
--- a/src/SMESH_I/SMESH_2smeshpy.cxx
+++ b/src/SMESH_I/SMESH_2smeshpy.cxx
@@ -1066,7 +1066,7 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
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",
diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx
index 0463ee5d2..428aacbc9 100644
--- a/src/SMESH_I/SMESH_MeshEditor_i.cxx
+++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx
@@ -26,6 +26,7 @@
#include "SMESH_MeshEditor_i.hxx"
+#include "SMDS_Mesh0DElement.hxx"
#include "SMDS_MeshEdge.hxx"
#include "SMDS_MeshFace.hxx"
#include "SMDS_MeshVolume.hxx"
@@ -319,6 +320,47 @@ CORBA::Boolean SMESH_MeshEditor_i::RemoveNodes(const SMESH::long_array & IDsOfNo
*/
//=============================================================================
+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();
@@ -353,26 +395,6 @@ CORBA::Long SMESH_MeshEditor_i::AddEdge(const SMESH::long_array & IDsOfNodes)
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
diff --git a/src/SMESH_I/SMESH_MeshEditor_i.hxx b/src/SMESH_I/SMESH_MeshEditor_i.hxx
index 81411fe36..9943e74cb 100644
--- a/src/SMESH_I/SMESH_MeshEditor_i.hxx
+++ b/src/SMESH_I/SMESH_MeshEditor_i.hxx
@@ -55,6 +55,7 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
* 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);
diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx
index 2aee2fa97..6673da334 100644
--- a/src/SMESH_I/SMESH_Mesh_i.cxx
+++ b/src/SMESH_I/SMESH_Mesh_i.cxx
@@ -2416,6 +2416,17 @@ CORBA::Long SMESH_Mesh_i::NbElements()throw (SALOME::SALOME_Exception)
return NbEdges() + NbFaces() + NbVolumes();
}
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+CORBA::Long SMESH_Mesh_i::Nb0DElements()throw (SALOME::SALOME_Exception)
+{
+ Unexpect aCatch(SALOME_SalomeException);
+ return _impl->Nb0DElements();
+}
+
//=============================================================================
/*!
*
diff --git a/src/SMESH_I/SMESH_Mesh_i.hxx b/src/SMESH_I/SMESH_Mesh_i.hxx
index 2915d4091..a79c3c21a 100644
--- a/src/SMESH_I/SMESH_Mesh_i.hxx
+++ b/src/SMESH_I/SMESH_Mesh_i.hxx
@@ -227,6 +227,9 @@ public:
CORBA::Long NbElements()
throw (SALOME::SALOME_Exception);
+ CORBA::Long Nb0DElements()
+ throw (SALOME::SALOME_Exception);
+
CORBA::Long NbEdges()
throw (SALOME::SALOME_Exception);
diff --git a/src/SMESH_SWIG/smeshDC.py b/src/SMESH_SWIG/smeshDC.py
index d7a72c7dd..9bf05b303 100644
--- a/src/SMESH_SWIG/smeshDC.py
+++ b/src/SMESH_SWIG/smeshDC.py
@@ -1600,6 +1600,12 @@ class Mesh:
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
@@ -1938,6 +1944,13 @@ class Mesh:
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.