-// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#ifdef WITH_CGNS
#include "DriverCGNS_Read.hxx"
#include "DriverCGNS_Write.hxx"
+#include "DriverStructuredCGNS_Write.hxx"
#endif
#include <GEOMUtils.hxx>
-#undef _Precision_HeaderFile
+//#undef _Precision_HeaderFile
#include <BRepBndLib.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
#include <Bnd_Box.hxx>
int result=pthread_create(&thread, NULL, deleteMeshDS, (void*)_meshDS);
#endif
}
- if(_pool)
- DeletePoolThreads();
}
//================================================================================
if ( res != Driver_Mesh::DRS_OK )
throw SALOME_Exception("Export failed");
}
+//================================================================================
+/*!
+ * \brief Export the mesh to the StructuredCGNS file
+ */
+//================================================================================
+
+void SMESH_Mesh::ExportStructuredCGNS(const char * file, const SMESHDS_Mesh* meshPart, const char * meshName)
+{
+
+ int res = Driver_Mesh::DRS_OK;
+ SMESH_TRY;
+
+#ifdef WITH_CGNS
+ auto myMesh = meshPart ? (SMESHDS_Mesh*) meshPart : _meshDS;
+
+ if ( myMesh->HasSomeStructuredGridFilled() )
+ {
+ DriverStructuredCGNS_Write writer;
+ writer.SetFile( file );
+ writer.SetMesh( const_cast<SMESHDS_Mesh*>( myMesh ));
+ writer.SetMeshName( SMESH_Comment("Mesh_") << myMesh->GetPersistentId());
+ if ( meshName && meshName[0] )
+ writer.SetMeshName( meshName );
+
+ res = writer.Perform();
+ if ( res != Driver_Mesh::DRS_OK )
+ {
+ SMESH_ComputeErrorPtr err = writer.GetError();
+ if ( err && !err->IsOK() && !err->myComment.empty() )
+ throw SALOME_Exception(("Export failed: " + err->myComment ).c_str() );
+ }
+ }
+
+#endif
+ SMESH_CATCH( SMESH::throwSalomeEx );
+
+ if ( res == Driver_Mesh::DRS_TOO_LARGE_MESH )
+ {
+ std::cout << "\n\n\n Going into too large mesh file path\n\n\n\n";
+ throw TooLargeForExport("CGNS");
+ }
+
+ if ( res != Driver_Mesh::DRS_OK )
+ throw SALOME_Exception("Export failed");
+}
//================================================================================
/*!
// sort submeshes according to stored mesh order
SortByMeshOrder( theSubMeshes );
}
-
-
-//=============================================================================
-/*!
- * \brief Build folder for parallel computation
- */
-//=============================================================================
-void SMESH_Mesh::CreateTmpFolder()
-{
-#ifndef WIN32
- // Temporary folder that will be used by parallel computation
- tmp_folder = fs::temp_directory_path()/fs::unique_path(fs::path("SMESH_%%%%-%%%%"));
- fs::create_directories(tmp_folder);
-#endif
-}
-//
-//=============================================================================
-/*!
- * \brief Delete temporary folder used for parallel computation
- */
-//=============================================================================
-void SMESH_Mesh::DeleteTmpFolder()
-{
-#ifndef WIN32
- fs::remove_all(tmp_folder);
-#endif
-}