mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-03-04 16:55:38 +05:00
[SALOME platform 0013410]: SubMesh not taken into account with Netgen 1D-2D et 1D-2D-3D
const SMESH_Hypothesis * GetHypothesis(const TopoDS_Shape & aSubShape, const SMESH_HypoFilter& aFilter, - const bool andAncestors) const; + const bool andAncestors, + TopoDS_Shape* assignedTo=0) const;
This commit is contained in:
parent
6c591d8d62
commit
b27af1c2d2
@ -109,7 +109,7 @@ SMESH_Mesh::~SMESH_Mesh()
|
|||||||
INFOS("SMESH_Mesh::~SMESH_Mesh");
|
INFOS("SMESH_Mesh::~SMESH_Mesh");
|
||||||
|
|
||||||
// delete groups
|
// delete groups
|
||||||
map < int, SMESH_Group * >::iterator itg;
|
std::map < int, SMESH_Group * >::iterator itg;
|
||||||
for (itg = _mapGroup.begin(); itg != _mapGroup.end(); itg++) {
|
for (itg = _mapGroup.begin(); itg != _mapGroup.end(); itg++) {
|
||||||
SMESH_Group *aGroup = (*itg).second;
|
SMESH_Group *aGroup = (*itg).second;
|
||||||
delete aGroup;
|
delete aGroup;
|
||||||
@ -135,12 +135,12 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape)
|
|||||||
{
|
{
|
||||||
// removal of a shape to mesh, delete objects referring to sub-shapes:
|
// removal of a shape to mesh, delete objects referring to sub-shapes:
|
||||||
// - sub-meshes
|
// - sub-meshes
|
||||||
map <int, SMESH_subMesh *>::iterator i_sm = _mapSubMesh.begin();
|
std::map <int, SMESH_subMesh *>::iterator i_sm = _mapSubMesh.begin();
|
||||||
for ( ; i_sm != _mapSubMesh.end(); ++i_sm )
|
for ( ; i_sm != _mapSubMesh.end(); ++i_sm )
|
||||||
delete i_sm->second;
|
delete i_sm->second;
|
||||||
_mapSubMesh.clear();
|
_mapSubMesh.clear();
|
||||||
// - groups on geometry
|
// - groups on geometry
|
||||||
map <int, SMESH_Group *>::iterator i_gr = _mapGroup.begin();
|
std::map <int, SMESH_Group *>::iterator i_gr = _mapGroup.begin();
|
||||||
while ( i_gr != _mapGroup.end() ) {
|
while ( i_gr != _mapGroup.end() ) {
|
||||||
if ( dynamic_cast<SMESHDS_GroupOnGeom*>( i_gr->second->GetGroupDS() )) {
|
if ( dynamic_cast<SMESHDS_GroupOnGeom*>( i_gr->second->GetGroupDS() )) {
|
||||||
_myMeshDS->RemoveGroup( i_gr->second->GetGroupDS() );
|
_myMeshDS->RemoveGroup( i_gr->second->GetGroupDS() );
|
||||||
@ -332,10 +332,10 @@ int SMESH_Mesh::MEDToMesh(const char* theFileName, const char* theMeshName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reading groups (sub-meshes are out of scope of MED import functionality)
|
// Reading groups (sub-meshes are out of scope of MED import functionality)
|
||||||
list<TNameAndType> aGroupNames = myReader.GetGroupNamesAndTypes();
|
std::list<TNameAndType> aGroupNames = myReader.GetGroupNamesAndTypes();
|
||||||
if(MYDEBUG) MESSAGE("MEDToMesh - Nb groups = "<<aGroupNames.size());
|
if(MYDEBUG) MESSAGE("MEDToMesh - Nb groups = "<<aGroupNames.size());
|
||||||
int anId;
|
int anId;
|
||||||
list<TNameAndType>::iterator name_type = aGroupNames.begin();
|
std::list<TNameAndType>::iterator name_type = aGroupNames.begin();
|
||||||
for ( ; name_type != aGroupNames.end(); name_type++ ) {
|
for ( ; name_type != aGroupNames.end(); name_type++ ) {
|
||||||
SMESH_Group* aGroup = AddGroup( name_type->second, name_type->first.c_str(), anId );
|
SMESH_Group* aGroup = AddGroup( name_type->second, name_type->first.c_str(), anId );
|
||||||
if ( aGroup ) {
|
if ( aGroup ) {
|
||||||
@ -585,7 +585,7 @@ SMESH_Hypothesis::Hypothesis_Status
|
|||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
const list<const SMESHDS_Hypothesis*>&
|
const std::list<const SMESHDS_Hypothesis*>&
|
||||||
SMESH_Mesh::GetHypothesisList(const TopoDS_Shape & aSubShape) const
|
SMESH_Mesh::GetHypothesisList(const TopoDS_Shape & aSubShape) const
|
||||||
throw(SALOME_Exception)
|
throw(SALOME_Exception)
|
||||||
{
|
{
|
||||||
@ -599,37 +599,43 @@ SMESH_Mesh::GetHypothesisList(const TopoDS_Shape & aSubShape) const
|
|||||||
* \param aSubShape - the shape to check
|
* \param aSubShape - the shape to check
|
||||||
* \param aFilter - the hypothesis filter
|
* \param aFilter - the hypothesis filter
|
||||||
* \param andAncestors - flag to check hypos assigned to ancestors of the shape
|
* \param andAncestors - flag to check hypos assigned to ancestors of the shape
|
||||||
|
* \param assignedTo - to return the shape the found hypo is assigned to
|
||||||
* \retval SMESH_Hypothesis* - the first hypo passed through aFilter
|
* \retval SMESH_Hypothesis* - the first hypo passed through aFilter
|
||||||
*/
|
*/
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
const SMESH_Hypothesis * SMESH_Mesh::GetHypothesis(const TopoDS_Shape & aSubShape,
|
const SMESH_Hypothesis * SMESH_Mesh::GetHypothesis(const TopoDS_Shape & aSubShape,
|
||||||
const SMESH_HypoFilter& aFilter,
|
const SMESH_HypoFilter& aFilter,
|
||||||
const bool andAncestors) const
|
const bool andAncestors,
|
||||||
|
TopoDS_Shape* assignedTo) const
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
const list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(aSubShape);
|
const std::list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(aSubShape);
|
||||||
list<const SMESHDS_Hypothesis*>::const_iterator hyp = hypList.begin();
|
std::list<const SMESHDS_Hypothesis*>::const_iterator hyp = hypList.begin();
|
||||||
for ( ; hyp != hypList.end(); hyp++ ) {
|
for ( ; hyp != hypList.end(); hyp++ ) {
|
||||||
const SMESH_Hypothesis * h = cSMESH_Hyp( *hyp );
|
const SMESH_Hypothesis * h = cSMESH_Hyp( *hyp );
|
||||||
if ( aFilter.IsOk( h, aSubShape))
|
if ( aFilter.IsOk( h, aSubShape)) {
|
||||||
|
if ( assignedTo ) *assignedTo = aSubShape;
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ( andAncestors )
|
if ( andAncestors )
|
||||||
{
|
{
|
||||||
TopTools_ListIteratorOfListOfShape it( GetAncestors( aSubShape ));
|
TopTools_ListIteratorOfListOfShape it( GetAncestors( aSubShape ));
|
||||||
for (; it.More(); it.Next() )
|
for (; it.More(); it.Next() )
|
||||||
{
|
{
|
||||||
const list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(it.Value());
|
const std::list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(it.Value());
|
||||||
list<const SMESHDS_Hypothesis*>::const_iterator hyp = hypList.begin();
|
std::list<const SMESHDS_Hypothesis*>::const_iterator hyp = hypList.begin();
|
||||||
for ( ; hyp != hypList.end(); hyp++ ) {
|
for ( ; hyp != hypList.end(); hyp++ ) {
|
||||||
const SMESH_Hypothesis * h = cSMESH_Hyp( *hyp );
|
const SMESH_Hypothesis * h = cSMESH_Hyp( *hyp );
|
||||||
if (aFilter.IsOk( h, it.Value() ))
|
if (aFilter.IsOk( h, it.Value() )) {
|
||||||
|
if ( assignedTo ) *assignedTo = it.Value();
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -656,7 +662,7 @@ int SMESH_Mesh::GetHypotheses(const TopoDS_Shape & aSubShape,
|
|||||||
bool mainHypFound = false;
|
bool mainHypFound = false;
|
||||||
|
|
||||||
// fill in hypTypes
|
// fill in hypTypes
|
||||||
list<const SMESHDS_Hypothesis*>::const_iterator hyp;
|
std::list<const SMESHDS_Hypothesis*>::const_iterator hyp;
|
||||||
for ( hyp = aHypList.begin(); hyp != aHypList.end(); hyp++ ) {
|
for ( hyp = aHypList.begin(); hyp != aHypList.end(); hyp++ ) {
|
||||||
if ( hypTypes.insert( (*hyp)->GetName() ).second )
|
if ( hypTypes.insert( (*hyp)->GetName() ).second )
|
||||||
nbHyps++;
|
nbHyps++;
|
||||||
@ -666,7 +672,7 @@ int SMESH_Mesh::GetHypotheses(const TopoDS_Shape & aSubShape,
|
|||||||
|
|
||||||
// get hypos from aSubShape
|
// get hypos from aSubShape
|
||||||
{
|
{
|
||||||
const list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(aSubShape);
|
const std::list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(aSubShape);
|
||||||
for ( hyp = hypList.begin(); hyp != hypList.end(); hyp++ )
|
for ( hyp = hypList.begin(); hyp != hypList.end(); hyp++ )
|
||||||
if ( aFilter.IsOk (cSMESH_Hyp( *hyp ), aSubShape) &&
|
if ( aFilter.IsOk (cSMESH_Hyp( *hyp ), aSubShape) &&
|
||||||
( cSMESH_Hyp(*hyp)->IsAuxiliary() || !mainHypFound ) &&
|
( cSMESH_Hyp(*hyp)->IsAuxiliary() || !mainHypFound ) &&
|
||||||
@ -688,7 +694,7 @@ int SMESH_Mesh::GetHypotheses(const TopoDS_Shape & aSubShape,
|
|||||||
{
|
{
|
||||||
if ( !map.Add( it.Value() ))
|
if ( !map.Add( it.Value() ))
|
||||||
continue;
|
continue;
|
||||||
const list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(it.Value());
|
const std::list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(it.Value());
|
||||||
for ( hyp = hypList.begin(); hyp != hypList.end(); hyp++ )
|
for ( hyp = hypList.begin(); hyp != hypList.end(); hyp++ )
|
||||||
if (aFilter.IsOk( cSMESH_Hyp( *hyp ), it.Value() ) &&
|
if (aFilter.IsOk( cSMESH_Hyp( *hyp ), it.Value() ) &&
|
||||||
( cSMESH_Hyp(*hyp)->IsAuxiliary() || !mainHypFound ) &&
|
( cSMESH_Hyp(*hyp)->IsAuxiliary() || !mainHypFound ) &&
|
||||||
@ -710,7 +716,7 @@ int SMESH_Mesh::GetHypotheses(const TopoDS_Shape & aSubShape,
|
|||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
const list<SMESHDS_Command*> & SMESH_Mesh::GetLog() throw(SALOME_Exception)
|
const std::list<SMESHDS_Command*> & SMESH_Mesh::GetLog() throw(SALOME_Exception)
|
||||||
{
|
{
|
||||||
Unexpect aCatch(SalomeException);
|
Unexpect aCatch(SalomeException);
|
||||||
if(MYDEBUG) MESSAGE("SMESH_Mesh::GetLog");
|
if(MYDEBUG) MESSAGE("SMESH_Mesh::GetLog");
|
||||||
@ -808,19 +814,19 @@ throw(SALOME_Exception)
|
|||||||
*/
|
*/
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
list<SMESH_subMesh*>
|
std::list<SMESH_subMesh*>
|
||||||
SMESH_Mesh::GetGroupSubMeshesContaining(const TopoDS_Shape & aSubShape) const
|
SMESH_Mesh::GetGroupSubMeshesContaining(const TopoDS_Shape & aSubShape) const
|
||||||
throw(SALOME_Exception)
|
throw(SALOME_Exception)
|
||||||
{
|
{
|
||||||
Unexpect aCatch(SalomeException);
|
Unexpect aCatch(SalomeException);
|
||||||
list<SMESH_subMesh*> found;
|
std::list<SMESH_subMesh*> found;
|
||||||
|
|
||||||
SMESH_subMesh * subMesh = GetSubMeshContaining(aSubShape);
|
SMESH_subMesh * subMesh = GetSubMeshContaining(aSubShape);
|
||||||
if ( !subMesh )
|
if ( !subMesh )
|
||||||
return found;
|
return found;
|
||||||
|
|
||||||
// submeshes of groups have max IDs, so search from the map end
|
// submeshes of groups have max IDs, so search from the map end
|
||||||
map<int, SMESH_subMesh *>::const_reverse_iterator i_sm;
|
std::map<int, SMESH_subMesh *>::const_reverse_iterator i_sm;
|
||||||
for ( i_sm = _mapSubMesh.rbegin(); i_sm != _mapSubMesh.rend(); ++i_sm) {
|
for ( i_sm = _mapSubMesh.rbegin(); i_sm != _mapSubMesh.rend(); ++i_sm) {
|
||||||
SMESHDS_SubMesh * ds = i_sm->second->GetSubMeshDS();
|
SMESHDS_SubMesh * ds = i_sm->second->GetSubMeshDS();
|
||||||
if ( ds && ds->IsComplexSubmesh() ) {
|
if ( ds && ds->IsComplexSubmesh() ) {
|
||||||
@ -978,9 +984,9 @@ bool SMESH_Mesh::GetAutoColor() throw(SALOME_Exception)
|
|||||||
bool SMESH_Mesh::HasDuplicatedGroupNamesMED()
|
bool SMESH_Mesh::HasDuplicatedGroupNamesMED()
|
||||||
{
|
{
|
||||||
set<string> aGroupNames;
|
set<string> aGroupNames;
|
||||||
for ( map<int, SMESH_Group*>::iterator it = _mapGroup.begin(); it != _mapGroup.end(); it++ ) {
|
for ( std::map<int, SMESH_Group*>::iterator it = _mapGroup.begin(); it != _mapGroup.end(); it++ ) {
|
||||||
SMESH_Group* aGroup = it->second;
|
SMESH_Group* aGroup = it->second;
|
||||||
string aGroupName = aGroup->GetName();
|
std::string aGroupName = aGroup->GetName();
|
||||||
aGroupName.resize(MAX_MED_GROUP_NAME_LENGTH);
|
aGroupName.resize(MAX_MED_GROUP_NAME_LENGTH);
|
||||||
if (!aGroupNames.insert(aGroupName).second)
|
if (!aGroupNames.insert(aGroupName).second)
|
||||||
return true;
|
return true;
|
||||||
@ -1018,7 +1024,7 @@ void SMESH_Mesh::ExportMED(const char *file,
|
|||||||
set<string> aGroupNames;
|
set<string> aGroupNames;
|
||||||
char aString [256];
|
char aString [256];
|
||||||
int maxNbIter = 10000; // to guarantee cycle finish
|
int maxNbIter = 10000; // to guarantee cycle finish
|
||||||
for ( map<int, SMESH_Group*>::iterator it = _mapGroup.begin(); it != _mapGroup.end(); it++ ) {
|
for ( std::map<int, SMESH_Group*>::iterator it = _mapGroup.begin(); it != _mapGroup.end(); it++ ) {
|
||||||
SMESH_Group* aGroup = it->second;
|
SMESH_Group* aGroup = it->second;
|
||||||
SMESHDS_GroupBase* aGroupDS = aGroup->GetGroupDS();
|
SMESHDS_GroupBase* aGroupDS = aGroup->GetGroupDS();
|
||||||
if ( aGroupDS ) {
|
if ( aGroupDS ) {
|
||||||
@ -1058,11 +1064,11 @@ void SMESH_Mesh::ExportUNV(const char *file) throw(SALOME_Exception)
|
|||||||
myWriter.SetMeshId(_idDoc);
|
myWriter.SetMeshId(_idDoc);
|
||||||
// myWriter.SetGroups(_mapGroup);
|
// myWriter.SetGroups(_mapGroup);
|
||||||
|
|
||||||
for ( map<int, SMESH_Group*>::iterator it = _mapGroup.begin(); it != _mapGroup.end(); it++ ) {
|
for ( std::map<int, SMESH_Group*>::iterator it = _mapGroup.begin(); it != _mapGroup.end(); it++ ) {
|
||||||
SMESH_Group* aGroup = it->second;
|
SMESH_Group* aGroup = it->second;
|
||||||
SMESHDS_GroupBase* aGroupDS = aGroup->GetGroupDS();
|
SMESHDS_GroupBase* aGroupDS = aGroup->GetGroupDS();
|
||||||
if ( aGroupDS ) {
|
if ( aGroupDS ) {
|
||||||
string aGroupName = aGroup->GetName();
|
std::string aGroupName = aGroup->GetName();
|
||||||
aGroupDS->SetStoreName( aGroupName.c_str() );
|
aGroupDS->SetStoreName( aGroupName.c_str() );
|
||||||
myWriter.AddGroup( aGroupDS );
|
myWriter.AddGroup( aGroupDS );
|
||||||
}
|
}
|
||||||
@ -1312,10 +1318,10 @@ SMESH_Group* SMESH_Mesh::GetGroup (const int theGroupID)
|
|||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
list<int> SMESH_Mesh::GetGroupIds() const
|
std::list<int> SMESH_Mesh::GetGroupIds() const
|
||||||
{
|
{
|
||||||
list<int> anIds;
|
std::list<int> anIds;
|
||||||
for ( map<int, SMESH_Group*>::const_iterator it = _mapGroup.begin(); it != _mapGroup.end(); it++ )
|
for ( std::map<int, SMESH_Group*>::const_iterator it = _mapGroup.begin(); it != _mapGroup.end(); it++ )
|
||||||
anIds.push_back( it->first );
|
anIds.push_back( it->first );
|
||||||
|
|
||||||
return anIds;
|
return anIds;
|
||||||
@ -1380,7 +1386,7 @@ ostream& SMESH_Mesh::Dump(ostream& save)
|
|||||||
save << clause << ".1) Number of " << orderStr << " triangles: \t" << nb3 << endl;
|
save << clause << ".1) Number of " << orderStr << " triangles: \t" << nb3 << endl;
|
||||||
save << clause << ".2) Number of " << orderStr << " quadrangles:\t" << nb4 << endl;
|
save << clause << ".2) Number of " << orderStr << " quadrangles:\t" << nb4 << endl;
|
||||||
if ( nb3 + nb4 != NbFaces(order) ) {
|
if ( nb3 + nb4 != NbFaces(order) ) {
|
||||||
map<int,int> myFaceMap;
|
std::map<int,int> myFaceMap;
|
||||||
SMDS_FaceIteratorPtr itFaces=_myMeshDS->facesIterator();
|
SMDS_FaceIteratorPtr itFaces=_myMeshDS->facesIterator();
|
||||||
while( itFaces->more( ) ) {
|
while( itFaces->more( ) ) {
|
||||||
int nbNodes = itFaces->next()->NbNodes();
|
int nbNodes = itFaces->next()->NbNodes();
|
||||||
@ -1405,7 +1411,7 @@ ostream& SMESH_Mesh::Dump(ostream& save)
|
|||||||
save << clause << ".3) Number of " << orderStr << " prisms: \t" << nb6 << endl;
|
save << clause << ".3) Number of " << orderStr << " prisms: \t" << nb6 << endl;
|
||||||
save << clause << ".4) Number of " << orderStr << " pyramids:\t" << nb5 << endl;
|
save << clause << ".4) Number of " << orderStr << " pyramids:\t" << nb5 << endl;
|
||||||
if ( nb8 + nb4 + nb5 + nb6 != NbVolumes(order) ) {
|
if ( nb8 + nb4 + nb5 + nb6 != NbVolumes(order) ) {
|
||||||
map<int,int> myVolumesMap;
|
std::map<int,int> myVolumesMap;
|
||||||
SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
|
SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
|
||||||
while( itVolumes->more( ) ) {
|
while( itVolumes->more( ) ) {
|
||||||
int nbNodes = itVolumes->next()->NbNodes();
|
int nbNodes = itVolumes->next()->NbNodes();
|
||||||
|
@ -109,7 +109,8 @@ public:
|
|||||||
|
|
||||||
const SMESH_Hypothesis * GetHypothesis(const TopoDS_Shape & aSubShape,
|
const SMESH_Hypothesis * GetHypothesis(const TopoDS_Shape & aSubShape,
|
||||||
const SMESH_HypoFilter& aFilter,
|
const SMESH_HypoFilter& aFilter,
|
||||||
const bool andAncestors) const;
|
const bool andAncestors,
|
||||||
|
TopoDS_Shape* assignedTo=0) const;
|
||||||
|
|
||||||
int GetHypotheses(const TopoDS_Shape & aSubShape,
|
int GetHypotheses(const TopoDS_Shape & aSubShape,
|
||||||
const SMESH_HypoFilter& aFilter,
|
const SMESH_HypoFilter& aFilter,
|
||||||
@ -248,8 +249,8 @@ protected:
|
|||||||
std::list <SMESH_subMesh*> _subMeshesUsingHypothesisList;
|
std::list <SMESH_subMesh*> _subMeshesUsingHypothesisList;
|
||||||
SMESHDS_Document * _myDocument;
|
SMESHDS_Document * _myDocument;
|
||||||
SMESHDS_Mesh * _myMeshDS;
|
SMESHDS_Mesh * _myMeshDS;
|
||||||
map <int, SMESH_subMesh *> _mapSubMesh;
|
std::map <int, SMESH_subMesh*> _mapSubMesh;
|
||||||
map <int, SMESH_Group *> _mapGroup;
|
std::map <int, SMESH_Group*> _mapGroup;
|
||||||
SMESH_Gen * _gen;
|
SMESH_Gen * _gen;
|
||||||
|
|
||||||
bool _isAutoColor;
|
bool _isAutoColor;
|
||||||
|
Loading…
Reference in New Issue
Block a user