X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FDriverMED%2FDriverMED_R_SMESHDS_Mesh.cxx;h=e500ed3ade57f9743d8b19250ebc55a6ba48a606;hb=79b1ac2b6df9117f16f11d444b1f165d477a1813;hp=87f33c81c7a318f63047d443d68c184c2098668b;hpb=57b43b4d010e2d0a1529d3c131bbb9d416e63258;p=modules%2Fsmesh.git diff --git a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx index 87f33c81c..e500ed3ad 100644 --- a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx +++ b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx @@ -17,7 +17,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -83,6 +83,7 @@ DriverMED_R_SMESHDS_Mesh // Reading the MED mesh //--------------------- PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh+1); + string aMeshName; if (myMeshId != -1) { ostringstream aMeshNameStr; @@ -94,6 +95,7 @@ DriverMED_R_SMESHDS_Mesh if(MYDEBUG) MESSAGE("Perform - aMeshName : "<GetName()); if(aMeshName != aMeshInfo->GetName()) continue; aResult = DRS_OK; + //TInt aMeshDim = aMeshInfo->GetDim(); // Reading MED families to the temporary structure @@ -121,11 +123,18 @@ DriverMED_R_SMESHDS_Mesh } } + if (aMeshInfo->GetType() == MED::eSTRUCTURE){ + bool aRes = buildMeshGrille(aMed,aMeshInfo); + continue; + } + // Reading MED nodes to the corresponding SMDS structure //------------------------------------------------------ - PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo); - if(!aNodeInfo) + PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo); + if (!aNodeInfo) { + aResult = DRS_FAIL; continue; + } PCoordHelper aCoordHelper = GetCoordHelper(aNodeInfo); @@ -173,9 +182,9 @@ DriverMED_R_SMESHDS_Mesh for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){ const EGeometrieElement& aGeom = aGeom2SizeIter->first; - switch(aGeom){ - case ePOINT1: - break; + switch(aGeom) { +// case ePOINT1: ## PAL16410 +// break; case ePOLYGONE: { PPolygoneInfo aPolygoneInfo = aMed->GetPPolygoneInfo(aMeshInfo,anEntity,aGeom); EBooleen anIsElemNum = takeNumbers ? aPolygoneInfo->IsElemNum() : eFAUX; @@ -336,6 +345,7 @@ DriverMED_R_SMESHDS_Mesh case ePENTA15: aNbNodes = 15; break; case eHEXA8: aNbNodes = 8; break; case eHEXA20: aNbNodes = 20; break; + case ePOINT1: aNbNodes = 1; break; default:; } vector aNodeIds(aNbNodes); @@ -369,14 +379,14 @@ DriverMED_R_SMESHDS_Mesh continue; bool isRenum = false; - SMDS_MeshElement* anElement = NULL; + const SMDS_MeshElement* anElement = NULL; TInt aFamNum = aCellInfo->GetFamNum(iElem); #ifndef _DEXCEPT_ try{ #endif //MESSAGE("Try to create element # " << iElem << " with id = " // << aCellInfo->GetElemNum(iElem)); - switch(aGeom){ + switch(aGeom) { case eSEG2: if(anIsElemNum) anElement = myMesh->AddEdgeWithID(aNodeIds[0], @@ -662,6 +672,10 @@ DriverMED_R_SMESHDS_Mesh isRenum = anIsElemNum; } break; + + case ePOINT1: + anElement = FindNode(myMesh,aNodeIds[0]); + break; } #ifndef _DEXCEPT_ }catch(const std::exception& exc){ @@ -781,7 +795,7 @@ void DriverMED_R_SMESHDS_Mesh::GetGroup(SMESHDS_Group* theGroup) theGroup->SMDSGroup().Add(element); } if ( element ) - theGroup->SetType( element->GetType() ); + theGroup->SetType( theGroup->SMDSGroup().GetType() ); } } } @@ -885,3 +899,93 @@ bool DriverMED_R_SMESHDS_Mesh::checkFamilyID(DriverMED_FamilyPtr & aFamily, int return ( aFamily->GetId() == anID ); } + +/*! \brief Reading the structured mesh and convert to non structured (by filling of smesh structure for non structured mesh) + * \param theWrapper - PWrapper const pointer + * \param theMeshInfo - PMeshInfo const pointer + * \return TRUE, if successfully. Else FALSE + */ +bool DriverMED_R_SMESHDS_Mesh::buildMeshGrille(const MED::PWrapper& theWrapper, + const MED::PMeshInfo& theMeshInfo) +{ + bool res = true; + + MED::PGrilleInfo aGrilleInfo = theWrapper->GetPGrilleInfo(theMeshInfo); + MED::TInt aNbNodes = aGrilleInfo->GetNbNodes(); + MED::TInt aNbCells = aGrilleInfo->GetNbCells(); + MED::TInt aMeshDim = theMeshInfo->GetDim(); + DriverMED_FamilyPtr aFamily; + for(MED::TInt iNode=0;iNode < aNbNodes; iNode++){ + double aCoords[3] = {0.0, 0.0, 0.0}; + const SMDS_MeshNode* aNode; + MED::TNodeCoord aMEDNodeCoord = aGrilleInfo->GetCoord(iNode); + for(MED::TInt iDim=0;iDimAddNodeWithID(aCoords[0],aCoords[1],aCoords[2],(int)iNode); + + if((aGrilleInfo->myFamNumNode).size() > 0){ + TInt aFamNum = aGrilleInfo->GetFamNumNode(iNode); + if ( checkFamilyID ( aFamily, aFamNum )) + { + aFamily->AddElement(aNode); + aFamily->SetType(SMDSAbs_Node); + } + } + + } + + SMDS_MeshElement* anElement = NULL; + MED::TIntVector aNodeIds; + for(MED::TInt iCell=0;iCell < aNbCells; iCell++){ + aNodeIds = aGrilleInfo->GetConn(iCell); + switch(aGrilleInfo->GetGeom()){ + case MED::eSEG2: + if(aNodeIds.size() != 2){ + res = false; + EXCEPTION(runtime_error,"buildMeshGrille Error. Incorrect size of ids 2!="<AddEdgeWithID(aNodeIds[0], + aNodeIds[1], + iCell); + break; + case MED::eQUAD4: + if(aNodeIds.size() != 4){ + res = false; + EXCEPTION(runtime_error,"buildMeshGrille Error. Incorrect size of ids 4!="<AddFaceWithID(aNodeIds[0], + aNodeIds[2], + aNodeIds[3], + aNodeIds[1], + iCell); + break; + case MED::eHEXA8: + if(aNodeIds.size() != 8){ + res = false; + EXCEPTION(runtime_error,"buildMeshGrille Error. Incorrect size of ids 8!="<AddVolumeWithID(aNodeIds[0], + aNodeIds[2], + aNodeIds[3], + aNodeIds[1], + aNodeIds[4], + aNodeIds[6], + aNodeIds[7], + aNodeIds[5], + iCell); + break; + default: + break; + } + + if((aGrilleInfo->myFamNum).size() > 0){ + TInt aFamNum = aGrilleInfo->GetFamNum(iCell); + if ( checkFamilyID ( aFamily, aFamNum )){ + aFamily->AddElement(anElement); + aFamily->SetType(anElement->GetType()); + } + } + } + + return res; +}