From 0d03310b89a97e8afe4e0cdf18c4ce182941011b Mon Sep 17 00:00:00 2001 From: cconopoima Date: Wed, 6 Dec 2023 11:53:31 +0000 Subject: [PATCH] [bos #40035][EDF] Handle Salome Exception in interface to retun meaninfull error message when the shrink geometry does not match the topology of the original geometry. --- idl/SMESH_BasicHypothesis.idl | 8 ++++---- src/StdMeshers/StdMeshers_Cartesian_VL.cxx | 2 +- .../StdMeshers_ViscousLayerBuilder_i.cxx | 12 ++++++++++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/idl/SMESH_BasicHypothesis.idl b/idl/SMESH_BasicHypothesis.idl index 30281a309..3a097af91 100644 --- a/idl/SMESH_BasicHypothesis.idl +++ b/idl/SMESH_BasicHypothesis.idl @@ -1270,15 +1270,15 @@ module StdMeshers void SetTotalThickness(in double thickness) raises (SALOME::SALOME_Exception); void SetNumberLayers(in short numberOfLayers ) raises (SALOME::SALOME_Exception); void SetStretchFactor(in double strechFactor ) raises (SALOME::SALOME_Exception); - void SetMethod( in VLExtrusionMethod how ); - void SetGroupName(in string name); + void SetMethod( in VLExtrusionMethod how ) raises (SALOME::SALOME_Exception); + void SetGroupName(in string name) raises (SALOME::SALOME_Exception); - GEOM::GEOM_Object GetShrinkGeometry( in SMESH::SMESH_Mesh finalMesh, in GEOM::GEOM_Object theObject ); + GEOM::GEOM_Object GetShrinkGeometry( in SMESH::SMESH_Mesh finalMesh, in GEOM::GEOM_Object theObject ) raises (SALOME::SALOME_Exception); /*! * Build the prismatic layer from the shrink mesh */ - boolean AddLayers( in SMESH::SMESH_Mesh sourceMesh, in SMESH::SMESH_Mesh finalMesh, in GEOM::GEOM_Object theObject ); + boolean AddLayers( in SMESH::SMESH_Mesh sourceMesh, in SMESH::SMESH_Mesh finalMesh, in GEOM::GEOM_Object theObject ) raises (SALOME::SALOME_Exception); }; diff --git a/src/StdMeshers/StdMeshers_Cartesian_VL.cxx b/src/StdMeshers/StdMeshers_Cartesian_VL.cxx index 784996922..ddf0f8965 100644 --- a/src/StdMeshers/StdMeshers_Cartesian_VL.cxx +++ b/src/StdMeshers/StdMeshers_Cartesian_VL.cxx @@ -1121,7 +1121,7 @@ bool StdMeshers_Cartesian_VL::ViscousBuilder::MakeViscousLayers( SMESH_Mesh & // Validate map of shrink+joint geometry elements if ( !CheckGeometryMaps(offsetMesh, theShape ) && !isMainShape2D ) - throw SALOME_Exception("All elements from the shrink geometry were not match to the original geometry\n"); + throw SALOME_Exception("The shrink geometry does not match or respect the original topology.The viscous layer can't be build"); initMDS->ClearMesh(); // avoid mesh superposition on multiple calls of addLayers diff --git a/src/StdMeshers_I/StdMeshers_ViscousLayerBuilder_i.cxx b/src/StdMeshers_I/StdMeshers_ViscousLayerBuilder_i.cxx index 3fc156116..a34390f6c 100644 --- a/src/StdMeshers_I/StdMeshers_ViscousLayerBuilder_i.cxx +++ b/src/StdMeshers_I/StdMeshers_ViscousLayerBuilder_i.cxx @@ -188,8 +188,16 @@ CORBA::Boolean StdMeshers_ViscousLayerBuilder_i::AddLayers( SMESH::SMESH_Mesh_pt TopoDS_Shape theShape = StdMeshers_ObjRefUlils::GeomObjectToShape( theShapeObject ); SMESH_Mesh_i* shrinkMesh_i = SMESH::DownCast< SMESH_Mesh_i* >( shrinkMesh ); SMESH_Mesh_i* theFinalMesh_i = SMESH::DownCast< SMESH_Mesh_i* >( finalMesh ); - - bool success = GetImpl()->AddLayers( shrinkMesh_i->GetImpl(), theFinalMesh_i->GetImpl(), theShape ); + bool success = false; + + try + { + success = GetImpl()->AddLayers( shrinkMesh_i->GetImpl(), theFinalMesh_i->GetImpl(), theShape ); + } + catch ( std::exception& exc ) + { + THROW_SALOME_CORBA_EXCEPTION( exc.what(), SALOME::INTERNAL_ERROR ); + } return success; } -- 2.30.2