diff --git a/doc/salome/gui/SMESH/images/a-createpolyhedralvolume.png b/doc/salome/gui/SMESH/images/a-createpolyhedralvolume.png
index 009f71d51..6c6bb615d 100755
Binary files a/doc/salome/gui/SMESH/images/a-createpolyhedralvolume.png and b/doc/salome/gui/SMESH/images/a-createpolyhedralvolume.png differ
diff --git a/doc/salome/gui/SMESH/images/add0delement.png b/doc/salome/gui/SMESH/images/add0delement.png
index d3d8da302..ed27488c9 100644
Binary files a/doc/salome/gui/SMESH/images/add0delement.png and b/doc/salome/gui/SMESH/images/add0delement.png differ
diff --git a/doc/salome/gui/SMESH/images/add_ball.png b/doc/salome/gui/SMESH/images/add_ball.png
new file mode 100644
index 000000000..1fe4f645c
Binary files /dev/null and b/doc/salome/gui/SMESH/images/add_ball.png differ
diff --git a/doc/salome/gui/SMESH/images/addball.png b/doc/salome/gui/SMESH/images/addball.png
new file mode 100644
index 000000000..c38c9faf8
Binary files /dev/null and b/doc/salome/gui/SMESH/images/addball.png differ
diff --git a/doc/salome/gui/SMESH/images/addedge.png b/doc/salome/gui/SMESH/images/addedge.png
index 34f4fe07a..7a5a03063 100755
Binary files a/doc/salome/gui/SMESH/images/addedge.png and b/doc/salome/gui/SMESH/images/addedge.png differ
diff --git a/doc/salome/gui/SMESH/images/addhexahedron.png b/doc/salome/gui/SMESH/images/addhexahedron.png
index 65d881f86..0cf7fe819 100755
Binary files a/doc/salome/gui/SMESH/images/addhexahedron.png and b/doc/salome/gui/SMESH/images/addhexahedron.png differ
diff --git a/doc/salome/gui/SMESH/images/addnode.png b/doc/salome/gui/SMESH/images/addnode.png
index bbde71e6a..1fd9a9f8a 100755
Binary files a/doc/salome/gui/SMESH/images/addnode.png and b/doc/salome/gui/SMESH/images/addnode.png differ
diff --git a/doc/salome/gui/SMESH/images/addpolygon.png b/doc/salome/gui/SMESH/images/addpolygon.png
index 71b81ecca..200999d8d 100755
Binary files a/doc/salome/gui/SMESH/images/addpolygon.png and b/doc/salome/gui/SMESH/images/addpolygon.png differ
diff --git a/doc/salome/gui/SMESH/images/addquadrangle.png b/doc/salome/gui/SMESH/images/addquadrangle.png
index 3dccce258..bd2462273 100755
Binary files a/doc/salome/gui/SMESH/images/addquadrangle.png and b/doc/salome/gui/SMESH/images/addquadrangle.png differ
diff --git a/doc/salome/gui/SMESH/images/addtetrahedron.png b/doc/salome/gui/SMESH/images/addtetrahedron.png
index 0289a95e4..0a6a74084 100755
Binary files a/doc/salome/gui/SMESH/images/addtetrahedron.png and b/doc/salome/gui/SMESH/images/addtetrahedron.png differ
diff --git a/doc/salome/gui/SMESH/images/addtriangle.png b/doc/salome/gui/SMESH/images/addtriangle.png
index 991085fd1..67682c8cf 100755
Binary files a/doc/salome/gui/SMESH/images/addtriangle.png and b/doc/salome/gui/SMESH/images/addtriangle.png differ
diff --git a/doc/salome/gui/SMESH/images/image146.png b/doc/salome/gui/SMESH/images/image146.png
index 521513c60..a952f5fcc 100755
Binary files a/doc/salome/gui/SMESH/images/image146.png and b/doc/salome/gui/SMESH/images/image146.png differ
diff --git a/doc/salome/gui/SMESH/images/meshcomputationfail.png b/doc/salome/gui/SMESH/images/meshcomputationfail.png
index 781a59a64..61f3a433a 100644
Binary files a/doc/salome/gui/SMESH/images/meshcomputationfail.png and b/doc/salome/gui/SMESH/images/meshcomputationfail.png differ
diff --git a/doc/salome/gui/SMESH/images/use_existing_face_sample_mesh.png b/doc/salome/gui/SMESH/images/use_existing_face_sample_mesh.png
new file mode 100644
index 000000000..2110540e4
Binary files /dev/null and b/doc/salome/gui/SMESH/images/use_existing_face_sample_mesh.png differ
diff --git a/doc/salome/gui/SMESH/input/adding_nodes_and_elements.doc b/doc/salome/gui/SMESH/input/adding_nodes_and_elements.doc
index 9890d9a59..a51bbdde4 100644
--- a/doc/salome/gui/SMESH/input/adding_nodes_and_elements.doc
+++ b/doc/salome/gui/SMESH/input/adding_nodes_and_elements.doc
@@ -7,6 +7,7 @@
- \ref adding_nodes_anchor "Nodes"
- \ref adding_0delems_anchor "0D Elements"
+- \ref adding_balls_anchor "Ball Elements"
- \ref adding_edges_anchor "Edges"
- \ref adding_triangles_anchor "Triangles"
- \ref adding_quadrangles_anchor "Quadrangles"
@@ -76,6 +77,18 @@ selecting it in the 3D viewer and click the \b Apply or
\image html add_0delement.png
+\anchor adding_balls_anchor
+Adding ball elements
+
+\image html addball.png
+
+In this dialog box specify the node which will form your ball element
+either by selecting it in the 3D viewer or by manual entering its ID,
+specify a ball diameter and click the \b Apply or Apply and
+Close button. Your ball element will be created:
+
+\image html add_ball.png
+
\anchor adding_edges_anchor
Adding edges
diff --git a/idl/SMESH_Mesh.idl b/idl/SMESH_Mesh.idl
index a729eb09a..409bb4e6e 100644
--- a/idl/SMESH_Mesh.idl
+++ b/idl/SMESH_Mesh.idl
@@ -74,7 +74,8 @@ module SMESH
ADD_ELEM0D,
ADD_BIQUAD_QUADRANGLE,
ADD_TRIQUAD_HEXA,
- ADD_HEXAGONAL_PRISM
+ ADD_HEXAGONAL_PRISM,
+ ADD_BALL
};
struct log_block
@@ -119,7 +120,8 @@ module SMESH
EDGE,
FACE,
VOLUME,
- ELEM0D
+ ELEM0D,
+ BALL
};
typedef sequence array_of_ElementType ;
@@ -131,14 +133,15 @@ module SMESH
Geom_POINT,
Geom_EDGE,
Geom_TRIANGLE,
- Geom_QUADRANGLE,
- Geom_POLYGON,
+ Geom_QUADRANGLE, // when a new GeometryType is added, please
+ Geom_POLYGON, // update a corresponding list in SMESH_2smeshpy.cxx, ln 665
Geom_TETRA,
Geom_PYRAMID,
Geom_HEXA,
Geom_PENTA,
Geom_HEXAGONAL_PRISM,
- Geom_POLYHEDRA
+ Geom_POLYHEDRA,
+ Geom_BALL
};
/*!
@@ -180,6 +183,7 @@ module SMESH
Entity_Hexagonal_Prism,
Entity_Polyhedra,
Entity_Quad_Polyhedra,
+ Entity_Ball,
Entity_Last
};
@@ -684,6 +688,9 @@ module SMESH
long Nb0DElements()
raises (SALOME::SALOME_Exception);
+ long NbBalls()
+ raises (SALOME::SALOME_Exception);
+
long NbEdges()
raises (SALOME::SALOME_Exception);
@@ -899,6 +906,11 @@ module SMESH
*/
boolean IsQuadratic(in long id);
+ /*!
+ * Returns diameter of a ball discrete element or zero in case of an invalid \a id
+ */
+ double GetBallDiameter(in long id);
+
/*!
* Returns XYZ coordinates of bary center for given element
* as list of double
diff --git a/idl/SMESH_MeshEditor.idl b/idl/SMESH_MeshEditor.idl
index d1a396a13..561c5b884 100644
--- a/idl/SMESH_MeshEditor.idl
+++ b/idl/SMESH_MeshEditor.idl
@@ -64,7 +64,7 @@ module SMESH
long RemoveOrphanNodes();
/*!
- * \brief Add new node.
+ * \brief Add a new node.
* \param x X coordinate of new node
* \param y Y coordinate of new node
* \param z Z coordinate of new node
@@ -73,14 +73,20 @@ module SMESH
long AddNode(in double x, in double y, in double z);
/*!
- * Create 0D element on the given node.
+ * Create a 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).
+ * Create a ball element on the given node.
+ * \param IdOfNode Node IDs for creation of element.
+ */
+ long AddBall(in long IDOfNode, in double diameter);
+
+ /*!
+ * Create an edge, either linear and quadratic (this is determed
+ * by number of given nodes, two or three).
* \param IdsOfNodes List of node IDs for creation of element.
* Needed order of nodes in this list corresponds to description
* of MED. This description is located by the following link:
diff --git a/src/DriverMED/DriverMED_Family.cxx b/src/DriverMED/DriverMED_Family.cxx
index cf51d8d39..c284b0b3c 100644
--- a/src/DriverMED/DriverMED_Family.cxx
+++ b/src/DriverMED/DriverMED_Family.cxx
@@ -151,17 +151,21 @@ DriverMED_Family
const bool doGroupOfNodes,
const bool doGroupOfEdges,
const bool doGroupOfFaces,
- const bool doGroupOfVolumes)
+ const bool doGroupOfVolumes,
+ const bool doGroupOf0DElems,
+ const bool doGroupOfBalls)
{
DriverMED_FamilyPtrList aFamilies;
- string anAllNodesGroupName = "Group_Of_All_Nodes";
- string anAllEdgesGroupName = "Group_Of_All_Edges";
- string anAllFacesGroupName = "Group_Of_All_Faces";
+ string anAllNodesGroupName = "Group_Of_All_Nodes";
+ string anAllEdgesGroupName = "Group_Of_All_Edges";
+ string anAllFacesGroupName = "Group_Of_All_Faces";
string anAllVolumesGroupName = "Group_Of_All_Volumes";
+ string anAll0DElemsGroupName = "Group_Of_All_0DElems";
+ string anAllBallsGroupName = "Group_Of_All_Balls";
- // Reserve four ids for families of free elements
- // (1 - nodes, -1 - edges, -2 - faces, -3 - volumes).
+ // Reserve 6 ids for families of free elements
+ // (1 - nodes, -1 - edges, -2 - faces, -3 - volumes, -4 - 0D, -5 - balls).
// 'Free' means here not belonging to any group.
int aNodeFamId = FIRST_NODE_FAMILY;
int aElemFamId = FIRST_ELEM_FAMILY;
@@ -263,6 +267,12 @@ DriverMED_Family
else if (aFam->myType == SMDSAbs_Volume) {
if (doGroupOfVolumes) aFam->myGroupNames.insert(anAllVolumesGroupName);
}
+ else if (aFam->myType == SMDSAbs_0DElement) {
+ if (doGroupOfVolumes) aFam->myGroupNames.insert(anAll0DElemsGroupName);
+ }
+ else if (aFam->myType == SMDSAbs_Ball) {
+ if (doGroupOfVolumes) aFam->myGroupNames.insert(anAllBallsGroupName);
+ }
}
}
@@ -303,6 +313,24 @@ DriverMED_Family
aFamilies.push_back(aFreeVolumesFam);
}
+ if (doGroupOf0DElems)
+ {
+ DriverMED_FamilyPtr aFree0DFam (new DriverMED_Family);
+ aFree0DFam->SetId(REST_0DELEM_FAMILY);
+ aFree0DFam->myType = SMDSAbs_0DElement;
+ aFree0DFam->myGroupNames.insert(anAll0DElemsGroupName);
+ aFamilies.push_back(aFree0DFam);
+ }
+
+ if (doGroupOfBalls)
+ {
+ DriverMED_FamilyPtr aFreeBallsFam (new DriverMED_Family);
+ aFreeBallsFam->SetId(REST_BALL_FAMILY);
+ aFreeBallsFam->myType = SMDSAbs_Ball;
+ aFreeBallsFam->myGroupNames.insert(anAllBallsGroupName);
+ aFamilies.push_back(aFreeBallsFam);
+ }
+
DriverMED_FamilyPtr aNullFam (new DriverMED_Family);
aNullFam->SetId(0);
aNullFam->myType = SMDSAbs_All;
@@ -399,9 +427,9 @@ void DriverMED_Family::Init (SMESHDS_GroupBase* theGroup)
myGroupNames.insert(string(theGroup->GetStoreName()));
Quantity_Color aColor = theGroup->GetColor();
- double aRed = aColor.Red();
+ double aRed = aColor.Red();
double aGreen = aColor.Green();
- double aBlue = aColor.Blue();
+ double aBlue = aColor.Blue();
int aR = int( aRed*255 );
int aG = int( aGreen*255 );
int aB = int( aBlue*255 );
@@ -428,6 +456,8 @@ DriverMED_Family
DriverMED_FamilyPtr anEdgesFamily (new DriverMED_Family);
DriverMED_FamilyPtr aFacesFamily (new DriverMED_Family);
DriverMED_FamilyPtr aVolumesFamily (new DriverMED_Family);
+ // DriverMED_FamilyPtr a0DElemsFamily (new DriverMED_Family);
+ // DriverMED_FamilyPtr aBallsFamily (new DriverMED_Family);
char submeshGrpName[ 30 ];
sprintf( submeshGrpName, "SubMesh %d", theId );
@@ -494,13 +524,14 @@ void DriverMED_Family::Split (DriverMED_FamilyPtr by,
DriverMED_FamilyPtr common)
{
// Elements
- ElementsSet::iterator anIter = by->myElements.begin();
+ ElementsSet::iterator anIter = by->myElements.begin(), elemInMe;
while ( anIter != by->myElements.end())
{
- if (myElements.find(*anIter) != myElements.end())
+ elemInMe = myElements.find(*anIter);
+ if (elemInMe != myElements.end())
{
common->myElements.insert(*anIter);
- myElements.erase(*anIter);
+ myElements.erase(elemInMe);
by->myElements.erase(anIter++);
}
else
@@ -511,11 +542,7 @@ void DriverMED_Family::Split (DriverMED_FamilyPtr by,
{
// Groups list
common->myGroupNames = myGroupNames;
- MED::TStringSet::iterator aGrNamesIter = by->myGroupNames.begin();
- for (; aGrNamesIter != by->myGroupNames.end(); aGrNamesIter++)
- {
- common->myGroupNames.insert(*aGrNamesIter);
- }
+ common->myGroupNames.insert( by->myGroupNames.begin(), by->myGroupNames.end() );
// Type
common->myType = myType;
diff --git a/src/DriverMED/DriverMED_Family.h b/src/DriverMED/DriverMED_Family.h
index d1c939810..1e159539c 100644
--- a/src/DriverMED/DriverMED_Family.h
+++ b/src/DriverMED/DriverMED_Family.h
@@ -40,18 +40,21 @@
#include
#define REST_NODES_FAMILY 1
-#define REST_EDGES_FAMILY -1
-#define REST_FACES_FAMILY -2
-#define REST_VOLUMES_FAMILY -3
#define FIRST_NODE_FAMILY 2
-#define FIRST_ELEM_FAMILY -4
+
+#define REST_EDGES_FAMILY -1
+#define REST_FACES_FAMILY -2
+#define REST_VOLUMES_FAMILY -3
+#define REST_0DELEM_FAMILY -4
+#define REST_BALL_FAMILY -5
+#define FIRST_ELEM_FAMILY -6
class DriverMED_Family;
typedef boost::shared_ptr DriverMED_FamilyPtr;
-typedef std::list DriverMED_FamilyPtrList;
-typedef std::map SMESHDS_SubMeshPtrMap;
-typedef std::list SMESHDS_GroupBasePtrList;
-typedef std::set ElementsSet;
+typedef std::list DriverMED_FamilyPtrList;
+typedef std::map SMESHDS_SubMeshPtrMap;
+typedef std::list SMESHDS_GroupBasePtrList;
+typedef std::set ElementsSet;
class MESHDRIVERMED_EXPORT DriverMED_Family
{
@@ -73,7 +76,9 @@ class MESHDRIVERMED_EXPORT DriverMED_Family
const bool doGroupOfNodes,
const bool doGroupOfEdges,
const bool doGroupOfFaces,
- const bool doGroupOfVolumes);
+ const bool doGroupOfVolumes,
+ const bool doGroupOf0DElems,
+ const bool doGroupOfBalls);
//! Create TFamilyInfo for this family
MED::PFamilyInfo
diff --git a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx
index 1ec19c537..a60b77ca9 100644
--- a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx
+++ b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx
@@ -189,6 +189,70 @@ DriverMED_R_SMESHDS_Mesh
for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
const EGeometrieElement& aGeom = aGeom2SizeIter->first;
+ if ( anEntity == eSTRUCT_ELEMENT ) // MED_BALL (issue 0021459)
+ {
+ PBallInfo aBallInfo = aMed->GetPBallInfo(aMeshInfo);
+ TInt aNbBalls = aBallInfo->GetNbElem();
+
+ EBooleen anIsElemNum = takeNumbers ? aBallInfo->IsElemNum() : eFAUX;
+ if ( anIsElemNum && aBallInfo->myElemNum->empty() )
+ anIsElemNum = eFAUX;
+
+ // get supporting nodes
+ TNodeIds aNodeIds;
+#ifdef _EDF_NODE_IDS_
+ if(anIsNodeNum) {
+ aNodeIds.resize( aNbBalls );
+ for(TInt iBall = 0; iBall < aNbBalls && anIsNodeNum; iBall++)
+ {
+ aNodeIds[iBall] = aNodeInfo->GetElemNum(iBall);
+ anIsNodeNum = myMesh->FindNode( aNodeIds[iBall] ) ? eVRAI : eFAUX;
+ }
+ }
+#endif
+ if ( !anIsNodeNum )
+ aNodeIds.swap( *(aBallInfo->myConn ));
+
+ // allocate array of diameters
+ vtkIdType maxID = myMesh->MaxElementID() + aNbBalls;
+ if ( anIsElemNum && !aBallInfo->myElemNum->empty() )
+ maxID = *std::max_element( aBallInfo->myElemNum->begin(),
+ aBallInfo->myElemNum->end() );
+ myMesh->getGrid()->AllocateDiameters( maxID ); // performance optimization
+
+ // create balls
+ SMDS_MeshElement* anElement;
+ DriverMED_FamilyPtr aFamily;
+ for ( TInt iBall = 0; iBall < aNbBalls; iBall++)
+ {
+ anElement = 0;
+ if ( anIsElemNum ) {
+ if (!(anElement = myMesh->AddBallWithID( aNodeIds[iBall],
+ aBallInfo->myDiameters[iBall],
+ aBallInfo->GetElemNum(iBall))))
+ anIsElemNum = eFAUX;
+ }
+ if ( !anElement )
+ myMesh->AddBall( myMesh->FindNode( aNodeIds[iBall]),
+ aBallInfo->myDiameters[iBall] );
+
+ // Save reference to this element from its family
+ TInt aFamNum = aBallInfo->GetFamNum(iBall);
+ if ( checkFamilyID ( aFamily, aFamNum ))
+ {
+ aFamily->AddElement(anElement);
+ aFamily->SetType( SMDSAbs_Ball );
+ }
+ }
+
+ if ( !anIsElemNum &&
+ ( takeNumbers && aBallInfo->IsElemNum() && !aBallInfo->myElemNum->empty() ))
+ if ( aResult < DRS_WARN_RENUMBER )
+ aResult = DRS_WARN_RENUMBER;
+
+ continue;
+ } // MED_BALL
+
switch(aGeom) {
// case ePOINT1: ## PAL16410
// break;
@@ -388,7 +452,7 @@ DriverMED_R_SMESHDS_Mesh
INFOS("Following exception was caught:\n\t"<NbNodes();
- //int nb0DElements = myMesh->Nb0DElements();
- int nbEdges = myMesh->NbEdges();
- int nbFaces = myMesh->NbFaces();
- int nbVolumes = myMesh->NbVolumes();
- if (myDoGroupOfNodes && nbNodes)
- myNodesDefaultFamilyId = REST_NODES_FAMILY;
- if (myDoGroupOfEdges && nbEdges)
- myEdgesDefaultFamilyId = REST_EDGES_FAMILY;
- if (myDoGroupOfFaces && nbFaces)
- myFacesDefaultFamilyId = REST_FACES_FAMILY;
- if (myDoGroupOfVolumes && nbVolumes)
- myVolumesDefaultFamilyId = REST_VOLUMES_FAMILY;
+ int myBallsDefaultFamilyId = 0;
+ int myEdgesDefaultFamilyId = 0;
+ int myFacesDefaultFamilyId = 0;
+ int myVolumesDefaultFamilyId = 0;
+ int nbNodes = myMesh->NbNodes();
+ int nb0DElements = myMesh->Nb0DElements();
+ int nbBalls = myMesh->NbBalls();
+ int nbEdges = myMesh->NbEdges();
+ int nbFaces = myMesh->NbFaces();
+ int nbVolumes = myMesh->NbVolumes();
+ if (myDoGroupOfNodes && nbNodes) myNodesDefaultFamilyId = REST_NODES_FAMILY;
+ if (myDoGroupOfEdges && nbEdges) myEdgesDefaultFamilyId = REST_EDGES_FAMILY;
+ if (myDoGroupOfFaces && nbFaces) myFacesDefaultFamilyId = REST_FACES_FAMILY;
+ if (myDoGroupOfVolumes && nbVolumes) myVolumesDefaultFamilyId = REST_VOLUMES_FAMILY;
+ if (myDoGroupOf0DElems && nb0DElements) my0DElementsDefaultFamilyId = REST_0DELEM_FAMILY;
+ if (myDoGroupOfVolumes && nbVolumes) myBallsDefaultFamilyId = REST_BALL_FAMILY;
MESSAGE("Perform - aFamilyInfo");
//cout << " DriverMED_Family::MakeFamilies() " << endl;
@@ -422,14 +422,18 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
myDoGroupOfNodes && nbNodes,
myDoGroupOfEdges && nbEdges,
myDoGroupOfFaces && nbFaces,
- myDoGroupOfVolumes && nbVolumes);
+ myDoGroupOfVolumes && nbVolumes,
+ myDoGroupOf0DElems && nb0DElements,
+ myDoGroupOfBalls && nbBalls);
} else {
aFamilies = DriverMED_Family::MakeFamilies
(mySubMeshes, myGroups,
myDoGroupOfNodes && nbNodes,
myDoGroupOfEdges && nbEdges,
myDoGroupOfFaces && nbFaces,
- myDoGroupOfVolumes && nbVolumes);
+ myDoGroupOfVolumes && nbVolumes,
+ myDoGroupOf0DElems && nb0DElements,
+ myDoGroupOfBalls && nbBalls);
}
//cout << " myMed->SetFamilyInfo() " << endl;
list::iterator aFamsIter;
@@ -515,6 +519,13 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
ePOINT1,
nbElemInfo.Nb0DElements(),
SMDSAbs_0DElement));
+#ifdef _ELEMENTS_BY_DIM_
+ anEntity = eSTRUCT_ELEMENT;
+#endif
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eBALL,
+ nbElemInfo.NbBalls(),
+ SMDSAbs_Ball));
#ifdef _ELEMENTS_BY_DIM_
anEntity = eARETE;
#endif
@@ -632,6 +643,9 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
case SMDSAbs_0DElement:
defaultFamilyId = my0DElementsDefaultFamilyId;
break;
+ case SMDSAbs_Ball:
+ defaultFamilyId = myBallsDefaultFamilyId;
+ break;
case SMDSAbs_Edge:
defaultFamilyId = myEdgesDefaultFamilyId;
break;
@@ -646,22 +660,21 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
}
// iterator on elements of a current type
- SMDS_ElemIteratorPtr elemIterator = myMesh->elementsIterator( aElemTypeData->_smdsType );
- if ( !elemIterator->more()) continue;
+ SMDS_ElemIteratorPtr elemIterator;
int iElem = 0;
// Treat POLYGONs
// ---------------
if ( aElemTypeData->_geomType == ePOLYGONE )
{
+ elemIterator = myMesh->elementGeomIterator( SMDSGeom_POLYGON );
if ( nbPolygonNodes == 0 ) {
// Count nb of nodes
- while ( const SMDS_MeshElement* anElem = elemIterator->next() ) {
- if ( anElem->IsPoly() ) {
- nbPolygonNodes += anElem->NbNodes();
- if ( ++iElem == aElemTypeData->_nbElems )
- break;
- }
+ while ( elemIterator->more() ) {
+ const SMDS_MeshElement* anElem = elemIterator->next();
+ nbPolygonNodes += anElem->NbNodes();
+ if ( ++iElem == aElemTypeData->_nbElems )
+ break;
}
}
else {
@@ -676,11 +689,9 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
TElemNum & index = *(aPolygoneInfo->myIndex.get());
index[0] = 1;
- while ( const SMDS_MeshElement* anElem = elemIterator->next() )
+ while ( elemIterator->more() )
{
- if ( !anElem->IsPoly() )
- continue;
-
+ const SMDS_MeshElement* anElem = elemIterator->next();
// index
TInt aNbNodes = anElem->NbNodes();
index[ iElem+1 ] = index[ iElem ] + aNbNodes;
@@ -714,16 +725,18 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
// ----------------
else if (aElemTypeData->_geomType == ePOLYEDRE )
{
+ elemIterator = myMesh->elementGeomIterator( SMDSGeom_POLYHEDRA );
+
if ( nbPolyhedronNodes == 0 ) {
// Count nb of nodes
- while ( const SMDS_MeshElement* anElem = elemIterator->next() ) {
- const SMDS_VtkVolume *aPolyedre = dynamic_cast(anElem);
- if ( aPolyedre && aPolyedre->IsPoly()) {
- nbPolyhedronNodes += aPolyedre->NbNodes();
- nbPolyhedronFaces += aPolyedre->NbFaces();
- if ( ++iElem == aElemTypeData->_nbElems )
- break;
- }
+ while ( elemIterator->more() ) {
+ const SMDS_MeshElement* anElem = elemIterator->next();
+ const SMDS_VtkVolume *aPolyedre = dynamic_cast(anElem);
+ if ( !aPolyedre ) continue;
+ nbPolyhedronNodes += aPolyedre->NbNodes();
+ nbPolyhedronFaces += aPolyedre->NbFaces();
+ if ( ++iElem == aElemTypeData->_nbElems )
+ break;
}
}
else {
@@ -744,13 +757,11 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
faces[0] = 1;
TInt iFace = 0, iNode = 0;
- while ( const SMDS_MeshElement* anElem = elemIterator->next() )
+ while ( elemIterator->more() )
{
+ const SMDS_MeshElement* anElem = elemIterator->next();
const SMDS_VtkVolume *aPolyedre = dynamic_cast(anElem);
- if ( !aPolyedre )
- continue;
- if ( !aPolyedre->IsPoly() )
- continue;
+ if ( !aPolyedre ) continue;
// index
TInt aNbFaces = aPolyedre->NbFaces();
index[ iElem+1 ] = index[ iElem ] + aNbFaces;
@@ -785,6 +796,48 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
}
} // if (aElemTypeData->_geomType == ePOLYEDRE )
+ // Treat BALLs
+ // ----------------
+ else if (aElemTypeData->_geomType == eBALL )
+ {
+ // allocate data arrays
+ PBallInfo aBallInfo = myMed->CrBallInfo( aMeshInfo,
+ aElemTypeData->_nbElems );
+
+ // build map of family numbers for this type
+ if ( !isElemFamMapBuilt[ aElemTypeData->_smdsType ])
+ {
+ fillElemFamilyMap( anElemFamMap, aFamilies, aElemTypeData->_smdsType );
+ isElemFamMapBuilt[ aElemTypeData->_smdsType ] = true;
+ }
+
+ elemIterator = myMesh->elementsIterator( SMDSAbs_Ball );
+ while ( elemIterator->more() )
+ {
+ const SMDS_MeshElement* anElem = elemIterator->next();
+ // connectivity
+ const SMDS_MeshElement* aNode = anElem->GetNode( 0 );
+#ifdef _EDF_NODE_IDS_
+ (*aBallInfo->myConn)[ iElem ] = aNodeIdMap[aNode->GetID()];
+#else
+ (*aBallInfo->myConn)[ iElem ] = aNode->GetID();
+#endif
+ // element number
+ aBallInfo->SetElemNum( iElem, anElem->GetID() );
+
+ // diameter
+ aBallInfo->myDiameters[ iElem ] =
+ static_cast( anElem )->GetDiameter();
+
+ // family number
+ int famNum = getFamilyId( anElemFamMap, anElem, defaultFamilyId );
+ aBallInfo->SetFamNum( iElem, famNum );
+ ++iElem;
+ }
+ // store data in a file
+ myMed->SetBallInfo(aBallInfo);
+ }
+
else
{
// Treat standard types
@@ -807,8 +860,10 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
}
TInt aNbNodes = MED::GetNbNodes(aElemTypeData->_geomType);
- while ( const SMDS_MeshElement* anElem = elemIterator->next() )
+ elemIterator = myMesh->elementsIterator( aElemTypeData->_smdsType );
+ while ( elemIterator->more() )
{
+ const SMDS_MeshElement* anElem = elemIterator->next();
if ( anElem->NbNodes() != aNbNodes || anElem->IsPoly() )
continue; // other geometry
diff --git a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.h b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.h
index a5543c882..6b0f03138 100644
--- a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.h
+++ b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.h
@@ -56,6 +56,8 @@ class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
void AddGroupOfEdges();
void AddGroupOfFaces();
void AddGroupOfVolumes();
+ void AddGroupOf0DElems();
+ void AddGroupOfBalls();
/*! functions to prepare adding one mesh
*/
@@ -77,6 +79,8 @@ class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
bool myDoGroupOfEdges;
bool myDoGroupOfFaces;
bool myDoGroupOfVolumes;
+ bool myDoGroupOf0DElems;
+ bool myDoGroupOfBalls;
};
diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx
index f46baed8c..4daba11f8 100644
--- a/src/OBJECT/SMESH_Actor.cxx
+++ b/src/OBJECT/SMESH_Actor.cxx
@@ -138,8 +138,9 @@ SMESH_ActorDef::SMESH_ActorDef()
if ( mgr && mgr->booleanValue( "SMESH", "use_precision", false ) )
myControlsPrecision = mgr->integerValue( "SMESH", "controls_precision", -1);
- vtkFloatingPointType aElem0DSize = SMESH::GetFloat("SMESH:elem0d_size",5);
- vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
+ vtkFloatingPointType aElem0DSize = SMESH::GetFloat("SMESH:elem0d_size",5);
+ vtkFloatingPointType aBallElemSize = SMESH::GetFloat("SMESH:ball_elem_size",10);
+ vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
@@ -314,6 +315,26 @@ SMESH_ActorDef::SMESH_ActorDef()
aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
aFilter->RegisterCellsWithType(VTK_VERTEX);
+ //Definition 0D device of the actor (ball elements)
+ //-----------------------------------------------
+ myBallProp = vtkProperty::New();
+ SMESH::GetColor( "SMESH", "ball_elem_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 0 ) );
+ myBallProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+ myBallProp->SetPointSize(aBallElemSize);
+
+ myBallActor = SMESH_CellLabelActor::New();
+ myBallActor->SetUserMatrix(aMatrix);
+ myBallActor->SetStoreGemetryMapping(true);
+ myBallActor->PickableOff();
+ myBallActor->SetVisibility(false);
+ myBallActor->SetProperty(myBallProp);
+ myBallActor->SetRepresentation(SMESH_DeviceActor::eSurface);
+ aFilter = myBallActor->GetExtractUnstructuredGrid();
+ //aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
+ aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
+ aFilter->RegisterCellsWithType(VTK_VERTEX);
+ aFilter->RegisterCellsWithType(VTK_POLY_VERTEX);
+
//my0DExtProp = vtkProperty::New();
//my0DExtProp->DeepCopy(my0DProp);
//anRGB[0] = 1 - anRGB[0];
@@ -508,6 +529,7 @@ SMESH_ActorDef::~SMESH_ActorDef()
my0DProp->Delete();
my0DActor->Delete();
+ myBallActor->Delete();
//my0DExtProp->Delete();
//my0DExtActor->Delete();
@@ -574,6 +596,9 @@ void SMESH_ActorDef::SetCellsLabeled(bool theIsCellsLabeled)
if(my0DActor)
my0DActor->SetCellsLabeled(theIsCellsLabeled);
+ if(myBallActor)
+ myBallActor->SetCellsLabeled(theIsCellsLabeled);
+
myTimeStamp->Modified();
}
@@ -592,6 +617,9 @@ bool SMESH_ActorDef::GetCellsLabeled() {
if(my0DActor)
result = result || my0DActor->GetCellsLabeled();
+ if(myBallActor)
+ result = result || myBallActor->GetCellsLabeled();
+
return result;
}
@@ -669,6 +697,7 @@ SetControlMode(eControl theMode,
my1DActor->GetMapper()->SetScalarVisibility(false);
my2DActor->GetMapper()->SetScalarVisibility(false);
my3DActor->GetMapper()->SetScalarVisibility(false);
+ myBallActor->GetMapper()->SetScalarVisibility(false);
myScalarBarActor->SetVisibility(false);
bool anIsScalarVisible = theMode > eNone;
@@ -932,13 +961,14 @@ void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
theRenderer->AddActor(myNodeExtActor);
theRenderer->AddActor(my1DExtActor);
- my3DActor->AddToRender(theRenderer);
+ my3DActor ->AddToRender(theRenderer);
my3DExtActor->AddToRender(theRenderer);
- my2DActor->AddToRender(theRenderer);
+ my2DActor ->AddToRender(theRenderer);
my2DExtActor->AddToRender(theRenderer);
- myNodeActor->AddToRender(theRenderer);
- my1DActor->AddToRender(theRenderer);
- my0DActor->AddToRender(theRenderer);
+ myNodeActor ->AddToRender(theRenderer);
+ my1DActor ->AddToRender(theRenderer);
+ my0DActor ->AddToRender(theRenderer);
+ myBallActor ->AddToRender(theRenderer);
//theRenderer->AddActor(my0DExtActor);
theRenderer->AddActor(myHighlitableActor);
@@ -969,6 +999,7 @@ void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){
my3DExtActor->RemoveFromRender(theRenderer);
myNodeActor->RemoveFromRender(theRenderer);
my0DActor->RemoveFromRender(theRenderer);
+ myBallActor->RemoveFromRender(theRenderer);
my1DActor->RemoveFromRender(theRenderer);
theRenderer->RemoveActor(myScalarBarActor);
@@ -995,6 +1026,7 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
myNodeExtActor->Init(myVisualObj,myImplicitBoolean);
my0DActor->Init(myVisualObj,myImplicitBoolean);
+ myBallActor->Init(myVisualObj,myImplicitBoolean);
//my0DExtActor->Init(myVisualObj,myImplicitBoolean);
my1DActor->Init(myVisualObj,myImplicitBoolean);
@@ -1006,6 +1038,7 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
my3DExtActor->Init(myVisualObj,myImplicitBoolean);
my0DActor->GetMapper()->SetLookupTable(myLookupTable);
+ myBallActor->GetMapper()->SetLookupTable(myLookupTable);
//my0DExtActor->GetMapper()->SetLookupTable(myLookupTable);
my1DActor->GetMapper()->SetLookupTable(myLookupTable);
@@ -1079,6 +1112,7 @@ void SMESH_ActorDef::SetTransform(VTKViewer_Transform* theTransform){
myNodeExtActor->SetTransform(theTransform);
my0DActor->SetTransform(theTransform);
+ myBallActor->SetTransform(theTransform);
//my0DExtActor->SetTransform(theTransform);
my1DActor->SetTransform(theTransform);
@@ -1219,6 +1253,7 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
myNodeExtActor->VisibilityOff();
my0DActor->VisibilityOff();
+ myBallActor->VisibilityOff();
//my0DExtActor->VisibilityOff();
my1DActor->VisibilityOff();
@@ -1275,6 +1310,9 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
if(myEntityMode & e0DElements){
my0DActor->VisibilityOn();
}
+ if(myEntityMode & eBallElem){
+ myBallActor->VisibilityOn();
+ }
if(myEntityMode & eEdges && GetRepresentation() != ePoint){
my1DActor->VisibilityOn();
@@ -1295,6 +1333,9 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
if(my0DActor)
my0DActor->UpdateLabels();
+ if(myBallActor)
+ myBallActor->UpdateLabels();
+
if(my1DActor)
my1DActor->UpdateLabels();
@@ -1322,6 +1363,11 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode)
theMode &= ~e0DElements;
}
+ if(!myVisualObj->GetNbEntities(SMDSAbs_Ball)) {
+ myEntityState &= ~eBallElem;
+ theMode &= ~eBallElem;
+ }
+
if(!myVisualObj->GetNbEntities(SMDSAbs_Edge)) {
myEntityState &= ~eEdges;
theMode &= ~eEdges;
@@ -1341,6 +1387,9 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode)
if(myVisualObj->GetNbEntities(SMDSAbs_0DElement))
theMode |= e0DElements;
+ if(myVisualObj->GetNbEntities(SMDSAbs_Ball))
+ theMode |= eBallElem;
+
if(myVisualObj->GetNbEntities(SMDSAbs_Edge))
theMode |= eEdges;
@@ -1369,6 +1418,11 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode)
aHightFilter->RegisterCellsWithType(VTK_VERTEX);
}
+ if (myEntityMode & eBallElem) {
+ aFilter->RegisterCellsWithType(VTK_POLY_VERTEX);
+ aHightFilter->RegisterCellsWithType(VTK_POLY_VERTEX);
+ }
+
if (myEntityMode & eEdges) {
if (MYDEBUG) MESSAGE("EDGES");
aFilter->RegisterCellsWithType(VTK_LINE);
@@ -1519,6 +1573,7 @@ void SMESH_ActorDef::SetRepresentation (int theMode)
//my0DActor->SetProperty(aProp);
//my0DActor->SetBackfaceProperty(aBackProp);
my0DActor->SetRepresentation(aReperesent);
+ myBallActor->SetRepresentation(aReperesent);
//my0DExtActor->SetRepresentation(aReperesent);
switch(myControlMode){
@@ -1676,6 +1731,9 @@ void SMESH_ActorDef::Update(){
if(my0DActor)
my0DActor->UpdateLabels();
+ if(myBallActor)
+ myBallActor->UpdateLabels();
+
if(my1DActor)
my1DActor->UpdateLabels();
@@ -1799,6 +1857,18 @@ void SMESH_ActorDef::Get0DColor(vtkFloatingPointType& r,vtkFloatingPointType& g,
::GetColor(my0DProp,r,g,b);
}
+void SMESH_ActorDef::SetBallColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
+ myBallProp->SetColor(r,g,b);
+ if( SMESH_GroupObj* aGroupObj = dynamic_cast( myVisualObj.get() ) )
+ if( aGroupObj->GetElementType() == SMDSAbs_Ball )
+ myNameActor->SetBackgroundColor(r,g,b);
+ Modified();
+}
+
+void SMESH_ActorDef::GetBallColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
+ ::GetColor(myBallProp,r,g,b);
+}
+
void SMESH_ActorDef::SetHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
myHighlightProp->SetColor(r,g,b);
Modified();
@@ -1845,6 +1915,15 @@ vtkFloatingPointType SMESH_ActorDef::Get0DSize(){
return my0DProp->GetPointSize();
}
+void SMESH_ActorDef::SetBallSize(vtkFloatingPointType theVal){
+ myBallProp->SetPointSize(theVal);
+ Modified();
+}
+
+vtkFloatingPointType SMESH_ActorDef::GetBallSize(){
+ return myBallProp->GetPointSize();
+}
+
int SMESH_ActorDef::GetObjDimension( const int theObjId )
{
return myVisualObj->GetElemDimension( theObjId );
@@ -1868,6 +1947,7 @@ SMESH_ActorDef::SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
myNodeExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
my0DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
+ myBallActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
//my0DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
my1DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
diff --git a/src/OBJECT/SMESH_Actor.h b/src/OBJECT/SMESH_Actor.h
index 95eeb5a59..4e04546f4 100644
--- a/src/OBJECT/SMESH_Actor.h
+++ b/src/OBJECT/SMESH_Actor.h
@@ -76,6 +76,9 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
virtual void Set0DColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b) = 0;
virtual void Get0DColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b) = 0;
+ virtual void SetBallColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b) = 0;
+ virtual void GetBallColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b) = 0;
+
virtual void SetHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b) = 0;
virtual void GetHighlightColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b) = 0;
@@ -88,9 +91,12 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
virtual void Set0DSize(vtkFloatingPointType size) = 0;
virtual vtkFloatingPointType Get0DSize() = 0;
+ virtual void SetBallSize(vtkFloatingPointType size) = 0;
+ virtual vtkFloatingPointType GetBallSize() = 0;
+
enum EReperesent { ePoint, eEdge, eSurface};
- enum EEntityMode { e0DElements = 0x01, eEdges = 0x02, eFaces = 0x04, eVolumes = 0x08, eAllEntity = 0x0f};
+ enum EEntityMode { e0DElements = 0x01, eEdges = 0x02, eFaces = 0x04, eVolumes = 0x08, eBallElem = 0x10, eAllEntity = 0x1f};
enum EQuadratic2DRepresentation { eLines = 0x01, eArcs = 0x02 };
diff --git a/src/OBJECT/SMESH_ActorDef.h b/src/OBJECT/SMESH_ActorDef.h
index 1c257ff99..b346e68b4 100644
--- a/src/OBJECT/SMESH_ActorDef.h
+++ b/src/OBJECT/SMESH_ActorDef.h
@@ -119,6 +119,9 @@ class SMESH_ActorDef : public SMESH_Actor
virtual void Set0DColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b);
virtual void Get0DColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b);
+ virtual void SetBallColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b);
+ virtual void GetBallColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b);
+
virtual void SetHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b);
virtual void GetHighlightColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b);
@@ -131,6 +134,9 @@ class SMESH_ActorDef : public SMESH_Actor
virtual void Set0DSize(vtkFloatingPointType size);
virtual vtkFloatingPointType Get0DSize();
+ virtual void SetBallSize(vtkFloatingPointType size);
+ virtual vtkFloatingPointType GetBallSize();
+
virtual int GetNodeObjId(int theVtkID);
virtual vtkFloatingPointType* GetNodeCoord(int theObjID);
@@ -259,6 +265,8 @@ class SMESH_ActorDef : public SMESH_Actor
vtkProperty* my0DProp;
SMESH_CellLabelActor* my0DActor;
+ vtkProperty* myBallProp;
+ SMESH_CellLabelActor* myBallActor;
vtkProperty* my0DExtProp;
SMESH_DeviceActor* my0DExtActor;
diff --git a/src/OBJECT/SMESH_ActorUtils.cxx b/src/OBJECT/SMESH_ActorUtils.cxx
index 0a965ea85..bb9fd64b1 100644
--- a/src/OBJECT/SMESH_ActorUtils.cxx
+++ b/src/OBJECT/SMESH_ActorUtils.cxx
@@ -159,8 +159,10 @@ namespace SMESH
std::map GetEntitiesFromObject(SMESH_VisualObj *theObject) {
std::map entities;
- entities.insert(std::pair(SMDSAbs_0DElement,
+ entities.insert(std::pair(SMDSAbs_0DElement,
theObject ? theObject->GetNbEntities(SMDSAbs_0DElement) : 0));
+ entities.insert(std::pair(SMDSAbs_Ball,
+ theObject ? theObject->GetNbEntities(SMDSAbs_Ball) : 0));
entities.insert(std::pair(SMDSAbs_Edge,
theObject ? theObject->GetNbEntities(SMDSAbs_Edge) : 0));
entities.insert(std::pair(SMDSAbs_Face,
diff --git a/src/OBJECT/SMESH_Object.cxx b/src/OBJECT/SMESH_Object.cxx
index c52200bef..e137a1c6d 100644
--- a/src/OBJECT/SMESH_Object.cxx
+++ b/src/OBJECT/SMESH_Object.cxx
@@ -87,8 +87,9 @@ static inline vtkIdType getCellType( const SMDSAbs_ElementType theType,
{
switch( theType )
{
- case SMDSAbs_0DElement:
- return VTK_VERTEX;
+ case SMDSAbs_0DElement: return VTK_VERTEX;
+
+ case SMDSAbs_Ball: return VTK_POLY_VERTEX;
case SMDSAbs_Edge:
if( theNbNodes == 2 ) return VTK_LINE;
@@ -344,8 +345,8 @@ void SMESH_VisualObjDef::buildElemPrs()
// Calculate cells size
- static SMDSAbs_ElementType aTypes[ 4 ] =
- { SMDSAbs_0DElement, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Volume };
+ static SMDSAbs_ElementType aTypes[ 5 ] =
+ { SMDSAbs_Ball, SMDSAbs_0DElement, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Volume };
// get entity data
map nbEnts;
@@ -359,6 +360,7 @@ void SMESH_VisualObjDef::buildElemPrs()
SMDS_Mesh::CheckMemory(); // PAL16631
vtkIdType aCellsSize = 2 * nbEnts[ SMDSAbs_0DElement ] + 3 * nbEnts[ SMDSAbs_Edge ];
+ aCellsSize += 2 * nbEnts[ SMDSAbs_Ball ];
for ( int i = 2; i <= 3; i++ ) // iterate through faces and volumes
{
@@ -387,8 +389,9 @@ void SMESH_VisualObjDef::buildElemPrs()
}
}
- vtkIdType aNbCells = nbEnts[ SMDSAbs_0DElement ] + nbEnts[ SMDSAbs_Edge ] +
- nbEnts[ SMDSAbs_Face ] + nbEnts[ SMDSAbs_Volume ];
+ vtkIdType aNbCells =
+ nbEnts[ SMDSAbs_0DElement ] + nbEnts[ SMDSAbs_Ball ] + nbEnts[ SMDSAbs_Edge ] +
+ nbEnts[ SMDSAbs_Face ] + nbEnts[ SMDSAbs_Volume ];
if ( MYDEBUG )
MESSAGE( "Update - aNbCells = "< 0 ||
GetNbEntities(SMDSAbs_0DElement) > 0 ||
+ GetNbEntities(SMDSAbs_Ball) > 0 ||
GetNbEntities(SMDSAbs_Edge) > 0 ||
GetNbEntities(SMDSAbs_Face) > 0 ||
GetNbEntities(SMDSAbs_Volume) > 0 ;
@@ -586,6 +590,9 @@ void SMESH_VisualObjDef::updateEntitiesFlags() {
if( myEntitiesCache[SMDSAbs_0DElement] != 0 || myEntitiesCache[SMDSAbs_0DElement] >= entities[SMDSAbs_0DElement] )
myEntitiesState &= ~SMESH_Actor::e0DElements;
+ if( myEntitiesCache[SMDSAbs_Ball] != 0 || myEntitiesCache[SMDSAbs_Ball] >= entities[SMDSAbs_Ball] )
+ myEntitiesState &= ~SMESH_Actor::eBallElem;
+
if( myEntitiesCache[SMDSAbs_Edge] != 0 || myEntitiesCache[SMDSAbs_Edge] >= entities[SMDSAbs_Edge] )
myEntitiesState &= ~SMESH_Actor::eEdges;
@@ -701,6 +708,7 @@ int SMESH_MeshObj::GetElemDimension( const int theObjId )
switch ( aType )
{
case SMDSAbs_0DElement : return 0;
+ case SMDSAbs_Ball : return 0;
case SMDSAbs_Edge : return 1;
case SMDSAbs_Face : return 2;
case SMDSAbs_Volume: return 3;
@@ -725,6 +733,10 @@ int SMESH_MeshObj::GetNbEntities( const SMDSAbs_ElementType theType) const
{
return myClient->Nb0DElements();
}
+ case SMDSAbs_Ball:
+ {
+ return myClient->NbBalls();
+ }
break;
case SMDSAbs_Edge:
{
@@ -761,7 +773,13 @@ int SMESH_MeshObj::GetEntities( const SMDSAbs_ElementType theType, TEntityList&
break;
case SMDSAbs_0DElement:
{
- SMDS_0DElementIteratorPtr anIter = myClient->elements0dIterator();
+ SMDS_ElemIteratorPtr anIter = myClient->elementsIterator(SMDSAbs_0DElement);
+ while ( anIter->more() ) theObjs.push_back( anIter->next() );
+ }
+ break;
+ case SMDSAbs_Ball:
+ {
+ SMDS_ElemIteratorPtr anIter = myClient->elementGeomIterator(SMDSGeom_BALL);
while ( anIter->more() ) theObjs.push_back( anIter->next() );
}
break;
@@ -805,7 +823,7 @@ void SMESH_MeshObj::UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor
//=================================================================================
bool SMESH_MeshObj::IsNodePrs() const
{
- return myClient->Nb0DElements() == 0 && myClient->NbEdges() == 0 && myClient->NbFaces() == 0 && myClient->NbVolumes() == 0 ;
+ return myClient->Nb0DElements() + myClient->NbEdges() + myClient->NbFaces() + myClient->NbVolumes() + myClient->NbBalls() == 0 ;
}
@@ -1031,6 +1049,7 @@ int SMESH_subMeshObj::GetNbEntities( const SMDSAbs_ElementType theType) const
return mySubMeshServer->GetNumberOfNodes( /*all=*/true );
}
break;
+ case SMDSAbs_Ball:
case SMDSAbs_0DElement:
case SMDSAbs_Edge:
case SMDSAbs_Face: