#include <vtkUnstructuredGridWriter.h>
-// to pass CORBA exception through SMESH_TRY
-#define SMY_OWN_CATCH catch( SALOME::SALOME_Exception& se ) { throw se; }
+// to pass CORBA exception and TooLargeForExport exception through SMESH_TRY
+#define SMY_OWN_CATCH \
+ catch( SALOME::SALOME_Exception& se ) { throw se; } \
+ catch( ::SMESH_Mesh::TooLargeForExport& ex ) \
+ { SALOME::ExceptionStruct se = { \
+ SALOME::COMM, \
+ CORBA::string_dup(SMESH_Comment("Mesh is too large for export in format ") << ex.what()), \
+ CORBA::string_dup(SMESH_Comment("format=") << ex.what() ), 0 }; \
+ throw SALOME::SALOME_Exception( se ); }
#include "SMESH_TryCatch.hxx" // include after OCCT headers!
char* SMESH_Mesh_i::GetVersionString(CORBA::Long minor, CORBA::Short nbDigits)
{
- string ver = DriverMED_W_SMESHDS_Mesh::GetVersionString(minor,
- nbDigits);
+ string ver = DriverMED_W_SMESHDS_Mesh::GetVersionString(minor, nbDigits);
return CORBA::string_dup( ver.c_str() );
}
{
Unexpect aCatch(SALOME_SalomeException);
- const int prevNbMeshEnt = NbNodes() + NbElements();
+ const smIdType prevNbMeshEnt = NbNodes() + NbElements();
if ( _preMeshInfo )
_preMeshInfo->ForgetOrLoad();
THROW_SALOME_CORBA_EXCEPTION( "RemoveGroupWithContents(): group does not belong to this mesh",
SALOME::BAD_PARAM);
- vector<int> nodeIds; // to remove nodes becoming free
+ vector<smIdType> nodeIds; // to remove nodes becoming free
bool isNodal = ( theGroup->GetType() == SMESH::NODE );
if ( !isNodal && !theGroup->IsEmpty() )
{
- CORBA::Long elemID = theGroup->GetID( 1 );
+ SMESH::smIdType elemID = theGroup->GetID( 1 );
int nbElemNodes = GetElemNbNodes( elemID );
if ( nbElemNodes > 0 )
nodeIds.reserve( theGroup->Size() * nbElemNodes );
SMDS_ElemIteratorPtr nIt = elOfType->nodesIterator();
for ( nbChecked = 1; nIt->more() && !toStopChecking; ++nbChecked )
{
- const int nID = nIt->next()->GetID();
+ const smIdType nID = nIt->next()->GetID();
if ( nID < isNodeInGroupsSize && isNodeInGroups[ nID ] &&
isToInclude( nbChecked, ++nbCommon, nbNodes, nbCorners, toStopChecking ))
{
while ( elemIt->more() )
{
const SMDS_MeshElement* e = elemIt->next();
- const int elemID = e->GetID();
+ const smIdType elemID = e->GetID();
const int shapeID = e->GetShapeID();
TRange & lastRange = ranges.back();
if ( lastRange.shapeID != shapeID ||
lastRange.toID != elemID )
- ranges.push_back( TRange{ shapeID, elemID, elemID + 1 });
+ ranges.push_back( TRange{ shapeID, FromIdType<int>(elemID), FromIdType<int>(elemID + 1) });
else
lastRange.toID = elemID + 1;
if ( !theIsBreakLink )
if ( mainGO->GetType() == GEOM_GROUP || !geomChanged ) // is group or not modified
{
- int nb = NbNodes() + NbElements();
+ smIdType nb = NbNodes() + NbElements();
CheckGeomGroupModif();
if ( nb != NbNodes() + NbElements() ) // something removed due to hypotheses change
_gen_i->UpdateIcons( me );
if ( !_impl->HasShapeToMesh() ) return;
- CORBA::Long nbEntities = NbNodes() + NbElements();
+ SMESH::smIdType nbEntities = NbNodes() + NbElements();
// Check if group contents changed
// Update icons
- CORBA::Long newNbEntities = NbNodes() + NbElements();
+ SMESH::smIdType newNbEntities = NbNodes() + NbElements();
list< SALOMEDS::SObject_wrap > soToUpdateIcons;
if ( newNbEntities != nbEntities )
{
while(its != logDS.end()){
SMESHDS_Command *com = *its;
int comType = com->GetType();
- int lgcom = com->GetNumber();
+ smIdType lgcom = com->GetNumber();
const list < smIdType >&intList = com->GetIndexes();
int inum = intList.size();
list < smIdType >::const_iterator ii = intList.begin();
*/
//================================================================================
-void SMESH_Mesh_i::ExportMED(const char* file,
- CORBA::Boolean auto_groups,
- CORBA::Long version,
- CORBA::Boolean overwrite,
- CORBA::Boolean autoDimension)
+void SMESH_Mesh_i::ExportMED(const char* file,
+ CORBA::Boolean auto_groups,
+ CORBA::Long version,
+ CORBA::Boolean overwrite,
+ CORBA::Boolean autoDimension)
{
//MESSAGE("MED minor version: "<< minor);
SMESH_TRY;
*/
//================================================================================
-void SMESH_Mesh_i::ExportSAUV (const char* file,
- CORBA::Boolean auto_groups)
+void SMESH_Mesh_i::ExportSAUV( const char* file, CORBA::Boolean auto_groups )
{
- Unexpect aCatch(SALOME_SalomeException);
+ SMESH_TRY;
if ( _preMeshInfo )
_preMeshInfo->FullLoadFromFile();
TPythonDump() << SMESH::SMESH_Mesh_var( _this())
<< ".ExportSAUV( r'" << file << "', " << auto_groups << " )";
_impl->ExportSAUV(file, aMeshName.c_str(), auto_groups);
+
+ SMESH_CATCH( SMESH::throwCorbaException );
}
void SMESH_Mesh_i::ExportDAT (const char *file)
{
- Unexpect aCatch(SALOME_SalomeException);
+ SMESH_TRY;
if ( _preMeshInfo )
_preMeshInfo->FullLoadFromFile();
- // Update Python script
// check names of groups
checkGroupNames();
+ // Update Python script
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportDAT( r'" << file << "' )";
// Perform Export
PrepareForWriting(file);
_impl->ExportDAT(file);
+
+ SMESH_CATCH( SMESH::throwCorbaException );
}
//================================================================================
void SMESH_Mesh_i::ExportUNV (const char *file)
{
- Unexpect aCatch(SALOME_SalomeException);
+ SMESH_TRY;
if ( _preMeshInfo )
_preMeshInfo->FullLoadFromFile();
- // Update Python script
// check names of groups
checkGroupNames();
+ // Update Python script
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportUNV( r'" << file << "' )";
// Perform Export
PrepareForWriting(file);
_impl->ExportUNV(file);
+
+ SMESH_CATCH( SMESH::throwCorbaException );
}
//================================================================================
void SMESH_Mesh_i::ExportSTL (const char *file, const bool isascii)
{
- Unexpect aCatch(SALOME_SalomeException);
+ SMESH_TRY;
if ( _preMeshInfo )
_preMeshInfo->FullLoadFromFile();
- // Update Python script
// check names of groups
checkGroupNames();
+ // Update Python script
TPythonDump() << SMESH::SMESH_Mesh_var(_this())
<< ".ExportSTL( r'" << file << "', " << isascii << " )";
// Perform Export
PrepareForWriting( file );
_impl->ExportSTL( file, isascii, name.in() );
+
+ SMESH_CATCH( SMESH::throwCorbaException );
}
//================================================================================
void SMESH_Mesh_i::ExportPartToDAT(::SMESH::SMESH_IDSource_ptr meshPart,
const char* file)
{
- Unexpect aCatch(SALOME_SalomeException);
+ SMESH_TRY;
if ( _preMeshInfo )
_preMeshInfo->FullLoadFromFile();
TPythonDump() << SMESH::SMESH_Mesh_var(_this())
<< ".ExportPartToDAT( " << meshPart << ", r'" << file << "' )";
+
+ SMESH_CATCH( SMESH::throwCorbaException );
}
//================================================================================
/*!
void SMESH_Mesh_i::ExportPartToUNV(::SMESH::SMESH_IDSource_ptr meshPart,
const char* file)
{
- Unexpect aCatch(SALOME_SalomeException);
+ SMESH_TRY;
if ( _preMeshInfo )
_preMeshInfo->FullLoadFromFile();
TPythonDump() << SMESH::SMESH_Mesh_var(_this())
<< ".ExportPartToUNV( " << meshPart<< ", r'" << file << "' )";
+
+ SMESH_CATCH( SMESH::throwCorbaException );
}
//================================================================================
/*!
const char* file,
::CORBA::Boolean isascii)
{
- Unexpect aCatch(SALOME_SalomeException);
+ SMESH_TRY;
if ( _preMeshInfo )
_preMeshInfo->FullLoadFromFile();
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportPartToSTL( "
<< meshPart<< ", r'" << file << "', " << isascii << ")";
+
+ SMESH_CATCH( SMESH::throwCorbaException );
}
//================================================================================
CORBA::Boolean groupElemsByType)
{
#ifdef WITH_CGNS
- Unexpect aCatch(SALOME_SalomeException);
+ SMESH_TRY;
if ( _preMeshInfo )
_preMeshInfo->FullLoadFromFile();
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportCGNS( "
<< meshPart<< ", r'" << file << "', " << overwrite << ")";
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+
#else
THROW_SALOME_CORBA_EXCEPTION("CGNS library is unavailable", SALOME::INTERNAL_ERROR);
#endif
const char* file,
bool withRequiredGroups)
{
- Unexpect aCatch(SALOME_SalomeException);
+ SMESH_TRY;
if ( _preMeshInfo )
_preMeshInfo->FullLoadFromFile();
<< meshPart<< ", r'"
<< file << "', "
<< withRequiredGroups << ")";
+
+ SMESH_CATCH( SMESH::throwCorbaException );
}
//=============================================================================
std::vector<const SMDS_MeshElement *> elems;
mesh->GetElementsByNodes( nn, elems, (SMDSAbs_ElementType) elemType );
result->length( elems.size() );
- for ( smIdType i = 0; i < elems.size(); ++i )
+ for ( size_t i = 0; i < elems.size(); ++i )
result[i] = elems[i]->GetID();
}
return result._retn();
SMDSAbs_ElementType iterType = isNodes ? SMDSAbs_Node : elemType;
if ( SMESH_MeshEditor_i::IsTemporaryIDSource( theObject ))
{
- int nbIds;
+ SMESH::smIdType nbIds;
if ( SMESH::smIdType* ids = SMESH_MeshEditor_i::GetTemporaryIDs( theObject, nbIds ))
elemIt = SMDS_ElemIteratorPtr( new IDSourceIterator( meshDS, ids, nbIds, iterType ));
}
smIdType SMESH_MeshPartDS::MaxElementID() const
{
if ( _meshDS ) return _meshDS->MaxElementID();
- int maxID = 0;
+ smIdType maxID = 0;
for ( int iType = SMDSAbs_Edge; iType < SMDSAbs_NbElementTypes; ++iType )
if ( !_elements[ iType ].empty() )
- maxID = Max( maxID, (*_elements[ iType ].rbegin())->GetID() );
+ maxID = std::max( maxID, (*_elements[ iType ].rbegin())->GetID() );
return maxID;
}
// -------------------------------------------------------------------------------------
smIdType SMESH_MeshPartDS::MinElementID() const
{
if ( _meshDS ) return _meshDS->MinElementID();
- int minID = 0;
+ smIdType minID = 0;
for ( int iType = SMDSAbs_Edge; iType < SMDSAbs_NbElementTypes; ++iType )
if ( !_elements[ iType ].empty() )
- minID = Min( minID, (*_elements[ iType ].begin())->GetID() );
+ minID = std::min( minID, (*_elements[ iType ].begin())->GetID() );
return minID;
}
// -------------------------------------------------------------------------------------