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 <limits>
#include "SMESH_TryCatch.hxx" // include after OCCT headers!
#define cast2Node(elem) static_cast<const SMDS_MeshNode*>( elem )
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() )
THROW_SALOME_CORBA_EXCEPTION("Invalid diameter", SALOME::BAD_PARAM);
SMESH_TRY;
const SMDS_MeshNode* aNode = getMeshDS()->FindNode(IDOfNode);
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)
return elem->GetID();
SMESH_CATCH( SMESH::throwCorbaException );
return 0;
}
@ -1137,6 +1143,8 @@ SMESH_MeshEditor_i::Create0DElementsOnAllNodes(SMESH::SMESH_IDSource_ptr theObje
SMESH::SMESH_IDSource_var result;
TPythonDump pyDump;
SMESH_TRY;
TIDSortedElemSet elements, elems0D;
if ( idSourceToSet( theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
getEditor().Create0DElementsOnAllNodes( elements, elems0D );
@ -1183,6 +1191,8 @@ SMESH_MeshEditor_i::Create0DElementsOnAllNodes(SMESH::SMESH_IDSource_ptr theObje
pyDump << " = " << this << ".Create0DElementsOnAllNodes( "
<< theObject << ", '" << theGroupName << "' )";
SMESH_CATCH( SMESH::throwCorbaException );
return result._retn();
}
@ -6192,8 +6202,10 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodesOnGroupBoundaries( const SMESH::Li
CORBA::Boolean createJointElems )
throw (SALOME::SALOME_Exception)
{
initData();
bool aResult = false;
SMESH_TRY;
initData();
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
myMesh->GetMeshDS()->Modified();
@ -6223,6 +6235,9 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodesOnGroupBoundaries( const SMESH::Li
// Update Python script
TPythonDump() << "isDone = " << this << ".DoubleNodesOnGroupBoundaries( " << &theDomains
<< ", " << createJointElems << " )";
SMESH_CATCH( SMESH::throwCorbaException );
return aResult;
}
@ -6282,8 +6297,10 @@ void SMESH_MeshEditor_i::CreateHoleSkin(CORBA::Double radius,
const char* groupName,
const SMESH::double_array& theNodesCoords,
SMESH::array_of_long_array_out GroupsOfNodes)
throw (SALOME::SALOME_Exception)
throw (SALOME::SALOME_Exception)
{
SMESH_TRY;
initData();
std::vector<std::vector<int> > aListOfListOfNodes;
::SMESH_MeshEditor aMeshEditor( myMesh );
@ -6294,27 +6311,33 @@ throw (SALOME::SALOME_Exception)
vector<double> nodesCoords;
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 );
aMeshEditor.CreateHoleSkin(radius, aShape, theNodeSearcher, groupName, nodesCoords, aListOfListOfNodes);
aMeshEditor.CreateHoleSkin(radius, aShape, theNodeSearcher, groupName,
nodesCoords, aListOfListOfNodes);
GroupsOfNodes = new SMESH::array_of_long_array;
GroupsOfNodes->length( aListOfListOfNodes.size() );
std::vector<std::vector<int> >::iterator llIt = aListOfListOfNodes.begin();
for ( CORBA::Long i = 0; llIt != aListOfListOfNodes.end(); llIt++, i++ )
{
vector<int>& aListOfNodes = *llIt;
vector<int>::iterator lIt = aListOfNodes.begin();;
SMESH::long_array& aGroup = (*GroupsOfNodes)[ i ];
aGroup.length( aListOfNodes.size() );
for ( int j = 0; lIt != aListOfNodes.end(); lIt++, j++ )
aGroup[ j ] = (*lIt);
}
{
vector<int>& aListOfNodes = *llIt;
vector<int>::iterator lIt = aListOfNodes.begin();;
SMESH::long_array& aGroup = (*GroupsOfNodes)[ i ];
aGroup.length( aListOfNodes.size() );
for ( int j = 0; lIt != aListOfNodes.end(); lIt++, j++ )
aGroup[ j ] = (*lIt);
}
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