Container of mesh faces substituting other faces in the input mesh of 3D algorithm. More...
#include <SMESH_ProxyMesh.hxx>

Data Structures | |
| class | SubMesh |
| Proxy sub-mesh. More... | |
Public Types | |
| typedef boost::shared_ptr < SMESH_ProxyMesh > | Ptr |
| typedef std::map< const SMDS_MeshNode *, const SMDS_MeshNode *, TIDCompare > | TN2NMap |
Public Member Functions | |
| SMESH_ProxyMesh () | |
| Constructor; mesh must be set by a descendant class. | |
| SMESH_ProxyMesh (std::vector< SMESH_ProxyMesh::Ptr > &components) | |
| SMESH_ProxyMesh (const SMESH_Mesh &mesh) | |
| virtual | ~SMESH_ProxyMesh () |
| Destructor deletes proxy submeshes and tmp elemens. | |
| const SMESHDS_SubMesh * | GetSubMesh (const TopoDS_Shape &face) const |
| Returns the submesh of a shape; it can be a proxy sub-mesh. | |
| const SubMesh * | GetProxySubMesh (const TopoDS_Shape &face) const |
| Returns the proxy sub-mesh of a shape; it can be NULL. | |
| const SMDS_MeshNode * | GetProxyNode (const SMDS_MeshNode *node) const |
| Returns the proxy node of a node; the input node is returned if no proxy exists. | |
| SMDS_ElemIteratorPtr | GetFaces () const |
| Returns iterator on all faces of the mesh taking into account substitutions To be used in case of mesh without shape. | |
| SMDS_ElemIteratorPtr | GetFaces (const TopoDS_Shape &face) const |
| Returns iterator on all faces on the shape taking into account substitutions. | |
| int | NbFaces () const |
| Return total nb of faces taking into account substitutions. | |
| bool | IsTemporary (const SMDS_MeshElement *elem) const |
| Return true if the element is a temporary one. | |
| const SMESH_Mesh * | GetMesh () const |
| SMESHDS_Mesh * | GetMeshDS () const |
| Returns mesh DS. | |
Protected Member Functions | |
| void | setMesh (const SMESH_Mesh &mesh) |
| int | shapeIndex (const TopoDS_Shape &shape) const |
| Returns index of a shape. | |
| SubMesh * | findProxySubMesh (int shapeIndex=0) const |
| Returns a proxy sub-mesh. | |
| SubMesh * | getProxySubMesh (int shapeIndex) |
| Returns a proxy sub-mesh; it is created if not yet exists. | |
| SubMesh * | getProxySubMesh (const TopoDS_Shape &shape=TopoDS_Shape()) |
| Returns a proxy sub-mesh; it is created if not yet exists. | |
| bool | takeProxySubMesh (const TopoDS_Shape &shape, SMESH_ProxyMesh *proxyMesh) |
| Move proxy sub-mesh from other proxy mesh to this, returns true if sub-mesh found. | |
| void | takeTmpElemsInMesh (SMESH_ProxyMesh *proxyMesh) |
| Move tmp elements residing the _mesh from other proxy mesh to this. | |
| void | removeTmpElement (const SMDS_MeshElement *face) |
| Removes tmp faces from the _mesh. | |
| void | storeTmpElement (const SMDS_MeshElement *face) |
| Stores tmp element residing the _mesh. | |
| void | setNode2Node (const SMDS_MeshNode *srcNode, const SMDS_MeshNode *proxyNode, const SubMesh *subMesh) |
| Set node-node correspondence. | |
Protected Attributes | |
| std::vector< SMDSAbs_EntityType > | _allowedTypes |
Private Attributes | |
| const SMESH_Mesh * | _mesh |
| std::vector< SubMesh * > | _subMeshes |
| std::set< const SMDS_MeshElement * > | _elemsInMesh |
| SubMesh | _subContainer |
Container of mesh faces substituting other faces in the input mesh of 3D algorithm.
Definition at line 45 of file SMESH_ProxyMesh.hxx.
| typedef boost::shared_ptr<SMESH_ProxyMesh> SMESH_ProxyMesh.Ptr |
Definition at line 49 of file SMESH_ProxyMesh.hxx.
| typedef std::map<const SMDS_MeshNode*, const SMDS_MeshNode*, TIDCompare > SMESH_ProxyMesh.TN2NMap |
Definition at line 51 of file SMESH_ProxyMesh.hxx.
| SMESH_ProxyMesh::SMESH_ProxyMesh | ( | ) |
Constructor; mesh must be set by a descendant class.
Definition at line 39 of file SMESH_ProxyMesh.cxx.
:_mesh(0) { }
| SMESH_ProxyMesh.SMESH_ProxyMesh | ( | std::vector< SMESH_ProxyMesh::Ptr > & | components | ) |
| SMESH_ProxyMesh.SMESH_ProxyMesh | ( | const SMESH_Mesh & | mesh | ) |
Definition at line 90 of file SMESH_ProxyMesh.hxx.
References _mesh, and PAL_MESH_041_mesh.mesh.
| SMESH_ProxyMesh::~SMESH_ProxyMesh | ( | ) | [virtual] |
Destructor deletes proxy submeshes and tmp elemens.
Definition at line 100 of file SMESH_ProxyMesh.cxx.
References _elemsInMesh, _subMeshes, GetMeshDS(), and SMESHDS_Mesh.RemoveFreeElement().
{
for ( unsigned i = 0; i < _subMeshes.size(); ++i )
delete _subMeshes[i];
_subMeshes.clear();
set< const SMDS_MeshElement* >::iterator i = _elemsInMesh.begin();
for ( ; i != _elemsInMesh.end(); ++i )
GetMeshDS()->RemoveFreeElement( *i, 0 );
_elemsInMesh.clear();
}
| SMESH_ProxyMesh::SubMesh * SMESH_ProxyMesh::findProxySubMesh | ( | int | shapeIndex = 0 | ) | const [protected] |
Returns a proxy sub-mesh.
Definition at line 353 of file SMESH_ProxyMesh.cxx.
References _subMeshes.
Referenced by StdMeshers_QuadToTriaAdaptor.Compute2ndPart(), GetProxyNode(), and takeProxySubMesh().
{
return shapeIndex < int(_subMeshes.size()) ? _subMeshes[shapeIndex] : 0;
}
| SMDS_ElemIteratorPtr SMESH_ProxyMesh::GetFaces | ( | const TopoDS_Shape & | face | ) | const |
Returns iterator on all faces on the shape taking into account substitutions.
Definition at line 226 of file SMESH_ProxyMesh.cxx.
References _mesh, _subContainer, SMESHDS_SubMesh.AddSubMesh(), GetSubMesh(), SMESH_Mesh.HasShapeToMesh(), and SMESHDS_SubMesh.RemoveAllSubmeshes().
{
if ( !_mesh->HasShapeToMesh() )
return SMDS_ElemIteratorPtr();
_subContainer.RemoveAllSubmeshes();
TopTools_IndexedMapOfShape FF;
TopExp::MapShapes( shape, TopAbs_FACE, FF );
for ( int i = 1; i <= FF.Extent(); ++i )
if ( const SMESHDS_SubMesh* sm = GetSubMesh( FF(i)))
_subContainer.AddSubMesh( sm );
return _subContainer.SMESHDS_SubMesh::GetElements();
}
| SMDS_ElemIteratorPtr SMESH_ProxyMesh::GetFaces | ( | ) | const |
Returns iterator on all faces of the mesh taking into account substitutions To be used in case of mesh without shape.
Definition at line 249 of file SMESH_ProxyMesh.cxx.
References _allowedTypes, _mesh, _subContainer, _subMeshes, SMESHDS_SubMesh.AddSubMesh(), SMDS_Mesh.elementsIterator(), GetMeshDS(), SMESH_Mesh.HasShapeToMesh(), SMESH_Mesh.NbFaces(), NbFaces(), SMESHDS_SubMesh.NbSubMeshes(), SMESHDS_SubMesh.RemoveAllSubmeshes(), and SMDSAbs_Face.
Referenced by StdMeshers_QuadToTriaAdaptor.Compute(), VISCOUS._ViscousBuilder.inflate(), and VISCOUS._ViscousBuilder.smoothAndCheck().
{
if ( _mesh->HasShapeToMesh() )
return SMDS_ElemIteratorPtr();
_subContainer.RemoveAllSubmeshes();
for ( unsigned i = 0; i < _subMeshes.size(); ++i )
if ( _subMeshes[i] )
_subContainer.AddSubMesh( _subMeshes[i] );
if ( _subContainer.NbSubMeshes() == 0 ) // no elements substituted
return GetMeshDS()->elementsIterator(SMDSAbs_Face);
// if _allowedTypes is empty, only elements from _subMeshes are returned,...
SMDS_ElemIteratorPtr proxyIter = _subContainer.SMESHDS_SubMesh::GetElements();
if ( _allowedTypes.empty() || NbFaces() == _mesh->NbFaces() )
return proxyIter;
// ... else elements filtered using allowedTypes are additionally returned
SMDS_ElemIteratorPtr facesIter = GetMeshDS()->elementsIterator(SMDSAbs_Face);
SMDS_ElemIteratorPtr filterIter( new TFilteringIterator( _allowedTypes, facesIter ));
vector< SMDS_ElemIteratorPtr > iters(2);
iters[0] = proxyIter;
iters[1] = filterIter;
typedef vector< SMDS_ElemIteratorPtr > TElemIterVector;
typedef SMDS_IteratorOnIterators<const SMDS_MeshElement *, TElemIterVector> TItersIter;
return SMDS_ElemIteratorPtr( new TItersIter( iters ));
}
| const SMESH_Mesh* SMESH_ProxyMesh.GetMesh | ( | ) | const |
| SMESHDS_Mesh * SMESH_ProxyMesh::GetMeshDS | ( | ) | const |
Returns mesh DS.
Definition at line 364 of file SMESH_ProxyMesh.cxx.
References _mesh, and SMESH_Mesh.GetMeshDS().
Referenced by StdMeshers_QuadToTriaAdaptor.Compute2ndPart(), GetFaces(), GetProxyNode(), GetSubMesh(), VISCOUS._ViscousBuilder.MakeN2NMap(), NbFaces(), removeTmpElement(), shapeIndex(), and ~SMESH_ProxyMesh().
{
return (SMESHDS_Mesh*)( _mesh ? _mesh->GetMeshDS() : 0 );
}
| const SMDS_MeshNode * SMESH_ProxyMesh::GetProxyNode | ( | const SMDS_MeshNode * | node | ) | const |
Returns the proxy node of a node; the input node is returned if no proxy exists.
Definition at line 161 of file SMESH_ProxyMesh.cxx.
References _mesh, findProxySubMesh(), SMESH_Mesh.GetAncestors(), GetMeshDS(), SMDS_MeshNode.GetPosition(), SMDS_MeshElement.getshapeId(), SMESH_MesherHelper.GetSubShapeByNode(), SMDS_Position.GetTypeOfPosition(), ex29_refine.node(), SMESH_fixation.shape, shapeIndex(), and SMDS_TOP_FACE.
Referenced by SMESH_MesherHelper.LoadNodeColumns().
{
const SMDS_MeshNode* proxy = node;
if ( node->GetPosition()->GetTypeOfPosition() == SMDS_TOP_FACE )
{
if ( const SubMesh* proxySM = findProxySubMesh( node->getshapeId() ))
proxy = proxySM->GetProxyNode( node );
}
else
{
TopoDS_Shape shape = SMESH_MesherHelper::GetSubShapeByNode( node, GetMeshDS());
TopTools_ListIteratorOfListOfShape ancIt;
if ( !shape.IsNull() ) ancIt.Initialize( _mesh->GetAncestors( shape ));
for ( ; ancIt.More() && proxy == node; ancIt.Next() )
if ( const SubMesh* proxySM = findProxySubMesh( shapeIndex(ancIt.Value())))
proxy = proxySM->GetProxyNode( node );
}
return proxy;
}
| const SMESH_ProxyMesh::SubMesh * SMESH_ProxyMesh::GetProxySubMesh | ( | const TopoDS_Shape & | face | ) | const |
Returns the proxy sub-mesh of a shape; it can be NULL.
Definition at line 149 of file SMESH_ProxyMesh.cxx.
References _subMeshes, and shapeIndex().
Referenced by VISCOUS._ViscousBuilder.MakeN2NMap().
{
int i = shapeIndex(shape);
return i < _subMeshes.size() ? _subMeshes[i] : 0;
}
| SMESH_ProxyMesh::SubMesh * SMESH_ProxyMesh::getProxySubMesh | ( | int | shapeIndex | ) | [protected] |
Returns a proxy sub-mesh; it is created if not yet exists.
Definition at line 327 of file SMESH_ProxyMesh.cxx.
References _subMeshes.
Referenced by StdMeshers_QuadToTriaAdaptor.Compute(), VISCOUS._MeshOfSolid.getFaceSubM(), and getProxySubMesh().
{
if ( int(_subMeshes.size()) <= index )
_subMeshes.resize( index+1, 0 );
if ( !_subMeshes[index] )
_subMeshes[index] = new SubMesh( index );
return _subMeshes[index];
}
| SMESH_ProxyMesh::SubMesh * SMESH_ProxyMesh::getProxySubMesh | ( | const TopoDS_Shape & | shape = TopoDS_Shape() | ) | [protected] |
Returns a proxy sub-mesh; it is created if not yet exists.
Definition at line 342 of file SMESH_ProxyMesh.cxx.
References getProxySubMesh(), and shapeIndex().
{
return getProxySubMesh( shapeIndex( shape ));
}
| const SMESHDS_SubMesh * SMESH_ProxyMesh::GetSubMesh | ( | const TopoDS_Shape & | face | ) | const |
Returns the submesh of a shape; it can be a proxy sub-mesh.
Definition at line 129 of file SMESH_ProxyMesh.cxx.
References _subMeshes, GetMeshDS(), SMESHDS_Mesh.MeshElements(), and shapeIndex().
Referenced by StdMeshers_QuadToTriaAdaptor.Compute(), GetFaces(), SMESH_MesherHelper.LoadNodeColumns(), and NbFaces().
{
const SMESHDS_SubMesh* sm = 0;
int i = shapeIndex(shape);
if ( i < _subMeshes.size() )
sm = _subMeshes[i];
if ( !sm )
sm = GetMeshDS()->MeshElements( i );
return sm;
}
| bool SMESH_ProxyMesh::IsTemporary | ( | const SMDS_MeshElement * | elem | ) | const |
Return true if the element is a temporary one.
Definition at line 465 of file SMESH_ProxyMesh.cxx.
References _elemsInMesh, and SMDS_MeshElement.GetID().
Referenced by SMESH_MesherHelper.LoadNodeColumns().
{
return ( elem->GetID() < 1 ) || _elemsInMesh.count( elem );
}
| int SMESH_ProxyMesh::NbFaces | ( | ) | const |
Return total nb of faces taking into account substitutions.
Definition at line 285 of file SMESH_ProxyMesh.cxx.
References _allowedTypes, _mesh, _subMeshes, GetMeshDS(), SMDS_Mesh.GetMeshInfo(), SMESH_Mesh.GetShapeToMesh(), GetSubMesh(), SMESH_Mesh.HasShapeToMesh(), SMDS_MeshInfo.NbEntities(), SMDS_Mesh.NbFaces(), SMDSEntity_Quad_Quadrangle, and SMDSEntity_Triangle.
Referenced by GetFaces().
{
int nb = 0;
if ( _mesh->HasShapeToMesh() )
{
TopTools_IndexedMapOfShape FF;
TopExp::MapShapes( _mesh->GetShapeToMesh(), TopAbs_FACE, FF );
for ( int i = 1; i <= FF.Extent(); ++i )
if ( const SMESHDS_SubMesh* sm = GetSubMesh( FF(i)))
nb += sm->NbElements();
}
else
{
if ( _subMeshes.empty() )
return GetMeshDS()->NbFaces();
for ( unsigned i = 0; i < _subMeshes.size(); ++i )
if ( _subMeshes[i] )
nb += _subMeshes[i]->NbElements();
// if _allowedTypes is empty, only elements from _subMeshes are returned,
// else elements filtered using allowedTypes are additionally returned
if ( !_allowedTypes.empty() )
{
for ( int t = SMDSEntity_Triangle; t <= SMDSEntity_Quad_Quadrangle; ++t )
{
bool allowed =
( find( _allowedTypes.begin(), _allowedTypes.end(), t ) != _allowedTypes.end() );
if ( allowed )
nb += GetMeshDS()->GetMeshInfo().NbEntities( SMDSAbs_EntityType( t ));
}
}
}
return nb;
}
| void SMESH_ProxyMesh::removeTmpElement | ( | const SMDS_MeshElement * | face | ) | [protected] |
Removes tmp faces from the _mesh.
Definition at line 415 of file SMESH_ProxyMesh.cxx.
References _elemsInMesh, PAL_MESH_043_3D.face, SMDS_MeshElement.GetID(), GetMeshDS(), and SMESHDS_Mesh.RemoveFreeElement().
Referenced by StdMeshers_QuadToTriaAdaptor.Compute().
{
if ( face && face->GetID() > 0 )
{
set< const SMDS_MeshElement* >::iterator i = _elemsInMesh.find( face );
if ( i != _elemsInMesh.end() )
{
GetMeshDS()->RemoveFreeElement( face, 0 );
_elemsInMesh.erase( i );
}
}
else
{
delete face;
}
}
| void SMESH_ProxyMesh.setMesh | ( | const SMESH_Mesh & | mesh | ) | [protected] |
Definition at line 124 of file SMESH_ProxyMesh.hxx.
References _mesh, and PAL_MESH_041_mesh.mesh.
Referenced by VISCOUS._MeshOfSolid._MeshOfSolid(), and StdMeshers_QuadToTriaAdaptor.Compute().
| void SMESH_ProxyMesh::setNode2Node | ( | const SMDS_MeshNode * | srcNode, |
| const SMDS_MeshNode * | proxyNode, | ||
| const SubMesh * | subMesh | ||
| ) | [protected] |
Set node-node correspondence.
Reimplemented in VISCOUS._MeshOfSolid.
Definition at line 449 of file SMESH_ProxyMesh.cxx.
References SMESH_ProxyMesh.SubMesh._n2n.
Referenced by VISCOUS._MeshOfSolid.setNode2Node().
{
SubMesh* sm = const_cast<SubMesh*>( subMesh );
if ( !subMesh->_n2n )
sm->_n2n = new TN2NMap;
sm->_n2n->insert( make_pair( srcNode, proxyNode ));
}
| int SMESH_ProxyMesh::shapeIndex | ( | const TopoDS_Shape & | shape | ) | const [protected] |
Returns index of a shape.
Definition at line 118 of file SMESH_ProxyMesh.cxx.
References _mesh, GetMeshDS(), SMESH_Mesh.HasShapeToMesh(), and SMESHDS_Mesh.ShapeToIndex().
Referenced by VISCOUS._MeshOfSolid.getFaceSubM(), GetProxyNode(), getProxySubMesh(), GetProxySubMesh(), GetSubMesh(), and takeProxySubMesh().
{
return ( shape.IsNull() || !_mesh->HasShapeToMesh() ? 0 : GetMeshDS()->ShapeToIndex(shape));
}
| void SMESH_ProxyMesh::storeTmpElement | ( | const SMDS_MeshElement * | face | ) | [protected] |
Stores tmp element residing the _mesh.
Definition at line 438 of file SMESH_ProxyMesh.cxx.
References _elemsInMesh.
Referenced by StdMeshers_QuadToTriaAdaptor.Compute().
{
_elemsInMesh.insert( face );
}
| bool SMESH_ProxyMesh::takeProxySubMesh | ( | const TopoDS_Shape & | shape, |
| SMESH_ProxyMesh * | proxyMesh | ||
| ) | [protected] |
Move proxy sub-mesh from other proxy mesh to this, returns true if sub-mesh found.
Definition at line 375 of file SMESH_ProxyMesh.cxx.
References _mesh, _subMeshes, findProxySubMesh(), and shapeIndex().
Referenced by StdMeshers_QuadToTriaAdaptor.Compute().
{
if ( proxyMesh && proxyMesh->_mesh == _mesh )
{
int iS = shapeIndex( shape );
if ( SubMesh* sm = proxyMesh->findProxySubMesh( iS ))
{
if ( iS >= int(_subMeshes.size()) )
_subMeshes.resize( iS + 1, 0 );
_subMeshes[iS] = sm;
proxyMesh->_subMeshes[iS] = 0;
return true;
}
}
return false;
}
| void SMESH_ProxyMesh::takeTmpElemsInMesh | ( | SMESH_ProxyMesh * | proxyMesh | ) | [protected] |
Move tmp elements residing the _mesh from other proxy mesh to this.
Definition at line 399 of file SMESH_ProxyMesh.cxx.
References _elemsInMesh.
Referenced by StdMeshers_QuadToTriaAdaptor.Compute().
{
if ( proxyMesh )
{
_elemsInMesh.insert( proxyMesh->_elemsInMesh.begin(),
proxyMesh->_elemsInMesh.end());
proxyMesh->_elemsInMesh.clear();
}
}
std::vector< SMDSAbs_EntityType> SMESH_ProxyMesh._allowedTypes [protected] |
Definition at line 157 of file SMESH_ProxyMesh.hxx.
Referenced by StdMeshers_QuadToTriaAdaptor.Compute(), GetFaces(), and NbFaces().
std::set< const SMDS_MeshElement* > SMESH_ProxyMesh._elemsInMesh [private] |
Definition at line 167 of file SMESH_ProxyMesh.hxx.
Referenced by IsTemporary(), removeTmpElement(), storeTmpElement(), takeTmpElemsInMesh(), and ~SMESH_ProxyMesh().
const SMESH_Mesh* SMESH_ProxyMesh._mesh [private] |
Definition at line 161 of file SMESH_ProxyMesh.hxx.
Referenced by GetFaces(), GetMesh(), GetMeshDS(), GetProxyNode(), NbFaces(), setMesh(), shapeIndex(), SMESH_ProxyMesh(), and takeProxySubMesh().
SubMesh SMESH_ProxyMesh._subContainer [mutable, private] |
Definition at line 170 of file SMESH_ProxyMesh.hxx.
Referenced by GetFaces().
std::vector< SubMesh* > SMESH_ProxyMesh._subMeshes [private] |
Definition at line 164 of file SMESH_ProxyMesh.hxx.
Referenced by findProxySubMesh(), GetFaces(), getProxySubMesh(), GetProxySubMesh(), GetSubMesh(), NbFaces(), takeProxySubMesh(), and ~SMESH_ProxyMesh().