]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
0021459: EDF 1495 SMESH: Manipulation of discrete elements with attributes
authoreap <eap@opencascade.com>
Thu, 19 Jul 2012 12:50:10 +0000 (12:50 +0000)
committereap <eap@opencascade.com>
Thu, 19 Jul 2012 12:50:10 +0000 (12:50 +0000)
27 files changed:
doc/salome/gui/SMESH/images/a-createpolyhedralvolume.png
doc/salome/gui/SMESH/images/add0delement.png
doc/salome/gui/SMESH/images/add_ball.png [new file with mode: 0644]
doc/salome/gui/SMESH/images/addball.png [new file with mode: 0644]
doc/salome/gui/SMESH/images/addedge.png
doc/salome/gui/SMESH/images/addhexahedron.png
doc/salome/gui/SMESH/images/addnode.png
doc/salome/gui/SMESH/images/addpolygon.png
doc/salome/gui/SMESH/images/addquadrangle.png
doc/salome/gui/SMESH/images/addtetrahedron.png
doc/salome/gui/SMESH/images/addtriangle.png
doc/salome/gui/SMESH/images/image146.png
doc/salome/gui/SMESH/images/meshcomputationfail.png
doc/salome/gui/SMESH/images/use_existing_face_sample_mesh.png [new file with mode: 0644]
doc/salome/gui/SMESH/input/adding_nodes_and_elements.doc
idl/SMESH_Mesh.idl
idl/SMESH_MeshEditor.idl
src/DriverMED/DriverMED_Family.cxx
src/DriverMED/DriverMED_Family.h
src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx
src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx
src/DriverMED/DriverMED_W_SMESHDS_Mesh.h
src/OBJECT/SMESH_Actor.cxx
src/OBJECT/SMESH_Actor.h
src/OBJECT/SMESH_ActorDef.h
src/OBJECT/SMESH_ActorUtils.cxx
src/OBJECT/SMESH_Object.cxx

index 009f71d51a2d392c0d61f56b34b1b881454c35da..6c6bb615d376dc7cb8d47d9d626f38bdb7a3e767 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/a-createpolyhedralvolume.png and b/doc/salome/gui/SMESH/images/a-createpolyhedralvolume.png differ
index d3d8da302af093e1002bc6e573fc997ad6daecc2..ed27488c9a790a605a9d12ff2b47d45062f127a3 100644 (file)
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 (file)
index 0000000..1fe4f64
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 (file)
index 0000000..c38c9fa
Binary files /dev/null and b/doc/salome/gui/SMESH/images/addball.png differ
index 34f4fe07a009a10e8e617d6afd651ef47ba2db32..7a5a030632559926267d32e1f302f4b342d13957 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/addedge.png and b/doc/salome/gui/SMESH/images/addedge.png differ
index 65d881f86d2b94b1664bb9f0f24d1f91069b9fe0..0cf7fe819a0143afd9f65ff03720d0474a76cf75 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/addhexahedron.png and b/doc/salome/gui/SMESH/images/addhexahedron.png differ
index bbde71e6a93e0c9f568fa9b61a44c28ff501f545..1fd9a9f8a5ec91d375d86951ef6f66327950fb3f 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/addnode.png and b/doc/salome/gui/SMESH/images/addnode.png differ
index 71b81ecca7225e7735c713320b905b01dd6b287d..200999d8da6a349486ef881cff40fc2e9552a102 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/addpolygon.png and b/doc/salome/gui/SMESH/images/addpolygon.png differ
index 3dccce258c08e80204accd307703a16308c33d73..bd2462273021fe124257018aef84aa29ed571bbe 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/addquadrangle.png and b/doc/salome/gui/SMESH/images/addquadrangle.png differ
index 0289a95e4872ad25363f105a9d293e92d3ff2b1a..0a6a74084f715a2da8b51b5770ccfc29cbbed5a0 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/addtetrahedron.png and b/doc/salome/gui/SMESH/images/addtetrahedron.png differ
index 991085fd100a6b817e7bf6059a16b62c8729fea0..67682c8cf6e3000319d0d48daef1c468ae360c40 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/addtriangle.png and b/doc/salome/gui/SMESH/images/addtriangle.png differ
index 521513c60fc8a1a60c05c7e78f1e1a3d988ca690..a952f5fccfd7ba55a04905a062a33ccd3cc9912e 100755 (executable)
Binary files a/doc/salome/gui/SMESH/images/image146.png and b/doc/salome/gui/SMESH/images/image146.png differ
index 781a59a6418416325c333e6e7da5122e24c7c1ef..61f3a433aea52615f49c56dbc3a78c5106f1d11b 100644 (file)
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 (file)
index 0000000..2110540
Binary files /dev/null and b/doc/salome/gui/SMESH/images/use_existing_face_sample_mesh.png differ
index 9890d9a59ae51af2c2774ea6d0a470c71ddaa92b..a51bbdde45ccb820873ab4457f35723a87a0f0bf 100644 (file)
@@ -7,6 +7,7 @@
 <ul>
 <li>\ref adding_nodes_anchor "Nodes"</li>
 <li>\ref adding_0delems_anchor "0D Elements"</li>
+<li>\ref adding_balls_anchor "Ball Elements"</li>
 <li>\ref adding_edges_anchor "Edges"</li>
 <li>\ref adding_triangles_anchor "Triangles"</li>
 <li>\ref adding_quadrangles_anchor "Quadrangles"</li>
@@ -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
+<h2>Adding ball elements</h2>
+
+\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 <b>Apply and
+Close</b> button. Your ball element will be created:
+
+\image html add_ball.png
+
 <br>
 \anchor adding_edges_anchor
 <h2>Adding edges</h2>
