X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FDriverMED%2FDriverMED_Family.cxx;h=80b343e227f762e04e5baf3c4d78e9f5581ebb0c;hb=f4cb697fcc605c3b9cdb517f9b4eef6b8532dc1a;hp=ee1123ccd0719e9f7f380d0cca33b0a845d4455b;hpb=c3bf92bd87b770fd81631a3853f7f5bb1ac6a4e8;p=modules%2Fsmesh.git diff --git a/src/DriverMED/DriverMED_Family.cxx b/src/DriverMED/DriverMED_Family.cxx index ee1123ccd..80b343e22 100644 --- a/src/DriverMED/DriverMED_Family.cxx +++ b/src/DriverMED/DriverMED_Family.cxx @@ -26,8 +26,12 @@ // $Header$ #include "DriverMED_Family.h" +#include "MED_Factory.hxx" + #include +using namespace std; + //============================================================================= /*! * Split each group from list on some parts (families) @@ -37,7 +41,7 @@ //============================================================================= list DriverMED_Family::MakeFamilies (const map & theSubMeshes, - const list& theGroups, + const list& theGroups, const bool doGroupOfNodes, const bool doGroupOfEdges, const bool doGroupOfFaces, @@ -60,6 +64,8 @@ list DriverMED_Family::MakeFamilies map::const_iterator aSMIter = theSubMeshes.begin(); for (; aSMIter != theSubMeshes.end(); aSMIter++) { + if ( aSMIter->second->IsComplexSubmesh() ) + continue; // submesh containing other submeshs list aSMFams = SplitByType((*aSMIter).second, (*aSMIter).first); list::iterator aSMFamsIter = aSMFams.begin(); for (; aSMFamsIter != aSMFams.end(); aSMFamsIter++) @@ -95,7 +101,7 @@ list DriverMED_Family::MakeFamilies } // Process groups - list::const_iterator aGroupsIter = theGroups.begin(); + list::const_iterator aGroupsIter = theGroups.begin(); for (; aGroupsIter != theGroups.end(); aGroupsIter++) { DriverMED_FamilyPtr aFam2 (new DriverMED_Family); @@ -200,22 +206,37 @@ list DriverMED_Family::MakeFamilies * Create TFamilyInfo for this family */ //============================================================================= -MEDA::PFamilyInfo DriverMED_Family::GetFamilyInfo - (const MEDA::PMeshInfo& theMeshInfo) const +MED::PFamilyInfo +DriverMED_Family::GetFamilyInfo(const MED::PWrapper& theWrapper, + const MED::PMeshInfo& theMeshInfo) const { string aValue; + ostringstream aStr; - aStr << myId; + + aStr << "FAM_" << myId; + set::iterator aGrIter = myGroupNames.begin(); + for (; aGrIter != myGroupNames.end(); aGrIter++) + { + aStr << "_" << *aGrIter; + } + aValue = aStr.str(); + /* MED::TStringVector anAttrDescs (1, ""); // 1 attribute with empty description, MED::TIntVector anAttrIds (1, myId); // Id=0, MED::TIntVector anAttrVals (1, myId); // Value=0 - - MEDA::PFamilyInfo anInfo = MEDA::TWrapper::CrFamilyInfo(theMeshInfo, - aValue, - myId, - myGroupNames, - anAttrDescs,anAttrIds,anAttrVals); + */ + + MED::PFamilyInfo anInfo = theWrapper->CrFamilyInfo(theMeshInfo, + aValue, + myId, + myGroupNames); +/* + anAttrDescs, + anAttrIds, + anAttrVals); +*/ // cout << endl; // cout << "Groups: "; @@ -239,25 +260,25 @@ MEDA::PFamilyInfo DriverMED_Family::GetFamilyInfo //============================================================================= /*! - * Initialize the tool by SMESHDS_Group + * Initialize the tool by SMESHDS_GroupBase */ //============================================================================= -void DriverMED_Family::Init (SMESHDS_Group* group) +void DriverMED_Family::Init (SMESHDS_GroupBase* theGroup) { // Elements myElements.clear(); - group->InitIterator(); - while (group->More()) + SMDS_ElemIteratorPtr elemIt = theGroup->GetElements(); + while (elemIt->more()) { - myElements.insert(group->Next()); + myElements.insert(elemIt->next()); } // Type - myType = group->GetType(); + myType = theGroup->GetType(); // Groups list myGroupNames.clear(); - myGroupNames.insert(string(group->GetStoreName())); + myGroupNames.insert(string(theGroup->GetStoreName())); } //============================================================================= @@ -341,14 +362,16 @@ void DriverMED_Family::Split (DriverMED_FamilyPtr by, { // Elements set::iterator anIter = by->myElements.begin(); - for (; anIter != by->myElements.end(); anIter++) + while ( anIter != by->myElements.end()) { if (myElements.find(*anIter) != myElements.end()) { common->myElements.insert(*anIter); myElements.erase(*anIter); - by->myElements.erase(*anIter); + by->myElements.erase(anIter++); } + else + anIter++; } if (!common->IsEmpty())