X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FDriverMED%2FDriverMED_W_SMESHDS_Mesh.cxx;h=f5370662b8c79d07566f61206a240e6992369f86;hb=51bffaa32f72836f227a449e4f2d5c68ab8200ed;hp=634accfba901519605222d0dd4e09473207e7f69;hpb=c63ee099ad2b149bd70136839c973e8910137bc5;p=modules%2Fsmesh.git diff --git a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx index 634accfba..f5370662b 100644 --- a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx +++ b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx @@ -66,6 +66,24 @@ void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName) return SetFile(theFileName,MED::eV2_2); } +string DriverMED_W_SMESHDS_Mesh::GetVersionString(const MED::EVersion theVersion, int theNbDigits) +{ + TInt majeur, mineur, release; + majeur = mineur = release = 0; + if ( theVersion == eV2_1 ) + MED::GetVersionRelease(majeur, mineur, release); + else + MED::GetVersionRelease(majeur, mineur, release); + ostringstream name; + if ( theNbDigits > 0 ) + name << majeur; + if ( theNbDigits > 1 ) + name << "." << mineur; + if ( theNbDigits > 2 ) + name << "." << release; + return name.str(); +} + void DriverMED_W_SMESHDS_Mesh::SetMeshName(const std::string& theMeshName) { myMeshName = theMeshName; @@ -262,6 +280,17 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform() aMeshDimension = anIsXDimension + anIsYDimension + anIsZDimension; if(!aMeshDimension) aMeshDimension = 3; + // PAL16857(SMESH not conform to the MED convention): + if ( aMeshDimension == 2 && anIsZDimension ) // 2D only if mesh is in XOY plane + aMeshDimension = 3; + // PAL18941(a saved study with a mesh belong Z is opened and the mesh is belong X) + if ( aMeshDimension == 1 && !anIsXDimension ) // 1D only if mesh is along OX + if ( anIsYDimension ) { + aMeshDimension = 2; + anIsXDimension = true; + } else { + aMeshDimension = 3; + } } SMDS_NodeIteratorPtr aNodesIter = myMesh->nodesIterator(); @@ -295,17 +324,21 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform() // Storing SMDS groups and sub-meshes //----------------------------------- - int myNodesDefaultFamilyId = 0; - int myEdgesDefaultFamilyId = 0; - int myFacesDefaultFamilyId = 0; + int myNodesDefaultFamilyId = 0; + int myEdgesDefaultFamilyId = 0; + int myFacesDefaultFamilyId = 0; int myVolumesDefaultFamilyId = 0; - if (myDoGroupOfNodes) + int nbNodes = myMesh->NbNodes(); + int nbEdges = myMesh->NbEdges(); + int nbFaces = myMesh->NbFaces(); + int nbVolumes = myMesh->NbVolumes(); + if (myDoGroupOfNodes && nbNodes) myNodesDefaultFamilyId = REST_NODES_FAMILY; - if (myDoGroupOfEdges) + if (myDoGroupOfEdges && nbEdges) myEdgesDefaultFamilyId = REST_EDGES_FAMILY; - if (myDoGroupOfFaces) + if (myDoGroupOfFaces && nbFaces) myFacesDefaultFamilyId = REST_FACES_FAMILY; - if (myDoGroupOfVolumes) + if (myDoGroupOfVolumes && nbVolumes) myVolumesDefaultFamilyId = REST_VOLUMES_FAMILY; MESSAGE("Perform - aFamilyInfo"); @@ -314,11 +347,17 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform() if (myAllSubMeshes) { aFamilies = DriverMED_Family::MakeFamilies (myMesh->SubMeshes(), myGroups, - myDoGroupOfNodes, myDoGroupOfEdges, myDoGroupOfFaces, myDoGroupOfVolumes); + myDoGroupOfNodes && nbNodes, + myDoGroupOfEdges && nbEdges, + myDoGroupOfFaces && nbFaces, + myDoGroupOfVolumes && nbVolumes); } else { aFamilies = DriverMED_Family::MakeFamilies (mySubMeshes, myGroups, - myDoGroupOfNodes, myDoGroupOfEdges, myDoGroupOfFaces, myDoGroupOfVolumes); + myDoGroupOfNodes && nbNodes, + myDoGroupOfEdges && nbEdges, + myDoGroupOfFaces && nbFaces, + myDoGroupOfVolumes && nbVolumes); } list::iterator aFamsIter = aFamilies.begin(); @@ -454,7 +493,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform() if ( edge_fam != anElemFamMap.end() ) aFamilyNums->push_back( edge_fam->second ); else - aFamilyNums->push_back( myFacesDefaultFamilyId ); + aFamilyNums->push_back( myEdgesDefaultFamilyId ); } if ( aNbSeg2 ) { @@ -987,9 +1026,11 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform() } catch(const std::exception& exc) { INFOS("Follow exception was cought:\n\t"<