From b2c5ea766711abcfb88e3d5af07c779b415a6057 Mon Sep 17 00:00:00 2001 From: apo Date: Thu, 2 Feb 2006 10:13:51 +0000 Subject: [PATCH] Fix for Bug IPAL11482 Regression of import time stemps from explored MED file --- src/VISU_I/VISU_CorbaMedConvertor.cxx | 113 +++++++++++--------------- 1 file changed, 49 insertions(+), 64 deletions(-) diff --git a/src/VISU_I/VISU_CorbaMedConvertor.cxx b/src/VISU_I/VISU_CorbaMedConvertor.cxx index 06bd2b6b..629ba8fa 100644 --- a/src/VISU_I/VISU_CorbaMedConvertor.cxx +++ b/src/VISU_I/VISU_CorbaMedConvertor.cxx @@ -234,7 +234,8 @@ namespace //--------------------------------------------------------------- void - GetCellsSize(vtkIdType& theNbCells, vtkIdType& theCellsSize, + GetCellsSize(vtkIdType& theNbCells, + vtkIdType& theCellsSize, SALOME_MED::MESH_ptr theMEDMesh, const VISU::TEntity& theVEntity) { @@ -243,21 +244,22 @@ namespace int iGeomEnd = GetEntity2Geom(theVEntity,aGeomElems); const medEntityMesh& aMEntity = VTKEntityToMED(theVEntity); if(MYDEBUG) MESSAGE("GetCellsSize - theVEntity = "<getNumberOfElements(aMEntity,aMEDGeom); - if(iNumElemEnd > 0){ - if(MYDEBUG) MESSAGE("GetCellsSize - iNumElemEnd = "<getNumberOfElements(aMEntity,aMEDGeom); + if(iNumElemEnd > 0){ + if(MYDEBUG) MESSAGE("GetCellsSize - iNumElemEnd = "<getTypes(); @@ -288,23 +290,34 @@ namespace if(theEntity == NODE_ENTITY){ aMeshOnEntity->myNbCells = theMesh->myNbPoints; aMeshOnEntity->myCellsSize = 2*theMesh->myNbPoints; - vtkIdType aNbCells, aCellsSize; - GetCellsSize(aNbCells,aCellsSize,theMEDMesh,CELL_ENTITY); - if(aNbCells > 0){ - TMeshOnEntityMap::iterator aIter = aMeshOnEntityMap.find(CELL_ENTITY); - if (aIter != aMeshOnEntityMap.end()){ - VISU::PCMeshOnEntity aMeshOnCells = aIter->second; - aMeshOnCells->myEntity = VISU::CELL_ENTITY; - aMeshOnCells->myMeshName = theMesh->myName; - aMeshOnCells->myNbCells = aNbCells; - aMeshOnCells->myCellsSize = aCellsSize; - } - } }else{ GetCellsSize(aMeshOnEntity->myNbCells,aMeshOnEntity->myCellsSize,theMEDMesh,theEntity); } } - + + + //--------------------------------------------------------------- + PCMeshOnEntity + InitMeshOnEntity(const VISU::PCMesh& theMesh, + const VISU::TEntity& theEntity, + const VISU::PCMeshOnEntity& theMeshOnEntity) + { + PCMeshOnEntity aMeshOnEntity; + TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap; + TMeshOnEntityMap::const_iterator anIter = aMeshOnEntityMap.find(theEntity); + if(anIter == aMeshOnEntityMap.end()){ + aMeshOnEntity.reset(new TCMeshOnEntity()); + *aMeshOnEntity = *theMeshOnEntity; + aMeshOnEntity->myEntity = theEntity; + aMeshOnEntityMap[theEntity] = aMeshOnEntity; + }else + aMeshOnEntity = anIter->second; + + GetCellsSize(theMesh,theMesh->myMesh,theEntity); + + return aMeshOnEntity; + } + } @@ -346,18 +359,12 @@ VISU_MEDFieldConvertor::Build() aMeshOnEntity->myMeshName = aMeshName.in(); aMeshOnEntity->mySupport = aMEDSupport; - if(aVEntity == NODE_ENTITY){ - PCMeshOnEntity aMeshOnEntity2 = aMeshOnEntityMap[CELL_ENTITY](new TCMeshOnEntity()); - *aMeshOnEntity2 = *aMeshOnEntity; - aMeshOnEntity->myEntity = CELL_ENTITY; - GetCellsSize(aMesh,aMEDMesh,CELL_ENTITY); - }else{ - PCMeshOnEntity aMeshOnEntity2 = aMeshOnEntityMap[NODE_ENTITY](new TCMeshOnEntity()); - *aMeshOnEntity2 = *aMeshOnEntity; - aMeshOnEntity->myEntity = NODE_ENTITY; - GetCellsSize(aMesh,aMEDMesh,NODE_ENTITY); - } - GetCellsSize(aMesh,aMEDMesh,aVEntity); + if(aVEntity == NODE_ENTITY) + ::InitMeshOnEntity(aMesh,CELL_ENTITY,aMeshOnEntity); + else + ::InitMeshOnEntity(aMesh,NODE_ENTITY,aMeshOnEntity); + + ::GetCellsSize(aMesh,aMEDMesh,aVEntity); TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap; PCField aField = aFieldMap[aFieldName.in()](new TCField()); @@ -577,7 +584,7 @@ VISU_MEDConvertor::Build(SALOME_MED::MED_ptr theMED) aNbCells = aMesh->myNbPoints; aCellsSize = 2*aMesh->myNbPoints; }else - GetCellsSize(aNbCells,aCellsSize,aMeshOnSupport,aVEntity); + ::GetCellsSize(aNbCells,aCellsSize,aMeshOnSupport,aVEntity); if(aNbCells > 0){ TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.find(aVEntity); @@ -622,7 +629,7 @@ VISU_MEDConvertor::Build(SALOME_MED::MED_ptr theMED) int aNbCells = aMeshOnEntity->myNbCells, aCellsSize = aMeshOnEntity->myCellsSize; CORBA::Boolean anIsOnAllElements = aMEDSupport->isOnAllElements(); if(!anIsOnAllElements) - GetCellsSize(aNbCells,aCellsSize,aMEDFamily); + ::GetCellsSize(aNbCells,aCellsSize,aMEDFamily); if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build "<< @@ -844,34 +851,12 @@ VISU_MEDConvertor::Build(SALOMEDS::ChildIterator_ptr theTimeStampIterator) }else aMeshOnEntity = aMeshOnEntityMapIter->second; - PCMeshOnEntity aMeshOnEntity2; - if(aVEntity == NODE_ENTITY){ - TEntity aVEntity2 = CELL_ENTITY; - TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter2 = aMeshOnEntityMap.find(aVEntity2); - if(aMeshOnEntityMapIter2 == aMeshOnEntityMap.end()){ - aMeshOnEntity2.reset(new TCMeshOnEntity()); - aMeshOnEntity2->myEntity = aVEntity2; - aMeshOnEntity2->myMeshName = aMeshName.in(); - aMeshOnEntity2->mySupport = aMEDSupport; - aMeshOnEntityMap[aVEntity2] = aMeshOnEntity2; - }else - aMeshOnEntity2 = aMeshOnEntityMapIter2->second; - GetCellsSize(aMesh,aMEDMesh,aVEntity2); - }else{ - TEntity aVEntity2 = NODE_ENTITY; - TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter2 = aMeshOnEntityMap.find(aVEntity2); - if(aMeshOnEntityMapIter2 == aMeshOnEntityMap.end()){ - aMeshOnEntity2.reset(new TCMeshOnEntity()); - aMeshOnEntity2->myEntity = aVEntity2; - aMeshOnEntity2->myMeshName = aMeshName.in(); - aMeshOnEntity2->mySupport = aMEDSupport; - aMeshOnEntityMap[aVEntity2] = aMeshOnEntity2; - }else - aMeshOnEntity2 = aMeshOnEntityMapIter2->second; - GetCellsSize(aMesh,aMEDMesh,aVEntity2); - } + if(aVEntity == NODE_ENTITY) + ::InitMeshOnEntity(aMesh,CELL_ENTITY,aMeshOnEntity); + else + ::InitMeshOnEntity(aMesh,NODE_ENTITY,aMeshOnEntity); - GetCellsSize(aMesh,aMEDMesh,aVEntity); + ::GetCellsSize(aMesh,aMEDMesh,aVEntity); PCField aField; TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap; -- 2.39.2