X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FCONVERTOR%2FVISU_MedConvertor.cxx;h=8ee84ca66cb9c60100d6e4957264e4f4594d18f9;hb=e7e2c50aba46c639191ce54d4b42ae4587abb652;hp=a5531c172aa4f9ca6adb1e36f7614d3bbb11539b;hpb=e967b0415406f4f86ca2c9489abc8554b4c15dae;p=modules%2Fvisu.git diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index a5531c17..8ee84ca6 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -1,32 +1,31 @@ -// VISU OBJECT : interactive object for VISU entities implementation +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// VISU OBJECT : interactive object for VISU entities implementation // File : VISU_MedConvertor.cxx // Author : Alexey PETROV // Module : VISU - - +// #include "VISU_MedConvertor.hxx" -#include "VISU_Convertor.hxx" #include "VISU_ConvertorUtils.hxx" #include "MED_Factory.hxx" @@ -34,12 +33,24 @@ #include "MED_GaussUtils.hxx" #include "MED_Utilities.hxx" -#include "CASCatch.hxx" +#include "SALOMEconfig.h" + +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#define NO_CAS_CATCH +#endif + +#include + +#ifdef NO_CAS_CATCH +#include +#endif #include -using namespace std; -using namespace VISU; +#ifdef WNT +#include +#define isnan _isnan +#endif using MED::TInt; using MED::TFloat; @@ -61,6 +72,8 @@ static int MY_GROUP_DEBUG = 0; #define _LOAD_FAMILIES_ #define _EDF_NODE_IDS_ + + namespace { //--------------------------------------------------------------- @@ -131,165 +144,179 @@ namespace //--------------------------------------------------------------- VISU::TEntity - MEDEntityToVTK(MED::EEntiteMaillage theMEDEntity) + MEDEntityToVTK( MED::EEntiteMaillage theMEDEntity ) { + VISU::TEntity anEntity = VISU::TEntity( -1 ); + switch(theMEDEntity){ - case MED::eNOEUD: return NODE_ENTITY; - case MED::eARETE: return EDGE_ENTITY; - case MED::eFACE: return FACE_ENTITY; - case MED::eMAILLE: return CELL_ENTITY; + case MED::eNOEUD : + anEntity = VISU::NODE_ENTITY; + break; + case MED::eARETE : + anEntity = VISU::EDGE_ENTITY; + break; + case MED::eFACE : + anEntity = VISU::FACE_ENTITY; + break; + case MED::eMAILLE : + anEntity = VISU::CELL_ENTITY; + break; + case MED::eNOEUD_ELEMENT : + anEntity = VISU::CELL_ENTITY; + break; } - return VISU::TEntity(-1); + + return anEntity; } //--------------------------------------------------------------- MED::EEntiteMaillage - VTKEntityToMED(TEntity theVTKEntity) + VTKEntityToMED(VISU::TEntity theVTKEntity) { switch(theVTKEntity){ - case NODE_ENTITY: return MED::eNOEUD; - case EDGE_ENTITY: return MED::eARETE; - case FACE_ENTITY: return MED::eFACE; - case CELL_ENTITY: return MED::eMAILLE; + case VISU::NODE_ENTITY: return MED::eNOEUD; + case VISU::EDGE_ENTITY: return MED::eARETE; + case VISU::FACE_ENTITY: return MED::eFACE; + case VISU::CELL_ENTITY: return MED::eMAILLE; } return MED::EEntiteMaillage(-1); } //--------------------------------------------------------------- - PMEDSubProfile + VISU::PMEDSubProfile CrSubProfile(const MED::PWrapper& theMEDWrapper, - const MED::PMeshInfo& theMeshInfo, - MED::EEntiteMaillage theMEntity, - MED::EGeometrieElement theMGeom, - const MED::TGeom2Size& theGeom2Size, - const MED::TGeom2Profile& theGeom2Profile) + const MED::PMeshInfo& theMeshInfo, + MED::EEntiteMaillage theMEntity, + MED::EGeometrieElement theMGeom, + const MED::TGeom2Size& theGeom2Size, + const MED::TGeom2Profile& theGeom2Profile) { VISU::EGeometry aEGeom = MEDGeom2VISU(theMGeom); vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom); - PMEDSubProfile aSubProfile(new TMEDSubProfile()); + VISU::PMEDSubProfile aSubProfile(new VISU::TMEDSubProfile()); aSubProfile->myGeom = aEGeom; aSubProfile->myMGeom = theMGeom; - aSubProfile->myStatus = eAddAll; + aSubProfile->myStatus = VISU::eAddAll; MED::TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(theMGeom); if(aTimeStampIter == theGeom2Size.end()) - aSubProfile->myStatus = eRemoveAll; + aSubProfile->myStatus = VISU::eRemoveAll; else{ MED::TGeom2Profile::const_iterator aProfileIter = theGeom2Profile.find(theMGeom); if(aProfileIter != theGeom2Profile.end()){ - MED::PProfileInfo aProfileInfo = aProfileIter->second; - - aSubProfile->myName = aProfileInfo->GetName(); - aSubProfile->myStatus = eAddPart; - - const MED::TElemNum& anElemNum = aProfileInfo->myElemNum; - TInt aNbElem = anElemNum.size(); - aSubProfile->myNbCells = aNbElem; - switch(theMGeom){ - case MED::ePOLYGONE: { - MED::PPolygoneInfo aPolygoneInfo = - theMEDWrapper->GetPPolygoneInfo(theMeshInfo,theMEntity,theMGeom); - for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){ - TInt aNbConn = aPolygoneInfo->GetNbConn(anElemNum[anElemId]); - aSubProfile->myCellsSize += aNbConn; - } - break; - } - case MED::ePOLYEDRE: { - MED::PPolyedreInfo aPolyedreInfo = - theMEDWrapper->GetPPolyedreInfo(theMeshInfo,theMEntity,theMGeom); - for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){ - MED::TCConnSliceArr aConnSliceArr = - aPolyedreInfo->GetConnSliceArr(anElemNum[anElemId]); - TInt aNbFaces = aConnSliceArr.size(); - TInt aCellSize = 0; - for(TInt iFace = 0; iFace < aNbFaces; iFace++){ - MED::TCConnSlice aConnSlice = aConnSliceArr[iFace]; - TInt aNbConn = aConnSlice.size(); - aCellSize += aNbConn; - } - aSubProfile->myCellsSize += aCellSize; - } - break; - } - default: { - aSubProfile->myCellsSize = aSubProfile->myNbCells*aVNbNodes; - }} + MED::PProfileInfo aProfileInfo = aProfileIter->second; + + aSubProfile->myName = aProfileInfo->GetName(); + aSubProfile->myStatus = VISU::eAddPart; + + const MED::TElemNum& anElemNum = aProfileInfo->myElemNum; + TInt aNbElem = anElemNum.size(); + aSubProfile->myNbCells = aNbElem; + switch(theMGeom){ + case MED::ePOLYGONE: { + MED::PPolygoneInfo aPolygoneInfo = + theMEDWrapper->GetPPolygoneInfo(theMeshInfo,theMEntity,theMGeom); + for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){ + TInt aNbConn = aPolygoneInfo->GetNbConn( anElemNum[ anElemId ] - 1 ); + aSubProfile->myCellsSize += aNbConn; + } + break; + } + case MED::ePOLYEDRE: { + MED::PPolyedreInfo aPolyedreInfo = + theMEDWrapper->GetPPolyedreInfo(theMeshInfo,theMEntity,theMGeom); + for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){ + MED::TCConnSliceArr aConnSliceArr = + aPolyedreInfo->GetConnSliceArr( anElemNum[ anElemId ] - 1 ); + TInt aNbFaces = aConnSliceArr.size(); + TInt aCellSize = 0; + for(TInt iFace = 0; iFace < aNbFaces; iFace++){ + MED::TCConnSlice aConnSlice = aConnSliceArr[iFace]; + TInt aNbConn = aConnSlice.size(); + aCellSize += aNbConn; + } + aSubProfile->myCellsSize += aCellSize; + } + break; + } + default: { + aSubProfile->myCellsSize = aSubProfile->myNbCells*aVNbNodes; + }} }else{ - TInt aNbElem = aTimeStampIter->second; - aSubProfile->myNbCells = aNbElem; - switch(theMGeom){ - case MED::ePOLYGONE: { - MED::PPolygoneInfo aPolygoneInfo = - theMEDWrapper->GetPPolygoneInfo(theMeshInfo,theMEntity,theMGeom); - for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){ - TInt aNbConn = aPolygoneInfo->GetNbConn(anElemId); - aSubProfile->myCellsSize += aNbConn; - } - break; - } - case MED::ePOLYEDRE: { - MED::PPolyedreInfo aPolyedreInfo = - theMEDWrapper->GetPPolyedreInfo(theMeshInfo,theMEntity,theMGeom); - for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){ - MED::TCConnSliceArr aConnSliceArr = - aPolyedreInfo->GetConnSliceArr(anElemId); - TInt aNbFaces = aConnSliceArr.size(); - TInt aCellSize = 0; - for(TInt iFace = 0; iFace < aNbFaces; iFace++){ - MED::TCConnSlice aConnSlice = aConnSliceArr[iFace]; - TInt aNbConn = aConnSlice.size(); - aCellSize += aNbConn; - } - aSubProfile->myCellsSize += aCellSize; - } - break; - } - default: { - aSubProfile->myCellsSize = aSubProfile->myNbCells*aVNbNodes; - }} + TInt aNbElem = aTimeStampIter->second; + aSubProfile->myNbCells = aNbElem; + switch(theMGeom){ + case MED::ePOLYGONE: { + MED::PPolygoneInfo aPolygoneInfo = + theMEDWrapper->GetPPolygoneInfo(theMeshInfo,theMEntity,theMGeom); + for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){ + TInt aNbConn = aPolygoneInfo->GetNbConn(anElemId); + aSubProfile->myCellsSize += aNbConn; + } + break; + } + case MED::ePOLYEDRE: { + MED::PPolyedreInfo aPolyedreInfo = + theMEDWrapper->GetPPolyedreInfo(theMeshInfo,theMEntity,theMGeom); + for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){ + MED::TCConnSliceArr aConnSliceArr = + aPolyedreInfo->GetConnSliceArr(anElemId); + TInt aNbFaces = aConnSliceArr.size(); + TInt aCellSize = 0; + for(TInt iFace = 0; iFace < aNbFaces; iFace++){ + MED::TCConnSlice aConnSlice = aConnSliceArr[iFace]; + TInt aNbConn = aConnSlice.size(); + aCellSize += aNbConn; + } + aSubProfile->myCellsSize += aCellSize; + } + break; + } + default: { + aSubProfile->myCellsSize = aSubProfile->myNbCells*aVNbNodes; + }} } } INITMSG(MYDEBUG, - "- aMGeom = "<GetGeom2Profile(); const MED::TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size; MED::TGeom2Size::const_iterator anIter = aGeom2Size.begin(); for(; anIter != aGeom2Size.end(); anIter++){ MED::EGeometrieElement aMGeom = anIter->first; - PSubProfile aSubProfile = CrSubProfile(theMEDWrapper, - theMeshInfo, - theMEntity, - aMGeom, - theGeom2Size, - aGeom2Profile); + VISU::PSubProfile aSubProfile = CrSubProfile(theMEDWrapper, + theMeshInfo, + theMEntity, + aMGeom, + theGeom2Size, + aGeom2Profile); aProfileKey.insert(aSubProfile); } @@ -300,42 +327,42 @@ namespace //--------------------------------------------------------------- void InitProfile(const MED::PWrapper& theMEDWrapper, - const MED::PMeshInfo& theMeshInfo, - MED::TTimeStampVal& theTimeStampVal, - VISU::TMEDMeshOnEntity& theMeshOnEntity, - MED::EEntiteMaillage theMEntity, - const MED::TGeom2Size& theGeom2Size, - VISU::TMEDValForTime& theValForTime) + const MED::PMeshInfo& theMeshInfo, + MED::PTimeStampValueBase& theTimeStampValue, + VISU::TMEDMeshOnEntity& theMeshOnEntity, + MED::EEntiteMaillage theMEntity, + const MED::TGeom2Size& theGeom2Size, + VISU::TMEDValForTime& theValForTime) { - TTimerLog aTimerLog(MYDEBUG,"InitProfile"); + VISU::TTimerLog aTimerLog(MYDEBUG,"InitProfile"); INITMSG(MYDEBUG,"InitProfile"<second; INITMSG(MYDEBUG,"aProfileMap.find(aProfileKey)"<myGeom2SubProfile; + VISU::PMEDProfile aProfile(new VISU::TMEDProfile()); + VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile; - TProfileKey::const_iterator anIter = aProfileKey.begin(); + VISU::TProfileKey::const_iterator anIter = aProfileKey.begin(); for(; anIter != aProfileKey.end(); anIter++){ - PMEDSubProfile aSubProfile(*anIter); + VISU::PMEDSubProfile aSubProfile(*anIter); - if(aProfile->myIsAll && aSubProfile->myStatus != eAddAll) - aProfile->myIsAll = false; + if(aProfile->myIsAll && aSubProfile->myStatus != VISU::eAddAll) + aProfile->myIsAll = false; - VISU::EGeometry aEGeom = aSubProfile->myGeom; - aGeom2SubProfile[aEGeom] = aSubProfile; + VISU::EGeometry aEGeom = aSubProfile->myGeom; + aGeom2SubProfile[aEGeom] = aSubProfile; } aProfileMap[aProfileKey] = aProfile; @@ -345,20 +372,20 @@ namespace //--------------------------------------------------------------- - TGaussKey - GetGaussKey(const MED::TTimeStampVal& theTimeStampVal, - const VISU::TMEDMeshOnEntity& theMeshOnEntity, - const MED::TGeom2Size& theGeom2Size, - VISU::TMEDValForTime& theValForTime) + VISU::TGaussKey + GetGaussKey(const MED::PTimeStampValueBase& theTimeStampValue, + const VISU::TMEDMeshOnEntity& theMeshOnEntity, + const MED::TGeom2Size& theGeom2Size, + VISU::TMEDValForTime& theValForTime) { - TTimerLog aTimerLog(MYDEBUG,"GetGaussKey"); + VISU::TTimerLog aTimerLog(MYDEBUG,"GetGaussKey"); INITMSG(MYDEBUG,"GetGaussKey"<myGeom2SubProfile; + VISU::TGaussKey aGaussKey; + VISU::PMEDProfile aProfile = theValForTime.myProfile; + VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile; - const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampVal.GetTimeStampInfo(); + const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampValue->GetTimeStampInfo(); const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss(); const MED::TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size; @@ -367,49 +394,53 @@ namespace MED::EGeometrieElement aMGeom = anIter->first; VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom); - TGeom2SubProfile::iterator anIter2 = aGeom2SubProfile.find(aEGeom); + VISU::TGeom2SubProfile::iterator anIter2 = aGeom2SubProfile.find(aEGeom); if(anIter2 == aGeom2SubProfile.end()){ - INITMSG(MYDEBUG,"anIter2 == aGeom2SubProfile.end!!"<second; + VISU::PMEDSubProfile aSubProfile = anIter2->second; MED::TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(aMGeom); if(aTimeStampIter != theGeom2Size.end()){ - TInt aNbCells = aTimeStampIter->second; - if(aSubProfile->myStatus == eAddPart) - aNbCells = aSubProfile->myNbCells; - - PMEDGaussSubMesh aGaussSubMesh(new TMEDGaussSubMesh()); - aGaussSubMesh->mySubProfile = aSubProfile; - aGaussSubMesh->myStatus = aSubProfile->myStatus; - - PMEDGauss aGauss(new TMEDGauss()); - aGaussSubMesh->myGauss = aGauss; - aGauss->myGeom = aEGeom; - aGauss->myNbPoints = 1; - - MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom); - if(aGaussIter != aGeom2Gauss.end()){ - MED::PGaussInfo aGaussInfo = aGaussIter->second; - aGauss->myGaussInfo = aGaussInfo; - aGauss->myName = aGaussInfo->GetName(); - aGauss->myNbPoints = aGaussInfo->GetNbGauss(); - } - - aGaussSubMesh->myNbCells = aNbCells*aGauss->myNbPoints; - aGaussSubMesh->myCellsSize = aGaussSubMesh->myNbCells*2; - - aGaussKey.insert(aGaussSubMesh); - - INITMSGA(MYDEBUG,0, - "- aEGeom = "<myGeom<< - "; aName = '"<myName<<"'"<< - "; aNbGauss = "<myNbPoints<< - "; aStatus = "<myStatus<< - "; aNbCells = "<myNbCells<< - "; aCellsSize = "<myCellsSize<< - endl); + TInt aNbCells = aTimeStampIter->second; + if(aSubProfile->myStatus == VISU::eAddPart) + aNbCells = aSubProfile->myNbCells; + + VISU::PMEDGaussSubMesh aGaussSubMesh(new VISU::TMEDGaussSubMesh()); + aGaussSubMesh->mySubProfile = aSubProfile; + aGaussSubMesh->myStatus = aSubProfile->myStatus; + + VISU::PMEDGauss aGauss(new VISU::TMEDGauss()); + aGaussSubMesh->myGauss = aGauss; + aGauss->myGeom = aEGeom; + aGauss->myNbPoints = 1; + + MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom); + if(aGaussIter != aGeom2Gauss.end()){ + MED::PGaussInfo aGaussInfo = aGaussIter->second; + aGauss->myGaussInfo = aGaussInfo; + aGauss->myName = aGaussInfo->GetName(); + aGauss->myNbPoints = aGaussInfo->GetNbGauss(); + } else if ( aTimeStampInfo.GetNbGauss(aMGeom) > 1 ) + EXCEPTION( std::runtime_error, "aGaussIter == aGeom2Gauss.end()" + " && aTimeStampInfo.GetNbGauss(aMGeom) > 1 !!!" ); + + aGaussSubMesh->myNbCells = aNbCells*aGauss->myNbPoints; + aGaussSubMesh->myCellsSize = aGaussSubMesh->myNbCells*2; + + aGaussKey.insert(aGaussSubMesh); + + INITMSGA(MYDEBUG,0, + "- aEGeom = "<myGeom<< + "; aName = '"<myName<<"'"<< + "; aNbGauss = "<myNbPoints<< + "; aStatus = "<myStatus<< + "; aNbCells = "<myNbCells<< + "; aCellsSize = "<myCellsSize<< + endl); + + //break; } } @@ -419,364 +450,415 @@ namespace //--------------------------------------------------------------- void - InitGaussMesh(MED::TTimeStampVal& theTimeStampVal, - VISU::TMEDMeshOnEntity& theMeshOnEntity, - const MED::TGeom2Size& theGeom2Size, - VISU::TMEDValForTime& theValForTime) + InitGaussMesh(MED::PTimeStampValueBase& theTimeStampValue, + VISU::TMEDMeshOnEntity& theMeshOnEntity, + const MED::TGeom2Size& theGeom2Size, + VISU::TMEDValForTime& theValForTime) { - TTimerLog aTimerLog(MYDEBUG,"InitGaussMesh"); + VISU::TTimerLog aTimerLog(MYDEBUG,"InitGaussMesh"); INITMSG(MYDEBUG,"InitGaussMesh"<second; INITMSG(MYDEBUG,"aGaussMeshMap.find(aGaussKey)"<myGeom2GaussSubMesh; + VISU::PMEDGaussMesh aGaussMesh(new VISU::TMEDGaussMesh()); + VISU::TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh; { - TGaussKey::const_iterator anIter = aGaussKey.begin(); - for(; anIter != aGaussKey.end(); anIter++){ - PMEDGaussSubMesh aGaussSubMesh(*anIter); - PMEDGauss aGauss = aGaussSubMesh->myGauss; - VISU::EGeometry aEGeom = aGauss->myGeom; - aGeom2GaussSubMesh[aEGeom] = aGaussSubMesh; - } + VISU::TGaussKey::const_iterator anIter = aGaussKey.begin(); + for(; anIter != aGaussKey.end(); anIter++){ + VISU::PMEDGaussSubMesh aGaussSubMesh(*anIter); + VISU::PMEDGauss aGauss = aGaussSubMesh->myGauss; + VISU::EGeometry aEGeom = aGauss->myGeom; + aGeom2GaussSubMesh[aEGeom] = aGaussSubMesh; + } } { - TGaussSubMeshArr& aGaussSubMeshArr = aGaussMesh->myGaussSubMeshArr; - aGaussSubMeshArr.resize(aGeom2GaussSubMesh.size()); - TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin(); - for(TInt anID = 0; anIter != aGeom2GaussSubMesh.end(); anIter++, anID++){ - const PGaussSubMeshImpl& aGaussSubMesh = anIter->second; - aGaussSubMeshArr[anID] = aGaussSubMesh; - } + VISU::TGaussSubMeshArr& aGaussSubMeshArr = aGaussMesh->myGaussSubMeshArr; + aGaussSubMeshArr.resize(aGeom2GaussSubMesh.size()); + VISU::TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin(); + for(TInt anID = 0; anIter != aGeom2GaussSubMesh.end(); anIter++, anID++){ + const VISU::PGaussSubMeshImpl& aGaussSubMesh = anIter->second; + aGaussSubMeshArr[anID] = aGaussSubMesh; + } } - INITMSG(MYDEBUG,"aGaussMeshMap[aGaussKey] = aGaussMesh"<myMeshInfo; const std::string& aMeshName = theMesh->myName; - TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap; + VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap; MED::TEntityInfo::const_iterator anEntityIter = theEntityInfo.begin(); for(; anEntityIter != theEntityInfo.end(); anEntityIter++){ const MED::EEntiteMaillage& aMEntity = anEntityIter->first; const MED::TGeom2Size& aGeom2Size = anEntityIter->second; - TEntity aVEntity = MEDEntityToVTK(aMEntity); - PMEDMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[aVEntity](new TMEDMeshOnEntity()); + VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity); + VISU::PMEDMeshOnEntity aMeshOnEntity = + aMeshOnEntityMap[aVEntity](new VISU::TMEDMeshOnEntity()); aMeshOnEntity->myEntity = aVEntity; aMeshOnEntity->myMeshName = aMeshName; aMeshOnEntity->myGeom2Size = aGeom2Size; - TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize; + VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize; + VISU::TGeom2ElemID2FamilyID& aGeom2ElemID2FamilyID = aMeshOnEntity->myGeom2ElemID2FamilyID; INITMSG(MYDEBUG, - "- aMEntity = "<myMeshInfo; const std::string& aMeshName = theMesh->myName; - TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap; + VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap; MED::TEntityInfo::const_iterator anEntityIter = theEntityInfo.begin(); + + VISU::TStructuredId& aGrilleStructure = theMesh->myGrilleStructure; + if ( theGrilleInfo->GetGrilleType() != MED::eGRILLE_STANDARD ) + for ( int aDimId = 0; aDimId < theMesh->myDim; aDimId++ ) + aGrilleStructure[aDimId] = theGrilleInfo->GetNbIndexes(aDimId); + else { + MED::TIntVector aVector = theGrilleInfo->GetGrilleStructure(); + for ( int aDimId = 0; aDimId < aVector.size(); aDimId++ ) + aGrilleStructure[aDimId] = aVector[aDimId]; + } + + int kMax = aGrilleStructure[2]; + int jMax = aGrilleStructure[1]; + int iMax = aGrilleStructure[0]; + + int iii = 0; + VISU::TObj2StructuredId& aObj2StructuredId = theMesh->myObj2StructuredId; + switch ( theMesh->myDim ) { + case 1: + for ( int i = 1; i <= iMax; i++ ) + aObj2StructuredId[i-1][0] = i; + break; + case 2: + for ( int j = 1; j <= jMax; j++ ) + for ( int i = 1; i <= iMax; i++ ) { + aObj2StructuredId[iii][0] = i; + aObj2StructuredId[iii][1] = j; + iii++; + } + break; + case 3: + for ( int k = 1; k <= kMax; k++ ) + for ( int j = 1; j <= jMax; j++ ) + for ( int i = 1; i <= iMax; i++ ) { + aObj2StructuredId[iii][0] = i; + aObj2StructuredId[iii][1] = j; + aObj2StructuredId[iii][2] = k; + iii++; + } + } + for(; anEntityIter != theEntityInfo.end(); anEntityIter++){ const MED::EEntiteMaillage& aMEntity = anEntityIter->first; const MED::TGeom2Size& aGeom2Size = anEntityIter->second; - TEntity aVEntity = MEDEntityToVTK(aMEntity); - PMEDMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[aVEntity](new TMEDMeshOnEntity()); + VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity); + VISU::PMEDMeshOnEntity aMeshOnEntity = + aMeshOnEntityMap[aVEntity](new VISU::TMEDMeshOnEntity()); aMeshOnEntity->myEntity = aVEntity; aMeshOnEntity->myMeshName = aMeshName; aMeshOnEntity->myGeom2Size = aGeom2Size; -// TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize; + VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize; + VISU::TGeom2ElemID2FamilyID& aGeom2ElemID2FamilyID = aMeshOnEntity->myGeom2ElemID2FamilyID; INITMSG(MYDEBUG, - "- aMEntity = "<GetNbFields(); MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo; const std::string& aMeshName = theMesh->myName; INITMSG(MYDEBUG,"BuildFieldMap: aNbFields = "<GetPFieldInfo(aMeshInfo,iField); + VISU::TTimerLog aTimerLog(MYDEBUG,"GetPFieldInfo"); + + MED::TErr anError = 0; + MED::PFieldInfo aFieldInfo = theMEDWrapper->GetPFieldInfo(aMeshInfo, iField, &anError); + if ( anError < 0 ) + continue; + TInt aNbComp = aFieldInfo->GetNbComp(); std::string aFieldName = aFieldInfo->GetName(); MED::TGeom2Size aGeom2Size; MED::EEntiteMaillage aMEntity; TInt aNbTimeStamps = theMEDWrapper->GetNbTimeStamps(aFieldInfo, - theEntityInfo, - aMEntity, - aGeom2Size); + theEntityInfo, + aMEntity, + aGeom2Size); if(aNbTimeStamps < 1) - continue; + continue; - TEntity aVEntity = MEDEntityToVTK(aMEntity); - PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity]; - TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap; - PMEDField aField = aFieldMap[aFieldName](new TMEDField()); + VISU::TEntity aVEntity = MEDEntityToVTK( aMEntity ); + vtkIdType aDataType = VTK_DOUBLE; + if ( aFieldInfo->GetType() != MED::eFLOAT64 ) { +#if defined(HAVE_F77INT64) + aDataType = VTK_LONG; +#else + aDataType = VTK_INT; +#endif + } + VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity]; + VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap; + VISU::PMEDField aField = aFieldMap[aFieldName](new VISU::TMEDField()); aField->myId = iField; - aField->InitArrays(aNbComp); + aField->Init(aNbComp, aDataType); aField->myEntity = aVEntity; aField->myName = aFieldName; aField->myMeshName = aMeshName; aField->myDataSize = aMeshOnEntity->myNbCells * aNbComp; - + aField->myIsELNO = ( aMEntity == MED::eNOEUD_ELEMENT ); + INITMSG(MYDEBUG,"myName = '"<myName<<"'"<< - "; myId = "<myId<< - "; myEntity = "<myEntity<< - "; myDataSize = "<myDataSize<< - "; myNbComp = "<myNbComp<<"\n"); + "; myId = "<myId<< + "; myEntity = "<myEntity<< + "; myDataSize = "<myDataSize<< + "; myNbComp = "<myNbComp<<"\n"); for(TInt iComp = 0; iComp < aNbComp; iComp++){ - aField->myCompNames[iComp] = aFieldInfo->GetCompName(iComp); - aField->myUnitNames[iComp] = aFieldInfo->GetUnitName(iComp); + aField->myCompNames[iComp] = aFieldInfo->GetCompName(iComp); + aField->myUnitNames[iComp] = aFieldInfo->GetUnitName(iComp); } for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){ - TTimerLog aTimerLog(MYDEBUG,"GetPTimeStampInfo"); - MED::PTimeStampInfo aTimeStampInfo = theMEDWrapper->GetPTimeStampInfo(aFieldInfo, - aMEntity, - aGeom2Size, - iTimeStamp); - TFloat aDt = aTimeStampInfo->GetDt(); - std::string anUnitDt = aTimeStampInfo->GetUnitDt(); - - TValField& aValField = aField->myValField; - PMEDValForTime aValForTime = aValField[iTimeStamp](new TMEDValForTime()); - aValForTime->myId = iTimeStamp; - aValForTime->myFieldName = aField->myName; - aValForTime->myEntity = aField->myEntity; - aValForTime->myMeshName = aField->myMeshName; - aValForTime->myTime = VISU::TTime(aDt,anUnitDt); - INITMSG(MYDEBUG,"aDt = '"<myGeom2NbGauss; - const MED::TGeom2NbGauss& aMGeom2NbGauss = aTimeStampInfo->myGeom2NbGauss; - MED::TGeom2NbGauss::const_iterator anIter = aMGeom2NbGauss.begin(); - for(; anIter != aMGeom2NbGauss.end(); anIter++){ - const MED::EGeometrieElement& aMGeom = anIter->first; - EGeometry aEGeom = MEDGeom2VISU(aMGeom); - TInt aNbGauss = anIter->second; - aVGeom2NbGauss[aEGeom] = aNbGauss; - } + VISU::TTimerLog aTimerLog(MYDEBUG,"GetPTimeStampInfo"); + + MED::TErr anError = 0; + MED::PTimeStampInfo aTimeStampInfo = theMEDWrapper->GetPTimeStampInfo(aFieldInfo, + aMEntity, + aGeom2Size, + iTimeStamp, + &anError); + if ( anError < 0 ) + continue; + + TFloat aDt = aTimeStampInfo->GetDt(); + std::string anUnitDt = aTimeStampInfo->GetUnitDt(); + + VISU::TValField& aValField = aField->myValField; + VISU::PMEDValForTime aValForTime = aValField[iTimeStamp](new VISU::TMEDValForTime()); + aValForTime->myId = iTimeStamp; + aValForTime->myFieldName = aField->myName; + aValForTime->myEntity = aField->myEntity; + aValForTime->myMeshName = aField->myMeshName; + aValForTime->myTime = VISU::TTime(aDt,anUnitDt); + INITMSG(MYDEBUG,"aDt = '"<myGeom2NbGauss; + const MED::TGeom2NbGauss& aMGeom2NbGauss = aTimeStampInfo->myGeom2NbGauss; + MED::TGeom2NbGauss::const_iterator anIter = aMGeom2NbGauss.begin(); + for(; anIter != aMGeom2NbGauss.end(); anIter++){ + const MED::EGeometrieElement& aMGeom = anIter->first; + VISU::EGeometry aEGeom = MEDGeom2VISU( aMGeom ); + TInt aNbGauss = anIter->second; + aVGeom2NbGauss[ aEGeom ] = aNbGauss; + + // ELNO data should satisfy the following condition ( implicitly ) + vtkIdType aNbNodes = MEDGeom2NbNodes( aMGeom ); + aField->myIsELNO &= ( aNbGauss == aNbNodes ); + } } } } @@ -784,13 +866,13 @@ namespace //--------------------------------------------------------------- void - BuildFamilyMap(PMEDMesh theMesh, - const MED::TEntityInfo& theEntityInfo, - const MED::TEntity2TGeom2ElemInfo& theEntity2TGeom2ElemInfo, - const MED::TFamilyInfoSet& theFamilyInfoSet, - MED::PWrapper theMEDWrapper) + BuildFamilyMap(VISU::PMEDMesh theMesh, + const MED::TEntityInfo& theEntityInfo, + const MED::TEntity2TGeom2ElemInfo& theEntity2TGeom2ElemInfo, + const MED::TFamilyInfoSet& theFamilyInfoSet, + MED::PWrapper theMEDWrapper) { - TTimerLog aTimerLog(MYDEBUG,"BuildFamilyMap"); + VISU::TTimerLog aTimerLog(MYDEBUG,"BuildFamilyMap"); INITMSG(MYDEBUG,"BuildFamilyMap\n"); MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo; @@ -800,179 +882,397 @@ namespace const MED::EEntiteMaillage& aMEntity = aEntity2FamilySetIter->first; const MED::TFamilyTSizeSet& aFamilyTSizeSet = aEntity2FamilySetIter->second; - TEntity aVEntity = MEDEntityToVTK(aMEntity); - PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity]; - const TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize; - TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap; - + VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity); + VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity]; + const VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize; + VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap; + VISU::TFamilyIDMap& aFamilyIDMap = aMeshOnEntity->myFamilyIDMap; + if(aFamilyTSizeSet.empty()) - continue; - + continue; + INITMSG(MY_FAMILY_DEBUG, - "- aMEntity = "<(aFamilyTSize); + TInt aSize = boost::get<1>(aFamilyTSize); + TInt anId = aFamilyInfo->GetId(); + if(anId == 0) + continue; + + std::string aFamilyName = aFamilyInfo->GetName(); + + VISU::PMEDFamily aFamily = aFamilyMap[aFamilyName](new VISU::TMEDFamily()); + aFamily->myId = anId; + aFamily->myEntity = aVEntity; + aFamily->myName = aFamilyName; + aFamily->myNbCells = aSize; + + aFamily->myCellsSize = 0; + VISU::TFamilyID2CellsSize::const_iterator anIter = aFamilyID2CellsSize.find(anId); + if(anIter != aFamilyID2CellsSize.end()) + aFamily->myCellsSize = anIter->second; + + const TInt aNbGroup = aFamilyInfo->GetNbGroup(); + VISU::TNames& aGroupNames = aFamily->myGroupNames; + aGroupNames.resize(aNbGroup); + for(TInt i = 0; i < aNbGroup; i++){ + std::string aGroupName = aFamilyInfo->GetGroupName(i); + aGroupNames[i] = aGroupName; + } + + aFamilyIDMap[anId] = aFamily; + + INITMSG(MY_FAMILY_DEBUG, + "- aFamilyName = '"<myMeshOnEntityMap; + + MED::TEntityInfo::const_iterator aEntityIter = theEntityInfo.begin(); + + const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo; + MED::PGrilleInfo aGrilleInfo = theMEDWrapper->GetPGrilleInfo(aMeshInfo); + + const MED::TFamilyID2NbCells& aFam2NbCells = MED::GetFamilyID2NbCells(aGrilleInfo); + + MED::TFamilyInfoSet::const_iterator aFamInter = theFamilyInfoSet.begin(); + for(; aFamInter != theFamilyInfoSet.end(); aFamInter++){ + const MED::PFamilyInfo& aFamilyInfo = *aFamInter; + TInt anId = aFamilyInfo->GetId(); + + if(anId == 0) + continue; + + std::string aFamilyName = aFamilyInfo->GetName(); + const MED::EEntiteMaillage& aMEntity = MED::GetEntityByFamilyId(aGrilleInfo, + anId); + VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity); + + VISU::PMEDMeshOnEntity aMeshOnEntity; + VISU::TMeshOnEntityMap::iterator aMeshOnEntityIter = aMeshOnEntityMap.find(aVEntity); + if(aMeshOnEntityIter != aMeshOnEntityMap.end()) + aMeshOnEntity = aMeshOnEntityIter->second; + + VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap; + VISU::TFamilyIDMap& aFamilyIDMap = aMeshOnEntity->myFamilyIDMap; + + VISU::PMEDFamily aFamily = aFamilyMap[aFamilyName](new VISU::TMEDFamily()); + aFamily->myId = anId; + aFamily->myEntity = aVEntity; + aFamily->myName = aFamilyName; + aFamily->myNbCells = 0; + aFamily->myCellsSize = 0; + + const VISU::TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize; + VISU::TFamilyID2CellsSize::const_iterator aFamilyid2CellsSizeIter = aFamilyID2CellsSize.find(anId); + if(aFamilyid2CellsSizeIter != (aMeshOnEntity->myFamilyID2CellsSize).end()) + aFamily->myCellsSize = aFamilyid2CellsSizeIter->second; + MED::TFamilyID2NbCells::const_iterator aFam2NbCellsIter = aFam2NbCells.find(anId); + if(aFam2NbCellsIter != aFam2NbCells.end()) + aFamily->myNbCells = aFam2NbCellsIter->second; + + const TInt aNbGroup = aFamilyInfo->GetNbGroup(); + VISU::TNames& aGroupNames = aFamily->myGroupNames; + aGroupNames.resize(aNbGroup); + for(TInt i = 0; i < aNbGroup; i++){ + std::string aGroupName = aFamilyInfo->GetGroupName(i); + aGroupNames[i] = aGroupName; + } + + aFamilyIDMap[anId] = aFamily; + + INITMSG(MY_FAMILY_DEBUG, + "- aFamilyName =|"<myName<<"|" + << "; myId = "<myId + << "; aNbAttr = "<GetNbAttr() + << "; aNbGroup = "<GetNbGroup() + << "; aVEntity = "<myGroupMap; + VISU::TGroupMap& aGroupMap = theMesh->myGroupMap; MED::TGroupInfo aGroupInfo = MED::GetGroupInfo(theFamilyInfoSet); MED::TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin(); for(; aGroupInfoIter != aGroupInfo.end(); aGroupInfoIter++){ const std::string& aGroupName = aGroupInfoIter->first; INITMSG(MY_GROUP_DEBUG,"aGroupName = '"<myFamilySet; + VISU::PMEDGroup aGroup(new VISU::TMEDGroup()); + VISU::TFamilySet& aFamilySet = aGroup->myFamilySet; const MED::TFamilyInfoSet& aFamilyInfoSet = aGroupInfoIter->second; MED::TFamilyInfoSet::const_iterator aFamilyIter = aFamilyInfoSet.begin(); for(; aFamilyIter != aFamilyInfoSet.end(); aFamilyIter++){ - const MED::PFamilyInfo& aFamilyInfo = *aFamilyIter; - std::string aFamilyName = aFamilyInfo->GetName(); - - TEntity aVEntity = TEntity(-1); - PMEDFamily aFamily; - - // Find aVisuEntity - const TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap; - TMeshOnEntityMap::const_iterator aMeshOnEntityIter = aMeshOnEntityMap.begin(); - for(; aMeshOnEntityIter != aMeshOnEntityMap.end(); aMeshOnEntityIter++){ - const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityIter->second; - const TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap; - TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin(); - for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){ - const std::string& aName = aFamilyMapIter->first; - aFamily = aFamilyMapIter->second; - if(aName == aFamilyName){ - aVEntity = aFamily->myEntity; - goto exit_lable; - } - } - } - exit_lable: - if(aFamily && aVEntity >= 0){ - aFamilySet.insert(aFamily); - INITMSG(MY_GROUP_DEBUG, - "- aFamilyName = '"<GetName(); + + VISU::TEntity aVEntity = VISU::TEntity(-1); + VISU::PMEDFamily aFamily; + + // Find aVisuEntity + const VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap; + VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityIter = aMeshOnEntityMap.begin(); + for(; aMeshOnEntityIter != aMeshOnEntityMap.end(); aMeshOnEntityIter++){ + const VISU::PMeshOnEntity& aMeshOnEntity = aMeshOnEntityIter->second; + const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap; + VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin(); + for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){ + const std::string& aName = aFamilyMapIter->first; + if(aName == aFamilyName){ + aFamily = aFamilyMapIter->second; + aVEntity = aFamily->myEntity; + if(aFamily && aVEntity >= 0){ + aFamilySet.insert(VISU::TEnity2Family(aVEntity, aFamily)); + INITMSG(MY_GROUP_DEBUG, + "- aFamilyName = '"<GetNbElem(); + TInt aDim = theNodeInfo->GetMeshInfo()->GetSpaceDim(); + aCoordHolder->Init(aNbElem, aDim, theNodeInfo->myCoord); + TNamedPointCoords::Init(PCoordHolder(aCoordHolder)); + myVersion = theVersion; + + for(TInt iDim = 0; iDim < aDim; iDim++) + myPointsDim[iDim] = theNodeInfo->GetCoordName(iDim); + + myIsElemNum = theNodeInfo->IsElemNum(); if(theNodeInfo->IsElemNum()) - TNamedPointCoords::Init(theNbPoints,theDim,theNodeInfo->myElemNum); - else - TNamedPointCoords::Init(theNbPoints,theDim); + myElemNum = theNodeInfo->myElemNum; + + myIsElemNames = theNodeInfo->IsElemNames(); if(theNodeInfo->IsElemNames()) - myNodeInfo = theNodeInfo; + myElemNames = theNodeInfo->myElemNames; } void TMEDNamedPointCoords - ::Init(vtkIdType theNbPoints, - vtkIdType theDim, - const MED::PGrilleInfo& theInfo) + ::Init(const MED::PGrilleInfo& theGrilleInfo) + { + TMEDCoordHolder* aCoordHolder = new TMEDCoordHolder(); + TInt aNbElem = theGrilleInfo->GetNbNodes(); + TInt aDim = theGrilleInfo->GetMeshInfo()->GetSpaceDim(); + MED::PNodeCoord aCoord(new MED::TNodeCoord(aNbElem * aDim)); + aCoordHolder->Init(aNbElem, aDim, aCoord); + TNamedPointCoords::Init(PCoordHolder(aCoordHolder)); + + for(TInt iDim = 0; iDim < aDim; iDim++) + myPointsDim[iDim] = theGrilleInfo->GetCoordName(iDim); + + for(TInt iElem = 0; iElem < aNbElem; iElem++){ + VISU::TCoordSlice aVCoordSlice = GetCoordSlice(iElem); + MED::TNodeCoord aMCoord = theGrilleInfo->GetCoord(iElem); + for(TInt iDim = 0; iDim < aDim; iDim++){ + aVCoordSlice[iDim] = aMCoord[iDim]; + } + } + } + + vtkIdType + TMEDNamedPointCoords + ::GetObjID(vtkIdType theID) const + { + if(myIsElemNum) + return (*myElemNum)[theID]; + return TNamedPointCoords::GetObjID(theID); + } + + + vtkIdType + TMEDNamedPointCoords + ::GetVTKID(vtkIdType theID) const + { + if(myIsElemNum){ + // To prepare corresponding mapper engine + if(myObj2VTKID.empty()){ + vtkIdType anEnd = myElemNum->size(); + for(vtkIdType anID = 0; anID < anEnd; anID++) + myObj2VTKID[(*myElemNum)[anID]] = anID; + } + TObj2VTKID::const_iterator anIter = myObj2VTKID.find(theID); + if(anIter != myObj2VTKID.end()) + return anIter->second; + return -1; + } + return TNamedPointCoords::GetVTKID(theID); + } + + MED::TInt + GetPNOMLength(MED::EVersion theVersion) { - TNamedPointCoords::Init(theNbPoints,theDim); + if(theVersion == MED::eV2_1) + return MED::GetPNOMLength(); + return MED::GetPNOMLength(); } std::string TMEDNamedPointCoords ::GetNodeName(vtkIdType theObjID) const { - if(myNodeInfo) - return myNodeInfo->GetElemName(theObjID); + if(myIsElemNames) + return GetString(theObjID, GetPNOMLength(myVersion), *myElemNames); return TNamedPointCoords::GetNodeName(theObjID); } + unsigned long int + TMEDNamedPointCoords + ::GetMemorySize() + { + size_t aSize = TNamedPointCoords::GetMemorySize(); + + if(myElemNum){ + aSize += myObj2VTKID.size() * sizeof(vtkIdType) * 2; + aSize += myElemNum->size() * sizeof(MED::TInt); + } + + if(myIsElemNames) + aSize += myElemNames->size() * sizeof(char); + return aSize; + } + //--------------------------------------------------------------- vtkIdType TMEDSubProfile ::GetElemObjID(vtkIdType theID) const { - if(myIsElemNum) - return myElemNum[theID]; + if ( !mySubMeshID.empty() ) + theID = mySubMeshID[theID]; + + if ( myIsElemNum ) + return (*myElemNum)[theID]; else return theID; } + //--------------------------------------------------------------- + vtkIdType + TMEDSubProfile + ::GetElemVTKID(vtkIdType theID) const + { + if ( myIsElemNum ) + for ( size_t anId = 0; anId < (*myElemNum).size(); anId++ ) + if ( (*myElemNum)[ anId ] == theID ) { + theID = anId; + break; + } + + return TSubProfileImpl::GetElemVTKID( theID ); + } + + + //---------------------------------------------------------------- + unsigned long int + TMEDSubProfile + ::GetMemorySize() + { + size_t aSize = TSubProfileImpl::GetMemorySize(); + if(myIsElemNum) + aSize += myElemNum->size() * sizeof(MED::TInt); + return aSize; + } + + //--------------------------------------------------------------- void TMEDGauss ::LessThan(const PGaussImpl& theGauss, - bool& theResult) const + bool& theResult) const { TGaussImpl::LessThan(theGauss,theResult); if(myGaussInfo){ if(PMEDGauss aGauss = theGauss){ - const MED::TGaussInfo& aLeft = myGaussInfo; - const MED::TGaussInfo& aReight = aGauss->myGaussInfo; - theResult = MED::TGaussInfo::TLess()(aLeft,aReight); + const MED::TGaussInfo& aLeft = myGaussInfo; + const MED::TGaussInfo& aReight = aGauss->myGaussInfo; + theResult = MED::TGaussInfo::TLess()(aLeft,aReight); } } } @@ -981,50 +1281,84 @@ namespace //--------------------------------------------------------------- TGaussPointID TMEDGaussSubMesh - ::GetObjID(vtkIdType theID, - vtkIdType theStartID) const + ::GetObjID(vtkIdType theID) const { - TCellID aCellID = theID / myGauss->myNbPoints; - TLocalPntID aLocalPntID = theID % myGauss->myNbPoints; - - if(myIsElemNum) - aCellID = myElemNum[aCellID]; + vtkIdType aNbPoints = myGauss->myNbPoints; + TCellID aCellID = theID / aNbPoints; + TLocalPntID aLocalPntID = theID % aNbPoints; + + if ( myIsElemNum ) + aCellID = GetElemObjID(aCellID); else - aCellID += theStartID; + aCellID += myStartID; - return TGaussPointID(aCellID,aLocalPntID); + return TGaussPointID(aCellID, aLocalPntID); } + + //--------------------------------------------------------------- + vtkIdType + TMEDGaussSubMesh + ::GetVTKID( const TGaussPointID& theID ) const + { + vtkIdType aResult = -1; + + TCellID aCellID = theID.first; + TLocalPntID aLocalPntID = theID.second; + + vtkIdType aNbPoints = myGauss->myNbPoints; + if ( aLocalPntID >= aNbPoints ) + return aResult; + + if ( myIsElemNum ) { + aCellID = GetElemVTKID( aCellID ); + } else + aCellID -= myStartID; + + return aCellID * aNbPoints + aLocalPntID + myStartID; + } + + + //--------------------------------------------------------------- + unsigned long int + TMEDGaussSubMesh + ::GetMemorySize() + { + size_t aSize = TGaussSubMeshImpl::GetMemorySize(); + if(myIsElemNum) + aSize += myElemNum->size() * sizeof(MED::TInt); + return aSize; + } + //--------------------------------------------------------------- void TMEDSubMesh - ::Init(const MED::PElemInfo& theElemInfo) + ::Init(const MED::PElemInfo& theElemInfo, + MED::EVersion theVersion) { + myVersion = theVersion; myIsElemNum = theElemInfo->IsElemNum(); - if(myIsElemNum) myElemNum = theElemInfo->myElemNum; + myIsElemNames = theElemInfo->IsElemNames(); if(theElemInfo->IsElemNames()) - myElemInfo = theElemInfo; + myElemNames = theElemInfo->myElemNames; } void TMEDSubMesh ::Init(const MED::PGrilleInfo& theGrilleInfo) - { - myIsElemNum = MED::eFAUX; - // must be implemented - } + {} vtkIdType TMEDSubMesh ::GetElemObjID(vtkIdType theID) const { if(myIsElemNum) - return myElemNum[theID]; + return (*myElemNum)[theID]; else return TSubMeshImpl::GetElemObjID(theID); } @@ -1033,46 +1367,50 @@ namespace TMEDSubMesh ::GetElemName(vtkIdType theObjID) const { - if(myElemInfo) - return myElemInfo->GetElemName(theObjID); + if(myIsElemNames) + return GetString(theObjID, GetPNOMLength(myVersion), *myElemNames); return TSubMeshImpl::GetElemName(theObjID); } - struct TSetIsDone + unsigned long int + TMEDSubMesh + ::GetMemorySize() { - bool& myIsDone; - TSetIsDone(bool& theIsDone): - myIsDone(theIsDone) - {} + size_t aSize = TSubMeshImpl::GetMemorySize(); - ~TSetIsDone() - { - myIsDone = true; - } + if(myIsElemNum) + aSize += myElemNum->size() * sizeof(MED::TInt); - }; + if(myIsElemNames) + aSize += myElemNames->size() * sizeof(char); + + return aSize; + } + + + //--------------------------------------------------------------- } //--------------------------------------------------------------- extern "C" VISU_Convertor* -CreateConvertor(const string& theFileName) +CreateConvertor(const std::string& theFileName) { if(MED::PWrapper aMed = MED::CrWrapper(theFileName,true)) - return new VISU_MedConvertor(theFileName); + return new VISU_MedConvertor(theFileName, aMed); return NULL; } VISU_MedConvertor -::VISU_MedConvertor(const string& theFileName): +::VISU_MedConvertor(const std::string& theFileName, MED::PWrapper theMed): myIsEntitiesDone(false), myIsFieldsDone(false), myIsGroupsDone(false), - myIsMinMaxDone(false) + myIsMinMaxDone(false), + myMed(theMed) { - myFileInfo.setFile(QString(theFileName.c_str())); - myName = myFileInfo.baseName().latin1(); + myName = theFileName; } @@ -1085,11 +1423,10 @@ VISU_MedConvertor return this; TSetIsDone aSetIsDone(myIsEntitiesDone); - TTimerLog aTimerLog(MYDEBUG,"BuildEntities"); - MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1()); + VISU::TTimerLog aTimerLog(MYDEBUG,"BuildEntities"); - TInt aNbMeshes = aMed->GetNbMeshes(); - TMeshMap& aMeshMap = myMeshMap; + TInt aNbMeshes = myMed->GetNbMeshes(); + VISU::TMeshMap& aMeshMap = myMeshMap; INITMSG(MYDEBUG,"BuildEntities aNbMeshes = "<GetPMeshInfo(iMesh); + MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh); std::string aMeshName = aMeshInfo->GetName(); TInt aDim = aMeshInfo->GetDim(); MED::EMaillage aType = aMeshInfo->GetType(); - + // creating TMesh structure and TMeshOnEntityMap - PMEDMesh aMesh = aMeshMap[aMeshName](new TMEDMesh()); + VISU::PMEDMesh aMesh = aMeshMap[aMeshName](new VISU::TMEDMesh()); aMesh->myDim = aDim; aMesh->myName = aMeshName; aMesh->myMeshInfo = aMeshInfo; - aMesh->myNamedPointCoords(new TMEDNamedPointCoords()); + aMesh->myNamedPointCoords(new VISU::TMEDNamedPointCoords()); INITMSG(MYDEBUG,"aMeshName = '"<GetPNodeInfo(aMeshInfo)){ - MED::TEntityInfo anEntityInfo = aMed->GetEntityInfo(aMeshInfo); + if(MED::PNodeInfo aNodeInfo = myMed->GetPNodeInfo(aMeshInfo)){ + MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo); - aMesh->myNbPoints = aNodeInfo->GetNbElem(); - aMesh->myEntityInfo = anEntityInfo; - - + aMesh->myNbPoints = aNodeInfo->GetNbElem(); + aMesh->myEntityInfo = anEntityInfo; + + #ifndef _DEXCEPT_ - try{ + try{ #endif - INITMSG(MYDEBUG,"myNbPoints = "<myNbPoints<< - "; anEntityInfo.size() = "<GetPGrilleInfo(aMeshInfo); - - MED::TEntityInfo anEntityInfo; - anEntityInfo[MED::eNOEUD][MED::ePOINT1] = aGrilleInfo->GetNbNodes(); - anEntityInfo[aGrilleInfo->GetEntity()][aGrilleInfo->GetGeom()] = aGrilleInfo->GetNbCells(); - - aMesh->myNbPoints = aGrilleInfo->GetNbNodes(); - aMesh->myEntityInfo = anEntityInfo; - + MED::PGrilleInfo aGrilleInfo = myMed->GetPGrilleInfo(aMeshInfo); + + MED::TEntityInfo anEntityInfo; + anEntityInfo[MED::eNOEUD][MED::ePOINT1] = aGrilleInfo->GetNbNodes(); + anEntityInfo[aGrilleInfo->GetEntity()][aGrilleInfo->GetGeom()] = aGrilleInfo->GetNbCells(); + anEntityInfo[aGrilleInfo->GetSubEntity()][aGrilleInfo->GetSubGeom()] = aGrilleInfo->GetNbSubCells(); + + aMesh->myNbPoints = aGrilleInfo->GetNbNodes(); + aMesh->myEntityInfo = anEntityInfo; + + aMesh->myIsPolarType = (MED::eGRILLE_POLAIRE == aGrilleInfo->GetGrilleType()); + aMesh->myIsStructured = true; #ifndef _DEXCEPT_ - try{ + try{ #endif - BEGMSG(MYDEBUG,"anEntityInfo.size() = "<GetNbMeshes(); - TMeshMap& aMeshMap = myMeshMap; + TInt aNbMeshes = myMed->GetNbMeshes(); + VISU::TMeshMap& aMeshMap = myMeshMap; INITMSG(MYDEBUG,"BuildFields - aNbMeshes = "<GetPMeshInfo(iMesh); + MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh); std::string aMeshName = aMeshInfo->GetName(); - TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName); + VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName); if(anIter == aMeshMap.end()) - continue; - PMEDMesh aMesh = anIter->second; + continue; + VISU::PMEDMesh aMesh = anIter->second; INITMSG(MYDEBUG,"aMeshName = '"<GetEntityInfo(aMeshInfo); + MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo); - BuildFieldMap(aMesh, - anEntityInfo, - aMed); + BuildFieldMap(aMesh, + anEntityInfo, + myMed); #ifndef _DEXCEPT_ }catch(std::exception& exc){ - MSG(MYDEBUG,"Follow exception was occured in:\n"< +void +BuildTimeStampMinMax(MED::SharedPtr theTimeStampValue, + const VISU::PMEDMeshOnEntity theMeshOnEntity, + const MED::TGeom2Gauss& theGeom2Gauss, + VISU::TMetric2Comp2MinMax& theMetric2Comp2MinMax, + VISU::TMetric2Comp2MinMax& theMetric2Comp2AverageMinMax, + VISU::TMetric2Comp2Group2MinMax& theMetric2Comp2Group2MinMax, + VISU::TMetric2Comp2Group2MinMax& theMetric2Comp2Group2AverageMinMax, + TInt theNbComp, + TInt theNbComp2) +{ + const VISU::TFamilyIDMap& aFamilyIDMap = theMeshOnEntity->myFamilyIDMap; + VISU::TGeom2ElemID2FamilyID aGeom2ElemID2FamilyID = theMeshOnEntity->myGeom2ElemID2FamilyID; + + VISU::TVector aBaseAverageValues; + aBaseAverageValues.resize(3); + aBaseAverageValues[VISU::AVERAGE_METRIC] = 0.0; + aBaseAverageValues[VISU::MINIMUM_METRIC] = VTK_LARGE_FLOAT; + aBaseAverageValues[VISU::MAXIMUM_METRIC] = -VTK_LARGE_FLOAT; + + const typename TimeStampValueType::TTGeom2Value& aGeom2Value = theTimeStampValue->myGeom2Value; + typename TimeStampValueType::TTGeom2Value::const_iterator anIter = aGeom2Value.begin(); + for(; anIter != aGeom2Value.end(); anIter++){ + const typename TimeStampValueType::TTMeshValue& aMMeshValue = anIter->second; + MED::EGeometrieElement aMGeom = anIter->first; + + TInt aNbElem = aMMeshValue.myNbElem; + TInt aNbGauss = aMMeshValue.myNbGauss; + +// AKL: fix of 0021175 issue. Non-regression test is GVIEW10561(import zzzz121b.med). +// MED::TGeom2Gauss::const_iterator aGaussIter = theGeom2Gauss.find(aMGeom); +// if(aGaussIter == theGeom2Gauss.end()) +// aNbGauss = 1; + + INITMSG(MYDEBUG, + "- aMGeom = "<GetNbMeshes(); - TMeshMap& aMeshMap = myMeshMap; + TInt aNbMeshes = myMed->GetNbMeshes(); + VISU::TMeshMap& aMeshMap = myMeshMap; INITMSG(MYDEBUG,"BuildMinMax - aNbMeshes = "<GetPMeshInfo(iMesh); + MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh); std::string aMeshName = aMeshInfo->GetName(); - TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName); + VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName); if(anIter == aMeshMap.end()) - continue; - PMEDMesh aMesh = anIter->second; + continue; + VISU::PMEDMesh aMesh = anIter->second; #ifndef _DEXCEPT_ try{ #endif - TInt aNbFields = aMed->GetNbFields(); - - INITMSG(MYDEBUG, - "- aMeshName = '"<GetEntityInfo(aMeshInfo); - - for(TInt iField = 1; iField <= aNbFields; iField++){ - TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPFieldInfo()"); - MED::PFieldInfo aFieldInfo = aMed->GetPFieldInfo(aMeshInfo,iField); - std::string aFieldName = aFieldInfo->GetName(); - INITMSG(MYDEBUG,"- aFieldName = '"<GetNbTimeStamps(aFieldInfo, - anEntityInfo, - aMEntity, - aGeom2Size); - if(aNbTimeStamps < 1) - continue; - - TEntity aVEntity = MEDEntityToVTK(aMEntity); - PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity]; - TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap; - PMEDField aField = aFieldMap[aFieldName]; - - TInt aNbComp = aField->myNbComp; - int aNbComp2 = aNbComp; - if(aNbComp == 2 || aNbComp == 4) - aNbComp2 = 2; - else if(aNbComp > 4) - aNbComp2 = 3; - - TMinMaxArr& aMinMaxArr = aField->myMinMaxArr; - TSetIsDone aSetIsDone(aField->myIsMinMaxInitilized); - for(TInt iTimeStamp = aNbTimeStamps; iTimeStamp >= 1; iTimeStamp--){ - TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPTimeStampInfo()"); - INITMSG(MYDEBUG,"- iTimeStamp = "<GetNbFields(); + + INITMSG(MYDEBUG, + "- aMeshName = '"<GetEntityInfo(aMeshInfo); + + for(TInt iField = 1; iField <= aNbFields; iField++) + { + VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPFieldInfo()"); + + MED::TErr anError = 0; + MED::PFieldInfo aFieldInfo = myMed->GetPFieldInfo(aMeshInfo, iField, &anError); + if ( anError < 0 ) + continue; + + std::string aFieldName = aFieldInfo->GetName(); + INITMSG(MYDEBUG,"- aFieldName = '"<GetNbTimeStamps(aFieldInfo, + anEntityInfo, + aMEntity, + aGeom2Size); + if(aNbTimeStamps < 1) + continue; + + VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity); + VISU::PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity]; + VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap; + VISU::PMEDField aField = aFieldMap[aFieldName]; + + TInt aNbComp = aField->myNbComp; + int aNbComp2 = aNbComp; + if(aNbComp == 2 || aNbComp == 4) + aNbComp2 = 2; + else if(aNbComp > 4) + aNbComp2 = 3; + + VISU::TMetric2Comp2MinMax& aMetric2Comp2MinMax = aField->myMetric2Comp2MinMax; + VISU::TMetric2Comp2MinMax& aMetric2Comp2AverageMinMax = aField->myMetric2Comp2AverageMinMax; + VISU::TMetric2Comp2Group2MinMax& aMetric2Comp2Group2MinMax = aField->myMetric2Comp2Group2MinMax; + VISU::TMetric2Comp2Group2MinMax& aMetric2Comp2Group2AverageMinMax = aField->myMetric2Comp2Group2AverageMinMax; + TSetIsDone aSetIsDone(aField->myIsMinMaxInitilized); + for(TInt iTimeStamp = aNbTimeStamps; iTimeStamp >= 1; iTimeStamp--){ + VISU::TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPTimeStampInfo()"); + INITMSG(MYDEBUG,"- iTimeStamp = "<GetPTimeStampInfo(aFieldInfo, - aMEntity, - aGeom2Size, - iTimeStamp); - - MED::PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStampInfo, - aMKey2Profile, - aKey2Gauss); - - const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss(); - - const MED::TTimeStampVal& aTimeStampValRef = aTimeStampVal; - - const MED::TGeom2Value& aGeom2Value = aTimeStampValRef.myGeom2Value; - MED::TGeom2Value::const_iterator anIter = aGeom2Value.begin(); - for(; anIter != aGeom2Value.end(); anIter++){ - const MED::TMeshValue& aMMeshValue = anIter->second; - MED::EGeometrieElement aMGeom = anIter->first; - - TInt aNbElem = aMMeshValue.myNbElem; - TInt aNbGauss = aMMeshValue.myNbGauss; - - MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom); - if(aGaussIter == aGeom2Gauss.end()) - aNbGauss = 1; - - INITMSG(MYDEBUG, - "- aMGeom = "<GetMessageString()); - } + }catch(Standard_Failure){ + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + MSG(MYDEBUG,"Follow signal was occured in:\n"<GetMessageString()); + }catch(std::exception& exc){ + MSG(MYDEBUG,"Follow exception was occured in:\n"<GetMinMax(iComp); - INITMSG(MYDEBUG,"- "<GetMinMax(iComp, VISU::TNames()); + INITMSG(MYDEBUG,"- "<GetNbMeshes(); - TMeshMap& aMeshMap = myMeshMap; + TInt aNbMeshes = myMed->GetNbMeshes(); + VISU::TMeshMap& aMeshMap = myMeshMap; INITMSG(MYDEBUG,"BuildGroups - aNbMeshes = "<GetPMeshInfo(iMesh); - std::string aMeshName = aMeshInfo->GetName(); + MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh); + std::string aMeshName = aMeshInfo->GetName(); - TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName); + VISU::TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName); if(anIter == aMeshMap.end()) - continue; - PMEDMesh aMesh = anIter->second; + continue; + VISU::PMEDMesh aMesh = anIter->second; INITMSG(MYDEBUG,"aMeshName = '"<GetEntityInfo(aMeshInfo); + MED::EMaillage aType = aMeshInfo->GetType(); + + MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo); MED::TEntity2TGeom2ElemInfo anEntity2TGeom2ElemInfo = - MED::GetEntity2TGeom2ElemInfo(aMed,aMeshInfo,anEntityInfo); + MED::GetEntity2TGeom2ElemInfo(myMed, aMeshInfo, anEntityInfo); #ifndef _DEXCEPT_ try{ #endif - MED::TFamilyInfoSet aFamilyInfoSet = MED::GetFamilyInfoSet(aMed,aMeshInfo); - - BuildFamilyMap(aMesh, - anEntityInfo, - anEntity2TGeom2ElemInfo, - aFamilyInfoSet, - aMed); - - BuildGroupMap(aMesh, - aFamilyInfoSet); + MED::TFamilyInfoSet aFamilyInfoSet = MED::GetFamilyInfoSet(myMed, aMeshInfo); + + if(aType == MED::eNON_STRUCTURE) + BuildFamilyMap(aMesh, + anEntityInfo, + anEntity2TGeom2ElemInfo, + aFamilyInfoSet, + myMed); + else + BuildGrilleFamilyMap(aMesh, + anEntityInfo, + aFamilyInfoSet, + myMed); + + BuildGroupMap(aMesh, + aFamilyInfoSet); #ifndef _DEXCEPT_ }catch(std::exception& exc){ - MSG(MYDEBUG,"Follow exception was occured in:\n"<myEntity; + const VISU::TEntity& anEntity = theMeshOnEntity->myEntity; int isPointsUpdated = 0, isCellsOnEntityUpdated = 0; - if(anEntity == NODE_ENTITY){ - isPointsUpdated += LoadPoints(aMed,theMesh); + if(anEntity == VISU::NODE_ENTITY){ + isPointsUpdated += LoadPoints(myMed, theMesh); }else{ - isPointsUpdated += LoadPoints(aMed,theMesh); - isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,theMesh,theMeshOnEntity); + isPointsUpdated += LoadPoints(myMed, theMesh); + isCellsOnEntityUpdated += LoadCellsOnEntity(myMed, theMesh, theMeshOnEntity); } return (isPointsUpdated || isCellsOnEntityUpdated); @@ -1536,21 +2128,20 @@ VISU_MedConvertor int VISU_MedConvertor ::LoadFamilyOnEntity(VISU::PMeshImpl theMesh, - VISU::PMeshOnEntityImpl theMeshOnEntity, - VISU::PFamilyImpl theFamily) + VISU::PMeshOnEntityImpl theMeshOnEntity, + VISU::PFamilyImpl theFamily) { - TTimerLog aTimerLog(MYDEBUG,"LoadFamilyOnEntity"); + VISU::TTimerLog aTimerLog(MYDEBUG,"LoadFamilyOnEntity"); INITMSG(MYDEBUG,"LoadFamilyOnEntity"<myEntity; + const VISU::TEntity& anEntity = theMeshOnEntity->myEntity; int isPointsUpdated = 0, isCellsOnEntityUpdated = 0; - if(anEntity == NODE_ENTITY){ - isPointsUpdated += LoadPointsOnFamily(aMed,theMesh,theFamily); + if(anEntity == VISU::NODE_ENTITY){ + isPointsUpdated += LoadPointsOnFamily(myMed, theMesh, theFamily); }else{ - isPointsUpdated += LoadPoints(aMed,theMesh); - isCellsOnEntityUpdated += LoadCellsOnFamily(aMed,theMesh,theMeshOnEntity,theFamily); + isPointsUpdated += LoadPoints(myMed, theMesh); + isCellsOnEntityUpdated += LoadCellsOnFamily(myMed, theMesh, theMeshOnEntity, theFamily); } return (isPointsUpdated || isCellsOnEntityUpdated); @@ -1561,23 +2152,22 @@ VISU_MedConvertor int VISU_MedConvertor ::LoadMeshOnGroup(VISU::PMeshImpl theMesh, - const VISU::TFamilySet& theFamilySet) + const VISU::TFamilySet& theFamilySet) { - TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnGroup"); + VISU::TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnGroup"); INITMSG(MYDEBUG,"LoadMeshOnGroup"<myEntity; - const PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity]; - isPointsUpdated += LoadPoints(aMed,theMesh); - if(anEntity == NODE_ENTITY){ - isPointsUpdated += LoadPointsOnFamily(aMed,theMesh,aFamily); + VISU::PMEDFamily aFamily = (*aFamilyIter).second; + const VISU::TEntity& anEntity = aFamily->myEntity; + const VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity]; + isPointsUpdated += LoadPoints(myMed, theMesh); + if(anEntity == VISU::NODE_ENTITY){ + isPointsUpdated += LoadPointsOnFamily(myMed, theMesh, aFamily); }else{ - isCellsOnEntityUpdated += LoadCellsOnFamily(aMed,theMesh,aMeshOnEntity,aFamily); + isCellsOnEntityUpdated += LoadCellsOnFamily(myMed,theMesh,aMeshOnEntity,aFamily); } } @@ -1589,21 +2179,19 @@ VISU_MedConvertor int VISU_MedConvertor ::LoadValForTimeOnMesh(VISU::PMeshImpl theMesh, - VISU::PMeshOnEntityImpl theMeshOnEntity, - VISU::PFieldImpl theField, - VISU::PValForTimeImpl theValForTime) + VISU::PMeshOnEntityImpl theMeshOnEntity, + VISU::PFieldImpl theField, + VISU::PValForTimeImpl theValForTime) { - TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnMesh"); + VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnMesh"); INITMSG(MYDEBUG,"LoadValForTimeOnMesh"<myEntity; + const VISU::TEntity& anEntity = theMeshOnEntity->myEntity; int isPointsUpdated = 0, isCellsOnEntityUpdated = 0; - isPointsUpdated += LoadPoints(aMed,theMesh); - if(anEntity != NODE_ENTITY) - isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,theMesh,theMeshOnEntity); - int isFieldUpdated = LoadValForTimeOnMesh(aMed,theMesh,theMeshOnEntity,theField,theValForTime); + isPointsUpdated += LoadPoints(myMed,theMesh); + if(anEntity != VISU::NODE_ENTITY) + isCellsOnEntityUpdated += LoadCellsOnEntity(myMed,theMesh,theMeshOnEntity); + int isFieldUpdated = LoadValForTimeOnMesh(myMed,theMesh,theMeshOnEntity,theField,theValForTime); return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated); } @@ -1613,20 +2201,18 @@ VISU_MedConvertor int VISU_MedConvertor ::LoadValForTimeOnGaussPts(VISU::PMeshImpl theMesh, - VISU::PMeshOnEntityImpl theMeshOnEntity, - VISU::PFieldImpl theField, - VISU::PValForTimeImpl theValForTime) + VISU::PMeshOnEntityImpl theMeshOnEntity, + VISU::PFieldImpl theField, + VISU::PValForTimeImpl theValForTime) { - TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnGaussPts"); + VISU::TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnGaussPts"); INITMSG(MYDEBUG,"LoadValForTimeOnGaussPts"<myEntity; + const VISU::TEntity& anEntity = theMeshOnEntity->myEntity; int isPointsUpdated = 0, isCellsOnEntityUpdated = 0; - if(anEntity != NODE_ENTITY) - isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,theMesh,theMeshOnEntity); - int isFieldUpdated = LoadValForTimeOnGaussPts(aMed,theMesh,theMeshOnEntity,theField,theValForTime); + if(anEntity != VISU::NODE_ENTITY) + isCellsOnEntityUpdated += LoadCellsOnEntity(myMed,theMesh,theMeshOnEntity); + int isFieldUpdated = LoadValForTimeOnGaussPts(myMed,theMesh,theMeshOnEntity,theField,theValForTime); return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated); } @@ -1636,14 +2222,14 @@ VISU_MedConvertor int VISU_MedConvertor ::LoadPoints(const MED::PWrapper& theMed, - VISU::PMEDMesh theMesh) + VISU::PMEDMesh theMesh) { - TTimerLog aTimerLog(MYDEBUG,"LoadPoints"); + VISU::TTimerLog aTimerLog(MYDEBUG,"LoadPoints"); try{ //Check on existing family - PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY]; + VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY]; aMeshOnEntity->myMeshName = theMesh->myName; - aMeshOnEntity->myEntity = NODE_ENTITY; + aMeshOnEntity->myEntity = VISU::NODE_ENTITY; INITMSG(MYDEBUG,"LoadPoints - theMesh->myIsDone = "<myIsDone<<"'\n"); @@ -1657,66 +2243,41 @@ VISU_MedConvertor //Main part of code MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo); TInt aNbElem = aNodeInfo->GetNbElem(); - TInt aDim = theMesh->myDim; - - PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords; - TMEDNamedPointCoords& aCoords = aNamedPointCoords; - aCoords.Init(aNbElem,aDim,aNodeInfo); - for(int iDim = 0; iDim < aDim; iDim++) - aCoords.GetName(iDim) = aNodeInfo->GetCoordName(iDim); + VISU::PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords; + aNamedPointCoords->Init(aNodeInfo, theMed->GetVersion()); - for(int iElem = 0; iElem < aNbElem; iElem++){ - TCoordSlice aVCoordSlice = aCoords.GetCoordSlice(iElem); - MED::TCCoordSlice aMCoordSlice = aNodeInfo->GetCoordSlice(iElem); - for(int iDim = 0; iDim < aDim; iDim++) - aVCoordSlice[iDim] = aMCoordSlice[iDim]; - } - - TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh; - PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new TMEDSubMesh()); + VISU::TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh; + VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new VISU::TMEDSubMesh()); - aSubMesh->Init(MED::PElemInfo(aNodeInfo)); + aSubMesh->Init(MED::PElemInfo(aNodeInfo), theMed->GetVersion()); aSubMesh->myNbCells = theMesh->myNbPoints; aSubMesh->myCellsSize = 2*theMesh->myNbPoints; - TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect; + VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect; aCell2Connect.resize(aNbElem); for (int iElem = 0; iElem < aNbElem; iElem++) - aCell2Connect[iElem] = VISU::TConnect(1,iElem); + aCell2Connect[iElem] = VISU::TConnect(1,iElem); } // END NON_STRUCTURED else { // STRUCTURED //Main part of code MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(theMesh->myMeshInfo); TInt aNbElem = aGrilleInfo->GetNbNodes(); - TInt aDim = theMesh->myDim; - - PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords; - TMEDNamedPointCoords& aCoords = aNamedPointCoords; - aCoords.Init(aNbElem,aDim,aGrilleInfo); - for(int iDim = 0; iDim < aDim; iDim++) - aCoords.GetName(iDim) = aGrilleInfo->GetCoordName(iDim); - - for(int iElem = 0; iElem < aNbElem; iElem++){ - TCoordSlice aVCoordSlice = aCoords.GetCoordSlice(iElem); - MED::TNodeCoord aMCoord = aGrilleInfo->GetCoord(iElem); - for(int iDim = 0; iDim < aDim; iDim++){ - aVCoordSlice[iDim] = aMCoord[iDim]; - } - } + VISU::PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords; + aNamedPointCoords->Init(aGrilleInfo); - TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh; - PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new TMEDSubMesh()); + VISU::TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh; + VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new VISU::TMEDSubMesh()); aSubMesh->Init(aGrilleInfo); aSubMesh->myNbCells = theMesh->myNbPoints; aSubMesh->myCellsSize = 2*theMesh->myNbPoints; - TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect; + VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect; aCell2Connect.resize(aNbElem); - for (int iElem = 0; iElem < aNbElem; iElem++) - aCell2Connect[iElem] = VISU::TConnect(1,iElem); + for(int iElem = 0; iElem < aNbElem; iElem++) + aCell2Connect[iElem] = VISU::TConnect(1,iElem); } @@ -1727,7 +2288,7 @@ VISU_MedConvertor }catch(std::exception& exc){ throw; }catch(...){ - EXCEPTION(runtime_error,"Unknown exception !!!"); + EXCEPTION(std::runtime_error,"Unknown exception !!!"); } return 0; @@ -1738,24 +2299,41 @@ VISU_MedConvertor int VISU_MedConvertor ::LoadPointsOnFamily(const MED::PWrapper& theMed, - const VISU::PMEDMesh theMesh, - const VISU::PMEDFamily theFamily) + const VISU::PMEDMesh theMesh, + const VISU::PMEDFamily theFamily) { - TTimerLog aTimerLog(MYDEBUG,"LoadPointsOnFamily"); + VISU::TTimerLog aTimerLog(MYDEBUG,"LoadPointsOnFamily"); try{ if(theFamily->myIsDone) return 0; + const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo; + MED::EMaillage aType = aMeshInfo->GetType(); + //Main part of code - MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo); - TInt aNbElem = aNodeInfo->GetNbElem(); - - if(aNbElem > 0){ - TInt anId = theFamily->myId; - TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1]; - for(TInt iElem = 0; iElem < aNbElem; iElem++) - if(aNodeInfo->GetFamNum(iElem) == anId) - aSubMeshID.push_back(iElem); + if(aType == MED::eNON_STRUCTURE){ + MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo); + TInt aNbElem = aNodeInfo->GetNbElem(); + + if(aNbElem > 0){ + TInt anId = theFamily->myId; + VISU::TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1]; + for(TInt iElem = 0; iElem < aNbElem; iElem++) + if(aNodeInfo->GetFamNum(iElem) == anId) + aSubMeshID.push_back(iElem); + } + } + else { + MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(aMeshInfo); + TInt aNbElem = aGrilleInfo->GetNbNodes(); + + if(aNbElem > 0){ + TInt anId = theFamily->myId; + VISU::TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1]; + for(TInt iElem = 0; iElem < aNbElem; iElem++) + if(aGrilleInfo->GetFamNumNode(iElem) == anId) + aSubMeshID.push_back(iElem); + } } theFamily->myIsDone = true; @@ -1765,7 +2343,7 @@ VISU_MedConvertor }catch(std::exception& exc){ throw; }catch(...){ - EXCEPTION(runtime_error,"Unknown exception !!!"); + EXCEPTION(std::runtime_error,"Unknown exception !!!"); } return 0; @@ -1776,14 +2354,14 @@ VISU_MedConvertor int VISU_MedConvertor ::LoadCellsOnEntity(const MED::PWrapper& theMed, - const VISU::PMEDMesh theMesh, - const VISU::PMEDMeshOnEntity theMeshOnEntity) + const VISU::PMEDMesh theMesh, + const VISU::PMEDMeshOnEntity theMeshOnEntity) { - TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnEntity"); + VISU::TTimerLog aTimerLog(MYDEBUG,"LoadCellsOnEntity"); #ifndef _DEXCEPT_ try{ #endif - const TEntity& aVEntity = theMeshOnEntity->myEntity; + const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity; const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity); INITMSG(MYDEBUG,"LoadCellsOnEntity - aVEntity = "<myGeom2Size; MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin(); - TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh; + VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh; for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){ - const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first; - VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom); - INITMSG(MYDEBUG,"aMGeom = "<GetNbCells(); - - if(aNbElem > 0){ - PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new TMEDSubMesh()); - - aSubMesh->Init(aGrilleInfo); - aSubMesh->myNbCells = aNbElem; - aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1); - - TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect; - aCell2Connect.resize(aNbElem); - - TInt aMNbNodes = MEDGeom2NbNodes(aMGeom); - TVector aConnect(aMNbNodes); - - for(TInt iElem = 0; iElem < aNbElem; iElem++) { - MED::TIntVector aConn = aGrilleInfo->GetConn(iElem); - TConnect& anArray = aCell2Connect[iElem]; - anArray.resize(aVNbNodes); - - if(anIsNodeNum){ - for(TInt iConn = 0; iConn < aMNbNodes; iConn++){ - aConnect[iConn] = aNodeIdMap[aConn[iConn] - 1]; - } - }else{ - for(int iConn = 0; iConn < aMNbNodes; ++iConn){ - aConnect[iConn] = aConn[iConn]; - } - } - - switch(aMGeom){ - case MED::eQUAD4: - anArray[0] = aConnect[0]; - anArray[1] = aConnect[2]; - anArray[2] = aConnect[3]; - anArray[3] = aConnect[1]; - break; - case MED::eHEXA8: - anArray[0] = aConnect[0]; - anArray[1] = aConnect[2]; - anArray[2] = aConnect[3]; - anArray[3] = aConnect[1]; - anArray[4] = aConnect[4]; - anArray[5] = aConnect[6]; - anArray[6] = aConnect[7]; - anArray[7] = aConnect[5]; - break; - default: - for(int iNode = 0; iNode < aVNbNodes; iNode++) - anArray[iNode] = aConnect[iNode]; - } - - for(int iNode = 0; iNode < aVNbNodes; iNode++) - if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode]) - EXCEPTION(runtime_error,"LoadCellsOnEntity - "<< - " aNbPoints("<first; + VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom); + INITMSG(MYDEBUG,"aMGeom = "<second;//aGrilleInfo->GetNbCells(); + + if(aNbElem > 0){ + VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh()); + + aSubMesh->Init(aGrilleInfo); + aSubMesh->myNbCells = aNbElem; + aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1); + + VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect; + aCell2Connect.resize(aNbElem); + + TInt aMNbNodes = MEDGeom2NbNodes(aMGeom); + VISU::TVector aConnect(aMNbNodes); + + for(TInt iElem = 0; iElem < aNbElem; iElem++) { + MED::TIntVector aConn = aGrilleInfo->GetConn(iElem, theMeshOnEntity->myEntity != VISU::CELL_ENTITY); + VISU::TConnect& anArray = aCell2Connect[iElem]; + anArray.resize(aVNbNodes); + + if(anIsNodeNum){ + for(TInt iConn = 0; iConn < aMNbNodes; iConn++){ + aConnect[iConn] = aNodeIdMap[aConn[iConn] - 1]; + } + }else{ + for(int iConn = 0; iConn < aMNbNodes; ++iConn){ + aConnect[iConn] = aConn[iConn]; + } + } + + switch(aMGeom){ + case MED::eQUAD4: + anArray[0] = aConnect[0]; + anArray[1] = aConnect[2]; + anArray[2] = aConnect[3]; + anArray[3] = aConnect[1]; + break; + case MED::eHEXA8: + anArray[0] = aConnect[0]; + anArray[1] = aConnect[2]; + anArray[2] = aConnect[3]; + anArray[3] = aConnect[1]; + anArray[4] = aConnect[4]; + anArray[5] = aConnect[6]; + anArray[6] = aConnect[7]; + anArray[7] = aConnect[5]; + break; + default: + for(int iNode = 0; iNode < aVNbNodes; iNode++) + anArray[iNode] = aConnect[iNode]; + } + + for(int iNode = 0; iNode < aVNbNodes; iNode++) + if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode]) + EXCEPTION(std::runtime_error,"LoadCellsOnEntity - "<< + " aNbPoints("<myIsDone = true; @@ -1895,14 +2473,14 @@ VISU_MedConvertor EBooleen anIsNodeNum = aNodeInfo->IsElemNum(); if(anIsNodeNum){ for(TInt i = 0; i < aNbPoints; i++){ - aNodeIdMap[aNodeInfo->GetElemNum(i)-1] = i; + aNodeIdMap[aNodeInfo->GetElemNum(i)-1] = i; } } #endif const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size; MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin(); - TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh; + VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh; for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){ const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first; @@ -1910,198 +2488,198 @@ VISU_MedConvertor INITMSG(MYDEBUG,"aMGeom = "<GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom); - TInt aNbElem = aPolygoneInfo->GetNbElem(); - if(aNbElem > 0){ - PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new TMEDSubMesh()); - - aSubMesh->Init(MED::PElemInfo(aPolygoneInfo)); - aSubMesh->myNbCells = aNbElem; - - TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect; - aCell2Connect.resize(aNbElem); - - for(TInt iElem = 0; iElem < aNbElem; iElem++) { - MED::TCConnSlice aConnSlice = aPolygoneInfo->GetConnSlice(iElem); - TInt aNbConn = aPolygoneInfo->GetNbConn(iElem); - aSubMesh->myCellsSize += aNbConn; - TConnect& anArray = aCell2Connect[iElem]; - anArray.resize(aNbConn); - for(TInt iConn = 0; iConn < aNbConn; iConn++) - anArray[iConn] = aConnSlice[iConn] - 1; - } - } - break; + MED::PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom); + TInt aNbElem = aPolygoneInfo->GetNbElem(); + if(aNbElem > 0){ + VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh()); + + aSubMesh->Init(MED::PElemInfo(aPolygoneInfo),theMed->GetVersion()); + aSubMesh->myNbCells = aNbElem; + + VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect; + aCell2Connect.resize(aNbElem); + + for(TInt iElem = 0; iElem < aNbElem; iElem++) { + MED::TCConnSlice aConnSlice = aPolygoneInfo->GetConnSlice(iElem); + TInt aNbConn = aPolygoneInfo->GetNbConn(iElem); + aSubMesh->myCellsSize += aNbConn; + VISU::TConnect& anArray = aCell2Connect[iElem]; + anArray.resize(aNbConn); + for(TInt iConn = 0; iConn < aNbConn; iConn++) + anArray[iConn] = aConnSlice[iConn] - 1; + } + } + break; } case MED::ePOLYEDRE: { - MED::PPolyedreInfo aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom); - TInt aNbElem = aPolyedreInfo->GetNbElem(); - - if(aNbElem > 0){ - PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new TMEDSubMesh()); - - aSubMesh->Init((MED::PElemInfo)aPolyedreInfo); - aSubMesh->myNbCells = aNbElem; - - TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect; - aCell2Connect.resize(aNbElem); - - for(TInt iElem = 0; iElem < aNbElem; iElem++){ - MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(iElem); - TConnect& anArray = aCell2Connect[iElem]; - typedef std::set TConnectSet; - TConnectSet aConnectSet; - TInt aNbFaces = aConnSliceArr.size(); - for(TInt iFace = 0; iFace < aNbFaces; iFace++){ - MED::TCConnSlice aConnSlice = aConnSliceArr[iFace]; - TInt aNbConn = aConnSlice.size(); - aSubMesh->myCellsSize += aNbConn; - for(TInt iConn = 0; iConn < aNbConn; iConn++){ - aConnectSet.insert(aConnSlice[iConn]); - } - } - - int aNbConn = aConnectSet.size(); - anArray.resize(aNbConn); - TConnectSet::iterator anIter = aConnectSet.begin(); - for(int i = 0; anIter != aConnectSet.end(); anIter++, i++){ - TInt anId = *anIter; - anArray[i] = anId - 1; - } - } - } - - break; + MED::PPolyedreInfo aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom); + TInt aNbElem = aPolyedreInfo->GetNbElem(); + + if(aNbElem > 0){ + VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh()); + + aSubMesh->Init(MED::PElemInfo(aPolyedreInfo),theMed->GetVersion()); + aSubMesh->myNbCells = aNbElem; + + VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect; + aCell2Connect.resize(aNbElem); + + for(TInt iElem = 0; iElem < aNbElem; iElem++){ + MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(iElem); + VISU::TConnect& anArray = aCell2Connect[iElem]; + typedef std::set TConnectSet; + TConnectSet aConnectSet; + TInt aNbFaces = aConnSliceArr.size(); + for(TInt iFace = 0; iFace < aNbFaces; iFace++){ + MED::TCConnSlice aConnSlice = aConnSliceArr[iFace]; + TInt aNbConn = aConnSlice.size(); + aSubMesh->myCellsSize += aNbConn; + for(TInt iConn = 0; iConn < aNbConn; iConn++){ + aConnectSet.insert(aConnSlice[iConn]); + } + } + + int aNbConn = aConnectSet.size(); + anArray.resize(aNbConn); + TConnectSet::iterator anIter = aConnectSet.begin(); + for(int i = 0; anIter != aConnectSet.end(); anIter++, i++){ + TInt anId = *anIter; + anArray[i] = anId - 1; + } + } + } + + break; } default: { - vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom); - INITMSG(MYDEBUG,"aVNbNodes = "<GetPCellInfo(aMeshInfo,aMEntity,aMGeom); - TInt aNbElem = aCellInfo->GetNbElem(); - - if(aNbElem > 0){ - PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new TMEDSubMesh()); - - aSubMesh->Init((MED::PElemInfo)aCellInfo); - aSubMesh->myNbCells = aNbElem; - aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1); - - TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect; - aCell2Connect.resize(aNbElem); - - TInt aMNbNodes = MEDGeom2NbNodes(aMGeom); - TVector aConnect(aMNbNodes); - - for(TInt iElem = 0; iElem < aNbElem; iElem++) { - MED::TCConnSlice aConnSlice = aCellInfo->GetConnSlice(iElem); - TConnect& anArray = aCell2Connect[iElem]; - anArray.resize(aVNbNodes); - - if(anIsNodeNum){ - for(TInt iConn = 0; iConn < aMNbNodes; iConn++){ - aConnect[iConn] = aNodeIdMap[aConnSlice[iConn] - 1]; - } - }else{ - for(int iConn = 0; iConn < aMNbNodes; iConn++){ - aConnect[iConn] = aConnSlice[iConn] - 1; - } - } - - switch(aMGeom){ + vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom); + INITMSG(MYDEBUG,"aVNbNodes = "<GetPCellInfo(aMeshInfo,aMEntity,aMGeom); + TInt aNbElem = aCellInfo->GetNbElem(); + + if(aNbElem > 0){ + VISU::PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new VISU::TMEDSubMesh()); + + aSubMesh->Init(MED::PElemInfo(aCellInfo), theMed->GetVersion()); + aSubMesh->myNbCells = aNbElem; + aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1); + + VISU::TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect; + aCell2Connect.resize(aNbElem); + + TInt aMNbNodes = MEDGeom2NbNodes(aMGeom); + VISU::TVector aConnect(aMNbNodes); + + for(TInt iElem = 0; iElem < aNbElem; iElem++) { + MED::TCConnSlice aConnSlice = aCellInfo->GetConnSlice(iElem); + VISU::TConnect& anArray = aCell2Connect[iElem]; + anArray.resize(aVNbNodes); + + if(anIsNodeNum){ + for(TInt iConn = 0; iConn < aMNbNodes; iConn++){ + aConnect[iConn] = aNodeIdMap[aConnSlice[iConn] - 1]; + } + }else{ + for(int iConn = 0; iConn < aMNbNodes; iConn++){ + aConnect[iConn] = aConnSlice[iConn] - 1; + } + } + + switch(aMGeom){ #if !(defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC) - case MED::eSEG3: - anArray[0] = aConnect[0]; - anArray[2] = aConnect[1]; + case MED::eSEG3: + anArray[0] = aConnect[0]; + anArray[2] = aConnect[1]; - anArray[1] = aConnect[2]; - break; + anArray[1] = aConnect[2]; + break; #endif #if !(defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC) - case MED::eTRIA6: - anArray[0] = aConnect[0]; - anArray[2] = aConnect[1]; - anArray[4] = aConnect[2]; - - anArray[1] = aConnect[3]; - anArray[3] = aConnect[4]; - anArray[5] = aConnect[5]; - break; + case MED::eTRIA6: + anArray[0] = aConnect[0]; + anArray[2] = aConnect[1]; + anArray[4] = aConnect[2]; + + anArray[1] = aConnect[3]; + anArray[3] = aConnect[4]; + anArray[5] = aConnect[5]; + break; #endif #if !(defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC) - case MED::eQUAD8: - anArray[0] = aConnect[0]; - anArray[2] = aConnect[1]; - anArray[4] = aConnect[2]; - anArray[6] = aConnect[3]; - - anArray[1] = aConnect[4]; - anArray[3] = aConnect[5]; - anArray[5] = aConnect[6]; - anArray[7] = aConnect[7]; - break; + case MED::eQUAD8: + anArray[0] = aConnect[0]; + anArray[2] = aConnect[1]; + anArray[4] = aConnect[2]; + anArray[6] = aConnect[3]; + + anArray[1] = aConnect[4]; + anArray[3] = aConnect[5]; + anArray[5] = aConnect[6]; + anArray[7] = aConnect[7]; + break; #endif #if (defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC) - case MED::eTETRA10: - anArray[0] = aConnect[0]; - anArray[1] = aConnect[2]; - anArray[2] = aConnect[1]; - anArray[3] = aConnect[3]; - - anArray[4] = aConnect[6]; - anArray[5] = aConnect[5]; - anArray[6] = aConnect[4]; - - anArray[7] = aConnect[7]; - anArray[8] = aConnect[9]; - anArray[9] = aConnect[8]; - break; + case MED::eTETRA10: + anArray[0] = aConnect[0]; + anArray[1] = aConnect[2]; + anArray[2] = aConnect[1]; + anArray[3] = aConnect[3]; + + anArray[4] = aConnect[6]; + anArray[5] = aConnect[5]; + anArray[6] = aConnect[4]; + + anArray[7] = aConnect[7]; + anArray[8] = aConnect[9]; + anArray[9] = aConnect[8]; + break; #endif - case MED::eTETRA4: - anArray[0] = aConnect[0]; - anArray[1] = aConnect[2]; - anArray[2] = aConnect[1]; - anArray[3] = aConnect[3]; - break; + case MED::eTETRA4: + anArray[0] = aConnect[0]; + anArray[1] = aConnect[2]; + anArray[2] = aConnect[1]; + anArray[3] = aConnect[3]; + break; #if (defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC) - case MED::ePYRA13: - anArray[0] = aConnect[0]; - anArray[1] = aConnect[3]; - anArray[2] = aConnect[2]; - anArray[3] = aConnect[1]; - anArray[4] = aConnect[4]; - - anArray[5] = aConnect[5]; - anArray[6] = aConnect[8]; - anArray[7] = aConnect[7]; - anArray[8] = aConnect[6]; - - anArray[9] = aConnect[9]; - anArray[10] = aConnect[12]; - anArray[11] = aConnect[11]; - anArray[12] = aConnect[10]; - break; + case MED::ePYRA13: + anArray[0] = aConnect[0]; + anArray[1] = aConnect[3]; + anArray[2] = aConnect[2]; + anArray[3] = aConnect[1]; + anArray[4] = aConnect[4]; + + anArray[5] = aConnect[8]; + anArray[6] = aConnect[7]; + anArray[7] = aConnect[6]; + anArray[8] = aConnect[5]; + + anArray[9] = aConnect[9]; + anArray[10] = aConnect[12]; + anArray[11] = aConnect[11]; + anArray[12] = aConnect[10]; + break; #endif - case MED::ePYRA5: - anArray[0] = aConnect[0]; - anArray[1] = aConnect[3]; - anArray[2] = aConnect[2]; - anArray[3] = aConnect[1]; - anArray[4] = aConnect[4]; - break; - default: - for(int iNode = 0; iNode < aVNbNodes; iNode++) - anArray[iNode] = aConnect[iNode]; - } - for(int iNode = 0; iNode < aVNbNodes; iNode++) - if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode]) - EXCEPTION(runtime_error,"LoadCellsOnEntity - "<< - " aNbPoints("<myEntity; + const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity; const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity); INITMSG(MYDEBUG,"LoadCellsOnFamily - aVEntity = "<myId; const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo; - TGeom2SubMeshID& aGeom2SubMeshID = theFamily->myGeom2SubMeshID; + VISU::TGeom2SubMeshID& aGeom2SubMeshID = theFamily->myGeom2SubMeshID; + MED::EMaillage aType = aMeshInfo->GetType(); const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size; MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin(); for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){ const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first; - MED::PElemInfo anElemInfo; - switch(aMGeom){ - case MED::ePOLYGONE: { - anElemInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom); - break; - } - case MED::ePOLYEDRE: { - anElemInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom); - break; - } - default: { - anElemInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom); - break; - }} - if(anElemInfo){ - if(TInt aNbElem = anElemInfo->GetNbElem()){ - TSubMeshID aSubMeshID; - for(TInt iElem = 0; iElem < aNbElem; iElem++) - if(anElemInfo->GetFamNum(iElem) == anId) - aSubMeshID.push_back(iElem); - if(!aSubMeshID.empty()){ - VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom); - INITMSG(MYDEBUG,"aMGeom = "<GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom); + break; + } + case MED::ePOLYEDRE: { + anElemInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom); + break; + } + default: { + anElemInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom); + break; + }} + if(anElemInfo){ + if(TInt aNbElem = anElemInfo->GetNbElem()){ + VISU::TSubMeshID aSubMeshID; + for(TInt iElem = 0; iElem < aNbElem; iElem++) + if(anElemInfo->GetFamNum(iElem) == anId) + aSubMeshID.push_back(iElem); + if(!aSubMeshID.empty()){ + VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom); + INITMSG(MYDEBUG,"aMGeom = "<GetPGrilleInfo(aMeshInfo); + if(anElemInfo){ + TInt aNbElem = anElemInfo->GetNbCells(); + if(aNbElem>0 && (aMGeom == anElemInfo->GetGeom()) ){ + VISU::TSubMeshID aSubMeshID; + for(TInt iElem = 0; iElem < aNbElem; iElem++) + if(anElemInfo->GetFamNum(iElem) == anId) + aSubMeshID.push_back(iElem); + if(!aSubMeshID.empty()){ + VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom); + INITMSG(MYDEBUG,"aMGeom = "<myIsDone) return; - const TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile; - const MED::TGeom2Profile& aGeom2Profile = theTimeStampVal.GetGeom2Profile(); + const VISU::TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile; + const MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->GetGeom2Profile(); MED::TGeom2Profile::const_iterator anIter = aGeom2Profile.begin(); for(; anIter != aGeom2Profile.end(); anIter++){ MED::PProfileInfo aProfileInfo = anIter->second; MED::EGeometrieElement aMGeom = anIter->first; VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom); - TGeom2SubProfile::const_iterator anIter2 = aGeom2SubProfile.find(aEGeom); + VISU::TGeom2SubProfile::const_iterator anIter2 = aGeom2SubProfile.find(aEGeom); if(anIter2 != aGeom2SubProfile.end()){ - PMEDSubProfile aSubProfile = anIter2->second; + VISU::PMEDSubProfile aSubProfile = anIter2->second; MED::TElemNum& anElemNum = aProfileInfo->myElemNum; if(!anElemNum.empty()){ - TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID; - TInt aSize = anElemNum.size(); - aSubMeshID.resize(aSize); - for(TInt anId = 0; anId < aSize; anId++) - aSubMeshID[anId] = anElemNum[anId] - 1; + VISU::TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID; + TInt aSize = anElemNum.size(); + aSubMeshID.resize(aSize); + for(TInt anId = 0; anId < aSize; anId++) + aSubMeshID[anId] = anElemNum[anId] - 1; } INITMSG(MYDEBUG, - "- aEGeom = "<myMeshInfo->GetType() == MED::eSTRUCTURE) - EXCEPTION(runtime_error,"LoadGaussMesh - Gauss Points localization error!!!"); + EXCEPTION(std::runtime_error,"LoadGaussMesh - Gauss Points localization error!!!"); - PMEDGaussMesh aGaussMesh = theValForTime.myGaussMesh; + VISU::PMEDGaussMesh aGaussMesh = theValForTime.myGaussMesh; if(!aGaussMesh || aGaussMesh->myIsDone) return; const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo; MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo); - TEntity aVEntity = theMeshOnEntity.myEntity; + VISU::TEntity aVEntity = theMeshOnEntity.myEntity; MED::EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity); - const TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh; - const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampVal.GetTimeStampInfo(); + const VISU::TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh; + const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampValue->GetTimeStampInfo(); const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss(); - TGeom2GaussSubMesh::const_iterator aSubMeshIter = aGeom2GaussSubMesh.begin(); + VISU::TGeom2GaussSubMesh::const_iterator aSubMeshIter = aGeom2GaussSubMesh.begin(); for(; aSubMeshIter != aGeom2GaussSubMesh.end(); aSubMeshIter++){ - PMEDGaussSubMesh aGaussSubMesh = aSubMeshIter->second; + VISU::PMEDGaussSubMesh aGaussSubMesh = aSubMeshIter->second; VISU::EGeometry aEGeom = aSubMeshIter->first; if(aGaussSubMesh->myIsDone) continue; - PMEDSubProfile aSubProfile = aGaussSubMesh->mySubProfile; - const TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID; + VISU::PMEDSubProfile aSubProfile = aGaussSubMesh->mySubProfile; + const VISU::TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID; MED::EGeometrieElement aMGeom = aSubProfile->myMGeom; MED::PPolygoneInfo aPolygoneInfo; @@ -2310,145 +2907,184 @@ LoadGaussMesh(const MED::PWrapper& theMed, switch(aMGeom){ case MED::ePOLYGONE: aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo, - aMEntity, - aMGeom); + aMEntity, + aMGeom); anElemInfo = aPolygoneInfo; break; case MED::ePOLYEDRE: aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo, - aMEntity, - aMGeom); + aMEntity, + aMGeom); anElemInfo = aPolyedreInfo; break; default: aCellInfo = theMed->GetPCellInfo(aMeshInfo, - aMEntity, - aMGeom); + aMEntity, + aMGeom); anElemInfo = aCellInfo; } aGaussSubMesh->myIsElemNum = anElemInfo->IsElemNum(); aGaussSubMesh->myElemNum = anElemInfo->myElemNum; std::string aName; - MED::TGaussCoord aGaussCoord; bool anIsGaussCoord3D = false; + MED::PGaussCoord aGaussCoordPtr(new MED::TGaussCoord()); + MED::TGaussCoord& aGaussCoord = *aGaussCoordPtr; MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom); if(aGaussIter != aGeom2Gauss.end()){ - PMEDGauss aGauss = aGaussSubMesh->myGauss; + VISU::PMEDGauss aGauss = aGaussSubMesh->myGauss; MED::PGaussInfo aGaussInfo = aGauss->myGaussInfo; if(aGaussInfo){ - aName = aGaussInfo->GetName(); - if(!aSubMeshID.empty()){ - const std::string& aProfileName = aSubProfile->myName; - MED::PProfileInfo aProfileInfo = MED::GetProfileInfo(theMed, - aProfileName); - if(aProfileInfo){ - const MED::TElemNum& anElemNum = aProfileInfo->myElemNum; - anIsGaussCoord3D = MED::GetGaussCoord3D(aGaussInfo, - aCellInfo, - aNodeInfo, - aGaussCoord, - anElemNum); - } - }else - anIsGaussCoord3D = MED::GetGaussCoord3D(aGaussInfo, - aCellInfo, - aNodeInfo, - aGaussCoord); + aName = aGaussInfo->GetName(); + if(!aSubMeshID.empty()){ + const std::string& aProfileName = aSubProfile->myName; + MED::PProfileInfo aProfileInfo = MED::GetProfileInfo(theMed, + aProfileName); + if(aProfileInfo){ + const MED::TElemNum& anElemNum = aProfileInfo->myElemNum; + anIsGaussCoord3D = MED::GetGaussCoord3D(aGaussInfo, + aCellInfo, + aNodeInfo, + aGaussCoord, + anElemNum); + } + }else + anIsGaussCoord3D = MED::GetGaussCoord3D(aGaussInfo, + aCellInfo, + aNodeInfo, + aGaussCoord); } }else{ if(!aSubMeshID.empty()){ - const std::string& aProfileName = aSubProfile->myName; - MED::PProfileInfo aProfileInfo = MED::GetProfileInfo(theMed, - aProfileName); - if(aProfileInfo){ - const MED::TElemNum& anElemNum = aProfileInfo->myElemNum; - switch(aMGeom){ - case MED::ePOLYGONE: - anIsGaussCoord3D = MED::GetBaryCenter(aPolygoneInfo, - aNodeInfo, - aGaussCoord, - anElemNum); - break; - case MED::ePOLYEDRE: - anIsGaussCoord3D = MED::GetBaryCenter(aPolyedreInfo, - aNodeInfo, - aGaussCoord, - anElemNum); - break; - default: - anIsGaussCoord3D = MED::GetBaryCenter(aCellInfo, - aNodeInfo, - aGaussCoord, - anElemNum); - } - } + const std::string& aProfileName = aSubProfile->myName; + MED::PProfileInfo aProfileInfo = MED::GetProfileInfo(theMed, + aProfileName); + if(aProfileInfo){ + const MED::TElemNum& anElemNum = aProfileInfo->myElemNum; + switch(aMGeom){ + case MED::ePOLYGONE: + anIsGaussCoord3D = MED::GetBaryCenter(aPolygoneInfo, + aNodeInfo, + aGaussCoord, + anElemNum); + break; + case MED::ePOLYEDRE: + anIsGaussCoord3D = MED::GetBaryCenter(aPolyedreInfo, + aNodeInfo, + aGaussCoord, + anElemNum); + break; + default: + anIsGaussCoord3D = MED::GetBaryCenter(aCellInfo, + aNodeInfo, + aGaussCoord, + anElemNum); + } + } }else - switch(aMGeom){ - case MED::ePOLYGONE: - anIsGaussCoord3D = MED::GetBaryCenter(aPolygoneInfo, - aNodeInfo, - aGaussCoord); - break; - case MED::ePOLYEDRE: - anIsGaussCoord3D = MED::GetBaryCenter(aPolyedreInfo, - aNodeInfo, - aGaussCoord); - break; - default: - anIsGaussCoord3D = MED::GetBaryCenter(aCellInfo, - aNodeInfo, - aGaussCoord); - } + switch(aMGeom){ + case MED::ePOLYGONE: + anIsGaussCoord3D = MED::GetBaryCenter(aPolygoneInfo, + aNodeInfo, + aGaussCoord); + break; + case MED::ePOLYEDRE: + anIsGaussCoord3D = MED::GetBaryCenter(aPolyedreInfo, + aNodeInfo, + aGaussCoord); + break; + default: + anIsGaussCoord3D = MED::GetBaryCenter(aCellInfo, + aNodeInfo, + aGaussCoord); + } } if(anIsGaussCoord3D){ - TPointCoords& aCoords = aGaussSubMesh->myPointCoords; - TInt aNbGauss = aGaussCoord.GetNbGauss(); - TInt aNbElem = aGaussCoord.GetNbElem(); - TInt aDim = aGaussCoord.GetDim(); - vtkIdType aNbCells = aNbElem*aNbGauss; - aCoords.Init(aNbCells,aDim); - for(TInt anElemId = 0, aNodeId = 0; anElemId < aNbElem; anElemId++){ - MED::TCoordSliceArr aCoordSliceArr = aGaussCoord.GetCoordSliceArr(anElemId); - for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++, aNodeId++){ - MED::TCoordSlice aCoordSlice = aCoordSliceArr[aGaussId]; - TCoordSlice aSlice = aCoords.GetCoordSlice(aNodeId); - for(TInt aDimId = 0; aDimId < aDim; aDimId++) - aSlice[aDimId] = aCoordSlice[aDimId]; - } - } + VISU::TPointCoords& aCoords = aGaussSubMesh->myPointCoords; + VISU::TMEDGaussCoordHolder* aCoordHolder = new VISU::TMEDGaussCoordHolder(); + aCoordHolder->Init(aGaussCoordPtr); + aCoords.Init(VISU::PCoordHolder(aCoordHolder)); - aGaussSubMesh->myIsDone = true;; + aGaussSubMesh->myIsDone = true; + TInt aNbGauss = aGaussCoord.GetNbGauss(); + TInt aNbElem = aGaussCoord.GetNbElem(); + TInt aNbCells = aNbElem*aNbGauss; + INITMSG(MYDEBUG, - "- aEGeom = "<myIsDone = true; } +//--------------------------------------------------------------- +template +void +FillValForTime(MED::SharedPtr theTimeStampValue, + const VISU::TGeom2SubProfile& theGeom2SubProfile, + VISU::PMEDValForTime theValForTime, + VISU::PMEDField theField) +{ + if(theValForTime->myIsFilled) + return; + theField->myDataSize = 0; + TInt aNbComp = theField->myNbComp; + + VISU::TGeom2SubProfile::const_iterator anIter = theGeom2SubProfile.begin(); + for(; anIter != theGeom2SubProfile.end(); anIter++) { + VISU::EGeometry aEGeom = anIter->first; + VISU::PMEDSubProfile aSubProfile(anIter->second); + + TInt aNbElem = aSubProfile->myNbCells; + theField->myDataSize += aNbElem * aNbComp; + + if(aSubProfile->myStatus != VISU::eRemoveAll){ + TInt aNbGauss = theValForTime->GetNbGauss(aEGeom); + + INITMSG(MYDEBUG, + "- aEGeom = "<