]> SALOME platform Git repositories - modules/multipr.git/blobdiff - src/MULTIPR/MULTIPR_MeshDis.cxx
Salome HOME
*** empty log message ***
[modules/multipr.git] / src / MULTIPR / MULTIPR_MeshDis.cxx
index 3a856f3ef4a7571c4df7e2764ed8e3436949b48e..9b93c2d070d24e43a3f6811fce359f8e9219cf5f 100644 (file)
@@ -240,6 +240,10 @@ void MeshDis::insertMesh(
        Mesh*       pMesh,
        int         pPosition)
 {
+       // debug
+       //cout << "INSERT PARTS BEFORE: " << endl;
+       //cout << (*this) << endl;
+       
        MeshDisPart* part = new MeshDisPart();
        
        part->create(
@@ -256,8 +260,50 @@ void MeshDis::insertMesh(
        // rename id of following parts
        for (unsigned i = pPosition + 1 ; i < mParts.size() ; i++)
        {
-               mParts[i]->mId = i + 1;
+               mParts[i]->mId++;
+       }
+       
+       // debug
+       //cout << "INSERT PARTS AFTER: " << endl;
+       //cout << (*this) << endl;
+}
+
+
+void MeshDis::removeParts(const char* pPrefixPartName)
+{
+       // debug
+       //cout << "REMOVE PARTS BEFORE: " << endl;
+       //cout << (*this) << endl;
+       
+       if (pPrefixPartName == NULL) throw NullArgumentException("", __FILE__, __LINE__);
+       
+       for (vector<MeshDisPart*>::iterator itPart = mParts.begin() ; itPart != mParts.end() ; itPart++)
+       {
+               MeshDisPart* currentPart = (*itPart);
+               
+               if (startWith(currentPart->getPartName(), pPrefixPartName))
+               {
+                       mParts.erase(itPart);
+               
+                       // decrement id of following parts
+                       for (vector<MeshDisPart*>::iterator itPart2 = itPart ; itPart2 != mParts.end() ; itPart2++)
+                       {
+                               (*itPart2)->mId--;
+                       }
+                       
+                       itPart--;
+                       if (currentPart->mMEDFileName != NULL)
+                       {
+                               remove(currentPart->mMEDFileName);
+                       }
+                       
+                       delete currentPart;
+               }
        }
+       
+       // debug
+       //cout << "REMOVE PARTS AFTER: " << endl;
+       //cout << (*this) << endl;
 }
 
 
@@ -513,6 +559,7 @@ void MeshDis::decimatePart(
        const char* originalFilename = part->getMEDFileName();
        string strPrefix = removeExtension(originalFilename, ".med");
        
+cout << (*this) << endl;
        //---------------------------------------------------------------------
        // Decimates the given mesh
        //---------------------------------------------------------------------
@@ -566,6 +613,8 @@ void MeshDis::decimatePart(
                        meshLow,
                        part->mId + 1);
        }
+       
+cout << (*this) << endl;
 }