From: nri Date: Thu, 10 Jul 2003 16:52:53 +0000 (+0000) Subject: NRI : Merge from V1_2. X-Git-Tag: V_02092003~13 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5d196bfbc3b1657ae6a6ddd8ca2681086676c978;p=modules%2Fvisu.git NRI : Merge from V1_2. --- diff --git a/src/VISU_I/VISU_MedConvertor.cxx b/src/VISU_I/VISU_MedConvertor.cxx index a046a156..2c277742 100644 --- a/src/VISU_I/VISU_MedConvertor.cxx +++ b/src/VISU_I/VISU_MedConvertor.cxx @@ -20,9 +20,6 @@ static int MYDEBUG = 0; #endif static med_err ret = 0; -static med_entite_maillage MEDENTITY[4] = { - MED_MAILLE, MED_NOEUD, MED_ARETE, MED_FACE - }; typedef map TVisu2MedEntity; static TVisu2MedEntity aVisu2MedEntity; static int INIT = ( @@ -45,20 +42,22 @@ static med_geometrie_element CELLGEOM[MED_NBR_GEOMETRIE_MAILLE] = { MED_PYRA5, MED_PENTA6, MED_HEXA8, MED_TETRA10, MED_PYRA13, MED_PENTA15, MED_HEXA20 }; -void GetEntity2Geom(const VISU::TEntity& theEntity, med_geometrie_element*& theVector, int* theEnd) { +void GetEntity2Geom(const VISU::TEntity& theEntity, med_geometrie_element*& theVector, int* theEnd) + throw (std::runtime_error&) +{ switch(theEntity){ case VISU::CELL_ENTITY: theVector = CELLGEOM; *theEnd = MED_NBR_GEOMETRIE_MAILLE; break; case VISU::FACE_ENTITY: theVector = FACEGEOM; *theEnd = MED_NBR_GEOMETRIE_FACE; break; case VISU::EDGE_ENTITY: theVector = EDGEGEOM; *theEnd = MED_NBR_GEOMETRIE_ARETE; break; case VISU::NODE_ENTITY: theVector = NODEGEOM; *theEnd = 1; break; + default: + throw std::runtime_error("GetEntity2Geom >> theEntity is uncorrect"); } } extern "C" VISU_Convertor* CreateMedConvertor(const string& theFileName) throw(std::runtime_error&){ - VISU_MedConvertor* aConvertor = new VISU_MedConvertor(theFileName); - aConvertor->Build(); - return aConvertor; + return new VISU_MedConvertor(theFileName); } int med2vtkCellType(int medType){ @@ -100,12 +99,11 @@ VISU_MedConvertor::VISU_MedConvertor(const string& theFileName) throw (std::runt myFileInfo.setFile(QString(theFileName.c_str())); myName = (const char*)(myFileInfo.baseName()); } - VISU_Convertor* VISU_MedConvertor::Build() throw (std::runtime_error&) { MedFile aMedFile(myFileInfo.absFilePath()); med_idt fid = aMedFile.GetFid(); med_int iMeshEnd = MEDnMaa(fid); //Get number of meshes - if(MYDEBUG) MESSAGE("ImportInfo - MEDnMaa = "< TFamily2EntityMap; TFamily2EntityMap aFamily2EntityMap; TVisu2MedEntity::const_iterator aVisu2MedEntityIter = aVisu2MedEntity.begin(); @@ -131,19 +125,20 @@ VISU_Convertor* VISU_MedConvertor::Build() throw (std::runtime_error&) { int medId = getIdMedType(aGeomElemVector[iGeomElem]); int aVtkType = med2vtk[medId].vtkType; med_geometrie_element aMedType = med2vtk[medId].medType; - //Get number of connectivities - med_int iNumElemEnd = MEDnEntMaa(fid,aMeshName,MED_CONN,aMedEntity,aMedType,MED_NOD); - if (iNumElemEnd > 0) { - VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity]; - aMeshOnEntity.myEntity = anEntity; - aMeshOnEntity.myMeshName = aMeshName; - if(MYDEBUG) - MESSAGE("ImportInfo -\t anEntity = "<> MEDnoeudsLire(...)"); - }else{ - med_int aNbConnForElem = getNbMedConnect(aMedType,anEntity,aMesh.myDim); - valarray conn(aNbConnForElem*iNumElemEnd); - ret = MEDelementsLire(fid,aMeshName,aMesh.myDim,&conn[0],MED_FULL_INTERLACE, - &name_elem[0],&iname_elem,&num_elem[0],&inum_elem, - &num_fam_elem[0],iNumElemEnd,aMedEntity,aMedType,MED_NOD); - if (ret < 0) throw std::runtime_error("ImportInfo >> MEDelementsLire(...)"); + for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) + if(num_fam_elem[iNumElem] != 0) + aFamily2EntityMap[num_fam_elem[iNumElem]] = anEntity; } + } + //Get number of connectivities + med_int iNumElemEnd = MEDnEntMaa(fid,aMeshName,MED_CONN,aMedEntity,aMedType,MED_NOD); + if (iNumElemEnd > 0) { + VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity]; + aMeshOnEntity.myEntity = anEntity; + aMeshOnEntity.myMeshName = aMeshName; + med_booleen iname_elem, inum_elem; + valarray num_elem(iNumElemEnd), num_fam_elem(iNumElemEnd); + valarray name_elem('\0',iNumElemEnd*MED_TAILLE_PNOM+1); + med_int aNbConnForElem = getNbMedConnect(aMedType,anEntity,aMesh.myDim); + if(MYDEBUG) + MESSAGE("ImportInfo -\t anEntity = "<> MEDelementsLire(...)"); for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) if(num_fam_elem[iNumElem] != 0) aFamily2EntityMap[num_fam_elem[iNumElem]] = anEntity; @@ -199,7 +209,9 @@ VISU_Convertor* VISU_MedConvertor::Build() throw (std::runtime_error&) { "; myName = '"<