From: apo Date: Thu, 28 Jul 2005 11:08:12 +0000 (+0000) Subject: To introduce new data structure (TMeshValue) that is responsible for result data... X-Git-Tag: BR-D5-38-2003_D2005-12-09~146 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=91987fe6a1753c05eeddfb1e232bcca39ff60394;p=modules%2Fvisu.git To introduce new data structure (TMeshValue) that is responsible for result data representation according to Gauss Points and number of components --- diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index 95381c6d..72c0b922 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -235,8 +235,98 @@ namespace VISU return make_pair(aFamily->myNbCells,aFamily->myCellsSize); } + + //--------------------------------------------------------------- + void + TMeshValue + ::Init(vtkIdType theNbElem, + vtkIdType theNbGauss, + vtkIdType theNbComp) + { + myNbElem = theNbElem; + myNbGauss = theNbGauss; + myNbComp = theNbComp; + + myStep = theNbComp*theNbGauss; + + myValue.resize(theNbElem*myStep); + } + + TCValueSliceArr + TMeshValue + ::GetGaussValueSliceArr(vtkIdType theElemId) const + { + TCValueSliceArr aValueSliceArr(myNbGauss); + vtkIdType anId = theElemId*myStep; + for(vtkIdType aGaussId = 0; aGaussId < myNbGauss; aGaussId++){ + aValueSliceArr[aGaussId] = + TCValueSlice(myValue,std::slice(anId,myNbComp,1)); + anId += myNbComp; + } + return aValueSliceArr; + } + + TValueSliceArr + TMeshValue + ::GetGaussValueSliceArr(vtkIdType theElemId) + { + TValueSliceArr aValueSliceArr(myNbGauss); + vtkIdType anId = theElemId*myStep; + for(vtkIdType aGaussId = 0; aGaussId < myNbGauss; aGaussId++){ + aValueSliceArr[aGaussId] = + TValueSlice(myValue,std::slice(anId,myNbComp,1)); + anId += myNbComp; + } + return aValueSliceArr; + } + + TCValueSliceArr + TMeshValue + ::GetCompValueSliceArr(vtkIdType theElemId) const + { + TCValueSliceArr aValueSliceArr(myNbComp); + vtkIdType anId = theElemId*myStep; + for(vtkIdType aCompId = 0; aCompId < myNbComp; aCompId++){ + aValueSliceArr[aCompId] = + TCValueSlice(myValue,std::slice(anId,myNbGauss,myNbGauss)); + anId += 1; + } + return aValueSliceArr; + } + + TValueSliceArr + TMeshValue + ::GetCompValueSliceArr(vtkIdType theElemId) + { + TValueSliceArr aValueSliceArr(myNbComp); + vtkIdType anId = theElemId*myStep; + for(vtkIdType aCompId = 0; aCompId < myNbComp; aCompId++){ + aValueSliceArr[aCompId] = + TValueSlice(myValue,std::slice(anId,myNbGauss,myNbGauss)); + anId += 1; + } + return aValueSliceArr; + } + //--------------------------------------------------------------- + const TMeshValue& + TValForTimeImpl + ::GetMeshValue(vtkIdType theGeom) const + { + TGeom2Value::const_iterator anIter = myGeom2Value.find(theGeom); + if(anIter == myGeom2Value.end()) + EXCEPTION(runtime_error,"TValForTimeImpl::GetMeshValue - myGeom2Value.find(theGeom) fails"); + return anIter->second; + } + + TMeshValue& + TValForTimeImpl + ::GetMeshValue(vtkIdType theGeom) + { + return myGeom2Value[theGeom]; + } + int TValForTimeImpl ::GetNbGauss(vtkIdType theGeom) const @@ -601,92 +691,68 @@ namespace //theFloatArray->DebugOn(); theFloatArray->SetNumberOfTuples(theNumberOfTuples); theFloatArray->SetName(theFieldName.c_str()); - int aNbComp = theField->myNbComp; - const VISU::TValForCells& aValForCells = theValForTime->myValForCells; - VISU::TValForCells::const_iterator anIter = aValForCells.begin(); - for(int aTupleId = 0; anIter != aValForCells.end(); anIter++) { + TGeom2Value& aGeom2Value = theValForTime->myGeom2Value; + TGeom2Value::const_iterator anIter = aGeom2Value.begin(); + for(int aTupleId = 0; anIter != aGeom2Value.end(); anIter++){ int aGeom = anIter->first; - const VISU::TValForCellsWithType& anArray = anIter->second; - - int aNbGauss = theValForTime->GetNbGauss(aGeom); - int aStep = aNbComp*aNbGauss; - int aNbElem = anArray.size()/aStep; + const TMeshValue& aMeshValue = anIter->second; + int aNbElem = aMeshValue.myNbElem; + int aNbGauss = aMeshValue.myNbGauss; + int aNbComp = aMeshValue.myNbComp; + INITMSG(MYDEBUG,"GetTimeStampOnProfile2 - aGeom = "<SetTuple3(aTupleId++,aValue[0],aValue[1],aValue[2]); + } } } } diff --git a/src/CONVERTOR/VISU_Convertor_impl.hxx b/src/CONVERTOR/VISU_Convertor_impl.hxx index ceb2b99e..8a6f88c4 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.hxx +++ b/src/CONVERTOR/VISU_Convertor_impl.hxx @@ -243,12 +243,53 @@ namespace VISU //--------------------------------------------------------------- - typedef std::vector TValForCellsWithType; - typedef std::map TValForCells; + typedef std::vector TValue; + typedef TSlice TValueSlice; + typedef TCSlice TCValueSlice; + + typedef std::vector TCValueSliceArr; + typedef std::vector TValueSliceArr; + + struct TMeshValue + { + TValue myValue; + + vtkIdType myNbElem; + vtkIdType myNbComp; + vtkIdType myNbGauss; + vtkIdType myStep; + + void + Init(vtkIdType theNbElem, + vtkIdType theNbGauss, + vtkIdType theNbComp); + + TCValueSliceArr + GetGaussValueSliceArr(vtkIdType theElemId) const; + + TValueSliceArr + GetGaussValueSliceArr(vtkIdType theElemId); + + TCValueSliceArr + GetCompValueSliceArr(vtkIdType theElemId) const; + + TValueSliceArr + GetCompValueSliceArr(vtkIdType theElemId); + }; + + + //--------------------------------------------------------------- + typedef std::map TGeom2Value; struct TValForTimeImpl: virtual TValForTime, virtual TSource { - TValForCells myValForCells; + TGeom2Value myGeom2Value; + + const TMeshValue& + GetMeshValue(vtkIdType theGeom) const; + + TMeshValue& + GetMeshValue(vtkIdType theGeom); int myNbGauss; diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index c48b9233..0b6f084f 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -38,9 +38,12 @@ #define _EDF_NODE_IDS_ using namespace std; -using namespace MED; using namespace VISU; +using MED::TInt; +using MED::TFloat; +using MED::EBooleen; + #ifdef _DEBUG_ static int MYDEBUG = 1; static int MY_FAMILY_DEBUG = 0; @@ -54,11 +57,6 @@ static int MY_GROUP_DEBUG = 0; namespace { - - using namespace MED; - using namespace VISU; - - //--------------------------------------------------------------- int MEDGeom2NbNodes(MED::EGeometrieElement theMEDGeomType) @@ -72,23 +70,23 @@ namespace MEDGeomToVTK(MED::EGeometrieElement theMEDGeomType) { switch(theMEDGeomType){ - case ePOINT1: return VTK_VERTEX; - case eSEG2: return VTK_LINE; - case eSEG3: return VTK_LINE; - case eTRIA3: return VTK_TRIANGLE; - case eTRIA6: return VTK_TRIANGLE; - case eQUAD4: return VTK_QUAD; - case eQUAD8: return VTK_QUAD; - case eTETRA4: return VTK_TETRA; - case eTETRA10: return VTK_TETRA; - case eHEXA8: return VTK_HEXAHEDRON; - case eHEXA20: return VTK_HEXAHEDRON; - case ePENTA6: return VTK_WEDGE; - case ePENTA15: return VTK_WEDGE; - case ePYRA5: return VTK_PYRAMID; - case ePYRA13: return VTK_PYRAMID; - case ePOLYGONE: return VTK_POLYGON; - case ePOLYEDRE: return VTK_CONVEX_POINT_SET; + case MED::ePOINT1: return VTK_VERTEX; + case MED::eSEG2: return VTK_LINE; + case MED::eSEG3: return VTK_LINE; + case MED::eTRIA3: return VTK_TRIANGLE; + case MED::eTRIA6: return VTK_TRIANGLE; + case MED::eQUAD4: return VTK_QUAD; + case MED::eQUAD8: return VTK_QUAD; + case MED::eTETRA4: return VTK_TETRA; + case MED::eTETRA10: return VTK_TETRA; + case MED::eHEXA8: return VTK_HEXAHEDRON; + case MED::eHEXA20: return VTK_HEXAHEDRON; + case MED::ePENTA6: return VTK_WEDGE; + case MED::ePENTA15: return VTK_WEDGE; + case MED::ePYRA5: return VTK_PYRAMID; + case MED::ePYRA13: return VTK_PYRAMID; + case MED::ePOLYGONE: return VTK_POLYGON; + case MED::ePOLYEDRE: return VTK_CONVEX_POINT_SET; } return -1; } @@ -99,18 +97,18 @@ namespace VTKGeomToMED(int theVTKGeomType) { switch(theVTKGeomType){ - case VTK_VERTEX: return ePOINT1; - case VTK_LINE: return eSEG2; - case VTK_TRIANGLE: return eTRIA3; - case VTK_QUAD: return eQUAD4; - case VTK_TETRA: return eTETRA4; - case VTK_HEXAHEDRON: return eHEXA8; - case VTK_WEDGE: return ePENTA6; - case VTK_PYRAMID: return ePYRA5; - case VTK_POLYGON: return ePOLYGONE; - case VTK_CONVEX_POINT_SET: return ePOLYEDRE; + case VTK_VERTEX: return MED::ePOINT1; + case VTK_LINE: return MED::eSEG2; + case VTK_TRIANGLE: return MED::eTRIA3; + case VTK_QUAD: return MED::eQUAD4; + case VTK_TETRA: return MED::eTETRA4; + case VTK_HEXAHEDRON: return MED::eHEXA8; + case VTK_WEDGE: return MED::ePENTA6; + case VTK_PYRAMID: return MED::ePYRA5; + case VTK_POLYGON: return MED::ePOLYGONE; + case VTK_CONVEX_POINT_SET: return MED::ePOLYEDRE; } - return EGeometrieElement(-1); + return MED::EGeometrieElement(-1); } @@ -119,10 +117,10 @@ namespace MEDEntityToVTK(MED::EEntiteMaillage theMEDEntity) { switch(theMEDEntity){ - case eNOEUD: return NODE_ENTITY; - case eARETE: return EDGE_ENTITY; - case eFACE: return FACE_ENTITY; - case eMAILLE: return CELL_ENTITY; + case MED::eNOEUD: return NODE_ENTITY; + case MED::eARETE: return EDGE_ENTITY; + case MED::eFACE: return FACE_ENTITY; + case MED::eMAILLE: return CELL_ENTITY; } return TEntity(-1); } @@ -133,10 +131,10 @@ namespace VTKEntityToMED(TEntity theVTKEntity) { switch(theVTKEntity){ - case NODE_ENTITY: return eNOEUD; - case EDGE_ENTITY: return eARETE; - case FACE_ENTITY: return eFACE; - case CELL_ENTITY: return eMAILLE; + case NODE_ENTITY: return MED::eNOEUD; + case EDGE_ENTITY: return MED::eARETE; + case FACE_ENTITY: return MED::eFACE; + case CELL_ENTITY: return MED::eMAILLE; } return MED::EEntiteMaillage(-1); } @@ -155,14 +153,14 @@ namespace aSubProfile->myGeom = aVGeom; aSubProfile->myStatus = eAddAll; - TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(theMGeom); + MED::TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(theMGeom); if(aTimeStampIter == theGeom2Size.end()) aSubProfile->myStatus = eRemoveAll; else{ aSubProfile->myNbCells = aTimeStampIter->second; - TGeom2Profile::const_iterator aProfileIter = theGeom2Profile.find(theMGeom); + MED::TGeom2Profile::const_iterator aProfileIter = theGeom2Profile.find(theMGeom); if(aProfileIter != theGeom2Profile.end()){ - PProfileInfo aProfileInfo = aProfileIter->second; + MED::PProfileInfo aProfileInfo = aProfileIter->second; aSubProfile->myNbCells = aProfileInfo->myElemNum.size(); aSubProfile->myName = aProfileInfo->GetName(); @@ -194,12 +192,12 @@ namespace INITMSG(MYDEBUG,"GetProfileKey"<first; + MED::EGeometrieElement aMGeom = anIter->first; PSubProfile aSubProfile = CrSubProfile(aMGeom,theGeom2Size,aGeom2Profile); aProfileKey.insert(aSubProfile); } @@ -261,14 +259,14 @@ namespace TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile; TGaussKey aGaussKey; - const TGeom2Profile& aGeom2Profile = theTimeStampVal.GetGeom2Profile(); - const TTimeStampInfo& aTimeStampInfo = theTimeStampVal.GetTimeStampInfo(); - const TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss(); + const MED::TGeom2Profile& aGeom2Profile = theTimeStampVal.GetGeom2Profile(); + const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampVal.GetTimeStampInfo(); + const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss(); - const TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size; - TGeom2Size::const_iterator anIter = aGeom2Size.begin(); + const MED::TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size; + MED::TGeom2Size::const_iterator anIter = aGeom2Size.begin(); for(; anIter != aGeom2Size.end(); anIter++){ - EGeometrieElement aMGeom = anIter->first; + MED::EGeometrieElement aMGeom = anIter->first; vtkIdType aVGeom = MEDGeomToVTK(aMGeom); TGeom2SubProfile::iterator anIter2 = aGeom2SubProfile.find(aVGeom); @@ -277,9 +275,9 @@ namespace continue; } - TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(aMGeom); + MED::TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(aMGeom); if(aTimeStampIter != theGeom2Size.end()){ - TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom); + MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom); if(aGaussIter != aGeom2Gauss.end()){ PMEDGaussSubMesh aGaussSubMesh(new TMEDGaussSubMesh()); @@ -291,7 +289,7 @@ namespace aGaussSubMesh->myGauss = aGauss; aGauss->myGeom = aVGeom; - PGaussInfo aGaussInfo = aGaussIter->second; + MED::PGaussInfo aGaussInfo = aGaussIter->second; aGauss->myGaussInfo = aGaussInfo; std::string aName = aGaussInfo->GetName(); @@ -395,10 +393,10 @@ VISU_Convertor* VISU_MedConvertor ::Build() { - PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1()); + MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1()); - TKey2Gauss aKey2Gauss = GetKey2Gauss(aMed); - TMKey2Profile aMKey2Profile = GetMKey2Profile(aMed); + MED::TKey2Gauss aKey2Gauss = MED::GetKey2Gauss(aMed); + MED::TMKey2Profile aMKey2Profile = MED::GetMKey2Profile(aMed); TInt aNbMeshes = aMed->GetNbMeshes(); TMeshMap& aMeshMap = myMeshMap; @@ -408,13 +406,13 @@ VISU_MedConvertor for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){ try{ - PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh); + MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh); - PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo); + MED::PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo); MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo); - TElemGroup aElemGroup = GetElemsByEntity(aMed,aMeshInfo,aEntityInfo); + MED::TElemGroup aElemGroup = MED::GetElemsByEntity(aMed,aMeshInfo,aEntityInfo); // creating TMesh structure and TMeshOnEntityMap typedef map TFamilyCounterMap; @@ -439,7 +437,7 @@ VISU_MedConvertor TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap; MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin(); for(; anEntityIter != aEntityInfo.end(); anEntityIter++){ - const EEntiteMaillage& aMEntity = anEntityIter->first; + const MED::EEntiteMaillage& aMEntity = anEntityIter->first; const MED::TGeom2Size& aGeom2Size = anEntityIter->second; TEntity aVEntity = MEDEntityToVTK(aMEntity); @@ -452,7 +450,7 @@ VISU_MedConvertor "; aVEntity = "<myNbCells = aMesh->myNbPoints; aMeshOnEntity->myCellsSize = 2*aMesh->myNbPoints; @@ -473,14 +471,14 @@ VISU_MedConvertor aMeshOnEntity->myNbCells = 0; aMeshOnEntity->myCellsSize = 0; for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){ - const EGeometrieElement& aMGeom = aGeom2SizeIter->first; + const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first; switch(aMGeom){ - case ePOLYGONE: { - PPolygoneInfo aPolygoneInfo = aMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom); + case MED::ePOLYGONE: { + MED::PPolygoneInfo aPolygoneInfo = aMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom); TInt aNbElem = aPolygoneInfo->GetNbElem(); - TElemNum aConn = aPolygoneInfo->GetConnectivite(); - TElemNum aIndex = aPolygoneInfo->GetIndex(); + MED::TElemNum aConn = aPolygoneInfo->GetConnectivite(); + MED::TElemNum aIndex = aPolygoneInfo->GetIndex(); TInt aNbIndex = aIndex.size(); TInt aNbConn = aConn.size(); @@ -506,11 +504,11 @@ VISU_MedConvertor } break; } - case ePOLYEDRE: { - PPolyedreInfo aPolyedreInfo = aMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom); + case MED::ePOLYEDRE: { + MED::PPolyedreInfo aPolyedreInfo = aMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom); TInt aNbElem = aPolyedreInfo->GetNbElem(); - TElemNum aConn = aPolyedreInfo->GetConnectivite(); - TElemNum aIndex = aPolyedreInfo->GetIndex(); + MED::TElemNum aConn = aPolyedreInfo->GetConnectivite(); + MED::TElemNum aIndex = aPolyedreInfo->GetIndex(); TInt aNbIndex = aIndex.size(); TInt aNbConn = aConn.size(); @@ -539,7 +537,7 @@ VISU_MedConvertor default: { vtkIdType aVGeom = MEDGeomToVTK(aMGeom); int aVNbNodes = VTKGeom2NbNodes(aVGeom); - PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom); + MED::PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom); TInt aNbElem = aCellInfo->GetNbElem(); aMeshOnEntity->myNbCells += aNbElem; aMeshOnEntity->myCellsSize += aNbElem*(aVNbNodes+1); @@ -566,12 +564,12 @@ VISU_MedConvertor TInt aNbFields = aMed->GetNbFields(); BEGMSG(MYDEBUG,"TField: aNbFields = "<GetPFieldInfo(aMeshInfo,iField); + MED::PFieldInfo aFieldInfo = aMed->GetPFieldInfo(aMeshInfo,iField); TInt aNbComp = aFieldInfo->GetNbComp(); - const string& aFieldName = aFieldInfo->GetName(); + const std::string& aFieldName = aFieldInfo->GetName(); MED::TGeom2Size aGeom2Size; - EEntiteMaillage aMEntity; + MED::EEntiteMaillage aMEntity; TInt aNbTimeStamps = aMed->GetNbTimeStamps(aFieldInfo, aEntityInfo, aMEntity, @@ -604,15 +602,15 @@ VISU_MedConvertor } for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){ - PTimeStampInfo aTimeStampInfo = aMed->GetPTimeStampInfo(aFieldInfo, - aMEntity, - aGeom2Size, - iTimeStamp); + MED::PTimeStampInfo aTimeStampInfo = aMed->GetPTimeStampInfo(aFieldInfo, + aMEntity, + aGeom2Size, + iTimeStamp); TFloat aDt = aTimeStampInfo->GetDt(); - const string& anUnitDt = aTimeStampInfo->GetUnitDt(); - PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStampInfo, - aMKey2Profile, - aKey2Gauss); + const std::string& anUnitDt = aTimeStampInfo->GetUnitDt(); + MED::PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStampInfo, + aMKey2Profile, + aKey2Gauss); TValField& aValField = aField->myValField; PMEDValForTime aValForTime = aValField[iTimeStamp](new TMEDValForTime()); aValForTime->myId = iTimeStamp; @@ -632,25 +630,25 @@ VISU_MedConvertor continue; - TFamilyGroup aFamilyGroup = GetFamilies(aMed,aMeshInfo); - TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,aElemGroup,aFamilyGroup); - TFamilyByEntity::const_iterator aFamilyByEntityIter = aFamilyByEntity.begin(); + MED::TFamilyGroup aFamilyGroup = MED::GetFamilies(aMed,aMeshInfo); + MED::TFamilyByEntity aFamilyByEntity = MED::GetFamiliesByEntity(aMed,aElemGroup,aFamilyGroup); + MED::TFamilyByEntity::const_iterator aFamilyByEntityIter = aFamilyByEntity.begin(); BEGMSG(MY_FAMILY_DEBUG,"TFamilyByEntity:\n"); for(; aFamilyByEntityIter != aFamilyByEntity.end(); aFamilyByEntityIter++){ - const EEntiteMaillage& aMEntity = aFamilyByEntityIter->first; - const TFamilyGroup& aFamilyGroup = aFamilyByEntityIter->second; + const MED::EEntiteMaillage& aMEntity = aFamilyByEntityIter->first; + const MED::TFamilyGroup& aFamilyGroup = aFamilyByEntityIter->second; TEntity aVEntity = MEDEntityToVTK(aMEntity); - VISU::PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity]; - VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap; + PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity]; + TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap; if(aFamilyGroup.empty()) continue; INITMSG(MY_FAMILY_DEBUG,"aMEntity = "<GetId() == 0) continue; @@ -682,22 +680,22 @@ VISU_MedConvertor } BEGMSG(MY_GROUP_DEBUG,"TGroup:\n"); - VISU::TGroupMap& aGroupMap = aMesh->myGroupMap; - TGroupInfo aGroupInfo = GetFamiliesByGroup(aFamilyGroup); - TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin(); - for(;aGroupInfoIter != aGroupInfo.end(); aGroupInfoIter++){ - const string& aGroupName = aGroupInfoIter->first; - const TFamilyGroup& aFamilyGroup = aGroupInfoIter->second; + TGroupMap& aGroupMap = aMesh->myGroupMap; + MED::TGroupInfo aGroupInfo = GetFamiliesByGroup(aFamilyGroup); + MED::TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin(); + for(; aGroupInfoIter != aGroupInfo.end(); aGroupInfoIter++){ + const std::string& aGroupName = aGroupInfoIter->first; + const MED::TFamilyGroup& aFamilyGroup = aGroupInfoIter->second; PMEDGroup aGroup(new TMEDGroup()); aGroup->myName = aGroupName; aGroup->myMeshName = aMesh->myName; INITMSG(MY_GROUP_DEBUG,"aGroup->myName = '"<myName<<"'\n"); - TFamilyGroup::const_iterator aFamilyIter = aFamilyGroup.begin(); + MED::TFamilyGroup::const_iterator aFamilyIter = aFamilyGroup.begin(); for(; aFamilyIter != aFamilyGroup.end(); aFamilyIter++){ - const PFamilyInfo& aFamilyInfo = *aFamilyIter; - const string& aFamilyName = aFamilyInfo->GetName(); + const MED::PFamilyInfo& aFamilyInfo = *aFamilyIter; + const std::string& aFamilyName = aFamilyInfo->GetName(); TEntity aVEntity = TEntity(-1); PMEDFamily aFamily; @@ -710,7 +708,7 @@ VISU_MedConvertor const TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap; TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin(); for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){ - const string& aName = aFamilyMapIter->first; + const std::string& aName = aFamilyMapIter->first; aFamily = aFamilyMapIter->second; if(aName == aFamilyName){ aVEntity = aFamily->myEntity; @@ -756,12 +754,12 @@ VISU_MedConvertor ::LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity, const string& theFamilyName) { - PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1()); - const string& aMeshName = theMeshOnEntity->myMeshName; - const VISU::TEntity& anEntity = theMeshOnEntity->myEntity; + MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1()); + const std::string& aMeshName = theMeshOnEntity->myMeshName; + const TEntity& anEntity = theMeshOnEntity->myEntity; PMeshImpl aMesh = myMeshMap[aMeshName]; int isPointsUpdated; - if(anEntity == VISU::NODE_ENTITY) + if(anEntity == NODE_ENTITY) isPointsUpdated = LoadPoints(aMed,aMesh,theFamilyName); else isPointsUpdated = LoadPoints(aMed,aMesh); @@ -777,14 +775,14 @@ VISU_MedConvertor ::LoadMeshOnGroup(VISU::PMeshImpl theMesh, const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet) { - PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1()); + MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1()); int isPointsUpdated = 0, isCellsOnEntityUpdated = 0; - VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin(); + TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin(); for(; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){ - const string& aFamilyName = aFamilyAndEntitySetIter->first; - const VISU::TEntity& anEntity = aFamilyAndEntitySetIter->second; - const VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity]; - if(anEntity == VISU::NODE_ENTITY){ + const std::string& aFamilyName = aFamilyAndEntitySetIter->first; + const TEntity& anEntity = aFamilyAndEntitySetIter->second; + const PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity]; + if(anEntity == NODE_ENTITY){ isPointsUpdated += LoadPoints(aMed,theMesh,aFamilyName); isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,theMesh,aMeshOnEntity); }else{ @@ -805,7 +803,7 @@ VISU_MedConvertor VISU::PFieldImpl theField, VISU::PValForTimeImpl theValForTime) { - PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1()); + MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1()); int isPointsUpdated = LoadPoints(aMed,theMesh); int isCellsOnEntityUpdated = LoadCellsOnEntity(aMed,theMesh,theMeshOnEntity); int isFieldUpdated = LoadField(aMed,theMesh,theMeshOnEntity,theField,theValForTime); @@ -823,8 +821,8 @@ VISU_MedConvertor { try{ //Check on existing family - VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY]; - aMeshOnEntity->myEntity = VISU::NODE_ENTITY; + PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY]; + aMeshOnEntity->myEntity = NODE_ENTITY; aMeshOnEntity->myMeshName = theMesh->myName; PMEDFamily aFamily = GetFamily(aMeshOnEntity,theFamilyName); @@ -839,7 +837,7 @@ VISU_MedConvertor "; theFamilyName = '"<GetPNodeInfo(theMesh->myMeshInfo); + MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo); TInt aNbElem = aNodeInfo->GetNbElem(); if(!theMesh->myIsMEDDone){ @@ -852,12 +850,12 @@ VISU_MedConvertor aCoords.GetName(iDim) = aNodeInfo->GetCoordName(iDim); for(int iElem = 0; iElem < aNbElem; iElem++){ - VISU::TCoordSlice aCoordSlice = aCoords.GetCoordSlice(iElem); + TCoordSlice aCoordSlice = aCoords.GetCoordSlice(iElem); for(int iDim = 0; iDim < aDim; iDim++) aCoordSlice[iDim] = aNodeInfo->GetNodeCoord(iElem,iDim); } - VISU::TCell2Connect& aConnForCellType = aMeshOnEntity->myGeom2Cell2Connect[VTK_VERTEX]; + TCell2Connect& aConnForCellType = aMeshOnEntity->myGeom2Cell2Connect[VTK_VERTEX]; aConnForCellType.resize(aNbElem); for (int iElem = 0; iElem < aNbElem; iElem++) aConnForCellType[iElem] = VISU::TConnect(1,iElem); @@ -868,7 +866,7 @@ VISU_MedConvertor if(aFamily){ if(!aFamily->myIsMEDDone){ if(aNbElem > 0){ - VISU::TSubMeshID& aSubMeshID = aFamily->myGeom2SubMeshID[VTK_VERTEX]; + TSubMeshID& aSubMeshID = aFamily->myGeom2SubMeshID[VTK_VERTEX]; for (int iElem = 0; iElem < aNbElem; iElem++) if(aNodeInfo->GetFamNum(iElem) == aFamily->myId) aSubMeshID.push_back(iElem); @@ -910,16 +908,16 @@ VISU_MedConvertor INITMSG(MYDEBUG,"LoadCellsOnEntity - theFamilyName = '"<GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom); + case MED::ePOLYGONE: { + MED::PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom); TInt aNbElem = aPolygoneInfo->GetNbElem(); if(!isCellsLoaded){ TCell2Connect& aCell2Connect = aGeom2Cell2Connect[aVGeom]; aCell2Connect.resize(aNbElem); - const TElemNum& aIndex = aPolygoneInfo->GetIndex(); - const TElemNum& aConnect = aPolygoneInfo->GetConnectivite(); + const MED::TElemNum& aIndex = aPolygoneInfo->GetIndex(); + const MED::TElemNum& aConnect = aPolygoneInfo->GetConnectivite(); - for (int iElem = 0; iElem < aNbElem; iElem++) { + for(int iElem = 0; iElem < aNbElem; iElem++) { TConnect& anArray = aCell2Connect[iElem]; int aNbConn = aPolygoneInfo->GetNbConn(iElem); anArray.resize(aNbConn); @@ -965,17 +963,17 @@ VISU_MedConvertor } break; } - case ePOLYEDRE: { - PPolyedreInfo aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom); + case MED::ePOLYEDRE: { + MED::PPolyedreInfo aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom); TInt aNbElem = aPolyedreInfo->GetNbElem(); if(!isCellsLoaded){ TCell2Connect& aCell2Connect = aGeom2Cell2Connect[aVGeom]; aCell2Connect.resize(aNbElem); - const TElemNum& aConnect = aPolyedreInfo->GetConnectivite(); - const TElemNum& aFaces = aPolyedreInfo->GetFaces(); - const TElemNum& aIndex = aPolyedreInfo->GetIndex(); + const MED::TElemNum& aConnect = aPolyedreInfo->GetConnectivite(); + const MED::TElemNum& aFaces = aPolyedreInfo->GetFaces(); + const MED::TElemNum& aIndex = aPolyedreInfo->GetIndex(); for(int iElem = 0; iElem < aNbElem; iElem++){ typedef set TConnectSet; @@ -1011,18 +1009,18 @@ VISU_MedConvertor default: { int aVNbNodes = VTKGeom2NbNodes(aVGeom); - PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom); + MED::PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom); TInt aNbElem = aCellInfo->GetNbElem(); if(!isCellsLoaded){ - VISU::TCell2Connect& aConnForCellType = aGeom2Cell2Connect[aVGeom]; + TCell2Connect& aConnForCellType = aGeom2Cell2Connect[aVGeom]; aConnForCellType.resize(aNbElem); int aMNbNodes = MEDGeom2NbNodes(aMGeom); vector aConnect(aMNbNodes); for (int iElem = 0; iElem < aNbElem; iElem++) { - VISU::TConnect& anArray = aConnForCellType[iElem]; + TConnect& anArray = aConnForCellType[iElem]; anArray.resize(aVNbNodes); if(anIsNodeNum){ @@ -1036,15 +1034,15 @@ VISU_MedConvertor } switch(aMGeom){ - case eTETRA4: - case eTETRA10: + case MED::eTETRA4: + case MED::eTETRA10: anArray[0] = aConnect[0]; anArray[1] = aConnect[1]; anArray[2] = aConnect[3]; anArray[3] = aConnect[2]; break; - case ePYRA5: - case ePYRA13: + case MED::ePYRA5: + case MED::ePYRA13: anArray[0] = aConnect[0]; anArray[1] = aConnect[3]; anArray[2] = aConnect[2]; @@ -1066,7 +1064,7 @@ VISU_MedConvertor } //Filling aFamily Geom2SubMeshID if(aFamily){ - VISU::TSubMeshID& aSubMeshID = aFamily->myGeom2SubMeshID[aVGeom]; + TSubMeshID& aSubMeshID = aFamily->myGeom2SubMeshID[aVGeom]; for(int iElem = 0; iElem < aNbElem; iElem++) if(aCellInfo->GetFamNum(iElem) == aFamily->myId) aSubMeshID.push_back(iElem); @@ -1099,8 +1097,8 @@ LoadProfile(MED::TTimeStampVal& theTimeStampVal, return; const TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile; - const TGeom2Profile& aGeom2Profile = theTimeStampVal.GetGeom2Profile(); - TGeom2Profile::const_iterator anIter = aGeom2Profile.begin(); + const MED::TGeom2Profile& aGeom2Profile = theTimeStampVal.GetGeom2Profile(); + MED::TGeom2Profile::const_iterator anIter = aGeom2Profile.begin(); for(; anIter != aGeom2Profile.end(); anIter++){ MED::PProfileInfo aProfileInfo = anIter->second; MED::EGeometrieElement aMGeom = anIter->first; @@ -1145,16 +1143,16 @@ LoadGaussMesh(const MED::PWrapper& theMed, if(aGaussMesh->myIsMEDDone) return; - const PMeshInfo& aMeshInfo = theMesh->myMeshInfo; - PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo); + const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo; + MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo); TEntity aVEntity = theMeshOnEntity.myEntity; - EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity); + MED::EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity); const TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh; - const TTimeStampInfo& aTimeStampInfo = theTimeStampVal.GetTimeStampInfo(); - const TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss(); - TGeom2Gauss::const_iterator anIter = aGeom2Gauss.begin(); + const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampVal.GetTimeStampInfo(); + const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss(); + MED::TGeom2Gauss::const_iterator anIter = aGeom2Gauss.begin(); for(; anIter != aGeom2Gauss.end(); anIter++){ MED::PGaussInfo aGaussInfo = anIter->second; MED::EGeometrieElement aMGeom = anIter->first; @@ -1198,10 +1196,10 @@ LoadGaussMesh(const MED::PWrapper& theMed, vtkIdType aNbCells = aNbElem*aNbGauss; aCoords.Init(aNbCells,aDim); for(TInt anElemId = 0, aNodeId = 0; anElemId < aNbElem; anElemId++){ - TCoordSliceArr aCoordSliceArr = aGaussCoord.GetCoordSliceArr(anElemId); + MED::TCoordSliceArr aCoordSliceArr = aGaussCoord.GetCoordSliceArr(anElemId); for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++, aNodeId++){ - VISU::TCoordSlice aSlice = aCoords.GetCoordSlice(aNodeId); MED::TCoordSlice aCoordSlice = aCoordSliceArr[aGaussId]; + TCoordSlice aSlice = aCoords.GetCoordSlice(aNodeId); for(TInt aDimId = 0; aDimId < aDim; aDimId++) aSlice[aDimId] = aCoordSlice[aDimId]; } @@ -1245,27 +1243,27 @@ VISU_MedConvertor //Main part of code const std::string& aMeshName = theMeshOnEntity->myMeshName; - const PMeshInfo& aMeshInfo = theMesh->myMeshInfo; - PFieldInfo aFieldInfo = theMed->GetPFieldInfo(aMeshInfo, - theField->myId); + const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo; + MED::PFieldInfo aFieldInfo = theMed->GetPFieldInfo(aMeshInfo, + theField->myId); MED::TGeom2Size aGeom2Size; - EEntiteMaillage aMEntity; + MED::EEntiteMaillage aMEntity; theMed->GetNbTimeStamps(aFieldInfo, theMesh->myEntityInfo, aMEntity, aGeom2Size); - PTimeStampInfo aTimeStampInfo = + MED::PTimeStampInfo aTimeStampInfo = theMed->GetPTimeStampInfo(aFieldInfo, aMEntity, aGeom2Size, theValForTime->myId); - TKey2Gauss aKey2Gauss = GetKey2Gauss(*theMed); - TMKey2Profile aMKey2Profile = GetMKey2Profile(*theMed); + MED::TKey2Gauss aKey2Gauss = GetKey2Gauss(*theMed); + MED::TMKey2Profile aMKey2Profile = GetMKey2Profile(*theMed); - PTimeStampVal aTimeStampVal = + MED::PTimeStampVal aTimeStampVal = theMed->GetPTimeStampVal(aTimeStampInfo, aMKey2Profile, aKey2Gauss); @@ -1283,7 +1281,7 @@ VISU_MedConvertor PMEDProfile aProfile = theValForTime->myProfile; TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile; - const TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss(); + const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss(); TInt aNbComp = theField->myNbComp; INITMSGA(MYDEBUG,0, @@ -1311,14 +1309,20 @@ VISU_MedConvertor "; aNbElem = "<myValForCells[aVGeom]; - aValForCellsWithType.resize(iNumElemEnd*theField->myNbComp); - for(int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) - for(int k = 0, kj = iNumElem*theField->myNbComp; k < theField->myNbComp; k++) - aValForCellsWithType[kj+k] = theArray[aIndexAndSize.first*theField->myNbComp+kj+k]; + + int aNbElem = aIndexAndSize.second; + int aStart = aIndexAndSize.first*aNbComp; + TMeshValue& aMeshValue = theValForTime->GetMeshValue(aVGeom); + aMeshValue.Init(aNbElem,aNbGauss,aNbComp); + for(int iElem = 0, anId = 0; iElem < aNbElem; iElem++, anId += aNbComp){ + TValueSliceArr aValueSliceArr = aMeshValue.GetGaussValueSliceArr(iElem); + for(int iGauss = 0; iGauss < aNbGauss; iGauss++){ + TValueSlice& aValueSlice = aValueSliceArr[iGauss]; + for(int iComp = 0; iComp < aNbComp; iComp++) + aValueSlice[iComp] = theArray[aStart+anId+iComp]; + } + } } } } @@ -1201,9 +1219,9 @@ VISU_MEDConvertor::LoadField(VISU::PCMesh theMesh, VISU::PCValForTime theValForTime) { //Check on loading already done - if(!theValForTime->myValForCells.empty()) + if(theValForTime->myIsCDone) return 0; - + SALOME_MED::FIELD_var aMEDField = theValForTime->myField; SALOME_MED::FIELDDOUBLE_ptr aFieldDouble = SALOME_MED::FIELDDOUBLE::_narrow(aMEDField); if(!aFieldDouble->_is_nil()){ diff --git a/src/VISU_I/VISU_CorbaMedConvertor.hxx b/src/VISU_I/VISU_CorbaMedConvertor.hxx index bbf41cef..7f119bed 100644 --- a/src/VISU_I/VISU_CorbaMedConvertor.hxx +++ b/src/VISU_I/VISU_CorbaMedConvertor.hxx @@ -89,7 +89,7 @@ namespace VISU //--------------------------------------------------------------- - struct TCValForTime: virtual TValForTimeImpl + struct TCValForTime: virtual TValForTimeImpl, virtual TIsCDone { SALOME_MED::FIELD_var myField; };