From b90318f038b078ee6cf298d03637befd4042f221 Mon Sep 17 00:00:00 2001 From: apo Date: Mon, 10 Oct 2005 05:46:29 +0000 Subject: [PATCH] To fix regressions in CORBA MED converter --- src/VISU_I/VISU_CorbaMedConvertor.cxx | 72 +++++++++++++++++---------- src/VISU_I/VISU_CorbaMedConvertor.hxx | 16 +++++- 2 files changed, 60 insertions(+), 28 deletions(-) diff --git a/src/VISU_I/VISU_CorbaMedConvertor.cxx b/src/VISU_I/VISU_CorbaMedConvertor.cxx index 5457ae9c..78d2d287 100644 --- a/src/VISU_I/VISU_CorbaMedConvertor.cxx +++ b/src/VISU_I/VISU_CorbaMedConvertor.cxx @@ -39,7 +39,7 @@ using namespace VISU; #define USER_INTERLACE MED_FULL_INTERLACE #ifdef _DEBUG_ -static int MYDEBUG = 0; +static int MYDEBUG = 1; #else static int MYDEBUG = 0; #endif @@ -633,6 +633,7 @@ VISU_MEDConvertor::Build(SALOME_MED::MED_ptr theMED) aFamily->myNbCells = aNbCells; aFamily->myCellsSize = aCellsSize; aFamily->myId = aMEDFamily->getIdentifier(); + aFamily->myName = aSupportName.in(); aFamily->myFamily = aMEDFamily; } } @@ -816,17 +817,20 @@ VISU_MEDConvertor::Build(SALOMEDS::ChildIterator_ptr theTimeStampIterator) aMeshOnEntity->myEntity = aVEntity; aMeshOnEntity->myMeshName = aMeshName.in(); aMeshOnEntity->mySupport = aMEDSupport; + + PCMeshOnEntity aMeshOnEntity2; if(aVEntity == NODE_ENTITY){ - PCMeshOnEntity aMeshOnEntity2 = aMeshOnEntityMap[CELL_ENTITY](new TCMeshOnEntity()); - *aMeshOnEntity2 = *aMeshOnEntity; - aMeshOnEntity->myEntity = CELL_ENTITY; - GetCellsSize(aMesh,aMEDMesh,CELL_ENTITY); + aMeshOnEntity2 = aMeshOnEntityMap[CELL_ENTITY](new TCMeshOnEntity()); + aMeshOnEntity2->myEntity = CELL_ENTITY; }else{ - PCMeshOnEntity aMeshOnEntity2 = aMeshOnEntityMap[NODE_ENTITY](new TCMeshOnEntity()); - *aMeshOnEntity2 = *aMeshOnEntity; - aMeshOnEntity->myEntity = NODE_ENTITY; - GetCellsSize(aMesh,aMEDMesh,NODE_ENTITY); + aMeshOnEntity2 = aMeshOnEntityMap[NODE_ENTITY](new TCMeshOnEntity()); + aMeshOnEntity2->myEntity = NODE_ENTITY; } + + aMeshOnEntity2->myMeshName = aMeshName.in(); + aMeshOnEntity2->mySupport = aMEDSupport; + GetCellsSize(aMesh,aMEDMesh,aMeshOnEntity2->myEntity); + GetCellsSize(aMesh,aMEDMesh,aVEntity); TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap; TFieldMap::iterator aFieldMapIter = aFieldMap.find(aFieldName.in()); @@ -973,7 +977,11 @@ VISU_MEDConvertor if(MYDEBUG) MESSAGE("LoadPoints - Filling aMeshOnEntity with type NODE_ENTITY"); TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh; - PSubMeshImpl aSubMesh = aGeom2SubMesh[VISU::ePOINT1]; + PSubMeshImpl aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new TCSubMesh()); + + aSubMesh->myNbCells = theMesh->myNbPoints; + aSubMesh->myCellsSize = 2*theMesh->myNbPoints; + TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect; aCell2Connect.resize(aNbElem); for(int iElem = 0; iElem < aNbElem; iElem++) @@ -1053,25 +1061,31 @@ VISU_MEDConvertor for(int iGeom = 0, aCounter = 0; iGeom < iGeomEnd; iGeom++){ SALOME_MED::medGeometryElement aMGeom = aGeomElems[iGeom]; int aMNbNodes = MEDGeom2NbNodes(aMGeom); - VISU::EGeometry aEGeom = MEDGeom2VISU(aEGeom); + VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom); int aVNbNodes = VISUGeom2NbNodes(aEGeom); - int iNumElemEnd = aMedMesh->getNumberOfElements(aMEntity,aMGeom); - if (iNumElemEnd > 0) { + int aNbElem = aMedMesh->getNumberOfElements(aMEntity,aMGeom); + if (aNbElem > 0) { using namespace SALOME_MED; SALOME_MED::long_array_var conn = aMedMesh->getConnectivity(MED_FULL_INTERLACE,MED_NODAL,aMEntity,aMGeom); - PSubMeshImpl aSubMesh = aGeom2SubMesh[aEGeom]; + PSubMeshImpl aSubMesh = aGeom2SubMesh[aEGeom](new TCSubMesh()); + + aSubMesh->myNbCells = aNbElem; + aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1); + TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect; std::vector aConnect(aMNbNodes); - int aNbConnForElem = conn->length()/iNumElemEnd; + int aNbConnForElem = conn->length()/aNbElem; if(MYDEBUG) MESSAGE("LoadCellsOnEntity - aMGeom = "<> aNbPoints(%d) <= anArray[%d][%d]=%d < 0 !!!",aNbPoints,iNumElem,k,anArray[k]); + aString.sprintf("ImportCells >> aNbPoints(%d) <= anArray[%d][%d]=%d < 0 !!!",aNbPoints,iElem,k,anArray[k]); throw std::runtime_error(aString.latin1()); } aCell2Connect.push_back(anArray); @@ -1287,17 +1301,21 @@ ImportField(TArray& theArray, } int -VISU_MEDConvertor::LoadField(VISU::PCMesh theMesh, - VISU::PCMeshOnEntity theMeshOnEntity, - VISU::PField theField, - VISU::PCValForTime theValForTime) +VISU_MEDConvertor +::LoadField(VISU::PCMesh theMesh, + VISU::PCMeshOnEntity theMeshOnEntity, + VISU::PField theField, + VISU::PCValForTime theValForTime) { //Check on loading already done - PProfileImpl aProfile = theValForTime->myProfile; - TSource& aMeshSource = aProfile->mySource; - if(aMeshSource.myIsDone) + PIDMapperFilter anIDMapperFilter = theValForTime->myIDMapperFilter; + if(anIDMapperFilter->myIsVTKDone) return 0; + PCProfile aProfile(new TCProfile()); + aProfile->myIsAll = true; + theValForTime->myProfile = aProfile; + SALOME_MED::FIELD_var aMEDField = theValForTime->myField; SALOME_MED::FIELDDOUBLE_ptr aFieldDouble = SALOME_MED::FIELDDOUBLE::_narrow(aMEDField); if(!aFieldDouble->_is_nil()){ @@ -1312,7 +1330,7 @@ VISU_MEDConvertor::LoadField(VISU::PCMesh theMesh, ::ImportField(anArray,theMesh,theField,theValForTime,theMeshOnEntity); } - aMeshSource.myIsDone = true; + anIDMapperFilter->myIsVTKDone = true; return 1; } diff --git a/src/VISU_I/VISU_CorbaMedConvertor.hxx b/src/VISU_I/VISU_CorbaMedConvertor.hxx index b0282c75..f4a975aa 100644 --- a/src/VISU_I/VISU_CorbaMedConvertor.hxx +++ b/src/VISU_I/VISU_CorbaMedConvertor.hxx @@ -45,6 +45,18 @@ namespace VISU typedef SharedPtr PCMesh; + //--------------------------------------------------------------- + struct TCProfile: virtual TProfileImpl + {}; + typedef SharedPtr PCProfile; + + + //--------------------------------------------------------------- + struct TCSubMesh: virtual TSubMeshImpl + {}; + typedef SharedPtr PCSubMesh; + + //--------------------------------------------------------------- struct TCMeshOnEntity: virtual TMeshOnEntityImpl { @@ -139,7 +151,9 @@ class VISU_MEDConvertor: public VISU_Convertor_impl{ VISU::PMeshOnEntityImpl theMeshOnEntity, VISU::PFieldImpl theField, VISU::PValForTimeImpl theValForTime) - {} + { + return 0; + } int LoadPoints(VISU::PCMesh theMesh) ; -- 2.39.2