-// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
{
Kernel_Utils::Localizer loc;
Status aResult = DRS_OK;
+
+ if ( Driver_Mesh::IsMeshTooLarge< int >( myMesh, /*checkIDs =*/ false))
+ return DRS_TOO_LARGE_MESH;
+
#if defined(WIN32) && defined(UNICODE)
std::wstring aFile = Kernel_Utils::utf8_decode_s(myFile);
std::ofstream out_stream(aFile.c_str());
#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 );
{
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();
while ( anIter->more() )
{
const SMDS_MeshEdge* anElem = anIter->next();
- // aRec.label = anElem->GetID(); -- IPAL54452
- ++aRec.label;
+ if ( myRenumber ) // -- IPAL54452
+ ++aRec.label;
+ else
+ aRec.label = anElem->GetID();
if ( !elemLabelByID.empty() )
elemLabelByID[ anElem->GetID() ] = aRec.label;
{
const SMDS_MeshNode* aNode = aNodesIter->next();
if ( nodeLabelByID.empty() )
- aRec.node_labels.push_back( aNode->GetID() );
+ aRec.node_labels.push_back( FromSmIdType<int>(aNode->GetID()) );
else
aRec.node_labels.push_back( nodeLabelByID[ aNode->GetID() ]);
}
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( aNode->GetID() );
+ aRec.node_labels.push_back( FromSmIdType<int>(aNode->GetID()) );
else
aRec.node_labels.push_back( nodeLabelByID[ aNode->GetID() ]);
}
default:
continue;
}
- // aRec.label = anElem->GetID(); -- IPAL54452
- ++aRec.label;
+ if ( myRenumber )
+ ++aRec.label;
+ else
+ aRec.label = anElem->GetID(); // -- IPAL54452
if ( !elemLabelByID.empty() )
elemLabelByID[ anElem->GetID() ] = aRec.label;
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;
{
const SMDS_MeshElement* aNode = aNodesIter->next();
if ( nodeLabelByID.empty() )
- aRec.node_labels.push_back( aNode->GetID() );
+ aRec.node_labels.push_back( FromSmIdType<int>(aNode->GetID()) );
else
aRec.node_labels.push_back( nodeLabelByID[ aNode->GetID() ]);
}
// --------------------
{
using namespace UNV2417;
- if ( myGroups.size() > 0 ) {
+ if ( myGroups.size() > 0 )
+ {
TRecord aRec;
TDataSet aDataSet2417;
TGroupList::const_iterator aIter = myGroups.begin();
while ( aIter->more() ) {
const SMDS_MeshElement* aNode = aIter->next();
if ( nodeLabelByID.empty() )
- aRec.NodeList.push_back( aNode->GetID() );
+ aRec.NodeList.push_back( FromSmIdType<int>( aNode->GetID()) );
else
aRec.NodeList.push_back( nodeLabelByID[ aNode->GetID() ]);
}
while ( aIter->more() ) {
const SMDS_MeshElement* aElem = aIter->next();
if ( elemLabelByID.empty() )
- aRec.ElementList.push_back( aElem->GetID() );
+ aRec.ElementList.push_back( FromSmIdType<int>(aElem->GetID()) );
else
aRec.ElementList.push_back( elemLabelByID[ aElem->GetID() ]);
}
EXCEPTION(runtime_error,"ERROR: Output file not good.");
}
catch(const std::exception& exc){
- INFOS("Follow exception was cought:\n\t"<<exc.what());
+ INFOS("Follow exception was caught:\n\t"<<exc.what());
throw;
}
catch(...){
- INFOS("Unknown exception was cought !!!");
+ INFOS("Unknown exception was caught !!!");
throw;
}
return aResult;