From: eap Date: Tue, 6 Jul 2021 13:17:33 +0000 (+0300) Subject: bos #24368 EDF 23667 - Duplicates nodes X-Git-Tag: V9_8_0a1~31 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d5aa4efde29d902f7be1259d7603d36e95f61215;p=modules%2Fsmesh.git bos #24368 EDF 23667 - Duplicates nodes + Suppress warnings --- diff --git a/idl/SMESH_Mesh.idl b/idl/SMESH_Mesh.idl index 070732b25..28896496b 100644 --- a/idl/SMESH_Mesh.idl +++ b/idl/SMESH_Mesh.idl @@ -664,8 +664,7 @@ module SMESH in boolean autoDimension) raises (SALOME::SALOME_Exception); long long ExportMEDCoupling(in boolean auto_groups, - in boolean autoDimension - ) raises (SALOME::SALOME_Exception); + in boolean autoDimension) raises (SALOME::SALOME_Exception); /*! * Export a [part of] Mesh into a MED file diff --git a/src/Driver/Driver_Mesh.h b/src/Driver/Driver_Mesh.h index 9eac8fc88..8ec3bac1f 100644 --- a/src/Driver/Driver_Mesh.h +++ b/src/Driver/Driver_Mesh.h @@ -32,6 +32,7 @@ #include #include +#include #ifdef WIN32 #if defined MESHDRIVER_EXPORTS || defined MeshDriver_EXPORTS @@ -79,7 +80,7 @@ class MESHDRIVER_EXPORT Driver_Mesh { if ( sizeof( IDTYPE ) < sizeof( smIdType )) { - const smIdType maxNB = std::numeric_limits< IDTYPE >::max(); + const smIdType maxNB = ToSmIdType( std::numeric_limits< IDTYPE >::max() ); return (( checkIDs ? mesh->MaxNodeID() : mesh->NbNodes() ) > maxNB || ( checkIDs ? mesh->MaxElementID() : mesh->NbElements() > maxNB )); } diff --git a/src/DriverDAT/DriverDAT_R_SMDS_Mesh.cxx b/src/DriverDAT/DriverDAT_R_SMDS_Mesh.cxx index 27fa48bbb..d0f233ecc 100644 --- a/src/DriverDAT/DriverDAT_R_SMDS_Mesh.cxx +++ b/src/DriverDAT/DriverDAT_R_SMDS_Mesh.cxx @@ -76,7 +76,7 @@ Driver_Mesh::Status DriverDAT_R_SMDS_Mesh::Perform() myMesh->AddNodeWithID(coordX, coordY, coordZ, intNumPoint); } - fprintf(stdout, "%ld noeuds\n", myMesh->NbNodes()); + fprintf(stdout, "%ld noeuds\n", static_cast< long >( myMesh->NbNodes() )); /**************************************************************************** * LECTURE DES ELEMENTS * ****************************************************************************/ diff --git a/src/SMDS/SMDS_UnstructuredGrid.cxx b/src/SMDS/SMDS_UnstructuredGrid.cxx index d6b4a2126..124d069f1 100644 --- a/src/SMDS/SMDS_UnstructuredGrid.cxx +++ b/src/SMDS/SMDS_UnstructuredGrid.cxx @@ -1004,14 +1004,14 @@ void SMDS_UnstructuredGrid::ModifyCellNodes(int vtkVolId, std::map loc */ int SMDS_UnstructuredGrid::getOrderedNodesOfFace(int vtkVolId, int& dim, std::vector& orderedNodes) { - int vtkType = this->GetCellType(vtkVolId); - dim = SMDS_Downward::getCellDimension(vtkType); + int vtkType = this->GetCellType( vtkVolId ); + dim = SMDS_Downward::getCellDimension( vtkType ); if (dim == 3) - { - SMDS_Down3D *downvol = static_cast (_downArray[vtkType]); - int downVolId = this->_cellIdToDownId[vtkVolId]; - downvol->getOrderedNodesOfFace(downVolId, orderedNodes); - } + { + SMDS_Down3D *downvol = static_cast (_downArray[vtkType]); + int downVolId = this->_cellIdToDownId[ vtkVolId ]; + downvol->getOrderedNodesOfFace(downVolId, orderedNodes); + } // else nothing to do; return orderedNodes.size(); } @@ -1090,74 +1090,88 @@ SMDS_UnstructuredGrid::extrudeVolumeFromFace(int vtkVolId, break; default: isQuadratic = false; - break; + break; } if (isQuadratic) + { + long dom1 = domain1; + long dom2 = domain2; + long dom1_2; // for nodeQuadDomains + if (domain1 < domain2) + dom1_2 = dom1 + INT_MAX * dom2; + else + dom1_2 = dom2 + INT_MAX * dom1; + //cerr << "dom1=" << dom1 << " dom2=" << dom2 << " dom1_2=" << dom1_2 << endl; + int ima = orderedOriginals.size(); + int mid = orderedOriginals.size() / 2; + //cerr << "ima=" << ima << " mid=" << mid << endl; + for (int i = 0; i < mid; i++) + orderedNodes.push_back(nodeDomains[orderedOriginals[i]][domain1]); + for (int i = 0; i < mid; i++) + orderedNodes.push_back(nodeDomains[orderedOriginals[i]][domain2]); + for (int i = mid; i < ima; i++) + orderedNodes.push_back(nodeDomains[orderedOriginals[i]][domain1]); + for (int i = mid; i < ima; i++) + orderedNodes.push_back(nodeDomains[orderedOriginals[i]][domain2]); + for (int i = 0; i < mid; i++) { - long dom1 = domain1; - long dom2 = domain2; - long dom1_2; // for nodeQuadDomains - if (domain1 < domain2) - dom1_2 = dom1 + INT_MAX * dom2; + int oldId = orderedOriginals[i]; + int newId; + if (nodeQuadDomains.count(oldId) && nodeQuadDomains[oldId].count(dom1_2)) + newId = nodeQuadDomains[oldId][dom1_2]; else - dom1_2 = dom2 + INT_MAX * dom1; - //cerr << "dom1=" << dom1 << " dom2=" << dom2 << " dom1_2=" << dom1_2 << endl; - int ima = orderedOriginals.size(); - int mid = orderedOriginals.size() / 2; - //cerr << "ima=" << ima << " mid=" << mid << endl; - for (int i = 0; i < mid; i++) - orderedNodes.push_back(nodeDomains[orderedOriginals[i]][domain1]); - for (int i = 0; i < mid; i++) - orderedNodes.push_back(nodeDomains[orderedOriginals[i]][domain2]); - for (int i = mid; i < ima; i++) - orderedNodes.push_back(nodeDomains[orderedOriginals[i]][domain1]); - for (int i = mid; i < ima; i++) - orderedNodes.push_back(nodeDomains[orderedOriginals[i]][domain2]); - for (int i = 0; i < mid; i++) + { + double *coords = this->GetPoint(oldId); + SMDS_MeshNode *newNode = _mesh->AddNode(coords[0], coords[1], coords[2]); + newId = newNode->GetVtkID(); + if (! nodeQuadDomains.count(oldId)) { - int oldId = orderedOriginals[i]; - int newId; - if (nodeQuadDomains.count(oldId) && nodeQuadDomains[oldId].count(dom1_2)) - newId = nodeQuadDomains[oldId][dom1_2]; - else - { - double *coords = this->GetPoint(oldId); - SMDS_MeshNode *newNode = _mesh->AddNode(coords[0], coords[1], coords[2]); - newId = newNode->GetVtkID(); - if (! nodeQuadDomains.count(oldId)) - { - std::map emptyMap; - nodeQuadDomains[oldId] = emptyMap; - } - nodeQuadDomains[oldId][dom1_2] = newId; - } - orderedNodes.push_back(newId); + std::map emptyMap; + nodeQuadDomains[oldId] = emptyMap; } + nodeQuadDomains[oldId][dom1_2] = newId; + } + orderedNodes.push_back(newId); } + } else - { + { + for (int i = 0; i < nbNodes; i++) + orderedNodes.push_back(nodeDomains[orderedOriginals[i]][domain1]); + if (dim == 3) for (int i = 0; i < nbNodes; i++) - orderedNodes.push_back(nodeDomains[orderedOriginals[i]][domain1]); - if (dim == 3) - for (int i = 0; i < nbNodes; i++) - orderedNodes.push_back(nodeDomains[orderedOriginals[i]][domain2]); - else - for (int i = nbNodes-1; i >= 0; i--) - orderedNodes.push_back(nodeDomains[orderedOriginals[i]][domain2]); + orderedNodes.push_back(nodeDomains[orderedOriginals[i]][domain2]); + else + for (int i = nbNodes-1; i >= 0; i--) + orderedNodes.push_back(nodeDomains[orderedOriginals[i]][domain2]); - } + } if (dim == 3) - { - SMDS_MeshVolume *vol = _mesh->AddVolumeFromVtkIds(orderedNodes); - return vol; - } + { + SMDS_MeshVolume *vol = _mesh->AddVolumeFromVtkIds(orderedNodes); + return vol; + } else if (dim == 2) + { + // bos #24368 + // orient face by the original one, as getOrderedNodesOfFace() not implemented for faces + const SMDS_MeshElement* origFace = _mesh->FindElementVtk( vtkVolId ); + int i0 = origFace->GetNodeIndex( _mesh->FindNodeVtk( orderedNodes[0] )); + int i1 = origFace->GetNodeIndex( _mesh->FindNodeVtk( orderedNodes[1] )); + int diff = i0 - i1; + // order of nodes must be reverse in face and origFace + bool oriOk = ( diff == 1 ) || ( diff == -3 ); + if ( !oriOk ) { - SMDS_MeshFace *face = _mesh->AddFaceFromVtkIds(orderedNodes); - return face; + SMDSAbs_EntityType type = isQuadratic ? SMDSEntity_Quad_Quadrangle : SMDSEntity_Quadrangle; + const std::vector& interlace = SMDS_MeshCell::reverseSmdsOrder( type ); + SMDS_MeshCell::applyInterlace( interlace, orderedNodes ); } + SMDS_MeshFace *face = _mesh->AddFaceFromVtkIds(orderedNodes); + return face; + } // TODO update sub-shape list of elements and nodes return 0;