Version: 6.3.1

src/SMESH_I/SMESH_Mesh_i.hxx

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  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 //  File   : SMESH_Mesh_i.hxx
00023 //  Author : Paul RASCLE, EDF
00024 //  Module : SMESH
00025 
00026 #ifndef _SMESH_MESH_I_HXX_
00027 #define _SMESH_MESH_I_HXX_
00028 
00029 #include "SMESH.hxx"
00030 
00031 #include <SALOMEconfig.h>
00032 #include CORBA_SERVER_HEADER(SMESH_Mesh)
00033 #include CORBA_SERVER_HEADER(SMESH_Group)
00034 #include CORBA_SERVER_HEADER(SMESH_Hypothesis)
00035 #include CORBA_CLIENT_HEADER(GEOM_Gen)
00036 #include CORBA_CLIENT_HEADER(MED)
00037 
00038 #include "SMESH_Hypothesis.hxx"
00039 #include "SMESH_Mesh.hxx"
00040 //#include "SMESH_subMesh_i.hxx"
00041 #include "SMESH_subMesh.hxx"
00042 
00043 #include "SALOME_GenericObj_i.hh"
00044 
00045 class SMESH_Gen_i;
00046 class SMESH_GroupBase_i;
00047 class SMESH_subMesh_i;
00048 
00049 #include <map>
00050 
00051 class SMESH_I_EXPORT SMESH_Mesh_i:
00052   public virtual POA_SMESH::SMESH_Mesh,
00053   public virtual SALOME::GenericObj_i
00054 {
00055   SMESH_Mesh_i();
00056   SMESH_Mesh_i(const SMESH_Mesh_i&);
00057 public:
00058   SMESH_Mesh_i( PortableServer::POA_ptr thePOA,
00059                 SMESH_Gen_i*            myGen_i,
00060                 CORBA::Long             studyId );
00061 
00062   virtual ~SMESH_Mesh_i();
00063 
00064   // --- CORBA
00065   void SetShape( GEOM::GEOM_Object_ptr theShapeObject )
00066     throw (SALOME::SALOME_Exception);
00067 
00068   CORBA::Boolean HasShapeToMesh()
00069     throw (SALOME::SALOME_Exception);
00070 
00071   GEOM::GEOM_Object_ptr GetShapeToMesh()
00072     throw (SALOME::SALOME_Exception);
00073 
00074   void Clear()
00075     throw (SALOME::SALOME_Exception);
00076 
00077   void ClearSubMesh(CORBA::Long ShapeID)
00078     throw (SALOME::SALOME_Exception);
00079 
00080   SMESH::Hypothesis_Status AddHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
00081                                          SMESH::SMESH_Hypothesis_ptr anHyp)
00082     throw (SALOME::SALOME_Exception);
00083 
00084   SMESH::Hypothesis_Status RemoveHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
00085                                             SMESH::SMESH_Hypothesis_ptr anHyp)
00086     throw (SALOME::SALOME_Exception);
00087 
00088   SMESH::ListOfHypothesis* GetHypothesisList(GEOM::GEOM_Object_ptr aSubShapeObject)
00089     throw (SALOME::SALOME_Exception);
00090 
00091   SMESH::SMESH_subMesh_ptr GetSubMesh(GEOM::GEOM_Object_ptr aSubShapeObject, const char* theName)
00092     throw (SALOME::SALOME_Exception);
00093 
00094   void RemoveSubMesh( SMESH::SMESH_subMesh_ptr theSubMesh )
00095     throw (SALOME::SALOME_Exception);
00096 
00097   SMESH::SMESH_Group_ptr CreateGroup( SMESH::ElementType theElemType, const char* theName )
00098     throw (SALOME::SALOME_Exception);
00099 
00100   SMESH::SMESH_GroupOnGeom_ptr CreateGroupFromGEOM(SMESH::ElementType    theElemType,
00101                                                    const char*           theName,
00102                                                    GEOM::GEOM_Object_ptr theGeomObj )
00103     throw (SALOME::SALOME_Exception);
00104 
00105   void RemoveGroup( SMESH::SMESH_GroupBase_ptr theGroup )
00106     throw (SALOME::SALOME_Exception);
00107 
00108   void RemoveGroupWithContents( SMESH::SMESH_GroupBase_ptr theGroup )
00109     throw (SALOME::SALOME_Exception);
00110 
00111   SMESH::ListOfGroups* GetGroups()
00112     throw (SALOME::SALOME_Exception);
00113 
00114   CORBA::Long NbGroups()
00115     throw (SALOME::SALOME_Exception);
00116 
00117   SMESH::SMESH_Group_ptr UnionGroups( SMESH::SMESH_GroupBase_ptr theGroup1,
00118                                       SMESH::SMESH_GroupBase_ptr theGroup2,
00119                                       const char* theName )
00120     throw (SALOME::SALOME_Exception);
00121 
00122   SMESH::SMESH_Group_ptr UnionListOfGroups( const SMESH::ListOfGroups& theGroups,
00123                                             const char* theName)
00124     throw (SALOME::SALOME_Exception);
00125 
00126   SMESH::SMESH_Group_ptr IntersectGroups( SMESH::SMESH_GroupBase_ptr theGroup1,
00127                                           SMESH::SMESH_GroupBase_ptr theGroup2,
00128                                           const char* theName )
00129     throw (SALOME::SALOME_Exception);
00130 
00131   SMESH::SMESH_Group_ptr IntersectListOfGroups( const SMESH::ListOfGroups&  theGroups,
00132                                                 const char* theName )
00133     throw (SALOME::SALOME_Exception);
00134 
00135   SMESH::SMESH_Group_ptr CutGroups( SMESH::SMESH_GroupBase_ptr theGroup1,
00136                                     SMESH::SMESH_GroupBase_ptr theGroup2,
00137                                     const char* theName )
00138     throw (SALOME::SALOME_Exception);
00139 
00140   SMESH::SMESH_Group_ptr CutListOfGroups( const SMESH::ListOfGroups& theMainGroups,
00141                                           const SMESH::ListOfGroups& theToolGroups,
00142                                           const char* theName )
00143   throw (SALOME::SALOME_Exception);
00144 
00145   SMESH::SMESH_Group_ptr CreateDimGroup( const SMESH::ListOfGroups& theGroups,
00146                                          SMESH::ElementType theElemType,
00147                                          const char* theName )
00148   throw (SALOME::SALOME_Exception);
00149 
00150 
00151   SMESH::SMESH_Group_ptr ConvertToStandalone( SMESH::SMESH_GroupOnGeom_ptr theGeomGroup );
00152 
00153 //    SMESH::string_array* GetLog(CORBA::Boolean clearAfterGet)
00154 //      throw (SALOME::SALOME_Exception);
00155 
00156   SMESH::log_array* GetLog(CORBA::Boolean clearAfterGet)
00157     throw (SALOME::SALOME_Exception);
00158 
00159   SMESH::SMESH_MeshEditor_ptr GetMeshEditor();
00160 
00161   SMESH::SMESH_MeshEditor_ptr GetMeshEditPreviewer();
00162 
00163   CORBA::Boolean HasModificationsToDiscard() throw (SALOME::SALOME_Exception);
00164 
00165   void ClearLog()
00166     throw (SALOME::SALOME_Exception);
00167 
00168   CORBA::Long GetId()
00169     throw (SALOME::SALOME_Exception);
00170 
00171   CORBA::Long GetStudyId()
00172     throw (SALOME::SALOME_Exception);
00173 
00174   // --- C++ interface
00175   void SetImpl(::SMESH_Mesh* impl);
00176   ::SMESH_Mesh& GetImpl();         // :: force no namespace here
00177 
00178   SMESH_Gen_i* GetGen() { return _gen_i; }
00179 
00180   int ImportUNVFile( const char* theFileName )
00181     throw (SALOME::SALOME_Exception);
00182 
00183   int ImportSTLFile( const char* theFileName )
00184     throw (SALOME::SALOME_Exception);
00185 
00189   SMESH::DriverMED_ReadStatus ImportMEDFile( const char* theFileName, const char* theMeshName )
00190     throw (SALOME::SALOME_Exception);
00191 
00195   void SetAutoColor(CORBA::Boolean theAutoColor)
00196     throw (SALOME::SALOME_Exception);
00197 
00198   CORBA::Boolean GetAutoColor()
00199     throw (SALOME::SALOME_Exception);
00200 
00204   CORBA::Boolean HasDuplicatedGroupNamesMED();
00208   char* GetVersionString(SMESH::MED_VERSION version, CORBA::Short nbDigits);
00209 
00210   void ExportToMEDX( const char* file, CORBA::Boolean auto_groups, SMESH::MED_VERSION theVersion, CORBA::Boolean overwrite )
00211     throw (SALOME::SALOME_Exception);
00212   void ExportToMED( const char* file, CORBA::Boolean auto_groups, SMESH::MED_VERSION theVersion )
00213     throw (SALOME::SALOME_Exception);
00214   void ExportMED( const char* file, CORBA::Boolean auto_groups )
00215     throw (SALOME::SALOME_Exception);
00216 
00217   void ExportDAT( const char* file )
00218     throw (SALOME::SALOME_Exception);
00219   void ExportUNV( const char* file )
00220     throw (SALOME::SALOME_Exception);
00221   void ExportSTL( const char* file, bool isascii )
00222     throw (SALOME::SALOME_Exception);
00223 
00224   SALOME_MED::MESH_ptr GetMEDMesh()
00225     throw (SALOME::SALOME_Exception);
00226 
00227   CORBA::Long NbNodes()
00228     throw (SALOME::SALOME_Exception);
00229 
00230   CORBA::Long NbElements()
00231     throw (SALOME::SALOME_Exception);
00232 
00233   CORBA::Long Nb0DElements()
00234     throw (SALOME::SALOME_Exception);
00235 
00236   CORBA::Long NbEdges()
00237     throw (SALOME::SALOME_Exception);
00238 
00239   CORBA::Long NbEdgesOfOrder(SMESH::ElementOrder order)
00240     throw (SALOME::SALOME_Exception);
00241 
00242   CORBA::Long NbFaces()
00243     throw (SALOME::SALOME_Exception);
00244 
00245   CORBA::Long NbFacesOfOrder(SMESH::ElementOrder order)
00246     throw (SALOME::SALOME_Exception);
00247 
00248   CORBA::Long NbTriangles()
00249     throw (SALOME::SALOME_Exception);
00250 
00251   CORBA::Long NbTrianglesOfOrder(SMESH::ElementOrder order)
00252     throw (SALOME::SALOME_Exception);
00253 
00254   CORBA::Long NbQuadrangles()
00255     throw (SALOME::SALOME_Exception);
00256 
00257   CORBA::Long NbQuadranglesOfOrder(SMESH::ElementOrder order)
00258     throw (SALOME::SALOME_Exception);
00259 
00260   CORBA::Long NbPolygons()
00261     throw (SALOME::SALOME_Exception);
00262 
00263   CORBA::Long NbVolumes()
00264     throw (SALOME::SALOME_Exception);
00265 
00266   CORBA::Long NbVolumesOfOrder(SMESH::ElementOrder order)
00267     throw (SALOME::SALOME_Exception);
00268 
00269   CORBA::Long NbTetras()
00270     throw (SALOME::SALOME_Exception);
00271 
00272   CORBA::Long NbTetrasOfOrder(SMESH::ElementOrder order)
00273     throw (SALOME::SALOME_Exception);
00274 
00275   CORBA::Long NbHexas()
00276     throw (SALOME::SALOME_Exception);
00277 
00278   CORBA::Long NbHexasOfOrder(SMESH::ElementOrder order)
00279     throw (SALOME::SALOME_Exception);
00280 
00281   CORBA::Long NbPyramids()
00282     throw (SALOME::SALOME_Exception);
00283 
00284   CORBA::Long NbPyramidsOfOrder(SMESH::ElementOrder order)
00285     throw (SALOME::SALOME_Exception);
00286 
00287   CORBA::Long NbPrisms()
00288     throw (SALOME::SALOME_Exception);
00289 
00290   CORBA::Long NbPrismsOfOrder(SMESH::ElementOrder order)
00291     throw (SALOME::SALOME_Exception);
00292 
00293   CORBA::Long NbPolyhedrons()
00294     throw (SALOME::SALOME_Exception);
00295 
00296   CORBA::Long NbSubMesh()
00297     throw (SALOME::SALOME_Exception);
00298 
00299   SMESH::long_array* GetElementsId()
00300     throw (SALOME::SALOME_Exception);
00301 
00302   SMESH::long_array* GetElementsByType( SMESH::ElementType theElemType )
00303     throw (SALOME::SALOME_Exception);
00304 
00305   SMESH::long_array* GetNodesId()
00306     throw (SALOME::SALOME_Exception);
00307 
00308   SMESH::ElementType GetElementType( CORBA::Long id, bool iselem )
00309     throw (SALOME::SALOME_Exception);
00310 
00311   SMESH::EntityType GetElementGeomType( CORBA::Long id )
00312     throw (SALOME::SALOME_Exception);
00313 
00317   SMESH::long_array* GetSubMeshElementsId(CORBA::Long ShapeID)
00318     throw (SALOME::SALOME_Exception);
00319 
00325   SMESH::long_array* GetSubMeshNodesId(CORBA::Long ShapeID, CORBA::Boolean all)
00326     throw (SALOME::SALOME_Exception);
00327 
00331   SMESH::ElementType GetSubMeshElementType(CORBA::Long ShapeID)
00332     throw (SALOME::SALOME_Exception);
00333 
00334   char* Dump();
00335 
00336   // Internal methods not available through CORBA
00337   // They are called by corresponding interface methods
00338   SMESH_Hypothesis::Hypothesis_Status addHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
00339                                                     SMESH::SMESH_Hypothesis_ptr anHyp);
00340 
00341   SMESH_Hypothesis::Hypothesis_Status removeHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
00342                                                        SMESH::SMESH_Hypothesis_ptr anHyp);
00343 
00344   static SMESH::Hypothesis_Status
00345   ConvertHypothesisStatus (SMESH_Hypothesis::Hypothesis_Status theStatus);
00346 
00347   static void PrepareForWriting (const char* file, bool overwrite = true);
00348 
00349   //int importMEDFile( const char* theFileName, const char* theMeshName );
00350 
00351   SMESH::SMESH_subMesh_ptr createSubMesh( GEOM::GEOM_Object_ptr theSubShapeObject );
00352 
00353   void removeSubMesh(SMESH::SMESH_subMesh_ptr theSubMesh,
00354                      GEOM::GEOM_Object_ptr theSubShapeObject );
00355 
00356   SMESH::SMESH_GroupBase_ptr createGroup(SMESH::ElementType  theElemType,
00357                                          const char*         theName,
00358                                          const TopoDS_Shape& theShape = TopoDS_Shape());
00359 
00360   void removeGroup( const int theId );
00361 
00362   SMESH::SMESH_subMesh_ptr getSubMesh(int shapeID);
00363   // return an existing subMesh object for the shapeID. shapeID == submeshID.
00364 
00365   const std::map<int, SMESH::SMESH_GroupBase_ptr>& getGroups() { return _mapGroups; }
00366   // return an existing group object.
00367 
00373   void CheckGeomGroupModif();
00374 
00375   CORBA::LongLong GetMeshPtr();
00376 
00380   void CreateGroupServants();
00381 
00385   SMESH::ListOfGroups* GetGroups(const std::list<int>& groupIDs) const;
00386 
00391   SMESH::double_array* GetNodeXYZ(CORBA::Long id);
00392 
00397   SMESH::long_array* GetNodeInverseElements(CORBA::Long id);
00398 
00402   SMESH::NodePosition* GetNodePosition(CORBA::Long NodeID);
00403 
00408   CORBA::Long GetShapeID(CORBA::Long id);
00409 
00415   CORBA::Long GetShapeIDForElem(CORBA::Long id);
00416 
00421   CORBA::Long GetElemNbNodes(CORBA::Long id);
00422 
00426   SMESH::long_array* GetElemNodes(CORBA::Long id);
00427 
00433   CORBA::Long GetElemNode(CORBA::Long id, CORBA::Long index);
00434 
00439   CORBA::Boolean IsMediumNode(CORBA::Long ide, CORBA::Long idn);
00440 
00445   CORBA::Boolean IsMediumNodeOfAnyElem(CORBA::Long idn,
00446                                        SMESH::ElementType theElemType);
00447 
00451   CORBA::Long ElemNbEdges(CORBA::Long id);
00452 
00456   CORBA::Long ElemNbFaces(CORBA::Long id);
00460   SMESH::long_array* GetElemFaceNodes(CORBA::Long elemId, CORBA::Short faceIndex);
00461 
00465   CORBA::Long FindElementByNodes(const SMESH::long_array& nodes);
00466 
00470   CORBA::Boolean IsPoly(CORBA::Long id);
00471 
00475   CORBA::Boolean IsQuadratic(CORBA::Long id);
00476 
00480   SMESH::double_array* BaryCenter(CORBA::Long id);
00481 
00485   virtual SALOME_MED::MedFileInfo* GetMEDFileInfo();
00486 
00490   void SetParameters (const char* theParameters);
00491 
00495   char* GetParameters();
00496 
00500   SMESH::string_array* GetLastParameters();
00501 
00505   static void CollectMeshInfo(const SMDS_ElemIteratorPtr theItr,
00506                               SMESH::long_array&         theInfo);
00507 
00511   virtual SMESH::submesh_array_array* GetMeshOrder();
00515   virtual ::CORBA::Boolean SetMeshOrder(const SMESH::submesh_array_array& theSubMeshArray);
00516 
00517 
00518   // =========================
00519   // SMESH_IDSource interface
00520   // =========================
00521 
00522   virtual SMESH::long_array* GetIDs();
00528   virtual SMESH::long_array* GetMeshInfo();
00532   virtual SMESH::array_of_ElementType* GetTypes();
00536   virtual SMESH::SMESH_Mesh_ptr GetMesh();
00537 
00538 
00539   std::map<int, SMESH_subMesh_i*> _mapSubMesh_i; //NRI
00540   std::map<int, ::SMESH_subMesh*> _mapSubMesh;   //NRI
00541 
00542 private:
00546   void checkGroupNames();
00547 
00551   void convertMeshOrder(const TListOfListOfInt&     theIdsOrder,
00552                         SMESH::submesh_array_array& theSubMeshOrder,
00553                         const bool                  theIsDump);
00554 
00555 private:
00556 
00557   static int myIdGenerator;
00558   ::SMESH_Mesh* _impl;  // :: force no namespace here
00559   SMESH_Gen_i* _gen_i;
00560   int _id;          // id given by creator (unique within the creator instance)
00561   int _studyId;
00562   std::map<int, SMESH::SMESH_subMesh_ptr>    _mapSubMeshIor;
00563   std::map<int, SMESH::SMESH_GroupBase_ptr>  _mapGroups;
00564   std::map<int, SMESH::SMESH_Hypothesis_ptr> _mapHypo;
00565   SALOME_MED::MedFileInfo_var myFileInfo;
00566 
00567 private:
00568 
00569   // Data used to track changes of GEOM groups
00570   struct TGeomGroupData {
00571     // keep study entry and not ior because GEOM_Object actually changes if
00572     // number of items in a group varies (1) <-> (>1)
00573     std::string       _groupEntry;
00574     std::set<int>     _indices; // indices of group items within group's main shape
00575     CORBA::Object_ptr _smeshObject; // SMESH object depending on GEOM group
00576   };
00577   std::list<TGeomGroupData> _geomGroupData;
00578 
00582   void addGeomGroupData(GEOM::GEOM_Object_ptr theGeomObj,
00583                         CORBA::Object_ptr     theSmeshObj);
00587   void removeGeomGroupData(CORBA::Object_ptr theSmeshObj);
00591   TopoDS_Shape newGroupShape( TGeomGroupData & groupData);
00592 
00593 };
00594 
00595 #endif
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS