bos #24400 [CEA] Option in SALOME for not storing in med files the indices (number of nodes)

+ minor changes:
1) unify member field names: avoid _my*, replace by either _* or my*
2) BUG: mesh persistent ID is not unique
3) arguments alignement
4) Add SMESHDS_Hypothesis::SaveString() and LoadString()
5) In mesh construction dlg disable "Mesh Type" if it contains ANY only
6) Add SMESH::printErrorInDebugMode argument of SMESH_CATCH
7) Use static_assert to check completeness of arrays corresponding to enum
8) Add renumber arg to ExportUNV() and ExportDAT()
9) Fix some warnings
This commit is contained in:
eap 2021-07-22 14:10:49 +03:00
parent ad1d7c52f7
commit 88ff35ddd4
43 changed files with 940 additions and 699 deletions

View File

@ -56,6 +56,8 @@ There are additional parameters available at export to MED and SAUV format files
* **1D**: if all mesh nodes lie on OX coordinate axis. * **1D**: if all mesh nodes lie on OX coordinate axis.
* **2D**: if all mesh nodes lie in XOY coordinate plane. * **2D**: if all mesh nodes lie in XOY coordinate plane.
* :ref:`Save cell/node numbers to MED file <med_export_numbers_pref>` preference controls whether node and cell numbers are saved.
**See Also** a sample TUI Script of an :ref:`Export Mesh <tui_export_mesh>` operation. **See Also** a sample TUI Script of an :ref:`Export Mesh <tui_export_mesh>` operation.

View File

@ -54,6 +54,10 @@ General Preferences
* **Show warning when exporting group** - if activated, a warning is displayed when exporting a group. * **Show warning when exporting group** - if activated, a warning is displayed when exporting a group.
.. _med_export_numbers_pref:
* **Save cell/node numbers to MED file** - if activated, optional node and cell numbers are saved to MED file.
.. _medexport_z_tolerance_pref: .. _medexport_z_tolerance_pref:
* **Z tolerance for MED export** - defines Z tolerance in :ref:`MED Export <export_auto_groups>` dialog. * **Z tolerance for MED export** - defines Z tolerance in :ref:`MED Export <export_auto_groups>` dialog.

View File

@ -657,14 +657,14 @@ module SMESH
* - 3D in the rest cases. * - 3D in the rest cases.
* If @a autoDimension is @c false, the space dimension is always 3. * If @a autoDimension is @c false, the space dimension is always 3.
*/ */
void ExportMED( in string fileName, void ExportMED( in string fileName,
in boolean auto_groups, in boolean auto_groups,
in long version, in long version,
in boolean overwrite, in boolean overwrite,
in boolean autoDimension) raises (SALOME::SALOME_Exception); in boolean autoDimension) raises (SALOME::SALOME_Exception);
long long ExportMEDCoupling(in boolean auto_groups, long long ExportMEDCoupling(in boolean auto_groups,
in boolean autoDimension) raises (SALOME::SALOME_Exception); in boolean autoDimension) raises (SALOME::SALOME_Exception);
/*! /*!
* Export a [part of] Mesh into a MED file * Export a [part of] Mesh into a MED file
@ -693,6 +693,7 @@ module SMESH
* - ZTolerance : tolerance in Z direction. If Z coordinate of a node is close to zero * - ZTolerance : tolerance in Z direction. If Z coordinate of a node is close to zero
* within a given tolerance, the coordinate is set to zero. * within a given tolerance, the coordinate is set to zero.
* If @a ZTolerance is negative, the node coordinates are kept as is. * If @a ZTolerance is negative, the node coordinates are kept as is.
* - saveNumbers : enable saving numbers of nodes and cells.
*/ */
void ExportPartToMED( in SMESH_IDSource meshPart, void ExportPartToMED( in SMESH_IDSource meshPart,
in string fileName, in string fileName,
@ -702,14 +703,16 @@ module SMESH
in boolean autoDimension, in boolean autoDimension,
in GEOM::ListOfFields fields, in GEOM::ListOfFields fields,
in string geomAssocFields, in string geomAssocFields,
in double ZTolerance) raises (SALOME::SALOME_Exception); in double ZTolerance,
in boolean saveNumbers) raises (SALOME::SALOME_Exception);
long long ExportPartToMEDCoupling( in SMESH_IDSource meshPart, long long ExportPartToMEDCoupling( in SMESH_IDSource meshPart,
in boolean auto_groups, in boolean auto_groups,
in boolean autoDimension, in boolean autoDimension,
in GEOM::ListOfFields fields, in GEOM::ListOfFields fields,
in string geomAssocFields, in string geomAssocFields,
in double ZTolerance) raises (SALOME::SALOME_Exception); in double ZTolerance,
in boolean saveNumbers) raises (SALOME::SALOME_Exception);
/*! /*!
* Export Mesh to SAUV formatted file * Export Mesh to SAUV formatted file
@ -733,8 +736,10 @@ module SMESH
* Export Mesh to different Formats * Export Mesh to different Formats
* (UNV supported version is I-DEAS 10) * (UNV supported version is I-DEAS 10)
*/ */
void ExportDAT( in string file ) raises (SALOME::SALOME_Exception); void ExportDAT( in string file,
void ExportUNV( in string file ) raises (SALOME::SALOME_Exception); in boolean renumer) raises (SALOME::SALOME_Exception);
void ExportUNV( in string file,
in boolean renumer ) raises (SALOME::SALOME_Exception);
void ExportSTL( in string file, void ExportSTL( in string file,
in boolean isascii ) raises (SALOME::SALOME_Exception); in boolean isascii ) raises (SALOME::SALOME_Exception);
void ExportCGNS( in SMESH_IDSource meshPart, void ExportCGNS( in SMESH_IDSource meshPart,
@ -745,9 +750,11 @@ module SMESH
in string file, in string file,
in boolean withRequiredGroups) raises (SALOME::SALOME_Exception); in boolean withRequiredGroups) raises (SALOME::SALOME_Exception);
void ExportPartToDAT( in SMESH_IDSource meshPart, void ExportPartToDAT( in SMESH_IDSource meshPart,
in string file ) raises (SALOME::SALOME_Exception); in string file,
in boolean renumer ) raises (SALOME::SALOME_Exception);
void ExportPartToUNV( in SMESH_IDSource meshPart, void ExportPartToUNV( in SMESH_IDSource meshPart,
in string file ) raises (SALOME::SALOME_Exception); in string file,
in boolean renumer ) raises (SALOME::SALOME_Exception);
void ExportPartToSTL( in SMESH_IDSource meshPart, void ExportPartToSTL( in SMESH_IDSource meshPart,
in string file, in string file,
in boolean isascii ) raises (SALOME::SALOME_Exception); in boolean isascii ) raises (SALOME::SALOME_Exception);
@ -1098,7 +1105,7 @@ module SMESH
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
/*! /*!
* Get the internal Id * Get the internal persisten Id
*/ */
long GetId(); long GetId();
}; };

View File

@ -66,6 +66,7 @@
<parameter name="auto_groups" value="false"/> <parameter name="auto_groups" value="false"/>
<parameter name="med_ztolerance" value="0.0"/> <parameter name="med_ztolerance" value="0.0"/>
<parameter name="show_warning" value="true"/> <parameter name="show_warning" value="true"/>
<parameter name="med_save_numbers" value="true"/>
<parameter name="show_result_notification" value="2"/> <parameter name="show_result_notification" value="2"/>
<parameter name="mesh_elem_info" value="1"/> <parameter name="mesh_elem_info" value="1"/>
<parameter name="elem_info_grp_details" value="false"/> <parameter name="elem_info_grp_details" value="false"/>

View File

