#include <SMESHDS_SubMesh.hxx>

Definition at line 42 of file SMESHDS_SubMesh.hxx.
| SMESHDS_SubMesh::SMESHDS_SubMesh | ( | SMESHDS_Mesh * | parent, |
| int | index | ||
| ) |
Constructor.
Definition at line 46 of file SMESHDS_SubMesh.cxx.
{
myParent = parent;
myElements.clear();
myNodes.clear();
myIndex = index;
myUnusedIdNodes = 0;
myUnusedIdElements = 0;
}
| SMESHDS_SubMesh::~SMESHDS_SubMesh | ( | ) | [virtual] |
| void SMESHDS_SubMesh::AddElement | ( | const SMDS_MeshElement * | ME | ) | [virtual] |
Reimplemented in SMESH_ProxyMesh.SubMesh.
Definition at line 70 of file SMESHDS_SubMesh.cxx.
References SMDS_MeshElement.GetID(), SMDS_MeshElement.getIdInShape(), SMDS_MeshElement.getshapeId(), MESSAGE, SMDS_MeshElement.setIdInShape(), and SMDS_MeshElement.setShapeId().
Referenced by SMESHDS_Mesh.add(), VISCOUS._ViscousBuilder.addBoundaryElements(), SMESH_MeshEditor.convertElemToQuadratic(), SMESH_MeshEditor.ConvertToQuadratic(), DriverMED_R_SMESHDS_Mesh.GetSubMesh(), StdMeshers_Import_1D.importMesh(), SMESH_Gen_i.Load(), SMESH_MeshEditor.removeQuadElem(), and SMESH_MeshEditor.SplitVolumesIntoTetra().
{
if (!IsComplexSubmesh())
{
//MESSAGE("in " << myIndex << " AddElement "<< ME->GetID());
int oldShapeId = ME->getshapeId();
if ( oldShapeId > 0 )
{
if (oldShapeId != myIndex)
{
MESSAGE("add element in subshape already belonging to another subshape "
<< ME->GetID() << " " << oldShapeId << " " << myIndex);
throw SALOME_Exception(LOCALIZED("add element in subshape already belonging to a subshape"));
}
else
{
int idInSubShape = ME->getIdInShape();
if (idInSubShape >= 0)
{
MESSAGE("add element in subshape already belonging to that subshape "
<< ME->GetID() << " " << oldShapeId << " " << idInSubShape);
// check if ok: do nothing if ok
if (idInSubShape >= myElements.size())
{
MESSAGE("out of bounds " << idInSubShape << " " << myElements.size());
throw SALOME_Exception(LOCALIZED("out of bounds"));
}
if (ME != myElements[idInSubShape])
{
MESSAGE("not the same element");
throw SALOME_Exception(LOCALIZED("not the same element"));
}
MESSAGE("already done, OK, nothing to do");
return;
}
}
}
SMDS_MeshElement* elem = (SMDS_MeshElement*) (ME);
elem->setShapeId(myIndex);
elem->setIdInShape(myElements.size());
myElements.push_back(ME);
}
}
| void SMESHDS_SubMesh::AddNode | ( | const SMDS_MeshNode * | ME | ) | [virtual] |
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 | ) |
Definition at line 411 of file SMESHDS_SubMesh.cxx.
Referenced by SMESHDS_Mesh.AddCompoundSubmesh(), and SMESH_ProxyMesh.GetFaces().
{
ASSERT( theSubMesh );
mySubMeshes.insert( theSubMesh );
}
| void SMESHDS_SubMesh::Clear | ( | ) | [virtual] |
Reimplemented in SMESH_ProxyMesh.SubMesh.
Definition at line 465 of file SMESHDS_SubMesh.cxx.
{
myElements.clear();
myNodes.clear();
myUnusedIdNodes = 0;
myUnusedIdElements = 0;
SMESHDS_SubMeshIteratorPtr sub = GetSubMeshIterator();
while ( sub->more() ) {
if ( SMESHDS_SubMesh* sm = (SMESHDS_SubMesh*) sub->next())
sm->Clear();
}
}
| void SMESHDS_SubMesh::compactList | ( | ) |
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 SMESHDS_SubMesh::Contains | ( | const SMDS_MeshElement * | ME | ) | const [virtual] |
Reimplemented in SMESH_ProxyMesh.SubMesh.
Definition at line 373 of file SMESHDS_SubMesh.cxx.
References SMDS_MeshElement.getIdInShape(), SMDS_MeshElement.GetType(), and SMDSAbs_Node.
Referenced by SMESHDS_GroupOnGeom.Contains(), SMESH_MeshEditor.ConvertToQuadratic(), StdMeshers_ProjectionUtils.FindMatchingNodesOnFaces(), VISCOUS._ViscousBuilder.findNeiborsOnEdge(), SMESH_MeshEditor.FindShape(), _QuadFaceGrid.LoadGrid(), SMESH_MesherHelper.LoadNodeColumns(), VISCOUS._ViscousBuilder.prepareEdgeToShrink(), SMESH_MeshEditor.removeQuadElem(), VISCOUS._ViscousBuilder.shrink(), SMESH_MeshEditor.SplitVolumesIntoTetra(), and VISCOUS._Shrinker1D.SwapSrcTgtNodes().
{
// DO NOT TRY TO FIND A REMOVED ELEMENT !!
//if ( IsComplexSubmesh() || !ME )
if (!ME)
return false;
if (IsComplexSubmesh())
{
set<const SMESHDS_SubMesh*>::const_iterator aSubIt = mySubMeshes.begin();
for (; aSubIt != mySubMeshes.end(); aSubIt++)
if ((*aSubIt)->Contains(ME))
return true;
return false;
}
if (ME->GetType() == SMDSAbs_Node)
{
int idInShape = ME->getIdInShape();
if ((idInShape >= 0) && (idInShape < myNodes.size()))
if (myNodes[idInShape] == ME)
return true;
}
else
{
int idInShape = ME->getIdInShape();
if ((idInShape >= 0) && (idInShape < myElements.size()))
if (myElements[idInShape] == ME)
return true;
}
return false;
}
| bool SMESHDS_SubMesh::ContainsSubMesh | ( | const SMESHDS_SubMesh * | theSubMesh | ) | const |
Definition at line 442 of file SMESHDS_SubMesh.cxx.
{
return mySubMeshes.find( theSubMesh ) != mySubMeshes.end();
}
| SMDS_ElemIteratorPtr SMESHDS_SubMesh::GetElements | ( | ) | const [virtual] |
Reimplemented in SMESH_ProxyMesh.SubMesh.
Definition at line 348 of file SMESHDS_SubMesh.cxx.
Referenced by StdMeshers_QuadToTriaAdaptor.Compute(), StdMeshers_Projection_3D.Compute(), SMESH_MeshEditor.convertElemToQuadratic(), StdMeshers_Projection_3D.Evaluate(), StdMeshers_ProjectionUtils.FindMatchingNodesOnFaces(), MyElemIterator.getElements(), SMESH_subMesh_i.GetElementsByType(), SMESH_Algo.GetNodeParamOnEdge(), SMESH_subMesh_i.GetNumberOfNodes(), SMESH_Algo.GetSortedNodesOnEdge(), SMESH_Mesh_i.GetSubMeshElementsId(), SMESH_Mesh_i.GetSubMeshElementType(), SMESH_Mesh_i.GetSubMeshNodesId(), SMESH_Pattern.getSubmeshWithElements(), StdMeshers_PrismAsBlock.Init(), isMeshBoundToShape(), SMESH_Algo.IsReversedSubMesh(), SMESH_Pattern.Load(), _QuadFaceGrid.LoadGrid(), StdMeshers_Penta_3D.LoadIJNodes(), SMESH_MesherHelper.LoadNodeColumns(), StdMeshers_Penta_3D.MakeBlock(), VISCOUS._ViscousBuilder.makeLayer(), StdMeshers_Penta_3D.MakeMeshOnFxy1(), VISCOUS._ViscousBuilder.MakeN2NMap(), StdMeshers_Penta_3D.MakeVolumeMesh(), MyIterator< const SMDS_MeshNode * >.MyIterator(), SMESH_Gen_i.Precompute(), StdMeshers_Prism_3D.projectBottomToTop(), VISCOUS._ViscousBuilder.refine(), SMESH_Gen_i.Save(), StdMeshers_MaxElementArea.SetParametersByMesh(), VISCOUS._ViscousBuilder.shrink(), and DriverMED_Family.SplitByType().
{
if ( IsComplexSubmesh() )
return SMDS_ElemIteratorPtr( new MyElemIterator( mySubMeshes ));
return SMDS_ElemIteratorPtr(new MySetIterator<const SMDS_MeshElement*, std::vector<const SMDS_MeshElement*> >(myElements));
}
| SMDS_NodeIteratorPtr SMESHDS_SubMesh::GetNodes | ( | ) | const [virtual] |
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 | ( | ) |
Definition at line 76 of file SMESHDS_SubMesh.hxx.
{return myParent; };
| int SMESHDS_SubMesh::getSize | ( | ) |
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 |
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] |
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 SMESHDS_SubMesh::NbElements | ( | ) | const [virtual] |
Reimplemented in SMESH_ProxyMesh.SubMesh.
Definition at line 210 of file SMESHDS_SubMesh.cxx.
Referenced by StdMeshers_Prism_3D.assocOrProjBottom2Top(), StdMeshers_Hexa_3D.Compute(), StdMeshers_Regular_1D.computeInternalParameters(), StdMeshers_ProjectionUtils.FindMatchingNodesOnFaces(), VISCOUS._ViscousBuilder.findNeiborsOnEdge(), SMESH_subMesh_i.GetElementsByType(), SMESH_subMesh_i.GetElementsId(), _FaceSide.GetNbSegments(), SMESH_subMesh_i.GetNumberOfElements(), SMESH_Mesh_i.GetSubMeshElementsId(), SMESH_Mesh_i.GetSubMeshElementType(), SMESH_Mesh_i.GetSubMeshNodesId(), StdMeshers_Import_1D.importMesh(), StdMeshers_PrismAsBlock.Init(), isMeshBoundToShape(), SMESH_MesherHelper.LoadNodeColumns(), VISCOUS._ViscousBuilder.MakeN2NMap(), VISCOUS._ViscousBuilder.prepareEdgeToShrink(), StdMeshers_NumberOfSegments.SetParametersByMesh(), and SMESH_subMesh.SubMeshesComputed().
{
//MESSAGE(this << " NbElements " << IsComplexSubmesh() << " " << myElements.size() - myUnusedIdElements);
if ( !IsComplexSubmesh() )
return myElements.size() - myUnusedIdElements;
int nbElems = 0;
set<const SMESHDS_SubMesh*>::const_iterator it = mySubMeshes.begin();
for ( ; it != mySubMeshes.end(); it++ )
nbElems += (*it)->NbElements();
return nbElems;
}
| int SMESHDS_SubMesh::NbNodes | ( | ) | const [virtual] |
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 |
Definition at line 61 of file SMESHDS_SubMesh.hxx.
Referenced by SMESH_ProxyMesh.GetFaces().
{ return mySubMeshes.size(); }
| void SMESHDS_SubMesh::RemoveAllSubmeshes | ( | ) |
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] |
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] |
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 | ) |
Definition at line 422 of file SMESHDS_SubMesh.cxx.
{
return mySubMeshes.erase( theSubMesh );
}
std::vector<const SMDS_MeshElement*> SMESHDS_SubMesh.myElements [private] |
Definition at line 80 of file SMESHDS_SubMesh.hxx.
int SMESHDS_SubMesh.myIndex [private] |
Definition at line 85 of file SMESHDS_SubMesh.hxx.
std::vector<const SMDS_MeshNode*> SMESHDS_SubMesh.myNodes [private] |
Definition at line 81 of file SMESHDS_SubMesh.hxx.
SMESHDS_Mesh* SMESHDS_SubMesh.myParent [private] |
Definition at line 76 of file SMESHDS_SubMesh.hxx.
std::set<const SMESHDS_SubMesh*> SMESHDS_SubMesh.mySubMeshes [private] |
Definition at line 87 of file SMESHDS_SubMesh.hxx.
int SMESHDS_SubMesh.myUnusedIdElements [private] |
Definition at line 84 of file SMESHDS_SubMesh.hxx.
int SMESHDS_SubMesh.myUnusedIdNodes [private] |
Definition at line 83 of file SMESHDS_SubMesh.hxx.