index a729eb09a7ca89c46a9ae0460acf35e776a770f5..409bb4e6ec4ac3ded80a66a86a00e08a1152545f 100644 (file)
@@ -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<ElementType> 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
index d1a396a13a86630962c95af7b9767c83cb93af52..561c5b8841b4945d60160daafac2eceaa1eba64a 100644 (file)
@@ -64,7 +64,7 @@ module SMESH
     long RemoveOrphanNodes();
 
     /*!
-     * \brief Add new node.
+     * \brief Add 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 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:
index cf51d8d39246c5dc28c3b9c57b9a7e5b763a032e..c284b0b3ca8f3e7315eaa5eb97360d222c57931c 100644 (file)
@@ -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;
index d1c9398107ba8c94a05119edfd0278a402801127..1e159539cc9bc7dc77a0698c0697386269805976 100644 (file)
 #include <set>
 
 #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_Family> DriverMED_FamilyPtr;
-typedef std::list<DriverMED_FamilyPtr> DriverMED_FamilyPtrList;
-typedef std::map<int,SMESHDS_SubMesh*> SMESHDS_SubMeshPtrMap;
-typedef std::list<SMESHDS_GroupBase*> SMESHDS_GroupBasePtrList;
-typedef std::set<const SMDS_MeshElement*> ElementsSet;
+typedef std::list<DriverMED_FamilyPtr     > DriverMED_FamilyPtrList;
+typedef std::map<int,SMESHDS_SubMesh*     > SMESHDS_SubMeshPtrMap;
+typedef std::list<SMESHDS_GroupBase*      > SMESHDS_GroupBasePtrList;
+typedef std::set<const SMDS_MeshElement*  > 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 
index 1ec19c537b8f7d9968b9d57a9609d19dc097a56e..a60b77ca9e33cde6123d5eb35e4c5c0f5d6a133b 100644 (file)
@@ -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"<<exc.what());
                   aResult = DRS_FAIL;
                 }catch(...){
-                  INFOS("Unknown exception was cought !!!");
+                  INFOS("Unknown exception was caught !!!");
                   aResult = DRS_FAIL;
                 }
 #endif          
index 5482d809427bbf7933e05e2d64358f500721ee0b..39b03f2d619cd4435c71d253ee0d0967f0ebc71f 100644 (file)
@@ -311,7 +311,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
     // Mesh dimension definition
     TInt aSpaceDimension;
     TCoordHelperPtr aCoordHelperPtr;
-    {  
+    {
       bool anIsXDimension = false;
       bool anIsYDimension = false;
       bool anIsZDimension = false;
@@ -394,24 +394,24 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
 
     // Storing SMDS groups and sub-meshes as med families
     //----------------------------------------------------
-    int myNodesDefaultFamilyId   = 0;
+    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();
-    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<DriverMED_FamilyPtr>::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<const SMDS_VtkVolume*>(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<const SMDS_VtkVolume*>(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<const SMDS_VtkVolume*>(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<const SMDS_BallElement*>( 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
 
index a5543c8822a14cade003e683d42394519646047b..6b0f03138c3e44aa7edd1dc6e1bdc46a849b402f 100644 (file)
@@ -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;
 };
 
 
index f46baed8c209f16c2f12169b01fbb0a9e4bf338f..4daba11f8575cdb82ec8ed052654fa09dfb902c5 100644 (file)
@@ -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<SMESH_GroupObj*>( 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);
index 95eeb5a59854900fee672e9195271368f89f69ef..4e04546f42237bb77bfd10fb74bfb149a8d9c2dd 100644 (file)
@@ -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 };
 
index 1c257ff9984b06443214db299da3f1831bdf1e73..b346e68b467d50648abb1cbdf18b952d137e12b2 100644 (file)
@@ -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;
 
index 0a965ea85193bd28284d62afeb9564afc41c2a44..bb9fd64b185324fea24f498371bd67a37bedc711 100644 (file)
@@ -159,8 +159,10 @@ namespace SMESH
 
   std::map<SMDSAbs_ElementType,int> GetEntitiesFromObject(SMESH_VisualObj *theObject) {
     std::map<SMDSAbs_ElementType,int> entities;
-       entities.insert(std::pair<SMDSAbs_ElementType,int>(SMDSAbs_0DElement,
+    entities.insert(std::pair<SMDSAbs_ElementType,int>(SMDSAbs_0DElement,
                theObject ? theObject->GetNbEntities(SMDSAbs_0DElement) : 0));
+    entities.insert(std::pair<SMDSAbs_ElementType,int>(SMDSAbs_Ball,
+               theObject ? theObject->GetNbEntities(SMDSAbs_Ball) : 0));
     entities.insert(std::pair<SMDSAbs_ElementType,int>(SMDSAbs_Edge,
                theObject ? theObject->GetNbEntities(SMDSAbs_Edge) : 0));
     entities.insert(std::pair<SMDSAbs_ElementType,int>(SMDSAbs_Face,
index c52200bef9399d6730ca246ff6440e5374d04fae..e137a1c6d202d47ec858db715030421bd8653246 100644 (file)
@@ -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<SMDSAbs_ElementType,int> 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 = "<<aNbCells<<"; aCellsSize = "<<aCellsSize );
@@ -566,6 +569,7 @@ bool SMESH_VisualObjDef::IsValid() const
         //MESSAGE("SMESH_VisualObjDef::IsValid");
   return GetNbEntities(SMDSAbs_Node) > 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: