From: apo Date: Thu, 21 Jul 2005 10:08:19 +0000 (+0000) Subject: Introducing of Gauss Points SubMesh data structure X-Git-Tag: BR-D5-38-2003_D2005-12-09~161 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6c255198c4179aa75f1f60f91ea13dd403adc9ea;p=modules%2Fvisu.git Introducing of Gauss Points SubMesh data structure --- diff --git a/src/CONVERTOR/VISUConvertor.cxx b/src/CONVERTOR/VISUConvertor.cxx index 5bdeef6f..e43e8c0b 100644 --- a/src/CONVERTOR/VISUConvertor.cxx +++ b/src/CONVERTOR/VISUConvertor.cxx @@ -75,7 +75,8 @@ void parseFile(const char* theFileName) { } } } - //continue; + continue; + //Importing groups const VISU::TGroupMap& aGroupMap = aMesh->myGroupMap; VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin(); diff --git a/src/CONVERTOR/VISU_Convertor.hxx b/src/CONVERTOR/VISU_Convertor.hxx index 8cd141fc..31e38ff3 100644 --- a/src/CONVERTOR/VISU_Convertor.hxx +++ b/src/CONVERTOR/VISU_Convertor.hxx @@ -29,7 +29,6 @@ #include -#include #include #include #include @@ -90,6 +89,12 @@ namespace VISU{ typedef SharedPtr PMesh; typedef std::map TMeshMap; + struct TGaussSubMesh; + typedef SharedPtr PGaussSubMesh; + + struct TGaussMesh; + typedef SharedPtr PGaussMesh; + struct TSubProfile; typedef SharedPtr PSubProfile; @@ -114,6 +119,8 @@ namespace VISU{ struct TValForTime; typedef SharedPtr PValForTime; + typedef std::vector TNames; + //--------------------------------------------------------------- struct TBaseStructure @@ -122,7 +129,15 @@ namespace VISU{ {} }; - typedef std::vector TNames; + + //--------------------------------------------------------------- + struct TIntId: virtual TBaseStructure + { + int myId; + + TIntId(): myId(0) + {} + }; //--------------------------------------------------------------- @@ -160,18 +175,50 @@ namespace VISU{ bool operator()(const PSubProfile& theLeft, const PSubProfile& theRight) const; }; + typedef std::set TProfileKey; + typedef std::map TProfileMap; + + + //--------------------------------------------------------------- + struct TGauss: virtual TBaseStructure + {}; + + + //--------------------------------------------------------------- + struct TGaussSubMesh: virtual TBaseStructure + { + PSubProfile mySubProfile; + PGauss myGauss; + }; + + + //--------------------------------------------------------------- + struct TGaussMesh: virtual TBaseStructure + {}; + + + //--------------------------------------------------------------- + struct TGaussSubMeshLess + { + bool + operator()(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight) const; + }; + + typedef std::set TGaussKey; + typedef std::map TGaussMeshMap; //--------------------------------------------------------------- - typedef std::map TProfileMap; typedef std::map TFamilyMap; typedef std::map TFieldMap; struct TMeshOnEntity: virtual TBaseStructure { + TGaussMeshMap myGaussMeshMap; TProfileMap myProfileMap; + TFamilyMap myFamilyMap; TFieldMap myFieldMap; @@ -183,7 +230,7 @@ namespace VISU{ //--------------------------------------------------------------- typedef std::set TBindGroups; - struct TFamily: virtual TBaseStructure + struct TFamily: virtual TIntId { TBindGroups myGroups; std::string myName; @@ -206,7 +253,7 @@ namespace VISU{ //--------------------------------------------------------------- typedef std::map TValField; - struct TField: virtual TBaseStructure + struct TField: virtual TIntId { TEntity myEntity; std::string myName; @@ -221,16 +268,11 @@ namespace VISU{ }; - //--------------------------------------------------------------- - struct TGauss: virtual TBaseStructure - {}; - - //--------------------------------------------------------------- typedef std::pair TTime; typedef std::map TGaussMap; - struct TValForTime: virtual TBaseStructure + struct TValForTime: virtual TIntId { TEntity myEntity; std::string myMeshName; @@ -238,6 +280,7 @@ namespace VISU{ TTime myTime; PProfile myProfile; + PGaussMesh myGaussMesh; TGaussMap myGaussMap; }; diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index 53982f41..f1a7cc74 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -57,7 +57,7 @@ static float ERR_SIZE_CALC = 1.00; static int MYVTKDEBUG = 0; #ifdef _DEBUG_ -static int MYDEBUG = 0; +static int MYDEBUG = 1; static int MYDEBUGWITHFILES = 1; #else static int MYDEBUG = 0; @@ -93,6 +93,22 @@ namespace VISU } + bool + TGaussSubMeshLess:: + operator()(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight) const + { + PGaussImpl aLeft(theLeft->myGauss), aRight(theRight->myGauss); + + if(aLeft->myGeom != aRight->myGeom) + return aLeft->myGeom < aRight->myGeom; + + if(aLeft->myName != aRight->myName) + return aLeft->myName < aRight->myName; + + return TSubProfileLess()(theLeft->mySubProfile,theRight->mySubProfile); + } + + bool TSubProfileLess ::operator()(const PSubProfile& theLeft, const PSubProfile& theRight) const @@ -113,6 +129,11 @@ namespace VISU } + TGaussSubMeshImpl::TGaussSubMeshImpl(): + myStatus(eNone) + {} + + pair TMeshOnEntityImpl ::GetCellsDims(const string& theFamilyName) const @@ -137,7 +158,7 @@ namespace VISU TGaussMap::const_iterator anIter2 = myGaussMap.find(theGeom); if(anIter2 != myGaussMap.end()){ PGaussImpl aGauss = anIter2->second; - return aGauss->myNbPts; + return aGauss->myNbPoints; } return myNbGauss; } @@ -304,9 +325,11 @@ namespace vtkIdType iEnd = theMesh->myPointsCoord.size(); vtkIdType aNbPoints = iEnd / theMesh->myDim; aPoints->SetNumberOfPoints(aNbPoints); + INITMSG(MYDEBUG,"GetPoints - aNbPoints = "<> There is no elements on the family !!!"); - VISU::TGeom2SubMeshID::const_iterator aGeom2SubMeshIDIter = aGeom2SubMeshID.find(aVtkType); + VISU::TGeom2SubMeshID::const_iterator aGeom2SubMeshIDIter = aGeom2SubMeshID.find(aGeom); if(aGeom2SubMeshIDIter == aGeom2SubMeshID.end()) continue; @@ -382,7 +405,7 @@ namespace VISU::TSubMeshID::const_iterator aSubMeshIDIter = aSubMeshID.begin(); for(; aSubMeshIDIter != aSubMeshID.end(); aSubMeshIDIter++, i++){ PrintCells(i,aConnectivity,anArray[*aSubMeshIDIter]); - aCellTypesArray->SetValue(j++,(unsigned char)aVtkType); + aCellTypesArray->SetValue(j++,(unsigned char)aGeom); } } } @@ -407,6 +430,7 @@ namespace const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet) { //Calculate dimentions of the group + INITMSG(MYDEBUG,"GetCellsOnGroup\n"); int aNbCells = 0, aCellsSize = 0; VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin(); for(; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){ @@ -434,19 +458,22 @@ namespace VISU::TGeom2Cell2Connect::const_iterator aGeom2Cell2ConnectIter = aGeom2Cell2Connect.begin(); for(; aGeom2Cell2ConnectIter != aGeom2Cell2Connect.end(); aGeom2Cell2ConnectIter++){ const VISU::TCell2Connect& anArray = aGeom2Cell2ConnectIter->second; - int aVtkType = aGeom2Cell2ConnectIter->first; - MSG(MYDEBUG,"GetCellsOnGroup - aVtkType = "<> There is no elements on the family !!!"); - VISU::TGeom2SubMeshID::const_iterator aGeom2SubMeshIDIter = aGeom2SubMeshID.find(aVtkType); - if(aGeom2SubMeshIDIter == aGeom2SubMeshID.end()) continue; - const VISU::TSubMeshID& aSubMeshID = aGeom2SubMeshIDIter->second; - MSG(MYDEBUG,"GetCellsOnGroup - aSubMeshID.size() = "<SetValue(j++,(unsigned char)aVtkType); + + VISU::TGeom2SubMeshID::const_iterator aGeom2SubMeshIDIter = aGeom2SubMeshID.find(aGeom); + if(aGeom2SubMeshIDIter != aGeom2SubMeshID.end()){ + const VISU::TSubMeshID& aSubMeshID = aGeom2SubMeshIDIter->second; + INITMSG(MYDEBUG,"aSubMeshID.size() = "<SetValue(j++,(unsigned char)aGeom); + } } } } @@ -478,7 +505,7 @@ namespace const VISU::TValForCells& aValForCells = theValForTime->myValForCells; VISU::TValForCells::const_iterator anIter = aValForCells.begin(); - for(int k = 0; anIter != aValForCells.end(); anIter++) { + for(int aTupleId = 0; anIter != aValForCells.end(); anIter++) { int aGeom = anIter->first; const VISU::TValForCellsWithType& anArray = anIter->second; @@ -505,7 +532,7 @@ namespace }else aValue = anArray.at(aFirstId); - theFloatArray->SetTuple1(k++,aValue); + theFloatArray->SetTuple1(aTupleId++,aValue); } } break; @@ -522,7 +549,7 @@ namespace aValue[iComp] = anArray[aFirstId]; } - theFloatArray->SetTuple3(k++,aValue[0],aValue[1],0.0); + theFloatArray->SetTuple3(aTupleId++,aValue[0],aValue[1],0.0); } break; case 4: @@ -538,7 +565,7 @@ namespace aValue[iComp] = anArray[aFirstId]; } - theFloatArray->SetTuple3(k++,aValue[0],aValue[1],0.0); + theFloatArray->SetTuple3(aTupleId++,aValue[0],aValue[1],0.0); } break; default: @@ -555,7 +582,7 @@ namespace aValue[iComp] = anArray[aFirstId]; } - theFloatArray->SetTuple3(k++,aValue[0],aValue[1],aValue[2]); + theFloatArray->SetTuple3(aTupleId++,aValue[0],aValue[1],aValue[2]); } else EXCEPTION(runtime_error,"GetTimeStamp3 - There is no an algorithm for representation of the field !!!"); @@ -579,11 +606,9 @@ namespace const VISU::PFieldImpl theField, const VISU::PValForTimeImpl theValForTime) { - int aNumberOfTuples = theField->myDataSize/theField->myNbComp; + int aNbTuples = theField->myDataSize/theField->myNbComp; string aFieldName = GenerateFieldName(theField,theValForTime); - INITMSG(MYDEBUG,"GetTimeStamp2"<< - "; aNumberOfTuples = "<(aFindMeshOnGroup); PGroupImpl aGroup = boost::get<1>(aFindMeshOnGroup); const VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup->myFamilyAndEntitySet; + //Main part of code TVTKSource& aSource = aGroup->mySource; try{ @@ -740,14 +770,14 @@ GetCells(VISU::TVTKSource& theSource, { vtkIdType aNbCells = theSubProfile->myNbCells; vtkIdType aCellsSize = theSubProfile->myCellsSize; - vtkIdType aVGeom = theSubProfile->myGeom; - vtkIdType aNbNodes = VTKGeom2NbNodes(aVGeom); + vtkIdType aGeom = theSubProfile->myGeom; + vtkIdType aNbNodes = VTKGeom2NbNodes(aGeom); const TSubMeshID& aSubMeshID = theSubProfile->mySubMeshID; const TGeom2Cell2Connect& aGeom2Cell2Connect = theMeshOnEntity->myGeom2Cell2Connect; - TGeom2Cell2Connect::const_iterator aConnectIter = aGeom2Cell2Connect.find(aVGeom); + TGeom2Cell2Connect::const_iterator aConnectIter = aGeom2Cell2Connect.find(aGeom); if(aConnectIter == aGeom2Cell2Connect.end()) - EXCEPTION(runtime_error,"GetCells >> There is no elements for the GEOM("<> There is no elements for the GEOM("<second; @@ -762,7 +792,7 @@ GetCells(VISU::TVTKSource& theSource, for(vtkIdType anId = 0, aConnId = 0; anIter != aCell2Connect.end(); anIter++){ const TConnect& anArray = aCell2Connect[anId]; PrintCells(aConnId,aConnectivity,anArray); - aCellTypesArray->SetValue(anId,(unsigned char)aVGeom); + aCellTypesArray->SetValue(anId,(unsigned char)aGeom); aConnId += aNbNodes; anId++; } @@ -772,7 +802,7 @@ GetCells(VISU::TVTKSource& theSource, vtkIdType aSubId = *anIter; const TConnect& anArray = aCell2Connect[aSubId]; PrintCells(aConnId,aConnectivity,anArray); - aCellTypesArray->SetValue(anId,(unsigned char)aVGeom); + aCellTypesArray->SetValue(anId,(unsigned char)aGeom); aConnId += aNbNodes; anId++; } @@ -800,14 +830,14 @@ GetMeshOnSubProfile(PMeshImpl theMesh, PProfileImpl theProfile, PSubProfileImpl theSubProfile) { - INITMSG(MYDEBUG,"GetMeshOnSubProfile"<GetNumberOfPoints()<GetNumberOfCells()< PProfileImpl; + //--------------------------------------------------------------- + struct TGaussImpl: virtual TGauss + { + vtkIdType myGeom; + std::string myName; + + vtkIdType myNbPoints; + }; + typedef SharedPtr PGaussImpl; + + + //--------------------------------------------------------------- + struct TGaussSubMeshImpl: virtual TGaussSubMesh, virtual TSource + { + TGaussSubMeshImpl(); + + ESubMeshStatus myStatus; + }; + + + //--------------------------------------------------------------- + struct TGaussMeshImpl: virtual TGaussMesh + {}; + + //--------------------------------------------------------------- typedef std::vector TConnect; typedef std::vector TCell2Connect; @@ -121,7 +137,7 @@ namespace VISU //--------------------------------------------------------------- - struct TFamilyImpl: virtual TFamily, virtual TSource, virtual TIntId + struct TFamilyImpl: virtual TFamily, virtual TSource { TGeom2SubMeshID myGeom2SubMeshID; }; @@ -136,7 +152,7 @@ namespace VISU //--------------------------------------------------------------- - struct TFieldImpl: virtual TField, virtual TIntId + struct TFieldImpl: virtual TField { vtkIdType myDataSize; @@ -146,25 +162,18 @@ namespace VISU typedef SharedPtr PFieldImpl; - //--------------------------------------------------------------- - struct TGaussImpl: virtual TGauss - { - vtkIdType myNbPts; - }; - typedef SharedPtr PGaussImpl; - - //--------------------------------------------------------------- typedef std::vector TValForCellsWithType; typedef std::map TValForCells; - struct TValForTimeImpl: virtual TValForTime, virtual TSource, virtual TIntId + struct TValForTimeImpl: virtual TValForTime, virtual TSource { TValForCells myValForCells; + int myNbGauss; + int GetNbGauss(vtkIdType theGeom) const; - int myNbGauss; }; typedef SharedPtr PValForTimeImpl; diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index 3dde308d..38c82660 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -42,7 +42,7 @@ using namespace MED; using namespace VISU; #ifdef _DEBUG_ -static int MYDEBUG = 0; +static int MYDEBUG = 1; #else static int MYDEBUG = 0; #endif @@ -54,6 +54,7 @@ namespace{ using namespace VISU; + //--------------------------------------------------------------- int MEDGeom2NbNodes(MED::EGeometrieElement theMEDGeomType) { @@ -61,6 +62,7 @@ namespace{ } + //--------------------------------------------------------------- int MEDGeomToVTK(MED::EGeometrieElement theMEDGeomType) { @@ -87,6 +89,7 @@ namespace{ } + //--------------------------------------------------------------- MED::EGeometrieElement VTKGeomToMED(int theVTKGeomType) { @@ -106,6 +109,7 @@ namespace{ } + //--------------------------------------------------------------- TEntity MEDEntityToVTK(MED::EEntiteMaillage theMEDEntity) { @@ -119,6 +123,7 @@ namespace{ } + //--------------------------------------------------------------- MED::EEntiteMaillage VTKEntityToMED(TEntity theVTKEntity) { @@ -132,49 +137,137 @@ namespace{ } - TProfileKey - GetProfileKey(const MED::TTimeStampVal& theTimeStampVal, - const VISU::TMEDMeshOnEntity& theMeshOnEntity, - const MED::TGeom2Size& theGeom2Size) + //--------------------------------------------------------------- + PMEDSubProfile + CrSubProfile(MED::EGeometrieElement theMGeom, + const MED::TGeom2Size& theGeom2Size, + const MED::TGeom2Profile& theGeom2Profile) { - INITMSG(MYDEBUG,"GetProfileKey"<myGeom = aVGeom; + aSubProfile->myStatus = eAddAll; + + 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); + if(aProfileIter != theGeom2Profile.end()){ + PProfileInfo aProfileInfo = aProfileIter->second; + aSubProfile->myNbCells = aProfileInfo->myElemNum.size(); + aSubProfile->myName = aProfileInfo->GetName(); + aSubProfile->myStatus = eAddPart; + } + } + aSubProfile->myCellsSize = aSubProfile->myNbCells*aVNbNodes; - TProfileKey aProfileKey; + INITMSGA(MYDEBUG,0, + "- aVGeom = "<first; + EGeometrieElement aMGeom = anIter->first; + PMEDGaussSubMesh aGaussSubMesh(new TMEDGaussSubMesh()); + aGaussSubMesh->myStatus = eAddAll; + + PSubProfile aSubProfile = CrSubProfile(aMGeom,theGeom2Size,aGeom2Profile); + aGaussSubMesh->mySubProfile = aSubProfile; + + PMEDGauss aGauss(new TMEDGauss()); + aGaussSubMesh->myGauss = aGauss; + vtkIdType aVGeom = MEDGeomToVTK(aMGeom); vtkIdType aVNbNodes = VTKGeom2NbNodes(aVGeom); - - PMEDSubProfile aSubProfile(new TMEDSubProfile()); - aSubProfile->myGeom = aVGeom; - aSubProfile->myStatus = eAddAll; - aSubProfile->myNbCells = 0; - - MED::TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(aMGeom); + aGauss->myGeom = aVGeom; + + std::string aName; + TInt aNbGauss = 0; + + TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(aMGeom); if(aTimeStampIter == theGeom2Size.end()) - aSubProfile->myStatus = eRemoveAll; + aGaussSubMesh->myStatus = eRemoveAll; else{ - aSubProfile->myNbCells = aTimeStampIter->second; - MED::TGeom2Profile::const_iterator aProfileIter = aGeom2Profile.find(aMGeom); - if(aProfileIter != aGeom2Profile.end()){ - MED::PProfileInfo aProfileInfo = aProfileIter->second; - aSubProfile->myNbCells = aProfileInfo->myElemNum.size(); - aSubProfile->myName = aProfileInfo->GetName(); - aSubProfile->myStatus = eAddPart; + TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom); + TInt aNbCells = aTimeStampIter->second; + if(aGaussIter != aGeom2Gauss.end()){ + PGaussInfo aGaussInfo = aGaussIter->second; + + aName = aGaussInfo->GetName(); + aGauss->myName = aName; + + aNbGauss = aGaussInfo->GetNbGauss(); + aGauss->myNbPoints = aNbGauss; + + aGaussSubMesh->myNbCells = aNbCells*aNbGauss; + aGaussSubMesh->myCellsSize = aGaussSubMesh->myNbCells*2; + + aGaussSubMesh->myStatus = eAddPart; + }else{ + aGaussSubMesh->myNbCells = aNbCells; + aGaussSubMesh->myCellsSize = aGaussSubMesh->myNbCells*(aVNbNodes+1); } } - aSubProfile->myCellsSize = aSubProfile->myNbCells*aVNbNodes; - - INITMSG(MYDEBUG,"aVGeom = "<first; + PSubProfile aSubProfile = CrSubProfile(aMGeom,theGeom2Size,aGeom2Profile); aProfileKey.insert(aSubProfile); } @@ -182,6 +275,7 @@ namespace{ } + //--------------------------------------------------------------- void InitProfile(MED::TTimeStampVal& theTimeStampVal, VISU::TMEDValForTime& theValForTime, @@ -340,7 +434,8 @@ VISU_MedConvertor aMeshOnEntity->myCellsSize += aNbConnii; } - INITMSG(MYDEBUG,"aMGeom = "<myGroupMap; TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin(); @@ -506,7 +601,7 @@ VISU_MedConvertor } if(!aGroup->myFamilyAndEntitySet.empty() && aGroup->myNbCells > 0){ BEGMSG(MYDEBUG,"myNbCells = "<myNbCells<< - "; myCellsSize = "<myCellsSize<<"\n\n"); + "; myCellsSize = "<myCellsSize<<"\n"); aGroupMap.insert(VISU::TGroupMap::value_type(aGroupName,aGroup)); } } @@ -570,7 +665,11 @@ VISU_MedConvertor aValForTime->myNbGauss = aTimeStampInfo->GetNbGauss(); aValForTime->myTime = VISU::TTime(aDt,anUnitDt); INITMSG(MYDEBUG,"aDt = "<second; PMEDGauss aMEDGauss(new TMEDGauss()); aMEDGauss->myGaussInfo = aGaussInfo; - aMEDGauss->myNbPts = aGaussInfo->GetNbGauss(); + aMEDGauss->myNbPoints = aGaussInfo->GetNbGauss(); aGaussMap[MEDGeomToVTK(aMGeom)] = aMEDGauss; } } @@ -999,11 +1098,12 @@ VISU_MedConvertor const TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss(); TInt aNbComp = theField->myNbComp; - BEGMSG(MYDEBUG,"aMeshName = '"<