X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FDriverMED%2FDriverMED_Family.h;h=6ec769bbad86aa3de32e0a958a9ebceb38579bd1;hp=b5fc51f2e36a5155f6b024f4b964537e45315afa;hb=0635c9fc80f67d1e5dc0e94ec85f487286a92070;hpb=e4737e85f0da6d3f90fd08f6be1c2825195fe16f diff --git a/src/DriverMED/DriverMED_Family.h b/src/DriverMED/DriverMED_Family.h index b5fc51f2e..6ec769bba 100644 --- a/src/DriverMED/DriverMED_Family.h +++ b/src/DriverMED/DriverMED_Family.h @@ -1,37 +1,39 @@ -// SMESH DriverMED : tool to split groups on families +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// Copyright (C) 2003 CEA -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// SMESH DriverMED : tool to split groups on families // File : DriverMED_Family.hxx // Author : Julia DOROVSKIKH // Module : SMESH // $Header$ - +// #ifndef _INCLUDE_DRIVERMED_FAMILY #define _INCLUDE_DRIVERMED_FAMILY +#include "SMESH_DriverMED.hxx" + #include "SMDS_Mesh.hxx" #include "SMESHDS_GroupBase.hxx" #include "SMESHDS_SubMesh.hxx" -#include "MEDA_Wrapper.hxx" +#include "MED_Common.hxx" #include #include @@ -45,75 +47,92 @@ class DriverMED_Family; typedef boost::shared_ptr DriverMED_FamilyPtr; +typedef std::list DriverMED_FamilyPtrList; +typedef std::map SMESHDS_SubMeshPtrMap; +typedef std::list SMESHDS_GroupBasePtrList; +typedef std::set ElementsSet; -class DriverMED_Family +class MESHDRIVERMED_EXPORT DriverMED_Family { public: - // Methods for groups storing to MED - - static std::list MakeFamilies (const std::map & theSubMeshes, - const std::list& theGroups, - const bool doGroupOfNodes, - const bool doGroupOfEdges, - const bool doGroupOfFaces, - const bool doGroupOfVolumes); - // Split each group from list and each sub-mesh from list - // on some parts (families) on the basis of the elements membership in other groups - // from and other sub-meshes from . - // Resulting families have no common elements. - - MEDA::PFamilyInfo GetFamilyInfo (const MEDA::PMeshInfo& theMeshInfo) const; - // Create TFamilyInfo for this family - - const std::set& GetElements () const { return myElements; } - // Returns elements of this family - - int GetId () const { return myId; } - // Returns a family ID + DriverMED_Family(); + + //! Methods for groups storing to MED + /*! + Split each group from list and each sub-mesh from list + on some parts (families) on the basis of the elements membership in other groups + from and other sub-meshes from . + Resulting families have no common elements. + */ + static + DriverMED_FamilyPtrList + MakeFamilies (const SMESHDS_SubMeshPtrMap& theSubMeshes, + const SMESHDS_GroupBasePtrList& theGroups, + const bool doGroupOfNodes, + const bool doGroupOfEdges, + const bool doGroupOfFaces, + const bool doGroupOfVolumes); + + //! Create TFamilyInfo for this family + MED::PFamilyInfo + GetFamilyInfo (const MED::PWrapper& theWrapper, + const MED::PMeshInfo& theMeshInfo) const; + + //! Returns elements of this family + const ElementsSet& GetElements () const; + + //! Returns a family ID + int GetId () const; + + //! Sets a family ID + void SetId (const int theId); public: // Methods for groups reading from MED - void AddElement (const SMDS_MeshElement* theElement) { myElements.insert(theElement); } + void AddElement(const SMDS_MeshElement* theElement); - void AddGroupName (std::string theGroupName) { myGroupNames.insert(theGroupName); } + const MED::TStringSet& GetGroupNames() const; + void AddGroupName(std::string theGroupName); - void SetType (const SMDSAbs_ElementType theType) { myType = theType; } - SMDSAbs_ElementType GetType () { return myType; } + void SetType(const SMDSAbs_ElementType theType); + SMDSAbs_ElementType GetType(); - bool MemberOf (std::string theGroupName) const - { return (myGroupNames.find(theGroupName) != myGroupNames.end()); } + bool MemberOf(std::string theGroupName) const; - const MED::TStringSet& GetGroupNames () const { return myGroupNames; } + int GetGroupAttributVal() const; + void SetGroupAttributVal( int theValue); private: + //! Initialize the tool by SMESHDS_GroupBase void Init (SMESHDS_GroupBase* group); - // Initialize the tool by SMESHDS_GroupBase - static std::list SplitByType (SMESHDS_SubMesh* theSubMesh, - const int theId); - // Split on some parts (families) - // on the basis of the elements type. + //! Split on some parts (families) on the basis of the elements type. + static + DriverMED_FamilyPtrList + SplitByType(SMESHDS_SubMesh* theSubMesh, + const int theId); + + /*! Remove from elements, common with , + Remove from elements, common with , + Create family from common elements, with combined groups list. + */ void Split (DriverMED_FamilyPtr by, DriverMED_FamilyPtr common); - // Remove from elements, common with , - // Remove from elements, common with , - // Create family from common elements, with combined groups list. - void SetId (const int theId) { myId = theId; } - // Sets a family ID + //! Check, if this family has empty list of elements + bool IsEmpty () const; - bool IsEmpty () const { return myElements.empty(); } - // Check, if this family has empty list of elements private: int myId; SMDSAbs_ElementType myType; - std::set myElements; + ElementsSet myElements; MED::TStringSet myGroupNames; + int myGroupAttributVal; }; #endif