Salome HOME
Merge from V5_1_main branch 24/11/2010
[modules/smesh.git] / src / SMESH / SMESH_Pattern.cxx
index c3a9126a3e941ab475348341e63b7ee16ac5297d..0857f545d4ec09ebd2dd52337417f2620fe1c4f6 100644 (file)
@@ -73,6 +73,7 @@
 #include "SMESH_MesherHelper.hxx"
 #include "SMESH_subMesh.hxx"
 
+#include <Basics_Utils.hxx>
 #include "utilities.h"
 
 using namespace std;
@@ -210,6 +211,8 @@ bool SMESH_Pattern::Load (const char* theFileContents)
 {
   MESSAGE("Load( file ) ");
 
+  Kernel_Utils::Localizer loc;
+  
   // file structure:
 
   // ! This is a comment
@@ -353,6 +356,9 @@ bool SMESH_Pattern::Load (const char* theFileContents)
 bool SMESH_Pattern::Save (ostream& theFile)
 {
   MESSAGE(" ::Save(file) " );
+  
+  Kernel_Utils::Localizer loc;
+    
   if ( !IsLoaded() ) {
     MESSAGE(" Pattern not loaded ");
     return setErrorCode( ERR_SAVE_NOT_LOADED );
@@ -760,7 +766,12 @@ bool SMESH_Pattern::Load (SMESH_Mesh*        theMesh,
             }
             paramNodeMap.insert( make_pair( u, node ));
           }
-        }
+
+          //rnv : To fix the bug IPAL21999 Pattern Mapping - New - collapse of pattern mesh
+          if ( paramNodeMap.size() != eSubMesh->NbNodes() )
+              return setErrorCode(ERR_UNEXPECTED);
+          }
+
         // put U in [0,1] so that the first key-point has U==0
         bool isSeam = helper.IsRealSeam( edge );
         double du = l - f;