bos #42143 [CEA] Structured CGNS: wrong groups exported from savec hdf

This commit is contained in:
Esukhareva 2024-11-22 14:51:32 +00:00
parent e60bcaf4a9
commit ed432ffceb
2 changed files with 18 additions and 9 deletions

View File

@ -52,13 +52,14 @@ class MESHDRIVER_EXPORT Driver_Mesh
enum Status { enum Status {
DRS_OK, DRS_OK,
DRS_EMPTY, // a file contains no mesh with the given name DRS_EMPTY, // a file contains no mesh with the given name
DRS_WARN_RENUMBER, // a file has overlapped ranges of element numbers, DRS_WARN_RENUMBER, // a file has overlapped ranges of element numbers,
// so the numbers from the file are ignored // so the numbers from the file are ignored
DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
DRS_WARN_DESCENDING, // some elements were skipped due to descending connectivity DRS_WARN_DESCENDING, // some elements were skipped due to descending connectivity
DRS_FAIL, // general failure (exception etc.) DRS_WARN_NO_STRUCT_GRID, // have no filled structured grid, probably loaded from the hdf file, need recompute
DRS_TOO_LARGE_MESH // mesh is too large for export DRS_FAIL, // general failure (exception etc.)
DRS_TOO_LARGE_MESH // mesh is too large for export
}; };
void SetMeshId(int theMeshId); void SetMeshId(int theMeshId);

View File

@ -1702,8 +1702,10 @@ void SMESH_Mesh::ExportStructuredCGNS(const char * file, const SMESHDS_Mesh* mes
#ifdef WITH_CGNS #ifdef WITH_CGNS
auto myMesh = meshPart ? (SMESHDS_Mesh*) meshPart : _meshDS; auto myMesh = meshPart ? (SMESHDS_Mesh*) meshPart : _meshDS;
if ( myMesh->HasSomeStructuredGridFilled() ) if ( !myMesh->HasSomeStructuredGridFilled() ){
{ res = Driver_Mesh::DRS_WARN_NO_STRUCT_GRID;
}
else{
DriverStructuredCGNS_Write writer; DriverStructuredCGNS_Write writer;
writer.SetFile( file ); writer.SetFile( file );
writer.SetMesh( const_cast<SMESHDS_Mesh*>( myMesh )); writer.SetMesh( const_cast<SMESHDS_Mesh*>( myMesh ));
@ -1728,6 +1730,12 @@ void SMESH_Mesh::ExportStructuredCGNS(const char * file, const SMESHDS_Mesh* mes
std::cout << "\n\n\n Going into too large mesh file path\n\n\n\n"; std::cout << "\n\n\n Going into too large mesh file path\n\n\n\n";
throw TooLargeForExport("CGNS"); throw TooLargeForExport("CGNS");
} }
else if( res == Driver_Mesh::DRS_WARN_NO_STRUCT_GRID )
{
throw SALOME_Exception("The mesh does not contain a structured grid. If you are attempting to export "
"a quadrilateral mesh loaded from an HDF file, please perform a Clean + Compute operation before exporting. "
"This step is necessary due to a current limitation.");
}
if ( res != Driver_Mesh::DRS_OK ) if ( res != Driver_Mesh::DRS_OK )
throw SALOME_Exception("Export failed"); throw SALOME_Exception("Export failed");