Salome HOME
Update copyright info (2010->2011)
[plugins/ghs3dplugin.git] / src / GHS3DPlugin_Hypothesis.cxx
index 04644bc75abb7f82136a78ba89dcf084bb0d7c8b..dac9e716b4edf684a8557a51499bd0e06d9b3485 100644 (file)
@@ -1,4 +1,4 @@
-//  Copyright (C) 2004-2008  CEA/DEN, EDF R&D
+//  Copyright (C) 2004-2011  CEA/DEN, EDF R&D
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
@@ -16,6 +16,7 @@
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //=============================================================================
 // File      : GHS3DPlugin_Hypothesis.cxx
 // Created   : Wed Apr  2 12:36:29 2008
@@ -417,6 +418,7 @@ short  GHS3DPlugin_Hypothesis::DefaultMaximumMemory()
     return (int) ( 0.7 * totMB );
   }
 #endif
+  return 1024;
 }
 
 //=======================================================================
@@ -540,9 +542,11 @@ std::ostream & GHS3DPlugin_Hypothesis::SaveTo(std::ostream & save)
   save << (int)myToUseBoundaryRecoveryVersion << " ";
   save << (int)myToUseFemCorrection           << " ";
   save << (int)myToRemoveCentralPoint         << " ";
-  save << "__OPTIONS_BEGIN__ ";
-  save << myTextOption                        << " ";
-  save << " __OPTIONS_END__ ";
+  if (!myTextOption.empty()) {
+    save << "__OPTIONS_BEGIN__ ";
+    save << myTextOption                      << " ";
+    save << "__OPTIONS_END__ ";
+  }
   
 
   TEnforcedVertexValues::iterator it  = myEnforcedVertices.begin();
@@ -645,20 +649,6 @@ std::istream & GHS3DPlugin_Hypothesis::LoadFrom(std::istream & load)
     else
         load.clear(ios::badbit | load.rdstate());
     
-//     isOK = (load >> myTextOption);
-//     while (isOK) {
-//         std::string txt;
-//         if (load >> txt) {
-//             myTextOption += " ";
-//             myTextOption += txt;
-//         }
-//         else
-//             isOK = false;
-//     }
-//     //   else
-//     //     load.clear(ios::badbit | load.rdstate());
-
-    
     std::string separator;
     bool hasOptions = false;
     bool hasEnforcedVertices = false;
@@ -669,25 +659,23 @@ std::istream & GHS3DPlugin_Hypothesis::LoadFrom(std::istream & load)
             hasOptions = true;
         else if (separator == "__ENFORCED_VERTICES_BEGIN__")
             hasEnforcedVertices = true;
-    
+
     if (hasOptions) {
         std::string txt;
-        isOK = (load >> myTextOption);
         while (isOK) {
-            if (myTextOption == "__OPTIONS_END__") {
-                isOK = false;
-                break;
-            }
-            if (load >> txt) {
+            isOK = (load >> txt);
+            if (isOK) {
                 if (txt == "__OPTIONS_END__") {
+                    if (!myTextOption.empty()) {
+                        // Remove last space
+                        myTextOption.erase(myTextOption.end()-1);
+                    }
                     isOK = false;
                     break;
                 }
-                myTextOption += " ";
                 myTextOption += txt;
+                myTextOption += " ";
             }
-            else
-                isOK = false;
         }
     }