smesh/src/DriverMED/DriverMED_Family.h

147 lines
4.5 KiB
C
Raw Normal View History

2012-06-05 18:18:07 +06:00
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
2009-02-17 10:27:49 +05:00
//
2011-06-06 14:15:39 +06:00
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
2009-02-17 10:27:49 +05:00
//
2011-06-06 14:15:39 +06:00
// 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.
2004-06-18 14:34:31 +06:00
//
2011-06-06 14:15:39 +06:00
// 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.
2004-06-18 14:34:31 +06:00
//
2011-06-06 14:15:39 +06:00
// 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
2004-06-18 14:34:31 +06:00
//
2011-06-06 14:15:39 +06:00
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
2004-06-18 14:34:31 +06:00
//
2010-05-14 21:32:37 +06:00
2009-02-17 10:27:49 +05:00
// SMESH DriverMED : tool to split groups on families
2004-06-18 14:34:31 +06:00
// File : DriverMED_Family.hxx
// Author : Julia DOROVSKIKH
// Module : SMESH
// $Header$
2009-02-17 10:27:49 +05:00
//
2004-06-18 14:34:31 +06:00
#ifndef _INCLUDE_DRIVERMED_FAMILY
#define _INCLUDE_DRIVERMED_FAMILY
#include "SMESH_DriverMED.hxx"
2004-06-18 14:34:31 +06:00
#include "SMDS_Mesh.hxx"
2004-12-01 15:48:31 +05:00
#include "SMESHDS_GroupBase.hxx"
2004-06-18 14:34:31 +06:00
#include "SMESHDS_SubMesh.hxx"
2005-01-20 11:25:54 +05:00
#include "MED_Common.hxx"
2004-06-18 14:34:31 +06:00
#include <boost/shared_ptr.hpp>
#include <set>
#define REST_NODES_FAMILY 1
#define FIRST_NODE_FAMILY 2
#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
2004-06-18 14:34:31 +06:00
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;
2004-06-18 14:34:31 +06:00
class MESHDRIVERMED_EXPORT DriverMED_Family
2004-06-18 14:34:31 +06:00
{
public:
DriverMED_Family();
//! Methods for groups storing to MED
/*!
Split each group from list <theGroups> and each sub-mesh from list <theSubMeshes>
on some parts (families) on the basis of the elements membership in other groups
from <theGroups> and other sub-meshes from <theSubMeshes>.
Resulting families have no common elements.
*/
static
DriverMED_FamilyPtrList
MakeFamilies (const SMESHDS_SubMeshPtrMap& theSubMeshes,
2009-12-08 18:11:42 +05:00
const SMESHDS_GroupBasePtrList& theGroups,
const bool doGroupOfNodes,
const bool doGroupOfEdges,
const bool doGroupOfFaces,
const bool doGroupOfVolumes,
const bool doGroupOf0DElems,
const bool doGroupOfBalls);
//! Create TFamilyInfo for this family
MED::PFamilyInfo
GetFamilyInfo (const MED::PWrapper& theWrapper,
2009-12-08 18:11:42 +05:00
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);
2004-06-18 14:34:31 +06:00
public:
// Methods for groups reading from MED
void AddElement(const SMDS_MeshElement* theElement);
2004-06-18 14:34:31 +06:00
const MED::TStringSet& GetGroupNames() const;
void AddGroupName(std::string theGroupName);
2004-06-18 14:34:31 +06:00
void SetType(const SMDSAbs_ElementType theType);
SMDSAbs_ElementType GetType();
2009-12-08 18:11:42 +05:00
const std::set< SMDSAbs_ElementType >& GetTypes() const;
2004-06-18 14:34:31 +06:00
bool MemberOf(std::string theGroupName) const;
2004-06-18 14:34:31 +06:00
int GetGroupAttributVal() const;
void SetGroupAttributVal( int theValue);
2005-10-11 19:35:18 +06:00
2004-06-18 14:34:31 +06:00
private:
//! Initialize the tool by SMESHDS_GroupBase
2004-12-01 15:48:31 +05:00
void Init (SMESHDS_GroupBase* group);
2004-06-18 14:34:31 +06:00
//! Split <theSubMesh> on some parts (families) on the basis of the elements type.
static
DriverMED_FamilyPtrList
SplitByType(SMESHDS_SubMesh* theSubMesh,
2009-12-08 18:11:42 +05:00
const int theId);
2004-06-18 14:34:31 +06:00
/*! Remove from <Elements> elements, common with <by>,
Remove from <by> elements, common with <Elements>,
Create family <common> from common elements, with combined groups list.
*/
2004-06-18 14:34:31 +06:00
void Split (DriverMED_FamilyPtr by,
2009-12-08 18:11:42 +05:00
DriverMED_FamilyPtr common);
2004-06-18 14:34:31 +06:00
//! Check, if this family has empty list of elements
bool IsEmpty () const;
2004-06-18 14:34:31 +06:00
private:
int myId;
SMDSAbs_ElementType myType;
ElementsSet myElements;
2004-06-18 14:34:31 +06:00
MED::TStringSet myGroupNames;
int myGroupAttributVal;
2009-12-08 18:11:42 +05:00
std::set<SMDSAbs_ElementType> myTypes; // Issue 0020576
2004-06-18 14:34:31 +06:00
};
#endif