Back to index

salome-smesh  6.5.0
DriverMED_Family.h
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 DriverMED : tool to split groups on families
00024 //  File   : DriverMED_Family.hxx
00025 //  Author : Julia DOROVSKIKH
00026 //  Module : SMESH
00027 //  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/DriverMED/DriverMED_Family.h,v 1.12.2.1.6.3.8.1 2012-04-13 09:31:03 vsr Exp $
00028 //
00029 #ifndef _INCLUDE_DRIVERMED_FAMILY
00030 #define _INCLUDE_DRIVERMED_FAMILY
00031 
00032 #include "SMESH_DriverMED.hxx"
00033 
00034 #include "SMDS_Mesh.hxx"
00035 #include "SMESHDS_GroupBase.hxx"
00036 #include "SMESHDS_SubMesh.hxx"
00037 #include "MED_Common.hxx"
00038 
00039 #include <boost/shared_ptr.hpp>
00040 #include <set>
00041 
00042 #define REST_NODES_FAMILY 1
00043 #define REST_EDGES_FAMILY -1
00044 #define REST_FACES_FAMILY -2
00045 #define REST_VOLUMES_FAMILY -3
00046 #define FIRST_NODE_FAMILY 2
00047 #define FIRST_ELEM_FAMILY -4
00048 
00049 class DriverMED_Family;
00050 typedef boost::shared_ptr<DriverMED_Family> DriverMED_FamilyPtr;
00051 typedef std::list<DriverMED_FamilyPtr> DriverMED_FamilyPtrList;
00052 typedef std::map<int,SMESHDS_SubMesh*> SMESHDS_SubMeshPtrMap;
00053 typedef std::list<SMESHDS_GroupBase*> SMESHDS_GroupBasePtrList;
00054 typedef std::set<const SMDS_MeshElement*> ElementsSet;
00055 
00056 class MESHDRIVERMED_EXPORT DriverMED_Family
00057 {
00058  public:
00059 
00060   DriverMED_Family();
00061 
00063 
00069   static 
00070   DriverMED_FamilyPtrList
00071   MakeFamilies (const SMESHDS_SubMeshPtrMap& theSubMeshes,
00072                 const SMESHDS_GroupBasePtrList& theGroups,
00073                 const bool doGroupOfNodes,
00074                 const bool doGroupOfEdges,
00075                 const bool doGroupOfFaces,
00076                 const bool doGroupOfVolumes);
00077 
00079   MED::PFamilyInfo 
00080   GetFamilyInfo (const MED::PWrapper& theWrapper, 
00081                  const MED::PMeshInfo& theMeshInfo) const;
00082 
00084   const ElementsSet& GetElements () const;
00085 
00087   int GetId () const;
00088 
00090   void SetId (const int theId);
00091 
00092  public:
00093 
00094   // Methods for groups reading from MED
00095 
00096   void AddElement(const SMDS_MeshElement* theElement);
00097 
00098   const MED::TStringSet& GetGroupNames() const;
00099   void AddGroupName(std::string theGroupName);
00100 
00101   void SetType(const SMDSAbs_ElementType theType);
00102   SMDSAbs_ElementType GetType();
00103   const std::set< SMDSAbs_ElementType >& GetTypes() const;
00104 
00105   bool MemberOf(std::string theGroupName) const;
00106 
00107   int GetGroupAttributVal() const;
00108   void SetGroupAttributVal( int theValue);
00109 
00110  private:
00112   void Init (SMESHDS_GroupBase* group);
00113 
00115   static
00116   DriverMED_FamilyPtrList 
00117   SplitByType(SMESHDS_SubMesh* theSubMesh,
00118               const int        theId);
00119 
00120 
00125   void Split (DriverMED_FamilyPtr by,
00126               DriverMED_FamilyPtr common);
00127 
00129   bool IsEmpty () const;
00130 
00131 
00132  private:
00133   int                           myId;
00134   SMDSAbs_ElementType           myType;
00135   ElementsSet                   myElements;
00136   MED::TStringSet               myGroupNames;
00137   int                           myGroupAttributVal;
00138   std::set<SMDSAbs_ElementType> myTypes; // Issue 0020576
00139 };
00140 
00141 #endif