]> SALOME platform Git repositories - plugins/blsurfplugin.git/blobdiff - src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx
Salome HOME
Updated copyright comment
[plugins/blsurfplugin.git] / src / BLSURFPlugin / BLSURFPlugin_Hypothesis.cxx
index bc094a3d41a2ad0ba6ed38c82571103ff52e120d..773db4dd20249b1b921abee1cbeec2b95228edb8 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2021  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2024  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -29,6 +29,7 @@
 
 #include <SMESHDS_Group.hxx>
 #include <SMESHDS_Mesh.hxx>
+#include <SMESH_BoostTxtArchive.hxx>
 #include <SMESH_Gen_i.hxx>
 #include <SMESH_Group.hxx>
 #include <SMESH_TryCatch.hxx>
@@ -47,7 +48,6 @@
 #define MESHGEMS_VERSION_HEX (MESHGEMS_VERSION_MAJOR << 16 | MESHGEMS_VERSION_MINOR << 8 | MESHGEMS_VERSION_PATCH)
 
 #include <boost/archive/text_oarchive.hpp>
-#include <boost/archive/text_iarchive.hpp>
 #include <boost/serialization/set.hpp>
 #include <boost/serialization/vector.hpp>
 #include <boost/serialization/string.hpp>
@@ -1001,6 +1001,8 @@ BLSURFPlugin_Hypothesis::GetEnforcedSegments( const EnforcedMesh& enfMesh,
   if (( mesh = SMESH_Hypothesis::GetMeshByPersistentID( enfMesh._meshID )))
   {
     mesh->Load();
+    if ( mesh->NbEdges() == 0 )
+      GetGen()->Compute( *mesh, mesh->GetShapeToMesh(), /*flags=*/0 );
 
     switch( enfMesh._type )
     {
@@ -2351,13 +2353,13 @@ std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save)
   std::ostringstream hpStream;
   boost::archive::text_oarchive( hpStream ) << _hyperPatchEntriesList;
   std::string hpString = hpStream.str();
-  SMESHDS_Hypothesis::SaveString( save, hpString );
+  SMESHDS_Hypothesis::SaveStringToStream( save, hpString );
 
   // Enforced meshes
   std::ostringstream enfMStream;
   boost::archive::text_oarchive( enfMStream ) << _enforcedMeshes;
   std::string enfMString = enfMStream.str();
-  SMESHDS_Hypothesis::SaveString( save, enfMString );
+  SMESHDS_Hypothesis::SaveStringToStream( save, enfMString );
 
   return save;
 }
@@ -3393,23 +3395,19 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load)
 
   // hyper-patches as entries (issue bos #20543)
   std::string buffer;
-  if ( SMESHDS_Hypothesis::LoadString( load, buffer ))
+  if ( SMESHDS_Hypothesis::LoadStringFromStream( load, buffer ))
   {
-    std::istringstream istream( buffer.data() );
-    boost::archive::text_iarchive archive( istream );
     SMESH_TRY;
-    archive >> _hyperPatchEntriesList;
+    SMESHUtils::BoostTxtArchive( buffer ) >> _hyperPatchEntriesList;
     SMESH_CATCH( SMESH::printErrorInDebugMode );
   }
 
   // Enforced meshes (issue bos $16292)
   buffer.clear();
-  if ( SMESHDS_Hypothesis::LoadString( load, buffer ))
+  if ( SMESHDS_Hypothesis::LoadStringFromStream( load, buffer ))
   {
-    std::istringstream istream( buffer.data() );
-    boost::archive::text_iarchive archive( istream );
     SMESH_TRY;
-    archive >> _enforcedMeshes;
+    SMESHUtils::BoostTxtArchive( buffer ) >> _enforcedMeshes;
     SMESH_CATCH( SMESH::printErrorInDebugMode );
   }