#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() );
}
*/
//================================================================================
-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();