Back to index

salome-smesh  6.5.0
SMESHDS_Mesh.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  SMESH SMESHDS : management of mesh data and SMESH document
00024 //  File   : SMESHDS_Mesh.hxx
00025 //  Module : SMESH
00026 //
00027 #ifndef _SMESHDS_Mesh_HeaderFile
00028 #define _SMESHDS_Mesh_HeaderFile
00029 
00030 #include "SMESH_SMESHDS.hxx"
00031 
00032 #include "SMDS_Mesh.hxx"
00033 #include "SMDS_MeshNode.hxx"
00034 #include "SMDS_Mesh0DElement.hxx"
00035 #include "SMDS_MeshEdge.hxx"
00036 #include "SMDS_MeshFace.hxx"
00037 #include "SMDS_MeshVolume.hxx"
00038 #include "SMESHDS_Hypothesis.hxx"
00039 #include "SMESHDS_SubMesh.hxx"
00040 #include "SMESHDS_Script.hxx"
00041 
00042 #include <TopTools_IndexedMapOfShape.hxx>
00043 #include <TopoDS_Shape.hxx>
00044 #include <TopoDS_Solid.hxx>
00045 #include <TopoDS_Shell.hxx>
00046 #include <TopoDS_Face.hxx>
00047 #include <TopoDS_Vertex.hxx>
00048 #include <TopoDS_Edge.hxx>
00049 
00050 #include <NCollection_DataMap.hxx>
00051 #include <map>
00052 /*
00053  * Using of native hash_map isn't portable and don't work on WIN32 platform.
00054  * So this functionality implement on new NCollection_DataMap technology
00055  */
00056 #include "SMESHDS_DataMapOfShape.hxx"
00057 
00058 class SMESHDS_GroupBase;
00059 class DownIdType;
00060 
00061 class SMESHDS_EXPORT SMESHDS_Mesh:public SMDS_Mesh{
00062 public:
00063   SMESHDS_Mesh(int theMeshID, bool theIsEmbeddedMode);
00064   bool IsEmbeddedMode();
00065   void SetPersistentId(int id);
00066   int GetPersistentId() const;
00067 
00068   void ShapeToMesh(const TopoDS_Shape & S);
00069   TopoDS_Shape ShapeToMesh() const;
00070   bool AddHypothesis(const TopoDS_Shape & SS, const SMESHDS_Hypothesis * H);
00071   bool RemoveHypothesis(const TopoDS_Shape & S, const SMESHDS_Hypothesis * H);
00072   
00073   virtual SMDS_MeshNode* AddNodeWithID(double x, double y, double z, int ID);
00074   virtual SMDS_MeshNode* AddNode(double x, double y, double z);
00075   
00076   virtual SMDS_Mesh0DElement* Add0DElementWithID(int nodeID, int ID);
00077   virtual SMDS_Mesh0DElement* Add0DElementWithID(const SMDS_MeshNode * node, int ID);
00078   virtual SMDS_Mesh0DElement* Add0DElement      (const SMDS_MeshNode * node);
00079   
00080   virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int ID);
00081   virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
00082                                        const SMDS_MeshNode * n2, 
00083                                        int ID);
00084   virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
00085                                  const SMDS_MeshNode * n2);
00086   
00087   // 2d order edge with 3 nodes: n12 - node between n1 and n2
00088   virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int n12, int ID);
00089   virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
00090                                        const SMDS_MeshNode * n2, 
00091                                        const SMDS_MeshNode * n12, 
00092                                        int ID);
00093   virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
00094                                  const SMDS_MeshNode * n2,
00095                                  const SMDS_MeshNode * n12);
00096   // tria 3
00097   virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int ID);
00098   virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
00099                                        const SMDS_MeshNode * n2,
00100                                        const SMDS_MeshNode * n3, 
00101                                        int ID);
00102   virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
00103                                  const SMDS_MeshNode * n2,
00104                                  const SMDS_MeshNode * n3);
00105   // quad 4
00106   virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4, int ID);
00107   virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
00108                                        const SMDS_MeshNode * n2,
00109                                        const SMDS_MeshNode * n3,
00110                                        const SMDS_MeshNode * n4, 
00111                                        int ID);
00112   virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
00113                                  const SMDS_MeshNode * n2,
00114                                  const SMDS_MeshNode * n3,
00115                                  const SMDS_MeshNode * n4);
00116 
00117   // 2d order triangle of 6 nodes
00118   virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3,
00119                                        int n12,int n23,int n31, int ID);
00120   virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
00121                                        const SMDS_MeshNode * n2,
00122                                        const SMDS_MeshNode * n3, 
00123                                        const SMDS_MeshNode * n12,
00124                                        const SMDS_MeshNode * n23,
00125                                        const SMDS_MeshNode * n31, 
00126                                        int ID);
00127   virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
00128                                  const SMDS_MeshNode * n2,
00129                                  const SMDS_MeshNode * n3,
00130                                  const SMDS_MeshNode * n12,
00131                                  const SMDS_MeshNode * n23,
00132                                  const SMDS_MeshNode * n31);
00133 
00134   // 2d order quadrangle
00135   virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4,
00136                                        int n12,int n23,int n34,int n41, int ID);
00137   virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
00138                                        const SMDS_MeshNode * n2,
00139                                        const SMDS_MeshNode * n3,
00140                                        const SMDS_MeshNode * n4, 
00141                                        const SMDS_MeshNode * n12,
00142                                        const SMDS_MeshNode * n23,
00143                                        const SMDS_MeshNode * n34,
00144                                        const SMDS_MeshNode * n41, 
00145                                        int ID);
00146   virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
00147                                  const SMDS_MeshNode * n2,
00148                                  const SMDS_MeshNode * n3,
00149                                  const SMDS_MeshNode * n4,
00150                                  const SMDS_MeshNode * n12,
00151                                  const SMDS_MeshNode * n23,
00152                                  const SMDS_MeshNode * n34,
00153                                  const SMDS_MeshNode * n41);
00154 
00155   // bi-quadratic quadrangle of 9 nodes
00156   virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4,
00157                                        int n12,int n23,int n34,int n41, int nCenter, int ID);
00158   virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
00159                                        const SMDS_MeshNode * n2,
00160                                        const SMDS_MeshNode * n3,
00161                                        const SMDS_MeshNode * n4, 
00162                                        const SMDS_MeshNode * n12,
00163                                        const SMDS_MeshNode * n23,
00164                                        const SMDS_MeshNode * n34,
00165                                        const SMDS_MeshNode * n41, 
00166                                        const SMDS_MeshNode * nCenter, 
00167                                        int ID);
00168   virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
00169                                  const SMDS_MeshNode * n2,
00170                                  const SMDS_MeshNode * n3,
00171                                  const SMDS_MeshNode * n4,
00172                                  const SMDS_MeshNode * n12,
00173                                  const SMDS_MeshNode * n23,
00174                                  const SMDS_MeshNode * n34,
00175                                  const SMDS_MeshNode * n41,
00176                                  const SMDS_MeshNode * nCenter);
00177   // tetra 4
00178   virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int ID);
00179   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
00180                                            const SMDS_MeshNode * n2,
00181                                            const SMDS_MeshNode * n3,
00182                                            const SMDS_MeshNode * n4, 
00183                                            int ID);
00184   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
00185                                      const SMDS_MeshNode * n2,
00186                                      const SMDS_MeshNode * n3,
00187                                      const SMDS_MeshNode * n4);
00188   // pyra 5
00189   virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int ID);
00190   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
00191                                            const SMDS_MeshNode * n2,
00192                                            const SMDS_MeshNode * n3,
00193                                            const SMDS_MeshNode * n4,
00194                                            const SMDS_MeshNode * n5, 
00195                                            int ID);
00196   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
00197                                      const SMDS_MeshNode * n2,
00198                                      const SMDS_MeshNode * n3,
00199                                      const SMDS_MeshNode * n4,
00200                                      const SMDS_MeshNode * n5);
00201   // penta 6
00202   virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int ID);
00203   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
00204                                            const SMDS_MeshNode * n2,
00205                                            const SMDS_MeshNode * n3,
00206                                            const SMDS_MeshNode * n4,
00207                                            const SMDS_MeshNode * n5,
00208                                            const SMDS_MeshNode * n6, 
00209                                            int ID);
00210   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
00211                                      const SMDS_MeshNode * n2,
00212                                      const SMDS_MeshNode * n3,
00213                                      const SMDS_MeshNode * n4,
00214                                      const SMDS_MeshNode * n5,
00215                                      const SMDS_MeshNode * n6);
00216   // hexa 8
00217   virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int ID);
00218   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
00219                                            const SMDS_MeshNode * n2,
00220                                            const SMDS_MeshNode * n3,
00221                                            const SMDS_MeshNode * n4,
00222                                            const SMDS_MeshNode * n5,
00223                                            const SMDS_MeshNode * n6,
00224                                            const SMDS_MeshNode * n7,
00225                                            const SMDS_MeshNode * n8, 
00226                                            int ID);
00227   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
00228                                      const SMDS_MeshNode * n2,
00229                                      const SMDS_MeshNode * n3,
00230                                      const SMDS_MeshNode * n4,
00231                                      const SMDS_MeshNode * n5,
00232                                      const SMDS_MeshNode * n6,
00233                                      const SMDS_MeshNode * n7,
00234                                      const SMDS_MeshNode * n8);
00235   // hexagonal prism of 12 nodes
00236   virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6,
00237                                            int n7, int n8, int n9, int n10, int n11, int n12, int ID);
00238   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
00239                                            const SMDS_MeshNode * n2,
00240                                            const SMDS_MeshNode * n3,
00241                                            const SMDS_MeshNode * n4,
00242                                            const SMDS_MeshNode * n5,
00243                                            const SMDS_MeshNode * n6,
00244                                            const SMDS_MeshNode * n7,
00245                                            const SMDS_MeshNode * n8, 
00246                                            const SMDS_MeshNode * n9, 
00247                                            const SMDS_MeshNode * n10, 
00248                                            const SMDS_MeshNode * n11, 
00249                                            const SMDS_MeshNode * n12, 
00250                                            int ID);
00251   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
00252                                      const SMDS_MeshNode * n2,
00253                                      const SMDS_MeshNode * n3,
00254                                      const SMDS_MeshNode * n4,
00255                                      const SMDS_MeshNode * n5,
00256                                      const SMDS_MeshNode * n6,
00257                                      const SMDS_MeshNode * n7,
00258                                      const SMDS_MeshNode * n8, 
00259                                      const SMDS_MeshNode * n9, 
00260                                      const SMDS_MeshNode * n10, 
00261                                      const SMDS_MeshNode * n11, 
00262                                      const SMDS_MeshNode * n12);
00263 
00264   // 2d order tetrahedron of 10 nodes
00265   virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
00266                                            int n12,int n23,int n31,
00267                                            int n14,int n24,int n34, int ID);
00268   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
00269                                            const SMDS_MeshNode * n2,
00270                                            const SMDS_MeshNode * n3,
00271                                            const SMDS_MeshNode * n4, 
00272                                            const SMDS_MeshNode * n12,
00273                                            const SMDS_MeshNode * n23,
00274                                            const SMDS_MeshNode * n31,
00275                                            const SMDS_MeshNode * n14, 
00276                                            const SMDS_MeshNode * n24,
00277                                            const SMDS_MeshNode * n34, 
00278                                            int ID);
00279   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
00280                                      const SMDS_MeshNode * n2,
00281                                      const SMDS_MeshNode * n3,
00282                                      const SMDS_MeshNode * n4,
00283                                      const SMDS_MeshNode * n12,
00284                                      const SMDS_MeshNode * n23,
00285                                      const SMDS_MeshNode * n31,
00286                                      const SMDS_MeshNode * n14, 
00287                                      const SMDS_MeshNode * n24,
00288                                      const SMDS_MeshNode * n34);
00289 
00290   // 2d order pyramid of 13 nodes
00291   virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5,
00292                                            int n12,int n23,int n34,int n41,
00293                                            int n15,int n25,int n35,int n45,
00294                                            int ID);
00295   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
00296                                            const SMDS_MeshNode * n2,
00297                                            const SMDS_MeshNode * n3,
00298                                            const SMDS_MeshNode * n4,
00299                                            const SMDS_MeshNode * n5, 
00300                                            const SMDS_MeshNode * n12,
00301                                            const SMDS_MeshNode * n23,
00302                                            const SMDS_MeshNode * n34,
00303                                            const SMDS_MeshNode * n41, 
00304                                            const SMDS_MeshNode * n15,
00305                                            const SMDS_MeshNode * n25,
00306                                            const SMDS_MeshNode * n35,
00307                                            const SMDS_MeshNode * n45, 
00308                                            int ID);
00309   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
00310                                      const SMDS_MeshNode * n2,
00311                                      const SMDS_MeshNode * n3,
00312                                      const SMDS_MeshNode * n4,
00313                                      const SMDS_MeshNode * n5,
00314                                      const SMDS_MeshNode * n12,
00315                                      const SMDS_MeshNode * n23,
00316                                      const SMDS_MeshNode * n34,
00317                                      const SMDS_MeshNode * n41, 
00318                                      const SMDS_MeshNode * n15,
00319                                      const SMDS_MeshNode * n25,
00320                                      const SMDS_MeshNode * n35,
00321                                      const SMDS_MeshNode * n45);
00322 
00323   // 2d order Pentahedron with 15 nodes
00324   virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3,
00325                                            int n4, int n5, int n6,
00326                                            int n12,int n23,int n31,
00327                                            int n45,int n56,int n64,
00328                                            int n14,int n25,int n36,
00329                                            int ID);
00330   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
00331                                            const SMDS_MeshNode * n2,
00332                                            const SMDS_MeshNode * n3,
00333                                            const SMDS_MeshNode * n4,
00334                                            const SMDS_MeshNode * n5,
00335                                            const SMDS_MeshNode * n6, 
00336                                            const SMDS_MeshNode * n12,
00337                                            const SMDS_MeshNode * n23,
00338                                            const SMDS_MeshNode * n31, 
00339                                            const SMDS_MeshNode * n45,
00340                                            const SMDS_MeshNode * n56,
00341                                            const SMDS_MeshNode * n64, 
00342                                            const SMDS_MeshNode * n14,
00343                                            const SMDS_MeshNode * n25,
00344                                            const SMDS_MeshNode * n36, 
00345                                            int ID);
00346   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
00347                                      const SMDS_MeshNode * n2,
00348                                      const SMDS_MeshNode * n3,
00349                                      const SMDS_MeshNode * n4,
00350                                      const SMDS_MeshNode * n5,
00351                                      const SMDS_MeshNode * n6, 
00352                                      const SMDS_MeshNode * n12,
00353                                      const SMDS_MeshNode * n23,
00354                                      const SMDS_MeshNode * n31, 
00355                                      const SMDS_MeshNode * n45,
00356                                      const SMDS_MeshNode * n56,
00357                                      const SMDS_MeshNode * n64, 
00358                                      const SMDS_MeshNode * n14,
00359                                      const SMDS_MeshNode * n25,
00360                                      const SMDS_MeshNode * n36);
00361 
00362   // 2d order Hexahedrons with 20 nodes
00363   virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
00364                                            int n5, int n6, int n7, int n8,
00365                                            int n12,int n23,int n34,int n41,
00366                                            int n56,int n67,int n78,int n85,
00367                                            int n15,int n26,int n37,int n48,
00368                                            int ID);
00369   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
00370                                            const SMDS_MeshNode * n2,
00371                                            const SMDS_MeshNode * n3,
00372                                            const SMDS_MeshNode * n4,
00373                                            const SMDS_MeshNode * n5,
00374                                            const SMDS_MeshNode * n6,
00375                                            const SMDS_MeshNode * n7,
00376                                            const SMDS_MeshNode * n8, 
00377                                            const SMDS_MeshNode * n12,
00378                                            const SMDS_MeshNode * n23,
00379                                            const SMDS_MeshNode * n34,
00380                                            const SMDS_MeshNode * n41, 
00381                                            const SMDS_MeshNode * n56,
00382                                            const SMDS_MeshNode * n67,
00383                                            const SMDS_MeshNode * n78,
00384                                            const SMDS_MeshNode * n85, 
00385                                            const SMDS_MeshNode * n15,
00386                                            const SMDS_MeshNode * n26,
00387                                            const SMDS_MeshNode * n37,
00388                                            const SMDS_MeshNode * n48, 
00389                                            int ID);
00390   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
00391                                      const SMDS_MeshNode * n2,
00392                                      const SMDS_MeshNode * n3,
00393                                      const SMDS_MeshNode * n4,
00394                                      const SMDS_MeshNode * n5,
00395                                      const SMDS_MeshNode * n6,
00396                                      const SMDS_MeshNode * n7,
00397                                      const SMDS_MeshNode * n8, 
00398                                      const SMDS_MeshNode * n12,
00399                                      const SMDS_MeshNode * n23,
00400                                      const SMDS_MeshNode * n34,
00401                                      const SMDS_MeshNode * n41, 
00402                                      const SMDS_MeshNode * n56,
00403                                      const SMDS_MeshNode * n67,
00404                                      const SMDS_MeshNode * n78,
00405                                      const SMDS_MeshNode * n85, 
00406                                      const SMDS_MeshNode * n15,
00407                                      const SMDS_MeshNode * n26,
00408                                      const SMDS_MeshNode * n37,
00409                                      const SMDS_MeshNode * n48);
00410 
00411   // 2d order Hexahedrons with 27 nodes
00412   virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
00413                                            int n5, int n6, int n7, int n8,
00414                                            int n12,int n23,int n34,int n41,
00415                                            int n56,int n67,int n78,int n85,
00416                                            int n15,int n26,int n37,int n48,
00417                                            int n1234,int n1256,int n2367,int n3478,
00418                                            int n1458,int n5678,int nCenter,
00419                                            int ID);
00420   virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
00421                                            const SMDS_MeshNode * n2,
00422                                            const SMDS_MeshNode * n3,
00423                                            const SMDS_MeshNode * n4,
00424                                            const SMDS_MeshNode * n5,
00425                                            const SMDS_MeshNode * n6,
00426                                            const SMDS_MeshNode * n7,
00427                                            const SMDS_MeshNode * n8, 
00428                                            const SMDS_MeshNode * n12,
00429                                            const SMDS_MeshNode * n23,
00430                                            const SMDS_MeshNode * n34,
00431                                            const SMDS_MeshNode * n41, 
00432                                            const SMDS_MeshNode * n56,
00433                                            const SMDS_MeshNode * n67,
00434                                            const SMDS_MeshNode * n78,
00435                                            const SMDS_MeshNode * n85, 
00436                                            const SMDS_MeshNode * n15,
00437                                            const SMDS_MeshNode * n26,
00438                                            const SMDS_MeshNode * n37,
00439                                            const SMDS_MeshNode * n48, 
00440                                            const SMDS_MeshNode * n1234,
00441                                            const SMDS_MeshNode * n1256,
00442                                            const SMDS_MeshNode * n2367,
00443                                            const SMDS_MeshNode * n3478,
00444                                            const SMDS_MeshNode * n1458,
00445                                            const SMDS_MeshNode * n5678,
00446                                            const SMDS_MeshNode * nCenter,
00447                                            int ID);
00448   virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
00449                                      const SMDS_MeshNode * n2,
00450                                      const SMDS_MeshNode * n3,
00451                                      const SMDS_MeshNode * n4,
00452                                      const SMDS_MeshNode * n5,
00453                                      const SMDS_MeshNode * n6,
00454                                      const SMDS_MeshNode * n7,
00455                                      const SMDS_MeshNode * n8, 
00456                                      const SMDS_MeshNode * n12,
00457                                      const SMDS_MeshNode * n23,
00458                                      const SMDS_MeshNode * n34,
00459                                      const SMDS_MeshNode * n41, 
00460                                      const SMDS_MeshNode * n56,
00461                                      const SMDS_MeshNode * n67,
00462                                      const SMDS_MeshNode * n78,
00463                                      const SMDS_MeshNode * n85, 
00464                                      const SMDS_MeshNode * n15,
00465                                      const SMDS_MeshNode * n26,
00466                                      const SMDS_MeshNode * n37,
00467                                      const SMDS_MeshNode * n48,
00468                                      const SMDS_MeshNode * n1234,
00469                                      const SMDS_MeshNode * n1256,
00470                                      const SMDS_MeshNode * n2367,
00471                                      const SMDS_MeshNode * n3478,
00472                                      const SMDS_MeshNode * n1458,
00473                                      const SMDS_MeshNode * n5678,
00474                                      const SMDS_MeshNode * nCenter);
00475 
00476   virtual SMDS_MeshFace* AddPolygonalFaceWithID (const std::vector<int>& nodes_ids,
00477                                                  const int               ID);
00478 
00479   virtual SMDS_MeshFace* AddPolygonalFaceWithID (const std::vector<const SMDS_MeshNode*>& nodes,
00480                                                  const int                                ID);
00481 
00482   virtual SMDS_MeshFace* AddPolygonalFace (const std::vector<const SMDS_MeshNode*>& nodes);
00483 
00484   virtual SMDS_MeshVolume* AddPolyhedralVolumeWithID
00485                            (const std::vector<int>& nodes_ids,
00486                             const std::vector<int>& quantities,
00487                             const int               ID);
00488 
00489   virtual SMDS_MeshVolume* AddPolyhedralVolumeWithID
00490                            (const std::vector<const SMDS_MeshNode*>& nodes,
00491                             const std::vector<int>&                  quantities,
00492                             const int                                ID);
00493 
00494   virtual SMDS_MeshVolume* AddPolyhedralVolume
00495                            (const std::vector<const SMDS_MeshNode*>& nodes,
00496                             const std::vector<int>&                  quantities);
00497 
00498   void MoveNode(const SMDS_MeshNode *, double x, double y, double z);
00499   virtual void RemoveNode(const SMDS_MeshNode *);
00500   void RemoveElement(const SMDS_MeshElement *);
00501 
00506   void RemoveFreeNode   (const SMDS_MeshNode *,    SMESHDS_SubMesh *, bool fromGroups=true);
00507   void RemoveFreeElement(const SMDS_MeshElement *, SMESHDS_SubMesh *, bool fromGroups=true);
00508 
00509   void ClearMesh();
00510 
00511   bool ChangeElementNodes(const SMDS_MeshElement * elem,
00512                           const SMDS_MeshNode    * nodes[],
00513                           const int                nbnodes);
00514   bool ChangePolygonNodes(const SMDS_MeshElement * elem,
00515                           std::vector<const SMDS_MeshNode*> nodes);
00516   bool ChangePolyhedronNodes(const SMDS_MeshElement * elem,
00517                              std::vector<const SMDS_MeshNode*> nodes,
00518                              std::vector<int>                  quantities);
00519   bool ModifyCellNodes(int smdsVolId, std::map<int,int> localClonedNodeIds);
00520   void Renumber (const bool isNodes, const int startID=1, const int deltaID=1);
00521 
00522   void SetNodeInVolume(SMDS_MeshNode * aNode, const TopoDS_Shell & S);
00523   void SetNodeInVolume(SMDS_MeshNode * aNode, const TopoDS_Solid & S);
00524   void SetNodeOnFace(SMDS_MeshNode * aNode, const TopoDS_Face & S, double u=0., double v=0.);
00525   void SetNodeOnEdge(SMDS_MeshNode * aNode, const TopoDS_Edge & S, double u=0.);
00526   void SetNodeOnVertex(SMDS_MeshNode * aNode, const TopoDS_Vertex & S);
00527   void UnSetNodeOnShape(const SMDS_MeshNode * aNode);
00528   void SetMeshElementOnShape(const SMDS_MeshElement * anElt,
00529                              const TopoDS_Shape & S);
00530   void UnSetMeshElementOnShape(const SMDS_MeshElement * anElt,
00531                                const TopoDS_Shape & S);
00532   bool HasMeshElements(const TopoDS_Shape & S) const;
00533   SMESHDS_SubMesh * MeshElements(const TopoDS_Shape & S) const;
00534   SMESHDS_SubMesh * MeshElements(const int Index) const;
00535   std::list<int> SubMeshIndices() const;
00536   const std::map<int,SMESHDS_SubMesh*>& SubMeshes() const
00537   { return myShapeIndexToSubMesh; }
00538 
00539   bool HasHypothesis(const TopoDS_Shape & S);
00540   const std::list<const SMESHDS_Hypothesis*>& GetHypothesis(const TopoDS_Shape & S) const;
00541   bool IsUsedHypothesis(const SMESHDS_Hypothesis * H) const;
00542   SMESHDS_Script * GetScript();
00543   void ClearScript();
00544   int ShapeToIndex(const TopoDS_Shape & aShape) const;
00545   const TopoDS_Shape& IndexToShape(int ShapeIndex) const;
00546   int MaxShapeIndex() const { return myIndexToShape.Extent(); }
00547   int MaxSubMeshIndex() const;
00548 
00549   SMESHDS_SubMesh * NewSubMesh(int Index);
00550   int AddCompoundSubmesh(const TopoDS_Shape& S, TopAbs_ShapeEnum type = TopAbs_SHAPE);
00551   void SetNodeInVolume(const SMDS_MeshNode * aNode, int Index);
00552   void SetNodeOnFace(SMDS_MeshNode * aNode, int Index , double u=0., double v=0.);
00553   void SetNodeOnEdge(SMDS_MeshNode * aNode, int Index , double u=0.);
00554   void SetNodeOnVertex(SMDS_MeshNode * aNode, int Index);
00555   void SetMeshElementOnShape(const SMDS_MeshElement * anElt, int Index);
00556 
00557   // Groups. SMESHDS_Mesh is not an owner of groups
00558   void AddGroup (SMESHDS_GroupBase* theGroup)      { myGroups.insert(theGroup); }
00559   void RemoveGroup (SMESHDS_GroupBase* theGroup)   { myGroups.erase(theGroup); }
00560   int GetNbGroups() const                      { return myGroups.size(); }
00561   const std::set<SMESHDS_GroupBase*>& GetGroups() const { return myGroups; }
00562 
00563   bool IsGroupOfSubShapes (const TopoDS_Shape& aSubShape) const;
00564 
00565   virtual void compactMesh();
00566   void CleanDownWardConnectivity();
00567   void BuildDownWardConnectivity(bool withEdges);
00568 
00569   ~SMESHDS_Mesh();
00570   
00571 private:
00572   void addNodeToSubmesh( const SMDS_MeshNode* aNode, int Index )
00573   {
00574     //Update or build submesh
00575     std::map<int,SMESHDS_SubMesh*>::iterator it = myShapeIndexToSubMesh.find( Index );
00576     if ( it == myShapeIndexToSubMesh.end() )
00577       it = myShapeIndexToSubMesh.insert( std::make_pair(Index, new SMESHDS_SubMesh(this, Index) )).first;
00578     it->second->AddNode( aNode ); // add aNode to submesh
00579   }
00580   
00581   /*int HashCode( const TopoDS_Shape& S, const Standard_Integer theUpper ) const
00582   {
00583       return S.HashCode(2147483647);
00584   }*/ 
00585 
00586   typedef std::list<const SMESHDS_Hypothesis*> THypList;
00587 
00588   typedef NCollection_DataMap< TopoDS_Shape, THypList > ShapeToHypothesis;
00589 
00590   ShapeToHypothesis          myShapeToHypothesis;
00591 
00592   int                        myMeshID, myPersistentID;
00593   TopoDS_Shape               myShape;
00594 
00595   typedef std::map<int,SMESHDS_SubMesh*> TShapeIndexToSubMesh;
00596   TShapeIndexToSubMesh myShapeIndexToSubMesh;
00597 
00598   TopTools_IndexedMapOfShape myIndexToShape;
00599 
00600   typedef std::set<SMESHDS_GroupBase*> TGroups;
00601   TGroups myGroups;
00602 
00603   SMESHDS_Script*            myScript;
00604   bool                       myIsEmbeddedMode;
00605 
00606   // optimize addition of nodes/elements to submeshes by, SetNodeInVolume() etc:
00607   // avoid search of submeshes in maps
00608   bool add( const SMDS_MeshElement* elem, SMESHDS_SubMesh* subMesh );
00609   SMESHDS_SubMesh* getSubmesh( const TopoDS_Shape & shape);
00610   SMESHDS_SubMesh* getSubmesh( const int            Index );
00611   int                        myCurSubID;
00612   TopoDS_Shape               myCurSubShape;
00613   SMESHDS_SubMesh*           myCurSubMesh;
00614 };
00615 
00616 
00617 #endif