static int MYVTKDEBUG = 0;
#ifdef _DEBUG_
-static int MYDEBUG = 1;
-static int MYDEBUGWITHFILES = 1;
+static int MYDEBUG = 0;
+static int MYDEBUGWITHFILES = 0;
#else
static int MYDEBUG = 0;
static int MYDEBUGWITHFILES = 0;
namespace VISU
{
-
+ //---------------------------------------------------------------
TSource::TSource():
myNbCells(0),
myCellsSize(0),
}
+ //---------------------------------------------------------------
TMeshImpl::TMeshImpl():
myPoints(vtkPoints::New()),
myIsInitialized(false),
myPoints->Delete();
}
+
+ //---------------------------------------------------------------
TSubProfileImpl::TSubProfileImpl():
myStatus(eNone)
{
}
- 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
}
+ //---------------------------------------------------------------
TProfileImpl::TProfileImpl():
myIsAll(true),
myIsInitialized(false),
}
+ //---------------------------------------------------------------
TGaussSubMeshImpl::TGaussSubMeshImpl():
myStatus(eNone)
{}
+ //---------------------------------------------------------------
+ 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);
+ }
+
+
+ //---------------------------------------------------------------
+ TGaussMeshImpl
+ ::TGaussMeshImpl():
+ myIsInitialized(false)
+ {}
+
+
+ //---------------------------------------------------------------
pair<int,int>
TMeshOnEntityImpl
::GetCellsDims(const string& theFamilyName) const
}
+ //---------------------------------------------------------------
int
TValForTimeImpl
::GetNbGauss(vtkIdType theGeom) const
}
+ //---------------------------------------------------------------
vtkIdType
VTKGeom2NbNodes(vtkIdType theGeom)
{
namespace
{
+ //---------------------------------------------------------------
template<class T>
std::string
dtos(const std::string& fmt, T val)
return aString.latin1();
}
+
+ //---------------------------------------------------------------
enum ECoordName{eX, eY, eZ, eNone};
typedef VISU::TCoord (*TGetCoord)(const VISU::TMeshImpl::TPointsCoord&, int);
}
+ //---------------------------------------------------------------
+ TProfileKey
+ GetProfileKey(const MED::TTimeStampVal& theTimeStampVal,
+ const VISU::TMEDMeshOnEntity& theMeshOnEntity,
+ const MED::TGeom2Size& theGeom2Size)
+ {
+ INITMSG(MYDEBUG,"GetProfileKey"<<endl);
+
+ TProfileKey aProfileKey;
+ const TGeom2Profile& aGeom2Profile = theTimeStampVal.GetGeom2Profile();
+
+ const TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size;
+ TGeom2Size::const_iterator anIter = aGeom2Size.begin();
+ for(; anIter != aGeom2Size.end(); anIter++){
+ EGeometrieElement aMGeom = anIter->first;
+ PSubProfile aSubProfile = CrSubProfile(aMGeom,theGeom2Size,aGeom2Profile);
+ aProfileKey.insert(aSubProfile);
+ }
+
+ return aProfileKey;
+ }
+
+
+ //---------------------------------------------------------------
+ void
+ InitProfile(MED::TTimeStampVal& theTimeStampVal,
+ VISU::TMEDMeshOnEntity& theMeshOnEntity,
+ const MED::TGeom2Size& theGeom2Size,
+ VISU::TMEDValForTime& theValForTime)
+ {
+ INITMSG(MYDEBUG,"InitProfile"<<endl);
+
+ TProfileMap& aProfileMap = theMeshOnEntity.myProfileMap;
+
+ TProfileKey aProfileKey = GetProfileKey(theTimeStampVal,
+ theMeshOnEntity,
+ theGeom2Size);
+
+ TProfileMap::const_iterator anIter = aProfileMap.find(aProfileKey);
+ if(anIter != aProfileMap.end()){
+ theValForTime.myProfile = anIter->second;
+ }else{
+ PMEDProfile aProfile(new TMEDProfile());
+ TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+
+ TProfileKey::const_iterator anIter = aProfileKey.begin();
+ for(; anIter != aProfileKey.end(); anIter++){
+ PMEDSubProfile aSubProfile(*anIter);
+
+ if(aProfile->myIsAll && aSubProfile->myStatus != eAddAll)
+ aProfile->myIsAll = false;
+
+ vtkIdType aVGeom = aSubProfile->myGeom;
+ aGeom2SubProfile[aVGeom] = aSubProfile;
+ }
+ aProfileMap[aProfileKey] = aProfile;
+ theValForTime.myProfile = aProfile;
+ }
+ }
+
+
//---------------------------------------------------------------
TGaussKey
GetGaussKey(const MED::TTimeStampVal& theTimeStampVal,
const VISU::TMEDMeshOnEntity& theMeshOnEntity,
- const MED::TGeom2Size& theGeom2Size)
+ const MED::TGeom2Size& theGeom2Size,
+ VISU::TMEDValForTime& theValForTime)
{
INITMSG(MYDEBUG,"GetGaussKey"<<endl);
+ PMEDProfile aProfile = theValForTime.myProfile;
+ TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+
TGaussKey aGaussKey;
const TGeom2Profile& aGeom2Profile = theTimeStampVal.GetGeom2Profile();
const TTimeStampInfo& aTimeStampInfo = theTimeStampVal.GetTimeStampInfo();
const TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
+
const TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size;
TGeom2Size::const_iterator anIter = aGeom2Size.begin();
for(; anIter != aGeom2Size.end(); anIter++){
EGeometrieElement aMGeom = anIter->first;
+ vtkIdType aVGeom = MEDGeomToVTK(aMGeom);
+ vtkIdType aVNbNodes = VTKGeom2NbNodes(aVGeom);
+
PMEDGaussSubMesh aGaussSubMesh(new TMEDGaussSubMesh());
aGaussSubMesh->myStatus = eAddAll;
- PSubProfile aSubProfile = CrSubProfile(aMGeom,theGeom2Size,aGeom2Profile);
- aGaussSubMesh->mySubProfile = aSubProfile;
+ TGeom2SubProfile::iterator anIter2 = aGeom2SubProfile.find(aVGeom);
+ if(anIter2 == aGeom2SubProfile.end()){
+ INITMSG(MYDEBUG,"anIter2 == aGeom2SubProfile.end!!"<<endl);
+ continue;
+ }
+
+ aGaussSubMesh->mySubProfile = anIter2->second;
PMEDGauss aGauss(new TMEDGauss());
aGaussSubMesh->myGauss = aGauss;
- vtkIdType aVGeom = MEDGeomToVTK(aMGeom);
- vtkIdType aVNbNodes = VTKGeom2NbNodes(aVGeom);
aGauss->myGeom = aVGeom;
std::string aName;
}
- //---------------------------------------------------------------
- TProfileKey
- GetProfileKey(const MED::TTimeStampVal& theTimeStampVal,
- const VISU::TMEDMeshOnEntity& theMeshOnEntity,
- const MED::TGeom2Size& theGeom2Size)
- {
- INITMSG(MYDEBUG,"GetProfileKey"<<endl);
-
- TProfileKey aProfileKey;
- const TGeom2Profile& aGeom2Profile = theTimeStampVal.GetGeom2Profile();
-
- const TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size;
- TGeom2Size::const_iterator anIter = aGeom2Size.begin();
- for(; anIter != aGeom2Size.end(); anIter++){
- EGeometrieElement aMGeom = anIter->first;
- PSubProfile aSubProfile = CrSubProfile(aMGeom,theGeom2Size,aGeom2Profile);
- aProfileKey.insert(aSubProfile);
- }
-
- return aProfileKey;
- }
-
-
//---------------------------------------------------------------
void
- InitProfile(MED::TTimeStampVal& theTimeStampVal,
- VISU::TMEDValForTime& theValForTime,
- VISU::TMEDMeshOnEntity& theMeshOnEntity,
- const MED::TGeom2Size& theGeom2Size)
+ InitGaussMesh(MED::TTimeStampVal& theTimeStampVal,
+ VISU::TMEDMeshOnEntity& theMeshOnEntity,
+ const MED::TGeom2Size& theGeom2Size,
+ VISU::TMEDValForTime& theValForTime)
{
- INITMSG(MYDEBUG,"InitProfile"<<endl);
+ INITMSG(MYDEBUG,"InitGaussMesh"<<endl);
- TProfileMap& aProfileMap = theMeshOnEntity.myProfileMap;
+ TGaussMeshMap& aGaussMeshMap = theMeshOnEntity.myGaussMeshMap;
- TProfileKey aProfileKey = GetProfileKey(theTimeStampVal,
- theMeshOnEntity,
- theGeom2Size);
-
- TProfileMap::const_iterator anIter = aProfileMap.find(aProfileKey);
- if(anIter != aProfileMap.end()){
- theValForTime.myProfile = anIter->second;
+ TGaussKey aGaussKey = GetGaussKey(theTimeStampVal,
+ theMeshOnEntity,
+ theGeom2Size,
+ theValForTime);
+
+ TGaussMeshMap::const_iterator anIter = aGaussMeshMap.find(aGaussKey);
+ if(anIter != aGaussMeshMap.end()){
+ theValForTime.myGaussMesh = anIter->second;
}else{
- PMEDProfile aProfile(new TMEDProfile());
- TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+ PMEDGaussMesh aGaussMesh(new TMEDGaussMesh());
+ TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
- TProfileKey::const_iterator anIter = aProfileKey.begin();
- for(; anIter != aProfileKey.end(); anIter++){
- PMEDSubProfile aSubProfile(*anIter);
-
- if(aProfile->myIsAll && aSubProfile->myStatus != eAddAll)
- aProfile->myIsAll = false;
-
- vtkIdType aVGeom = aSubProfile->myGeom;
- aGeom2SubProfile[aVGeom] = aSubProfile;
+ TGaussKey::const_iterator anIter = aGaussKey.begin();
+ for(; anIter != aGaussKey.end(); anIter++){
+ PMEDGaussSubMesh aGaussSubMesh(*anIter);
+ PMEDGauss aGauss = aGaussSubMesh->myGauss;
+ vtkIdType aVGeom = aGauss->myGeom;
+ aGeom2GaussSubMesh[aVGeom] = aGaussSubMesh;
}
- aProfileMap[aProfileKey] = aProfile;
- theValForTime.myProfile = aProfile;
+ aGaussMeshMap[aGaussKey] = aGaussMesh;
+ theValForTime.myGaussMesh = aGaussMesh;
}
}
+
+ //---------------------------------------------------------------
+ void
+ InitGaussProfile(MED::TTimeStampVal& theTimeStampVal,
+ VISU::TMEDMeshOnEntity& theMeshOnEntity,
+ const MED::TGeom2Size& theGeom2Size,
+ VISU::TMEDValForTime& theValForTime)
+ {
+ // The order of the function calls is important
+ InitProfile(theTimeStampVal,theMeshOnEntity,theGeom2Size,theValForTime);
+ InitGaussMesh(theTimeStampVal,theMeshOnEntity,theGeom2Size,theValForTime);
+ }
}
+
+//---------------------------------------------------------------
extern "C"
VISU_Convertor*
CreateConvertor(const string& theFileName)
myName = myFileInfo.baseName().latin1();
}
+
+//---------------------------------------------------------------
VISU_Convertor*
VISU_MedConvertor
::Build()
aValForTime->myTime = VISU::TTime(aDt,anUnitDt);
INITMSG(MYDEBUG,"aDt = "<<aDt<<", "<<anUnitDt<<"\n");
- GetGaussKey(aTimeStampVal,
- aMeshOnEntity,
- aGeom2Size);
-
- InitProfile(aTimeStampVal,
- aValForTime,
- aMeshOnEntity,
- aGeom2Size);
+ InitGaussProfile(aTimeStampVal,
+ aMeshOnEntity,
+ aGeom2Size,
+ aValForTime);
TGaussMap& aGaussMap = aValForTime->myGaussMap;
const TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss();
return this;
}
+
+//---------------------------------------------------------------
int
VISU_MedConvertor
::LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity,
}
+//---------------------------------------------------------------
int
VISU_MedConvertor
::LoadMeshOnGroup(VISU::PMeshImpl theMesh,
return (isPointsUpdated || isCellsOnEntityUpdated);
}
+
+//---------------------------------------------------------------
int
VISU_MedConvertor
::LoadFieldOnMesh(VISU::PMeshImpl theMesh,
}
+//---------------------------------------------------------------
int
VISU_MedConvertor
::LoadPoints(const MED::PWrapper& theMed,
}
+//---------------------------------------------------------------
int
VISU_MedConvertor
::LoadCellsOnEntity(const MED::PWrapper& theMed,
}
+//---------------------------------------------------------------
void
LoadProfile(MED::TTimeStampVal& theTimeStampVal,
VISU::TMEDValForTime& theValForTime,
PMEDSubProfile aSubProfile = anIter2->second;
aSubProfile->mySubMeshID = aProfileInfo->myElemNum;
- INITMSG(MYDEBUG,"aVGeom = "<<aVGeom<<
+ INITMSG(MYDEBUG,
+ "- aVGeom = "<<aVGeom<<
"; aNbCells = "<<aSubProfile->mySubMeshID.size()<<
endl);
}
}
+//---------------------------------------------------------------
+void
+LoadGaussMesh(MED::TTimeStampVal& theTimeStampVal,
+ VISU::TMEDValForTime& theValForTime,
+ VISU::TMEDMeshOnEntity& theMeshOnEntity)
+{
+ INITMSG(MYDEBUG,"LoadGaussMesh"<<endl);
+
+ PMEDGaussMesh aGaussMesh = theValForTime.myGaussMesh;
+ if(aGaussMesh->myIsInitialized)
+ return;
+
+ const TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
+ const TTimeStampInfo& aTimeStampInfo = theTimeStampVal.GetTimeStampInfo();
+ const TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
+ TGeom2Gauss::const_iterator anIter = aGeom2Gauss.begin();
+ for(; anIter != aGeom2Gauss.end(); anIter++){
+ MED::PGaussInfo aGaussInfo = anIter->second;
+ MED::EGeometrieElement aMGeom = anIter->first;
+ vtkIdType aVGeom = MEDGeomToVTK(aMGeom);
+
+ TGeom2GaussSubMesh::const_iterator anIter2 = aGeom2GaussSubMesh.find(aVGeom);
+ if(anIter2 != aGeom2GaussSubMesh.end()){
+ PMEDGaussSubMesh aGaussSubMesh = anIter2->second;
+ PMEDSubProfile aSubProfile = aGaussSubMesh->mySubProfile;
+
+ INITMSG(MYDEBUG,
+ "- aVGeom = "<<aVGeom<<
+ "; aNbCells = "<<aSubProfile->mySubMeshID.size()<<
+ endl);
+ }
+ }
+}
+
+
+//---------------------------------------------------------------
int
VISU_MedConvertor
::LoadField(const MED::PWrapper& theMed,
theValForTime,
theMeshOnEntity);
+ LoadGaussMesh(aTimeStampVal,
+ theValForTime,
+ theMeshOnEntity);
+
PMEDProfile aProfile = theValForTime->myProfile;
TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;