Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/med.git] / src / MEDWrapper / Base / MED_Algorithm.cxx
index 3b110be71dd015e6ebba8febd263dd20526d8748..2ecf0ca188b4b58b06a68f987588fe5d47d94d8e 100644 (file)
@@ -198,7 +198,7 @@ namespace MED
     MSG(MYDEBUG,"GetFamiliesByEntity(...)");
     TEntity2FamilySet anEntity2FamilySet;
     
-    typedef map<TInt,PFamilyInfo> TId2Family;
+    typedef std::map<TInt,PFamilyInfo> TId2Family;
     TId2Family anId2Family;
     TFamilyInfoSet::const_iterator anIter = theFamilyInfoSet.begin();
     for(; anIter != theFamilyInfoSet.end(); anIter++){
@@ -208,7 +208,7 @@ namespace MED
     
     if(!anId2Family.empty()){
       typedef std::map<TInt,TInt> TFamilyID2Size;
-      typedef map<EEntiteMaillage,TFamilyID2Size> TEntity2FamilyID;
+      typedef std::map<EEntiteMaillage,TFamilyID2Size> TEntity2FamilyID;
       TEntity2FamilyID anEntity2FamilyID;
       
       if(!theEntity2TGeom2ElemInfo.empty()){
@@ -262,7 +262,7 @@ namespace MED
               TErr* theErr,
               EModeSwitch theMode)
   {
-    INITMSG(MYDEBUG,"GetKey2Gauss - theMode = "<<theMode<<endl);
+    INITMSG(MYDEBUG,"GetKey2Gauss - theMode = "<<theMode<<std::endl);
     TKey2Gauss aKey2Gauss;
     TInt aNbGauss = theWrapper->GetNbGauss(theErr);
     for(TInt anId = 1; anId <= aNbGauss; anId++){
@@ -278,7 +278,7 @@ namespace MED
       INITMSG(MYDEBUG,
              "- aGeom = "<<aGeom<<
              "; aName = '"<<aName<<"'"<<
-             endl);
+             std::endl);
 #endif
 
     }
@@ -311,7 +311,7 @@ namespace MED
                  TErr* theErr,
                  EModeProfil theMode)
   {
-    INITMSG(MYDEBUG,"GetMKey2Profile - theMode = "<<theMode<<endl);
+    INITMSG(MYDEBUG,"GetMKey2Profile - theMode = "<<theMode<<std::endl);
     TKey2Profile aKey2Profile;
     TInt aNbProfiles = theWrapper->GetNbProfiles(theErr);
     for(TInt anId = 1; anId <= aNbProfiles; anId++){
@@ -324,16 +324,44 @@ namespace MED
       INITMSG(MYDEBUG,
              "- aName = '"<<aName<<"'"<<
              " : "<<
-             endl);
-      TInt aNbElem = anInfo->myElemNum.size();
+             std::endl);
+      TInt aNbElem = anInfo->GetSize();
       for(TInt iElem = 0; iElem < aNbElem; iElem++){
        ADDMSG(MYVALUEDEBUG,anInfo->GetElemNum(iElem)<<", ");
       }
-      ADDMSG(MYVALUEDEBUG,endl);
+      ADDMSG(MYVALUEDEBUG, std::endl);
 #endif
       
     }
     return TMKey2Profile(theMode,aKey2Profile);
   }
 
+  //---------------------------------------------------------------
+  EEntiteMaillage
+  GetEntityByFamilyId(PGrilleInfo& theInfo,TInt theId){
+    TElemNum::iterator aNodeFamIter = (theInfo->myFamNumNode).begin();
+    for(;aNodeFamIter != (theInfo->myFamNumNode).end(); aNodeFamIter++){
+      if(theId == *aNodeFamIter)
+       return eNOEUD;
+    }
+    TElemNum::iterator aCellFamIter = (theInfo->myFamNum).begin();
+    for(;aCellFamIter != (theInfo->myFamNum).end(); aCellFamIter++){
+      if(theId == *aCellFamIter)
+       return eMAILLE;
+    }
+    EXCEPTION(std::runtime_error, "GetEntityByFamilyId - fails");
+    return EEntiteMaillage(-1);
+  }
+
+  TFamilyID2NbCells
+  GetFamilyID2NbCells(PGrilleInfo& theInfo){
+    TFamilyID2NbCells aFamily2NbCells;
+    TInt aNbNodes = theInfo->myFamNumNode.size();
+    TInt aNbCells = theInfo->myFamNum.size();
+    for(TInt i=0; i<aNbNodes; i++) aFamily2NbCells[theInfo->GetFamNumNode(i)] = 0;
+    for(TInt i=0; i<aNbCells; i++) aFamily2NbCells[theInfo->GetFamNum(i)] = 0;
+    for(TInt i=0; i<aNbNodes; i++) aFamily2NbCells[theInfo->GetFamNumNode(i)] += 1;
+    for(TInt i=0; i<aNbCells; i++) aFamily2NbCells[theInfo->GetFamNum(i)] += 1;
+    return aFamily2NbCells;
+  }
 }