mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-28 18:30:35 +05:00
Check mesh size before export
This commit is contained in:
parent
293adaddb5
commit
6d54a9deb2
@ -28,6 +28,7 @@
|
||||
#define _INCLUDE_DRIVER_MESH
|
||||
|
||||
#include "SMESH_ComputeError.hxx"
|
||||
#include "SMDS_Mesh.hxx"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -50,12 +51,13 @@ class MESHDRIVER_EXPORT Driver_Mesh
|
||||
|
||||
enum Status {
|
||||
DRS_OK,
|
||||
DRS_EMPTY, // a file contains no mesh with the given name
|
||||
DRS_WARN_RENUMBER, // a file has overlapped ranges of element numbers,
|
||||
// so the numbers from the file are ignored
|
||||
DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
|
||||
DRS_EMPTY, // a file contains no mesh with the given name
|
||||
DRS_WARN_RENUMBER, // a file has overlapped ranges of element numbers,
|
||||
// so the numbers from the file are ignored
|
||||
DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
|
||||
DRS_WARN_DESCENDING, // some elements were skipped due to descending connectivity
|
||||
DRS_FAIL // general failure (exception etc.)
|
||||
DRS_FAIL, // general failure (exception etc.)
|
||||
DRS_TOO_LARGE_MESH // mesh is too large for export
|
||||
};
|
||||
|
||||
void SetMeshId(int theMeshId);
|
||||
@ -70,6 +72,22 @@ class MESHDRIVER_EXPORT Driver_Mesh
|
||||
|
||||
virtual SMESH_ComputeErrorPtr GetError();
|
||||
|
||||
//virtual bool CanExportMesh() const { return false; } //= 0;
|
||||
|
||||
// check if a mesh is too large to export it using IDTYPE;
|
||||
// check either max ID or number of elements
|
||||
template< typename IDTYPE >
|
||||
static bool IsMeshTooLarge( const SMDS_Mesh* mesh, bool checkIDs )
|
||||
{
|
||||
if ( sizeof( IDTYPE ) < sizeof( smIdType ))
|
||||
{
|
||||
const smIdType maxNB = std::numeric_limits< IDTYPE >::max();
|
||||
return (( checkIDs ? mesh->MaxNodeID() : mesh->NbNodes() ) > maxNB ||
|
||||
( checkIDs ? mesh->MaxElementID() : mesh->NbElements() > maxNB ));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
std::string myFile;
|
||||
std::string myMeshName;
|
||||
|
@ -248,6 +248,9 @@ Driver_Mesh::Status DriverCGNS_Write::Perform()
|
||||
if ( !myMesh || myMesh->GetMeshInfo().NbElements() < 1 )
|
||||
return addMessage( !myMesh ? "NULL mesh" : "Empty mesh (no elements)", /*fatal = */true );
|
||||
|
||||
if ( Driver_Mesh::IsMeshTooLarge< cgsize_t >( myMesh, /*checkIDs =*/ false))
|
||||
return DRS_TOO_LARGE_MESH;
|
||||
|
||||
// open the file
|
||||
if ( cg_open(myFile.c_str(), CG_MODE_MODIFY, &_fn) != CG_OK &&
|
||||
cg_open(myFile.c_str(), CG_MODE_WRITE, &_fn) != CG_OK )
|
||||
@ -282,7 +285,9 @@ Driver_Mesh::Status DriverCGNS_Write::Perform()
|
||||
else if ( meshDim == 2 )
|
||||
nbCells = myMesh->NbFaces();
|
||||
|
||||
cgsize_t size[9] = { myMesh->NbNodes(), nbCells, /*NBoundVertex=*/0, 0,0,0,0,0,0 };
|
||||
cgsize_t size[9] = { FromIdType<cgsize_t>( myMesh->NbNodes() ),
|
||||
FromIdType<cgsize_t>( nbCells ),
|
||||
/*NBoundVertex=*/0, 0,0,0,0,0,0 };
|
||||
int iZone;
|
||||
if ( cg_zone_write( _fn, iBase, "SMESH_Mesh", size,
|
||||
CGNS_ENUMV( Unstructured ), &iZone) != CG_OK )
|
||||
|
@ -100,6 +100,9 @@ Driver_Mesh::Status DriverGMF_Write::Perform()
|
||||
{
|
||||
Kernel_Utils::Localizer loc;
|
||||
|
||||
if ( Driver_Mesh::IsMeshTooLarge< int >( myMesh, /*checkIDs =*/ false))
|
||||
return DRS_TOO_LARGE_MESH;
|
||||
|
||||
const int dim = 3, version = sizeof(double) < 8 ? 1 : 2;
|
||||
|
||||
int meshID = GmfOpenMesh( myFile.c_str(), GmfWrite, version, dim );
|
||||
|
@ -343,12 +343,21 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Write my mesh
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
|
||||
{
|
||||
Status aResult = DRS_OK;
|
||||
try {
|
||||
//MESSAGE("Perform - myFile : "<<myFile);
|
||||
|
||||
if ( Driver_Mesh::IsMeshTooLarge< TInt >( myMesh, /*checkIDs =*/ true ))
|
||||
return DRS_TOO_LARGE_MESH;
|
||||
|
||||
// Creating the MED mesh for corresponding SMDS structure
|
||||
//-------------------------------------------------------
|
||||
string aMeshName;
|
||||
@ -559,7 +568,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
|
||||
aTCoordSlice[2] = 0.;
|
||||
|
||||
// node number
|
||||
int aNodeID = aCoordHelperPtr->GetID();
|
||||
TInt aNodeID = FromIdType<TInt>( aCoordHelperPtr->GetID() );
|
||||
aNodeInfo->SetElemNum( iNode, aNodeID );
|
||||
#ifdef _EDF_NODE_IDS_
|
||||
aNodeIdMap.insert( aNodeIdMap.end(), make_pair( aNodeID, iNode+1 ));
|
||||
|
@ -45,6 +45,10 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
|
||||
{
|
||||
Kernel_Utils::Localizer loc;
|
||||
Status aResult = DRS_OK;
|
||||
|
||||
if ( Driver_Mesh::IsMeshTooLarge< int >( myMesh, /*checkIDs =*/ false))
|
||||
return DRS_TOO_LARGE_MESH;
|
||||
|
||||
#if defined(WIN32) && defined(UNICODE)
|
||||
std::wstring aFile = Kernel_Utils::utf8_decode_s(myFile);
|
||||
std::ofstream out_stream(aFile.c_str());
|
||||
@ -256,11 +260,11 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
|
||||
EXCEPTION(runtime_error,"ERROR: Output file not good.");
|
||||
}
|
||||
catch(const std::exception& exc){
|
||||
INFOS("Follow exception was cought:\n\t"<<exc.what());
|
||||
INFOS("Follow exception was caught:\n\t"<<exc.what());
|
||||
throw;
|
||||
}
|
||||
catch(...){
|
||||
INFOS("Unknown exception was cought !!!");
|
||||
INFOS("Unknown exception was caught !!!");
|
||||
throw;
|
||||
}
|
||||
return aResult;
|
||||
|
@ -1428,6 +1428,8 @@ void SMESH_Mesh::ExportMED(const char * file,
|
||||
bool theAllElemsToGroup)
|
||||
{
|
||||
MESSAGE("MED_VERSION:"<< theVersion);
|
||||
|
||||
Driver_Mesh::Status status;
|
||||
SMESH_TRY;
|
||||
|
||||
DriverMED_W_SMESHDS_Mesh myWriter;
|
||||
@ -1482,9 +1484,12 @@ void SMESH_Mesh::ExportMED(const char * file,
|
||||
}
|
||||
}
|
||||
// Perform export
|
||||
myWriter.Perform();
|
||||
status = myWriter.Perform();
|
||||
|
||||
SMESH_CATCH( SMESH::throwSalomeEx );
|
||||
|
||||
if ( status == Driver_Mesh::DRS_TOO_LARGE_MESH )
|
||||
throw TooLargeForExport("MED");
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -1509,9 +1514,15 @@ void SMESH_Mesh::ExportSAUV(const char *file,
|
||||
cmd += "from medutilities import my_remove ; my_remove(r'" + medfilename + "')";
|
||||
cmd += "\"";
|
||||
system(cmd.c_str());
|
||||
ExportMED(medfilename.c_str(), theMeshName, theAutoGroups, /*minor=*/-1,
|
||||
/*meshPart=*/NULL, /*theAutoDimension=*/false, /*theAddODOnVertices=*/false,
|
||||
/*zTol=*/-1, /*theAllElemsToGroup=*/true ); // theAllElemsToGroup is for PAL0023413
|
||||
try {
|
||||
ExportMED(medfilename.c_str(), theMeshName, theAutoGroups, /*minor=*/-1,
|
||||
/*meshPart=*/NULL, /*theAutoDimension=*/false, /*theAddODOnVertices=*/false,
|
||||
/*zTol=*/-1, /*theAllElemsToGroup=*/true ); // theAllElemsToGroup is for PAL0023413
|
||||
}
|
||||
catch ( TooLargeForExport )
|
||||
{
|
||||
throw TooLargeForExport("SAUV");
|
||||
}
|
||||
#ifdef WIN32
|
||||
cmd = "%PYTHONBIN% ";
|
||||
#else
|
||||
@ -1541,12 +1552,19 @@ void SMESH_Mesh::ExportSAUV(const char *file,
|
||||
void SMESH_Mesh::ExportDAT(const char * file,
|
||||
const SMESHDS_Mesh* meshPart)
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
Driver_Mesh::Status status;
|
||||
SMESH_TRY;
|
||||
|
||||
DriverDAT_W_SMDS_Mesh myWriter;
|
||||
myWriter.SetFile( file );
|
||||
myWriter.SetMesh( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS );
|
||||
myWriter.SetMeshId(_id);
|
||||
myWriter.Perform();
|
||||
status = myWriter.Perform();
|
||||
|
||||
SMESH_CATCH( SMESH::throwSalomeEx );
|
||||
|
||||
if ( status == Driver_Mesh::DRS_TOO_LARGE_MESH )
|
||||
throw TooLargeForExport("DAT");
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -1558,7 +1576,9 @@ void SMESH_Mesh::ExportDAT(const char * file,
|
||||
void SMESH_Mesh::ExportUNV(const char * file,
|
||||
const SMESHDS_Mesh* meshPart)
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
Driver_Mesh::Status status;
|
||||
|
||||
SMESH_TRY;
|
||||
DriverUNV_W_SMDS_Mesh myWriter;
|
||||
myWriter.SetFile( file );
|
||||
myWriter.SetMesh( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS );
|
||||
@ -1579,7 +1599,12 @@ void SMESH_Mesh::ExportUNV(const char * file,
|
||||
}
|
||||
}
|
||||
}
|
||||
myWriter.Perform();
|
||||
status = myWriter.Perform();
|
||||
|
||||
SMESH_CATCH( SMESH::throwSalomeEx );
|
||||
|
||||
if ( status == Driver_Mesh::DRS_TOO_LARGE_MESH )
|
||||
throw TooLargeForExport("UNV");
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -1593,14 +1618,21 @@ void SMESH_Mesh::ExportSTL(const char * file,
|
||||
const char * name,
|
||||
const SMESHDS_Mesh* meshPart)
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
Driver_Mesh::Status status;
|
||||
SMESH_TRY;
|
||||
|
||||
DriverSTL_W_SMDS_Mesh myWriter;
|
||||
myWriter.SetFile( file );
|
||||
myWriter.SetIsAscii( isascii );
|
||||
myWriter.SetMesh( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS);
|
||||
myWriter.SetMeshId(_id);
|
||||
if ( name ) myWriter.SetName( name );
|
||||
myWriter.Perform();
|
||||
status = myWriter.Perform();
|
||||
|
||||
SMESH_CATCH( SMESH::throwSalomeEx );
|
||||
|
||||
if ( status == Driver_Mesh::DRS_TOO_LARGE_MESH )
|
||||
throw TooLargeForExport("STL");
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -1614,7 +1646,9 @@ void SMESH_Mesh::ExportCGNS(const char * file,
|
||||
const char * meshName,
|
||||
const bool groupElemsByType)
|
||||
{
|
||||
|
||||
int res = Driver_Mesh::DRS_FAIL;
|
||||
SMESH_TRY;
|
||||
|
||||
// pass group names to SMESHDS
|
||||
std::map<int, SMESH_Group*>::iterator it = _mapGroup.begin();
|
||||
@ -1644,6 +1678,11 @@ void SMESH_Mesh::ExportCGNS(const char * file,
|
||||
}
|
||||
|
||||
#endif
|
||||
SMESH_CATCH( SMESH::throwSalomeEx );
|
||||
|
||||
if ( res == Driver_Mesh::DRS_TOO_LARGE_MESH )
|
||||
throw TooLargeForExport("CGNS");
|
||||
|
||||
if ( res != Driver_Mesh::DRS_OK )
|
||||
throw SALOME_Exception("Export failed");
|
||||
}
|
||||
@ -1658,12 +1697,20 @@ void SMESH_Mesh::ExportGMF(const char * file,
|
||||
const SMESHDS_Mesh* meshDS,
|
||||
bool withRequiredGroups)
|
||||
{
|
||||
Driver_Mesh::Status status;
|
||||
SMESH_TRY;
|
||||
|
||||
DriverGMF_Write myWriter;
|
||||
myWriter.SetFile( file );
|
||||
myWriter.SetMesh( const_cast<SMESHDS_Mesh*>( meshDS ));
|
||||
myWriter.SetExportRequiredGroups( withRequiredGroups );
|
||||
|
||||
myWriter.Perform();
|
||||
status = myWriter.Perform();
|
||||
|
||||
SMESH_CATCH( SMESH::throwSalomeEx );
|
||||
|
||||
if ( status == Driver_Mesh::DRS_TOO_LARGE_MESH )
|
||||
throw TooLargeForExport("GMF");
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
|
@ -245,12 +245,22 @@ class SMESH_EXPORT SMESH_Mesh
|
||||
*/
|
||||
typedef TopTools_IndexedDataMapOfShapeListOfShape TAncestorMap;
|
||||
const TAncestorMap& GetAncestorMap() const { return _mapAncestors; }
|
||||
|
||||
/*!
|
||||
* \brief Check group names for duplications.
|
||||
* Consider maximum group name length stored in MED file
|
||||
*/
|
||||
bool HasDuplicatedGroupNamesMED();
|
||||
|
||||
/*!
|
||||
* \brief Exception thrown by Export*() in case if a mesh is too large for export
|
||||
* due to limitation of a format
|
||||
*/
|
||||
struct TooLargeForExport : public std::runtime_error
|
||||
{
|
||||
TooLargeForExport(const char* format):runtime_error(format) {}
|
||||
};
|
||||
|
||||
void ExportMED(const char * theFile,
|
||||
const char* theMeshName = NULL,
|
||||
bool theAutoGroups = true,
|
||||
|
@ -992,11 +992,19 @@ namespace
|
||||
aMesh->ExportGMF( aMeshOrGroup, aFilename.toUtf8().data(), toCreateGroups );
|
||||
}
|
||||
}
|
||||
catch (const SALOME::SALOME_Exception& S_ex){
|
||||
catch (const SALOME::SALOME_Exception& S_ex)
|
||||
{
|
||||
wc.suspend();
|
||||
SUIT_MessageBox::warning(SMESHGUI::desktop(),
|
||||
QObject::tr("SMESH_WRN_WARNING"),
|
||||
QObject::tr("SMESH_EXPORT_FAILED") + SalomeApp_Tools::ExceptionToString(S_ex));
|
||||
if ( S_ex.details.type == SALOME::COMM && // communicate about too large mesh
|
||||
strncmp( "format=", S_ex.details.sourceFile.in(), 7 ) == 0 )
|
||||
|
||||
SUIT_MessageBox::critical(SMESHGUI::desktop(),
|
||||
QObject::tr("SMESH_WRN_WARNING"),
|
||||
QObject::tr(S_ex.details.text.in() ));
|
||||
else
|
||||
SUIT_MessageBox::warning(SMESHGUI::desktop(),
|
||||
QObject::tr("SMESH_WRN_WARNING"),
|
||||
QObject::tr("SMESH_EXPORT_FAILED") + SalomeApp_Tools::ExceptionToString(S_ex));
|
||||
wc.resume();
|
||||
}
|
||||
}
|
||||
@ -5131,7 +5139,7 @@ bool SMESHGUI::activateModule( SUIT_Study* study )
|
||||
lab = lab + tr("INFO_COMPUTE") + "<br/>";
|
||||
lab = lab + tr("INFO_REFINE") + ":";
|
||||
items << wrap(tr("INFO_REFINE_LOCAL_SIZE"), "li")
|
||||
<< wrap(tr("INFO_REFINE_SUBMESH"), "li");
|
||||
<< wrap(tr("INFO_REFINE_SUBMESH"), "li");
|
||||
lab = lab + wrap(items.join(""), "ul");
|
||||
items.clear();
|
||||
|
||||
@ -5139,11 +5147,11 @@ bool SMESHGUI::activateModule( SUIT_Study* study )
|
||||
|
||||
gb = app->infoPanel()->addGroup(tr("INFO_GRP_IMPORT_MESH"));
|
||||
items << wrap("UNV", "li")
|
||||
<< wrap("MED", "li")
|
||||
<< wrap("STL", "li")
|
||||
<< wrap("CGNS", "li")
|
||||
<< wrap("SAUV", "li")
|
||||
<< wrap("GMF", "li");
|
||||
<< wrap("MED", "li")
|
||||
<< wrap("STL", "li")
|
||||
<< wrap("CGNS", "li")
|
||||
<< wrap("SAUV", "li")
|
||||
<< wrap("GMF", "li");
|
||||
lab = tr("INFO_AVAILABLE_FORMATS") + ":" + wrap(items.join(""), "ul");
|
||||
items.clear();
|
||||
|
||||
@ -5152,9 +5160,9 @@ bool SMESHGUI::activateModule( SUIT_Study* study )
|
||||
gb = app->infoPanel()->addGroup(tr("INFO_GRP_CHECK_MESH"));
|
||||
lab = tr("INFO_DISPLAY") + "<br/>";
|
||||
items << wrap(tr("INFO_QUALITY_AREA"), "li")
|
||||
<< wrap(tr("INFO_QUALITY_VOLUME"), "li")
|
||||
<< wrap(tr("INFO_QUALITY_ASPECT_RATION"), "li")
|
||||
<< wrap("...", "li");
|
||||
<< wrap(tr("INFO_QUALITY_VOLUME"), "li")
|
||||
<< wrap(tr("INFO_QUALITY_ASPECT_RATION"), "li")
|
||||
<< wrap("...", "li");
|
||||
lab = lab + tr("INFO_QUALITY_INFO") + ":" + wrap(items.join(""), "ul");
|
||||
items.clear();
|
||||
lab = lab + tr("INFO_CLIPPING");
|
||||
|
@ -65,11 +65,14 @@
|
||||
|
||||
//-------------------------------------------------------------------------------------
|
||||
// A macro makes description of a caught exception and calls onExceptionFun(const char*).
|
||||
// Two onExceptionFun() are defined here: SMESH::throwSalomeEx() and SMESH::doNothing().
|
||||
// Several onExceptionFun() are defined here: throwSalomeEx(), doNothing() and returnError().
|
||||
// To add your own catch close, define SMY_OWN_CATCH macro before including this file.
|
||||
|
||||
#define SMESH_CATCH( onExceptionFun ) \
|
||||
} \
|
||||
\
|
||||
SMY_OWN_CATCH \
|
||||
\
|
||||
catch (Standard_Failure& ex) \
|
||||
{ \
|
||||
SMESH_Comment text("OCCT Exception: "); \
|
||||
@ -92,9 +95,6 @@
|
||||
{ \
|
||||
SMESH_CAUGHT onExceptionFun( ex.what() ); \
|
||||
} \
|
||||
\
|
||||
SMY_OWN_CATCH \
|
||||
\
|
||||
catch (...) \
|
||||
{ \
|
||||
SMESH_CAUGHT onExceptionFun("Unknown Exception caught"); \
|
||||
|
@ -84,8 +84,15 @@
|
||||
|
||||
#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!
|
||||
|
||||
@ -461,8 +468,7 @@ SMESH::DriverMED_ReadStatus SMESH_Mesh_i::ImportCGNSFile( const char* theFileNa
|
||||
|
||||
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() );
|
||||
}
|
||||
|
||||
@ -3732,11 +3738,11 @@ string SMESH_Mesh_i::prepareMeshNameAndGroups(const char* file,
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
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;
|
||||
@ -3763,10 +3769,9 @@ void SMESH_Mesh_i::ExportMED(const char* file,
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
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();
|
||||
|
||||
@ -3774,6 +3779,8 @@ void SMESH_Mesh_i::ExportSAUV (const char* file,
|
||||
TPythonDump() << SMESH::SMESH_Mesh_var( _this())
|
||||
<< ".ExportSAUV( r'" << file << "', " << auto_groups << " )";
|
||||
_impl->ExportSAUV(file, aMeshName.c_str(), auto_groups);
|
||||
|
||||
SMESH_CATCH( SMESH::throwCorbaException );
|
||||
}
|
||||
|
||||
|
||||
@ -3785,18 +3792,20 @@ void SMESH_Mesh_i::ExportSAUV (const char* file,
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -3807,18 +3816,20 @@ void SMESH_Mesh_i::ExportDAT (const char *file)
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -3829,13 +3840,13 @@ void SMESH_Mesh_i::ExportUNV (const char *file)
|
||||
|
||||
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 << " )";
|
||||
|
||||
@ -3847,6 +3858,8 @@ void SMESH_Mesh_i::ExportSTL (const char *file, const bool isascii)
|
||||
// Perform Export
|
||||
PrepareForWriting( file );
|
||||
_impl->ExportSTL( file, isascii, name.in() );
|
||||
|
||||
SMESH_CATCH( SMESH::throwCorbaException );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -4249,7 +4262,7 @@ void SMESH_Mesh_i::exportMEDFields( DriverMED_W_Field& fieldWriter,
|
||||
void SMESH_Mesh_i::ExportPartToDAT(::SMESH::SMESH_IDSource_ptr meshPart,
|
||||
const char* file)
|
||||
{
|
||||
Unexpect aCatch(SALOME_SalomeException);
|
||||
SMESH_TRY;
|
||||
if ( _preMeshInfo )
|
||||
_preMeshInfo->FullLoadFromFile();
|
||||
|
||||
@ -4260,6 +4273,8 @@ void SMESH_Mesh_i::ExportPartToDAT(::SMESH::SMESH_IDSource_ptr meshPart,
|
||||
|
||||
TPythonDump() << SMESH::SMESH_Mesh_var(_this())
|
||||
<< ".ExportPartToDAT( " << meshPart << ", r'" << file << "' )";
|
||||
|
||||
SMESH_CATCH( SMESH::throwCorbaException );
|
||||
}
|
||||
//================================================================================
|
||||
/*!
|
||||
@ -4270,7 +4285,7 @@ void SMESH_Mesh_i::ExportPartToDAT(::SMESH::SMESH_IDSource_ptr meshPart,
|
||||
void SMESH_Mesh_i::ExportPartToUNV(::SMESH::SMESH_IDSource_ptr meshPart,
|
||||
const char* file)
|
||||
{
|
||||
Unexpect aCatch(SALOME_SalomeException);
|
||||
SMESH_TRY;
|
||||
if ( _preMeshInfo )
|
||||
_preMeshInfo->FullLoadFromFile();
|
||||
|
||||
@ -4281,6 +4296,8 @@ void SMESH_Mesh_i::ExportPartToUNV(::SMESH::SMESH_IDSource_ptr meshPart,
|
||||
|
||||
TPythonDump() << SMESH::SMESH_Mesh_var(_this())
|
||||
<< ".ExportPartToUNV( " << meshPart<< ", r'" << file << "' )";
|
||||
|
||||
SMESH_CATCH( SMESH::throwCorbaException );
|
||||
}
|
||||
//================================================================================
|
||||
/*!
|
||||
@ -4292,7 +4309,7 @@ void SMESH_Mesh_i::ExportPartToSTL(::SMESH::SMESH_IDSource_ptr meshPart,
|
||||
const char* file,
|
||||
::CORBA::Boolean isascii)
|
||||
{
|
||||
Unexpect aCatch(SALOME_SalomeException);
|
||||
SMESH_TRY;
|
||||
if ( _preMeshInfo )
|
||||
_preMeshInfo->FullLoadFromFile();
|
||||
|
||||
@ -4308,6 +4325,8 @@ void SMESH_Mesh_i::ExportPartToSTL(::SMESH::SMESH_IDSource_ptr meshPart,
|
||||
|
||||
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportPartToSTL( "
|
||||
<< meshPart<< ", r'" << file << "', " << isascii << ")";
|
||||
|
||||
SMESH_CATCH( SMESH::throwCorbaException );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -4322,7 +4341,7 @@ void SMESH_Mesh_i::ExportCGNS(::SMESH::SMESH_IDSource_ptr meshPart,
|
||||
CORBA::Boolean groupElemsByType)
|
||||
{
|
||||
#ifdef WITH_CGNS
|
||||
Unexpect aCatch(SALOME_SalomeException);
|
||||
SMESH_TRY;
|
||||
if ( _preMeshInfo )
|
||||
_preMeshInfo->FullLoadFromFile();
|
||||
|
||||
@ -4344,6 +4363,9 @@ void SMESH_Mesh_i::ExportCGNS(::SMESH::SMESH_IDSource_ptr meshPart,
|
||||
|
||||
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
|
||||
@ -4359,7 +4381,7 @@ void SMESH_Mesh_i::ExportGMF(::SMESH::SMESH_IDSource_ptr meshPart,
|
||||
const char* file,
|
||||
bool withRequiredGroups)
|
||||
{
|
||||
Unexpect aCatch(SALOME_SalomeException);
|
||||
SMESH_TRY;
|
||||
if ( _preMeshInfo )
|
||||
_preMeshInfo->FullLoadFromFile();
|
||||
|
||||
@ -4372,6 +4394,8 @@ void SMESH_Mesh_i::ExportGMF(::SMESH::SMESH_IDSource_ptr meshPart,
|
||||
<< meshPart<< ", r'"
|
||||
<< file << "', "
|
||||
<< withRequiredGroups << ")";
|
||||
|
||||
SMESH_CATCH( SMESH::throwCorbaException );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -5526,7 +5550,7 @@ SMESH::smIdType_array* SMESH_Mesh_i::GetElementsByNodes(const SMESH::smIdType_ar
|
||||
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();
|
||||
|
Loading…
Reference in New Issue
Block a user