mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-23 23:30:33 +05:00
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:
parent
ad1d7c52f7
commit
88ff35ddd4
@ -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.
|
||||
* **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.
|
||||
|
||||
|
||||
|
@ -54,6 +54,10 @@ General Preferences
|
||||
|
||||
* **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:
|
||||
|
||||
* **Z tolerance for MED export** - defines Z tolerance in :ref:`MED Export <export_auto_groups>` dialog.
|
||||
|
@ -693,6 +693,7 @@ module SMESH
|
||||
* - 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.
|
||||
* 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,
|
||||
in string fileName,
|
||||
@ -702,14 +703,16 @@ module SMESH
|
||||
in boolean autoDimension,
|
||||
in GEOM::ListOfFields fields,
|
||||
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,
|
||||
in boolean auto_groups,
|
||||
in boolean autoDimension,
|
||||
in GEOM::ListOfFields fields,
|
||||
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
|
||||
@ -733,8 +736,10 @@ module SMESH
|
||||
* Export Mesh to different Formats
|
||||
* (UNV supported version is I-DEAS 10)
|
||||
*/
|
||||
void ExportDAT( in string file ) raises (SALOME::SALOME_Exception);
|
||||
void ExportUNV( in string file ) raises (SALOME::SALOME_Exception);
|
||||
void ExportDAT( in string file,
|
||||
in boolean renumer) raises (SALOME::SALOME_Exception);
|
||||
void ExportUNV( in string file,
|
||||
in boolean renumer ) raises (SALOME::SALOME_Exception);
|
||||
void ExportSTL( in string file,
|
||||
in boolean isascii ) raises (SALOME::SALOME_Exception);
|
||||
void ExportCGNS( in SMESH_IDSource meshPart,
|
||||
@ -745,9 +750,11 @@ module SMESH
|
||||
in string file,
|
||||
in boolean withRequiredGroups) raises (SALOME::SALOME_Exception);
|
||||
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,
|
||||
in string file ) raises (SALOME::SALOME_Exception);
|
||||
in string file,
|
||||
in boolean renumer ) raises (SALOME::SALOME_Exception);
|
||||
void ExportPartToSTL( in SMESH_IDSource meshPart,
|
||||
in string file,
|
||||
in boolean isascii ) raises (SALOME::SALOME_Exception);
|
||||
@ -1098,7 +1105,7 @@ module SMESH
|
||||
raises (SALOME::SALOME_Exception);
|
||||
|
||||
/*!
|
||||
* Get the internal Id
|
||||
* Get the internal persisten Id
|
||||
*/
|
||||
long GetId();
|
||||
};
|
||||
|
@ -66,6 +66,7 @@
|
||||
<parameter name="auto_groups" value="false"/>
|
||||
<parameter name="med_ztolerance" value="0.0"/>
|
||||
<parameter name="show_warning" value="true"/>
|
||||
<parameter name="med_save_numbers" value="true"/>
|
||||
<parameter name="show_result_notification" value="2"/>
|
||||
<parameter name="mesh_elem_info" value="1"/>
|
||||
<parameter name="elem_info_grp_details" value="false"/>
|
||||
|
@ -32,6 +32,14 @@
|
||||
|
||||
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()
|
||||
{
|
||||
Kernel_Utils::Localizer loc;
|
||||
@ -70,21 +78,24 @@ Driver_Mesh::Status DriverDAT_W_SMDS_Mesh::Perform()
|
||||
SCRUTE(nb_of_volumes);
|
||||
|
||||
//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 *
|
||||
****************************************************************************/
|
||||
|
||||
std::vector< size_t > nodeNumByID;
|
||||
if ( myMesh->HasNumerationHoles() )
|
||||
if ( myRenumber && myMesh->HasNumerationHoles() )
|
||||
nodeNumByID.resize( myMesh->MaxNodeID() + 1 );
|
||||
|
||||
int num;
|
||||
smIdType num;
|
||||
SMDS_NodeIteratorPtr itNodes=myMesh->nodesIterator();
|
||||
for ( num = 1; itNodes->more(); ++num )
|
||||
{
|
||||
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());
|
||||
|
||||
if ( !nodeNumByID.empty() )
|
||||
@ -100,6 +111,9 @@ Driver_Mesh::Status DriverDAT_W_SMDS_Mesh::Perform()
|
||||
for ( SMDS_EdgeIteratorPtr itEdges = myMesh->edgesIterator(); itEdges->more(); ++num )
|
||||
{
|
||||
const SMDS_MeshElement * elem = itEdges->next();
|
||||
if ( !myRenumber )
|
||||
num = elem->GetID();
|
||||
|
||||
fprintf(aFileId, "%d %d ", num, 100 + elem->NbNodes());
|
||||
|
||||
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 )
|
||||
{
|
||||
const SMDS_MeshElement * elem = itFaces->next();
|
||||
if ( !myRenumber )
|
||||
num = elem->GetID();
|
||||
|
||||
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 )
|
||||
{
|
||||
const SMDS_MeshElement * elem = itVolumes->next();
|
||||
if ( !myRenumber )
|
||||
num = elem->GetID();
|
||||
|
||||
if ( elem->IsPoly() )
|
||||
{
|
||||
fprintf(aFileId, "%d %d ", num, 500 + elem->NbNodes());
|
||||
|
@ -34,7 +34,12 @@
|
||||
class MESHDRIVERDAT_EXPORT DriverDAT_W_SMDS_Mesh: public Driver_SMDS_Mesh
|
||||
{
|
||||
public:
|
||||
virtual Status Perform();
|
||||
virtual Status Perform() override;
|
||||
void SetRenumber( bool renumber ) { myRenumber = renumber; }
|
||||
|
||||
private:
|
||||
|
||||
bool myRenumber;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -53,6 +53,12 @@ using namespace std;
|
||||
using namespace MED;
|
||||
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Constructor
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh():
|
||||
myAllSubMeshes (false),
|
||||
myDoGroupOfNodes (false),
|
||||
@ -65,19 +71,31 @@ DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh():
|
||||
myAddODOnVertices(false),
|
||||
myDoAllInGroups(false),
|
||||
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)
|
||||
{
|
||||
myVersion = theVersion;
|
||||
Driver_SMESHDS_Mesh::SetFile(theFileName);
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* MED version is either the latest available, or with an inferior minor,
|
||||
* to ensure backward compatibility on writing med files.
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
string DriverMED_W_SMESHDS_Mesh::GetVersionString(int theMinor, int theNbDigits)
|
||||
{
|
||||
TInt majeur, mineur, release;
|
||||
@ -166,6 +184,12 @@ void DriverMED_W_SMESHDS_Mesh::AddAllToGroup()
|
||||
|
||||
namespace
|
||||
{
|
||||
//---------------------------------------------
|
||||
/*!
|
||||
* \brief Retrieving node coordinates utilities
|
||||
*/
|
||||
//---------------------------------------------
|
||||
|
||||
typedef double (SMDS_MeshNode::* TGetCoord)() const;
|
||||
typedef const char* TName;
|
||||
typedef const char* TUnit;
|
||||
@ -344,12 +368,24 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Write my mesh to a file
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
|
||||
{
|
||||
MED::PWrapper myMed = CrWrapperW(myFile, myVersion);
|
||||
return this->PerformInternal<MED::PWrapper>(myMed);
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Write my mesh to a MEDCoupling DS
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh_Mem::Perform()
|
||||
{
|
||||
void *ptr(nullptr);
|
||||
@ -571,7 +607,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::PerformInternal(LowLevelWriter myM
|
||||
#endif
|
||||
const EModeSwitch theMode = eFULL_INTERLACE;
|
||||
const ERepere theSystem = eCART;
|
||||
const EBooleen theIsElemNum = eVRAI;
|
||||
const EBooleen theIsElemNum = mySaveNumbers ? eVRAI : eFAUX;
|
||||
const EBooleen theIsElemNames = eFAUX;
|
||||
const EConnectivite theConnMode = eNOD;
|
||||
|
||||
|
@ -42,6 +42,9 @@ class SMESHDS_GroupBase;
|
||||
class SMESHDS_SubMesh;
|
||||
class SMDS_MeshElement;
|
||||
|
||||
/*!
|
||||
* \brief Write a mesh to a MED file
|
||||
*/
|
||||
class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
|
||||
{
|
||||
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 SetAutoDimension(bool toFindOutDimension) { myAutoDimension = toFindOutDimension; }
|
||||
void SetZTolerance(double tol) { myZTolerance = tol; }
|
||||
void SetSaveNumbers(bool toSave) { mySaveNumbers = toSave; }
|
||||
|
||||
static std::string GetVersionString(int theMinor, int theNbDigits=2);
|
||||
|
||||
@ -95,10 +99,14 @@ class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
|
||||
bool myDoAllInGroups;
|
||||
int myVersion;
|
||||
double myZTolerance;
|
||||
bool mySaveNumbers;
|
||||
};
|
||||
|
||||
#include "MEDCouplingMemArray.hxx"
|
||||
|
||||
/*!
|
||||
* \brief Write a mesh to a MEDCoupling DS
|
||||
*/
|
||||
class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh_Mem : public DriverMED_W_SMESHDS_Mesh
|
||||
{
|
||||
public:
|
||||
|
@ -55,13 +55,13 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
|
||||
#else
|
||||
std::ofstream out_stream(myFile.c_str());
|
||||
#endif
|
||||
try{
|
||||
|
||||
try
|
||||
{
|
||||
UNV164::Write( out_stream ); // unit system
|
||||
UNV2420::Write( out_stream, myMeshName ); // Coordinate system
|
||||
|
||||
std::vector< size_t > nodeLabelByID;
|
||||
if ( myMesh->HasNumerationHoles() )
|
||||
if ( myMesh->HasNumerationHoles() && myRenumber )
|
||||
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 )
|
||||
{
|
||||
const SMDS_MeshNode* aNode = aNodesIter->next();
|
||||
// aRec.label = aNode->GetID(); -- IPAL54452
|
||||
if ( !myRenumber )
|
||||
aRec.label = aNode->GetID(); //-- IPAL54452
|
||||
if ( !nodeLabelByID.empty() )
|
||||
nodeLabelByID[ aNode->GetID() ] = aRec.label;
|
||||
aRec.coord[0] = aNode->X();
|
||||
@ -105,8 +106,10 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
|
||||
while ( anIter->more() )
|
||||
{
|
||||
const SMDS_MeshEdge* anElem = anIter->next();
|
||||
// aRec.label = anElem->GetID(); -- IPAL54452
|
||||
if ( myRenumber ) // -- IPAL54452
|
||||
++aRec.label;
|
||||
else
|
||||
aRec.label = anElem->GetID();
|
||||
if ( !elemLabelByID.empty() )
|
||||
elemLabelByID[ anElem->GetID() ] = aRec.label;
|
||||
|
||||
@ -138,7 +141,8 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
|
||||
if ( anElem->IsPoly() ) continue;
|
||||
|
||||
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();
|
||||
if ( nodeLabelByID.empty() )
|
||||
aRec.node_labels.push_back( FromSmIdType<int>(aNode->GetID()) );
|
||||
@ -155,8 +159,10 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
// aRec.label = anElem->GetID(); -- IPAL54452
|
||||
if ( myRenumber )
|
||||
++aRec.label;
|
||||
else
|
||||
aRec.label = anElem->GetID(); // -- IPAL54452
|
||||
if ( !elemLabelByID.empty() )
|
||||
elemLabelByID[ anElem->GetID() ] = aRec.label;
|
||||
|
||||
@ -188,8 +194,10 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
// aRec.label = anElem->GetID(); -- IPAL54452
|
||||
++aRec.label;
|
||||
if ( myRenumber )
|
||||
++aRec.label; // -- IPAL54452
|
||||
else
|
||||
aRec.label = anElem->GetID();
|
||||
if ( !elemLabelByID.empty() )
|
||||
elemLabelByID[ anElem->GetID() ] = aRec.label;
|
||||
|
||||
@ -214,7 +222,8 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
|
||||
// --------------------
|
||||
{
|
||||
using namespace UNV2417;
|
||||
if ( myGroups.size() > 0 ) {
|
||||
if ( myGroups.size() > 0 )
|
||||
{
|
||||
TRecord aRec;
|
||||
TDataSet aDataSet2417;
|
||||
TGroupList::const_iterator aIter = myGroups.begin();
|
||||
@ -230,7 +239,7 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
|
||||
while ( aIter->more() ) {
|
||||
const SMDS_MeshElement* aNode = aIter->next();
|
||||
if ( nodeLabelByID.empty() )
|
||||
aRec.NodeList.push_back( FromSmIdType<int>(aNode->GetID()) );
|
||||
aRec.NodeList.push_back( FromSmIdType<int>( aNode->GetID()) );
|
||||
else
|
||||
aRec.NodeList.push_back( nodeLabelByID[ aNode->GetID() ]);
|
||||
}
|
||||
|
@ -39,9 +39,11 @@ class MESHDRIVERUNV_EXPORT DriverUNV_W_SMDS_Mesh: public Driver_SMDS_Mesh
|
||||
virtual Status Perform() override;
|
||||
|
||||
void AddGroup(SMESHDS_GroupBase* theGroup) { myGroups.push_back(theGroup); }
|
||||
void SetRenumber( bool renumber ) { myRenumber = renumber; }
|
||||
|
||||
private:
|
||||
TGroupList myGroups;
|
||||
bool myRenumber;
|
||||
};
|
||||
|
||||
|
||||
|
@ -197,12 +197,12 @@ namespace MED
|
||||
med_int wantedMajor = MED_MAJOR_NUM;
|
||||
med_int wantedMinor = MED_MINOR_NUM;
|
||||
// when non managed version of file is requested : ignore it and take the latest version
|
||||
std::vector<int> versionsOK(GetMEDVersionsAppendCompatible());
|
||||
bool isVersionRequestedOK(std::find(versionsOK.begin(),versionsOK.end(),theVersion)!=versionsOK.end());
|
||||
std::vector<int> versionsOK = GetMEDVersionsAppendCompatible();
|
||||
bool isVersionRequestedOK = std::find(versionsOK.begin(),versionsOK.end(),theVersion)!=versionsOK.end();
|
||||
if (isCreated && isVersionRequestedOK)
|
||||
{
|
||||
wantedMajor = theVersion/10;
|
||||
wantedMinor = theVersion%10;
|
||||
wantedMajor = theVersion / 10;
|
||||
wantedMinor = theVersion % 10;
|
||||
}
|
||||
return new MED::TWrapper(fileName, true, tfileInst, wantedMajor, wantedMinor);
|
||||
}
|
||||
|
@ -141,6 +141,7 @@ namespace MED
|
||||
TElemInfo
|
||||
::SetElemNum(TInt theId, TInt theVal)
|
||||
{
|
||||
if ( IsElemNum() )
|
||||
(*myElemNum)[theId] = theVal;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,8 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include <boost/make_shared.hpp>
|
||||
//#include <boost/make_shared.hpp>
|
||||
#include <boost/container/flat_set.hpp>
|
||||
|
||||
#if !defined WIN32 && !defined __APPLE__
|
||||
#include <sys/sysinfo.h>
|
||||
@ -1063,16 +1064,27 @@ bool SMDS_Mesh::ChangePolyhedronNodes(const SMDS_MeshElement * e
|
||||
// keep current nodes of element
|
||||
std::set<const SMDS_MeshNode*> oldNodes( element->begin_nodes(), element->end_nodes() );
|
||||
|
||||
// change nodes
|
||||
bool Ok = false;
|
||||
|
||||
// change vtkUnstructuredGrid::Faces
|
||||
if ( const SMDS_MeshVolume* vol = DownCast<SMDS_MeshVolume>( element ))
|
||||
Ok = vol->ChangeNodes( nodes, quantities );
|
||||
|
||||
// change vtkUnstructuredGrid::Connectivity and inverse connectivity
|
||||
if ( Ok )
|
||||
if ( SMDS_MeshCell* cell = dynamic_cast<SMDS_MeshCell*>((SMDS_MeshElement*) element))
|
||||
{
|
||||
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();
|
||||
updateInverseElements( element, &nodes[0], nodes.size(), oldNodes );
|
||||
}
|
||||
}
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
||||
|
@ -1536,15 +1536,15 @@ MgAdapt::Status MgAdapt::addMessage(const std::string& msg,
|
||||
const bool isFatal/*=false*/)
|
||||
{
|
||||
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_
|
||||
std::cout << msg << std::endl;
|
||||
#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()
|
||||
|
@ -243,8 +243,8 @@ private :
|
||||
TOptionValues _defaultOptionValues; // default values
|
||||
TOptionNames _doubleOptions, _charOptions, _boolOptions; // to find a type of option
|
||||
|
||||
std::vector <std::string> _myErrorMessages;
|
||||
Status _myStatus;
|
||||
std::vector <std::string> _errorMessages;
|
||||
Status _status;
|
||||
std::string meshFormatOutputMesh;
|
||||
std::vector< std::string> solFormatOutput;
|
||||
std::vector <group> groupVec;
|
||||
|
@ -146,7 +146,7 @@ void SMESH_Hypothesis::SetLibName(const char* theLibName)
|
||||
//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();
|
||||
map<int, SMESH_Mesh*>::iterator itm = myStudyContext->mapMesh.begin();
|
||||
|
@ -128,7 +128,7 @@ public:
|
||||
/*!
|
||||
* \brief Find a mesh with given persistent ID
|
||||
*/
|
||||
SMESH_Mesh* GetMeshByPersistentID(int id);
|
||||
SMESH_Mesh* GetMeshByPersistentID(int id) const;
|
||||
|
||||
protected:
|
||||
SMESH_Gen* _gen;
|
||||
|
@ -112,15 +112,33 @@ SMESH_Mesh::SMESH_Mesh(int theLocalId,
|
||||
if(MYDEBUG) MESSAGE("SMESH_Mesh::SMESH_Mesh(int localId)");
|
||||
_id = theLocalId;
|
||||
_gen = theGen;
|
||||
_myDocument = theDocument;
|
||||
_myMeshDS = theDocument->NewMesh(theIsEmbeddedMode,theLocalId);
|
||||
_document = theDocument;
|
||||
_meshDS = theDocument->NewMesh(theIsEmbeddedMode,theLocalId);
|
||||
_isShapeToMesh = false;
|
||||
_isAutoColor = false;
|
||||
_isModified = false;
|
||||
_shapeDiagonal = 0.0;
|
||||
_callUp = NULL;
|
||||
_myMeshDS->ShapeToMesh( PseudoShape() );
|
||||
_meshDS->ShapeToMesh( PseudoShape() );
|
||||
_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 ),
|
||||
_nbSubShapes( 0 ),
|
||||
_isShapeToMesh( false ),
|
||||
_myDocument( 0 ),
|
||||
_myMeshDS( 0 ),
|
||||
_document( 0 ),
|
||||
_meshDS( 0 ),
|
||||
_gen( 0 ),
|
||||
_isAutoColor( false ),
|
||||
_isModified( false ),
|
||||
@ -176,9 +194,9 @@ SMESH_Mesh::~SMESH_Mesh()
|
||||
{
|
||||
if(MYDEBUG) MESSAGE("SMESH_Mesh::~SMESH_Mesh");
|
||||
|
||||
if ( _myDocument ) // avoid destructing _myMeshDS from ~SMESH_Gen()
|
||||
_myDocument->RemoveMesh( _id );
|
||||
_myDocument = 0;
|
||||
if ( _document ) // avoid destructing _meshDS from ~SMESH_Gen()
|
||||
_document->RemoveMesh( _id );
|
||||
_document = 0;
|
||||
|
||||
// remove self from studyContext
|
||||
if ( _gen )
|
||||
@ -187,7 +205,7 @@ SMESH_Mesh::~SMESH_Mesh()
|
||||
studyContext->mapMesh.erase( _id );
|
||||
}
|
||||
|
||||
_myMeshDS->ClearMesh();
|
||||
_meshDS->ClearMesh();
|
||||
|
||||
// issue 0020340: EDF 1022 SMESH : Crash with FindNodeClosestTo in a second new study
|
||||
// Notify event listeners at least that something happens
|
||||
@ -208,13 +226,13 @@ SMESH_Mesh::~SMESH_Mesh()
|
||||
if ( _callUp) delete _callUp;
|
||||
_callUp = 0;
|
||||
|
||||
if ( _myMeshDS ) {
|
||||
// delete _myMeshDS, in a thread in order not to block closing a study with large meshes
|
||||
if ( _meshDS ) {
|
||||
// delete _meshDS, in a thread in order not to block closing a study with large meshes
|
||||
#ifndef WIN32
|
||||
boost::thread aThread(boost::bind( & deleteMeshDS, _myMeshDS ));
|
||||
boost::thread aThread(boost::bind( & deleteMeshDS, _meshDS ));
|
||||
#else
|
||||
pthread_t thread;
|
||||
int result=pthread_create(&thread, NULL, deleteMeshDS, (void*)_myMeshDS);
|
||||
int result=pthread_create(&thread, NULL, deleteMeshDS, (void*)_meshDS);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -227,7 +245,7 @@ SMESH_Mesh::~SMESH_Mesh()
|
||||
|
||||
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.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"));
|
||||
}
|
||||
// clear current data
|
||||
if ( !_myMeshDS->ShapeToMesh().IsNull() )
|
||||
if ( !_meshDS->ShapeToMesh().IsNull() )
|
||||
{
|
||||
// removal of a shape to mesh, delete objects referring to sub-shapes:
|
||||
// - sub-meshes
|
||||
@ -275,7 +293,7 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape)
|
||||
std::map <int, SMESH_Group *>::iterator i_gr = _mapGroup.begin();
|
||||
while ( i_gr != _mapGroup.end() ) {
|
||||
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;
|
||||
_mapGroup.erase( i_gr++ );
|
||||
}
|
||||
@ -286,7 +304,7 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape)
|
||||
|
||||
// clear SMESHDS
|
||||
TopoDS_Shape aNullShape;
|
||||
_myMeshDS->ShapeToMesh( aNullShape );
|
||||
_meshDS->ShapeToMesh( aNullShape );
|
||||
|
||||
_shapeDiagonal = 0.0;
|
||||
}
|
||||
@ -294,9 +312,9 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape)
|
||||
// set a new geometry
|
||||
if ( !aShape.IsNull() )
|
||||
{
|
||||
_myMeshDS->ShapeToMesh(aShape);
|
||||
_meshDS->ShapeToMesh(aShape);
|
||||
_isShapeToMesh = true;
|
||||
_nbSubShapes = _myMeshDS->MaxShapeIndex();
|
||||
_nbSubShapes = _meshDS->MaxShapeIndex();
|
||||
|
||||
// fill map of ancestors
|
||||
fillAncestorsMap(aShape);
|
||||
@ -305,7 +323,7 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape)
|
||||
{
|
||||
_isShapeToMesh = false;
|
||||
_shapeDiagonal = 0.0;
|
||||
_myMeshDS->ShapeToMesh( PseudoShape() );
|
||||
_meshDS->ShapeToMesh( PseudoShape() );
|
||||
}
|
||||
_isModified = false;
|
||||
}
|
||||
@ -318,7 +336,7 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape)
|
||||
|
||||
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
|
||||
{
|
||||
// clear mesh data
|
||||
_myMeshDS->ClearMesh();
|
||||
_meshDS->ClearMesh();
|
||||
|
||||
// update compute state of submeshes
|
||||
if ( SMESH_subMesh *sm = GetSubMeshContaining( GetShapeToMesh() ) )
|
||||
@ -474,7 +492,7 @@ int SMESH_Mesh::UNVToMesh(const char* theFileName)
|
||||
_isShapeToMesh = false;
|
||||
|
||||
DriverUNV_R_SMDS_Mesh myReader;
|
||||
myReader.SetMesh(_myMeshDS);
|
||||
myReader.SetMesh(_meshDS);
|
||||
myReader.SetFile(theFileName);
|
||||
myReader.SetMeshId(-1);
|
||||
myReader.Perform();
|
||||
@ -486,7 +504,7 @@ int SMESH_Mesh::UNVToMesh(const char* theFileName)
|
||||
{
|
||||
SMDS_MeshGroup* aGroup = gr2names->first;
|
||||
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->SetStoreName( aName.c_str() );
|
||||
AddGroup( aGroupDS );
|
||||
@ -507,7 +525,7 @@ int SMESH_Mesh::MEDToMesh(const char* theFileName, const char* theMeshName)
|
||||
_isShapeToMesh = false;
|
||||
|
||||
DriverMED_R_SMESHDS_Mesh myReader;
|
||||
myReader.SetMesh(_myMeshDS);
|
||||
myReader.SetMesh(_meshDS);
|
||||
myReader.SetMeshId(-1);
|
||||
myReader.SetFile(theFileName);
|
||||
myReader.SetMeshName(theMeshName);
|
||||
@ -532,8 +550,8 @@ int SMESH_Mesh::MEDToMesh(const char* theFileName, const char* theMeshName)
|
||||
}
|
||||
}
|
||||
|
||||
_myMeshDS->Modified();
|
||||
_myMeshDS->CompactMesh();
|
||||
_meshDS->Modified();
|
||||
_meshDS->CompactMesh();
|
||||
|
||||
return (int) status;
|
||||
}
|
||||
@ -550,7 +568,7 @@ std::string SMESH_Mesh::STLToMesh(const char* theFileName)
|
||||
_isShapeToMesh = false;
|
||||
|
||||
DriverSTL_R_SMDS_Mesh myReader;
|
||||
myReader.SetMesh(_myMeshDS);
|
||||
myReader.SetMesh(_meshDS);
|
||||
myReader.SetFile(theFileName);
|
||||
myReader.SetMeshId(-1);
|
||||
myReader.Perform();
|
||||
@ -574,7 +592,7 @@ int SMESH_Mesh::CGNSToMesh(const char* theFileName,
|
||||
#ifdef WITH_CGNS
|
||||
|
||||
DriverCGNS_Read myReader;
|
||||
myReader.SetMesh(_myMeshDS);
|
||||
myReader.SetMesh(_meshDS);
|
||||
myReader.SetFile(theFileName);
|
||||
myReader.SetMeshId(theMeshIndex);
|
||||
res = myReader.Perform();
|
||||
@ -597,7 +615,7 @@ SMESH_ComputeErrorPtr SMESH_Mesh::GMFToMesh(const char* theFileName,
|
||||
bool theMakeRequiredGroups)
|
||||
{
|
||||
DriverGMF_Read myReader;
|
||||
myReader.SetMesh(_myMeshDS);
|
||||
myReader.SetMesh(_meshDS);
|
||||
myReader.SetFile(theFileName);
|
||||
myReader.SetMakeRequiredGroups( theMakeRequiredGroups );
|
||||
myReader.Perform();
|
||||
@ -620,7 +638,6 @@ SMESH_Mesh::AddHypothesis(const TopoDS_Shape & aSubShape,
|
||||
int anHypId,
|
||||
std::string* anError )
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
if(MYDEBUG) MESSAGE("SMESH_Mesh::AddHypothesis");
|
||||
|
||||
if ( anError )
|
||||
@ -715,7 +732,6 @@ SMESH_Hypothesis::Hypothesis_Status
|
||||
SMESH_Mesh::RemoveHypothesis(const TopoDS_Shape & aSubShape,
|
||||
int anHypId)
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
if(MYDEBUG) MESSAGE("SMESH_Mesh::RemoveHypothesis");
|
||||
|
||||
StudyContextStruct *sc = _gen->GetStudyContext();
|
||||
@ -785,7 +801,7 @@ SMESH_Mesh::RemoveHypothesis(const TopoDS_Shape & aSubShape,
|
||||
const std::list<const SMESHDS_Hypothesis*>&
|
||||
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 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();
|
||||
for ( ; hyp != hypList.end(); 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++ )
|
||||
{
|
||||
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();
|
||||
for ( ; hyp != hypList.end(); hyp++ ) {
|
||||
const SMESH_Hypothesis * h = cSMESH_Hyp( *hyp );
|
||||
@ -921,7 +937,7 @@ int SMESH_Mesh::GetHypotheses(const SMESH_subMesh * aSubMesh,
|
||||
// get hypos from aSubShape
|
||||
{
|
||||
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++ )
|
||||
{
|
||||
const SMESH_Hypothesis* h = cSMESH_Hyp( *hyp );
|
||||
@ -950,7 +966,7 @@ int SMESH_Mesh::GetHypotheses(const SMESH_subMesh * aSubMesh,
|
||||
for ( ; smIt != ancestors.end(); smIt++ )
|
||||
{
|
||||
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++ )
|
||||
{
|
||||
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()
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
return _myMeshDS->GetScript()->GetCommands();
|
||||
return _meshDS->GetScript()->GetCommands();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -1005,8 +1020,7 @@ const std::list<SMESHDS_Command*> & SMESH_Mesh::GetLog()
|
||||
//=============================================================================
|
||||
void SMESH_Mesh::ClearLog()
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
_myMeshDS->GetScript()->Clear();
|
||||
_meshDS->GetScript()->Clear();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -1017,7 +1031,7 @@ void SMESH_Mesh::ClearLog()
|
||||
|
||||
SMESH_subMesh * SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape)
|
||||
{
|
||||
int index = _myMeshDS->ShapeToIndex(aSubShape);
|
||||
int index = _meshDS->ShapeToIndex(aSubShape);
|
||||
if ( !index && aSubShape.IsNull() )
|
||||
return 0;
|
||||
|
||||
@ -1027,10 +1041,10 @@ SMESH_subMesh * SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape)
|
||||
TopoDS_Iterator it( aSubShape );
|
||||
if ( it.More() )
|
||||
{
|
||||
index = _myMeshDS->AddCompoundSubmesh( aSubShape, it.Value().ShapeType() );
|
||||
index = _meshDS->AddCompoundSubmesh( aSubShape, it.Value().ShapeType() );
|
||||
// fill map of Ancestors
|
||||
while ( _nbSubShapes < index )
|
||||
fillAncestorsMap( _myMeshDS->IndexToShape( ++_nbSubShapes ));
|
||||
fillAncestorsMap( _meshDS->IndexToShape( ++_nbSubShapes ));
|
||||
}
|
||||
}
|
||||
// if ( !index )
|
||||
@ -1039,7 +1053,7 @@ SMESH_subMesh * SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape)
|
||||
SMESH_subMesh* aSubMesh = _subMeshHolder->Get( index );
|
||||
if ( !aSubMesh )
|
||||
{
|
||||
aSubMesh = new SMESH_subMesh(index, this, _myMeshDS, aSubShape);
|
||||
aSubMesh = new SMESH_subMesh(index, this, _meshDS, aSubShape);
|
||||
_subMeshHolder->Add( index, aSubMesh );
|
||||
|
||||
// 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
|
||||
{
|
||||
int index = _myMeshDS->ShapeToIndex(aSubShape);
|
||||
int index = _meshDS->ShapeToIndex(aSubShape);
|
||||
return GetSubMeshContaining( index );
|
||||
}
|
||||
|
||||
@ -1178,16 +1192,15 @@ bool SMESH_Mesh::IsUsedHypothesis(SMESHDS_Hypothesis * anHyp,
|
||||
|
||||
void SMESH_Mesh::NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* hyp)
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
|
||||
if ( !GetMeshDS()->IsUsedHypothesis( hyp ))
|
||||
return;
|
||||
|
||||
smIdType nbEntities = ( _myMeshDS->NbNodes() + _myMeshDS->NbElements() );
|
||||
smIdType nbEntities = ( _meshDS->NbNodes() + _meshDS->NbElements() );
|
||||
if ( hyp && _callUp && !_callUp->IsLoaded() ) // for not loaded mesh (#16648)
|
||||
{
|
||||
_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;
|
||||
@ -1257,7 +1270,7 @@ void SMESH_Mesh::NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* h
|
||||
HasModificationsToDiscard(); // to reset _isModified flag if mesh becomes empty
|
||||
GetMeshDS()->Modified();
|
||||
|
||||
smIdType newNbEntities = ( _myMeshDS->NbNodes() + _myMeshDS->NbElements() );
|
||||
smIdType newNbEntities = ( _meshDS->NbNodes() + _meshDS->NbElements() );
|
||||
if ( hyp && _callUp )
|
||||
_callUp->HypothesisModified( hyp->GetID(), newNbEntities != nbEntities );
|
||||
}
|
||||
@ -1269,13 +1282,11 @@ void SMESH_Mesh::NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* h
|
||||
//=============================================================================
|
||||
void SMESH_Mesh::SetAutoColor(bool theAutoColor)
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
_isAutoColor = theAutoColor;
|
||||
}
|
||||
|
||||
bool SMESH_Mesh::GetAutoColor()
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
return _isAutoColor;
|
||||
}
|
||||
|
||||
@ -1392,42 +1403,52 @@ bool SMESH_Mesh::HasDuplicatedGroupNamesMED()
|
||||
return false;
|
||||
}
|
||||
|
||||
void SMESH_Mesh::ExportMEDCommmon(DriverMED_W_SMESHDS_Mesh& myWriter,
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Export the mesh to a writer
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void SMESH_Mesh::exportMEDCommmon(DriverMED_W_SMESHDS_Mesh& theWriter,
|
||||
const char* theMeshName,
|
||||
bool theAutoGroups,
|
||||
const SMESHDS_Mesh* meshPart,
|
||||
const SMESHDS_Mesh* theMeshPart,
|
||||
bool theAutoDimension,
|
||||
bool theAddODOnVertices,
|
||||
double theZTolerance,
|
||||
bool theSaveNumbers,
|
||||
bool theAllElemsToGroup)
|
||||
{
|
||||
Driver_Mesh::Status status = Driver_Mesh::DRS_OK;
|
||||
|
||||
SMESH_TRY;
|
||||
myWriter.SetMesh ( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS );
|
||||
myWriter.SetAutoDimension( theAutoDimension );
|
||||
myWriter.AddODOnVertices ( theAddODOnVertices );
|
||||
myWriter.SetZTolerance ( theZTolerance );
|
||||
|
||||
theWriter.SetMesh ( theMeshPart ? (SMESHDS_Mesh*) theMeshPart : _meshDS );
|
||||
theWriter.SetAutoDimension( theAutoDimension );
|
||||
theWriter.AddODOnVertices ( theAddODOnVertices );
|
||||
theWriter.SetZTolerance ( theZTolerance );
|
||||
theWriter.SetSaveNumbers ( theSaveNumbers );
|
||||
if ( !theMeshName )
|
||||
myWriter.SetMeshId ( _id );
|
||||
theWriter.SetMeshId ( _id );
|
||||
else {
|
||||
myWriter.SetMeshId ( -1 );
|
||||
myWriter.SetMeshName ( theMeshName );
|
||||
theWriter.SetMeshId ( -1 );
|
||||
theWriter.SetMeshName ( theMeshName );
|
||||
}
|
||||
|
||||
if ( theAutoGroups ) {
|
||||
myWriter.AddGroupOfNodes();
|
||||
myWriter.AddGroupOfEdges();
|
||||
myWriter.AddGroupOfFaces();
|
||||
myWriter.AddGroupOfVolumes();
|
||||
myWriter.AddGroupOf0DElems();
|
||||
myWriter.AddGroupOfBalls();
|
||||
theWriter.AddGroupOfNodes();
|
||||
theWriter.AddGroupOfEdges();
|
||||
theWriter.AddGroupOfFaces();
|
||||
theWriter.AddGroupOfVolumes();
|
||||
theWriter.AddGroupOf0DElems();
|
||||
theWriter.AddGroupOfBalls();
|
||||
}
|
||||
if ( theAllElemsToGroup )
|
||||
myWriter.AddAllToGroup();
|
||||
theWriter.AddAllToGroup();
|
||||
|
||||
// Pass groups to writer. Provide unique group names.
|
||||
//set<string> aGroupNames; // Corrected for Mantis issue 0020028
|
||||
if ( !meshPart )
|
||||
if ( !theMeshPart )
|
||||
{
|
||||
std::map< SMDSAbs_ElementType, std::set<std::string> > aGroupNames;
|
||||
char aString [256];
|
||||
@ -1448,12 +1469,12 @@ void SMESH_Mesh::ExportMEDCommmon(DriverMED_W_SMESHDS_Mesh& myWriter,
|
||||
aGroupName.resize(MAX_MED_GROUP_NAME_LENGTH);
|
||||
}
|
||||
aGroupDS->SetStoreName( aGroupName.c_str() );
|
||||
myWriter.AddGroup( aGroupDS );
|
||||
theWriter.AddGroup( aGroupDS );
|
||||
}
|
||||
}
|
||||
}
|
||||
// Perform export
|
||||
status = myWriter.Perform();
|
||||
status = theWriter.Perform();
|
||||
|
||||
SMESH_CATCH( SMESH::throwSalomeEx );
|
||||
|
||||
@ -1461,62 +1482,70 @@ void SMESH_Mesh::ExportMEDCommmon(DriverMED_W_SMESHDS_Mesh& myWriter,
|
||||
throw TooLargeForExport("MED");
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* Same as SMESH_Mesh::ExportMED except for \a file and \a theVersion
|
||||
*/
|
||||
MEDCoupling::MCAuto<MEDCoupling::DataArrayByte> SMESH_Mesh::ExportMEDCoupling(
|
||||
const char* theMeshName,
|
||||
//================================================================================
|
||||
|
||||
MEDCoupling::MCAuto<MEDCoupling::DataArrayByte>
|
||||
SMESH_Mesh::ExportMEDCoupling(const char* theMeshName,
|
||||
bool theAutoGroups,
|
||||
const SMESHDS_Mesh* meshPart,
|
||||
const SMESHDS_Mesh* theMeshPart,
|
||||
bool theAutoDimension,
|
||||
bool theAddODOnVertices,
|
||||
double theZTolerance,
|
||||
bool theAllElemsToGroup)
|
||||
bool theSaveNumbers)
|
||||
{
|
||||
DriverMED_W_SMESHDS_Mesh_Mem myWriter;
|
||||
this->ExportMEDCommmon(myWriter,theMeshName,theAutoGroups,meshPart,theAutoDimension,theAddODOnVertices,theZTolerance,theAllElemsToGroup);
|
||||
return myWriter.getData();
|
||||
DriverMED_W_SMESHDS_Mesh_Mem writer;
|
||||
this->exportMEDCommmon( writer, theMeshName, theAutoGroups, theMeshPart, theAutoDimension,
|
||||
theAddODOnVertices, theZTolerance, theSaveNumbers,
|
||||
/*AllElemsToGroup(for ExportSAUV())=*/false);
|
||||
return writer.getData();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \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] theAutoGroups - boolean parameter for creating/not creating
|
||||
* the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
|
||||
* the typical use is auto_groups=false.
|
||||
* \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).
|
||||
* \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
|
||||
* - 1D if all mesh nodes lie on OX coordinate axis, or
|
||||
* - 2D if all mesh nodes lie on XOY coordinate plane, or
|
||||
* - 3D in the rest cases.
|
||||
* If \a theAutoDimension is \c false, the space dimension is always 3.
|
||||
* \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] ZTolerance - tolerance in Z direction. If Z coordinate of a node is close to zero
|
||||
* \param [in] theZTolerance - tolerance in Z direction. If Z coordinate of a node is close to zero
|
||||
* within a given tolerance, the coordinate is set to zero.
|
||||
* 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
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void SMESH_Mesh::ExportMED(const char * file,
|
||||
void SMESH_Mesh::ExportMED(const char * theFile,
|
||||
const char* theMeshName,
|
||||
bool theAutoGroups,
|
||||
int theVersion,
|
||||
const SMESHDS_Mesh* meshPart,
|
||||
const SMESHDS_Mesh* theMeshPart,
|
||||
bool theAutoDimension,
|
||||
bool theAddODOnVertices,
|
||||
double theZTolerance,
|
||||
bool theSaveNumbers,
|
||||
bool theAllElemsToGroup)
|
||||
{
|
||||
MESSAGE("MED_VERSION:"<< theVersion);
|
||||
DriverMED_W_SMESHDS_Mesh myWriter;
|
||||
myWriter.SetFile( file , theVersion );
|
||||
this->ExportMEDCommmon(myWriter,theMeshName,theAutoGroups,meshPart,theAutoDimension,theAddODOnVertices,theZTolerance,theAllElemsToGroup);
|
||||
DriverMED_W_SMESHDS_Mesh writer;
|
||||
writer.SetFile( theFile, theVersion );
|
||||
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,
|
||||
bool theAutoGroups)
|
||||
{
|
||||
std::string medfilename(file);
|
||||
std::string medfilename( theFile );
|
||||
medfilename += ".med";
|
||||
std::string cmd;
|
||||
#ifdef WIN32
|
||||
@ -1542,9 +1571,10 @@ void SMESH_Mesh::ExportSAUV(const char *file,
|
||||
cmd += "\"";
|
||||
system(cmd.c_str());
|
||||
try {
|
||||
ExportMED(medfilename.c_str(), theMeshName, theAutoGroups, /*minor=*/-1,
|
||||
ExportMED( medfilename.c_str(), theMeshName, theAutoGroups, /*minor=*/-1,
|
||||
/*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 )
|
||||
{
|
||||
@ -1556,7 +1586,7 @@ void SMESH_Mesh::ExportSAUV(const char *file,
|
||||
cmd = "python3 ";
|
||||
#endif
|
||||
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 += "\"";
|
||||
system(cmd.c_str());
|
||||
#ifdef WIN32
|
||||
@ -1577,16 +1607,18 @@ void SMESH_Mesh::ExportSAUV(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;
|
||||
SMESH_TRY;
|
||||
|
||||
DriverDAT_W_SMDS_Mesh myWriter;
|
||||
myWriter.SetFile( file );
|
||||
myWriter.SetMesh( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS );
|
||||
myWriter.SetMeshId(_id);
|
||||
status = myWriter.Perform();
|
||||
DriverDAT_W_SMDS_Mesh writer;
|
||||
writer.SetFile( file );
|
||||
writer.SetMesh( meshPart ? (SMESHDS_Mesh*) meshPart : _meshDS );
|
||||
writer.SetMeshId(_id);
|
||||
writer.SetRenumber( renumber );
|
||||
status = writer.Perform();
|
||||
|
||||
SMESH_CATCH( SMESH::throwSalomeEx );
|
||||
|
||||
@ -1601,16 +1633,17 @@ void SMESH_Mesh::ExportDAT(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;
|
||||
|
||||
SMESH_TRY;
|
||||
DriverUNV_W_SMDS_Mesh myWriter;
|
||||
myWriter.SetFile( file );
|
||||
myWriter.SetMesh( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS );
|
||||
myWriter.SetMeshId(_id);
|
||||
// myWriter.SetGroups(_mapGroup);
|
||||
DriverUNV_W_SMDS_Mesh writer;
|
||||
writer.SetFile( file );
|
||||
writer.SetMesh( meshPart ? (SMESHDS_Mesh*) meshPart : _meshDS );
|
||||
writer.SetMeshId(_id);
|
||||
writer.SetRenumber( renumber );
|
||||
|
||||
// pass group names to SMESHDS
|
||||
if ( !meshPart )
|
||||
@ -1622,11 +1655,11 @@ void SMESH_Mesh::ExportUNV(const char * file,
|
||||
if ( aGroupDS ) {
|
||||
std::string aGroupName = aGroup->GetName();
|
||||
aGroupDS->SetStoreName( aGroupName.c_str() );
|
||||
myWriter.AddGroup( aGroupDS );
|
||||
writer.AddGroup( aGroupDS );
|
||||
}
|
||||
}
|
||||
}
|
||||
status = myWriter.Perform();
|
||||
status = writer.Perform();
|
||||
|
||||
SMESH_CATCH( SMESH::throwSalomeEx );
|
||||
|
||||
@ -1648,13 +1681,13 @@ void SMESH_Mesh::ExportSTL(const char * file,
|
||||
Driver_Mesh::Status status;
|
||||
SMESH_TRY;
|
||||
|
||||
DriverSTL_W_SMDS_Mesh myWriter;
|
||||
myWriter.SetFile( file );
|
||||
myWriter.SetIsAscii( isascii );
|
||||
myWriter.SetMesh( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS);
|
||||
myWriter.SetMeshId(_id);
|
||||
if ( name ) myWriter.SetName( name );
|
||||
status = myWriter.Perform();
|
||||
DriverSTL_W_SMDS_Mesh writer;
|
||||
writer.SetFile( file );
|
||||
writer.SetIsAscii( isascii );
|
||||
writer.SetMesh( meshPart ? (SMESHDS_Mesh*) meshPart : _meshDS);
|
||||
writer.SetMeshId(_id);
|
||||
if ( name ) writer.SetName( name );
|
||||
status = writer.Perform();
|
||||
|
||||
SMESH_CATCH( SMESH::throwSalomeEx );
|
||||
|
||||
@ -1689,17 +1722,17 @@ void SMESH_Mesh::ExportCGNS(const char * file,
|
||||
}
|
||||
#ifdef WITH_CGNS
|
||||
|
||||
DriverCGNS_Write myWriter;
|
||||
myWriter.SetFile( file );
|
||||
myWriter.SetMesh( const_cast<SMESHDS_Mesh*>( meshDS ));
|
||||
myWriter.SetMeshName( SMESH_Comment("Mesh_") << meshDS->GetPersistentId());
|
||||
DriverCGNS_Write writer;
|
||||
writer.SetFile( file );
|
||||
writer.SetMesh( const_cast<SMESHDS_Mesh*>( meshDS ));
|
||||
writer.SetMeshName( SMESH_Comment("Mesh_") << meshDS->GetPersistentId());
|
||||
if ( meshName && meshName[0] )
|
||||
myWriter.SetMeshName( meshName );
|
||||
myWriter.SetElementsByType( groupElemsByType );
|
||||
res = myWriter.Perform();
|
||||
writer.SetMeshName( meshName );
|
||||
writer.SetElementsByType( groupElemsByType );
|
||||
res = writer.Perform();
|
||||
if ( res != Driver_Mesh::DRS_OK )
|
||||
{
|
||||
SMESH_ComputeErrorPtr err = myWriter.GetError();
|
||||
SMESH_ComputeErrorPtr err = writer.GetError();
|
||||
if ( err && !err->IsOK() && !err->myComment.empty() )
|
||||
throw SALOME_Exception(("Export failed: " + err->myComment ).c_str() );
|
||||
}
|
||||
@ -1727,12 +1760,12 @@ void SMESH_Mesh::ExportGMF(const char * file,
|
||||
Driver_Mesh::Status status;
|
||||
SMESH_TRY;
|
||||
|
||||
DriverGMF_Write myWriter;
|
||||
myWriter.SetFile( file );
|
||||
myWriter.SetMesh( const_cast<SMESHDS_Mesh*>( meshDS ));
|
||||
myWriter.SetExportRequiredGroups( withRequiredGroups );
|
||||
DriverGMF_Write writer;
|
||||
writer.SetFile( file );
|
||||
writer.SetMesh( const_cast<SMESHDS_Mesh*>( meshDS ));
|
||||
writer.SetExportRequiredGroups( withRequiredGroups );
|
||||
|
||||
status = myWriter.Perform();
|
||||
status = writer.Perform();
|
||||
|
||||
SMESH_CATCH( SMESH::throwSalomeEx );
|
||||
|
||||
@ -1822,8 +1855,7 @@ double SMESH_Mesh::GetComputeProgress() const
|
||||
|
||||
smIdType SMESH_Mesh::NbNodes() const
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
return _myMeshDS->NbNodes();
|
||||
return _meshDS->NbNodes();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -1834,8 +1866,7 @@ smIdType SMESH_Mesh::NbNodes() const
|
||||
|
||||
smIdType SMESH_Mesh::Nb0DElements() const
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
return _myMeshDS->GetMeshInfo().Nb0DElements();
|
||||
return _meshDS->GetMeshInfo().Nb0DElements();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -1846,8 +1877,7 @@ smIdType SMESH_Mesh::Nb0DElements() const
|
||||
|
||||
smIdType SMESH_Mesh::NbEdges(SMDSAbs_ElementOrder order) const
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
return _myMeshDS->GetMeshInfo().NbEdges(order);
|
||||
return _meshDS->GetMeshInfo().NbEdges(order);
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -1858,8 +1888,7 @@ smIdType SMESH_Mesh::NbEdges(SMDSAbs_ElementOrder order) const
|
||||
|
||||
smIdType SMESH_Mesh::NbFaces(SMDSAbs_ElementOrder order) const
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
return _myMeshDS->GetMeshInfo().NbFaces(order);
|
||||
return _meshDS->GetMeshInfo().NbFaces(order);
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -1870,8 +1899,7 @@ smIdType SMESH_Mesh::NbFaces(SMDSAbs_ElementOrder order) const
|
||||
|
||||
smIdType SMESH_Mesh::NbTriangles(SMDSAbs_ElementOrder order) const
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
return _myMeshDS->GetMeshInfo().NbTriangles(order);
|
||||
return _meshDS->GetMeshInfo().NbTriangles(order);
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -1882,8 +1910,7 @@ smIdType SMESH_Mesh::NbTriangles(SMDSAbs_ElementOrder order) const
|
||||
|
||||
smIdType SMESH_Mesh::NbBiQuadTriangles() const
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
return _myMeshDS->GetMeshInfo().NbBiQuadTriangles();
|
||||
return _meshDS->GetMeshInfo().NbBiQuadTriangles();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -1894,8 +1921,7 @@ smIdType SMESH_Mesh::NbBiQuadTriangles() const
|
||||
|
||||
smIdType SMESH_Mesh::NbQuadrangles(SMDSAbs_ElementOrder order) const
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
return _myMeshDS->GetMeshInfo().NbQuadrangles(order);
|
||||
return _meshDS->GetMeshInfo().NbQuadrangles(order);
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -1906,8 +1932,7 @@ smIdType SMESH_Mesh::NbQuadrangles(SMDSAbs_ElementOrder order) const
|
||||
|
||||
smIdType SMESH_Mesh::NbBiQuadQuadrangles() const
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
return _myMeshDS->GetMeshInfo().NbBiQuadQuadrangles();
|
||||
return _meshDS->GetMeshInfo().NbBiQuadQuadrangles();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -1918,8 +1943,7 @@ smIdType SMESH_Mesh::NbBiQuadQuadrangles() const
|
||||
|
||||
smIdType SMESH_Mesh::NbPolygons(SMDSAbs_ElementOrder order) const
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
return _myMeshDS->GetMeshInfo().NbPolygons(order);
|
||||
return _meshDS->GetMeshInfo().NbPolygons(order);
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -1930,8 +1954,7 @@ smIdType SMESH_Mesh::NbPolygons(SMDSAbs_ElementOrder order) const
|
||||
|
||||
smIdType SMESH_Mesh::NbVolumes(SMDSAbs_ElementOrder order) const
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
return _myMeshDS->GetMeshInfo().NbVolumes(order);
|
||||
return _meshDS->GetMeshInfo().NbVolumes(order);
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -1942,8 +1965,7 @@ smIdType SMESH_Mesh::NbVolumes(SMDSAbs_ElementOrder order) const
|
||||
|
||||
smIdType SMESH_Mesh::NbTetras(SMDSAbs_ElementOrder order) const
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
return _myMeshDS->GetMeshInfo().NbTetras(order);
|
||||
return _meshDS->GetMeshInfo().NbTetras(order);
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -1954,8 +1976,7 @@ smIdType SMESH_Mesh::NbTetras(SMDSAbs_ElementOrder order) const
|
||||
|
||||
smIdType SMESH_Mesh::NbHexas(SMDSAbs_ElementOrder order) const
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
return _myMeshDS->GetMeshInfo().NbHexas(order);
|
||||
return _meshDS->GetMeshInfo().NbHexas(order);
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -1966,8 +1987,7 @@ smIdType SMESH_Mesh::NbHexas(SMDSAbs_ElementOrder order) const
|
||||
|
||||
smIdType SMESH_Mesh::NbTriQuadraticHexas() const
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
return _myMeshDS->GetMeshInfo().NbTriQuadHexas();
|
||||
return _meshDS->GetMeshInfo().NbTriQuadHexas();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -1978,8 +1998,7 @@ smIdType SMESH_Mesh::NbTriQuadraticHexas() const
|
||||
|
||||
smIdType SMESH_Mesh::NbPyramids(SMDSAbs_ElementOrder order) const
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
return _myMeshDS->GetMeshInfo().NbPyramids(order);
|
||||
return _meshDS->GetMeshInfo().NbPyramids(order);
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -1990,20 +2009,17 @@ smIdType SMESH_Mesh::NbPyramids(SMDSAbs_ElementOrder order) const
|
||||
|
||||
smIdType SMESH_Mesh::NbPrisms(SMDSAbs_ElementOrder order) const
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
return _myMeshDS->GetMeshInfo().NbPrisms(order);
|
||||
return _meshDS->GetMeshInfo().NbPrisms(order);
|
||||
}
|
||||
|
||||
smIdType SMESH_Mesh::NbQuadPrisms() const
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
return _myMeshDS->GetMeshInfo().NbQuadPrisms();
|
||||
return _meshDS->GetMeshInfo().NbQuadPrisms();
|
||||
}
|
||||
|
||||
smIdType SMESH_Mesh::NbBiQuadPrisms() const
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
return _myMeshDS->GetMeshInfo().NbBiQuadPrisms();
|
||||
return _meshDS->GetMeshInfo().NbBiQuadPrisms();
|
||||
}
|
||||
|
||||
|
||||
@ -2015,8 +2031,7 @@ smIdType SMESH_Mesh::NbBiQuadPrisms() const
|
||||
|
||||
smIdType SMESH_Mesh::NbHexagonalPrisms() const
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
return _myMeshDS->GetMeshInfo().NbHexPrisms();
|
||||
return _meshDS->GetMeshInfo().NbHexPrisms();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -2027,8 +2042,7 @@ smIdType SMESH_Mesh::NbHexagonalPrisms() const
|
||||
|
||||
smIdType SMESH_Mesh::NbPolyhedrons() const
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
return _myMeshDS->GetMeshInfo().NbPolyhedrons();
|
||||
return _meshDS->GetMeshInfo().NbPolyhedrons();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -2039,8 +2053,7 @@ smIdType SMESH_Mesh::NbPolyhedrons() const
|
||||
|
||||
smIdType SMESH_Mesh::NbBalls() const
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
return _myMeshDS->GetMeshInfo().NbBalls();
|
||||
return _meshDS->GetMeshInfo().NbBalls();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -2051,8 +2064,7 @@ smIdType SMESH_Mesh::NbBalls() const
|
||||
|
||||
smIdType SMESH_Mesh::NbSubMesh() const
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
return _myMeshDS->NbSubMesh();
|
||||
return _meshDS->NbSubMesh();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -2064,7 +2076,7 @@ smIdType SMESH_Mesh::NbSubMesh() const
|
||||
|
||||
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");
|
||||
|
||||
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
|
||||
{
|
||||
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()
|
||||
{
|
||||
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();
|
||||
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;
|
||||
if ( nb3 + nb4 != NbFaces(order) ) {
|
||||
std::map<int,int> myFaceMap;
|
||||
SMDS_FaceIteratorPtr itFaces=_myMeshDS->facesIterator();
|
||||
SMDS_FaceIteratorPtr itFaces=_meshDS->facesIterator();
|
||||
while( itFaces->more( ) ) {
|
||||
int nbNodes = itFaces->next()->NbNodes();
|
||||
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;
|
||||
if ( nb8 + nb4 + nb5 + nb6 != NbVolumes(order) ) {
|
||||
std::map<int,int> myVolumesMap;
|
||||
SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
|
||||
SMDS_VolumeIteratorPtr itVolumes=_meshDS->volumesIterator();
|
||||
while( itVolumes->more( ) ) {
|
||||
int nbNodes = itVolumes->next()->NbNodes();
|
||||
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 )
|
||||
{
|
||||
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()
|
||||
{
|
||||
_mySubMeshOrder.clear();
|
||||
_subMeshOrder.clear();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -2408,7 +2420,7 @@ void SMESH_Mesh::ClearMeshOrder()
|
||||
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
if ( _mySubMeshOrder.empty() || theListToSort.size() < 2 )
|
||||
if ( _subMeshOrder.empty() || theListToSort.size() < 2 )
|
||||
return true;
|
||||
|
||||
|
||||
@ -2491,9 +2503,9 @@ bool SMESH_Mesh::SortByMeshOrder(std::vector<SMESH_subMesh*>& theListToSort) con
|
||||
typedef std::vector<SMESH_subMesh*>::iterator TPosInList;
|
||||
std::map< size_t, size_t > sortedPos; // index in theListToSort to order
|
||||
TPosInList smBeg = theListToSort.begin(), smEnd = theListToSort.end();
|
||||
TListOfListOfInt::const_iterator listIdsIt = _mySubMeshOrder.begin();
|
||||
TListOfListOfInt::const_iterator listIdsIt = _subMeshOrder.begin();
|
||||
bool needSort = false;
|
||||
for( ; listIdsIt != _mySubMeshOrder.end(); listIdsIt++)
|
||||
for( ; listIdsIt != _subMeshOrder.end(); listIdsIt++)
|
||||
{
|
||||
const TListOfInt& listOfId = *listIdsIt;
|
||||
// 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,
|
||||
const SMESH_subMesh* smAfter ) const
|
||||
{
|
||||
TListOfListOfInt::const_iterator listIdsIt = _mySubMeshOrder.begin();
|
||||
for( ; listIdsIt != _mySubMeshOrder.end(); listIdsIt++)
|
||||
TListOfListOfInt::const_iterator listIdsIt = _subMeshOrder.begin();
|
||||
for( ; listIdsIt != _subMeshOrder.end(); listIdsIt++)
|
||||
{
|
||||
const TListOfInt& listOfId = *listIdsIt;
|
||||
int iB = -1, iA = -1, i = 0;
|
||||
|
@ -178,9 +178,9 @@ class SMESH_EXPORT SMESH_Mesh
|
||||
|
||||
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; }
|
||||
|
||||
@ -265,14 +265,14 @@ class SMESH_EXPORT SMESH_Mesh
|
||||
TooLargeForExport(const char* format):runtime_error(format) {}
|
||||
};
|
||||
|
||||
MEDCoupling::MCAuto<MEDCoupling::DataArrayByte> ExportMEDCoupling(
|
||||
const char* theMeshName = NULL,
|
||||
MEDCoupling::MCAuto<MEDCoupling::DataArrayByte>
|
||||
ExportMEDCoupling(const char* theMeshName = NULL,
|
||||
bool theAutoGroups = true,
|
||||
const SMESHDS_Mesh* theMeshPart = 0,
|
||||
bool theAutoDimension = false,
|
||||
bool theAddODOnVertices = false,
|
||||
double theZTolerance = -1.,
|
||||
bool theAllElemsToGroup = false);
|
||||
bool theSaveNumbers = true);
|
||||
|
||||
void ExportMED(const char * theFile,
|
||||
const char* theMeshName = NULL,
|
||||
@ -282,12 +282,15 @@ class SMESH_EXPORT SMESH_Mesh
|
||||
bool theAutoDimension = false,
|
||||
bool theAddODOnVertices = false,
|
||||
double theZTolerance = -1.,
|
||||
bool theSaveNumbers = true,
|
||||
bool theAllElemsToGroup = false);
|
||||
|
||||
void ExportDAT(const char * file,
|
||||
const SMESHDS_Mesh* meshPart = 0);
|
||||
const SMESHDS_Mesh* meshPart = 0,
|
||||
const bool renumber = true);
|
||||
void ExportUNV(const char * file,
|
||||
const SMESHDS_Mesh* meshPart = 0);
|
||||
const SMESHDS_Mesh* meshPart = 0,
|
||||
const bool renumber = true);
|
||||
void ExportSTL(const char * file,
|
||||
const bool isascii,
|
||||
const char * name = 0,
|
||||
@ -385,16 +388,17 @@ class SMESH_EXPORT SMESH_Mesh
|
||||
|
||||
private:
|
||||
|
||||
void ExportMEDCommmon(DriverMED_W_SMESHDS_Mesh& myWriter,
|
||||
void exportMEDCommmon(DriverMED_W_SMESHDS_Mesh& myWriter,
|
||||
const char* theMeshName,
|
||||
bool theAutoGroups,
|
||||
const SMESHDS_Mesh* meshPart,
|
||||
bool theAutoDimension,
|
||||
bool theAddODOnVertices,
|
||||
double theZTolerance,
|
||||
bool theSaveNumbers,
|
||||
bool theAllElemsToGroup);
|
||||
|
||||
private:
|
||||
private:
|
||||
void fillAncestorsMap(const TopoDS_Shape& theShape);
|
||||
void getAncestorsSubMeshes(const TopoDS_Shape& theSubShape,
|
||||
std::vector< SMESH_subMesh* >& theSubMeshes) const;
|
||||
@ -404,8 +408,8 @@ protected:
|
||||
int _groupId; // id generator for group objects
|
||||
int _nbSubShapes; // initial nb of subshapes in the shape to mesh
|
||||
bool _isShapeToMesh;// set to true when a shape is given (only once)
|
||||
SMESHDS_Document * _myDocument;
|
||||
SMESHDS_Mesh * _myMeshDS;
|
||||
SMESHDS_Document * _document;
|
||||
SMESHDS_Mesh * _meshDS;
|
||||
SMESH_Gen * _gen;
|
||||
std::map <int, SMESH_Group*> _mapGroup;
|
||||
|
||||
@ -421,7 +425,7 @@ protected:
|
||||
|
||||
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
|
||||
// 1) make an upper level (SMESH_I) be consistent with a lower one (SMESH)
|
||||
|
@ -114,3 +114,33 @@ bool SMESHDS_Hypothesis::IsSameName( const SMESHDS_Hypothesis& other) const
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
@ -48,6 +48,9 @@ class SMESHDS_EXPORT SMESHDS_Hypothesis
|
||||
virtual std::ostream & SaveTo(std::ostream & save)=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;
|
||||
virtual bool operator==(const SMESHDS_Hypothesis& other) const;
|
||||
bool operator!=(const SMESHDS_Hypothesis& other) const { return !(*this==other); }
|
||||
|
@ -59,11 +59,11 @@ class SMESHDS_Mesh::SubMeshHolder : public SMESHDS_TSubMeshHolder< const SMESHDS
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
SMESHDS_Mesh::SMESHDS_Mesh(int theMeshID, bool theIsEmbeddedMode):
|
||||
myMeshID(theMeshID),
|
||||
mySubMeshHolder( new SubMeshHolder ),
|
||||
myIsEmbeddedMode(theIsEmbeddedMode)
|
||||
{
|
||||
myScript = new SMESHDS_Script(theIsEmbeddedMode);
|
||||
|
||||
SetPersistentId(theMeshID);
|
||||
}
|
||||
|
||||
@ -188,13 +188,15 @@ bool SMESHDS_Mesh::RemoveHypothesis(const TopoDS_Shape & S,
|
||||
//function : AddNode
|
||||
//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);
|
||||
if(node!=NULL) myScript->AddNode(node->GetID(), x, y, z);
|
||||
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);
|
||||
if(node!=NULL) myScript->AddNode(node->GetID(), x, y, z);
|
||||
return node;
|
||||
@ -235,9 +237,8 @@ bool SMESHDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem,
|
||||
//function : ChangePolygonNodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
bool SMESHDS_Mesh::ChangePolygonNodes
|
||||
(const SMDS_MeshElement * elem,
|
||||
std::vector<const SMDS_MeshNode*> nodes)
|
||||
bool SMESHDS_Mesh::ChangePolygonNodes (const SMDS_MeshElement * elem,
|
||||
std::vector<const SMDS_MeshNode*>& nodes)
|
||||
{
|
||||
ASSERT(nodes.size() > 3);
|
||||
|
||||
|
@ -596,7 +596,7 @@ class SMESHDS_EXPORT SMESHDS_Mesh : public SMDS_Mesh
|
||||
const SMDS_MeshNode * nodes[],
|
||||
const int nbnodes);
|
||||
bool ChangePolygonNodes(const SMDS_MeshElement * elem,
|
||||
std::vector<const SMDS_MeshNode*> nodes);
|
||||
std::vector<const SMDS_MeshNode*>& nodes);
|
||||
bool ChangePolyhedronNodes(const SMDS_MeshElement * elem,
|
||||
const std::vector<const SMDS_MeshNode*>& nodes,
|
||||
const std::vector<int>& quantities);
|
||||
@ -656,7 +656,7 @@ class SMESHDS_EXPORT SMESHDS_Mesh : public SMDS_Mesh
|
||||
|
||||
ShapeToHypothesis myShapeToHypothesis;
|
||||
|
||||
int myMeshID, myPersistentID;
|
||||
int myPersistentID;
|
||||
TopoDS_Shape myShape;
|
||||
|
||||
class SubMeshHolder;
|
||||
|
@ -460,6 +460,7 @@ namespace
|
||||
bool aCheckWarn = true;
|
||||
if ( resMgr )
|
||||
aCheckWarn = resMgr->booleanValue( "SMESH", "show_warning", false );
|
||||
|
||||
// get mesh object from selection and check duplication of their names
|
||||
bool hasDuplicatedMeshNames = false;
|
||||
QList< QPair< SMESH::SMESH_IDSource_var, QString > > aMeshList;
|
||||
@ -628,8 +629,8 @@ namespace
|
||||
"SMESH_OCTAHEDRA","SMESH_POLYEDRONS","SMESH_QUADRATIC_POLYEDRONS","SMESH_BALLS"
|
||||
};
|
||||
// is typeMsg complete? (compilation failure mains that enum SMDSAbs_EntityType changed)
|
||||
const int nbTypes = sizeof( typeMsg ) / sizeof( const char* );
|
||||
int _assert[( nbTypes == SMESH::Entity_Last ) ? 2 : -1 ]; _assert[0]=_assert[1]=0;
|
||||
static_assert( sizeof(typeMsg) / sizeof(const char*) == SMESH::Entity_Last,
|
||||
"Update names of EntityType's!!!" );
|
||||
|
||||
QString andStr = " " + QObject::tr("SMESH_AND") + " ", comma(", ");
|
||||
for ( size_t iType = 0; iType < presentNotSupported.size(); ++iType ) {
|
||||
@ -655,12 +656,11 @@ namespace
|
||||
|
||||
// Init the parameters with the default values
|
||||
bool aIsASCII_STL = true;
|
||||
bool toCreateGroups = false;
|
||||
if ( resMgr )
|
||||
toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false );
|
||||
bool toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false );
|
||||
bool toOverwrite = true;
|
||||
bool toFindOutDim = true;
|
||||
double zTol = resMgr ? resMgr->doubleValue( "SMESH", "med_ztolerance", 0. ) : 0.;
|
||||
bool toRenumber = true;
|
||||
double zTol = resMgr->doubleValue( "SMESH", "med_ztolerance", 0. );
|
||||
|
||||
QString aFilter, aTitle = QObject::tr("SMESH_EXPORT_MESH");
|
||||
QString anInitialPath = "";
|
||||
@ -670,44 +670,46 @@ namespace
|
||||
QList< QPair< GEOM::ListOfFields_var, QString > > aFieldList;
|
||||
|
||||
// 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( "IDEAS_FILES_FILTER" ) + " (*.unv)";
|
||||
else if ( isDAT )
|
||||
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(),
|
||||
anInitialPath + QString("/") + aMeshName,
|
||||
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";
|
||||
toCreateGroups = SMESHGUI::resourceMgr()->booleanValue( "SMESH", theByTypeResource, false );
|
||||
const char* theOptionResource = isCGNS ? "cgns_group_elems_by_type" : "export_renumber";
|
||||
bool option = resMgr->booleanValue( "SMESH", theOptionResource, false );
|
||||
|
||||
QStringList checkBoxes;
|
||||
checkBoxes << QObject::tr("CGNS_EXPORT_ELEMS_BY_TYPE");
|
||||
checkBoxes << QObject::tr( isCGNS ? "CGNS_EXPORT_ELEMS_BY_TYPE" : "SMESH_RENUMBER" );
|
||||
|
||||
SalomeApp_CheckFileDlg* fd =
|
||||
new SalomeApp_CheckFileDlg ( SMESHGUI::desktop(), false, checkBoxes, true, true );
|
||||
fd->setWindowTitle( aTitle );
|
||||
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() )
|
||||
fd->setDirectory( anInitialPath );
|
||||
fd->selectFile(aMeshName);
|
||||
fd->selectFile( aMeshName );
|
||||
SMESHGUI_FileValidator* fv = new SMESHGUI_FileValidator( fd );
|
||||
fd->setValidator( fv );
|
||||
fd->SetChecked( toCreateGroups, 0 );
|
||||
fd->SetChecked( option, 0 );
|
||||
|
||||
if ( fd->exec() )
|
||||
aFilename = fd->selectedFile();
|
||||
toOverwrite = fv->isOverwrite(aFilename);
|
||||
toCreateGroups = fd->IsChecked(0);
|
||||
SMESHGUI::resourceMgr()->setValue("SMESH", theByTypeResource, toCreateGroups );
|
||||
toOverwrite = fv->isOverwrite( aFilename );
|
||||
option = fd->IsChecked( 0 );
|
||||
SMESHGUI::resourceMgr()->setValue("SMESH", theOptionResource, option );
|
||||
( isCGNS ? toCreateGroups : toRenumber ) = option;
|
||||
|
||||
delete fd;
|
||||
}
|
||||
@ -751,7 +753,6 @@ namespace
|
||||
for ( CORBA::ULong i = 0; i < mvok->length(); ++i )
|
||||
{
|
||||
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]);
|
||||
}
|
||||
}
|
||||
@ -924,9 +925,9 @@ namespace
|
||||
// if ( SMESHGUI::automaticUpdate() )
|
||||
// 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();
|
||||
for( int aMeshIndex = 0; aMeshIter != aMeshList.end(); aMeshIter++, aMeshIndex++ )
|
||||
{
|
||||
@ -934,15 +935,11 @@ namespace
|
||||
SMESH::SMESH_Mesh_var aMeshItem = aMeshOrGroup->GetMesh();
|
||||
const GEOM::ListOfFields& fields = aFieldList[ aMeshIndex ].first.in();
|
||||
const QString& geoAssFields = aFieldList[ aMeshIndex ].second;
|
||||
const bool hasFields = ( fields.length() || !geoAssFields.isEmpty() );
|
||||
if ( !hasFields && aMeshOrGroup->_is_equivalent( aMeshItem ) && zTol < 0 )
|
||||
aMeshItem->ExportMED( aFilename.toUtf8().data(), toCreateGroups, aFormat,
|
||||
toOverwrite && aMeshIndex == 0, toFindOutDim );
|
||||
else
|
||||
|
||||
aMeshItem->ExportPartToMED( aMeshOrGroup, aFilename.toUtf8().data(),
|
||||
toCreateGroups, aFormat,
|
||||
toOverwrite && aMeshIndex == 0, toFindOutDim,
|
||||
fields, geoAssFields.toLatin1().data(), zTol );
|
||||
fields, geoAssFields.toLatin1().data(), zTol, saveNumbers );
|
||||
}
|
||||
}
|
||||
else if ( isSAUV )
|
||||
@ -957,16 +954,16 @@ namespace
|
||||
else if ( isDAT )
|
||||
{
|
||||
if ( aMeshOrGroup->_is_equivalent( aMesh ))
|
||||
aMesh->ExportDAT( aFilename.toUtf8().data() );
|
||||
aMesh->ExportDAT( aFilename.toUtf8().data(), toRenumber );
|
||||
else
|
||||
aMesh->ExportPartToDAT( aMeshOrGroup, aFilename.toUtf8().data() );
|
||||
aMesh->ExportPartToDAT( aMeshOrGroup, aFilename.toUtf8().data(), toRenumber );
|
||||
}
|
||||
else if ( isUNV )
|
||||
{
|
||||
if ( aMeshOrGroup->_is_equivalent( aMesh ))
|
||||
aMesh->ExportUNV( aFilename.toUtf8().data() );
|
||||
aMesh->ExportUNV( aFilename.toUtf8().data(), toRenumber );
|
||||
else
|
||||
aMesh->ExportPartToUNV( aMeshOrGroup, aFilename.toUtf8().data() );
|
||||
aMesh->ExportPartToUNV( aMeshOrGroup, aFilename.toUtf8().data(), toRenumber );
|
||||
}
|
||||
else if ( isSTL )
|
||||
{
|
||||
@ -5479,6 +5476,7 @@ void SMESHGUI::createPreferences()
|
||||
setPreferenceProperty( exportgroup, "columns", 2 );
|
||||
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_MED_SAVE_NUMS" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "med_save_numbers" );
|
||||
int zTol = addPreference( tr( "PREF_ZTOLERANCE" ), exportgroup, LightApp_Preferences::DblSpin, "SMESH", "med_ztolerance" );
|
||||
setPreferenceProperty( zTol, "precision", 10 );
|
||||
setPreferenceProperty( zTol, "min", 0.0000000001 );
|
||||
|
@ -891,6 +891,7 @@ void SMESHGUI_MeshDlg::setAvailableMeshType( const QStringList& theTypeMesh )
|
||||
{
|
||||
myMeshType->clear();
|
||||
myMeshType->addItems(theTypeMesh);
|
||||
myMeshType->setEnabled( theTypeMesh.size() > 1 );
|
||||
}
|
||||
//================================================================================
|
||||
/*!
|
||||
|
@ -106,12 +106,12 @@ SMESHGUI_EXPORT
|
||||
_PTR(SObject) FindSObject( CORBA::Object_ptr );
|
||||
|
||||
SMESHGUI_EXPORT
|
||||
void SetName( _PTR(SObject), const QString& );
|
||||
void SetName( _PTR(SObject), const QString& name );
|
||||
|
||||
SMESHGUI_EXPORT
|
||||
void SetValue( _PTR(SObject), const QString& );
|
||||
void setFileType( _PTR(SObject), const QString& );
|
||||
void setFileName( _PTR(SObject), const QString& );
|
||||
void SetValue ( _PTR(SObject), const QString& value );
|
||||
void setFileType( _PTR(SObject), const QString& fileType );
|
||||
void setFileName( _PTR(SObject), const QString& fileName );
|
||||
|
||||
SMESHGUI_EXPORT
|
||||
CORBA::Object_var SObjectToObject( _PTR(SObject) );
|
||||
@ -141,7 +141,7 @@ SMESHGUI_EXPORT
|
||||
}
|
||||
|
||||
SMESHGUI_EXPORT
|
||||
CORBA::Object_var IORToObject( const QString& );
|
||||
CORBA::Object_var IORToObject( const QString& ior );
|
||||
|
||||
template<class TInterface> typename TInterface::_var_type
|
||||
IORToInterface( const QString& theIOR )
|
||||
@ -153,7 +153,7 @@ SMESHGUI_EXPORT
|
||||
}
|
||||
|
||||
SMESHGUI_EXPORT
|
||||
CORBA::Object_var EntryToObject( const QString& );
|
||||
CORBA::Object_var EntryToObject( const QString& entry );
|
||||
|
||||
template<class TInterface> typename TInterface::_var_type
|
||||
EntryToInterface( const QString& theEntry )
|
||||
@ -165,7 +165,7 @@ SMESHGUI_EXPORT
|
||||
}
|
||||
|
||||
SMESHGUI_EXPORT
|
||||
int GetNameOfSelectedIObjects( LightApp_SelectionMgr*, QString& );
|
||||
int GetNameOfSelectedIObjects( LightApp_SelectionMgr*, QString& name );
|
||||
|
||||
SMESHGUI_EXPORT
|
||||
QString GetName( const Handle(SALOME_InteractiveObject)& theIO );
|
||||
@ -174,7 +174,7 @@ SMESHGUI_EXPORT
|
||||
_PTR(SObject) GetMeshOrSubmesh( _PTR(SObject) );
|
||||
|
||||
SMESHGUI_EXPORT
|
||||
void ShowHelpFile( const QString& );
|
||||
void ShowHelpFile( const QString& helpFileName);
|
||||
|
||||
/*!
|
||||
* \brief Return the normal to a face
|
||||
|
@ -2840,6 +2840,10 @@ Check algorithm documentation for supported geometry</translation>
|
||||
<source>SMESH_RENUMBERING</source>
|
||||
<translation>Renumbering</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_RENUMBER</source>
|
||||
<translation>Renumber</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_RENUMBERING_ELEMENTS_TITLE</source>
|
||||
<translation>Renumbering elements</translation>
|
||||
@ -4885,6 +4889,10 @@ Please, create VTK viewer and try again</translation>
|
||||
<source>PREF_SHOW_WARN</source>
|
||||
<translation>Show warning when exporting group</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_MED_SAVE_NUMS</source>
|
||||
<translation>Save cell/node numbers to MED file</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_ZTOLERANCE</source>
|
||||
<translation>Z tolerance for MED export</translation>
|
||||
|
@ -39,6 +39,15 @@ const char* SMESH::returnError(const char* 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"
|
||||
|
@ -108,6 +108,7 @@ namespace SMESH
|
||||
SMESHUtils_EXPORT void throwSalomeEx(const char* txt);
|
||||
SMESHUtils_EXPORT void doNothing(const char* txt);
|
||||
SMESHUtils_EXPORT const char* returnError(const char* txt);
|
||||
SMESHUtils_EXPORT void printErrorInDebugMode(const char* txt);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -4185,11 +4185,9 @@ namespace SMESH {
|
||||
"FT_LogicalOR",
|
||||
"FT_Undefined"};
|
||||
|
||||
#ifdef _DEBUG_
|
||||
// check if functName is complete, compilation failure means that enum FunctorType changed
|
||||
const int nbFunctors = sizeof(functName) / sizeof(const char*);
|
||||
int _assert[( nbFunctors == SMESH::FT_Undefined + 1 ) ? 2 : -1 ]; _assert[0]=_assert[1]=0;
|
||||
#endif
|
||||
static_assert( sizeof(functName) / sizeof(const char*) == SMESH::FT_Undefined + 1,
|
||||
"Update names of FunctorType's!!!" );
|
||||
|
||||
return functName;
|
||||
}
|
||||
|
@ -2707,10 +2707,10 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::ListOfIDSources& theMeshesArray,
|
||||
{
|
||||
// type names
|
||||
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*);
|
||||
int _assert[( nbNames == SMESH::NB_ELEMENT_TYPES ) ? 2 : -1 ]; _assert[0]=_assert[1]=0;
|
||||
}
|
||||
|
||||
// check of typeNames: compilation failure mains that NB_ELEMENT_TYPES changed:
|
||||
static_assert( sizeof(typeNames) / sizeof(const char*) ==SMESH::NB_ELEMENT_TYPES,
|
||||
"Update names of ElementType's!!!" );
|
||||
|
||||
SMESH::smIdType_array_var curState = newMesh->GetNbElementsByType();
|
||||
|
||||
@ -4206,8 +4206,9 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
|
||||
system(cmd.ToCString());
|
||||
|
||||
// MED writer to be used by storage process
|
||||
DriverMED_W_SMESHDS_Mesh myWriter;
|
||||
myWriter.SetFile( meshfile.ToCString() );
|
||||
DriverMED_W_SMESHDS_Mesh writer;
|
||||
writer.SetFile( meshfile.ToCString() );
|
||||
writer.SetSaveNumbers( false ); // bos #24400
|
||||
|
||||
// IMP issue 20918
|
||||
// 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
|
||||
if ( mySMESHDSMesh->NbNodes() > 0 ) {
|
||||
// write mesh data to med file
|
||||
myWriter.SetMesh( mySMESHDSMesh );
|
||||
myWriter.SetMeshId( id );
|
||||
writer.SetMesh( mySMESHDSMesh );
|
||||
writer.SetMeshId( id );
|
||||
strHasData = "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
|
||||
SMESHDS_Group* aGrpDS = dynamic_cast<SMESHDS_Group*>( aGrpBaseDS );
|
||||
if ( aGrpDS )
|
||||
myWriter.AddGroup( aGrpDS );
|
||||
writer.AddGroup( aGrpDS );
|
||||
|
||||
// write reference on a shape if exists
|
||||
SMESHDS_GroupOnGeom* aGeomGrp =
|
||||
@ -4914,7 +4915,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
|
||||
else // shape ref is invalid:
|
||||
{
|
||||
// save a group on geometry as ordinary group
|
||||
myWriter.AddGroup( aGeomGrp );
|
||||
writer.AddGroup( aGeomGrp );
|
||||
}
|
||||
}
|
||||
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 )
|
||||
{
|
||||
// Flush current mesh information into MED file
|
||||
myWriter.Perform();
|
||||
writer.Perform();
|
||||
|
||||
// save info on nb of elements
|
||||
SMESH_PreMeshInfo::SaveToFile( myImpl, id, aFile );
|
||||
@ -5547,7 +5548,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
|
||||
}
|
||||
} // 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
|
||||
|
||||
list< pair< SMESH_Hypothesis_i*, string > >::iterator hyp_data;
|
||||
|
@ -439,7 +439,7 @@ SMESH::smIdType SMESH_Group_i::AddFrom( SMESH::SMESH_IDSource_ptr theSource )
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
* Return ID of theIndex-th group item
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
|
@ -109,7 +109,7 @@ class SMESH_I_EXPORT SMESH_GroupBase_i:
|
||||
|
||||
|
||||
// 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_Group* GetSmeshGroup() const;
|
||||
SMESHDS_GroupBase* GetGroupDS() const;
|
||||
|
@ -102,7 +102,7 @@ namespace MeshEditor_I {
|
||||
//!< Constructor
|
||||
TPreviewMesh(SMDSAbs_ElementType previewElements = SMDSAbs_All) {
|
||||
_isShapeToMesh = (_id = 0);
|
||||
_myMeshDS = new SMESHDS_Mesh( _id, true );
|
||||
_meshDS = new SMESHDS_Mesh( _id, true );
|
||||
myPreviewType = previewElements;
|
||||
}
|
||||
//!< Copy a set of elements
|
||||
@ -155,7 +155,7 @@ namespace MeshEditor_I {
|
||||
//!< Copy a node
|
||||
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());
|
||||
}
|
||||
void RemoveAll()
|
||||
|
@ -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;
|
||||
if ( _preMeshInfo )
|
||||
@ -3833,11 +3833,12 @@ void SMESH_Mesh_i::ExportDAT (const char *file)
|
||||
// check names of groups
|
||||
checkGroupNames();
|
||||
// Update Python script
|
||||
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportDAT( r'" << file << "' )";
|
||||
TPythonDump() << SMESH::SMESH_Mesh_var(_this())
|
||||
<< ".ExportDAT( r'" << file<< ", " << renumber << "' )";
|
||||
|
||||
// Perform Export
|
||||
PrepareForWriting(file);
|
||||
_impl->ExportDAT(file);
|
||||
PrepareForWriting( file );
|
||||
_impl->ExportDAT( file, /*part=*/nullptr, renumber );
|
||||
|
||||
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;
|
||||
if ( _preMeshInfo )
|
||||
@ -3857,11 +3858,12 @@ void SMESH_Mesh_i::ExportUNV (const char *file)
|
||||
// check names of groups
|
||||
checkGroupNames();
|
||||
// Update Python script
|
||||
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportUNV( r'" << file << "' )";
|
||||
TPythonDump() << SMESH::SMESH_Mesh_var(_this())
|
||||
<< ".ExportUNV( r'" << file << "' " << renumber << "' )";
|
||||
|
||||
// Perform Export
|
||||
PrepareForWriting(file);
|
||||
_impl->ExportUNV(file);
|
||||
PrepareForWriting( file );
|
||||
_impl->ExportUNV( file, /*part=*/nullptr, renumber );
|
||||
|
||||
SMESH_CATCH( SMESH::throwCorbaException );
|
||||
}
|
||||
@ -3896,22 +3898,32 @@ void SMESH_Mesh_i::ExportSTL (const char *file, const bool isascii)
|
||||
SMESH_CATCH( SMESH::throwCorbaException );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
|
||||
class MEDFileSpeCls
|
||||
{
|
||||
public:
|
||||
MEDFileSpeCls(const char *file, CORBA::Boolean overwrite, CORBA::Long version):_file(file),_overwrite(overwrite),_version(version) { }
|
||||
std::string prepareMeshNameAndGroups(SMESH_Mesh_i& self) { return self.prepareMeshNameAndGroups(_file.c_str(),_overwrite); }
|
||||
void exportTo(SMESH_Mesh *mesh, const std::string& aMeshName, CORBA::Boolean auto_groups,
|
||||
SMESH_MeshPartDS* partDS,
|
||||
CORBA::Boolean autoDimension, bool have0dField,
|
||||
CORBA::Double ZTolerance)
|
||||
MEDFileSpeCls(const char * file,
|
||||
CORBA::Boolean overwrite,
|
||||
CORBA::Long version)
|
||||
:_file(file), _overwrite(overwrite), _version(version)
|
||||
{}
|
||||
std::string prepareMeshNameAndGroups(SMESH_Mesh_i& self)
|
||||
{
|
||||
mesh->ExportMED( _file.c_str(), aMeshName.c_str(), auto_groups, _version,
|
||||
partDS, autoDimension,have0dField,ZTolerance);
|
||||
|
||||
return self.prepareMeshNameAndGroups(_file.c_str(),_overwrite);
|
||||
}
|
||||
|
||||
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;
|
||||
fieldWriter.SetFile( _file.c_str() );
|
||||
@ -3921,12 +3933,18 @@ public:
|
||||
}
|
||||
|
||||
void prepareForWriting(SMESH_Mesh_i& self) { self.PrepareForWriting(_file.c_str(), _overwrite); }
|
||||
|
||||
private:
|
||||
std::string _file;
|
||||
CORBA::Boolean _overwrite;
|
||||
CORBA::Long _version;
|
||||
};
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Export a part of mesh to a med file
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
template<class SPECLS>
|
||||
void SMESH_Mesh_i::ExportPartToMEDCommon(SPECLS& speCls,
|
||||
@ -3935,7 +3953,8 @@ void SMESH_Mesh_i::ExportPartToMEDCommon(SPECLS& speCls,
|
||||
CORBA::Boolean autoDimension,
|
||||
const GEOM::ListOfFields& fields,
|
||||
const char* geomAssocFields,
|
||||
CORBA::Double ZTolerance)
|
||||
CORBA::Double ZTolerance,
|
||||
CORBA::Boolean saveNumbers)
|
||||
{
|
||||
SMESH_TRY;
|
||||
if ( _preMeshInfo )
|
||||
@ -3958,8 +3977,7 @@ void SMESH_Mesh_i::ExportPartToMEDCommon(SPECLS& speCls,
|
||||
if ( fieldShape->_is_nil() )
|
||||
THROW_SALOME_CORBA_EXCEPTION( "Null shape under a field", SALOME::INTERNAL_ERROR );
|
||||
if ( !fieldShape->IsSame( shapeToMesh ) )
|
||||
THROW_SALOME_CORBA_EXCEPTION
|
||||
( "Field defined not on shape", SALOME::BAD_PARAM);
|
||||
THROW_SALOME_CORBA_EXCEPTION( "Field defined not on shape", SALOME::BAD_PARAM);
|
||||
if ( fields[i]->GetDimension() == 0 )
|
||||
have0dField = true;
|
||||
}
|
||||
@ -3983,7 +4001,8 @@ void SMESH_Mesh_i::ExportPartToMEDCommon(SPECLS& speCls,
|
||||
SMESH::DownCast< SMESH_Mesh_i* >( meshPart ))
|
||||
{
|
||||
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();
|
||||
}
|
||||
else
|
||||
@ -4000,7 +4019,8 @@ void SMESH_Mesh_i::ExportPartToMEDCommon(SPECLS& speCls,
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -4008,7 +4028,7 @@ void SMESH_Mesh_i::ExportPartToMEDCommon(SPECLS& speCls,
|
||||
|
||||
if ( _impl->HasShapeToMesh() )
|
||||
{
|
||||
speCls.exportField(*this,aMeshName,have0dField,meshDS,fields,geomAssocFields);
|
||||
speCls.exportField( *this, aMeshName, have0dField, meshDS, fields, geomAssocFields);
|
||||
}
|
||||
SMESH_CATCH( SMESH::throwCorbaException );
|
||||
}
|
||||
@ -4027,11 +4047,14 @@ void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
|
||||
CORBA::Boolean autoDimension,
|
||||
const GEOM::ListOfFields& fields,
|
||||
const char* geomAssocFields,
|
||||
CORBA::Double ZTolerance)
|
||||
CORBA::Double ZTolerance,
|
||||
CORBA::Boolean saveNumbers)
|
||||
{
|
||||
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
|
||||
SMESH_TRY;
|
||||
GEOM::ListOfGBO_var goList = new GEOM::ListOfGBO;
|
||||
@ -4050,24 +4073,31 @@ void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
|
||||
<< autoDimension << ", "
|
||||
<< goList << ", '"
|
||||
<< ( geomAssocFields ? geomAssocFields : "" ) << "',"
|
||||
<< TVar( ZTolerance )
|
||||
<< TVar( ZTolerance ) << ", "
|
||||
<< saveNumbers
|
||||
<< " )";
|
||||
SMESH_CATCH( SMESH::throwCorbaException );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
|
||||
class MEDFileMemSpeCls
|
||||
{
|
||||
public:
|
||||
std::string prepareMeshNameAndGroups(SMESH_Mesh_i& self) { return self.generateMeshName(); }
|
||||
|
||||
void exportTo(SMESH_Mesh *mesh, const std::string& aMeshName, CORBA::Boolean auto_groups,
|
||||
SMESH_MeshPartDS* partDS,
|
||||
CORBA::Boolean autoDimension, bool have0dField,
|
||||
CORBA::Double ZTolerance)
|
||||
SMESH_MeshPartDS* partDS, CORBA::Boolean autoDimension, bool have0dField,
|
||||
CORBA::Double ZTolerance, CORBA::Boolean saveNumbers )
|
||||
{
|
||||
_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 exportField(SMESH_Mesh_i& self, const std::string& aMeshName, bool have0dField, SMESHDS_Mesh *meshDS, const GEOM::ListOfFields& fields, const char*geomAssocFields)
|
||||
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)
|
||||
{
|
||||
DriverMED_W_Field_Mem fieldWriter(_res);
|
||||
fieldWriter.SetMeshName( aMeshName );
|
||||
@ -4077,25 +4107,38 @@ public:
|
||||
}
|
||||
public:
|
||||
MEDCoupling::MCAuto<MEDCoupling::DataArrayByte> getData() { return _res; }
|
||||
|
||||
private:
|
||||
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::Boolean auto_groups,
|
||||
CORBA::Boolean autoDimension,
|
||||
const GEOM::ListOfFields& fields,
|
||||
const char* geomAssocFields,
|
||||
CORBA::Double ZTolerance)
|
||||
CORBA::Double ZTolerance,
|
||||
CORBA::Boolean saveNumbers)
|
||||
{
|
||||
MEDCoupling::MCAuto<MEDCoupling::DataArrayByte> data;
|
||||
|
||||
SMESH_TRY;
|
||||
if( !this->_gen_i->isSSLMode() )
|
||||
SMESH::throwCorbaException("SMESH_Mesh_i::ExportPartToMEDCoupling : only for embedded mode !");
|
||||
|
||||
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();
|
||||
|
||||
SMESH_CATCH( SMESH::throwCorbaException );
|
||||
|
||||
MEDCoupling::DataArrayByte *ret(data.retn());
|
||||
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,
|
||||
const char* file)
|
||||
void SMESH_Mesh_i::ExportPartToDAT(SMESH::SMESH_IDSource_ptr meshPart,
|
||||
const char* file,
|
||||
CORBA::Boolean renumber )
|
||||
{
|
||||
SMESH_TRY;
|
||||
if ( _preMeshInfo )
|
||||
_preMeshInfo->FullLoadFromFile();
|
||||
|
||||
PrepareForWriting(file);
|
||||
|
||||
SMESH_MeshPartDS partDS( meshPart );
|
||||
_impl->ExportDAT(file,&partDS);
|
||||
_impl->ExportDAT( file, &partDS, renumber );
|
||||
|
||||
TPythonDump() << SMESH::SMESH_Mesh_var(_this())
|
||||
<< ".ExportPartToDAT( " << meshPart << ", r'" << file << "' )";
|
||||
<< ".ExportPartToDAT( " << meshPart << ", r'" << file << ", " << renumber << "' )";
|
||||
|
||||
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,
|
||||
const char* file)
|
||||
void SMESH_Mesh_i::ExportPartToUNV(SMESH::SMESH_IDSource_ptr meshPart,
|
||||
const char* file,
|
||||
CORBA::Boolean renumber)
|
||||
{
|
||||
SMESH_TRY;
|
||||
if ( _preMeshInfo )
|
||||
@ -4408,10 +4449,10 @@ void SMESH_Mesh_i::ExportPartToUNV(::SMESH::SMESH_IDSource_ptr meshPart,
|
||||
PrepareForWriting(file);
|
||||
|
||||
SMESH_MeshPartDS partDS( meshPart );
|
||||
_impl->ExportUNV(file, &partDS);
|
||||
_impl->ExportUNV(file, &partDS, renumber );
|
||||
|
||||
TPythonDump() << SMESH::SMESH_Mesh_var(_this())
|
||||
<< ".ExportPartToUNV( " << meshPart<< ", r'" << file << "' )";
|
||||
<< ".ExportPartToUNV( " << meshPart<< ", r'" << file << ", " << renumber << "' )";
|
||||
|
||||
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) )
|
||||
{
|
||||
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 ))
|
||||
aResult[ i ] = n->GetID();
|
||||
}
|
||||
@ -5577,7 +5618,7 @@ SMESH::smIdType_array* SMESH_Mesh_i::GetElemFaceNodes(SMESH::smIdType elemId,
|
||||
{
|
||||
aResult->length( vtool.NbFaceNodes( 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();
|
||||
}
|
||||
}
|
||||
@ -5660,7 +5701,7 @@ SMESH::smIdType_array* SMESH_Mesh_i::GetElementsByNodes(const SMESH::smIdType_ar
|
||||
if ( SMESHDS_Mesh* mesh = _impl->GetMeshDS() )
|
||||
{
|
||||
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] );
|
||||
|
||||
std::vector<const SMDS_MeshElement *> elems;
|
||||
|
@ -213,13 +213,12 @@ public:
|
||||
CORBA::Boolean autoDimension = true);
|
||||
|
||||
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 ExportDAT( const char* file );
|
||||
void ExportUNV( const char* file );
|
||||
void ExportDAT( const char* file, const CORBA::Boolean renumber );
|
||||
void ExportUNV( const char* file, const CORBA::Boolean renumber );
|
||||
void ExportSTL( const char* file, bool isascii );
|
||||
void ExportCGNS(SMESH::SMESH_IDSource_ptr meshPart,
|
||||
const char* file,
|
||||
@ -237,7 +236,8 @@ public:
|
||||
CORBA::Boolean autoDim,
|
||||
const GEOM::ListOfFields& fields,
|
||||
const char* geomAssocFields,
|
||||
CORBA::Double ZTolerance);
|
||||
CORBA::Double ZTolerance,
|
||||
CORBA::Boolean saveNumbers );
|
||||
|
||||
void ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
|
||||
const char* file,
|
||||
@ -247,19 +247,23 @@ public:
|
||||
CORBA::Boolean autoDim,
|
||||
const GEOM::ListOfFields& fields,
|
||||
const char* geomAssocFields,
|
||||
CORBA::Double ZTolerance);
|
||||
CORBA::Double ZTolerance,
|
||||
CORBA::Boolean saveNumbers );
|
||||
|
||||
CORBA::LongLong ExportPartToMEDCoupling(SMESH::SMESH_IDSource_ptr meshPart,
|
||||
CORBA::Boolean auto_groups,
|
||||
CORBA::Boolean autoDim,
|
||||
const GEOM::ListOfFields& fields,
|
||||
const char* geomAssocFields,
|
||||
CORBA::Double ZTolerance);
|
||||
CORBA::Double ZTolerance,
|
||||
CORBA::Boolean saveNumbers);
|
||||
|
||||
void ExportPartToDAT(SMESH::SMESH_IDSource_ptr meshPart,
|
||||
const char* file);
|
||||
const char* file,
|
||||
CORBA::Boolean renumber);
|
||||
void ExportPartToUNV(SMESH::SMESH_IDSource_ptr meshPart,
|
||||
const char* file);
|
||||
const char* file,
|
||||
CORBA::Boolean renumber);
|
||||
void ExportPartToSTL(SMESH::SMESH_IDSource_ptr meshPart,
|
||||
const char* file,
|
||||
CORBA::Boolean isascii);
|
||||
|
@ -286,7 +286,7 @@ SMESH::point_array*
|
||||
|
||||
list<const gp_XYZ *> xyzList;
|
||||
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];
|
||||
const SMDS_MeshElement * elem = aMesh->GetMeshDS()->FindElement(index);
|
||||
@ -345,7 +345,7 @@ SMESH::point_array*
|
||||
|
||||
list<const gp_XYZ *> xyzList;
|
||||
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];
|
||||
const SMDS_MeshElement * elem = aMesh->GetMeshDS()->FindElement(index);
|
||||
|
@ -2309,7 +2309,8 @@ class Mesh(metaclass = MeshMeta):
|
||||
the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
|
||||
the typical use is auto_groups=False.
|
||||
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
|
||||
|
||||
- 1D if all mesh nodes lie on OX coordinate axis, or
|
||||
@ -2330,6 +2331,7 @@ class Mesh(metaclass = MeshMeta):
|
||||
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.
|
||||
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
|
||||
meshPart = args[1] if len(args) > 1 else None
|
||||
@ -2337,6 +2339,7 @@ class Mesh(metaclass = MeshMeta):
|
||||
fields = args[3] if len(args) > 3 else []
|
||||
geomAssocFields = args[4] if len(args) > 4 else ''
|
||||
z_tolerance = args[5] if len(args) > 5 else -1.
|
||||
saveNumbers = args[6] if len(args) > 6 else True
|
||||
# process keywords arguments
|
||||
auto_groups = kwargs.get("auto_groups", auto_groups)
|
||||
meshPart = kwargs.get("meshPart", meshPart)
|
||||
@ -2344,9 +2347,10 @@ class Mesh(metaclass = MeshMeta):
|
||||
fields = kwargs.get("fields", fields)
|
||||
geomAssocFields = kwargs.get("geomAssocFields", geomAssocFields)
|
||||
z_tolerance = kwargs.get("zTolerance", z_tolerance)
|
||||
saveNumbers = kwargs.get("saveNumbers", saveNumbers)
|
||||
|
||||
# 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()
|
||||
if isinstance( meshPart, list ):
|
||||
meshPart = self.GetIDSource( meshPart, SMESH.ALL )
|
||||
@ -2355,7 +2359,9 @@ class Mesh(metaclass = MeshMeta):
|
||||
z_tolerance,Parameters,hasVars = ParseParameters(z_tolerance)
|
||||
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
|
||||
dab = medcoupling.FromPyIntPtrToDataArrayByte(intPtr)
|
||||
return medcoupling.MEDFileData.New(dab)
|
||||
@ -2383,7 +2389,8 @@ class Mesh(metaclass = MeshMeta):
|
||||
or 3.2.1 or 3.3.1 formats.
|
||||
If the version is equal to -1, the version is not changed (default).
|
||||
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
|
||||
|
||||
- 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
|
||||
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.
|
||||
saveNumbers (boolean) : enable saving numbers of nodes and cells.
|
||||
"""
|
||||
# process positional arguments
|
||||
#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 []
|
||||
geomAssocFields = args[7] if len(args) > 7 else ''
|
||||
z_tolerance = args[8] if len(args) > 8 else -1.
|
||||
saveNumbers = args[9] if len(args) > 9 else True
|
||||
# process keywords arguments
|
||||
auto_groups = kwargs.get("auto_groups", auto_groups)
|
||||
version = kwargs.get("version", version)
|
||||
@ -2426,9 +2435,13 @@ class Mesh(metaclass = MeshMeta):
|
||||
fields = kwargs.get("fields", fields)
|
||||
geomAssocFields = kwargs.get("geomAssocFields", geomAssocFields)
|
||||
z_tolerance = kwargs.get("zTolerance", z_tolerance)
|
||||
saveNumbers = kwargs.get("saveNumbers", saveNumbers)
|
||||
|
||||
if isinstance( meshPart, Mesh):
|
||||
meshPart = meshPart.GetMesh()
|
||||
|
||||
# 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()
|
||||
if isinstance( meshPart, list ):
|
||||
meshPart = self.GetIDSource( meshPart, SMESH.ALL )
|
||||
@ -2439,7 +2452,7 @@ class Mesh(metaclass = MeshMeta):
|
||||
|
||||
self.mesh.ExportPartToMED( meshPart, fileName, auto_groups,
|
||||
version, overwrite, autoDimension,
|
||||
fields, geomAssocFields, z_tolerance)
|
||||
fields, geomAssocFields, z_tolerance, saveNumbers )
|
||||
else:
|
||||
self.mesh.ExportMED(fileName, auto_groups, version, overwrite, autoDimension)
|
||||
|
||||
@ -2457,41 +2470,43 @@ class Mesh(metaclass = MeshMeta):
|
||||
|
||||
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
|
||||
|
||||
Parameters:
|
||||
f: the file name
|
||||
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()
|
||||
if isinstance( meshPart, list ):
|
||||
meshPart = self.GetIDSource( meshPart, SMESH.ALL )
|
||||
unRegister.set( meshPart )
|
||||
self.mesh.ExportPartToDAT( meshPart, f )
|
||||
self.mesh.ExportPartToDAT( meshPart, f, renumber )
|
||||
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
|
||||
|
||||
Parameters:
|
||||
f: the file name
|
||||
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()
|
||||
if isinstance( meshPart, list ):
|
||||
meshPart = self.GetIDSource( meshPart, SMESH.ALL )
|
||||
unRegister.set( meshPart )
|
||||
self.mesh.ExportPartToUNV( meshPart, f )
|
||||
self.mesh.ExportPartToUNV( meshPart, f, renumber )
|
||||
else:
|
||||
self.mesh.ExportUNV(f)
|
||||
self.mesh.ExportUNV( f, renumber )
|
||||
|
||||
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
|
||||
args2.append(True)
|
||||
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
|
||||
omniORB.registerObjref(SMESH._objref_SMESH_Mesh._NP_RepositoryId, meshProxy)
|
||||
|
||||
|
@ -99,7 +99,7 @@ namespace
|
||||
{
|
||||
TmpMesh() {
|
||||
_isShapeToMesh = (_id = 0);
|
||||
_myMeshDS = new SMESHDS_Mesh( _id, true );
|
||||
_meshDS = new SMESHDS_Mesh( _id, true );
|
||||
}
|
||||
};
|
||||
//=======================================================================
|
||||
|
@ -240,7 +240,7 @@ namespace
|
||||
{
|
||||
TmpMesh()
|
||||
{
|
||||
_myMeshDS = new SMESHDS_Mesh(/*id=*/0, /*isEmbeddedMode=*/true);
|
||||
_meshDS = new SMESHDS_Mesh(/*id=*/0, /*isEmbeddedMode=*/true);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -53,7 +53,7 @@ class STDMESHERSGUI_EXPORT StdMeshersGUI_ObjectReferenceParamWdg : public QWidge
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
public:
|
||||
StdMeshersGUI_ObjectReferenceParamWdg( SUIT_SelectionFilter* filter,
|
||||
QWidget* parent,
|
||||
bool multiSelection=false
|
||||
@ -75,6 +75,7 @@ public:
|
||||
|
||||
size_t NbObjects() const { return myObjects.size(); }
|
||||
|
||||
// Return object entries
|
||||
QString GetValue() const { return myParamValue; }
|
||||
|
||||
bool IsObjectSelected(size_t i=0) const
|
||||
@ -93,7 +94,7 @@ public:
|
||||
|
||||
void SetDefaultText(QString defaultText="", QString styleSheet="");
|
||||
|
||||
public slots:
|
||||
public slots:
|
||||
/*!
|
||||
* \brief Activates selection (if not yet done), emits selectionActivated()
|
||||
*
|
||||
@ -103,7 +104,7 @@ public slots:
|
||||
void activateSelection();
|
||||
void deactivateSelection();
|
||||
|
||||
signals:
|
||||
signals:
|
||||
/*!
|
||||
* \brief Emitted when selection is activated
|
||||
*
|
||||
@ -113,13 +114,13 @@ signals:
|
||||
void selectionActivated();
|
||||
void contentModified();
|
||||
|
||||
private slots:
|
||||
private slots:
|
||||
void onSelectionDone();
|
||||
|
||||
private:
|
||||
private:
|
||||
void init();
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
bool myMultiSelection;
|
||||
std::vector<CORBA::Object_var> myObjects;
|
||||
|
Loading…
Reference in New Issue
Block a user