Add missing try/catch using SMESH_TryCatch.hxx

This commit is contained in:
eap 2012-12-17 15:39:30 +00:00
parent c3597c66f0
commit bd7cecec9a
2 changed files with 467 additions and 385 deletions

View File

@ -81,6 +81,8 @@
#include <sstream> #include <sstream>
#include <limits> #include <limits>
#include "SMESH_TryCatch.hxx" // include after OCCT headers!
#define cast2Node(elem) static_cast<const SMDS_MeshNode*>( elem ) #define cast2Node(elem) static_cast<const SMDS_MeshNode*>( elem )
using namespace std; using namespace std;
@ -856,6 +858,8 @@ CORBA::Long SMESH_MeshEditor_i::AddBall(CORBA::Long IDOfNode, CORBA::Double diam
if ( diameter < std::numeric_limits<double>::min() ) if ( diameter < std::numeric_limits<double>::min() )
THROW_SALOME_CORBA_EXCEPTION("Invalid diameter", SALOME::BAD_PARAM); THROW_SALOME_CORBA_EXCEPTION("Invalid diameter", SALOME::BAD_PARAM);
SMESH_TRY;
const SMDS_MeshNode* aNode = getMeshDS()->FindNode(IDOfNode); const SMDS_MeshNode* aNode = getMeshDS()->FindNode(IDOfNode);
SMDS_MeshElement* elem = getMeshDS()->AddBall(aNode, diameter); SMDS_MeshElement* elem = getMeshDS()->AddBall(aNode, diameter);
@ -869,6 +873,8 @@ CORBA::Long SMESH_MeshEditor_i::AddBall(CORBA::Long IDOfNode, CORBA::Double diam
if (elem) if (elem)
return elem->GetID(); return elem->GetID();
SMESH_CATCH( SMESH::throwCorbaException );
return 0; return 0;
} }
@ -1137,6 +1143,8 @@ SMESH_MeshEditor_i::Create0DElementsOnAllNodes(SMESH::SMESH_IDSource_ptr theObje
SMESH::SMESH_IDSource_var result; SMESH::SMESH_IDSource_var result;
TPythonDump pyDump; TPythonDump pyDump;
SMESH_TRY;
TIDSortedElemSet elements, elems0D; TIDSortedElemSet elements, elems0D;
if ( idSourceToSet( theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1)) if ( idSourceToSet( theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
getEditor().Create0DElementsOnAllNodes( elements, elems0D ); getEditor().Create0DElementsOnAllNodes( elements, elems0D );
@ -1183,6 +1191,8 @@ SMESH_MeshEditor_i::Create0DElementsOnAllNodes(SMESH::SMESH_IDSource_ptr theObje
pyDump << " = " << this << ".Create0DElementsOnAllNodes( " pyDump << " = " << this << ".Create0DElementsOnAllNodes( "
<< theObject << ", '" << theGroupName << "' )"; << theObject << ", '" << theGroupName << "' )";
SMESH_CATCH( SMESH::throwCorbaException );
return result._retn(); return result._retn();
} }
@ -6192,8 +6202,10 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodesOnGroupBoundaries( const SMESH::Li
CORBA::Boolean createJointElems ) CORBA::Boolean createJointElems )
throw (SALOME::SALOME_Exception) throw (SALOME::SALOME_Exception)
{ {
initData(); bool aResult = false;
SMESH_TRY;
initData();
SMESHDS_Mesh* aMeshDS = getMeshDS(); SMESHDS_Mesh* aMeshDS = getMeshDS();
@ -6215,7 +6227,7 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodesOnGroupBoundaries( const SMESH::Li
} }
} }
bool aResult = getEditor().DoubleNodesOnGroupBoundaries( domains, createJointElems ); aResult = getEditor().DoubleNodesOnGroupBoundaries( domains, createJointElems );
// TODO publish the groups of flat elements in study // TODO publish the groups of flat elements in study
myMesh->GetMeshDS()->Modified(); myMesh->GetMeshDS()->Modified();
@ -6223,6 +6235,9 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodesOnGroupBoundaries( const SMESH::Li
// Update Python script // Update Python script
TPythonDump() << "isDone = " << this << ".DoubleNodesOnGroupBoundaries( " << &theDomains TPythonDump() << "isDone = " << this << ".DoubleNodesOnGroupBoundaries( " << &theDomains
<< ", " << createJointElems << " )"; << ", " << createJointElems << " )";
SMESH_CATCH( SMESH::throwCorbaException );
return aResult; return aResult;
} }
@ -6282,8 +6297,10 @@ void SMESH_MeshEditor_i::CreateHoleSkin(CORBA::Double radius,
const char* groupName, const char* groupName,
const SMESH::double_array& theNodesCoords, const SMESH::double_array& theNodesCoords,
SMESH::array_of_long_array_out GroupsOfNodes) SMESH::array_of_long_array_out GroupsOfNodes)
throw (SALOME::SALOME_Exception) throw (SALOME::SALOME_Exception)
{ {
SMESH_TRY;
initData(); initData();
std::vector<std::vector<int> > aListOfListOfNodes; std::vector<std::vector<int> > aListOfListOfNodes;
::SMESH_MeshEditor aMeshEditor( myMesh ); ::SMESH_MeshEditor aMeshEditor( myMesh );
@ -6294,27 +6311,33 @@ throw (SALOME::SALOME_Exception)
vector<double> nodesCoords; vector<double> nodesCoords;
for (int i = 0; i < theNodesCoords.length(); i++) for (int i = 0; i < theNodesCoords.length(); i++)
{ {
nodesCoords.push_back( theNodesCoords[i] ); nodesCoords.push_back( theNodesCoords[i] );
} }
TopoDS_Shape aShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theShape ); TopoDS_Shape aShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theShape );
aMeshEditor.CreateHoleSkin(radius, aShape, theNodeSearcher, groupName, nodesCoords, aListOfListOfNodes); aMeshEditor.CreateHoleSkin(radius, aShape, theNodeSearcher, groupName,
nodesCoords, aListOfListOfNodes);
GroupsOfNodes = new SMESH::array_of_long_array; GroupsOfNodes = new SMESH::array_of_long_array;
GroupsOfNodes->length( aListOfListOfNodes.size() ); GroupsOfNodes->length( aListOfListOfNodes.size() );
std::vector<std::vector<int> >::iterator llIt = aListOfListOfNodes.begin(); std::vector<std::vector<int> >::iterator llIt = aListOfListOfNodes.begin();
for ( CORBA::Long i = 0; llIt != aListOfListOfNodes.end(); llIt++, i++ ) for ( CORBA::Long i = 0; llIt != aListOfListOfNodes.end(); llIt++, i++ )
{ {
vector<int>& aListOfNodes = *llIt; vector<int>& aListOfNodes = *llIt;
vector<int>::iterator lIt = aListOfNodes.begin();; vector<int>::iterator lIt = aListOfNodes.begin();;
SMESH::long_array& aGroup = (*GroupsOfNodes)[ i ]; SMESH::long_array& aGroup = (*GroupsOfNodes)[ i ];
aGroup.length( aListOfNodes.size() ); aGroup.length( aListOfNodes.size() );
for ( int j = 0; lIt != aListOfNodes.end(); lIt++, j++ ) for ( int j = 0; lIt != aListOfNodes.end(); lIt++, j++ )
aGroup[ j ] = (*lIt); aGroup[ j ] = (*lIt);
} }
TPythonDump() << "lists_nodes = " << this << ".CreateHoleSkin( " TPythonDump() << "lists_nodes = " << this << ".CreateHoleSkin( "
<< radius << ", " << theShape << ", " << ", " << groupName << ", " << theNodesCoords << " )"; << radius << ", "
<< theShape
<< ", '" << groupName << "', "
<< theNodesCoords << " )";
SMESH_CATCH( SMESH::throwCorbaException );
} }

File diff suppressed because it is too large Load Diff