@ -32,6 +32,14 @@
using namespace std; using namespace std;
//================================================================================
/*!
* \brief Write mesh data to a file
* \param [in] renumber - if true, renumber nodes and cell starting from 1
* \return Driver_Mesh::Status - Ok or not
*/
//================================================================================
Driver_Mesh::Status DriverDAT_W_SMDS_Mesh::Perform() Driver_Mesh::Status DriverDAT_W_SMDS_Mesh::Perform()
{ {
Kernel_Utils::Localizer loc; Kernel_Utils::Localizer loc;
@ -70,21 +78,24 @@ Driver_Mesh::Status DriverDAT_W_SMDS_Mesh::Perform()
SCRUTE(nb_of_volumes); SCRUTE(nb_of_volumes);
//fprintf(stdout, "%d %d\n", nbNodes, nbCells); //fprintf(stdout, "%d %d\n", nbNodes, nbCells);
fprintf(aFileId, "%ld %ld\n", nbNodes, static_cast< long >( nbCells )); fprintf(aFileId, "%ld %ld\n", static_cast< long >( nbNodes ), static_cast< long >( nbCells ));
/**************************************************************************** /****************************************************************************
* ECRITURE DES NOEUDS * * ECRITURE DES NOEUDS *
****************************************************************************/ ****************************************************************************/
std::vector< size_t > nodeNumByID; std::vector< size_t > nodeNumByID;
if ( myMesh->HasNumerationHoles() ) if ( myRenumber && myMesh->HasNumerationHoles() )
nodeNumByID.resize( myMesh->MaxNodeID() + 1 ); nodeNumByID.resize( myMesh->MaxNodeID() + 1 );
int num; smIdType num;
SMDS_NodeIteratorPtr itNodes=myMesh->nodesIterator(); SMDS_NodeIteratorPtr itNodes=myMesh->nodesIterator();
for ( num = 1; itNodes->more(); ++num ) for ( num = 1; itNodes->more(); ++num )
{ {
const SMDS_MeshNode * node = itNodes->next(); const SMDS_MeshNode * node = itNodes->next();
if ( !myRenumber )
num = node->GetID();
fprintf(aFileId, "%d %.14e %.14e %.14e\n", num, node->X(), node->Y(), node->Z()); fprintf(aFileId, "%d %.14e %.14e %.14e\n", num, node->X(), node->Y(), node->Z());
if ( !nodeNumByID.empty() ) if ( !nodeNumByID.empty() )
@ -100,6 +111,9 @@ Driver_Mesh::Status DriverDAT_W_SMDS_Mesh::Perform()
for ( SMDS_EdgeIteratorPtr itEdges = myMesh->edgesIterator(); itEdges->more(); ++num ) for ( SMDS_EdgeIteratorPtr itEdges = myMesh->edgesIterator(); itEdges->more(); ++num )
{ {
const SMDS_MeshElement * elem = itEdges->next(); const SMDS_MeshElement * elem = itEdges->next();
if ( !myRenumber )
num = elem->GetID();
fprintf(aFileId, "%d %d ", num, 100 + elem->NbNodes()); fprintf(aFileId, "%d %d ", num, 100 + elem->NbNodes());
for ( SMDS_ElemIteratorPtr it = elem->nodesIterator(); it->more(); ) for ( SMDS_ElemIteratorPtr it = elem->nodesIterator(); it->more(); )
@ -115,6 +129,8 @@ Driver_Mesh::Status DriverDAT_W_SMDS_Mesh::Perform()
for ( SMDS_FaceIteratorPtr itFaces = myMesh->facesIterator(); itFaces->more(); ++num ) for ( SMDS_FaceIteratorPtr itFaces = myMesh->facesIterator(); itFaces->more(); ++num )
{ {
const SMDS_MeshElement * elem = itFaces->next(); const SMDS_MeshElement * elem = itFaces->next();
if ( !myRenumber )
num = elem->GetID();
fprintf(aFileId, "%d %d ", num, (elem->IsPoly() ? 400 : 200 ) + elem->NbNodes() ); fprintf(aFileId, "%d %d ", num, (elem->IsPoly() ? 400 : 200 ) + elem->NbNodes() );
@ -133,6 +149,9 @@ Driver_Mesh::Status DriverDAT_W_SMDS_Mesh::Perform()
for ( SMDS_VolumeIteratorPtr itVolumes=myMesh->volumesIterator(); itVolumes->more(); ++num ) for ( SMDS_VolumeIteratorPtr itVolumes=myMesh->volumesIterator(); itVolumes->more(); ++num )
{ {
const SMDS_MeshElement * elem = itVolumes->next(); const SMDS_MeshElement * elem = itVolumes->next();
if ( !myRenumber )
num = elem->GetID();
if ( elem->IsPoly() ) if ( elem->IsPoly() )
{ {
fprintf(aFileId, "%d %d ", num, 500 + elem->NbNodes()); fprintf(aFileId, "%d %d ", num, 500 + elem->NbNodes());

View File

@ -34,7 +34,12 @@
class MESHDRIVERDAT_EXPORT DriverDAT_W_SMDS_Mesh: public Driver_SMDS_Mesh class MESHDRIVERDAT_EXPORT DriverDAT_W_SMDS_Mesh: public Driver_SMDS_Mesh
{ {
public: public:
virtual Status Perform(); virtual Status Perform() override;
void SetRenumber( bool renumber ) { myRenumber = renumber; }
private:
bool myRenumber;
}; };
#endif #endif

View File

@ -53,6 +53,12 @@ using namespace std;
using namespace MED; using namespace MED;
//================================================================================
/*!
* \brief Constructor
*/
//================================================================================
DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh(): DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh():
myAllSubMeshes (false), myAllSubMeshes (false),
myDoGroupOfNodes (false), myDoGroupOfNodes (false),
@ -65,19 +71,31 @@ DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh():
myAddODOnVertices(false), myAddODOnVertices(false),
myDoAllInGroups(false), myDoAllInGroups(false),
myVersion(-1), myVersion(-1),
myZTolerance(-1.) myZTolerance(-1.),
mySaveNumbers(true)
{} {}
//================================================================================
/*!
* \brief Set a file name and a version
* \param [in] theFileName - output file name
* \param [in] theVersion - desired MED file version == major * 10 + minor
*/
//================================================================================
void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName, int theVersion) void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName, int theVersion)
{ {
myVersion = theVersion; myVersion = theVersion;
Driver_SMESHDS_Mesh::SetFile(theFileName); Driver_SMESHDS_Mesh::SetFile(theFileName);
} }
//================================================================================
/*! /*!
* MED version is either the latest available, or with an inferior minor, * MED version is either the latest available, or with an inferior minor,
* to ensure backward compatibility on writing med files. * to ensure backward compatibility on writing med files.
*/ */
//================================================================================
string DriverMED_W_SMESHDS_Mesh::GetVersionString(int theMinor, int theNbDigits) string DriverMED_W_SMESHDS_Mesh::GetVersionString(int theMinor, int theNbDigits)
{ {
TInt majeur, mineur, release; TInt majeur, mineur, release;
@ -166,6 +184,12 @@ void DriverMED_W_SMESHDS_Mesh::AddAllToGroup()
namespace namespace
{ {
//---------------------------------------------
/*!
* \brief Retrieving node coordinates utilities
*/
//---------------------------------------------
typedef double (SMDS_MeshNode::* TGetCoord)() const; typedef double (SMDS_MeshNode::* TGetCoord)() const;
typedef const char* TName; typedef const char* TName;
typedef const char* TUnit; typedef const char* TUnit;
@ -344,12 +368,24 @@ namespace
} }
} }
//================================================================================
/*!
* \brief Write my mesh to a file
*/
//================================================================================
Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform() Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
{ {
MED::PWrapper myMed = CrWrapperW(myFile, myVersion); MED::PWrapper myMed = CrWrapperW(myFile, myVersion);
return this->PerformInternal<MED::PWrapper>(myMed); return this->PerformInternal<MED::PWrapper>(myMed);
} }
//================================================================================
/*!
* \brief Write my mesh to a MEDCoupling DS
*/
//================================================================================
Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh_Mem::Perform() Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh_Mem::Perform()
{ {
void *ptr(nullptr); void *ptr(nullptr);
@ -571,7 +607,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::PerformInternal(LowLevelWriter myM
#endif #endif
const EModeSwitch theMode = eFULL_INTERLACE; const EModeSwitch theMode = eFULL_INTERLACE;
const ERepere theSystem = eCART; const ERepere theSystem = eCART;
const EBooleen theIsElemNum = eVRAI; const EBooleen theIsElemNum = mySaveNumbers ? eVRAI : eFAUX;
const EBooleen theIsElemNames = eFAUX; const EBooleen theIsElemNames = eFAUX;
const EConnectivite theConnMode = eNOD; const EConnectivite theConnMode = eNOD;

View File

@ -42,6 +42,9 @@ class SMESHDS_GroupBase;
class SMESHDS_SubMesh; class SMESHDS_SubMesh;
class SMDS_MeshElement; class SMDS_MeshElement;
/*!
* \brief Write a mesh to a MED file
*/
class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
{ {
public: public:
@ -51,6 +54,7 @@ class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
void SetFile(const std::string& theFileName, int theVersion=-1); void SetFile(const std::string& theFileName, int theVersion=-1);
void SetAutoDimension(bool toFindOutDimension) { myAutoDimension = toFindOutDimension; } void SetAutoDimension(bool toFindOutDimension) { myAutoDimension = toFindOutDimension; }
void SetZTolerance(double tol) { myZTolerance = tol; } void SetZTolerance(double tol) { myZTolerance = tol; }
void SetSaveNumbers(bool toSave) { mySaveNumbers = toSave; }
static std::string GetVersionString(int theMinor, int theNbDigits=2); static std::string GetVersionString(int theMinor, int theNbDigits=2);
@ -82,23 +86,27 @@ class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
private: private:
std::list<SMESHDS_GroupBase*> myGroups; std::list<SMESHDS_GroupBase*> myGroups;
bool myAllSubMeshes; bool myAllSubMeshes;
std::vector<SMESHDS_SubMesh*> mySubMeshes; std::vector<SMESHDS_SubMesh*> mySubMeshes;
bool myDoGroupOfNodes; bool myDoGroupOfNodes;
bool myDoGroupOfEdges; bool myDoGroupOfEdges;
bool myDoGroupOfFaces; bool myDoGroupOfFaces;
bool myDoGroupOfVolumes; bool myDoGroupOfVolumes;
bool myDoGroupOf0DElems; bool myDoGroupOf0DElems;
bool myDoGroupOfBalls; bool myDoGroupOfBalls;
bool myAutoDimension; bool myAutoDimension;
bool myAddODOnVertices; bool myAddODOnVertices;
bool myDoAllInGroups; bool myDoAllInGroups;
int myVersion; int myVersion;
double myZTolerance; double myZTolerance;
bool mySaveNumbers;
}; };
#include "MEDCouplingMemArray.hxx" #include "MEDCouplingMemArray.hxx"
/*!
* \brief Write a mesh to a MEDCoupling DS
*/
class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh_Mem : public DriverMED_W_SMESHDS_Mesh class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh_Mem : public DriverMED_W_SMESHDS_Mesh
{ {
public: public:

View File

@ -55,13 +55,13 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
#else #else
std::ofstream out_stream(myFile.c_str()); std::ofstream out_stream(myFile.c_str());
#endif #endif
try{ try
{
UNV164::Write( out_stream ); // unit system UNV164::Write( out_stream ); // unit system
UNV2420::Write( out_stream, myMeshName ); // Coordinate system UNV2420::Write( out_stream, myMeshName ); // Coordinate system
std::vector< size_t > nodeLabelByID; std::vector< size_t > nodeLabelByID;
if ( myMesh->HasNumerationHoles() ) if ( myMesh->HasNumerationHoles() && myRenumber )
nodeLabelByID.resize( myMesh->MaxNodeID() + 1 ); nodeLabelByID.resize( myMesh->MaxNodeID() + 1 );
{ {
@ -75,7 +75,8 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
for ( aRec.label = 1; aNodesIter->more(); ++aRec.label ) for ( aRec.label = 1; aNodesIter->more(); ++aRec.label )
{ {
const SMDS_MeshNode* aNode = aNodesIter->next(); const SMDS_MeshNode* aNode = aNodesIter->next();
// aRec.label = aNode->GetID(); -- IPAL54452 if ( !myRenumber )
aRec.label = aNode->GetID(); //-- IPAL54452
if ( !nodeLabelByID.empty() ) if ( !nodeLabelByID.empty() )
nodeLabelByID[ aNode->GetID() ] = aRec.label; nodeLabelByID[ aNode->GetID() ] = aRec.label;
aRec.coord[0] = aNode->X(); aRec.coord[0] = aNode->X();
@ -105,8 +106,10 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
while ( anIter->more() ) while ( anIter->more() )
{ {
const SMDS_MeshEdge* anElem = anIter->next(); const SMDS_MeshEdge* anElem = anIter->next();
// aRec.label = anElem->GetID(); -- IPAL54452 if ( myRenumber ) // -- IPAL54452
++aRec.label; ++aRec.label;
else
aRec.label = anElem->GetID();
if ( !elemLabelByID.empty() ) if ( !elemLabelByID.empty() )
elemLabelByID[ anElem->GetID() ] = aRec.label; elemLabelByID[ anElem->GetID() ] = aRec.label;
@ -138,7 +141,8 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
if ( anElem->IsPoly() ) continue; if ( anElem->IsPoly() ) continue;
SMDS_NodeIteratorPtr aNodesIter = anElem->nodesIteratorToUNV(); SMDS_NodeIteratorPtr aNodesIter = anElem->nodesIteratorToUNV();
for ( aRec.node_labels.clear(); aNodesIter->more(); ) { for ( aRec.node_labels.clear(); aNodesIter->more(); )
{
const SMDS_MeshNode* aNode = aNodesIter->next(); const SMDS_MeshNode* aNode = aNodesIter->next();
if ( nodeLabelByID.empty() ) if ( nodeLabelByID.empty() )
aRec.node_labels.push_back( FromSmIdType<int>(aNode->GetID()) ); aRec.node_labels.push_back( FromSmIdType<int>(aNode->GetID()) );
@ -155,8 +159,10 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
default: default:
continue; continue;
} }
// aRec.label = anElem->GetID(); -- IPAL54452 if ( myRenumber )
++aRec.label; ++aRec.label;
else
aRec.label = anElem->GetID(); // -- IPAL54452
if ( !elemLabelByID.empty() ) if ( !elemLabelByID.empty() )
elemLabelByID[ anElem->GetID() ] = aRec.label; elemLabelByID[ anElem->GetID() ] = aRec.label;
@ -188,8 +194,10 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
default: default:
continue; continue;
} }
// aRec.label = anElem->GetID(); -- IPAL54452 if ( myRenumber )
++aRec.label; ++aRec.label; // -- IPAL54452
else
aRec.label = anElem->GetID();
if ( !elemLabelByID.empty() ) if ( !elemLabelByID.empty() )
elemLabelByID[ anElem->GetID() ] = aRec.label; elemLabelByID[ anElem->GetID() ] = aRec.label;
@ -214,7 +222,8 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
// -------------------- // --------------------
{ {
using namespace UNV2417; using namespace UNV2417;
if ( myGroups.size() > 0 ) { if ( myGroups.size() > 0 )
{
TRecord aRec; TRecord aRec;
TDataSet aDataSet2417; TDataSet aDataSet2417;
TGroupList::const_iterator aIter = myGroups.begin(); TGroupList::const_iterator aIter = myGroups.begin();
@ -230,7 +239,7 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
while ( aIter->more() ) { while ( aIter->more() ) {
const SMDS_MeshElement* aNode = aIter->next(); const SMDS_MeshElement* aNode = aIter->next();
if ( nodeLabelByID.empty() ) if ( nodeLabelByID.empty() )
aRec.NodeList.push_back( FromSmIdType<int>(aNode->GetID()) ); aRec.NodeList.push_back( FromSmIdType<int>( aNode->GetID()) );
else else
aRec.NodeList.push_back( nodeLabelByID[ aNode->GetID() ]); aRec.NodeList.push_back( nodeLabelByID[ aNode->GetID() ]);
} }

View File

@ -39,9 +39,11 @@ class MESHDRIVERUNV_EXPORT DriverUNV_W_SMDS_Mesh: public Driver_SMDS_Mesh
virtual Status Perform() override; virtual Status Perform() override;
void AddGroup(SMESHDS_GroupBase* theGroup) { myGroups.push_back(theGroup); } void AddGroup(SMESHDS_GroupBase* theGroup) { myGroups.push_back(theGroup); }
void SetRenumber( bool renumber ) { myRenumber = renumber; }
private: private:
TGroupList myGroups; TGroupList myGroups;
bool myRenumber;
}; };

View File

@ -197,12 +197,12 @@ namespace MED
med_int wantedMajor = MED_MAJOR_NUM; med_int wantedMajor = MED_MAJOR_NUM;
med_int wantedMinor = MED_MINOR_NUM; med_int wantedMinor = MED_MINOR_NUM;
// when non managed version of file is requested : ignore it and take the latest version // when non managed version of file is requested : ignore it and take the latest version
std::vector<int> versionsOK(GetMEDVersionsAppendCompatible()); std::vector<int> versionsOK = GetMEDVersionsAppendCompatible();
bool isVersionRequestedOK(std::find(versionsOK.begin(),versionsOK.end(),theVersion)!=versionsOK.end()); bool isVersionRequestedOK = std::find(versionsOK.begin(),versionsOK.end(),theVersion)!=versionsOK.end();
if (isCreated && isVersionRequestedOK) if (isCreated && isVersionRequestedOK)
{ {
wantedMajor = theVersion/10; wantedMajor = theVersion / 10;
wantedMinor = theVersion%10; wantedMinor = theVersion % 10;
} }
return new MED::TWrapper(fileName, true, tfileInst, wantedMajor, wantedMinor); return new MED::TWrapper(fileName, true, tfileInst, wantedMajor, wantedMinor);
} }

View File

@ -141,7 +141,8 @@ namespace MED
TElemInfo TElemInfo
::SetElemNum(TInt theId, TInt theVal) ::SetElemNum(TInt theId, TInt theVal)
{ {
(*myElemNum)[theId] = theVal; if ( IsElemNum() )
(*myElemNum)[theId] = theVal;
} }
//--------------------------------------------------------------- //---------------------------------------------------------------

View File

@ -204,10 +204,10 @@ namespace MED
} }
} }
TTFamilyInfo(const PMeshInfo& theMeshInfo, TTFamilyInfo(const PMeshInfo& theMeshInfo,
TInt theNbGroup, TInt theNbGroup,
TInt theNbAttr, TInt theNbAttr,
TInt theId, TInt theId,
const std::string& theValue): const std::string& theValue):
TNameInfoBase(theValue) TNameInfoBase(theValue)
{ {
@ -224,13 +224,13 @@ namespace MED
myAttrDesc.resize(theNbAttr*GetDESCLength()+1); myAttrDesc.resize(theNbAttr*GetDESCLength()+1);
} }
TTFamilyInfo(const PMeshInfo& theMeshInfo, TTFamilyInfo(const PMeshInfo& theMeshInfo,
const std::string& theValue, const std::string& theValue,
TInt theId, TInt theId,
const TStringSet& theGroupNames, const TStringSet& theGroupNames,
const TStringVector& theAttrDescs, const TStringVector& theAttrDescs,
const TIntVector& theAttrIds, const TIntVector& theAttrIds,
const TIntVector& theAttrVals): const TIntVector& theAttrVals):
TNameInfoBase(theValue) TNameInfoBase(theValue)
{ {
myMeshInfo = theMeshInfo; myMeshInfo = theMeshInfo;
@ -330,9 +330,9 @@ namespace MED
} }
TTElemInfo(const PMeshInfo& theMeshInfo, TTElemInfo(const PMeshInfo& theMeshInfo,
TInt theNbElem, TInt theNbElem,
EBooleen theIsElemNum, EBooleen theIsElemNum,
EBooleen theIsElemNames) EBooleen theIsElemNames)
{ {
myMeshInfo = theMeshInfo; myMeshInfo = theMeshInfo;
@ -351,12 +351,12 @@ namespace MED
myElemNames.reset(new TString(theNbElem*GetPNOMLength() + 1)); myElemNames.reset(new TString(theNbElem*GetPNOMLength() + 1));
else else
myElemNames.reset(new TString()); myElemNames.reset(new TString());
} }
TTElemInfo(const PMeshInfo& theMeshInfo, TTElemInfo(const PMeshInfo& theMeshInfo,
TInt theNbElem, TInt theNbElem,
const TIntVector& theFamilyNums, const TIntVector& theFamilyNums,
const TIntVector& theElemNums, const TIntVector& theElemNums,
const TStringVector& theElemNames) const TStringVector& theElemNames)
{ {
myMeshInfo = theMeshInfo; myMeshInfo = theMeshInfo;
@ -684,14 +684,14 @@ namespace MED
} }
} }
TTCellInfo(const PMeshInfo& theMeshInfo, TTCellInfo(const PMeshInfo& theMeshInfo,
EEntiteMaillage theEntity, EEntiteMaillage theEntity,
EGeometrieElement theGeom, EGeometrieElement theGeom,
TInt theNbElem, TInt theNbElem,
EConnectivite theConnMode, EConnectivite theConnMode,
EBooleen theIsElemNum, EBooleen theIsElemNum,
EBooleen theIsElemNames, EBooleen theIsElemNames,
EModeSwitch theMode): EModeSwitch theMode):
TModeSwitchInfo(theMode), TModeSwitchInfo(theMode),
TElemInfoBase(theMeshInfo, TElemInfoBase(theMeshInfo,
theNbElem, theNbElem,
@ -706,15 +706,15 @@ namespace MED
myConn.reset(new TElemNum(theNbElem * aNbConn)); myConn.reset(new TElemNum(theNbElem * aNbConn));
} }
TTCellInfo(const PMeshInfo& theMeshInfo, TTCellInfo(const PMeshInfo& theMeshInfo,
EEntiteMaillage theEntity, EEntiteMaillage theEntity,
EGeometrieElement theGeom, EGeometrieElement theGeom,
const TIntVector& theConnectivities, const TIntVector& theConnectivities,
EConnectivite theConnMode, EConnectivite theConnMode,
const TIntVector& theFamilyNums, const TIntVector& theFamilyNums,
const TIntVector& theElemNums, const TIntVector& theElemNums,
const TStringVector& theElemNames, const TStringVector& theElemNames,
EModeSwitch theMode): EModeSwitch theMode):
TModeSwitchInfo(theMode), TModeSwitchInfo(theMode),
TElemInfoBase(theMeshInfo, TElemInfoBase(theMeshInfo,
(TInt)theConnectivities.size() / GetNbNodes(theGeom), (TInt)theConnectivities.size() / GetNbNodes(theGeom),
@ -832,12 +832,12 @@ namespace MED
myNbRef = theInfo->GetNbRef(); myNbRef = theInfo->GetNbRef();
} }
TTFieldInfo(const PMeshInfo& theMeshInfo, TTFieldInfo(const PMeshInfo& theMeshInfo,
TInt theNbComp, TInt theNbComp,
ETypeChamp theType, ETypeChamp theType,
const std::string& theValue, const std::string& theValue,
EBooleen theIsLocal, EBooleen theIsLocal,
TInt theNbRef): TInt theNbRef):
TNameInfoBase(theValue) TNameInfoBase(theValue)
{ {
myMeshInfo = theMeshInfo; myMeshInfo = theMeshInfo;
@ -925,15 +925,15 @@ namespace MED
myGeom2Gauss = theInfo->GetGeom2Gauss(); myGeom2Gauss = theInfo->GetGeom2Gauss();
} }
TTTimeStampInfo(const PFieldInfo& theFieldInfo, TTTimeStampInfo(const PFieldInfo& theFieldInfo,
EEntiteMaillage theEntity, EEntiteMaillage theEntity,
const TGeom2Size& theGeom2Size, const TGeom2Size& theGeom2Size,
const TGeom2NbGauss& theGeom2NbGauss, const TGeom2NbGauss& theGeom2NbGauss,
TInt theNumDt, TInt theNumDt,
TInt /*theNumOrd*/, TInt /*theNumOrd*/,
TFloat theDt, TFloat theDt,
const std::string& theUnitDt, const std::string& theUnitDt,
const TGeom2Gauss& theGeom2Gauss) const TGeom2Gauss& theGeom2Gauss)
{ {
myFieldInfo = theFieldInfo; myFieldInfo = theFieldInfo;
@ -974,7 +974,7 @@ namespace MED
typedef TTNameInfo TNameInfoBase; typedef TTNameInfo TNameInfoBase;
TTProfileInfo(const TProfileInfo::TInfo& theInfo, TTProfileInfo(const TProfileInfo::TInfo& theInfo,
EModeProfil theMode): EModeProfil theMode):
TNameInfoBase(boost::get<0>(theInfo)) TNameInfoBase(boost::get<0>(theInfo))
{ {
TInt aSize = boost::get<1>(theInfo); TInt aSize = boost::get<1>(theInfo);
@ -987,9 +987,9 @@ namespace MED
template<class TMeshValueType> template<class TMeshValueType>
struct TTTimeStampValue: virtual TTimeStampValue<TMeshValueType> struct TTTimeStampValue: virtual TTimeStampValue<TMeshValueType>
{ {
TTTimeStampValue(const PTimeStampInfo& theTimeStampInfo, TTTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
const PTimeStampValueBase& theInfo, const PTimeStampValueBase& theInfo,
ETypeChamp theTypeChamp) ETypeChamp theTypeChamp)
{ {
typedef TTimeStampValue<TMeshValueType> TCompatible; typedef TTimeStampValue<TMeshValueType> TCompatible;
if(TCompatible* aCompatible = dynamic_cast<TCompatible*>(theInfo.get())){ if(TCompatible* aCompatible = dynamic_cast<TCompatible*>(theInfo.get())){
@ -1003,9 +1003,9 @@ namespace MED
} }
TTTimeStampValue(const PTimeStampInfo& theTimeStampInfo, TTTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
ETypeChamp theTypeChamp, ETypeChamp theTypeChamp,
const TGeom2Profile& theGeom2Profile, const TGeom2Profile& theGeom2Profile,
EModeSwitch theMode): EModeSwitch theMode):
TModeSwitchInfo(theMode) TModeSwitchInfo(theMode)
{ {
this->myTimeStampInfo = theTimeStampInfo; this->myTimeStampInfo = theTimeStampInfo;
@ -1060,10 +1060,10 @@ namespace MED
virtual virtual
void void
AllocateValue(EGeometrieElement theGeom, AllocateValue(EGeometrieElement theGeom,
TInt theNbElem, TInt theNbElem,
TInt theNbGauss, TInt theNbGauss,
TInt theNbComp, TInt theNbComp,
EModeSwitch theMode = eFULL_INTERLACE) EModeSwitch theMode = eFULL_INTERLACE)
{ {
this->GetMeshValue(theGeom).Allocate(theNbElem,theNbGauss,theNbComp,theMode); this->GetMeshValue(theGeom).Allocate(theNbElem,theNbGauss,theNbComp,theMode);
} }
@ -1080,7 +1080,7 @@ namespace MED
struct TTGrilleInfo: struct TTGrilleInfo:
virtual TGrilleInfo virtual TGrilleInfo
{ {
TTGrilleInfo(const PMeshInfo& theMeshInfo, TTGrilleInfo(const PMeshInfo& theMeshInfo,
const PGrilleInfo& theInfo) const PGrilleInfo& theInfo)
{ {
myMeshInfo = theMeshInfo; myMeshInfo = theMeshInfo;
@ -1105,9 +1105,9 @@ namespace MED
myFamNum = theInfo->myFamNum; myFamNum = theInfo->myFamNum;
} }
TTGrilleInfo(const PMeshInfo& theMeshInfo, TTGrilleInfo(const PMeshInfo& theMeshInfo,
const EGrilleType& type, const EGrilleType& type,
const TInt nnoeuds) const TInt nnoeuds)
{ {
myMeshInfo = theMeshInfo; myMeshInfo = theMeshInfo;
TInt aSpaceDim = theMeshInfo->GetSpaceDim(); TInt aSpaceDim = theMeshInfo->GetSpaceDim();
@ -1123,7 +1123,7 @@ namespace MED
myFamNumNode.resize(nnoeuds); myFamNumNode.resize(nnoeuds);
} }
TTGrilleInfo(const PMeshInfo& theMeshInfo, TTGrilleInfo(const PMeshInfo& theMeshInfo,
const EGrilleType& type) const EGrilleType& type)
{ {
myMeshInfo = theMeshInfo; myMeshInfo = theMeshInfo;
@ -1138,8 +1138,8 @@ namespace MED
myGrilleStructure.resize(aSpaceDim); myGrilleStructure.resize(aSpaceDim);
} }
TTGrilleInfo(const PMeshInfo& theMeshInfo, TTGrilleInfo(const PMeshInfo& theMeshInfo,
const EGrilleType& type, const EGrilleType& type,
const MED::TIntVector& nbNodeVec) const MED::TIntVector& nbNodeVec)
{ {
myMeshInfo = theMeshInfo; myMeshInfo = theMeshInfo;

View File

@ -147,9 +147,9 @@ namespace MED
public: public:
TFileWrapper(const PFileInternal& theFile, TFileWrapper(const PFileInternal& theFile,
EModeAcces theMode, EModeAcces theMode,
TErr* theErr = NULL, TErr* theErr = NULL,
TInt theMinor=-1): TInt theMinor=-1):
myFile(theFile), myFile(theFile),
myMinor(theMinor) myMinor(theMinor)
{ {
@ -242,9 +242,9 @@ namespace MED
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
TWrapper TWrapper
::GetMeshInfo(TInt theMeshId, ::GetMeshInfo(TInt theMeshId,
MED::TMeshInfo& theInfo, MED::TMeshInfo& theInfo,
TErr* theErr) TErr* theErr)
{ {
TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor); TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
@ -285,7 +285,7 @@ namespace MED
void void
TWrapper TWrapper
::SetMeshInfo(const MED::TMeshInfo& theInfo, ::SetMeshInfo(const MED::TMeshInfo& theInfo,
TErr* theErr) TErr* theErr)
{ {
TErr aRet; TErr aRet;
SetMeshInfo(theInfo, eLECTURE_ECRITURE, &aRet); SetMeshInfo(theInfo, eLECTURE_ECRITURE, &aRet);
@ -304,8 +304,8 @@ namespace MED
void void
TWrapper TWrapper
::SetMeshInfo(const MED::TMeshInfo& theInfo, ::SetMeshInfo(const MED::TMeshInfo& theInfo,
EModeAcces theMode, EModeAcces theMode,
TErr* theErr) TErr* theErr)
{ {
TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor); TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
@ -352,10 +352,10 @@ namespace MED
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
PMeshInfo PMeshInfo
TWrapper TWrapper
::CrMeshInfo(TInt theDim, ::CrMeshInfo(TInt theDim,
TInt theSpaceDim, TInt theSpaceDim,
const std::string& theValue, const std::string& theValue,
EMaillage theType, EMaillage theType,
const std::string& theDesc) const std::string& theDesc)
{ {
return PMeshInfo(new TTMeshInfo return PMeshInfo(new TTMeshInfo
@ -377,7 +377,7 @@ namespace MED
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
PMeshInfo PMeshInfo
TWrapper TWrapper
::GetPMeshInfo(TInt theId, ::GetPMeshInfo(TInt theId,
TErr* theErr) TErr* theErr)
{ {
PMeshInfo anInfo = CrMeshInfo(); PMeshInfo anInfo = CrMeshInfo();
@ -389,7 +389,7 @@ namespace MED
TInt TInt
TWrapper TWrapper
::GetNbFamilies(const MED::TMeshInfo& theInfo, ::GetNbFamilies(const MED::TMeshInfo& theInfo,
TErr* theErr) TErr* theErr)
{ {
TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor); TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
@ -404,9 +404,9 @@ namespace MED
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
TInt TInt
TWrapper TWrapper
::GetNbFamAttr(TInt theFamId, ::GetNbFamAttr(TInt theFamId,
const MED::TMeshInfo& theInfo, const MED::TMeshInfo& theInfo,
TErr* theErr) TErr* theErr)
{ {
TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor); TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
@ -423,9 +423,9 @@ namespace MED
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
TInt TInt
TWrapper TWrapper
::GetNbFamGroup(TInt theFamId, ::GetNbFamGroup(TInt theFamId,
const MED::TMeshInfo& theInfo, const MED::TMeshInfo& theInfo,
TErr* theErr) TErr* theErr)
{ {
TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor); TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
@ -442,9 +442,9 @@ namespace MED
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
TWrapper TWrapper
::GetFamilyInfo(TInt theFamId, ::GetFamilyInfo(TInt theFamId,
MED::TFamilyInfo& theInfo, MED::TFamilyInfo& theInfo,
TErr* theErr) TErr* theErr)
{ {
TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor); TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
@ -485,7 +485,7 @@ namespace MED
void void
TWrapper TWrapper
::SetFamilyInfo(const MED::TFamilyInfo& theInfo, ::SetFamilyInfo(const MED::TFamilyInfo& theInfo,
TErr* theErr) TErr* theErr)
{ {
TErr aRet; TErr aRet;
SetFamilyInfo(theInfo, eLECTURE_ECRITURE, &aRet); SetFamilyInfo(theInfo, eLECTURE_ECRITURE, &aRet);
@ -501,8 +501,8 @@ namespace MED
void void
TWrapper TWrapper
::SetFamilyInfo(const MED::TFamilyInfo& theInfo, ::SetFamilyInfo(const MED::TFamilyInfo& theInfo,
EModeAcces theMode, EModeAcces theMode,
TErr* theErr) TErr* theErr)
{ {
TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor); TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
@ -540,10 +540,10 @@ namespace MED
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
PFamilyInfo PFamilyInfo
TWrapper TWrapper
::CrFamilyInfo(const PMeshInfo& theMeshInfo, ::CrFamilyInfo(const PMeshInfo& theMeshInfo,
TInt theNbGroup, TInt theNbGroup,
TInt theNbAttr, TInt theNbAttr,
TInt theId, TInt theId,
const std::string& theValue) const std::string& theValue)
{ {
return PFamilyInfo(new TTFamilyInfo return PFamilyInfo(new TTFamilyInfo
@ -557,13 +557,13 @@ namespace MED
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
PFamilyInfo PFamilyInfo
TWrapper TWrapper
::CrFamilyInfo(const PMeshInfo& theMeshInfo, ::CrFamilyInfo(const PMeshInfo& theMeshInfo,
const std::string& theValue, const std::string& theValue,
TInt theId, TInt theId,
const MED::TStringSet& theGroupNames, const MED::TStringSet& theGroupNames,
const MED::TStringVector& theAttrDescs, const MED::TStringVector& theAttrDescs,
const MED::TIntVector& theAttrIds, const MED::TIntVector& theAttrIds,
const MED::TIntVector& theAttrVals) const MED::TIntVector& theAttrVals)
{ {
return PFamilyInfo(new TTFamilyInfo return PFamilyInfo(new TTFamilyInfo
(theMeshInfo, (theMeshInfo,
@ -578,7 +578,7 @@ namespace MED
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
PFamilyInfo PFamilyInfo
TWrapper TWrapper
::CrFamilyInfo(const PMeshInfo& theMeshInfo, ::CrFamilyInfo(const PMeshInfo& theMeshInfo,
const PFamilyInfo& theInfo) const PFamilyInfo& theInfo)
{ {
return PFamilyInfo(new TTFamilyInfo return PFamilyInfo(new TTFamilyInfo
@ -590,8 +590,8 @@ namespace MED
PFamilyInfo PFamilyInfo
TWrapper TWrapper
::GetPFamilyInfo(const PMeshInfo& theMeshInfo, ::GetPFamilyInfo(const PMeshInfo& theMeshInfo,
TInt theId, TInt theId,
TErr* theErr) TErr* theErr)
{ {
// must be reimplemented in connection with mesh type eSTRUCTURE // must be reimplemented in connection with mesh type eSTRUCTURE
// if (theMeshInfo->GetType() != eNON_STRUCTURE) // if (theMeshInfo->GetType() != eNON_STRUCTURE)
@ -620,11 +620,11 @@ namespace MED
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
TWrapper TWrapper
::GetNames(TElemInfo& theInfo, ::GetNames(TElemInfo& theInfo,
TInt /*theNb*/, TInt /*theNb*/,
EEntiteMaillage theEntity, EEntiteMaillage theEntity,
EGeometrieElement theGeom, EGeometrieElement theGeom,
TErr* theErr) TErr* theErr)
{ {
TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor); TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
@ -658,10 +658,10 @@ namespace MED
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
TWrapper TWrapper
::SetNames(const TElemInfo& theInfo, ::SetNames(const TElemInfo& theInfo,
EEntiteMaillage theEntity, EEntiteMaillage theEntity,
EGeometrieElement theGeom, EGeometrieElement theGeom,
TErr* theErr) TErr* theErr)
{ {
SetNames(theInfo, eLECTURE_ECRITURE, theEntity, theGeom, theErr); SetNames(theInfo, eLECTURE_ECRITURE, theEntity, theGeom, theErr);
} }
@ -669,11 +669,11 @@ namespace MED
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
TWrapper TWrapper
::SetNames(const TElemInfo& theInfo, ::SetNames(const TElemInfo& theInfo,
EModeAcces theMode, EModeAcces theMode,
EEntiteMaillage theEntity, EEntiteMaillage theEntity,
EGeometrieElement theGeom, EGeometrieElement theGeom,
TErr* theErr) TErr* theErr)
{ {
TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor); TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
@ -698,7 +698,7 @@ namespace MED
MED_NO_DT, MED_NO_DT,
MED_NO_IT, MED_NO_IT,
anEntity, anEntity,
aGeom, aGeom,
(TInt)anInfo.myElemNames->size(), (TInt)anInfo.myElemNames->size(),
&anElemNames); &anElemNames);
if (theErr) if (theErr)
@ -711,11 +711,11 @@ namespace MED
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
TWrapper TWrapper
::GetNumeration(TElemInfo& theInfo, ::GetNumeration(TElemInfo& theInfo,
TInt /*theNb*/, TInt /*theNb*/,
EEntiteMaillage theEntity, EEntiteMaillage theEntity,
EGeometrieElement theGeom, EGeometrieElement theGeom,
TErr* theErr) TErr* theErr)
{ {
TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor); TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
@ -749,10 +749,10 @@ namespace MED
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
TWrapper TWrapper
::SetNumeration(const TElemInfo& theInfo, ::SetNumeration(const TElemInfo& theInfo,
EEntiteMaillage theEntity, EEntiteMaillage theEntity,
EGeometrieElement theGeom, EGeometrieElement theGeom,
TErr* theErr) TErr* theErr)
{ {
SetNumeration(theInfo, eLECTURE_ECRITURE, theEntity, theGeom, theErr); SetNumeration(theInfo, eLECTURE_ECRITURE, theEntity, theGeom, theErr);
} }
@ -760,11 +760,11 @@ namespace MED
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
TWrapper TWrapper
::SetNumeration(const TElemInfo& theInfo, ::SetNumeration(const TElemInfo& theInfo,
EModeAcces theMode, EModeAcces theMode,
EEntiteMaillage theEntity, EEntiteMaillage theEntity,
EGeometrieElement theGeom, EGeometrieElement theGeom,
TErr* theErr) TErr* theErr)
{ {
TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor); TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
@ -802,11 +802,11 @@ namespace MED
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
TWrapper TWrapper
::GetFamilies(TElemInfo& theInfo, ::GetFamilies(TElemInfo& theInfo,
TInt /*theNb*/, TInt /*theNb*/,
EEntiteMaillage theEntity, EEntiteMaillage theEntity,
EGeometrieElement theGeom, EGeometrieElement theGeom,
TErr* theErr) TErr* theErr)
{ {
TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor); TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
@ -849,10 +849,10 @@ namespace MED
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
TWrapper TWrapper
::SetFamilies(const TElemInfo& theInfo, ::SetFamilies(const TElemInfo& theInfo,
EEntiteMaillage theEntity, EEntiteMaillage theEntity,
EGeometrieElement theGeom, EGeometrieElement theGeom,
TErr* theErr) TErr* theErr)
{ {
SetFamilies(theInfo, eLECTURE_ECRITURE, theEntity, theGeom, theErr); SetFamilies(theInfo, eLECTURE_ECRITURE, theEntity, theGeom, theErr);
} }
@ -860,11 +860,11 @@ namespace MED
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
TWrapper TWrapper
::SetFamilies(const TElemInfo& theInfo, ::SetFamilies(const TElemInfo& theInfo,
EModeAcces theMode, EModeAcces theMode,
EEntiteMaillage theEntity, EEntiteMaillage theEntity,
EGeometrieElement theGeom, EGeometrieElement theGeom,
TErr* theErr) TErr* theErr)
{ {
TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor); TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
@ -901,7 +901,7 @@ namespace MED
TInt TInt
TWrapper TWrapper
::GetNbNodes(const MED::TMeshInfo& theMeshInfo, ::GetNbNodes(const MED::TMeshInfo& theMeshInfo,
TErr* theErr) TErr* theErr)
{ {
return GetNbNodes(theMeshInfo, eCOOR, theErr); return GetNbNodes(theMeshInfo, eCOOR, theErr);
} }
@ -2208,14 +2208,14 @@ namespace MED
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
PCellInfo PCellInfo
TWrapper TWrapper
::CrCellInfo(const PMeshInfo& theMeshInfo, ::CrCellInfo(const PMeshInfo& theMeshInfo,
EEntiteMaillage theEntity, EEntiteMaillage theEntity,
EGeometrieElement theGeom, EGeometrieElement theGeom,
TInt theNbElem, TInt theNbElem,
EConnectivite theConnMode, EConnectivite theConnMode,
EBooleen theIsElemNum, EBooleen theIsElemNum,
EBooleen theIsElemNames, EBooleen theIsElemNames,
EModeSwitch theMode) EModeSwitch theMode)
{ {
return PCellInfo(new TTCellInfo return PCellInfo(new TTCellInfo
(theMeshInfo, (theMeshInfo,

View File

@ -47,7 +47,8 @@
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <boost/make_shared.hpp> //#include <boost/make_shared.hpp>
#include <boost/container/flat_set.hpp>
#if !defined WIN32 && !defined __APPLE__ #if !defined WIN32 && !defined __APPLE__
#include <sys/sysinfo.h> #include <sys/sysinfo.h>
@ -1063,16 +1064,27 @@ bool SMDS_Mesh::ChangePolyhedronNodes(const SMDS_MeshElement * e
// keep current nodes of element // keep current nodes of element
std::set<const SMDS_MeshNode*> oldNodes( element->begin_nodes(), element->end_nodes() ); std::set<const SMDS_MeshNode*> oldNodes( element->begin_nodes(), element->end_nodes() );
// change nodes
bool Ok = false; bool Ok = false;
// change vtkUnstructuredGrid::Faces
if ( const SMDS_MeshVolume* vol = DownCast<SMDS_MeshVolume>( element )) if ( const SMDS_MeshVolume* vol = DownCast<SMDS_MeshVolume>( element ))
Ok = vol->ChangeNodes( nodes, quantities ); Ok = vol->ChangeNodes( nodes, quantities );
// change vtkUnstructuredGrid::Connectivity and inverse connectivity
if ( Ok ) if ( Ok )
{ if ( SMDS_MeshCell* cell = dynamic_cast<SMDS_MeshCell*>((SMDS_MeshElement*) element))
setMyModified(); {
updateInverseElements( element, &nodes[0], nodes.size(), oldNodes ); boost::container::flat_set< const SMDS_MeshNode* > uniqueNodes( nodes.begin(), nodes.end() );
} const SMDS_MeshNode** nodesPtr = &( *uniqueNodes.begin());
const int nbNodes = (int) uniqueNodes.size();
Ok = cell->ChangeNodes( nodesPtr, nbNodes );
if ( Ok )
{
updateInverseElements( element, nodesPtr, nbNodes, oldNodes );
setMyModified();
}
}
return Ok; return Ok;
} }

View File

@ -1533,18 +1533,18 @@ void MgAdapt::buildBackGroundMeshAndSolFiles(const std::vector<std::string>& fie
} }
MgAdapt::Status MgAdapt::addMessage(const std::string& msg, MgAdapt::Status MgAdapt::addMessage(const std::string& msg,
const bool isFatal/*=false*/) const bool isFatal/*=false*/)
{ {
if ( isFatal ) if ( isFatal )
_myErrorMessages.clear(); // warnings are useless if a fatal error encounters _errorMessages.clear(); // warnings are useless if a fatal error encounters
_myErrorMessages.push_back( msg ); _errorMessages.push_back( msg );
//~MESSAGE(msg); //~MESSAGE(msg);
#ifdef _DEBUG_ #ifdef _DEBUG_
std::cout << msg << std::endl; std::cout << msg << std::endl;
#endif #endif
return ( _myStatus = isFatal ? MgAdapt::DRS_FAIL : MgAdapt::DRS_WARN_SKIP_ELEM ); return ( _status = isFatal ? MgAdapt::DRS_FAIL : MgAdapt::DRS_WARN_SKIP_ELEM );
} }
void MgAdapt::updateTimeStepRank() void MgAdapt::updateTimeStepRank()

View File

@ -243,8 +243,8 @@ private :
TOptionValues _defaultOptionValues; // default values TOptionValues _defaultOptionValues; // default values
TOptionNames _doubleOptions, _charOptions, _boolOptions; // to find a type of option TOptionNames _doubleOptions, _charOptions, _boolOptions; // to find a type of option
std::vector <std::string> _myErrorMessages; std::vector <std::string> _errorMessages;
Status _myStatus; Status _status;
std::string meshFormatOutputMesh; std::string meshFormatOutputMesh;
std::vector< std::string> solFormatOutput; std::vector< std::string> solFormatOutput;
std::vector <group> groupVec; std::vector <group> groupVec;

View File

@ -146,7 +146,7 @@ void SMESH_Hypothesis::SetLibName(const char* theLibName)
//purpose : Find a mesh with given persistent ID //purpose : Find a mesh with given persistent ID
//======================================================================= //=======================================================================
SMESH_Mesh* SMESH_Hypothesis::GetMeshByPersistentID(int id) SMESH_Mesh* SMESH_Hypothesis::GetMeshByPersistentID(int id) const
{ {
StudyContextStruct* myStudyContext = _gen->GetStudyContext(); StudyContextStruct* myStudyContext = _gen->GetStudyContext();
map<int, SMESH_Mesh*>::iterator itm = myStudyContext->mapMesh.begin(); map<int, SMESH_Mesh*>::iterator itm = myStudyContext->mapMesh.begin();

View File

@ -128,7 +128,7 @@ public:
/*! /*!
* \brief Find a mesh with given persistent ID * \brief Find a mesh with given persistent ID
*/ */
SMESH_Mesh* GetMeshByPersistentID(int id); SMESH_Mesh* GetMeshByPersistentID(int id) const;
protected: protected:
SMESH_Gen* _gen; SMESH_Gen* _gen;

View File

@ -112,15 +112,33 @@ SMESH_Mesh::SMESH_Mesh(int theLocalId,
if(MYDEBUG) MESSAGE("SMESH_Mesh::SMESH_Mesh(int localId)"); if(MYDEBUG) MESSAGE("SMESH_Mesh::SMESH_Mesh(int localId)");
_id = theLocalId; _id = theLocalId;
_gen = theGen; _gen = theGen;
_myDocument = theDocument; _document = theDocument;
_myMeshDS = theDocument->NewMesh(theIsEmbeddedMode,theLocalId); _meshDS = theDocument->NewMesh(theIsEmbeddedMode,theLocalId);
_isShapeToMesh = false; _isShapeToMesh = false;
_isAutoColor = false; _isAutoColor = false;
_isModified = false; _isModified = false;
_shapeDiagonal = 0.0; _shapeDiagonal = 0.0;
_callUp = NULL; _callUp = NULL;
_myMeshDS->ShapeToMesh( PseudoShape() ); _meshDS->ShapeToMesh( PseudoShape() );
_subMeshHolder = new SubMeshHolder; _subMeshHolder = new SubMeshHolder;
// assure unique persistent ID
if ( _document->NbMeshes() > 1 )
{
std::set< int > ids;
for ( _document->InitMeshesIterator(); _document->MoreMesh(); )
{
SMESHDS_Mesh * meshDS =_document->NextMesh();
if ( meshDS != _meshDS )
ids.insert( meshDS->GetPersistentId() );
}
if ( ids.count( _meshDS->GetPersistentId() ))
{
int uniqueID = *ids.rbegin() + 1;
_meshDS->SetPersistentId( uniqueID );
}
}
} }
//================================================================================ //================================================================================
@ -134,8 +152,8 @@ SMESH_Mesh::SMESH_Mesh():
_groupId( 0 ), _groupId( 0 ),
_nbSubShapes( 0 ), _nbSubShapes( 0 ),
_isShapeToMesh( false ), _isShapeToMesh( false ),
_myDocument( 0 ), _document( 0 ),
_myMeshDS( 0 ), _meshDS( 0 ),
_gen( 0 ), _gen( 0 ),
_isAutoColor( false ), _isAutoColor( false ),
_isModified( false ), _isModified( false ),
@ -176,9 +194,9 @@ SMESH_Mesh::~SMESH_Mesh()
{ {
if(MYDEBUG) MESSAGE("SMESH_Mesh::~SMESH_Mesh"); if(MYDEBUG) MESSAGE("SMESH_Mesh::~SMESH_Mesh");
if ( _myDocument ) // avoid destructing _myMeshDS from ~SMESH_Gen() if ( _document ) // avoid destructing _meshDS from ~SMESH_Gen()
_myDocument->RemoveMesh( _id ); _document->RemoveMesh( _id );
_myDocument = 0; _document = 0;
// remove self from studyContext // remove self from studyContext
if ( _gen ) if ( _gen )
@ -187,7 +205,7 @@ SMESH_Mesh::~SMESH_Mesh()
studyContext->mapMesh.erase( _id ); studyContext->mapMesh.erase( _id );
} }
_myMeshDS->ClearMesh(); _meshDS->ClearMesh();
// issue 0020340: EDF 1022 SMESH : Crash with FindNodeClosestTo in a second new study // issue 0020340: EDF 1022 SMESH : Crash with FindNodeClosestTo in a second new study
// Notify event listeners at least that something happens // Notify event listeners at least that something happens
@ -208,13 +226,13 @@ SMESH_Mesh::~SMESH_Mesh()
if ( _callUp) delete _callUp; if ( _callUp) delete _callUp;
_callUp = 0; _callUp = 0;
if ( _myMeshDS ) { if ( _meshDS ) {
// delete _myMeshDS, in a thread in order not to block closing a study with large meshes // delete _meshDS, in a thread in order not to block closing a study with large meshes
#ifndef WIN32 #ifndef WIN32
boost::thread aThread(boost::bind( & deleteMeshDS, _myMeshDS )); boost::thread aThread(boost::bind( & deleteMeshDS, _meshDS ));
#else #else
pthread_t thread; pthread_t thread;
int result=pthread_create(&thread, NULL, deleteMeshDS, (void*)_myMeshDS); int result=pthread_create(&thread, NULL, deleteMeshDS, (void*)_meshDS);
#endif #endif
} }
} }
@ -227,7 +245,7 @@ SMESH_Mesh::~SMESH_Mesh()
bool SMESH_Mesh::MeshExists( int meshId ) const bool SMESH_Mesh::MeshExists( int meshId ) const
{ {
return _myDocument ? bool( _myDocument->GetMesh( meshId )) : false; return _document ? bool( _document->GetMesh( meshId )) : false;
} }
//================================================================================ //================================================================================
@ -262,11 +280,11 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape)
if ( !aShape.IsNull() && _isShapeToMesh ) { if ( !aShape.IsNull() && _isShapeToMesh ) {
if ( aShape.ShapeType() != TopAbs_COMPOUND && // group contents is allowed to change if ( aShape.ShapeType() != TopAbs_COMPOUND && // group contents is allowed to change
_myMeshDS->ShapeToMesh().ShapeType() != TopAbs_COMPOUND ) _meshDS->ShapeToMesh().ShapeType() != TopAbs_COMPOUND )
throw SALOME_Exception(LOCALIZED ("a shape to mesh has already been defined")); throw SALOME_Exception(LOCALIZED ("a shape to mesh has already been defined"));
} }
// clear current data // clear current data
if ( !_myMeshDS->ShapeToMesh().IsNull() ) if ( !_meshDS->ShapeToMesh().IsNull() )
{ {
// removal of a shape to mesh, delete objects referring to sub-shapes: // removal of a shape to mesh, delete objects referring to sub-shapes:
// - sub-meshes // - sub-meshes
@ -275,7 +293,7 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape)
std::map <int, SMESH_Group *>::iterator i_gr = _mapGroup.begin(); std::map <int, SMESH_Group *>::iterator i_gr = _mapGroup.begin();
while ( i_gr != _mapGroup.end() ) { while ( i_gr != _mapGroup.end() ) {
if ( dynamic_cast<SMESHDS_GroupOnGeom*>( i_gr->second->GetGroupDS() )) { if ( dynamic_cast<SMESHDS_GroupOnGeom*>( i_gr->second->GetGroupDS() )) {
_myMeshDS->RemoveGroup( i_gr->second->GetGroupDS() ); _meshDS->RemoveGroup( i_gr->second->GetGroupDS() );
delete i_gr->second; delete i_gr->second;
_mapGroup.erase( i_gr++ ); _mapGroup.erase( i_gr++ );
} }
@ -286,7 +304,7 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape)
// clear SMESHDS // clear SMESHDS
TopoDS_Shape aNullShape; TopoDS_Shape aNullShape;
_myMeshDS->ShapeToMesh( aNullShape ); _meshDS->ShapeToMesh( aNullShape );
_shapeDiagonal = 0.0; _shapeDiagonal = 0.0;
} }
@ -294,9 +312,9 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape)
// set a new geometry // set a new geometry
if ( !aShape.IsNull() ) if ( !aShape.IsNull() )
{ {
_myMeshDS->ShapeToMesh(aShape); _meshDS->ShapeToMesh(aShape);
_isShapeToMesh = true; _isShapeToMesh = true;
_nbSubShapes = _myMeshDS->MaxShapeIndex(); _nbSubShapes = _meshDS->MaxShapeIndex();
// fill map of ancestors // fill map of ancestors
fillAncestorsMap(aShape); fillAncestorsMap(aShape);
@ -305,7 +323,7 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape)
{ {
_isShapeToMesh = false; _isShapeToMesh = false;
_shapeDiagonal = 0.0; _shapeDiagonal = 0.0;
_myMeshDS->ShapeToMesh( PseudoShape() ); _meshDS->ShapeToMesh( PseudoShape() );
} }
_isModified = false; _isModified = false;
} }
@ -318,7 +336,7 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape)
TopoDS_Shape SMESH_Mesh::GetShapeToMesh() const TopoDS_Shape SMESH_Mesh::GetShapeToMesh() const
{ {
return _myMeshDS->ShapeToMesh(); return _meshDS->ShapeToMesh();
} }
//======================================================================= //=======================================================================
@ -411,7 +429,7 @@ void SMESH_Mesh::Clear()
if ( HasShapeToMesh() ) // remove all nodes and elements if ( HasShapeToMesh() ) // remove all nodes and elements
{ {
// clear mesh data // clear mesh data
_myMeshDS->ClearMesh(); _meshDS->ClearMesh();
// update compute state of submeshes // update compute state of submeshes
if ( SMESH_subMesh *sm = GetSubMeshContaining( GetShapeToMesh() ) ) if ( SMESH_subMesh *sm = GetSubMeshContaining( GetShapeToMesh() ) )
@ -474,7 +492,7 @@ int SMESH_Mesh::UNVToMesh(const char* theFileName)
_isShapeToMesh = false; _isShapeToMesh = false;
DriverUNV_R_SMDS_Mesh myReader; DriverUNV_R_SMDS_Mesh myReader;
myReader.SetMesh(_myMeshDS); myReader.SetMesh(_meshDS);
myReader.SetFile(theFileName); myReader.SetFile(theFileName);
myReader.SetMeshId(-1); myReader.SetMeshId(-1);
myReader.Perform(); myReader.Perform();
@ -486,7 +504,7 @@ int SMESH_Mesh::UNVToMesh(const char* theFileName)
{ {
SMDS_MeshGroup* aGroup = gr2names->first; SMDS_MeshGroup* aGroup = gr2names->first;
const std::string& aName = gr2names->second; const std::string& aName = gr2names->second;
SMESHDS_Group* aGroupDS = new SMESHDS_Group( anId++, _myMeshDS, aGroup->GetType() ); SMESHDS_Group* aGroupDS = new SMESHDS_Group( anId++, _meshDS, aGroup->GetType() );
aGroupDS->SMDSGroup() = std::move( *aGroup ); aGroupDS->SMDSGroup() = std::move( *aGroup );
aGroupDS->SetStoreName( aName.c_str() ); aGroupDS->SetStoreName( aName.c_str() );
AddGroup( aGroupDS ); AddGroup( aGroupDS );
@ -507,7 +525,7 @@ int SMESH_Mesh::MEDToMesh(const char* theFileName, const char* theMeshName)
_isShapeToMesh = false; _isShapeToMesh = false;
DriverMED_R_SMESHDS_Mesh myReader; DriverMED_R_SMESHDS_Mesh myReader;
myReader.SetMesh(_myMeshDS); myReader.SetMesh(_meshDS);
myReader.SetMeshId(-1); myReader.SetMeshId(-1);
myReader.SetFile(theFileName); myReader.SetFile(theFileName);
myReader.SetMeshName(theMeshName); myReader.SetMeshName(theMeshName);
@ -532,8 +550,8 @@ int SMESH_Mesh::MEDToMesh(const char* theFileName, const char* theMeshName)
} }
} }
_myMeshDS->Modified(); _meshDS->Modified();
_myMeshDS->CompactMesh(); _meshDS->CompactMesh();
return (int) status; return (int) status;
} }
@ -550,7 +568,7 @@ std::string SMESH_Mesh::STLToMesh(const char* theFileName)
_isShapeToMesh = false; _isShapeToMesh = false;
DriverSTL_R_SMDS_Mesh myReader; DriverSTL_R_SMDS_Mesh myReader;
myReader.SetMesh(_myMeshDS); myReader.SetMesh(_meshDS);
myReader.SetFile(theFileName); myReader.SetFile(theFileName);
myReader.SetMeshId(-1); myReader.SetMeshId(-1);
myReader.Perform(); myReader.Perform();
@ -574,7 +592,7 @@ int SMESH_Mesh::CGNSToMesh(const char* theFileName,
#ifdef WITH_CGNS #ifdef WITH_CGNS
DriverCGNS_Read myReader; DriverCGNS_Read myReader;
myReader.SetMesh(_myMeshDS); myReader.SetMesh(_meshDS);
myReader.SetFile(theFileName); myReader.SetFile(theFileName);
myReader.SetMeshId(theMeshIndex); myReader.SetMeshId(theMeshIndex);
res = myReader.Perform(); res = myReader.Perform();
@ -597,7 +615,7 @@ SMESH_ComputeErrorPtr SMESH_Mesh::GMFToMesh(const char* theFileName,
bool theMakeRequiredGroups) bool theMakeRequiredGroups)
{ {
DriverGMF_Read myReader; DriverGMF_Read myReader;
myReader.SetMesh(_myMeshDS); myReader.SetMesh(_meshDS);
myReader.SetFile(theFileName); myReader.SetFile(theFileName);
myReader.SetMakeRequiredGroups( theMakeRequiredGroups ); myReader.SetMakeRequiredGroups( theMakeRequiredGroups );
myReader.Perform(); myReader.Perform();
@ -620,7 +638,6 @@ SMESH_Mesh::AddHypothesis(const TopoDS_Shape & aSubShape,
int anHypId, int anHypId,
std::string* anError ) std::string* anError )
{ {
Unexpect aCatch(SalomeException);
if(MYDEBUG) MESSAGE("SMESH_Mesh::AddHypothesis"); if(MYDEBUG) MESSAGE("SMESH_Mesh::AddHypothesis");
if ( anError ) if ( anError )
@ -715,7 +732,6 @@ SMESH_Hypothesis::Hypothesis_Status
SMESH_Mesh::RemoveHypothesis(const TopoDS_Shape & aSubShape, SMESH_Mesh::RemoveHypothesis(const TopoDS_Shape & aSubShape,
int anHypId) int anHypId)
{ {
Unexpect aCatch(SalomeException);
if(MYDEBUG) MESSAGE("SMESH_Mesh::RemoveHypothesis"); if(MYDEBUG) MESSAGE("SMESH_Mesh::RemoveHypothesis");
StudyContextStruct *sc = _gen->GetStudyContext(); StudyContextStruct *sc = _gen->GetStudyContext();
@ -785,7 +801,7 @@ SMESH_Mesh::RemoveHypothesis(const TopoDS_Shape & aSubShape,
const std::list<const SMESHDS_Hypothesis*>& const std::list<const SMESHDS_Hypothesis*>&
SMESH_Mesh::GetHypothesisList(const TopoDS_Shape & aSubShape) const SMESH_Mesh::GetHypothesisList(const TopoDS_Shape & aSubShape) const
{ {
return _myMeshDS->GetHypothesis(aSubShape); return _meshDS->GetHypothesis(aSubShape);
} }
//======================================================================= //=======================================================================
@ -828,7 +844,7 @@ const SMESH_Hypothesis * SMESH_Mesh::GetHypothesis(const SMESH_subMesh * aSubM
{ {
const TopoDS_Shape & aSubShape = aSubMesh->GetSubShape(); const TopoDS_Shape & aSubShape = aSubMesh->GetSubShape();
const std::list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(aSubShape); const std::list<const SMESHDS_Hypothesis*>& hypList = _meshDS->GetHypothesis(aSubShape);
std::list<const SMESHDS_Hypothesis*>::const_iterator hyp = hypList.begin(); std::list<const SMESHDS_Hypothesis*>::const_iterator hyp = hypList.begin();
for ( ; hyp != hypList.end(); hyp++ ) { for ( ; hyp != hypList.end(); hyp++ ) {
const SMESH_Hypothesis * h = cSMESH_Hyp( *hyp ); const SMESH_Hypothesis * h = cSMESH_Hyp( *hyp );
@ -849,7 +865,7 @@ const SMESH_Hypothesis * SMESH_Mesh::GetHypothesis(const SMESH_subMesh * aSubM
for ( ; smIt != ancestors.end(); smIt++ ) for ( ; smIt != ancestors.end(); smIt++ )
{ {
const TopoDS_Shape& curSh = (*smIt)->GetSubShape(); const TopoDS_Shape& curSh = (*smIt)->GetSubShape();
const std::list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(curSh); const std::list<const SMESHDS_Hypothesis*>& hypList = _meshDS->GetHypothesis(curSh);
std::list<const SMESHDS_Hypothesis*>::const_iterator hyp = hypList.begin(); std::list<const SMESHDS_Hypothesis*>::const_iterator hyp = hypList.begin();
for ( ; hyp != hypList.end(); hyp++ ) { for ( ; hyp != hypList.end(); hyp++ ) {
const SMESH_Hypothesis * h = cSMESH_Hyp( *hyp ); const SMESH_Hypothesis * h = cSMESH_Hyp( *hyp );
@ -921,7 +937,7 @@ int SMESH_Mesh::GetHypotheses(const SMESH_subMesh * aSubMesh,
// get hypos from aSubShape // get hypos from aSubShape
{ {
const TopoDS_Shape & aSubShape = aSubMesh->GetSubShape(); const TopoDS_Shape & aSubShape = aSubMesh->GetSubShape();
const std::list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(aSubShape); const std::list<const SMESHDS_Hypothesis*>& hypList = _meshDS->GetHypothesis(aSubShape);
for ( hyp = hypList.begin(); hyp != hypList.end(); hyp++ ) for ( hyp = hypList.begin(); hyp != hypList.end(); hyp++ )
{ {
const SMESH_Hypothesis* h = cSMESH_Hyp( *hyp ); const SMESH_Hypothesis* h = cSMESH_Hyp( *hyp );
@ -950,7 +966,7 @@ int SMESH_Mesh::GetHypotheses(const SMESH_subMesh * aSubMesh,
for ( ; smIt != ancestors.end(); smIt++ ) for ( ; smIt != ancestors.end(); smIt++ )
{ {
const TopoDS_Shape& curSh = (*smIt)->GetSubShape(); const TopoDS_Shape& curSh = (*smIt)->GetSubShape();
const std::list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(curSh); const std::list<const SMESHDS_Hypothesis*>& hypList = _meshDS->GetHypothesis(curSh);
for ( hyp = hypList.begin(); hyp != hypList.end(); hyp++ ) for ( hyp = hypList.begin(); hyp != hypList.end(); hyp++ )
{ {
const SMESH_Hypothesis* h = cSMESH_Hyp( *hyp ); const SMESH_Hypothesis* h = cSMESH_Hyp( *hyp );
@ -994,8 +1010,7 @@ SMESH_Hypothesis * SMESH_Mesh::GetHypothesis(const int anHypId) const
const std::list<SMESHDS_Command*> & SMESH_Mesh::GetLog() const std::list<SMESHDS_Command*> & SMESH_Mesh::GetLog()
{ {
Unexpect aCatch(SalomeException); return _meshDS->GetScript()->GetCommands();
return _myMeshDS->GetScript()->GetCommands();
} }
//============================================================================= //=============================================================================
@ -1005,8 +1020,7 @@ const std::list<SMESHDS_Command*> & SMESH_Mesh::GetLog()
//============================================================================= //=============================================================================
void SMESH_Mesh::ClearLog() void SMESH_Mesh::ClearLog()
{ {
Unexpect aCatch(SalomeException); _meshDS->GetScript()->Clear();
_myMeshDS->GetScript()->Clear();
} }
//============================================================================= //=============================================================================
@ -1017,7 +1031,7 @@ void SMESH_Mesh::ClearLog()
SMESH_subMesh * SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape) SMESH_subMesh * SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape)
{ {
int index = _myMeshDS->ShapeToIndex(aSubShape); int index = _meshDS->ShapeToIndex(aSubShape);
if ( !index && aSubShape.IsNull() ) if ( !index && aSubShape.IsNull() )
return 0; return 0;
@ -1027,10 +1041,10 @@ SMESH_subMesh * SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape)
TopoDS_Iterator it( aSubShape ); TopoDS_Iterator it( aSubShape );
if ( it.More() ) if ( it.More() )
{ {
index = _myMeshDS->AddCompoundSubmesh( aSubShape, it.Value().ShapeType() ); index = _meshDS->AddCompoundSubmesh( aSubShape, it.Value().ShapeType() );
// fill map of Ancestors // fill map of Ancestors
while ( _nbSubShapes < index ) while ( _nbSubShapes < index )
fillAncestorsMap( _myMeshDS->IndexToShape( ++_nbSubShapes )); fillAncestorsMap( _meshDS->IndexToShape( ++_nbSubShapes ));
} }
} }
// if ( !index ) // if ( !index )
@ -1039,7 +1053,7 @@ SMESH_subMesh * SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape)
SMESH_subMesh* aSubMesh = _subMeshHolder->Get( index ); SMESH_subMesh* aSubMesh = _subMeshHolder->Get( index );
if ( !aSubMesh ) if ( !aSubMesh )
{ {
aSubMesh = new SMESH_subMesh(index, this, _myMeshDS, aSubShape); aSubMesh = new SMESH_subMesh(index, this, _meshDS, aSubShape);
_subMeshHolder->Add( index, aSubMesh ); _subMeshHolder->Add( index, aSubMesh );
// include non-computable sub-meshes in SMESH_subMesh::_ancestors of sub-submeshes // include non-computable sub-meshes in SMESH_subMesh::_ancestors of sub-submeshes
@ -1069,7 +1083,7 @@ SMESH_subMesh * SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape)
SMESH_subMesh *SMESH_Mesh::GetSubMeshContaining(const TopoDS_Shape & aSubShape) const SMESH_subMesh *SMESH_Mesh::GetSubMeshContaining(const TopoDS_Shape & aSubShape) const
{ {
int index = _myMeshDS->ShapeToIndex(aSubShape); int index = _meshDS->ShapeToIndex(aSubShape);
return GetSubMeshContaining( index ); return GetSubMeshContaining( index );
} }
@ -1178,16 +1192,15 @@ bool SMESH_Mesh::IsUsedHypothesis(SMESHDS_Hypothesis * anHyp,
void SMESH_Mesh::NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* hyp) void SMESH_Mesh::NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* hyp)
{ {
Unexpect aCatch(SalomeException);
if ( !GetMeshDS()->IsUsedHypothesis( hyp )) if ( !GetMeshDS()->IsUsedHypothesis( hyp ))
return; return;
smIdType nbEntities = ( _myMeshDS->NbNodes() + _myMeshDS->NbElements() ); smIdType nbEntities = ( _meshDS->NbNodes() + _meshDS->NbElements() );
if ( hyp && _callUp && !_callUp->IsLoaded() ) // for not loaded mesh (#16648) if ( hyp && _callUp && !_callUp->IsLoaded() ) // for not loaded mesh (#16648)
{ {
_callUp->HypothesisModified( hyp->GetID(), /*updateIcons=*/true ); _callUp->HypothesisModified( hyp->GetID(), /*updateIcons=*/true );
nbEntities = ( _myMeshDS->NbNodes() + _myMeshDS->NbElements() ); // after loading mesh nbEntities = ( _meshDS->NbNodes() + _meshDS->NbElements() ); // after loading mesh
} }
SMESH_Algo *algo; SMESH_Algo *algo;
@ -1257,7 +1270,7 @@ void SMESH_Mesh::NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* h
HasModificationsToDiscard(); // to reset _isModified flag if mesh becomes empty HasModificationsToDiscard(); // to reset _isModified flag if mesh becomes empty
GetMeshDS()->Modified(); GetMeshDS()->Modified();
smIdType newNbEntities = ( _myMeshDS->NbNodes() + _myMeshDS->NbElements() ); smIdType newNbEntities = ( _meshDS->NbNodes() + _meshDS->NbElements() );
if ( hyp && _callUp ) if ( hyp && _callUp )
_callUp->HypothesisModified( hyp->GetID(), newNbEntities != nbEntities ); _callUp->HypothesisModified( hyp->GetID(), newNbEntities != nbEntities );
} }
@ -1269,13 +1282,11 @@ void SMESH_Mesh::NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* h
//============================================================================= //=============================================================================
void SMESH_Mesh::SetAutoColor(bool theAutoColor) void SMESH_Mesh::SetAutoColor(bool theAutoColor)
{ {
Unexpect aCatch(SalomeException);
_isAutoColor = theAutoColor; _isAutoColor = theAutoColor;
} }
bool SMESH_Mesh::GetAutoColor() bool SMESH_Mesh::GetAutoColor()
{ {
Unexpect aCatch(SalomeException);
return _isAutoColor; return _isAutoColor;
} }
@ -1392,42 +1403,52 @@ bool SMESH_Mesh::HasDuplicatedGroupNamesMED()
return false; return false;
} }
void SMESH_Mesh::ExportMEDCommmon(DriverMED_W_SMESHDS_Mesh& myWriter, //================================================================================
const char* theMeshName, /*!
bool theAutoGroups, * \brief Export the mesh to a writer
const SMESHDS_Mesh* meshPart, */
bool theAutoDimension, //================================================================================
bool theAddODOnVertices,
double theZTolerance, void SMESH_Mesh::exportMEDCommmon(DriverMED_W_SMESHDS_Mesh& theWriter,
bool theAllElemsToGroup) const char* theMeshName,
bool theAutoGroups,
const SMESHDS_Mesh* theMeshPart,
bool theAutoDimension,
bool theAddODOnVertices,
double theZTolerance,
bool theSaveNumbers,
bool theAllElemsToGroup)
{ {
Driver_Mesh::Status status = Driver_Mesh::DRS_OK; Driver_Mesh::Status status = Driver_Mesh::DRS_OK;
SMESH_TRY; SMESH_TRY;
myWriter.SetMesh ( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS );
myWriter.SetAutoDimension( theAutoDimension ); theWriter.SetMesh ( theMeshPart ? (SMESHDS_Mesh*) theMeshPart : _meshDS );
myWriter.AddODOnVertices ( theAddODOnVertices ); theWriter.SetAutoDimension( theAutoDimension );
myWriter.SetZTolerance ( theZTolerance ); theWriter.AddODOnVertices ( theAddODOnVertices );
theWriter.SetZTolerance ( theZTolerance );
theWriter.SetSaveNumbers ( theSaveNumbers );
if ( !theMeshName ) if ( !theMeshName )
myWriter.SetMeshId ( _id ); theWriter.SetMeshId ( _id );
else { else {
myWriter.SetMeshId ( -1 ); theWriter.SetMeshId ( -1 );
myWriter.SetMeshName ( theMeshName ); theWriter.SetMeshName ( theMeshName );
} }
if ( theAutoGroups ) { if ( theAutoGroups ) {
myWriter.AddGroupOfNodes(); theWriter.AddGroupOfNodes();
myWriter.AddGroupOfEdges(); theWriter.AddGroupOfEdges();
myWriter.AddGroupOfFaces(); theWriter.AddGroupOfFaces();
myWriter.AddGroupOfVolumes(); theWriter.AddGroupOfVolumes();
myWriter.AddGroupOf0DElems(); theWriter.AddGroupOf0DElems();
myWriter.AddGroupOfBalls(); theWriter.AddGroupOfBalls();
} }
if ( theAllElemsToGroup ) if ( theAllElemsToGroup )
myWriter.AddAllToGroup(); theWriter.AddAllToGroup();
// Pass groups to writer. Provide unique group names. // Pass groups to writer. Provide unique group names.
//set<string> aGroupNames; // Corrected for Mantis issue 0020028 //set<string> aGroupNames; // Corrected for Mantis issue 0020028
if ( !meshPart ) if ( !theMeshPart )
{ {
std::map< SMDSAbs_ElementType, std::set<std::string> > aGroupNames; std::map< SMDSAbs_ElementType, std::set<std::string> > aGroupNames;
char aString [256]; char aString [256];
@ -1448,12 +1469,12 @@ void SMESH_Mesh::ExportMEDCommmon(DriverMED_W_SMESHDS_Mesh& myWriter,
aGroupName.resize(MAX_MED_GROUP_NAME_LENGTH); aGroupName.resize(MAX_MED_GROUP_NAME_LENGTH);
} }
aGroupDS->SetStoreName( aGroupName.c_str() ); aGroupDS->SetStoreName( aGroupName.c_str() );
myWriter.AddGroup( aGroupDS ); theWriter.AddGroup( aGroupDS );
} }
} }
} }
// Perform export // Perform export
status = myWriter.Perform(); status = theWriter.Perform();
SMESH_CATCH( SMESH::throwSalomeEx ); SMESH_CATCH( SMESH::throwSalomeEx );
@ -1461,62 +1482,70 @@ void SMESH_Mesh::ExportMEDCommmon(DriverMED_W_SMESHDS_Mesh& myWriter,
throw TooLargeForExport("MED"); throw TooLargeForExport("MED");
} }
//================================================================================
/*! /*!
* Same as SMESH_Mesh::ExportMED except for \a file and \a theVersion * Same as SMESH_Mesh::ExportMED except for \a file and \a theVersion
*/ */
MEDCoupling::MCAuto<MEDCoupling::DataArrayByte> SMESH_Mesh::ExportMEDCoupling( //================================================================================
const char* theMeshName,
bool theAutoGroups, MEDCoupling::MCAuto<MEDCoupling::DataArrayByte>
const SMESHDS_Mesh* meshPart, SMESH_Mesh::ExportMEDCoupling(const char* theMeshName,
bool theAutoDimension, bool theAutoGroups,
bool theAddODOnVertices, const SMESHDS_Mesh* theMeshPart,
double theZTolerance, bool theAutoDimension,
bool theAllElemsToGroup) bool theAddODOnVertices,
double theZTolerance,
bool theSaveNumbers)
{ {
DriverMED_W_SMESHDS_Mesh_Mem myWriter; DriverMED_W_SMESHDS_Mesh_Mem writer;
this->ExportMEDCommmon(myWriter,theMeshName,theAutoGroups,meshPart,theAutoDimension,theAddODOnVertices,theZTolerance,theAllElemsToGroup); this->exportMEDCommmon( writer, theMeshName, theAutoGroups, theMeshPart, theAutoDimension,
return myWriter.getData(); theAddODOnVertices, theZTolerance, theSaveNumbers,
/*AllElemsToGroup(for ExportSAUV())=*/false);
return writer.getData();
} }
//================================================================================ //================================================================================
/*! /*!
* \brief Export the mesh to a med file * \brief Export the mesh to a med file
* \param [in] file - name of the MED file * \param [in] theFile - name of the MED file
* \param [in] theMeshName - name of this mesh * \param [in] theMeshName - name of this mesh
* \param [in] theAutoGroups - boolean parameter for creating/not creating * \param [in] theAutoGroups - boolean parameter for creating/not creating
* the groups Group_On_All_Nodes, Group_On_All_Faces, ... ; * the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
* the typical use is auto_groups=false. * the typical use is auto_groups=false.
* \param [in] theVersion - define the minor (xy, where version is x.y.z) of MED file format. * \param [in] theVersion - define the minor (xy, where version is x.y.z) of MED file format.
* If theVersion is equal to -1, the minor version is not changed (default). * If theVersion is equal to -1, the minor version is not changed (default).
* \param [in] meshPart - mesh data to export * \param [in] theMeshPart - mesh data to export
* \param [in] theAutoDimension - if \c true, a space dimension of a MED mesh can be either * \param [in] theAutoDimension - if \c true, a space dimension of a MED mesh can be either
* - 1D if all mesh nodes lie on OX coordinate axis, or * - 1D if all mesh nodes lie on OX coordinate axis, or
* - 2D if all mesh nodes lie on XOY coordinate plane, or * - 2D if all mesh nodes lie on XOY coordinate plane, or
* - 3D in the rest cases. * - 3D in the rest cases.
* If \a theAutoDimension is \c false, the space dimension is always 3. * If \a theAutoDimension is \c false, the space dimension is always 3.
* \param [in] theAddODOnVertices - to create 0D elements on all vertices * \param [in] theAddODOnVertices - to create 0D elements on all vertices
* \param [in] theAllElemsToGroup - to make every element to belong to any group (PAL23413) * \param [in] theZTolerance - tolerance in Z direction. If Z coordinate of a node is close to zero
* \param [in] ZTolerance - tolerance in Z direction. If Z coordinate of a node is close to zero
* within a given tolerance, the coordinate is set to zero. * within a given tolerance, the coordinate is set to zero.
* If \a ZTolerance is negative, the node coordinates are kept as is. * If \a ZTolerance is negative, the node coordinates are kept as is.
* \param [in] theSaveNumbers : enable saving numbers of nodes and cells.
* \param [in] theAllElemsToGroup - to make every element to belong to any group (PAL23413).
* It is used by ExportSAUV() only
* \return int - mesh index in the file * \return int - mesh index in the file
*/ */
//================================================================================ //================================================================================
void SMESH_Mesh::ExportMED(const char * file, void SMESH_Mesh::ExportMED(const char * theFile,
const char* theMeshName, const char* theMeshName,
bool theAutoGroups, bool theAutoGroups,
int theVersion, int theVersion,
const SMESHDS_Mesh* meshPart, const SMESHDS_Mesh* theMeshPart,
bool theAutoDimension, bool theAutoDimension,
bool theAddODOnVertices, bool theAddODOnVertices,
double theZTolerance, double theZTolerance,
bool theSaveNumbers,
bool theAllElemsToGroup) bool theAllElemsToGroup)
{ {
MESSAGE("MED_VERSION:"<< theVersion); MESSAGE("MED_VERSION:"<< theVersion);
DriverMED_W_SMESHDS_Mesh myWriter; DriverMED_W_SMESHDS_Mesh writer;
myWriter.SetFile( file , theVersion ); writer.SetFile( theFile, theVersion );
this->ExportMEDCommmon(myWriter,theMeshName,theAutoGroups,meshPart,theAutoDimension,theAddODOnVertices,theZTolerance,theAllElemsToGroup); this->exportMEDCommmon( writer, theMeshName, theAutoGroups, theMeshPart, theAutoDimension, theAddODOnVertices, theZTolerance, theSaveNumbers, theAllElemsToGroup );
} }
//================================================================================ //================================================================================
@ -1525,11 +1554,11 @@ void SMESH_Mesh::ExportMED(const char * file,
*/ */
//================================================================================ //================================================================================
void SMESH_Mesh::ExportSAUV(const char *file, void SMESH_Mesh::ExportSAUV(const char *theFile,
const char* theMeshName, const char* theMeshName,
bool theAutoGroups) bool theAutoGroups)
{ {
std::string medfilename(file); std::string medfilename( theFile );
medfilename += ".med"; medfilename += ".med";
std::string cmd; std::string cmd;
#ifdef WIN32 #ifdef WIN32
@ -1542,9 +1571,10 @@ void SMESH_Mesh::ExportSAUV(const char *file,
cmd += "\""; cmd += "\"";
system(cmd.c_str()); system(cmd.c_str());
try { try {
ExportMED(medfilename.c_str(), theMeshName, theAutoGroups, /*minor=*/-1, ExportMED( medfilename.c_str(), theMeshName, theAutoGroups, /*minor=*/-1,
/*meshPart=*/NULL, /*theAutoDimension=*/false, /*theAddODOnVertices=*/false, /*meshPart=*/NULL, /*theAutoDimension=*/false, /*theAddODOnVertices=*/false,
/*zTol=*/-1, /*theAllElemsToGroup=*/true ); // theAllElemsToGroup is for PAL0023413 /*zTol=*/-1, /*theSaveNumbers=*/false,
/*theAllElemsToGroup=*/true ); // theAllElemsToGroup is for PAL0023413
} }
catch ( TooLargeForExport ) catch ( TooLargeForExport )
{ {
@ -1556,7 +1586,7 @@ void SMESH_Mesh::ExportSAUV(const char *file,
cmd = "python3 "; cmd = "python3 ";
#endif #endif
cmd += "-c \""; cmd += "-c \"";
cmd += "from medutilities import convert ; convert(r'" + medfilename + "', 'MED', 'GIBI', 1, r'" + file + "')"; cmd += "from medutilities import convert ; convert(r'" + medfilename + "', 'MED', 'GIBI', 1, r'" + theFile + "')";
cmd += "\""; cmd += "\"";
system(cmd.c_str()); system(cmd.c_str());
#ifdef WIN32 #ifdef WIN32
@ -1577,16 +1607,18 @@ void SMESH_Mesh::ExportSAUV(const char *file,
//================================================================================ //================================================================================
void SMESH_Mesh::ExportDAT(const char * file, void SMESH_Mesh::ExportDAT(const char * file,
const SMESHDS_Mesh* meshPart) const SMESHDS_Mesh* meshPart,
const bool renumber)
{ {
Driver_Mesh::Status status; Driver_Mesh::Status status;
SMESH_TRY; SMESH_TRY;
DriverDAT_W_SMDS_Mesh myWriter; DriverDAT_W_SMDS_Mesh writer;
myWriter.SetFile( file ); writer.SetFile( file );
myWriter.SetMesh( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS ); writer.SetMesh( meshPart ? (SMESHDS_Mesh*) meshPart : _meshDS );
myWriter.SetMeshId(_id); writer.SetMeshId(_id);
status = myWriter.Perform(); writer.SetRenumber( renumber );
status = writer.Perform();
SMESH_CATCH( SMESH::throwSalomeEx ); SMESH_CATCH( SMESH::throwSalomeEx );
@ -1601,16 +1633,17 @@ void SMESH_Mesh::ExportDAT(const char * file,
//================================================================================ //================================================================================
void SMESH_Mesh::ExportUNV(const char * file, void SMESH_Mesh::ExportUNV(const char * file,
const SMESHDS_Mesh* meshPart) const SMESHDS_Mesh* meshPart,
const bool renumber)
{ {
Driver_Mesh::Status status; Driver_Mesh::Status status;
SMESH_TRY; SMESH_TRY;
DriverUNV_W_SMDS_Mesh myWriter; DriverUNV_W_SMDS_Mesh writer;
myWriter.SetFile( file ); writer.SetFile( file );
myWriter.SetMesh( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS ); writer.SetMesh( meshPart ? (SMESHDS_Mesh*) meshPart : _meshDS );
myWriter.SetMeshId(_id); writer.SetMeshId(_id);
// myWriter.SetGroups(_mapGroup); writer.SetRenumber( renumber );
// pass group names to SMESHDS // pass group names to SMESHDS
if ( !meshPart ) if ( !meshPart )
@ -1622,11 +1655,11 @@ void SMESH_Mesh::ExportUNV(const char * file,
if ( aGroupDS ) { if ( aGroupDS ) {
std::string aGroupName = aGroup->GetName(); std::string aGroupName = aGroup->GetName();
aGroupDS->SetStoreName( aGroupName.c_str() ); aGroupDS->SetStoreName( aGroupName.c_str() );
myWriter.AddGroup( aGroupDS ); writer.AddGroup( aGroupDS );
} }
} }
} }
status = myWriter.Perform(); status = writer.Perform();
SMESH_CATCH( SMESH::throwSalomeEx ); SMESH_CATCH( SMESH::throwSalomeEx );
@ -1648,13 +1681,13 @@ void SMESH_Mesh::ExportSTL(const char * file,
Driver_Mesh::Status status; Driver_Mesh::Status status;
SMESH_TRY; SMESH_TRY;
DriverSTL_W_SMDS_Mesh myWriter; DriverSTL_W_SMDS_Mesh writer;
myWriter.SetFile( file ); writer.SetFile( file );
myWriter.SetIsAscii( isascii ); writer.SetIsAscii( isascii );
myWriter.SetMesh( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS); writer.SetMesh( meshPart ? (SMESHDS_Mesh*) meshPart : _meshDS);
myWriter.SetMeshId(_id); writer.SetMeshId(_id);
if ( name ) myWriter.SetName( name ); if ( name ) writer.SetName( name );
status = myWriter.Perform(); status = writer.Perform();
SMESH_CATCH( SMESH::throwSalomeEx ); SMESH_CATCH( SMESH::throwSalomeEx );
@ -1689,17 +1722,17 @@ void SMESH_Mesh::ExportCGNS(const char * file,
} }
#ifdef WITH_CGNS #ifdef WITH_CGNS
DriverCGNS_Write myWriter; DriverCGNS_Write writer;
myWriter.SetFile( file ); writer.SetFile( file );
myWriter.SetMesh( const_cast<SMESHDS_Mesh*>( meshDS )); writer.SetMesh( const_cast<SMESHDS_Mesh*>( meshDS ));
myWriter.SetMeshName( SMESH_Comment("Mesh_") << meshDS->GetPersistentId()); writer.SetMeshName( SMESH_Comment("Mesh_") << meshDS->GetPersistentId());
if ( meshName && meshName[0] ) if ( meshName && meshName[0] )
myWriter.SetMeshName( meshName ); writer.SetMeshName( meshName );
myWriter.SetElementsByType( groupElemsByType ); writer.SetElementsByType( groupElemsByType );
res = myWriter.Perform(); res = writer.Perform();
if ( res != Driver_Mesh::DRS_OK ) if ( res != Driver_Mesh::DRS_OK )
{ {
SMESH_ComputeErrorPtr err = myWriter.GetError(); SMESH_ComputeErrorPtr err = writer.GetError();
if ( err && !err->IsOK() && !err->myComment.empty() ) if ( err && !err->IsOK() && !err->myComment.empty() )
throw SALOME_Exception(("Export failed: " + err->myComment ).c_str() ); throw SALOME_Exception(("Export failed: " + err->myComment ).c_str() );
} }
@ -1727,12 +1760,12 @@ void SMESH_Mesh::ExportGMF(const char * file,
Driver_Mesh::Status status; Driver_Mesh::Status status;
SMESH_TRY; SMESH_TRY;
DriverGMF_Write myWriter; DriverGMF_Write writer;
myWriter.SetFile( file ); writer.SetFile( file );
myWriter.SetMesh( const_cast<SMESHDS_Mesh*>( meshDS )); writer.SetMesh( const_cast<SMESHDS_Mesh*>( meshDS ));
myWriter.SetExportRequiredGroups( withRequiredGroups ); writer.SetExportRequiredGroups( withRequiredGroups );
status = myWriter.Perform(); status = writer.Perform();
SMESH_CATCH( SMESH::throwSalomeEx ); SMESH_CATCH( SMESH::throwSalomeEx );
@ -1822,8 +1855,7 @@ double SMESH_Mesh::GetComputeProgress() const
smIdType SMESH_Mesh::NbNodes() const smIdType SMESH_Mesh::NbNodes() const
{ {
Unexpect aCatch(SalomeException); return _meshDS->NbNodes();
return _myMeshDS->NbNodes();
} }
//================================================================================ //================================================================================
@ -1834,8 +1866,7 @@ smIdType SMESH_Mesh::NbNodes() const
smIdType SMESH_Mesh::Nb0DElements() const smIdType SMESH_Mesh::Nb0DElements() const
{ {
Unexpect aCatch(SalomeException); return _meshDS->GetMeshInfo().Nb0DElements();
return _myMeshDS->GetMeshInfo().Nb0DElements();
} }
//================================================================================ //================================================================================
@ -1846,8 +1877,7 @@ smIdType SMESH_Mesh::Nb0DElements() const
smIdType SMESH_Mesh::NbEdges(SMDSAbs_ElementOrder order) const smIdType SMESH_Mesh::NbEdges(SMDSAbs_ElementOrder order) const
{ {
Unexpect aCatch(SalomeException); return _meshDS->GetMeshInfo().NbEdges(order);
return _myMeshDS->GetMeshInfo().NbEdges(order);
} }
//================================================================================ //================================================================================
@ -1858,8 +1888,7 @@ smIdType SMESH_Mesh::NbEdges(SMDSAbs_ElementOrder order) const
smIdType SMESH_Mesh::NbFaces(SMDSAbs_ElementOrder order) const smIdType SMESH_Mesh::NbFaces(SMDSAbs_ElementOrder order) const
{ {
Unexpect aCatch(SalomeException); return _meshDS->GetMeshInfo().NbFaces(order);
return _myMeshDS->GetMeshInfo().NbFaces(order);
} }
//================================================================================ //================================================================================
@ -1870,8 +1899,7 @@ smIdType SMESH_Mesh::NbFaces(SMDSAbs_ElementOrder order) const
smIdType SMESH_Mesh::NbTriangles(SMDSAbs_ElementOrder order) const smIdType SMESH_Mesh::NbTriangles(SMDSAbs_ElementOrder order) const
{ {
Unexpect aCatch(SalomeException); return _meshDS->GetMeshInfo().NbTriangles(order);
return _myMeshDS->GetMeshInfo().NbTriangles(order);
} }
//================================================================================ //================================================================================
@ -1882,8 +1910,7 @@ smIdType SMESH_Mesh::NbTriangles(SMDSAbs_ElementOrder order) const
smIdType SMESH_Mesh::NbBiQuadTriangles() const smIdType SMESH_Mesh::NbBiQuadTriangles() const
{ {
Unexpect aCatch(SalomeException); return _meshDS->GetMeshInfo().NbBiQuadTriangles();
return _myMeshDS->GetMeshInfo().NbBiQuadTriangles();
} }
//================================================================================ //================================================================================
@ -1894,8 +1921,7 @@ smIdType SMESH_Mesh::NbBiQuadTriangles() const
smIdType SMESH_Mesh::NbQuadrangles(SMDSAbs_ElementOrder order) const smIdType SMESH_Mesh::NbQuadrangles(SMDSAbs_ElementOrder order) const
{ {
Unexpect aCatch(SalomeException); return _meshDS->GetMeshInfo().NbQuadrangles(order);
return _myMeshDS->GetMeshInfo().NbQuadrangles(order);
} }
//================================================================================ //================================================================================
@ -1906,8 +1932,7 @@ smIdType SMESH_Mesh::NbQuadrangles(SMDSAbs_ElementOrder order) const
smIdType SMESH_Mesh::NbBiQuadQuadrangles() const smIdType SMESH_Mesh::NbBiQuadQuadrangles() const
{ {
Unexpect aCatch(SalomeException); return _meshDS->GetMeshInfo().NbBiQuadQuadrangles();
return _myMeshDS->GetMeshInfo().NbBiQuadQuadrangles();
} }
//================================================================================ //================================================================================
@ -1918,8 +1943,7 @@ smIdType SMESH_Mesh::NbBiQuadQuadrangles() const
smIdType SMESH_Mesh::NbPolygons(SMDSAbs_ElementOrder order) const smIdType SMESH_Mesh::NbPolygons(SMDSAbs_ElementOrder order) const
{ {
Unexpect aCatch(SalomeException); return _meshDS->GetMeshInfo().NbPolygons(order);
return _myMeshDS->GetMeshInfo().NbPolygons(order);
} }
//================================================================================ //================================================================================
@ -1930,8 +1954,7 @@ smIdType SMESH_Mesh::NbPolygons(SMDSAbs_ElementOrder order) const
smIdType SMESH_Mesh::NbVolumes(SMDSAbs_ElementOrder order) const smIdType SMESH_Mesh::NbVolumes(SMDSAbs_ElementOrder order) const
{ {
Unexpect aCatch(SalomeException); return _meshDS->GetMeshInfo().NbVolumes(order);
return _myMeshDS->GetMeshInfo().NbVolumes(order);
} }
//================================================================================ //================================================================================
@ -1942,8 +1965,7 @@ smIdType SMESH_Mesh::NbVolumes(SMDSAbs_ElementOrder order) const
smIdType SMESH_Mesh::NbTetras(SMDSAbs_ElementOrder order) const smIdType SMESH_Mesh::NbTetras(SMDSAbs_ElementOrder order) const
{ {
Unexpect aCatch(SalomeException); return _meshDS->GetMeshInfo().NbTetras(order);
return _myMeshDS->GetMeshInfo().NbTetras(order);
} }
//================================================================================ //================================================================================
@ -1954,8 +1976,7 @@ smIdType SMESH_Mesh::NbTetras(SMDSAbs_ElementOrder order) const
smIdType SMESH_Mesh::NbHexas(SMDSAbs_ElementOrder order) const smIdType SMESH_Mesh::NbHexas(SMDSAbs_ElementOrder order) const
{ {
Unexpect aCatch(SalomeException); return _meshDS->GetMeshInfo().NbHexas(order);
return _myMeshDS->GetMeshInfo().NbHexas(order);
} }
//================================================================================ //================================================================================
@ -1966,8 +1987,7 @@ smIdType SMESH_Mesh::NbHexas(SMDSAbs_ElementOrder order) const
smIdType SMESH_Mesh::NbTriQuadraticHexas() const smIdType SMESH_Mesh::NbTriQuadraticHexas() const
{ {
Unexpect aCatch(SalomeException); return _meshDS->GetMeshInfo().NbTriQuadHexas();
return _myMeshDS->GetMeshInfo().NbTriQuadHexas();
} }
//================================================================================ //================================================================================
@ -1978,8 +1998,7 @@ smIdType SMESH_Mesh::NbTriQuadraticHexas() const
smIdType SMESH_Mesh::NbPyramids(SMDSAbs_ElementOrder order) const smIdType SMESH_Mesh::NbPyramids(SMDSAbs_ElementOrder order) const
{ {
Unexpect aCatch(SalomeException); return _meshDS->GetMeshInfo().NbPyramids(order);
return _myMeshDS->GetMeshInfo().NbPyramids(order);
} }
//================================================================================ //================================================================================
@ -1990,20 +2009,17 @@ smIdType SMESH_Mesh::NbPyramids(SMDSAbs_ElementOrder order) const
smIdType SMESH_Mesh::NbPrisms(SMDSAbs_ElementOrder order) const smIdType SMESH_Mesh::NbPrisms(SMDSAbs_ElementOrder order) const
{ {
Unexpect aCatch(SalomeException); return _meshDS->GetMeshInfo().NbPrisms(order);
return _myMeshDS->GetMeshInfo().NbPrisms(order);
} }
smIdType SMESH_Mesh::NbQuadPrisms() const smIdType SMESH_Mesh::NbQuadPrisms() const
{ {
Unexpect aCatch(SalomeException); return _meshDS->GetMeshInfo().NbQuadPrisms();
return _myMeshDS->GetMeshInfo().NbQuadPrisms();
} }
smIdType SMESH_Mesh::NbBiQuadPrisms() const smIdType SMESH_Mesh::NbBiQuadPrisms() const
{ {
Unexpect aCatch(SalomeException); return _meshDS->GetMeshInfo().NbBiQuadPrisms();
return _myMeshDS->GetMeshInfo().NbBiQuadPrisms();
} }
@ -2015,8 +2031,7 @@ smIdType SMESH_Mesh::NbBiQuadPrisms() const
smIdType SMESH_Mesh::NbHexagonalPrisms() const smIdType SMESH_Mesh::NbHexagonalPrisms() const
{ {
Unexpect aCatch(SalomeException); return _meshDS->GetMeshInfo().NbHexPrisms();
return _myMeshDS->GetMeshInfo().NbHexPrisms();
} }
//================================================================================ //================================================================================
@ -2027,8 +2042,7 @@ smIdType SMESH_Mesh::NbHexagonalPrisms() const
smIdType SMESH_Mesh::NbPolyhedrons() const smIdType SMESH_Mesh::NbPolyhedrons() const
{ {
Unexpect aCatch(SalomeException); return _meshDS->GetMeshInfo().NbPolyhedrons();
return _myMeshDS->GetMeshInfo().NbPolyhedrons();
} }
//================================================================================ //================================================================================
@ -2039,8 +2053,7 @@ smIdType SMESH_Mesh::NbPolyhedrons() const
smIdType SMESH_Mesh::NbBalls() const smIdType SMESH_Mesh::NbBalls() const
{ {
Unexpect aCatch(SalomeException); return _meshDS->GetMeshInfo().NbBalls();
return _myMeshDS->GetMeshInfo().NbBalls();
} }
//================================================================================ //================================================================================
@ -2051,8 +2064,7 @@ smIdType SMESH_Mesh::NbBalls() const
smIdType SMESH_Mesh::NbSubMesh() const smIdType SMESH_Mesh::NbSubMesh() const
{ {
Unexpect aCatch(SalomeException); return _meshDS->NbSubMesh();
return _myMeshDS->NbSubMesh();
} }
//================================================================================ //================================================================================
@ -2064,7 +2076,7 @@ smIdType SMESH_Mesh::NbSubMesh() const
int SMESH_Mesh::NbMeshes() const // nb meshes in the Study int SMESH_Mesh::NbMeshes() const // nb meshes in the Study
{ {
return _myDocument->NbMeshes(); return _document->NbMeshes();
} }
//======================================================================= //=======================================================================
@ -2077,7 +2089,7 @@ bool SMESH_Mesh::IsNotConformAllowed() const
if(MYDEBUG) MESSAGE("SMESH_Mesh::IsNotConformAllowed"); if(MYDEBUG) MESSAGE("SMESH_Mesh::IsNotConformAllowed");
static SMESH_HypoFilter filter( SMESH_HypoFilter::HasName( "NotConformAllowed" )); static SMESH_HypoFilter filter( SMESH_HypoFilter::HasName( "NotConformAllowed" ));
return GetHypothesis( _myMeshDS->ShapeToMesh(), filter, false ); return GetHypothesis( _meshDS->ShapeToMesh(), filter, false );
} }
//======================================================================= //=======================================================================
@ -2087,7 +2099,7 @@ bool SMESH_Mesh::IsNotConformAllowed() const
bool SMESH_Mesh::IsMainShape(const TopoDS_Shape& theShape) const bool SMESH_Mesh::IsMainShape(const TopoDS_Shape& theShape) const
{ {
return theShape.IsSame(_myMeshDS->ShapeToMesh() ); return theShape.IsSame(_meshDS->ShapeToMesh() );
} }
//======================================================================= //=======================================================================
@ -2162,7 +2174,7 @@ SMESH_Group* SMESH_Mesh::AddGroup (SMESHDS_GroupBase* groupDS)
bool SMESH_Mesh::SynchronizeGroups() bool SMESH_Mesh::SynchronizeGroups()
{ {
const size_t nbGroups = _mapGroup.size(); const size_t nbGroups = _mapGroup.size();
const std::set<SMESHDS_GroupBase*>& groups = _myMeshDS->GetGroups(); const std::set<SMESHDS_GroupBase*>& groups = _meshDS->GetGroups();
std::set<SMESHDS_GroupBase*>::const_iterator gIt = groups.begin(); std::set<SMESHDS_GroupBase*>::const_iterator gIt = groups.begin();
for ( ; gIt != groups.end(); ++gIt ) for ( ; gIt != groups.end(); ++gIt )
{ {
@ -2295,7 +2307,7 @@ ostream& SMESH_Mesh::Dump(ostream& save)
save << clause << ".2) Number of " << orderStr << " quadrangles:\t" << nb4 << endl; save << clause << ".2) Number of " << orderStr << " quadrangles:\t" << nb4 << endl;
if ( nb3 + nb4 != NbFaces(order) ) { if ( nb3 + nb4 != NbFaces(order) ) {
std::map<int,int> myFaceMap; std::map<int,int> myFaceMap;
SMDS_FaceIteratorPtr itFaces=_myMeshDS->facesIterator(); SMDS_FaceIteratorPtr itFaces=_meshDS->facesIterator();
while( itFaces->more( ) ) { while( itFaces->more( ) ) {
int nbNodes = itFaces->next()->NbNodes(); int nbNodes = itFaces->next()->NbNodes();
if ( myFaceMap.find( nbNodes ) == myFaceMap.end() ) if ( myFaceMap.find( nbNodes ) == myFaceMap.end() )
@ -2320,7 +2332,7 @@ ostream& SMESH_Mesh::Dump(ostream& save)
save << clause << ".4) Number of " << orderStr << " pyramids: \t" << nb5 << endl; save << clause << ".4) Number of " << orderStr << " pyramids: \t" << nb5 << endl;
if ( nb8 + nb4 + nb5 + nb6 != NbVolumes(order) ) { if ( nb8 + nb4 + nb5 + nb6 != NbVolumes(order) ) {
std::map<int,int> myVolumesMap; std::map<int,int> myVolumesMap;
SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator(); SMDS_VolumeIteratorPtr itVolumes=_meshDS->volumesIterator();
while( itVolumes->more( ) ) { while( itVolumes->more( ) ) {
int nbNodes = itVolumes->next()->NbNodes(); int nbNodes = itVolumes->next()->NbNodes();
if ( myVolumesMap.find( nbNodes ) == myVolumesMap.end() ) if ( myVolumesMap.find( nbNodes ) == myVolumesMap.end() )
@ -2346,7 +2358,7 @@ ostream& SMESH_Mesh::Dump(ostream& save)
SMDSAbs_ElementType SMESH_Mesh::GetElementType( const smIdType id, const bool iselem ) SMDSAbs_ElementType SMESH_Mesh::GetElementType( const smIdType id, const bool iselem )
{ {
return _myMeshDS->GetElementType( id, iselem ); return _meshDS->GetElementType( id, iselem );
} }
//============================================================================= //=============================================================================
@ -2397,7 +2409,7 @@ SMESH_Group* SMESH_Mesh::ConvertToStandalone ( int theGroupID )
void SMESH_Mesh::ClearMeshOrder() void SMESH_Mesh::ClearMeshOrder()
{ {
_mySubMeshOrder.clear(); _subMeshOrder.clear();
} }
//============================================================================= //=============================================================================
@ -2408,7 +2420,7 @@ void SMESH_Mesh::ClearMeshOrder()
void SMESH_Mesh::SetMeshOrder(const TListOfListOfInt& theOrder ) void SMESH_Mesh::SetMeshOrder(const TListOfListOfInt& theOrder )
{ {
_mySubMeshOrder = theOrder; _subMeshOrder = theOrder;
} }
//============================================================================= //=============================================================================
@ -2419,7 +2431,7 @@ void SMESH_Mesh::SetMeshOrder(const TListOfListOfInt& theOrder )
const TListOfListOfInt& SMESH_Mesh::GetMeshOrder() const const TListOfListOfInt& SMESH_Mesh::GetMeshOrder() const
{ {
return _mySubMeshOrder; return _subMeshOrder;
} }
//============================================================================= //=============================================================================
@ -2480,7 +2492,7 @@ void SMESH_Mesh::fillAncestorsMap(const TopoDS_Shape& theShape)
bool SMESH_Mesh::SortByMeshOrder(std::vector<SMESH_subMesh*>& theListToSort) const bool SMESH_Mesh::SortByMeshOrder(std::vector<SMESH_subMesh*>& theListToSort) const
{ {
if ( _mySubMeshOrder.empty() || theListToSort.size() < 2 ) if ( _subMeshOrder.empty() || theListToSort.size() < 2 )
return true; return true;
@ -2491,9 +2503,9 @@ bool SMESH_Mesh::SortByMeshOrder(std::vector<SMESH_subMesh*>& theListToSort) con
typedef std::vector<SMESH_subMesh*>::iterator TPosInList; typedef std::vector<SMESH_subMesh*>::iterator TPosInList;
std::map< size_t, size_t > sortedPos; // index in theListToSort to order std::map< size_t, size_t > sortedPos; // index in theListToSort to order
TPosInList smBeg = theListToSort.begin(), smEnd = theListToSort.end(); TPosInList smBeg = theListToSort.begin(), smEnd = theListToSort.end();
TListOfListOfInt::const_iterator listIdsIt = _mySubMeshOrder.begin(); TListOfListOfInt::const_iterator listIdsIt = _subMeshOrder.begin();
bool needSort = false; bool needSort = false;
for( ; listIdsIt != _mySubMeshOrder.end(); listIdsIt++) for( ; listIdsIt != _subMeshOrder.end(); listIdsIt++)
{ {
const TListOfInt& listOfId = *listIdsIt; const TListOfInt& listOfId = *listIdsIt;
// convert sm ids to sm's // convert sm ids to sm's
@ -2571,8 +2583,8 @@ bool SMESH_Mesh::SortByMeshOrder(std::vector<SMESH_subMesh*>& theListToSort) con
bool SMESH_Mesh::IsOrderOK( const SMESH_subMesh* smBefore, bool SMESH_Mesh::IsOrderOK( const SMESH_subMesh* smBefore,
const SMESH_subMesh* smAfter ) const const SMESH_subMesh* smAfter ) const
{ {
TListOfListOfInt::const_iterator listIdsIt = _mySubMeshOrder.begin(); TListOfListOfInt::const_iterator listIdsIt = _subMeshOrder.begin();
for( ; listIdsIt != _mySubMeshOrder.end(); listIdsIt++) for( ; listIdsIt != _subMeshOrder.end(); listIdsIt++)
{ {
const TListOfInt& listOfId = *listIdsIt; const TListOfInt& listOfId = *listIdsIt;
int iB = -1, iA = -1, i = 0; int iB = -1, iA = -1, i = 0;

View File

@ -178,9 +178,9 @@ class SMESH_EXPORT SMESH_Mesh
SMESH_Mesh* FindMesh( int meshId ) const; SMESH_Mesh* FindMesh( int meshId ) const;
SMESHDS_Mesh * GetMeshDS() { return _myMeshDS; } SMESHDS_Mesh * GetMeshDS() { return _meshDS; }
const SMESHDS_Mesh * GetMeshDS() const { return _myMeshDS; } const SMESHDS_Mesh * GetMeshDS() const { return _meshDS; }
SMESH_Gen *GetGen() { return _gen; } SMESH_Gen *GetGen() { return _gen; }
@ -265,14 +265,14 @@ class SMESH_EXPORT SMESH_Mesh
TooLargeForExport(const char* format):runtime_error(format) {} TooLargeForExport(const char* format):runtime_error(format) {}
}; };
MEDCoupling::MCAuto<MEDCoupling::DataArrayByte> ExportMEDCoupling( MEDCoupling::MCAuto<MEDCoupling::DataArrayByte>
const char* theMeshName = NULL, ExportMEDCoupling(const char* theMeshName = NULL,
bool theAutoGroups = true, bool theAutoGroups = true,
const SMESHDS_Mesh* theMeshPart = 0, const SMESHDS_Mesh* theMeshPart = 0,
bool theAutoDimension = false, bool theAutoDimension = false,
bool theAddODOnVertices = false, bool theAddODOnVertices = false,
double theZTolerance = -1., double theZTolerance = -1.,
bool theAllElemsToGroup = false); bool theSaveNumbers = true);
void ExportMED(const char * theFile, void ExportMED(const char * theFile,
const char* theMeshName = NULL, const char* theMeshName = NULL,
@ -282,12 +282,15 @@ class SMESH_EXPORT SMESH_Mesh
bool theAutoDimension = false, bool theAutoDimension = false,
bool theAddODOnVertices = false, bool theAddODOnVertices = false,
double theZTolerance = -1., double theZTolerance = -1.,
bool theSaveNumbers = true,
bool theAllElemsToGroup = false); bool theAllElemsToGroup = false);
void ExportDAT(const char * file, void ExportDAT(const char * file,
const SMESHDS_Mesh* meshPart = 0); const SMESHDS_Mesh* meshPart = 0,
const bool renumber = true);
void ExportUNV(const char * file, void ExportUNV(const char * file,
const SMESHDS_Mesh* meshPart = 0); const SMESHDS_Mesh* meshPart = 0,
const bool renumber = true);
void ExportSTL(const char * file, void ExportSTL(const char * file,
const bool isascii, const bool isascii,
const char * name = 0, const char * name = 0,
@ -385,16 +388,17 @@ class SMESH_EXPORT SMESH_Mesh
private: private:
void ExportMEDCommmon(DriverMED_W_SMESHDS_Mesh& myWriter, void exportMEDCommmon(DriverMED_W_SMESHDS_Mesh& myWriter,
const char* theMeshName, const char* theMeshName,
bool theAutoGroups, bool theAutoGroups,
const SMESHDS_Mesh* meshPart, const SMESHDS_Mesh* meshPart,
bool theAutoDimension, bool theAutoDimension,
bool theAddODOnVertices, bool theAddODOnVertices,
double theZTolerance, double theZTolerance,
bool theAllElemsToGroup); bool theSaveNumbers,
bool theAllElemsToGroup);
private: private:
void fillAncestorsMap(const TopoDS_Shape& theShape); void fillAncestorsMap(const TopoDS_Shape& theShape);
void getAncestorsSubMeshes(const TopoDS_Shape& theSubShape, void getAncestorsSubMeshes(const TopoDS_Shape& theSubShape,
std::vector< SMESH_subMesh* >& theSubMeshes) const; std::vector< SMESH_subMesh* >& theSubMeshes) const;
@ -404,8 +408,8 @@ protected:
int _groupId; // id generator for group objects int _groupId; // id generator for group objects
int _nbSubShapes; // initial nb of subshapes in the shape to mesh int _nbSubShapes; // initial nb of subshapes in the shape to mesh
bool _isShapeToMesh;// set to true when a shape is given (only once) bool _isShapeToMesh;// set to true when a shape is given (only once)
SMESHDS_Document * _myDocument; SMESHDS_Document * _document;
SMESHDS_Mesh * _myMeshDS; SMESHDS_Mesh * _meshDS;
SMESH_Gen * _gen; SMESH_Gen * _gen;
std::map <int, SMESH_Group*> _mapGroup; std::map <int, SMESH_Group*> _mapGroup;
@ -421,7 +425,7 @@ protected:
mutable std::vector<SMESH_subMesh*> _ancestorSubMeshes; // to speed up GetHypothes[ei]s() mutable std::vector<SMESH_subMesh*> _ancestorSubMeshes; // to speed up GetHypothes[ei]s()
TListOfListOfInt _mySubMeshOrder; TListOfListOfInt _subMeshOrder;
// Struct calling methods at CORBA API implementation level, used to // Struct calling methods at CORBA API implementation level, used to
// 1) make an upper level (SMESH_I) be consistent with a lower one (SMESH) // 1) make an upper level (SMESH_I) be consistent with a lower one (SMESH)

View File

@ -114,3 +114,33 @@ bool SMESHDS_Hypothesis::IsSameName( const SMESHDS_Hypothesis& other) const
{ {
return _name == other._name; return _name == other._name;
} }
//================================================================================
/*!
* \brief Save a string to a stream
*/
//================================================================================
void SMESHDS_Hypothesis::SaveString(std::ostream & save, const std::string& txt )
{
save << " " << txt.size() << " " << txt;
}
//================================================================================
/*!
* \brief Load a string from a stream
*/
//================================================================================
bool SMESHDS_Hypothesis::LoadString(std::istream & load, std::string& txt )
{
txt.clear();
int size = -1;
if ( static_cast<bool>( load >> size ) && size > 0 )
{
txt.resize( size, '\0' );
load.get( txt[0] ); // remove a white-space
load.get( & txt[0], size + 1 );
}
return (int)txt.size() == size;
}

View File

@ -48,6 +48,9 @@ class SMESHDS_EXPORT SMESHDS_Hypothesis
virtual std::ostream & SaveTo(std::ostream & save)=0; virtual std::ostream & SaveTo(std::ostream & save)=0;
virtual std::istream & LoadFrom(std::istream & load)=0; virtual std::istream & LoadFrom(std::istream & load)=0;
static void SaveString(std::ostream & save, const std::string& txt );
static bool LoadString(std::istream & load, std::string& txt );
bool IsSameName( const SMESHDS_Hypothesis& other) const; bool IsSameName( const SMESHDS_Hypothesis& other) const;
virtual bool operator==(const SMESHDS_Hypothesis& other) const; virtual bool operator==(const SMESHDS_Hypothesis& other) const;
bool operator!=(const SMESHDS_Hypothesis& other) const { return !(*this==other); } bool operator!=(const SMESHDS_Hypothesis& other) const { return !(*this==other); }

View File

@ -59,11 +59,11 @@ class SMESHDS_Mesh::SubMeshHolder : public SMESHDS_TSubMeshHolder< const SMESHDS
//purpose : //purpose :
//======================================================================= //=======================================================================
SMESHDS_Mesh::SMESHDS_Mesh(int theMeshID, bool theIsEmbeddedMode): SMESHDS_Mesh::SMESHDS_Mesh(int theMeshID, bool theIsEmbeddedMode):
myMeshID(theMeshID),
mySubMeshHolder( new SubMeshHolder ), mySubMeshHolder( new SubMeshHolder ),
myIsEmbeddedMode(theIsEmbeddedMode) myIsEmbeddedMode(theIsEmbeddedMode)
{ {
myScript = new SMESHDS_Script(theIsEmbeddedMode); myScript = new SMESHDS_Script(theIsEmbeddedMode);
SetPersistentId(theMeshID); SetPersistentId(theMeshID);
} }
@ -188,13 +188,15 @@ bool SMESHDS_Mesh::RemoveHypothesis(const TopoDS_Shape & S,
//function : AddNode //function : AddNode
//purpose : //purpose :
//======================================================================= //=======================================================================
SMDS_MeshNode* SMESHDS_Mesh::AddNode(double x, double y, double z){ SMDS_MeshNode* SMESHDS_Mesh::AddNode(double x, double y, double z)
{
SMDS_MeshNode* node = SMDS_Mesh::AddNode(x, y, z); SMDS_MeshNode* node = SMDS_Mesh::AddNode(x, y, z);
if(node!=NULL) myScript->AddNode(node->GetID(), x, y, z); if(node!=NULL) myScript->AddNode(node->GetID(), x, y, z);
return node; return node;
} }
SMDS_MeshNode* SMESHDS_Mesh::AddNodeWithID(double x, double y, double z, smIdType ID){ SMDS_MeshNode* SMESHDS_Mesh::AddNodeWithID(double x, double y, double z, smIdType ID)
{
SMDS_MeshNode* node = SMDS_Mesh::AddNodeWithID(x,y,z,ID); SMDS_MeshNode* node = SMDS_Mesh::AddNodeWithID(x,y,z,ID);
if(node!=NULL) myScript->AddNode(node->GetID(), x, y, z); if(node!=NULL) myScript->AddNode(node->GetID(), x, y, z);
return node; return node;
@ -235,9 +237,8 @@ bool SMESHDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem,
//function : ChangePolygonNodes //function : ChangePolygonNodes
//purpose : //purpose :
//======================================================================= //=======================================================================
bool SMESHDS_Mesh::ChangePolygonNodes bool SMESHDS_Mesh::ChangePolygonNodes (const SMDS_MeshElement * elem,
(const SMDS_MeshElement * elem, std::vector<const SMDS_MeshNode*>& nodes)
std::vector<const SMDS_MeshNode*> nodes)
{ {
ASSERT(nodes.size() > 3); ASSERT(nodes.size() > 3);

View File

@ -595,8 +595,8 @@ class SMESHDS_EXPORT SMESHDS_Mesh : public SMDS_Mesh
bool ChangeElementNodes(const SMDS_MeshElement * elem, bool ChangeElementNodes(const SMDS_MeshElement * elem,
const SMDS_MeshNode * nodes[], const SMDS_MeshNode * nodes[],
const int nbnodes); const int nbnodes);
bool ChangePolygonNodes(const SMDS_MeshElement * elem, bool ChangePolygonNodes(const SMDS_MeshElement * elem,
std::vector<const SMDS_MeshNode*> nodes); std::vector<const SMDS_MeshNode*>& nodes);
bool ChangePolyhedronNodes(const SMDS_MeshElement * elem, bool ChangePolyhedronNodes(const SMDS_MeshElement * elem,
const std::vector<const SMDS_MeshNode*>& nodes, const std::vector<const SMDS_MeshNode*>& nodes,
const std::vector<int>& quantities); const std::vector<int>& quantities);
@ -656,7 +656,7 @@ class SMESHDS_EXPORT SMESHDS_Mesh : public SMDS_Mesh
ShapeToHypothesis myShapeToHypothesis; ShapeToHypothesis myShapeToHypothesis;
int myMeshID, myPersistentID; int myPersistentID;
TopoDS_Shape myShape; TopoDS_Shape myShape;
class SubMeshHolder; class SubMeshHolder;

View File

@ -460,6 +460,7 @@ namespace
bool aCheckWarn = true; bool aCheckWarn = true;
if ( resMgr ) if ( resMgr )
aCheckWarn = resMgr->booleanValue( "SMESH", "show_warning", false ); aCheckWarn = resMgr->booleanValue( "SMESH", "show_warning", false );
// get mesh object from selection and check duplication of their names // get mesh object from selection and check duplication of their names
bool hasDuplicatedMeshNames = false; bool hasDuplicatedMeshNames = false;
QList< QPair< SMESH::SMESH_IDSource_var, QString > > aMeshList; QList< QPair< SMESH::SMESH_IDSource_var, QString > > aMeshList;
@ -628,8 +629,8 @@ namespace
"SMESH_OCTAHEDRA","SMESH_POLYEDRONS","SMESH_QUADRATIC_POLYEDRONS","SMESH_BALLS" "SMESH_OCTAHEDRA","SMESH_POLYEDRONS","SMESH_QUADRATIC_POLYEDRONS","SMESH_BALLS"
}; };
// is typeMsg complete? (compilation failure mains that enum SMDSAbs_EntityType changed) // is typeMsg complete? (compilation failure mains that enum SMDSAbs_EntityType changed)
const int nbTypes = sizeof( typeMsg ) / sizeof( const char* ); static_assert( sizeof(typeMsg) / sizeof(const char*) == SMESH::Entity_Last,
int _assert[( nbTypes == SMESH::Entity_Last ) ? 2 : -1 ]; _assert[0]=_assert[1]=0; "Update names of EntityType's!!!" );
QString andStr = " " + QObject::tr("SMESH_AND") + " ", comma(", "); QString andStr = " " + QObject::tr("SMESH_AND") + " ", comma(", ");
for ( size_t iType = 0; iType < presentNotSupported.size(); ++iType ) { for ( size_t iType = 0; iType < presentNotSupported.size(); ++iType ) {
@ -655,12 +656,11 @@ namespace
// Init the parameters with the default values // Init the parameters with the default values
bool aIsASCII_STL = true; bool aIsASCII_STL = true;
bool toCreateGroups = false; bool toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false );
if ( resMgr ) bool toOverwrite = true;
toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false ); bool toFindOutDim = true;
bool toOverwrite = true; bool toRenumber = true;
bool toFindOutDim = true; double zTol = resMgr->doubleValue( "SMESH", "med_ztolerance", 0. );
double zTol = resMgr ? resMgr->doubleValue( "SMESH", "med_ztolerance", 0. ) : 0.;
QString aFilter, aTitle = QObject::tr("SMESH_EXPORT_MESH"); QString aFilter, aTitle = QObject::tr("SMESH_EXPORT_MESH");
QString anInitialPath = ""; QString anInitialPath = "";
@ -670,44 +670,46 @@ namespace
QList< QPair< GEOM::ListOfFields_var, QString > > aFieldList; QList< QPair< GEOM::ListOfFields_var, QString > > aFieldList;
// Get a file name to write in and additional options // Get a file name to write in and additional options
if ( isUNV || isDAT || isGMF ) // Export w/o options if ( isGMF ) // Export w/o options
{ {
if ( isUNV ) aFilter = QObject::tr( "GMF_ASCII_FILES_FILTER" ) + " (*.mesh)" +
aFilter = QObject::tr( "IDEAS_FILES_FILTER" ) + " (*.unv)"; ";;" + QObject::tr( "GMF_BINARY_FILES_FILTER" ) + " (*.meshb)";
else if ( isDAT ) if ( anInitialPath.isEmpty() ) anInitialPath = SUIT_FileDlg::getLastVisitedPath();
aFilter = QObject::tr( "DAT_FILES_FILTER" ) + " (*.dat)";
else if ( isGMF )
aFilter = QObject::tr( "GMF_ASCII_FILES_FILTER" ) + " (*.mesh)" +
";;" + QObject::tr( "GMF_BINARY_FILES_FILTER" ) + " (*.meshb)";
if ( anInitialPath.isEmpty() ) anInitialPath = SUIT_FileDlg::getLastVisitedPath();
aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(), aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(),
anInitialPath + QString("/") + aMeshName, anInitialPath + QString("/") + aMeshName,
aFilter, aTitle, false); aFilter, aTitle, false);
} }
else if ( isCGNS )// Export to CGNS else if ( isCGNS || isUNV || isDAT ) // Export to [ CGNS | UNV | DAT ] - one option
{ {
const char* theByTypeResource = "cgns_group_elems_by_type"; const char* theOptionResource = isCGNS ? "cgns_group_elems_by_type" : "export_renumber";
toCreateGroups = SMESHGUI::resourceMgr()->booleanValue( "SMESH", theByTypeResource, false ); bool option = resMgr->booleanValue( "SMESH", theOptionResource, false );
QStringList checkBoxes; QStringList checkBoxes;
checkBoxes << QObject::tr("CGNS_EXPORT_ELEMS_BY_TYPE"); checkBoxes << QObject::tr( isCGNS ? "CGNS_EXPORT_ELEMS_BY_TYPE" : "SMESH_RENUMBER" );
SalomeApp_CheckFileDlg* fd = SalomeApp_CheckFileDlg* fd =
new SalomeApp_CheckFileDlg ( SMESHGUI::desktop(), false, checkBoxes, true, true ); new SalomeApp_CheckFileDlg ( SMESHGUI::desktop(), false, checkBoxes, true, true );
fd->setWindowTitle( aTitle ); fd->setWindowTitle( aTitle );
fd->setNameFilter( QObject::tr( "CGNS_FILES_FILTER" ) + " (*.cgns)" ); if ( isCGNS )
fd->setNameFilter( QObject::tr( "CGNS_FILES_FILTER" ) + " (*.cgns)" );
else if ( isUNV )
fd->setNameFilter( QObject::tr( "IDEAS_FILES_FILTER" ) + " (*.unv)" );
else if ( isDAT )
fd->setNameFilter( QObject::tr( "DAT_FILES_FILTER" ) + " (*.dat)" );
if ( !anInitialPath.isEmpty() ) if ( !anInitialPath.isEmpty() )
fd->setDirectory( anInitialPath ); fd->setDirectory( anInitialPath );
fd->selectFile(aMeshName); fd->selectFile( aMeshName );
SMESHGUI_FileValidator* fv = new SMESHGUI_FileValidator( fd ); SMESHGUI_FileValidator* fv = new SMESHGUI_FileValidator( fd );
fd->setValidator( fv ); fd->setValidator( fv );
fd->SetChecked( toCreateGroups, 0 ); fd->SetChecked( option, 0 );
if ( fd->exec() ) if ( fd->exec() )
aFilename = fd->selectedFile(); aFilename = fd->selectedFile();
toOverwrite = fv->isOverwrite(aFilename); toOverwrite = fv->isOverwrite( aFilename );
toCreateGroups = fd->IsChecked(0); option = fd->IsChecked( 0 );
SMESHGUI::resourceMgr()->setValue("SMESH", theByTypeResource, toCreateGroups ); SMESHGUI::resourceMgr()->setValue("SMESH", theOptionResource, option );
( isCGNS ? toCreateGroups : toRenumber ) = option;
delete fd; delete fd;
} }
@ -751,7 +753,6 @@ namespace
for ( CORBA::ULong i = 0; i < mvok->length(); ++i ) for ( CORBA::ULong i = 0; i < mvok->length(); ++i )
{ {
QString vs = (char*)( SMESH_Comment( mvok[i]/10 ) << "." << mvok[i]%10 ); QString vs = (char*)( SMESH_Comment( mvok[i]/10 ) << "." << mvok[i]%10 );
MESSAGE("MED version: " << vs.toStdString());
aFilterMap.insert( QObject::tr( "MED_VX_FILES_FILTER" ).arg( vs ) + " (*.med)", mvok[i]); aFilterMap.insert( QObject::tr( "MED_VX_FILES_FILTER" ).arg( vs ) + " (*.med)", mvok[i]);
} }
} }
@ -924,9 +925,9 @@ namespace
// if ( SMESHGUI::automaticUpdate() ) // if ( SMESHGUI::automaticUpdate() )
// SMESH::UpdateView(); // SMESH::UpdateView();
// } // }
if ( isMED && isOkToWrite) if ( isMED && isOkToWrite )
{ {
MESSAGE("OK to write MED file "<< aFilename.toUtf8().constData()); const bool saveNumbers = resMgr->booleanValue( "SMESH", "med_save_numbers", true );
aMeshIter = aMeshList.begin(); aMeshIter = aMeshList.begin();
for( int aMeshIndex = 0; aMeshIter != aMeshList.end(); aMeshIter++, aMeshIndex++ ) for( int aMeshIndex = 0; aMeshIter != aMeshList.end(); aMeshIter++, aMeshIndex++ )
{ {
@ -934,15 +935,11 @@ namespace
SMESH::SMESH_Mesh_var aMeshItem = aMeshOrGroup->GetMesh(); SMESH::SMESH_Mesh_var aMeshItem = aMeshOrGroup->GetMesh();
const GEOM::ListOfFields& fields = aFieldList[ aMeshIndex ].first.in(); const GEOM::ListOfFields& fields = aFieldList[ aMeshIndex ].first.in();
const QString& geoAssFields = aFieldList[ aMeshIndex ].second; const QString& geoAssFields = aFieldList[ aMeshIndex ].second;
const bool hasFields = ( fields.length() || !geoAssFields.isEmpty() );
if ( !hasFields && aMeshOrGroup->_is_equivalent( aMeshItem ) && zTol < 0 ) aMeshItem->ExportPartToMED( aMeshOrGroup, aFilename.toUtf8().data(),
aMeshItem->ExportMED( aFilename.toUtf8().data(), toCreateGroups, aFormat, toCreateGroups, aFormat,
toOverwrite && aMeshIndex == 0, toFindOutDim ); toOverwrite && aMeshIndex == 0, toFindOutDim,
else fields, geoAssFields.toLatin1().data(), zTol, saveNumbers );
aMeshItem->ExportPartToMED( aMeshOrGroup, aFilename.toUtf8().data(),
toCreateGroups, aFormat,
toOverwrite && aMeshIndex == 0, toFindOutDim,
fields, geoAssFields.toLatin1().data(), zTol );
} }
} }
else if ( isSAUV ) else if ( isSAUV )
@ -957,16 +954,16 @@ namespace
else if ( isDAT ) else if ( isDAT )
{ {
if ( aMeshOrGroup->_is_equivalent( aMesh )) if ( aMeshOrGroup->_is_equivalent( aMesh ))
aMesh->ExportDAT( aFilename.toUtf8().data() ); aMesh->ExportDAT( aFilename.toUtf8().data(), toRenumber );
else else
aMesh->ExportPartToDAT( aMeshOrGroup, aFilename.toUtf8().data() ); aMesh->ExportPartToDAT( aMeshOrGroup, aFilename.toUtf8().data(), toRenumber );
} }
else if ( isUNV ) else if ( isUNV )
{ {
if ( aMeshOrGroup->_is_equivalent( aMesh )) if ( aMeshOrGroup->_is_equivalent( aMesh ))
aMesh->ExportUNV( aFilename.toUtf8().data() ); aMesh->ExportUNV( aFilename.toUtf8().data(), toRenumber );
else else
aMesh->ExportPartToUNV( aMeshOrGroup, aFilename.toUtf8().data() ); aMesh->ExportPartToUNV( aMeshOrGroup, aFilename.toUtf8().data(), toRenumber );
} }
else if ( isSTL ) else if ( isSTL )
{ {
@ -5479,6 +5476,7 @@ void SMESHGUI::createPreferences()
setPreferenceProperty( exportgroup, "columns", 2 ); setPreferenceProperty( exportgroup, "columns", 2 );
addPreference( tr( "PREF_AUTO_GROUPS" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "auto_groups" ); addPreference( tr( "PREF_AUTO_GROUPS" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "auto_groups" );
addPreference( tr( "PREF_SHOW_WARN" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "show_warning" ); addPreference( tr( "PREF_SHOW_WARN" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "show_warning" );
addPreference( tr( "PREF_MED_SAVE_NUMS" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "med_save_numbers" );
int zTol = addPreference( tr( "PREF_ZTOLERANCE" ), exportgroup, LightApp_Preferences::DblSpin, "SMESH", "med_ztolerance" ); int zTol = addPreference( tr( "PREF_ZTOLERANCE" ), exportgroup, LightApp_Preferences::DblSpin, "SMESH", "med_ztolerance" );
setPreferenceProperty( zTol, "precision", 10 ); setPreferenceProperty( zTol, "precision", 10 );
setPreferenceProperty( zTol, "min", 0.0000000001 ); setPreferenceProperty( zTol, "min", 0.0000000001 );

View File

@ -891,6 +891,7 @@ void SMESHGUI_MeshDlg::setAvailableMeshType( const QStringList& theTypeMesh )
{ {
myMeshType->clear(); myMeshType->clear();
myMeshType->addItems(theTypeMesh); myMeshType->addItems(theTypeMesh);
myMeshType->setEnabled( theTypeMesh.size() > 1 );
} }
//================================================================================ //================================================================================
/*! /*!

View File

@ -106,12 +106,12 @@ SMESHGUI_EXPORT
_PTR(SObject) FindSObject( CORBA::Object_ptr ); _PTR(SObject) FindSObject( CORBA::Object_ptr );
SMESHGUI_EXPORT SMESHGUI_EXPORT
void SetName( _PTR(SObject), const QString& ); void SetName( _PTR(SObject), const QString& name );
SMESHGUI_EXPORT SMESHGUI_EXPORT
void SetValue( _PTR(SObject), const QString& ); void SetValue ( _PTR(SObject), const QString& value );
void setFileType( _PTR(SObject), const QString& ); void setFileType( _PTR(SObject), const QString& fileType );
void setFileName( _PTR(SObject), const QString& ); void setFileName( _PTR(SObject), const QString& fileName );
SMESHGUI_EXPORT SMESHGUI_EXPORT
CORBA::Object_var SObjectToObject( _PTR(SObject) ); CORBA::Object_var SObjectToObject( _PTR(SObject) );
@ -141,7 +141,7 @@ SMESHGUI_EXPORT
} }
SMESHGUI_EXPORT SMESHGUI_EXPORT
CORBA::Object_var IORToObject( const QString& ); CORBA::Object_var IORToObject( const QString& ior );
template<class TInterface> typename TInterface::_var_type template<class TInterface> typename TInterface::_var_type
IORToInterface( const QString& theIOR ) IORToInterface( const QString& theIOR )
@ -153,7 +153,7 @@ SMESHGUI_EXPORT
} }
SMESHGUI_EXPORT SMESHGUI_EXPORT
CORBA::Object_var EntryToObject( const QString& ); CORBA::Object_var EntryToObject( const QString& entry );
template<class TInterface> typename TInterface::_var_type template<class TInterface> typename TInterface::_var_type
EntryToInterface( const QString& theEntry ) EntryToInterface( const QString& theEntry )
@ -165,7 +165,7 @@ SMESHGUI_EXPORT
} }
SMESHGUI_EXPORT SMESHGUI_EXPORT
int GetNameOfSelectedIObjects( LightApp_SelectionMgr*, QString& ); int GetNameOfSelectedIObjects( LightApp_SelectionMgr*, QString& name );
SMESHGUI_EXPORT SMESHGUI_EXPORT
QString GetName( const Handle(SALOME_InteractiveObject)& theIO ); QString GetName( const Handle(SALOME_InteractiveObject)& theIO );
@ -174,7 +174,7 @@ SMESHGUI_EXPORT
_PTR(SObject) GetMeshOrSubmesh( _PTR(SObject) ); _PTR(SObject) GetMeshOrSubmesh( _PTR(SObject) );
SMESHGUI_EXPORT SMESHGUI_EXPORT
void ShowHelpFile( const QString& ); void ShowHelpFile( const QString& helpFileName);
/*! /*!
* \brief Return the normal to a face * \brief Return the normal to a face

View File

@ -2840,6 +2840,10 @@ Check algorithm documentation for supported geometry</translation>
<source>SMESH_RENUMBERING</source> <source>SMESH_RENUMBERING</source>
<translation>Renumbering</translation> <translation>Renumbering</translation>
</message> </message>
<message>
<source>SMESH_RENUMBER</source>
<translation>Renumber</translation>
</message>
<message> <message>
<source>SMESH_RENUMBERING_ELEMENTS_TITLE</source> <source>SMESH_RENUMBERING_ELEMENTS_TITLE</source>
<translation>Renumbering elements</translation> <translation>Renumbering elements</translation>
@ -4885,6 +4889,10 @@ Please, create VTK viewer and try again</translation>
<source>PREF_SHOW_WARN</source> <source>PREF_SHOW_WARN</source>
<translation>Show warning when exporting group</translation> <translation>Show warning when exporting group</translation>
</message> </message>
<message>
<source>PREF_MED_SAVE_NUMS</source>
<translation>Save cell/node numbers to MED file</translation>
</message>
<message> <message>
<source>PREF_ZTOLERANCE</source> <source>PREF_ZTOLERANCE</source>
<translation>Z tolerance for MED export</translation> <translation>Z tolerance for MED export</translation>

View File

@ -39,6 +39,15 @@ const char* SMESH::returnError(const char* txt)
return txt; return txt;
} }
void SMESH::printErrorInDebugMode(const char* txt)
{
#ifdef _DEBUG_
std::cerr << txt << " " << __FILE__ << ": " << __LINE__ << std::endl;
#else
(void)txt; // unused in release mode
#endif
}
// ------------------------------------------------------------------ // ------------------------------------------------------------------
#include "SMESH_ComputeError.hxx" #include "SMESH_ComputeError.hxx"

View File

@ -108,6 +108,7 @@ namespace SMESH
SMESHUtils_EXPORT void throwSalomeEx(const char* txt); SMESHUtils_EXPORT void throwSalomeEx(const char* txt);
SMESHUtils_EXPORT void doNothing(const char* txt); SMESHUtils_EXPORT void doNothing(const char* txt);
SMESHUtils_EXPORT const char* returnError(const char* txt); SMESHUtils_EXPORT const char* returnError(const char* txt);
SMESHUtils_EXPORT void printErrorInDebugMode(const char* txt);
} }
#endif #endif

View File

@ -4185,11 +4185,9 @@ namespace SMESH {
"FT_LogicalOR", "FT_LogicalOR",
"FT_Undefined"}; "FT_Undefined"};
#ifdef _DEBUG_
// check if functName is complete, compilation failure means that enum FunctorType changed // check if functName is complete, compilation failure means that enum FunctorType changed
const int nbFunctors = sizeof(functName) / sizeof(const char*); static_assert( sizeof(functName) / sizeof(const char*) == SMESH::FT_Undefined + 1,
int _assert[( nbFunctors == SMESH::FT_Undefined + 1 ) ? 2 : -1 ]; _assert[0]=_assert[1]=0; "Update names of FunctorType's!!!" );
#endif
return functName; return functName;
} }

View File

@ -2707,10 +2707,10 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::ListOfIDSources& theMeshesArray,
{ {
// type names // type names
const char* typeNames[] = { "All","Nodes","Edges","Faces","Volumes","0DElems","Balls" }; const char* typeNames[] = { "All","Nodes","Edges","Faces","Volumes","0DElems","Balls" };
{ // check of typeNames: compilation failure mains that NB_ELEMENT_TYPES changed:
const int nbNames = sizeof(typeNames) / sizeof(const char*); // check of typeNames: compilation failure mains that NB_ELEMENT_TYPES changed:
int _assert[( nbNames == SMESH::NB_ELEMENT_TYPES ) ? 2 : -1 ]; _assert[0]=_assert[1]=0; static_assert( sizeof(typeNames) / sizeof(const char*) ==SMESH::NB_ELEMENT_TYPES,
} "Update names of ElementType's!!!" );
SMESH::smIdType_array_var curState = newMesh->GetNbElementsByType(); SMESH::smIdType_array_var curState = newMesh->GetNbElementsByType();
@ -4206,8 +4206,9 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
system(cmd.ToCString()); system(cmd.ToCString());
// MED writer to be used by storage process // MED writer to be used by storage process
DriverMED_W_SMESHDS_Mesh myWriter; DriverMED_W_SMESHDS_Mesh writer;
myWriter.SetFile( meshfile.ToCString() ); writer.SetFile( meshfile.ToCString() );
writer.SetSaveNumbers( false ); // bos #24400
// IMP issue 20918 // IMP issue 20918
// SetStoreName() to groups before storing hypotheses to let them refer to // SetStoreName() to groups before storing hypotheses to let them refer to
@ -4414,8 +4415,8 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
// check if the mesh is not empty // check if the mesh is not empty
if ( mySMESHDSMesh->NbNodes() > 0 ) { if ( mySMESHDSMesh->NbNodes() > 0 ) {
// write mesh data to med file // write mesh data to med file
myWriter.SetMesh( mySMESHDSMesh ); writer.SetMesh( mySMESHDSMesh );
myWriter.SetMeshId( id ); writer.SetMeshId( id );
strHasData = "1"; strHasData = "1";
} }
aSize[ 0 ] = strHasData.length() + 1; aSize[ 0 ] = strHasData.length() + 1;
@ -4889,7 +4890,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
// Pass SMESHDS_Group to MED writer // Pass SMESHDS_Group to MED writer
SMESHDS_Group* aGrpDS = dynamic_cast<SMESHDS_Group*>( aGrpBaseDS ); SMESHDS_Group* aGrpDS = dynamic_cast<SMESHDS_Group*>( aGrpBaseDS );
if ( aGrpDS ) if ( aGrpDS )
myWriter.AddGroup( aGrpDS ); writer.AddGroup( aGrpDS );
// write reference on a shape if exists // write reference on a shape if exists
SMESHDS_GroupOnGeom* aGeomGrp = SMESHDS_GroupOnGeom* aGeomGrp =
@ -4914,7 +4915,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
else // shape ref is invalid: else // shape ref is invalid:
{ {
// save a group on geometry as ordinary group // save a group on geometry as ordinary group
myWriter.AddGroup( aGeomGrp ); writer.AddGroup( aGeomGrp );
} }
} }
else if ( SMESH_GroupOnFilter_i* aFilterGrp_i = else if ( SMESH_GroupOnFilter_i* aFilterGrp_i =
@ -4937,7 +4938,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
if ( strcmp( strHasData.c_str(), "1" ) == 0 ) if ( strcmp( strHasData.c_str(), "1" ) == 0 )
{ {
// Flush current mesh information into MED file // Flush current mesh information into MED file
myWriter.Perform(); writer.Perform();
// save info on nb of elements // save info on nb of elements
SMESH_PreMeshInfo::SaveToFile( myImpl, id, aFile ); SMESH_PreMeshInfo::SaveToFile( myImpl, id, aFile );
@ -5547,7 +5548,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
} }
} // reading MESHes } // reading MESHes
// As all object that can be referred by hypothesis are created, // As all objects that can be referred by hypothesis are created,
// we can restore hypothesis data // we can restore hypothesis data
list< pair< SMESH_Hypothesis_i*, string > >::iterator hyp_data; list< pair< SMESH_Hypothesis_i*, string > >::iterator hyp_data;

View File

@ -439,7 +439,7 @@ SMESH::smIdType SMESH_Group_i::AddFrom( SMESH::SMESH_IDSource_ptr theSource )
//============================================================================= //=============================================================================
/*! /*!
* * Return ID of theIndex-th group item
*/ */
//============================================================================= //=============================================================================

View File

@ -109,7 +109,7 @@ class SMESH_I_EXPORT SMESH_GroupBase_i:
// Internal C++ interface // Internal C++ interface
int GetLocalID() const { return myLocalID; } int GetLocalID() const { return myLocalID; } // return group persistent ID
SMESH_Mesh_i* GetMeshServant() const { return myMeshServant; } SMESH_Mesh_i* GetMeshServant() const { return myMeshServant; }
SMESH_Group* GetSmeshGroup() const; SMESH_Group* GetSmeshGroup() const;
SMESHDS_GroupBase* GetGroupDS() const; SMESHDS_GroupBase* GetGroupDS() const;

View File

@ -102,7 +102,7 @@ namespace MeshEditor_I {
//!< Constructor //!< Constructor
TPreviewMesh(SMDSAbs_ElementType previewElements = SMDSAbs_All) { TPreviewMesh(SMDSAbs_ElementType previewElements = SMDSAbs_All) {
_isShapeToMesh = (_id = 0); _isShapeToMesh = (_id = 0);
_myMeshDS = new SMESHDS_Mesh( _id, true ); _meshDS = new SMESHDS_Mesh( _id, true );
myPreviewType = previewElements; myPreviewType = previewElements;
} }
//!< Copy a set of elements //!< Copy a set of elements
@ -155,8 +155,8 @@ namespace MeshEditor_I {
//!< Copy a node //!< Copy a node
SMDS_MeshNode* Copy( const SMDS_MeshNode* anElemNode ) SMDS_MeshNode* Copy( const SMDS_MeshNode* anElemNode )
{ {
return _myMeshDS->AddNodeWithID(anElemNode->X(), anElemNode->Y(), anElemNode->Z(), return _meshDS->AddNodeWithID(anElemNode->X(), anElemNode->Y(), anElemNode->Z(),
anElemNode->GetID()); anElemNode->GetID());
} }
void RemoveAll() void RemoveAll()
{ {

View File

@ -3824,7 +3824,7 @@ void SMESH_Mesh_i::ExportSAUV( const char* file, CORBA::Boolean auto_groups )
*/ */
//================================================================================ //================================================================================
void SMESH_Mesh_i::ExportDAT (const char *file) void SMESH_Mesh_i::ExportDAT (const char *file, CORBA::Boolean renumber )
{ {
SMESH_TRY; SMESH_TRY;
if ( _preMeshInfo ) if ( _preMeshInfo )
@ -3833,11 +3833,12 @@ void SMESH_Mesh_i::ExportDAT (const char *file)
// check names of groups // check names of groups
checkGroupNames(); checkGroupNames();
// Update Python script // Update Python script
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportDAT( r'" << file << "' )"; TPythonDump() << SMESH::SMESH_Mesh_var(_this())
<< ".ExportDAT( r'" << file<< ", " << renumber << "' )";
// Perform Export // Perform Export
PrepareForWriting(file); PrepareForWriting( file );
_impl->ExportDAT(file); _impl->ExportDAT( file, /*part=*/nullptr, renumber );
SMESH_CATCH( SMESH::throwCorbaException ); SMESH_CATCH( SMESH::throwCorbaException );
} }
@ -3848,7 +3849,7 @@ void SMESH_Mesh_i::ExportDAT (const char *file)
*/ */
//================================================================================ //================================================================================
void SMESH_Mesh_i::ExportUNV (const char *file) void SMESH_Mesh_i::ExportUNV (const char *file, CORBA::Boolean renumber)
{ {
SMESH_TRY; SMESH_TRY;
if ( _preMeshInfo ) if ( _preMeshInfo )
@ -3857,11 +3858,12 @@ void SMESH_Mesh_i::ExportUNV (const char *file)
// check names of groups // check names of groups
checkGroupNames(); checkGroupNames();
// Update Python script // Update Python script
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportUNV( r'" << file << "' )"; TPythonDump() << SMESH::SMESH_Mesh_var(_this())
<< ".ExportUNV( r'" << file << "' " << renumber << "' )";
// Perform Export // Perform Export
PrepareForWriting(file); PrepareForWriting( file );
_impl->ExportUNV(file); _impl->ExportUNV( file, /*part=*/nullptr, renumber );
SMESH_CATCH( SMESH::throwCorbaException ); SMESH_CATCH( SMESH::throwCorbaException );
} }
@ -3896,22 +3898,32 @@ void SMESH_Mesh_i::ExportSTL (const char *file, const bool isascii)
SMESH_CATCH( SMESH::throwCorbaException ); SMESH_CATCH( SMESH::throwCorbaException );
} }
//================================================================================
class MEDFileSpeCls class MEDFileSpeCls
{ {
public: public:
MEDFileSpeCls(const char *file, CORBA::Boolean overwrite, CORBA::Long version):_file(file),_overwrite(overwrite),_version(version) { } MEDFileSpeCls(const char * file,
std::string prepareMeshNameAndGroups(SMESH_Mesh_i& self) { return self.prepareMeshNameAndGroups(_file.c_str(),_overwrite); } CORBA::Boolean overwrite,
void exportTo(SMESH_Mesh *mesh, const std::string& aMeshName, CORBA::Boolean auto_groups, CORBA::Long version)
SMESH_MeshPartDS* partDS, :_file(file), _overwrite(overwrite), _version(version)
CORBA::Boolean autoDimension, bool have0dField, {}
CORBA::Double ZTolerance) std::string prepareMeshNameAndGroups(SMESH_Mesh_i& self)
{ {
mesh->ExportMED( _file.c_str(), aMeshName.c_str(), auto_groups, _version, return self.prepareMeshNameAndGroups(_file.c_str(),_overwrite);
partDS, autoDimension,have0dField,ZTolerance);
} }
void exportField(SMESH_Mesh_i& self, const std::string& aMeshName, bool have0dField, SMESHDS_Mesh *meshDS, const GEOM::ListOfFields& fields, const char*geomAssocFields) void exportTo(SMESH_Mesh *mesh, const std::string& aMeshName, CORBA::Boolean auto_groups,
SMESH_MeshPartDS* partDS, CORBA::Boolean autoDimension, bool have0dField,
CORBA::Double ZTolerance, CORBA::Boolean saveNumbers )
{
mesh->ExportMED( _file.c_str(), aMeshName.c_str(), auto_groups, _version,
partDS, autoDimension, have0dField, ZTolerance, saveNumbers );
}
void exportField(SMESH_Mesh_i& self, const std::string& aMeshName, bool have0dField,
SMESHDS_Mesh *meshDS, const GEOM::ListOfFields& fields,
const char*geomAssocFields)
{ {
DriverMED_W_Field fieldWriter; DriverMED_W_Field fieldWriter;
fieldWriter.SetFile( _file.c_str() ); fieldWriter.SetFile( _file.c_str() );
@ -3921,21 +3933,28 @@ public:
} }
void prepareForWriting(SMESH_Mesh_i& self) { self.PrepareForWriting(_file.c_str(), _overwrite); } void prepareForWriting(SMESH_Mesh_i& self) { self.PrepareForWriting(_file.c_str(), _overwrite); }
private: private:
std::string _file; std::string _file;
CORBA::Boolean _overwrite; CORBA::Boolean _overwrite;
CORBA::Long _version; CORBA::Long _version;
}; };
//================================================================================
/*!
* \brief Export a part of mesh to a med file
*/
//================================================================================
template<class SPECLS> template<class SPECLS>
void SMESH_Mesh_i::ExportPartToMEDCommon(SPECLS& speCls, void SMESH_Mesh_i::ExportPartToMEDCommon(SPECLS& speCls,
SMESH::SMESH_IDSource_ptr meshPart, SMESH::SMESH_IDSource_ptr meshPart,
CORBA::Boolean auto_groups, CORBA::Boolean auto_groups,
CORBA::Boolean autoDimension, CORBA::Boolean autoDimension,
const GEOM::ListOfFields& fields, const GEOM::ListOfFields& fields,
const char* geomAssocFields, const char* geomAssocFields,
CORBA::Double ZTolerance) CORBA::Double ZTolerance,
CORBA::Boolean saveNumbers)
{ {
SMESH_TRY; SMESH_TRY;
if ( _preMeshInfo ) if ( _preMeshInfo )
@ -3958,8 +3977,7 @@ void SMESH_Mesh_i::ExportPartToMEDCommon(SPECLS& speCls,
if ( fieldShape->_is_nil() ) if ( fieldShape->_is_nil() )
THROW_SALOME_CORBA_EXCEPTION( "Null shape under a field", SALOME::INTERNAL_ERROR ); THROW_SALOME_CORBA_EXCEPTION( "Null shape under a field", SALOME::INTERNAL_ERROR );
if ( !fieldShape->IsSame( shapeToMesh ) ) if ( !fieldShape->IsSame( shapeToMesh ) )
THROW_SALOME_CORBA_EXCEPTION THROW_SALOME_CORBA_EXCEPTION( "Field defined not on shape", SALOME::BAD_PARAM);
( "Field defined not on shape", SALOME::BAD_PARAM);
if ( fields[i]->GetDimension() == 0 ) if ( fields[i]->GetDimension() == 0 )
have0dField = true; have0dField = true;
} }
@ -3983,7 +4001,8 @@ void SMESH_Mesh_i::ExportPartToMEDCommon(SPECLS& speCls,
SMESH::DownCast< SMESH_Mesh_i* >( meshPart )) SMESH::DownCast< SMESH_Mesh_i* >( meshPart ))
{ {
aMeshName = speCls.prepareMeshNameAndGroups(*this); aMeshName = speCls.prepareMeshNameAndGroups(*this);
speCls.exportTo(_impl, aMeshName, auto_groups, nullptr, autoDimension, have0dField, ZTolerance); speCls.exportTo(_impl, aMeshName, auto_groups, nullptr, autoDimension,
have0dField, ZTolerance, saveNumbers );
meshDS = _impl->GetMeshDS(); meshDS = _impl->GetMeshDS();
} }
else else
@ -4000,7 +4019,8 @@ void SMESH_Mesh_i::ExportPartToMEDCommon(SPECLS& speCls,
} }
SMESH_MeshPartDS* partDS = new SMESH_MeshPartDS( meshPart ); SMESH_MeshPartDS* partDS = new SMESH_MeshPartDS( meshPart );
speCls.exportTo(_impl, aMeshName, auto_groups, partDS, autoDimension, have0dField, ZTolerance); speCls.exportTo(_impl, aMeshName, auto_groups, partDS, autoDimension,
have0dField, ZTolerance, saveNumbers);
meshDS = tmpDSDeleter._obj = partDS; meshDS = tmpDSDeleter._obj = partDS;
} }
@ -4008,7 +4028,7 @@ void SMESH_Mesh_i::ExportPartToMEDCommon(SPECLS& speCls,
if ( _impl->HasShapeToMesh() ) if ( _impl->HasShapeToMesh() )
{ {
speCls.exportField(*this,aMeshName,have0dField,meshDS,fields,geomAssocFields); speCls.exportField( *this, aMeshName, have0dField, meshDS, fields, geomAssocFields);
} }
SMESH_CATCH( SMESH::throwCorbaException ); SMESH_CATCH( SMESH::throwCorbaException );
} }
@ -4027,11 +4047,14 @@ void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
CORBA::Boolean autoDimension, CORBA::Boolean autoDimension,
const GEOM::ListOfFields& fields, const GEOM::ListOfFields& fields,
const char* geomAssocFields, const char* geomAssocFields,
CORBA::Double ZTolerance) CORBA::Double ZTolerance,
CORBA::Boolean saveNumbers)
{ {
MESSAGE("MED version: "<< version); MESSAGE("MED version: "<< version);
MEDFileSpeCls spe(file,overwrite,version);
this->ExportPartToMEDCommon<MEDFileSpeCls>(spe,meshPart,auto_groups,autoDimension,fields,geomAssocFields,ZTolerance); MEDFileSpeCls spe( file, overwrite, version );
this->ExportPartToMEDCommon( spe, meshPart, auto_groups, autoDimension, fields,
geomAssocFields, ZTolerance, saveNumbers );
// dump // dump
SMESH_TRY; SMESH_TRY;
GEOM::ListOfGBO_var goList = new GEOM::ListOfGBO; GEOM::ListOfGBO_var goList = new GEOM::ListOfGBO;
@ -4050,24 +4073,31 @@ void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
<< autoDimension << ", " << autoDimension << ", "
<< goList << ", '" << goList << ", '"
<< ( geomAssocFields ? geomAssocFields : "" ) << "'," << ( geomAssocFields ? geomAssocFields : "" ) << "',"
<< TVar( ZTolerance ) << TVar( ZTolerance ) << ", "
<< saveNumbers
<< " )"; << " )";
SMESH_CATCH( SMESH::throwCorbaException ); SMESH_CATCH( SMESH::throwCorbaException );
} }
//================================================================================
class MEDFileMemSpeCls class MEDFileMemSpeCls
{ {
public: public:
std::string prepareMeshNameAndGroups(SMESH_Mesh_i& self) { return self.generateMeshName(); } std::string prepareMeshNameAndGroups(SMESH_Mesh_i& self) { return self.generateMeshName(); }
void exportTo(SMESH_Mesh *mesh, const std::string& aMeshName, CORBA::Boolean auto_groups, void exportTo(SMESH_Mesh *mesh, const std::string& aMeshName, CORBA::Boolean auto_groups,
SMESH_MeshPartDS* partDS, SMESH_MeshPartDS* partDS, CORBA::Boolean autoDimension, bool have0dField,
CORBA::Boolean autoDimension, bool have0dField, CORBA::Double ZTolerance, CORBA::Boolean saveNumbers )
CORBA::Double ZTolerance)
{ {
_res = mesh->ExportMEDCoupling(aMeshName.c_str(),auto_groups,partDS,autoDimension,have0dField,ZTolerance); _res = mesh->ExportMEDCoupling(aMeshName.c_str(), auto_groups, partDS,
autoDimension, have0dField, ZTolerance, saveNumbers );
} }
void prepareForWriting(SMESH_Mesh_i& self) { /* nothing here */ } void prepareForWriting(SMESH_Mesh_i& /*self*/) { /* nothing here */ }
void exportField(SMESH_Mesh_i& self, const std::string& aMeshName, bool have0dField, SMESHDS_Mesh *meshDS, const GEOM::ListOfFields& fields, const char*geomAssocFields)
void exportField(SMESH_Mesh_i& self, const std::string& aMeshName, bool have0dField,
SMESHDS_Mesh *meshDS, const GEOM::ListOfFields& fields,
const char*geomAssocFields)
{ {
DriverMED_W_Field_Mem fieldWriter(_res); DriverMED_W_Field_Mem fieldWriter(_res);
fieldWriter.SetMeshName( aMeshName ); fieldWriter.SetMeshName( aMeshName );
@ -4077,25 +4107,38 @@ public:
} }
public: public:
MEDCoupling::MCAuto<MEDCoupling::DataArrayByte> getData() { return _res; } MEDCoupling::MCAuto<MEDCoupling::DataArrayByte> getData() { return _res; }
private: private:
MEDCoupling::MCAuto<MEDCoupling::DataArrayByte> _res; MEDCoupling::MCAuto<MEDCoupling::DataArrayByte> _res;
}; };
//================================================================================
/*!
* \brief Export a part of mesh to a MEDCoupling DS
*/
//================================================================================
CORBA::LongLong SMESH_Mesh_i::ExportPartToMEDCoupling(SMESH::SMESH_IDSource_ptr meshPart, CORBA::LongLong SMESH_Mesh_i::ExportPartToMEDCoupling(SMESH::SMESH_IDSource_ptr meshPart,
CORBA::Boolean auto_groups, CORBA::Boolean auto_groups,
CORBA::Boolean autoDimension, CORBA::Boolean autoDimension,
const GEOM::ListOfFields& fields, const GEOM::ListOfFields& fields,
const char* geomAssocFields, const char* geomAssocFields,
CORBA::Double ZTolerance) CORBA::Double ZTolerance,
CORBA::Boolean saveNumbers)
{ {
MEDCoupling::MCAuto<MEDCoupling::DataArrayByte> data; MEDCoupling::MCAuto<MEDCoupling::DataArrayByte> data;
SMESH_TRY; SMESH_TRY;
if( !this->_gen_i->isSSLMode() ) if( !this->_gen_i->isSSLMode() )
SMESH::throwCorbaException("SMESH_Mesh_i::ExportPartToMEDCoupling : only for embedded mode !"); SMESH::throwCorbaException("SMESH_Mesh_i::ExportPartToMEDCoupling : only for embedded mode !");
MEDFileMemSpeCls spe; MEDFileMemSpeCls spe;
this->ExportPartToMEDCommon<MEDFileMemSpeCls>(spe,meshPart,auto_groups,autoDimension,fields,geomAssocFields,ZTolerance); this->ExportPartToMEDCommon( spe, meshPart, auto_groups, autoDimension, fields, geomAssocFields,
ZTolerance, saveNumbers );
data = spe.getData(); data = spe.getData();
SMESH_CATCH( SMESH::throwCorbaException ); SMESH_CATCH( SMESH::throwCorbaException );
MEDCoupling::DataArrayByte *ret(data.retn()); MEDCoupling::DataArrayByte *ret(data.retn());
return reinterpret_cast<CORBA::LongLong>(ret); return reinterpret_cast<CORBA::LongLong>(ret);
} }
@ -4375,20 +4418,17 @@ void SMESH_Mesh_i::exportMEDFields( DriverMED_W_Field& fieldWriter,
*/ */
//================================================================================ //================================================================================
void SMESH_Mesh_i::ExportPartToDAT(::SMESH::SMESH_IDSource_ptr meshPart, void SMESH_Mesh_i::ExportPartToDAT(SMESH::SMESH_IDSource_ptr meshPart,
const char* file) const char* file,
CORBA::Boolean renumber )
{ {
SMESH_TRY; SMESH_TRY;
if ( _preMeshInfo )
_preMeshInfo->FullLoadFromFile();
PrepareForWriting(file);
SMESH_MeshPartDS partDS( meshPart ); SMESH_MeshPartDS partDS( meshPart );
_impl->ExportDAT(file,&partDS); _impl->ExportDAT( file, &partDS, renumber );
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) TPythonDump() << SMESH::SMESH_Mesh_var(_this())
<< ".ExportPartToDAT( " << meshPart << ", r'" << file << "' )"; << ".ExportPartToDAT( " << meshPart << ", r'" << file << ", " << renumber << "' )";
SMESH_CATCH( SMESH::throwCorbaException ); SMESH_CATCH( SMESH::throwCorbaException );
} }
@ -4398,8 +4438,9 @@ void SMESH_Mesh_i::ExportPartToDAT(::SMESH::SMESH_IDSource_ptr meshPart,
*/ */
//================================================================================ //================================================================================
void SMESH_Mesh_i::ExportPartToUNV(::SMESH::SMESH_IDSource_ptr meshPart, void SMESH_Mesh_i::ExportPartToUNV(SMESH::SMESH_IDSource_ptr meshPart,
const char* file) const char* file,
CORBA::Boolean renumber)
{ {
SMESH_TRY; SMESH_TRY;
if ( _preMeshInfo ) if ( _preMeshInfo )
@ -4408,10 +4449,10 @@ void SMESH_Mesh_i::ExportPartToUNV(::SMESH::SMESH_IDSource_ptr meshPart,
PrepareForWriting(file); PrepareForWriting(file);
SMESH_MeshPartDS partDS( meshPart ); SMESH_MeshPartDS partDS( meshPart );
_impl->ExportUNV(file, &partDS); _impl->ExportUNV(file, &partDS, renumber );
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) TPythonDump() << SMESH::SMESH_Mesh_var(_this())
<< ".ExportPartToUNV( " << meshPart<< ", r'" << file << "' )"; << ".ExportPartToUNV( " << meshPart<< ", r'" << file << ", " << renumber << "' )";
SMESH_CATCH( SMESH::throwCorbaException ); SMESH_CATCH( SMESH::throwCorbaException );
} }
@ -5453,7 +5494,7 @@ SMESH::smIdType_array* SMESH_Mesh_i::GetElemNodes(const SMESH::smIdType id)
if ( const SMDS_MeshElement* elem = aMeshDS->FindElement(id) ) if ( const SMDS_MeshElement* elem = aMeshDS->FindElement(id) )
{ {
aResult->length( elem->NbNodes() ); aResult->length( elem->NbNodes() );
for ( SMESH::smIdType i = 0; i < aResult->length(); ++i ) for ( CORBA::ULong i = 0; i < aResult->length(); ++i )
if ( const SMDS_MeshNode* n = elem->GetNode( i )) if ( const SMDS_MeshNode* n = elem->GetNode( i ))
aResult[ i ] = n->GetID(); aResult[ i ] = n->GetID();
} }
@ -5577,7 +5618,7 @@ SMESH::smIdType_array* SMESH_Mesh_i::GetElemFaceNodes(SMESH::smIdType elemId,
{ {
aResult->length( vtool.NbFaceNodes( faceIndex )); aResult->length( vtool.NbFaceNodes( faceIndex ));
const SMDS_MeshNode** nn = vtool.GetFaceNodes( faceIndex ); const SMDS_MeshNode** nn = vtool.GetFaceNodes( faceIndex );
for ( SMESH::smIdType i = 0; i < aResult->length(); ++i ) for ( CORBA::ULong i = 0; i < aResult->length(); ++i )
aResult[ i ] = nn[ i ]->GetID(); aResult[ i ] = nn[ i ]->GetID();
} }
} }
@ -5660,7 +5701,7 @@ SMESH::smIdType_array* SMESH_Mesh_i::GetElementsByNodes(const SMESH::smIdType_ar
if ( SMESHDS_Mesh* mesh = _impl->GetMeshDS() ) if ( SMESHDS_Mesh* mesh = _impl->GetMeshDS() )
{ {
vector< const SMDS_MeshNode * > nn( nodes.length() ); vector< const SMDS_MeshNode * > nn( nodes.length() );
for ( SMESH::smIdType i = 0; i < nodes.length(); ++i ) for ( CORBA::ULong i = 0; i < nodes.length(); ++i )
nn[i] = mesh->FindNode( nodes[i] ); nn[i] = mesh->FindNode( nodes[i] );
std::vector<const SMDS_MeshElement *> elems; std::vector<const SMDS_MeshElement *> elems;

View File

@ -212,14 +212,13 @@ public:
CORBA::Boolean overwrite, CORBA::Boolean overwrite,
CORBA::Boolean autoDimension = true); CORBA::Boolean autoDimension = true);
CORBA::LongLong ExportMEDCoupling(CORBA::Boolean auto_groups, CORBA::LongLong ExportMEDCoupling(CORBA::Boolean auto_groups,
CORBA::Boolean autoDimension = true CORBA::Boolean autoDimension = true);
);
void ExportSAUV( const char* file, CORBA::Boolean auto_groups ); void ExportSAUV( const char* file, CORBA::Boolean auto_groups );
void ExportDAT( const char* file ); void ExportDAT( const char* file, const CORBA::Boolean renumber );
void ExportUNV( const char* file ); void ExportUNV( const char* file, const CORBA::Boolean renumber );
void ExportSTL( const char* file, bool isascii ); void ExportSTL( const char* file, bool isascii );
void ExportCGNS(SMESH::SMESH_IDSource_ptr meshPart, void ExportCGNS(SMESH::SMESH_IDSource_ptr meshPart,
const char* file, const char* file,
@ -231,13 +230,14 @@ public:
template<class SPECLS> template<class SPECLS>
void ExportPartToMEDCommon(SPECLS& speCls, void ExportPartToMEDCommon(SPECLS& speCls,
SMESH::SMESH_IDSource_ptr meshPart, SMESH::SMESH_IDSource_ptr meshPart,
CORBA::Boolean auto_groups, CORBA::Boolean auto_groups,
CORBA::Boolean autoDim, CORBA::Boolean autoDim,
const GEOM::ListOfFields& fields, const GEOM::ListOfFields& fields,
const char* geomAssocFields, const char* geomAssocFields,
CORBA::Double ZTolerance); CORBA::Double ZTolerance,
CORBA::Boolean saveNumbers );
void ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart, void ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
const char* file, const char* file,
@ -247,19 +247,23 @@ public:
CORBA::Boolean autoDim, CORBA::Boolean autoDim,
const GEOM::ListOfFields& fields, const GEOM::ListOfFields& fields,
const char* geomAssocFields, const char* geomAssocFields,
CORBA::Double ZTolerance); CORBA::Double ZTolerance,
CORBA::Boolean saveNumbers );
CORBA::LongLong ExportPartToMEDCoupling(SMESH::SMESH_IDSource_ptr meshPart, CORBA::LongLong ExportPartToMEDCoupling(SMESH::SMESH_IDSource_ptr meshPart,
CORBA::Boolean auto_groups, CORBA::Boolean auto_groups,
CORBA::Boolean autoDim, CORBA::Boolean autoDim,
const GEOM::ListOfFields& fields, const GEOM::ListOfFields& fields,
const char* geomAssocFields, const char* geomAssocFields,
CORBA::Double ZTolerance); CORBA::Double ZTolerance,
CORBA::Boolean saveNumbers);
void ExportPartToDAT(SMESH::SMESH_IDSource_ptr meshPart, void ExportPartToDAT(SMESH::SMESH_IDSource_ptr meshPart,
const char* file); const char* file,
CORBA::Boolean renumber);
void ExportPartToUNV(SMESH::SMESH_IDSource_ptr meshPart, void ExportPartToUNV(SMESH::SMESH_IDSource_ptr meshPart,
const char* file); const char* file,
CORBA::Boolean renumber);
void ExportPartToSTL(SMESH::SMESH_IDSource_ptr meshPart, void ExportPartToSTL(SMESH::SMESH_IDSource_ptr meshPart,
const char* file, const char* file,
CORBA::Boolean isascii); CORBA::Boolean isascii);

View File

@ -286,7 +286,7 @@ SMESH::point_array*
list<const gp_XYZ *> xyzList; list<const gp_XYZ *> xyzList;
set<const SMDS_MeshFace*> fset; set<const SMDS_MeshFace*> fset;
for ( SMESH::smIdType i = 0; i < theFacesIDs.length(); i++) for ( CORBA::ULong i = 0; i < theFacesIDs.length(); i++)
{ {
SMESH::smIdType index = theFacesIDs[i]; SMESH::smIdType index = theFacesIDs[i];
const SMDS_MeshElement * elem = aMesh->GetMeshDS()->FindElement(index); const SMDS_MeshElement * elem = aMesh->GetMeshDS()->FindElement(index);
@ -345,7 +345,7 @@ SMESH::point_array*
list<const gp_XYZ *> xyzList; list<const gp_XYZ *> xyzList;
set<const SMDS_MeshVolume*> vset; set<const SMDS_MeshVolume*> vset;
for ( SMESH::smIdType i = 0; i < theVolumesIDs.length(); i++) for ( CORBA::ULong i = 0; i < theVolumesIDs.length(); i++)
{ {
SMESH::smIdType index = theVolumesIDs[i]; SMESH::smIdType index = theVolumesIDs[i];
const SMDS_MeshElement * elem = aMesh->GetMeshDS()->FindElement(index); const SMDS_MeshElement * elem = aMesh->GetMeshDS()->FindElement(index);

View File

@ -2305,38 +2305,41 @@ class Mesh(metaclass = MeshMeta):
Export the mesh in a memory representation. Export the mesh in a memory representation.
Parameters: Parameters:
auto_groups (boolean): parameter for creating/not creating auto_groups (boolean): parameter for creating/not creating
the groups Group_On_All_Nodes, Group_On_All_Faces, ... ; the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
the typical use is auto_groups=False. the typical use is auto_groups=False.
overwrite (boolean): parameter for overwriting/not overwriting the file overwrite (boolean): parameter for overwriting/not overwriting the file
meshPart: a part of mesh (:class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`) to export instead of the mesh meshPart: a part of mesh (:class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`)
autoDimension: if *True* (default), a space dimension of a MED mesh can be either to export instead of the mesh
autoDimension: if *True* (default), a space dimension of a MED mesh can be either
- 1D if all mesh nodes lie on OX coordinate axis, or - 1D if all mesh nodes lie on OX coordinate axis, or
- 2D if all mesh nodes lie on XOY coordinate plane, or - 2D if all mesh nodes lie on XOY coordinate plane, or
- 3D in the rest cases. - 3D in the rest cases.
If *autoDimension* is *False*, the space dimension is always 3. If *autoDimension* is *False*, the space dimension is always 3.
fields: list of GEOM fields defined on the shape to mesh. fields: list of GEOM fields defined on the shape to mesh.
geomAssocFields: each character of this string means a need to export a geomAssocFields: each character of this string means a need to export a
corresponding field; correspondence between fields and characters corresponding field; correspondence between fields and characters
is following: is following:
- 'v' stands for "_vertices_" field; - 'v' stands for "_vertices_" field;
- 'e' stands for "_edges_" field; - 'e' stands for "_edges_" field;
- 'f' stands for "_faces_" field; - 'f' stands for "_faces_" field;
- 's' stands for "_solids_" field. - 's' stands for "_solids_" field.
zTolerance (float): tolerance in Z direction. If Z coordinate of a node is zTolerance (float): tolerance in Z direction. If Z coordinate of a node is
close to zero within a given tolerance, the coordinate is set to zero. close to zero within a given tolerance, the coordinate is set to zero.
If *ZTolerance* is negative (default), the node coordinates are kept as is. If *ZTolerance* is negative (default), the node coordinates are kept as is.
""" saveNumbers(boolean) : enable saving numbers of nodes and cells.
"""
auto_groups = args[0] if len(args) > 0 else False auto_groups = args[0] if len(args) > 0 else False
meshPart = args[1] if len(args) > 1 else None meshPart = args[1] if len(args) > 1 else None
autoDimension = args[2] if len(args) > 2 else True autoDimension = args[2] if len(args) > 2 else True
fields = args[3] if len(args) > 3 else [] fields = args[3] if len(args) > 3 else []
geomAssocFields = args[4] if len(args) > 4 else '' geomAssocFields = args[4] if len(args) > 4 else ''
z_tolerance = args[5] if len(args) > 5 else -1. z_tolerance = args[5] if len(args) > 5 else -1.
saveNumbers = args[6] if len(args) > 6 else True
# process keywords arguments # process keywords arguments
auto_groups = kwargs.get("auto_groups", auto_groups) auto_groups = kwargs.get("auto_groups", auto_groups)
meshPart = kwargs.get("meshPart", meshPart) meshPart = kwargs.get("meshPart", meshPart)
@ -2344,9 +2347,10 @@ class Mesh(metaclass = MeshMeta):
fields = kwargs.get("fields", fields) fields = kwargs.get("fields", fields)
geomAssocFields = kwargs.get("geomAssocFields", geomAssocFields) geomAssocFields = kwargs.get("geomAssocFields", geomAssocFields)
z_tolerance = kwargs.get("zTolerance", z_tolerance) z_tolerance = kwargs.get("zTolerance", z_tolerance)
saveNumbers = kwargs.get("saveNumbers", saveNumbers)
# invoke engine's function # invoke engine's function
if meshPart or fields or geomAssocFields or z_tolerance > 0: if meshPart or fields or geomAssocFields or z_tolerance > 0 or not saveNumbers:
unRegister = genObjUnRegister() unRegister = genObjUnRegister()
if isinstance( meshPart, list ): if isinstance( meshPart, list ):
meshPart = self.GetIDSource( meshPart, SMESH.ALL ) meshPart = self.GetIDSource( meshPart, SMESH.ALL )
@ -2355,7 +2359,9 @@ class Mesh(metaclass = MeshMeta):
z_tolerance,Parameters,hasVars = ParseParameters(z_tolerance) z_tolerance,Parameters,hasVars = ParseParameters(z_tolerance)
self.mesh.SetParameters(Parameters) self.mesh.SetParameters(Parameters)
intPtr = self.mesh.ExportPartToMEDCoupling(meshPart, auto_groups, autoDimension, fields, geomAssocFields, z_tolerance) intPtr = self.mesh.ExportPartToMEDCoupling(meshPart, auto_groups, autoDimension,
fields, geomAssocFields, z_tolerance,
saveNumbers )
import medcoupling import medcoupling
dab = medcoupling.FromPyIntPtrToDataArrayByte(intPtr) dab = medcoupling.FromPyIntPtrToDataArrayByte(intPtr)
return medcoupling.MEDFileData.New(dab) return medcoupling.MEDFileData.New(dab)
@ -2383,7 +2389,8 @@ class Mesh(metaclass = MeshMeta):
or 3.2.1 or 3.3.1 formats. or 3.2.1 or 3.3.1 formats.
If the version is equal to -1, the version is not changed (default). If the version is equal to -1, the version is not changed (default).
overwrite (boolean): parameter for overwriting/not overwriting the file overwrite (boolean): parameter for overwriting/not overwriting the file
meshPart: a part of mesh (:class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`) to export instead of the mesh meshPart: a part of mesh (:class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`)
to export instead of the mesh
autoDimension: if *True* (default), a space dimension of a MED mesh can be either autoDimension: if *True* (default), a space dimension of a MED mesh can be either
- 1D if all mesh nodes lie on OX coordinate axis, or - 1D if all mesh nodes lie on OX coordinate axis, or
@ -2404,6 +2411,7 @@ class Mesh(metaclass = MeshMeta):
zTolerance (float): tolerance in Z direction. If Z coordinate of a node is zTolerance (float): tolerance in Z direction. If Z coordinate of a node is
close to zero within a given tolerance, the coordinate is set to zero. close to zero within a given tolerance, the coordinate is set to zero.
If *ZTolerance* is negative (default), the node coordinates are kept as is. If *ZTolerance* is negative (default), the node coordinates are kept as is.
saveNumbers (boolean) : enable saving numbers of nodes and cells.
""" """
# process positional arguments # process positional arguments
#args = [i for i in args if i not in [SMESH.MED_V2_1, SMESH.MED_V2_2]] # backward compatibility #args = [i for i in args if i not in [SMESH.MED_V2_1, SMESH.MED_V2_2]] # backward compatibility
@ -2416,6 +2424,7 @@ class Mesh(metaclass = MeshMeta):
fields = args[6] if len(args) > 6 else [] fields = args[6] if len(args) > 6 else []
geomAssocFields = args[7] if len(args) > 7 else '' geomAssocFields = args[7] if len(args) > 7 else ''
z_tolerance = args[8] if len(args) > 8 else -1. z_tolerance = args[8] if len(args) > 8 else -1.
saveNumbers = args[9] if len(args) > 9 else True
# process keywords arguments # process keywords arguments
auto_groups = kwargs.get("auto_groups", auto_groups) auto_groups = kwargs.get("auto_groups", auto_groups)
version = kwargs.get("version", version) version = kwargs.get("version", version)
@ -2426,9 +2435,13 @@ class Mesh(metaclass = MeshMeta):
fields = kwargs.get("fields", fields) fields = kwargs.get("fields", fields)
geomAssocFields = kwargs.get("geomAssocFields", geomAssocFields) geomAssocFields = kwargs.get("geomAssocFields", geomAssocFields)
z_tolerance = kwargs.get("zTolerance", z_tolerance) z_tolerance = kwargs.get("zTolerance", z_tolerance)
saveNumbers = kwargs.get("saveNumbers", saveNumbers)
if isinstance( meshPart, Mesh):
meshPart = meshPart.GetMesh()
# invoke engine's function # invoke engine's function
if meshPart or fields or geomAssocFields or z_tolerance > 0: if meshPart or fields or geomAssocFields or z_tolerance > 0 or not saveNumbers:
unRegister = genObjUnRegister() unRegister = genObjUnRegister()
if isinstance( meshPart, list ): if isinstance( meshPart, list ):
meshPart = self.GetIDSource( meshPart, SMESH.ALL ) meshPart = self.GetIDSource( meshPart, SMESH.ALL )
@ -2439,7 +2452,7 @@ class Mesh(metaclass = MeshMeta):
self.mesh.ExportPartToMED( meshPart, fileName, auto_groups, self.mesh.ExportPartToMED( meshPart, fileName, auto_groups,
version, overwrite, autoDimension, version, overwrite, autoDimension,
fields, geomAssocFields, z_tolerance) fields, geomAssocFields, z_tolerance, saveNumbers )
else: else:
self.mesh.ExportMED(fileName, auto_groups, version, overwrite, autoDimension) self.mesh.ExportMED(fileName, auto_groups, version, overwrite, autoDimension)
@ -2457,41 +2470,43 @@ class Mesh(metaclass = MeshMeta):
self.mesh.ExportSAUV(f, auto_groups) self.mesh.ExportSAUV(f, auto_groups)
def ExportDAT(self, f, meshPart=None): def ExportDAT(self, f, meshPart=None, renumber=True):
""" """
Export the mesh in a file in DAT format Export the mesh in a file in DAT format
Parameters: Parameters:
f: the file name f: the file name
meshPart: a part of mesh (:class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`) to export instead of the mesh meshPart: a part of mesh (:class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`) to export instead of the mesh
renumber(boolean): enable renumbering nodes and cells in order to eliminate holes in numbering
""" """
if meshPart: if meshPart or not renumber:
unRegister = genObjUnRegister() unRegister = genObjUnRegister()
if isinstance( meshPart, list ): if isinstance( meshPart, list ):
meshPart = self.GetIDSource( meshPart, SMESH.ALL ) meshPart = self.GetIDSource( meshPart, SMESH.ALL )
unRegister.set( meshPart ) unRegister.set( meshPart )
self.mesh.ExportPartToDAT( meshPart, f ) self.mesh.ExportPartToDAT( meshPart, f, renumber )
else: else:
self.mesh.ExportDAT(f) self.mesh.ExportDAT( f, renumber )
def ExportUNV(self, f, meshPart=None): def ExportUNV(self, f, meshPart=None, renumber=True):
""" """
Export the mesh in a file in UNV format Export the mesh in a file in UNV format
Parameters: Parameters:
f: the file name f: the file name
meshPart: a part of mesh (:class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`) to export instead of the mesh meshPart: a part of mesh (:class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`) to export instead of the mesh
renumber(boolean): enable renumbering nodes and cells in order to eliminate holes in numbering
""" """
if meshPart: if meshPart or not renumber:
unRegister = genObjUnRegister() unRegister = genObjUnRegister()
if isinstance( meshPart, list ): if isinstance( meshPart, list ):
meshPart = self.GetIDSource( meshPart, SMESH.ALL ) meshPart = self.GetIDSource( meshPart, SMESH.ALL )
unRegister.set( meshPart ) unRegister.set( meshPart )
self.mesh.ExportPartToUNV( meshPart, f ) self.mesh.ExportPartToUNV( meshPart, f, renumber )
else: else:
self.mesh.ExportUNV(f) self.mesh.ExportUNV( f, renumber )
def ExportSTL(self, f, ascii=1, meshPart=None): def ExportSTL(self, f, ascii=1, meshPart=None):
""" """
@ -7454,6 +7469,14 @@ class meshProxy(SMESH._objref_SMESH_Mesh):
while len(args2) < 5: # !!!! nb of parameters for ExportToMED IDL's method while len(args2) < 5: # !!!! nb of parameters for ExportToMED IDL's method
args2.append(True) args2.append(True)
SMESH._objref_SMESH_Mesh.ExportMED(self, *args2) SMESH._objref_SMESH_Mesh.ExportMED(self, *args2)
def ExportUNV(self, *args): # renumber arg added
if len( args ) == 1:
args += True,
return SMESH._objref_SMESH_Mesh.ExportUNV(self, *args)
def ExportDAT(self, *args): # renumber arg added
if len( args ) == 1:
args += True,
return SMESH._objref_SMESH_Mesh.ExportDAT(self, *args)
pass pass
omniORB.registerObjref(SMESH._objref_SMESH_Mesh._NP_RepositoryId, meshProxy) omniORB.registerObjref(SMESH._objref_SMESH_Mesh._NP_RepositoryId, meshProxy)

View File

@ -99,7 +99,7 @@ namespace
{ {
TmpMesh() { TmpMesh() {
_isShapeToMesh = (_id = 0); _isShapeToMesh = (_id = 0);
_myMeshDS = new SMESHDS_Mesh( _id, true ); _meshDS = new SMESHDS_Mesh( _id, true );
} }
}; };
//======================================================================= //=======================================================================

View File

@ -240,7 +240,7 @@ namespace
{ {
TmpMesh() TmpMesh()
{ {
_myMeshDS = new SMESHDS_Mesh(/*id=*/0, /*isEmbeddedMode=*/true); _meshDS = new SMESHDS_Mesh(/*id=*/0, /*isEmbeddedMode=*/true);
} }
}; };

View File

@ -53,7 +53,7 @@ class STDMESHERSGUI_EXPORT StdMeshersGUI_ObjectReferenceParamWdg : public QWidge
{ {
Q_OBJECT Q_OBJECT
public: public:
StdMeshersGUI_ObjectReferenceParamWdg( SUIT_SelectionFilter* filter, StdMeshersGUI_ObjectReferenceParamWdg( SUIT_SelectionFilter* filter,
QWidget* parent, QWidget* parent,
bool multiSelection=false bool multiSelection=false
@ -75,6 +75,7 @@ public:
size_t NbObjects() const { return myObjects.size(); } size_t NbObjects() const { return myObjects.size(); }
// Return object entries
QString GetValue() const { return myParamValue; } QString GetValue() const { return myParamValue; }
bool IsObjectSelected(size_t i=0) const bool IsObjectSelected(size_t i=0) const
@ -82,10 +83,10 @@ public:
/*! /*!
* \brief Get the selection status * \brief Get the selection status
* *
* Useful to know which Object Reference param widget is activated * Useful to know which Object Reference param widget is activated
* to be able to activate the next one when the content of this * to be able to activate the next one when the content of this
* one has been modified * one has been modified
*/ */
bool IsSelectionActivated() const { return mySelectionActivated; } bool IsSelectionActivated() const { return mySelectionActivated; }
@ -93,49 +94,49 @@ public:
void SetDefaultText(QString defaultText="", QString styleSheet=""); void SetDefaultText(QString defaultText="", QString styleSheet="");
public slots: public slots:
/*! /*!
* \brief Activates selection (if not yet done), emits selectionActivated() * \brief Activates selection (if not yet done), emits selectionActivated()
* *
* Useful to deactivate one Object Reference param widget when an other * Useful to deactivate one Object Reference param widget when an other
* one is activated * one is activated
*/ */
void activateSelection(); void activateSelection();
void deactivateSelection(); void deactivateSelection();
signals: signals:
/*! /*!
* \brief Emitted when selection is activated * \brief Emitted when selection is activated
* *
* Useful to deactivate one Object Reference param widget when an other * Useful to deactivate one Object Reference param widget when an other
* one is activated * one is activated
*/ */
void selectionActivated(); void selectionActivated();
void contentModified(); void contentModified();
private slots: private slots:
void onSelectionDone(); void onSelectionDone();
private: private:
void init(); void init();
private: private:
bool myMultiSelection; bool myMultiSelection;
std::vector<CORBA::Object_var> myObjects; std::vector<CORBA::Object_var> myObjects;
SUIT_SelectionFilter* myFilter; SUIT_SelectionFilter* myFilter;
bool mySelectionActivated; bool mySelectionActivated;
bool myStretchActivated; bool myStretchActivated;
SMESHGUI* mySMESHGUI; SMESHGUI* mySMESHGUI;
LightApp_SelectionMgr* mySelectionMgr; LightApp_SelectionMgr* mySelectionMgr;
QLineEdit* myObjNameLineEdit; QLineEdit* myObjNameLineEdit;
QPushButton* mySelButton; QPushButton* mySelButton;
QString myParamValue; QString myParamValue;
QString myEmptyText; QString myEmptyText;
QString myEmptyStyleSheet; QString myEmptyStyleSheet;
}; };
#endif // STDMESHERSGUI_OBJECTREFERENCEPARAMWDG_H #endif // STDMESHERSGUI_OBJECTREFERENCEPARAMWDG_H