regression of grid test SMESH_TEST/Grids/smesh/imps/G0

+  std::vector<SMESH_subMesh*> GetSourceSubMeshes(const SMESH_Mesh* srcMesh) const;
This commit is contained in:
eap 2011-11-22 08:15:52 +00:00
parent 73c9a31feb
commit f1c147c629
2 changed files with 48 additions and 1 deletions

View File

@ -26,7 +26,7 @@
//
#include "StdMeshers_ImportSource.hxx"
#include "SMESHDS_GroupBase.hxx"
#include "SMESHDS_GroupOnGeom.hxx"
#include "SMESHDS_Mesh.hxx"
#include "SMESH_Algo.hxx"
#include "SMESH_Gen.hxx"
@ -258,6 +258,51 @@ std::vector<SMESH_Mesh*> StdMeshers_ImportSource1D::GetSourceMeshes() const
return meshes;
}
//================================================================================
/*!
* \brief Return submeshes whose events affect the target mesh
*/
//================================================================================
std::vector<SMESH_subMesh*>
StdMeshers_ImportSource1D::GetSourceSubMeshes(const SMESH_Mesh* srcMesh) const
{
if ( !srcMesh->HasShapeToMesh() )
return vector<SMESH_subMesh*>(1, srcMesh->GetSubMeshContaining(1));
set<int> shapeIDs;
const vector<SMESH_Group*>& groups = GetGroups();
const SMESHDS_Mesh * srcMeshDS = srcMesh->GetMeshDS();
for ( size_t i = 0; i < groups.size(); ++i )
{
SMESHDS_GroupBase * grDS = groups[i]->GetGroupDS();
if ( grDS->GetMesh() != srcMeshDS )
continue;
if ( SMESHDS_GroupOnGeom* gog = dynamic_cast<SMESHDS_GroupOnGeom*>( grDS ))
{
shapeIDs.insert( srcMeshDS->ShapeToIndex( gog->GetShape() ));
}
else
{
SMDS_ElemIteratorPtr elIt = grDS->GetElements();
while ( elIt->more() )
shapeIDs.insert( elIt->next()->getshapeId() );
}
}
if ( !shapeIDs.empty() && *shapeIDs.begin() < 1 )
{
shapeIDs.erase( shapeIDs.begin() );
shapeIDs.insert( 1 );
}
vector<SMESH_subMesh*> smVec( shapeIDs.size());
set<int>::iterator sID = shapeIDs.begin();
for ( int i = 0; sID != shapeIDs.end(); ++sID, ++i )
smVec[i] = srcMesh->GetSubMeshContaining( *sID );
return smVec;
}
//=============================================================================
/*!
* Save _toCopyMesh and _toCopyGroups to a stream

View File

@ -37,6 +37,7 @@
class SMESH_Group;
class SMESHDS_Mesh;
class SMESH_subMesh;
//==============================================================================
/*!
@ -69,6 +70,7 @@ class STDMESHERS_EXPORT StdMeshers_ImportSource1D : public SMESH_Hypothesis
const SMESHDS_Mesh& tgtMesh);
std::vector<SMESH_Mesh*> GetSourceMeshes() const;
std::vector<SMESH_subMesh*> GetSourceSubMeshes(const SMESH_Mesh* srcMesh) const;
private: