//---------------------------------------------------------------
typedef std::pair<double,std::string> TTime;
- typedef std::map<int,PGauss> TGaussMap;
struct TValForTime: virtual TIntId
{
PProfile myProfile;
PGaussMesh myGaussMesh;
- TGaussMap myGaussMap;
};
PFamily
static int MYVTKDEBUG = 0;
#ifdef _DEBUG_
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
static int MYDEBUGWITHFILES = 0;
#else
static int MYDEBUG = 0;
TSource::TSource():
myNbCells(0),
myCellsSize(0),
- myIsInitialized(false),
mySource(vtkUnstructuredGrid::New())
{
mySource->Delete();
//---------------------------------------------------------------
void
TPoints
- ::Init(vtkIdType theDim)
+ ::Init(vtkIdType theNbCells,
+ vtkIdType theDim)
{
myDim = theDim;
- }
-
- vtkIdType
- TPoints
- ::size() const
- {
- return myCoord.size()/myDim;
+ myNbCells = theNbCells;
+ myCoord.resize(theNbCells*theDim);
}
TCPointSlice
TPoints
- ::GetPointSlice(vtkIdType theElemId) const
+ ::GetPointSlice(vtkIdType theCellId) const
{
- return TCPointSlice(myCoord,std::slice(theElemId*myDim,myDim,1));
+ return TCPointSlice(myCoord,std::slice(theCellId*myDim,myDim,1));
}
TPointSlice
TPoints
- ::GetPointSlice(vtkIdType theElemId)
+ ::GetPointSlice(vtkIdType theCellId)
{
- return TPointSlice(myCoord,std::slice(theElemId*myDim,myDim,1));
+ return TPointSlice(myCoord,std::slice(theCellId*myDim,myDim,1));
}
//---------------------------------------------------------------
TMeshImpl::TMeshImpl():
myPoints(vtkPoints::New()),
- myIsInitialized(false),
myNbPoints(0)
{
myPoints->Delete();
//---------------------------------------------------------------
TProfileImpl::TProfileImpl():
myIsAll(true),
- myIsInitialized(false),
myAppendFilter(vtkAppendFilter::New())
{
myAppendFilter->Delete();
//---------------------------------------------------------------
TGaussMeshImpl
- ::TGaussMeshImpl():
- myIsInitialized(false)
+ ::TGaussMeshImpl()
{}
TValForTimeImpl
::GetNbGauss(vtkIdType theGeom) const
{
- TGaussMap::const_iterator anIter2 = myGaussMap.find(theGeom);
- if(anIter2 != myGaussMap.end()){
- PGaussImpl aGauss = anIter2->second;
+ PGaussMeshImpl aGaussMesh = myGaussMesh;
+ const TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
+ TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.find(theGeom);
+ if(anIter != aGeom2GaussSubMesh.end()){
+ PGaussSubMesh aGaussSubMesh = anIter->second;
+ PGaussImpl aGauss = aGaussSubMesh->myGauss;
return aGauss->myNbPoints;
}
return myNbGauss;
{
TVTKPoints& aPoints = theMesh->myPoints;
- if(!theMesh->myIsInitialized){
+ if(!theMesh->myIsVTKDone){
TCoordHelperPtr aCoordHelperPtr;
const VISU::TPointsCoord& anArray = theMesh->myPointsCoord;
{
aCoordHelperPtr->GetCoord(i,eY),
aCoordHelperPtr->GetCoord(i,eZ));
- theMesh->myIsInitialized = true;
+ theMesh->myIsVTKDone = true;
if(MYVTKDEBUG) aPoints->DebugOn();
}
bool *anIsInitialized;
if(aFamily){
aSource = aFamily->mySource;
- anIsInitialized = &(aFamily->myIsInitialized);
+ anIsInitialized = &(aFamily->myIsVTKDone);
}else{
aSource = aMeshOnEntity->mySource;
- anIsInitialized = &(aMeshOnEntity->myIsInitialized);
+ anIsInitialized = &(aMeshOnEntity->myIsVTKDone);
}
//Main part of code
//Main part of code
TVTKSource& aSource = aGroup->mySource;
try{
- if(!aGroup->myIsInitialized){
+ if(!aGroup->myIsVTKDone){
LoadMeshOnGroup(aMesh,aFamilyAndEntitySet);
GetPoints(aSource,aMesh);
GetCellsOnGroup(aSource,aMesh,aFamilyAndEntitySet);
- aGroup->myIsInitialized = true;
+ aGroup->myIsVTKDone = true;
if(MYDEBUGWITHFILES){
string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
INITMSG(MYDEBUG,"GetMeshOnSubProfile - aGeom = "<<theSubProfile->myGeom<<endl);
TVTKSource& aSource = theSubProfile->mySource;
- if(theSubProfile->myIsInitialized)
+ if(theSubProfile->myIsVTKDone)
return;
GetPoints(aSource,theMesh);
GetCells(aSource,theSubProfile,theMeshOnEntity);
BEGMSG(MYDEBUG,"GetNumberOfCells - "<<aSource->GetNumberOfCells()<<endl);
- theSubProfile->myIsInitialized = true;
+ theSubProfile->myIsVTKDone = true;
}
PMeshOnEntityImpl theMeshOnEntity,
PProfileImpl theProfile)
{
- if(theProfile->myIsInitialized)
+ if(theProfile->myIsVTKDone)
return;
TVTKAppendFilter& anAppendFilter = theProfile->myAppendFilter;
}
}
anAppendFilter->Update(); // Fix on VTK
- theProfile->myIsInitialized = true;
+ theProfile->myIsVTKDone = true;
}
#ifndef _DEBUG_
try{
#endif
- if(!aValForTime->myIsInitialized){
+ if(!aValForTime->myIsVTKDone){
LoadFieldOnMesh(aMesh,aMeshOnEntity,aField,aValForTime);
try{
aSource->ShallowCopy(anAppendFilter->GetOutput());
GetTimeStamp2(aSource,aField,aValForTime);
- aValForTime->myIsInitialized = true;
+ aValForTime->myIsVTKDone = true;
if(MYDEBUGWITHFILES){
string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
typedef float TCoord;
//---------------------------------------------------------------
- struct TSource: virtual TBaseStructure
+ struct TIsVTKDone: virtual TBaseStructure
+ {
+ bool myIsVTKDone;
+ TIsVTKDone():
+ myIsVTKDone(false)
+ {}
+ };
+
+
+ //---------------------------------------------------------------
+ struct TSource: virtual TIsVTKDone
{
TSource();
vtkIdType myCellsSize;
TVTKSource mySource;
- bool myIsInitialized;
};
struct TPoints: virtual TBaseStructure
{
vtkIdType myDim;
+ vtkIdType myNbCells;
+
TPointsCoord myCoord;
public:
TCPointSlice
- GetPointSlice(vtkIdType theElemId) const;
+ GetPointSlice(vtkIdType theCellId) const;
TPointSlice
- GetPointSlice(vtkIdType theElemId);
+ GetPointSlice(vtkIdType theCellId);
void
- Init(vtkIdType theDim);
+ Init(vtkIdType theNbCells,
+ vtkIdType theDim);
+
+ vtkIdType
+ GetNbCells() const { return myNbCells; }
+
+ vtkIdType
+ GetDim() const { return myDim; }
vtkIdType
- size() const;
+ size() const { return GetNbCells(); }
};
//---------------------------------------------------------------
- struct TMeshImpl: virtual TMesh
+ struct TMeshImpl: virtual TMesh, virtual TIsVTKDone
{
TPointsCoord myPointsCoord;
TPointsDim myPointsDim;
TVTKPoints myPoints;
- bool myIsInitialized;
vtkIdType myNbPoints;
TMeshImpl();
//---------------------------------------------------------------
typedef std::map<vtkIdType,PSubProfile> TGeom2SubProfile;
- struct TProfileImpl: virtual TProfile
+ struct TProfileImpl: virtual TProfile, virtual TIsVTKDone
{
TProfileImpl();
vtkIdType myCellsSize;
bool myIsAll;
- bool myIsInitialized;
TVTKAppendFilter myAppendFilter;
TGeom2SubProfile myGeom2SubProfile;
};
TPoints myPoints;
ESubMeshStatus myStatus;
};
+ typedef SharedPtr<TGaussSubMeshImpl> PGaussSubMeshImpl;
//---------------------------------------------------------------
typedef std::map<vtkIdType,PGaussSubMesh> TGeom2GaussSubMesh;
- struct TGaussMeshImpl: virtual TGaussMesh
+ struct TGaussMeshImpl: virtual TGaussMesh, virtual TIsVTKDone
{
TGaussMeshImpl();
- bool myIsInitialized;
TGeom2GaussSubMesh myGeom2GaussSubMesh;
};
+ typedef SharedPtr<TGaussMeshImpl> PGaussMeshImpl;
//---------------------------------------------------------------
#endif
-namespace{
+namespace
+{
using namespace MED;
using namespace VISU;
PMEDGauss aGauss(new TMEDGauss());
aGaussSubMesh->myGauss = aGauss;
-
aGauss->myGeom = aVGeom;
std::string aName;
aGaussSubMesh->myNbCells = aNbCells*aNbGauss;
aGaussSubMesh->myCellsSize = aGaussSubMesh->myNbCells*2;
- }else{
- aGaussSubMesh->myNbCells = aNbCells;
- aGaussSubMesh->myCellsSize = aGaussSubMesh->myNbCells*(aVNbNodes+1);
+
+ INITMSGA(MYDEBUG,0,
+ "- aVGeom = "<<aVGeom<<
+ "; aName = '"<<aName<<"'"<<
+ "; aNbGauss = "<<aNbGauss<<
+ "; aStatus = "<<aGaussSubMesh->myStatus<<
+ "; aNbCells = "<<aGaussSubMesh->myNbCells<<
+ "; aCellsSize = "<<aGaussSubMesh->myCellsSize<<
+ endl);
+
+ aGaussKey.insert(aGaussSubMesh);
}
}
-
- INITMSGA(MYDEBUG,0,
- "- aVGeom = "<<aVGeom<<
- "; aName = '"<<aName<<"'"<<
- "; aNbGauss = "<<aNbGauss<<
- "; aStatus = "<<aGaussSubMesh->myStatus<<
- "; aNbCells = "<<aGaussSubMesh->myNbCells<<
- "; aCellsSize = "<<aGaussSubMesh->myCellsSize<<
- endl);
-
- aGaussKey.insert(aGaussSubMesh);
}
return aGaussKey;
aMeshOnEntity,
aGeom2Size,
aValForTime);
-
- TGaussMap& aGaussMap = aValForTime->myGaussMap;
- const TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss();
- TGeom2Gauss::const_iterator anIter = aGeom2Gauss.begin();
- for(; anIter != aGeom2Gauss.end(); anIter++){
- EGeometrieElement aMGeom = anIter->first;
- PGaussInfo aGaussInfo = anIter->second;
- PMEDGauss aMEDGauss(new TMEDGauss());
- aMEDGauss->myGaussInfo = aGaussInfo;
- aMEDGauss->myNbPoints = aGaussInfo->GetNbGauss();
- aGaussMap[MEDGeomToVTK(aMGeom)] = aMEDGauss;
- }
}
}
INITMSG(MYDEBUG,"LoadProfile"<<endl);
PMEDProfile aProfile = theValForTime.myProfile;
- if(aProfile->myIsInitialized)
+ if(aProfile->myIsMEDDone)
return;
const TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
endl);
}
}
+
+ aProfile->myIsMEDDone = true;
}
INITMSG(MYDEBUG,"LoadGaussMesh"<<endl);
PMEDGaussMesh aGaussMesh = theValForTime.myGaussMesh;
- if(aGaussMesh->myIsInitialized)
+ if(aGaussMesh->myIsMEDDone)
return;
const PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
aNodeInfo,
aGaussCoord);
- TInt aSize = aGaussCoord.size();
- if(aSize){
+ if(TInt aNbGauss = aGaussCoord.GetNbGauss()){
TPoints& aPoints = aGaussSubMesh->myPoints;
- }
+ TInt aNbElem = aGaussCoord.GetNbElem();
+ TInt aDim = aGaussCoord.GetDim();
+ vtkIdType aNbCells = aNbElem*aNbGauss;
+ aPoints.Init(aNbCells,aDim);
+ for(TInt anElemId = 0, aCellId = 0; anElemId < aNbElem; anElemId++){
+ TCoordSliceArr aCoordSliceArr = aGaussCoord.GetCoordSliceArr(anElemId);
+ for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++, aCellId++){
+ TPointSlice aPointSlice = aPoints.GetPointSlice(aCellId);
+ TCoordSlice aCoordSlice = aCoordSliceArr[aGaussId];
+ for(TInt aDimId = 0; aDimId < aDim; aDimId++)
+ aPointSlice[aDimId] = aCoordSlice[aDimId];
+ }
+ }
- INITMSG(MYDEBUG,
- "- aVGeom = "<<aVGeom<<
- "; aStatus = "<<aGaussSubMesh->myStatus<<
- "; aNbCells = "<<aGaussCoord.size()<<
- endl);
-
+ INITMSG(MYDEBUG,
+ "- aVGeom = "<<aVGeom<<
+ "; aName = '"<<aGaussInfo->GetName()<<"'"<<
+ "; aStatus = "<<aGaussSubMesh->myStatus<<
+ "; aNbCells = "<<aNbCells<<
+ endl);
+ }
}else{
INITMSG(MYDEBUG,
}
}
}
+
+ aGaussMesh->myIsMEDDone = true;
}
INITMSG(MYDEBUG,"LoadField"<<endl);
//Check on loading already done
- if(!theValForTime->myValForCells.empty())
+ if(theValForTime->myIsMEDDone)
return 0;
//Main part of code
}
}
+ theValForTime->myIsMEDDone = true;
+
return 1;
}
namespace VISU{
- struct TMEDMesh: TMeshImpl
+ //---------------------------------------------------------------
+ struct TIsMEDDone: virtual TBaseStructure
+ {
+ bool myIsMEDDone;
+ TIsMEDDone():
+ myIsMEDDone(false)
+ {}
+ };
+
+
+ //---------------------------------------------------------------
+ struct TMEDMesh: virtual TMeshImpl
{
MED::PMeshInfo myMeshInfo;
MED::TEntityInfo myEntityInfo;
//---------------------------------------------------------------
- struct TMEDSubProfile: TSubProfileImpl
+ struct TMEDSubProfile: virtual TSubProfileImpl
{
MED::PProfileInfo myProfileInfo;
};
//---------------------------------------------------------------
- struct TMEDProfile: TProfileImpl
+ struct TMEDProfile: virtual TProfileImpl, virtual TIsMEDDone
{};
typedef SharedPtr<TMEDProfile> PMEDProfile;
//---------------------------------------------------------------
- struct TMEDGauss: TGaussImpl
+ struct TMEDGauss: virtual TGaussImpl
{
MED::PGaussInfo myGaussInfo;
};
//---------------------------------------------------------------
- struct TMEDGaussMesh: virtual TGaussMeshImpl
+ struct TMEDGaussMesh: virtual TGaussMeshImpl, virtual TIsMEDDone
{};
typedef SharedPtr<TMEDGaussMesh> PMEDGaussMesh;
//---------------------------------------------------------------
- struct TMEDMeshOnEntity: TMeshOnEntityImpl
+ struct TMEDMeshOnEntity: virtual TMeshOnEntityImpl
{
MED::TGeom2Size myGeom2Size;
};
//---------------------------------------------------------------
- struct TMEDFamily: TFamilyImpl
+ struct TMEDFamily: virtual TFamilyImpl
{};
typedef SharedPtr<TMEDFamily> PMEDFamily;
//---------------------------------------------------------------
- struct TMEDGroup: TGroupImpl
+ struct TMEDGroup: virtual TGroupImpl
{};
typedef SharedPtr<TMEDGroup> PMEDGroup;
//---------------------------------------------------------------
- struct TMEDField: TFieldImpl
+ struct TMEDField: virtual TFieldImpl
{};
typedef SharedPtr<TMEDField> PMEDField;
//---------------------------------------------------------------
- struct TMEDValForTime: TValForTimeImpl
+ struct TMEDValForTime: virtual TValForTimeImpl, virtual TIsMEDDone
{};
typedef SharedPtr<TMEDValForTime> PMEDValForTime;
}
-class VISU_MedConvertor: public VISU_Convertor_impl{
+class VISU_MedConvertor: public VISU_Convertor_impl
+{
VISU_MedConvertor();
VISU_MedConvertor(const VISU_MedConvertor&);
+
public:
- VISU_MedConvertor(const std::string& theFileName) ;
- virtual VISU_Convertor* Build() ;
-protected:
- QFileInfo myFileInfo;
+ VISU_MedConvertor(const std::string& theFileName);
- virtual int LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity,
- const std::string& theFamilyName = "");
+ virtual
+ VISU_Convertor*
+ Build();
- virtual int LoadMeshOnGroup(VISU::PMeshImpl theMesh,
- const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet);
+protected:
+ QFileInfo myFileInfo;
- virtual int LoadFieldOnMesh(VISU::PMeshImpl theMesh,
- VISU::PMeshOnEntityImpl theMeshOnEntity,
- VISU::PFieldImpl theField,
- VISU::PValForTimeImpl theValForTime);
+ virtual
+ int
+ LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity,
+ const std::string& theFamilyName = "");
+
+ virtual
+ int
+ LoadMeshOnGroup(VISU::PMeshImpl theMesh,
+ const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet);
+
+ virtual
+ int
+ LoadFieldOnMesh(VISU::PMeshImpl theMesh,
+ VISU::PMeshOnEntityImpl theMeshOnEntity,
+ VISU::PFieldImpl theField,
+ VISU::PValForTimeImpl theValForTime);
+
+ int
+ LoadPoints(const MED::PWrapper& theMed,
+ VISU::PMEDMesh theMesh,
+ const std::string& theFamilyName = "");
- int LoadPoints(const MED::PWrapper& theMed,
- VISU::PMEDMesh theMesh,
- const std::string& theFamilyName = "");
-
- int LoadCellsOnEntity(const MED::PWrapper& theMed,
- VISU::PMEDMesh theMesh,
- VISU::PMEDMeshOnEntity theMeshOnEntity,
- const std::string& theFamilyName = "");
+ int
+ LoadCellsOnEntity(const MED::PWrapper& theMed,
+ VISU::PMEDMesh theMesh,
+ VISU::PMEDMeshOnEntity theMeshOnEntity,
+ const std::string& theFamilyName = "");
- int LoadField(const MED::PWrapper& theMed,
- VISU::PMEDMesh theMesh,
- VISU::PMEDMeshOnEntity theMeshOnEntity,
- VISU::PMEDField theField,
- VISU::PMEDValForTime theValForTime);
+ int
+ LoadField(const MED::PWrapper& theMed,
+ VISU::PMEDMesh theMesh,
+ VISU::PMEDMeshOnEntity theMeshOnEntity,
+ VISU::PMEDField theField,
+ VISU::PMEDValForTime theValForTime);
};