From 9b3c975bfe536e12995c4ead7b301822539338c1 Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 23 Apr 2015 18:03:26 +0300 Subject: [PATCH] 23051: [CEA 1470] SMESH NetGen - Local refinement not computed and dumped properly Add protection against not published shapes passed to SetLocalSizeOnShape() --- idl/NETGENPlugin_Algorithm.idl | 3 ++- src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx | 4 ++++ src/NETGENPlugin/NETGENPlugin_Hypothesis_i.hxx | 3 ++- src/NETGENPlugin/NETGENPlugin_Mesher.cxx | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/idl/NETGENPlugin_Algorithm.idl b/idl/NETGENPlugin_Algorithm.idl index 16b7a07..a8f1fd6 100644 --- a/idl/NETGENPlugin_Algorithm.idl +++ b/idl/NETGENPlugin_Algorithm.idl @@ -104,7 +104,8 @@ module NETGENPlugin void SetFuseEdges(in boolean value); boolean GetFuseEdges(); - void SetLocalSizeOnShape(in GEOM::GEOM_Object GeomObj, in double localSize); + void SetLocalSizeOnShape(in GEOM::GEOM_Object GeomObj, in double localSize) + raises (SALOME::SALOME_Exception); void SetLocalSizeOnEntry(in string entry, in double localSize); double GetLocalSizeOnEntry(in string entry); string_array GetLocalSizeEntries(); diff --git a/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx b/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx index 5055b00..2da2e82 100644 --- a/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx @@ -311,9 +311,13 @@ CORBA::Double NETGENPlugin_Hypothesis_i::GetNbSegPerRadius() void NETGENPlugin_Hypothesis_i::SetLocalSizeOnShape(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double localSize) + throw (SALOME::SALOME_Exception) { string entry; entry = GeomObj->GetStudyEntry(); + if ( entry.empty() ) + THROW_SALOME_CORBA_EXCEPTION( "SetLocalSizeOnShape(), shape is not published in study!", + SALOME::BAD_PARAM ); SetLocalSizeOnEntry(entry.c_str(), localSize); } diff --git a/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.hxx b/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.hxx index 0ffa291..0113bcb 100644 --- a/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.hxx +++ b/src/NETGENPlugin/NETGENPlugin_Hypothesis_i.hxx @@ -79,7 +79,8 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_i: void SetNbSegPerRadius(CORBA::Double theVal); CORBA::Double GetNbSegPerRadius(); - void SetLocalSizeOnShape(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double localSize); + void SetLocalSizeOnShape(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double localSize) + throw (SALOME::SALOME_Exception); void SetLocalSizeOnEntry(const char* entry, CORBA::Double localSize); CORBA::Double GetLocalSizeOnEntry(const char* entry); NETGENPlugin::string_array* GetLocalSizeEntries(); diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx index 897a2cc..d06bbc2 100644 --- a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx @@ -212,8 +212,10 @@ void NETGENPlugin_Mesher::SetDefaultParameters() * */ //============================================================================= + void SetLocalSize(TopoDS_Shape GeomShape, double LocalSize) { + if ( GeomShape.IsNull() ) return; TopAbs_ShapeEnum GeomType = GeomShape.ShapeType(); if (GeomType == TopAbs_COMPOUND) { for (TopoDS_Iterator it (GeomShape); it.More(); it.Next()) {