Proxy sub-mesh. More...
#include <SMESH_ProxyMesh.hxx>

Public Member Functions | |
| const TN2NMap * | GetNodeNodeMap () const |
| const SMDS_MeshNode * | GetProxyNode (const SMDS_MeshNode *n) const |
| Return a proxy node or an input node. | |
| virtual void | AddElement (const SMDS_MeshElement *e) |
| Store an element. | |
| virtual int | NbElements () const |
| Return number of elements in a proxy submesh. | |
| virtual SMDS_ElemIteratorPtr | GetElements () const |
| Return elements of a proxy submesh. | |
| virtual void | Clear () |
| Deletes temporary elements. | |
| virtual bool | Contains (const SMDS_MeshElement *ME) const |
| Check presence of element inside it-self. | |
| template<class ITERATOR > | |
| void | ChangeElements (ITERATOR it, ITERATOR end) |
| SubMesh (int index=0) | |
| ~SubMesh () | |
| virtual bool | IsComplexSubmesh () const |
| virtual bool | RemoveElement (const SMDS_MeshElement *ME, bool isElemDeleted) |
| virtual void | AddNode (const SMDS_MeshNode *ME) |
| virtual bool | RemoveNode (const SMDS_MeshNode *ME, bool isNodeDeleted) |
| void | AddSubMesh (const SMESHDS_SubMesh *theSubMesh) |
| bool | RemoveSubMesh (const SMESHDS_SubMesh *theSubMesh) |
| void | RemoveAllSubmeshes () |
| bool | ContainsSubMesh (const SMESHDS_SubMesh *theSubMesh) const |
| int | NbSubMeshes () const |
| SMESHDS_SubMeshIteratorPtr | GetSubMeshIterator () const |
| virtual int | NbNodes () const |
| virtual SMDS_NodeIteratorPtr | GetNodes () const |
| int | getSize () |
| void | compactList () |
| SMESHDS_Mesh * | getParent () |
Private Attributes | |
| std::vector< const SMDS_MeshElement * > | _elements |
| TN2NMap * | _n2n |
Friends | |
| class | SMESH_ProxyMesh |
Proxy sub-mesh.
Definition at line 57 of file SMESH_ProxyMesh.hxx.
| SMESH_ProxyMesh.SubMesh.SubMesh | ( | int | index = 0 | ) |
Definition at line 77 of file SMESH_ProxyMesh.hxx.
:SMESHDS_SubMesh(0,index),_n2n(0) {}
| SMESH_ProxyMesh.SubMesh.~SubMesh | ( | ) |
Definition at line 78 of file SMESH_ProxyMesh.hxx.
{ Clear(); }
| void SMESH_ProxyMesh.SubMesh::AddElement | ( | const SMDS_MeshElement * | e | ) | [virtual] |
Store an element.
Reimplemented from SMESHDS_SubMesh.
Definition at line 529 of file SMESH_ProxyMesh.cxx.
Referenced by StdMeshers_QuadToTriaAdaptor.Compute(), VISCOUS._ViscousBuilder.makeLayer(), and VISCOUS._ViscousBuilder.shrink().
{
_elements.push_back( e );
}
| void SMESHDS_SubMesh::AddNode | ( | const SMDS_MeshNode * | ME | ) | [virtual, inherited] |
Definition at line 153 of file SMESHDS_SubMesh.cxx.
References SMDS_MeshElement.GetID(), SMDS_MeshElement.getIdInShape(), SMDS_MeshElement.getshapeId(), MESSAGE, ex29_refine.node(), SMDS_MeshElement.setIdInShape(), and SMDS_MeshElement.setShapeId().
Referenced by SMESHDS_Mesh.add(), DriverMED_R_SMESHDS_Mesh.GetSubMesh(), StdMeshers_Import_1D.importMesh(), SMESH_Gen_i.Load(), and SMESH_MeshEditor.SplitVolumesIntoTetra().
{
if ( !IsComplexSubmesh() )
{
int idInSubShape = N->getIdInShape();
int shapeId = N->getshapeId();
if ((shapeId > 0) && (idInSubShape >= 0))
{
MESSAGE("========== AddNode already belonging to other subShape " << N->GetID());
// OK for vertex nodes
//this->getParent()->UnSetNodeOnShape(N);
}
SMDS_MeshNode* node = (SMDS_MeshNode*)(N);
node->setShapeId(myIndex);
node->setIdInShape(myNodes.size());
myNodes.push_back(N);
//MESSAGE("in "<< myIndex << " AddNode " << node->GetID());
}
//MESSAGE("try to add node in a complex submesh " << N->GetID());
}
| void SMESHDS_SubMesh::AddSubMesh | ( | const SMESHDS_SubMesh * | theSubMesh | ) | [inherited] |
Definition at line 411 of file SMESHDS_SubMesh.cxx.
Referenced by SMESHDS_Mesh.AddCompoundSubmesh(), and SMESH_ProxyMesh.GetFaces().
{
ASSERT( theSubMesh );
mySubMeshes.insert( theSubMesh );
}
| void SMESH_ProxyMesh.SubMesh.ChangeElements | ( | ITERATOR | it, |
| ITERATOR | end | ||
| ) |
Definition at line 70 of file SMESH_ProxyMesh.hxx.
Referenced by StdMeshers_QuadToTriaAdaptor.Compute().
| void SMESH_ProxyMesh.SubMesh::Clear | ( | ) | [virtual] |
Deletes temporary elements.
Reimplemented from SMESHDS_SubMesh.
Definition at line 490 of file SMESH_ProxyMesh.cxx.
| void SMESHDS_SubMesh::compactList | ( | ) | [inherited] |
Definition at line 487 of file SMESHDS_SubMesh.cxx.
References ex29_refine.node(), and SMDS_MeshElement.setIdInShape().
{
//MESSAGE("compactList old: nodes " << myNodes.size() << " elements " << myElements.size());
//stringstream a;
//stringstream b;
//stringstream c;
//stringstream d;
std::vector<const SMDS_MeshElement*> newElems;
newElems.clear();
for (int i = 0; i < myElements.size(); i++)
if (myElements[i])
{
SMDS_MeshElement* elem = (SMDS_MeshElement*)myElements[i];
elem->setIdInShape(newElems.size());
newElems.push_back(elem);
//a << elem->GetID() << " ";
//b << elem->GetID() << " ";
}
//else
// a << "_ ";
myElements.swap(newElems);
myUnusedIdElements = 0;
//MESSAGE("in " << myIndex << " oldElems " << a.str());
//MESSAGE("in " << myIndex << " newElems " << b.str());
std::vector<const SMDS_MeshNode*> newNodes;
newNodes.clear();
for (int i = 0; i < myNodes.size(); i++)
if (myNodes[i])
{
SMDS_MeshNode* node = (SMDS_MeshNode*)myNodes[i];
node->setIdInShape(newNodes.size());
newNodes.push_back(node);
//c << node->GetID() << " ";
//d << node->GetID() << " ";
}
//else
// c << "_ ";
myNodes.swap(newNodes);
myUnusedIdNodes = 0;
//MESSAGE("in " << myIndex << " oldNodes " << c.str());
//MESSAGE("in " << myIndex << " newNodes " << d.str());
//MESSAGE("compactList new: nodes " << myNodes.size() << " elements " << myElements.size());
}
| bool SMESH_ProxyMesh.SubMesh::Contains | ( | const SMDS_MeshElement * | ME | ) | const [virtual] |
Check presence of element inside it-self.
Reimplemented from SMESHDS_SubMesh.
Definition at line 540 of file SMESH_ProxyMesh.cxx.
References SMDS_MeshElement.GetType(), and SMDSAbs_Node.
{
if ( ME->GetType() != SMDSAbs_Node )
return find( _elements.begin(), _elements.end(), ME ) != _elements.end();
return false;
}
| bool SMESHDS_SubMesh::ContainsSubMesh | ( | const SMESHDS_SubMesh * | theSubMesh | ) | const [inherited] |
Definition at line 442 of file SMESHDS_SubMesh.cxx.
{
return mySubMeshes.find( theSubMesh ) != mySubMeshes.end();
}
| SMDS_ElemIteratorPtr SMESH_ProxyMesh.SubMesh::GetElements | ( | ) | const [virtual] |
Return elements of a proxy submesh.
Reimplemented from SMESHDS_SubMesh.
Definition at line 517 of file SMESH_ProxyMesh.cxx.
Referenced by VISCOUS._ViscousBuilder.MakeN2NMap(), and VISCOUS._ViscousBuilder.shrink().
{
return SMDS_ElemIteratorPtr
( new SMDS_ElementVectorIterator( _elements.begin(), _elements.end() ));
}
| const TN2NMap* SMESH_ProxyMesh.SubMesh.GetNodeNodeMap | ( | ) | const |
Definition at line 61 of file SMESH_ProxyMesh.hxx.
{ return _n2n; }
| SMDS_NodeIteratorPtr SMESHDS_SubMesh::GetNodes | ( | ) | const [virtual, inherited] |
Definition at line 360 of file SMESHDS_SubMesh.cxx.
Referenced by VISCOUS._Shrinker1D.AddEdge(), SMESH_Pattern.createElements(), StdMeshers_ProjectionUtils.FindMatchingNodesOnFaces(), MyNodeIterator.getElements(), SMESH_subMesh_i.GetElementsByType(), SMESH_Algo.GetNodeParamOnEdge(), SMESH_subMesh_i.GetNumberOfNodes(), SMESH_Algo.GetSortedNodesOnEdge(), SMESH_Mesh_i.GetSubMeshNodesId(), SMESH_Pattern.getSubmeshWithElements(), StdMeshers_FaceSide.GetUVPtStruct(), Handle(), SMESH_Pattern.Load(), StdMeshers_Penta_3D.LoadIJNodes(), StdMeshers_Penta_3D.MakeMeshOnFxy1(), StdMeshers_Penta_3D.MakeNodes(), MyIterator< const SMDS_MeshNode * >.MyIterator(), SMESH_Gen_i.Precompute(), StdMeshers_Prism_3D.projectBottomToTop(), SMESH_Gen_i.Save(), StdMeshers_SegmentLengthAroundVertex.SetParametersByMesh(), VISCOUS._ViscousBuilder.shrink(), StdMeshers_Quadrangle_2D.Smooth(), and DriverMED_Family.SplitByType().
{
if ( IsComplexSubmesh() )
return SMDS_NodeIteratorPtr( new MyNodeIterator( mySubMeshes ));
return SMDS_NodeIteratorPtr(new MySetIterator<const SMDS_MeshNode*, std::vector<const SMDS_MeshNode*> >(myNodes));
}
| SMESHDS_Mesh* SMESHDS_SubMesh.getParent | ( | ) | [inherited] |
Definition at line 76 of file SMESHDS_SubMesh.hxx.
{return myParent; };
| const SMDS_MeshNode * SMESH_ProxyMesh.SubMesh::GetProxyNode | ( | const SMDS_MeshNode * | n | ) | const |
Return a proxy node or an input node.
Definition at line 476 of file SMESH_ProxyMesh.cxx.
References SMESH_ProxyMesh.SubMesh._n2n.
| int SMESHDS_SubMesh::getSize | ( | ) | [inherited] |
Definition at line 478 of file SMESHDS_SubMesh.cxx.
References ex13_hole1partial.d.
{
int c = NbNodes();
int d = NbElements();
//cerr << "SMESHDS_SubMesh::NbNodes " << c << endl;
//cerr << "SMESHDS_SubMesh::NbElements " << d << endl;
return c+d;
}
| SMESHDS_SubMeshIteratorPtr SMESHDS_SubMesh::GetSubMeshIterator | ( | ) | const [inherited] |
Definition at line 452 of file SMESHDS_SubMesh.cxx.
{
typedef set<const SMESHDS_SubMesh*>::const_iterator TIterator;
return SMESHDS_SubMeshIteratorPtr
( new SMDS_SetIterator< const SMESHDS_SubMesh*, TIterator >( mySubMeshes.begin(),
mySubMeshes.end()));
}
| virtual bool SMESHDS_SubMesh.IsComplexSubmesh | ( | ) | const [virtual, inherited] |
Definition at line 48 of file SMESHDS_SubMesh.hxx.
Referenced by SMESHDS_Mesh.AddCompoundSubmesh(), SMESH_Mesh.GetGroupSubMeshesContaining(), DriverMED_Family.MakeFamilies(), and SMESH_Gen_i.Save().
{ return !mySubMeshes.empty(); }
| int SMESH_ProxyMesh.SubMesh::NbElements | ( | ) | const [virtual] |
Return number of elements in a proxy submesh.
Reimplemented from SMESHDS_SubMesh.
Definition at line 506 of file SMESH_ProxyMesh.cxx.
Referenced by VISCOUS._ViscousBuilder.MakeN2NMap().
{
return _elements.size();
}
| int SMESHDS_SubMesh::NbNodes | ( | ) | const [virtual, inherited] |
Definition at line 229 of file SMESHDS_SubMesh.cxx.
Referenced by VISCOUS._Shrinker1D.AddEdge(), StdMeshers_Prism_3D.assocOrProjBottom2Top(), SMESH_subMesh.ComputeStateEngine(), StdMeshers_Projection_3D.Evaluate(), StdMeshers_ProjectionUtils.FindMatchingNodesOnFaces(), SMESH_subMesh_i.GetNumberOfNodes(), StdMeshers_FaceSide.GetUVPtStruct(), StdMeshers_Import_1D.importMesh(), StdMeshers_PrismAsBlock.Init(), SMESH_MEDSupport_i.isOnAllElements(), SMESH_Pattern.Load(), StdMeshers_Penta_3D.LoadIJNodes(), StdMeshers_Penta_3D.MakeMeshOnFxy1(), StdMeshers_Penta_3D.MakeNodes(), SMESH_Gen_i.Save(), StdMeshers_SegmentLengthAroundVertex.SetParametersByMesh(), VISCOUS._ViscousBuilder.shrink(), and SMESH_subMesh.SubMeshesComputed().
{
//MESSAGE(this << " NbNodes " << IsComplexSubmesh() << " " << myNodes.size() - myUnusedIdNodes);
if ( !IsComplexSubmesh() )
return myNodes.size() - myUnusedIdNodes;
int nbElems = 0;
set<const SMESHDS_SubMesh*>::const_iterator it = mySubMeshes.begin();
for ( ; it != mySubMeshes.end(); it++ )
nbElems += (*it)->NbNodes();
return nbElems;
}
| int SMESHDS_SubMesh.NbSubMeshes | ( | ) | const [inherited] |
Definition at line 61 of file SMESHDS_SubMesh.hxx.
Referenced by SMESH_ProxyMesh.GetFaces().
{ return mySubMeshes.size(); }
| void SMESHDS_SubMesh::RemoveAllSubmeshes | ( | ) | [inherited] |
Definition at line 432 of file SMESHDS_SubMesh.cxx.
Referenced by SMESH_ProxyMesh.GetFaces().
{
mySubMeshes.clear();
}
| bool SMESHDS_SubMesh::RemoveElement | ( | const SMDS_MeshElement * | ME, |
| bool | isElemDeleted | ||
| ) | [virtual, inherited] |
Definition at line 119 of file SMESHDS_SubMesh.cxx.
References SMDS_MeshElement.getIdInShape(), SMDS_MeshElement.getshapeId(), MESSAGE, SMDS_MeshElement.setIdInShape(), and SMDS_MeshElement.setShapeId().
Referenced by SMESHDS_Mesh.RemoveFreeElement().
{
if (!ME)
{
MESSAGE("-----------------> Remove Null Element " << isElemDeleted);
return false;
}
//MESSAGE("-----------------> RemoveElement "<< ME->GetID() << " " << isElemDeleted);
if (!IsComplexSubmesh())
{
if ( ME->getshapeId() != myIndex )
return false;
int idInSubShape = ME->getIdInShape();
//MESSAGE("in "<< myIndex << " RemoveElement " << ME->GetID() << " " << idInSubShape << " " << myUnusedIdElements);
SMDS_MeshElement* elem = (SMDS_MeshElement*) (ME);
elem->setShapeId(0);
elem->setIdInShape(-1);
if ((idInSubShape >= 0) && (idInSubShape < myElements.size()))
{
myElements[idInSubShape] = 0; // this vector entry is no more used
myUnusedIdElements++;
return true;
}
return false;
// }
}
MESSAGE("Try to remove an element from a complex submesh ");
return false;
}
| bool SMESHDS_SubMesh::RemoveNode | ( | const SMDS_MeshNode * | ME, |
| bool | isNodeDeleted | ||
| ) | [virtual, inherited] |
Definition at line 179 of file SMESHDS_SubMesh.cxx.
References SMDS_MeshElement.getIdInShape(), SMDS_MeshElement.getshapeId(), MESSAGE, ex29_refine.node(), SMDS_MeshElement.setIdInShape(), and SMDS_MeshElement.setShapeId().
Referenced by SMESHDS_Mesh.RemoveFreeNode().
{
if (!IsComplexSubmesh())
{
// if (!isNodeDeleted) // alive node has valid ID and can be found
// {
if ( N->getshapeId() != myIndex )
return false;
int idInSubShape = N->getIdInShape();
//int shapeId = N->getshapeId();
//MESSAGE("in "<< myIndex << " RemoveNode " << shapeId << " " << idInSubShape << " " << N->GetID());
SMDS_MeshNode* node = (SMDS_MeshNode*) (N);
node->setShapeId(0);
node->setIdInShape(-1);
if ((idInSubShape >= 0) && (idInSubShape < myNodes.size()))
{
myNodes[idInSubShape] = 0; // this vector entry is no more used
myUnusedIdNodes++;
return true;
}
return false;
// }
}
MESSAGE("Try to remove a node from a complex submesh");
return false;
}
| bool SMESHDS_SubMesh::RemoveSubMesh | ( | const SMESHDS_SubMesh * | theSubMesh | ) | [inherited] |
Definition at line 422 of file SMESHDS_SubMesh.cxx.
{
return mySubMeshes.erase( theSubMesh );
}
friend class SMESH_ProxyMesh [friend] |
Definition at line 83 of file SMESH_ProxyMesh.hxx.
std::vector<const SMDS_MeshElement *> SMESH_ProxyMesh.SubMesh._elements [private] |
Definition at line 81 of file SMESH_ProxyMesh.hxx.
TN2NMap* SMESH_ProxyMesh.SubMesh._n2n [private] |
Definition at line 82 of file SMESH_ProxyMesh.hxx.
Referenced by SMESH_ProxyMesh.SubMesh.GetProxyNode(), and SMESH_ProxyMesh.setNode2Node().