#endif
void parseFile(const char* theFileName) {
- //try{
+ try{
MSG(MYDEBUG,"'"<<theFileName<<"'...");
auto_ptr<VISU_Convertor> aCon(CreateConvertor(theFileName));
//aCon->GetSize();
}
}
MSG(MYDEBUG,"OK");
-// }catch(std::exception& exc){
-// MSG(MYDEBUG,"Follow exception was occured in file:"<<theFileName<<"\n"<<exc.what());
-// }catch(...){
-// MSG(MYDEBUG,"Unknown exception was occured in VISU_Convertor_impl in file:"<<theFileName);
-// }
+ }catch(std::exception& exc){
+ MSG(MYDEBUG,"Follow exception was occured in file:"<<theFileName<<"\n"<<exc.what());
+ }catch(...){
+ MSG(MYDEBUG,"Unknown exception was occured in VISU_Convertor_impl in file:"<<theFileName);
+ }
}
int main(int argc, char** argv){
- //try{
+ try{
if(argc > 1){
QFileInfo fi(argv[1]);
for(int i = 0; i < 1; i++){
}
return 0;
}
- //}catch(std::exception& exc){
- // MSG(MYDEBUG,"Follow exception was occured :\n"<<exc.what());
- //}catch(...){
- // MSG(MYDEBUG,"Unknown exception was occured in VISU_Convertor_impl");
- //}
+ }catch(std::exception& exc){
+ MSG(MYDEBUG,"Follow exception was occured :\n"<<exc.what());
+ }catch(...){
+ MSG(MYDEBUG,"Unknown exception was occured in VISU_Convertor_impl");
+ }
return 1;
}
namespace VISU{
- inline int GetNbOfPoints(int theVTKCellType){
+ inline
+ int
+ GetNbOfPoints(int theVTKCellType)
+ {
switch(theVTKCellType){
case VTK_VERTEX : return 1;
case VTK_LINE : return 2;
}
}
- pair<int,int> TMeshOnEntity::GetCellsDims(const string& theFamilyName) const
+ PField
+ TMesh
+ ::GetField(const string& theFieldName) const
{
- if(theFamilyName == "")
- return make_pair(myNbCells,myCellsSize);
- TFamilyMap::const_iterator aFamilyMapIter = myFamilyMap.find(theFamilyName);
- if(aFamilyMapIter == myFamilyMap.end())
- throw std::runtime_error("GetCellsDims >> There is no family on the mesh with entity !!!");
- const PFamily& aFamily = aFamilyMapIter->second;
- return make_pair(aFamily->myNbCells,aFamily->myCellsSize);
- }
-
- const PField TMesh::GetField(const string& theFieldName) const {
TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = myMeshOnEntityMap.begin();
for(; aMeshOnEntityMapIter != myMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
const TFieldMap& aFieldMap = aMeshOnEntityMapIter->second->myFieldMap;
}
- PFamily FindFamily(VISU::PMesh theMesh, const string& theFamilyName)
+ PFamily
+ FindFamily(VISU::PMesh theMesh,
+ const string& theFamilyName)
{
PFamily aFamily;
const TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
}
- PFamily GetFamily(VISU::PMeshOnEntity theMeshOnEntity, const string& theFamilyName)
+ PFamily
+ GetFamily(VISU::PMeshOnEntity theMeshOnEntity,
+ const string& theFamilyName)
{
PFamily aFamily;
if(theFamilyName != ""){
}
-const VISU::TMeshMap& VISU_Convertor::GetMeshMap() {
+const VISU::TMeshMap&
+VISU_Convertor
+::GetMeshMap()
+{
if(!myIsDone) { myIsDone = true; Build();}
return myMeshMap;
}
-string VISU_Convertor::GenerateName(const VISU::TTime& aTime){
+string
+VISU_Convertor
+::GenerateName(const VISU::TTime& aTime)
+{
static QString aName;
const string aUnits = aTime.second, tmp(aUnits.size(),' ');
if(aUnits == "" || aUnits == tmp)
return aName.latin1();
}
-string VISU_Convertor::GenerateName(const string& theName, unsigned int theTimeId) {
+string
+VISU_Convertor
+::GenerateName(const string& theName,
+ unsigned int theTimeId)
+{
static QString aName;
aName = QString(theName.c_str()).simplifyWhiteSpace();
int iEnd = strlen(aName);
namespace VISU{
- template<class T> class shared_ptr: public boost::shared_ptr<T>
+ template<class T> class SharedPtr: public boost::shared_ptr<T>
{
public:
- shared_ptr() {}
+ SharedPtr() {}
template<class Y>
- explicit shared_ptr(Y * p)
- {
- reset(p);
- }
+ explicit SharedPtr(Y * p):
+ boost::shared_ptr<T>(p)
+ {}
template<class Y>
- shared_ptr(shared_ptr<Y> const & r):
+ SharedPtr(SharedPtr<Y> const & r):
boost::shared_ptr<T>(r,boost::detail::dynamic_cast_tag())
{}
template<class Y>
- shared_ptr & operator=(shared_ptr<Y> const & r)
+ SharedPtr & operator=(SharedPtr<Y> const & r)
{
- shared_ptr<T>(r).swap(*this);
+ boost::shared_ptr<T>(r,boost::detail::dynamic_cast_tag()).swap(*this);
return *this;
}
- template<class Y> shared_ptr& operator()(Y * p) // Y must be complete
+ template<class Y> SharedPtr& operator()(Y * p) // Y must be complete
{
- if(T* pt = dynamic_cast<T*>(p))
- boost::shared_ptr<T>::reset(pt);
- else
- boost::throw_exception(std::bad_cast());
- return *this;
+ return operator=<Y>(SharedPtr<Y>(p));
}
- };
+ operator const T& () const
+ {
+ return *(this->get());
+ }
+ operator T& ()
+ {
+ return *(this->get());
+ }
- enum TEntity {NODE_ENTITY, EDGE_ENTITY, FACE_ENTITY, CELL_ENTITY};
+ };
+ //---------------------------------------------------------------
- typedef std::pair<std::string,TEntity> TFamilyAndEntity;
- typedef std::set<TFamilyAndEntity> TFamilyAndEntitySet;
- typedef std::set<std::string> TBindGroups;
- typedef std::pair<double,std::string> TTime;
+ enum TEntity {NODE_ENTITY, EDGE_ENTITY, FACE_ENTITY, CELL_ENTITY};
struct TMesh;
- typedef shared_ptr<TMesh> PMesh;
+ typedef SharedPtr<TMesh> PMesh;
typedef std::map<std::string,PMesh> TMeshMap;
+ struct TSubProfile;
+ typedef SharedPtr<TSubProfile> PSubProfile;
+
+ struct TProfile;
+ typedef SharedPtr<TProfile> PProfile;
+
struct TMeshOnEntity;
- typedef shared_ptr<TMeshOnEntity> PMeshOnEntity;
- typedef std::map<TEntity,PMeshOnEntity> TMeshOnEntityMap;
+ typedef SharedPtr<TMeshOnEntity> PMeshOnEntity;
struct TFamily;
- typedef shared_ptr<TFamily> PFamily;
- typedef std::map<std::string,PFamily> TFamilyMap;
+ typedef SharedPtr<TFamily> PFamily;
struct TGroup;
- typedef shared_ptr<TGroup> PGroup;
- typedef std::map<std::string,PGroup> TGroupMap;
+ typedef SharedPtr<TGroup> PGroup;
struct TField;
- typedef shared_ptr<TField> PField;
- typedef std::map<std::string,PField> TFieldMap;
+ typedef SharedPtr<TField> PField;
+
+ struct TGauss;
+ typedef SharedPtr<TGauss> PGauss;
struct TValForTime;
- typedef shared_ptr<TValForTime> PValForTime;
- typedef std::map<int,PValForTime> TValField;
+ typedef SharedPtr<TValForTime> PValForTime;
+
- struct TBaseStructure{
- virtual ~TBaseStructure(){}
+ //---------------------------------------------------------------
+ struct TBaseStructure
+ {
+ virtual ~TBaseStructure()
+ {}
};
typedef std::vector<std::string> TNames;
- struct TMesh: TBaseStructure{
- int myDim, myNbPoints;
- std::string myName;
+ //---------------------------------------------------------------
+ typedef std::map<TEntity,PMeshOnEntity> TMeshOnEntityMap;
+ typedef std::map<std::string,PGroup> TGroupMap;
+
+ struct TMesh: virtual TBaseStructure
+ {
TMeshOnEntityMap myMeshOnEntityMap;
TGroupMap myGroupMap;
+ std::string myName;
+ int myDim;
+
+ TMesh(): myDim(0)
+ {}
- TMesh() : myDim(0), myNbPoints(0) {}
- const PField GetField(const std::string& theFieldName) const;
+ PField
+ GetField(const std::string& theFieldName) const;
};
- struct TMeshOnEntity: TBaseStructure{
- std::string myMeshName;
- TEntity myEntity;
- int myNbCells, myCellsSize;
+
+ //---------------------------------------------------------------
+ struct TSubProfile: virtual TBaseStructure
+ {};
+
+
+ //---------------------------------------------------------------
+ struct TProfile: virtual TBaseStructure
+ {};
+
+
+ //---------------------------------------------------------------
+ struct TSubProfileLess
+ {
+ bool
+ operator()(const PSubProfile& theLeft, const PSubProfile& theRight) const;
+ };
+ typedef std::set<PSubProfile,TSubProfileLess> TProfileKey;
+
+
+ //---------------------------------------------------------------
+ typedef std::map<TProfileKey,PProfile> TProfileMap;
+
+ typedef std::map<std::string,PFamily> TFamilyMap;
+ typedef std::map<std::string,PField> TFieldMap;
+
+ struct TMeshOnEntity: virtual TBaseStructure
+ {
+ TProfileMap myProfileMap;
TFamilyMap myFamilyMap;
TFieldMap myFieldMap;
- TMeshOnEntity() : myNbCells(0), myCellsSize(0) {}
- std::pair<int,int>
- GetCellsDims(const std::string& theFamilyName = "") const;
+ std::string myMeshName;
+ TEntity myEntity;
};
- struct TFamily: TBaseStructure{
- int myId;
+
+ //---------------------------------------------------------------
+ typedef std::set<std::string> TBindGroups;
+
+ struct TFamily: virtual TBaseStructure
+ {
+ TBindGroups myGroups;
std::string myName;
TEntity myEntity;
- TBindGroups myGroups;
- int myNbCells, myCellsSize;
- TFamily() : myNbCells(0), myCellsSize(0) {}
};
- struct TGroup: TBaseStructure{
+
+ //---------------------------------------------------------------
+ typedef std::pair<std::string,TEntity> TFamilyAndEntity;
+ typedef std::set<TFamilyAndEntity> TFamilyAndEntitySet;
+
+ struct TGroup: virtual TBaseStructure
+ {
std::string myName;
std::string myMeshName;
- int myNbCells, myCellsSize;
TFamilyAndEntitySet myFamilyAndEntitySet;
- TGroup() : myNbCells(0), myCellsSize(0) {}
};
- struct TField: TBaseStructure{
- int myId;
+
+ //---------------------------------------------------------------
+ typedef std::map<int,PValForTime> TValField;
+
+ struct TField: virtual TBaseStructure
+ {
TEntity myEntity;
- bool myIsTrimmed;
std::string myName;
std::string myMeshName;
- int myNbComp, myDataSize;
TValField myValField;
TNames myCompNames;
TNames myUnitNames;
- TField() : myNbComp(0), myDataSize(0), myIsTrimmed(0) {}
+ int myNbComp;
+
+ TField(): myNbComp(0)
+ {}
};
- struct TValForTime: TBaseStructure{
- int myId;
+
+ //---------------------------------------------------------------
+ struct TGauss: virtual TBaseStructure
+ {};
+
+
+ //---------------------------------------------------------------
+ typedef std::pair<double,std::string> TTime;
+ typedef std::map<int,PGauss> TGaussMap;
+
+ struct TValForTime: virtual TBaseStructure
+ {
TEntity myEntity;
std::string myMeshName;
std::string myFieldName;
- int myNbComp;
TTime myTime;
-
- TValForTime() : myNbComp(0) {}
+
+ PProfile myProfile;
+ TGaussMap myGaussMap;
};
- PFamily FindFamily(VISU::PMesh theMesh,
- const std::string& theFamilyName);
-
- PFamily GetFamily(VISU::PMeshOnEntity theMeshOnEntity,
- const std::string& theFamilyName);
+ PFamily
+ FindFamily(VISU::PMesh theMesh,
+ const std::string& theFamilyName);
+
+ PFamily
+ GetFamily(VISU::PMeshOnEntity theMeshOnEntity,
+ const std::string& theFamilyName);
- void WriteToFile(vtkUnstructuredGrid* theDataSet,
- const std::string& theFileName);
+ void
+ WriteToFile(vtkUnstructuredGrid* theDataSet,
+ const std::string& theFileName);
};
-class VISU_Convertor{
+
+//---------------------------------------------------------------
+class VISU_Convertor
+{
protected:
std::string myName;
VISU::TMeshMap myMeshMap;
int myIsDone;
+
public:
- virtual ~VISU_Convertor(){};
- virtual const std::string& GetName() { return myName;}
- virtual int IsDone() const { return myIsDone;}
+ virtual
+ ~VISU_Convertor()
+ {};
+
+ virtual
+ const std::string&
+ GetName(){ return myName;}
+
+ virtual
+ int
+ IsDone() const { return myIsDone; }
+
typedef vtkUnstructuredGrid TOutput;
- virtual VISU_Convertor* Build() = 0;
- virtual const VISU::TMeshMap& GetMeshMap() ;
- virtual float GetSize() = 0;
+ virtual
+ VISU_Convertor*
+ Build() = 0;
- virtual TOutput* GetMeshOnEntity(const std::string& theMeshName,
- const VISU::TEntity& theEntity,
- const std::string& theFamilyName = "") = 0;
-
- virtual float GetMeshOnEntitySize(const std::string& theMeshName,
- const VISU::TEntity& theEntity,
- const std::string& theFamilyName = "") = 0;
-
- virtual TOutput* GetMeshOnGroup(const std::string& theMeshName,
- const std::string& theGroupName) = 0;
+ virtual
+ const VISU::TMeshMap&
+ GetMeshMap();
- virtual float GetMeshOnGroupSize(const std::string& theMeshName,
- const std::string& theGroupName) = 0;
+ virtual
+ float
+ GetSize() = 0;
- virtual TOutput* GetTimeStampOnMesh(const std::string& theMeshName,
- const VISU::TEntity& theEntity,
- const std::string& theFieldName,
- int theStampsNum) = 0;
+ virtual
+ TOutput*
+ GetMeshOnEntity(const std::string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const std::string& theFamilyName = "") = 0;
+
+ virtual
+ float
+ GetMeshOnEntitySize(const std::string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const std::string& theFamilyName = "") = 0;
+
+ virtual
+ TOutput*
+ GetMeshOnGroup(const std::string& theMeshName,
+ const std::string& theGroupName) = 0;
+
+ virtual
+ float
+ GetMeshOnGroupSize(const std::string& theMeshName,
+ const std::string& theGroupName) = 0;
+
+ virtual
+ TOutput*
+ GetTimeStampOnMesh(const std::string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const std::string& theFieldName,
+ int theStampsNum) = 0;
- virtual float GetTimeStampSize(const std::string& theMeshName,
- const VISU::TEntity& theEntity,
- const std::string& theFieldName,
- int theStampsNum) = 0;
+ virtual
+ float
+ GetTimeStampSize(const std::string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const std::string& theFieldName,
+ int theStampsNum) = 0;
- virtual float GetFieldOnMeshSize(const std::string& theMeshName,
- const VISU::TEntity& theEntity,
- const std::string& theFieldName) = 0;
-
- virtual const VISU::PField GetField(const std::string& theMeshName,
- VISU::TEntity theEntity,
- const std::string& theFieldName) = 0;
-
- virtual const VISU::PValForTime GetTimeStamp(const std::string& theMeshName,
- const VISU::TEntity& theEntity,
- const std::string& theFieldName,
- int theStampsNum) = 0;
+ virtual
+ float
+ GetFieldOnMeshSize(const std::string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const std::string& theFieldName) = 0;
+
+ virtual
+ const VISU::PField
+ GetField(const std::string& theMeshName,
+ VISU::TEntity theEntity,
+ const std::string& theFieldName) = 0;
+
+ virtual
+ const VISU::PValForTime
+ GetTimeStamp(const std::string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const std::string& theFieldName,
+ int theStampsNum) = 0;
- static std::string GenerateName(const VISU::TTime& aTime);
- static std::string GenerateName(const std::string& theName, unsigned int theTimeId);
+ static
+ std::string
+ GenerateName(const VISU::TTime& aTime);
+
+ static
+ std::string
+ GenerateName(const std::string& theName, unsigned int theTimeId);
};
-extern "C"{
- VISU_Convertor* CreateConvertor(const std::string& theFileName) ;
+extern "C"
+{
+ VISU_Convertor*
+ CreateConvertor(const std::string& theFileName);
};
#endif
#include "VISU_Convertor_impl.hxx"
#include "VISU_ConvertorUtils.hxx"
+#include <vtkPoints.h>
+#include <vtkAppendFilter.h>
+#include <vtkUnstructuredGrid.h>
+
#include <vtkIdList.h>
#include <vtkCellType.h>
#include <vtkIntArray.h>
#ifdef _DEBUG_
static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
+static int MYDEBUGWITHFILES = 1;
#else
static int MYDEBUG = 0;
static int MYDEBUGWITHFILES = 0;
#endif
-namespace{
+namespace VISU
+{
+
+ TSource::TSource():
+ myNbCells(0),
+ myCellsSize(0),
+ myIsInitialized(false),
+ mySource(vtkUnstructuredGrid::New())
+ {
+ mySource->Delete();
+ }
+
+
+ TMeshImpl::TMeshImpl():
+ myPoints(vtkPoints::New()),
+ myIsInitialized(false),
+ myNbPoints(0)
+ {
+ myPoints->Delete();
+ }
+
+ TSubProfileImpl::TSubProfileImpl():
+ myStatus(eNone)
+ {
+ myGeom = -1;
+ }
+
+
+ bool
+ TSubProfileLess
+ ::operator()(const PSubProfile& theLeft, const PSubProfile& theRight) const
+ {
+ PSubProfileImpl aLeft(theLeft), aRight(theRight);
+ if(aLeft->myGeom != aRight->myGeom)
+ return aLeft->myGeom < aRight->myGeom;
+ return aLeft->myName < aRight->myName;
+ }
+
+
+ TProfileImpl::TProfileImpl():
+ myIsAll(true),
+ myIsInitialized(false),
+ myAppendFilter(vtkAppendFilter::New())
+ {
+ myAppendFilter->Delete();
+ }
+
+
+ pair<int,int>
+ TMeshOnEntityImpl
+ ::GetCellsDims(const string& theFamilyName) const
+ {
+ if(theFamilyName == "")
+ return make_pair(myNbCells,myCellsSize);
+
+ TFamilyMap::const_iterator aFamilyMapIter = myFamilyMap.find(theFamilyName);
+ if(aFamilyMapIter == myFamilyMap.end())
+ throw std::runtime_error("GetCellsDims >> There is no family on the mesh with entity !!!");
+
+ PFamilyImpl aFamily = aFamilyMapIter->second;
+
+ return make_pair(aFamily->myNbCells,aFamily->myCellsSize);
+ }
+
+
+ int
+ TValForTimeImpl
+ ::GetNbGauss(vtkIdType theGeom) const
+ {
+ TGaussMap::const_iterator anIter2 = myGaussMap.find(theGeom);
+ if(anIter2 != myGaussMap.end()){
+ PGaussImpl aGauss = anIter2->second;
+ return aGauss->myNbPts;
+ }
+ return myNbGauss;
+ }
+
+
+ vtkIdType
+ VTKGeom2NbNodes(vtkIdType theGeom)
+ {
+ switch(theGeom){
+ case VTK_VERTEX: return 1;
+ case VTK_LINE: return 2;
+ case VTK_TRIANGLE: return 3;
+ case VTK_QUAD: return 4;
+ case VTK_TETRA: return 4;
+ case VTK_HEXAHEDRON: return 8;
+ case VTK_WEDGE: return 6;
+ case VTK_PYRAMID: return 5;
+ }
+ return -1;
+ }
+}
+
+namespace
+{
template<class T>
- std::string dtos(const std::string& fmt, T val){
+ std::string
+ dtos(const std::string& fmt, T val)
+ {
static QString aString;
aString.sprintf(fmt.c_str(),val);
return aString.latin1();
};
typedef std::auto_ptr<TCoordHelper> TCoordHelperPtr;
- void GetPoints(VISU::TVTKSource& theStorage, VISU::PMeshImpl theMesh)
+
+ void
+ GetPoints(VISU::TVTKSource& theSource,
+ VISU::PMeshImpl theMesh)
{
- vtkPoints* aPoints = theMesh->myPoints.GetPointer();
- if(!aPoints){
- aPoints = vtkPoints::New();
+ TVTKPoints& aPoints = theMesh->myPoints;
+
+ if(!theMesh->myIsInitialized){
TCoordHelperPtr aCoordHelperPtr;
const VISU::TMeshImpl::TPointsCoord& anArray = theMesh->myPointsCoord;
{
}
}
- if(MYVTKDEBUG) aPoints->DebugOn();
vtkIdType iEnd = theMesh->myPointsCoord.size();
vtkIdType aNbPoints = iEnd / theMesh->myDim;
aPoints->SetNumberOfPoints(aNbPoints);
- MSG(MYDEBUG,"GetPoints - aNbPoints = "<<aNbPoints<<"; myDim = "<<theMesh->myDim);
- for (vtkIdType i = 0, j = 0; i < iEnd; i += theMesh->myDim, j++)
+ INITMSG(MYDEBUG,"GetPoints - aNbPoints = "<<aNbPoints<<
+ "; myDim = "<<theMesh->myDim<<
+ endl);
+ for(vtkIdType i = 0, j = 0; i < iEnd; i += theMesh->myDim, j++)
aPoints->SetPoint(j,
aCoordHelperPtr->GetCoord(i,eX),
aCoordHelperPtr->GetCoord(i,eY),
aCoordHelperPtr->GetCoord(i,eZ));
- theMesh->myPoints = aPoints;
- aPoints->Delete();
+
+ theMesh->myIsInitialized = true;
+ if(MYVTKDEBUG) aPoints->DebugOn();
}
- theStorage->SetPoints(aPoints);
+
+ theSource->SetPoints(aPoints.GetPointer());
}
- inline void PrintCells(int& theStartId,
- vtkCellArray* theConnectivity,
- const VISU::TMeshOnEntityImpl::TConnect& theVector)
+ void
+ PrintCells(int& theStartId,
+ vtkCellArray* theConnectivity,
+ const VISU::TConnect& theVector)
{
vtkIdList *anIdList = vtkIdList::New();
int kEnd = theVector.size();
anIdList->Delete();
}
- void GetCellsOnEntity(VISU::TVTKSource& theStorage,
- const VISU::PMeshOnEntityImpl theMeshOnEntity,
- const string& theFamilyName)
+ void
+ GetCellsOnEntity(VISU::TVTKSource& theSource,
+ const VISU::PMeshOnEntityImpl theMeshOnEntity,
+ const string& theFamilyName)
{
//Check on existing family
PFamilyImpl aFamily = GetFamily(theMeshOnEntity,theFamilyName);
vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
aCellTypesArray->SetNumberOfComponents(1);
aCellTypesArray->SetNumberOfTuples(aNbCells);
- MSG(MYDEBUG,"GetCellsOnEntity - isFamilyPresent = "<<bool(aFamily));
- const VISU::TMeshOnEntityImpl::TCellsConn &aCellsConn = theMeshOnEntity->myCellsConn;
- VISU::TMeshOnEntityImpl::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
- for(int i = 0, j = 0; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
- const VISU::TMeshOnEntityImpl::TConnForCellType& anArray = aCellsConnIter->second;
- int aVtkType = aCellsConnIter->first;
- MSG(MYDEBUG,"GetCellsOnEntity - aVtkType = "<<aVtkType<<"; anArray.size() = "<<anArray.size());
+ INITMSG(MYDEBUG,"GetCellsOnEntity - isFamilyPresent = "<<bool(aFamily)<<
+ endl);
+ const VISU::TGeom2Cell2Connect& aGeom2Cell2Connect = theMeshOnEntity->myGeom2Cell2Connect;
+ VISU::TGeom2Cell2Connect::const_iterator aGeom2Cell2ConnectIter = aGeom2Cell2Connect.begin();
+ for(int i = 0, j = 0; aGeom2Cell2ConnectIter != aGeom2Cell2Connect.end(); aGeom2Cell2ConnectIter++){
+ const VISU::TCell2Connect& anArray = aGeom2Cell2ConnectIter->second;
+ int aVtkType = aGeom2Cell2ConnectIter->first;
+ INITMSG(MYDEBUG,"aVtkType = "<<aVtkType<<
+ "; anArray.size() = "<<anArray.size()<<
+ endl);
if(!aFamily)
for(int k = 0, kEnd = anArray.size(); k < kEnd; k++, i++){
PrintCells(i,aConnectivity,anArray[k]);
aCellTypesArray->SetValue(j++,(unsigned char)aVtkType);
}
else{
- const VISU::TFamilyImpl::TSubMesh& aSubMesh = aFamily->mySubMesh;
- if(aSubMesh.empty())
+ const VISU::TGeom2SubMeshID& aGeom2SubMeshID = aFamily->myGeom2SubMeshID;
+ if(aGeom2SubMeshID.empty())
EXCEPTION(runtime_error,"GetCells >> There is no elements on the family !!!");
- VISU::TFamilyImpl::TSubMesh::const_iterator aSubMeshIter = aSubMesh.find(aVtkType);
- if(aSubMeshIter == aSubMesh.end()) continue;
- const VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aSubMeshIter->second;
- MSG(MYDEBUG,"GetCellsOnEntity - aSubMeshOnCellType.size() = "<<aSubMeshOnCellType.size());
- VISU::TFamilyImpl::TSubMeshOnCellType::const_iterator aSubMeshOnCellTypeIter = aSubMeshOnCellType.begin();
- for(; aSubMeshOnCellTypeIter != aSubMeshOnCellType.end(); aSubMeshOnCellTypeIter++, i++){
- PrintCells(i,aConnectivity,anArray[*aSubMeshOnCellTypeIter]);
+
+ VISU::TGeom2SubMeshID::const_iterator aGeom2SubMeshIDIter = aGeom2SubMeshID.find(aVtkType);
+ if(aGeom2SubMeshIDIter == aGeom2SubMeshID.end())
+ continue;
+
+ const VISU::TSubMeshID& aSubMeshID = aGeom2SubMeshIDIter->second;
+
+ INITMSG(MYDEBUG,"aSubMeshID.size() = "<<aSubMeshID.size()<<
+ endl);
+
+ VISU::TSubMeshID::const_iterator aSubMeshIDIter = aSubMeshID.begin();
+ for(; aSubMeshIDIter != aSubMeshID.end(); aSubMeshIDIter++, i++){
+ PrintCells(i,aConnectivity,anArray[*aSubMeshIDIter]);
aCellTypesArray->SetValue(j++,(unsigned char)aVtkType);
}
}
aConnectivity->InitTraversal();
for(int i=0; aConnectivity->GetNextCell(npts,pts); i++)
aCellLocationsArray->SetValue(i,aConnectivity->GetTraversalLocation(npts));
- theStorage->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
+ theSource->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
if(MYVTKDEBUG) aConnectivity->DebugOn();
aCellLocationsArray->Delete();
aCellTypesArray->Delete();
}
- void GetCellsOnGroup(VISU::TVTKSource& theStorage,
- VISU::PMeshImpl theMesh,
- const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
+ void
+ GetCellsOnGroup(VISU::TVTKSource& theSource,
+ VISU::PMeshImpl theMesh,
+ const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
{
//Calculate dimentions of the group
int aNbCells = 0, aCellsSize = 0;
for(; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
const VISU::TFamilyAndEntity& aFamilyAndEntity = *aFamilyAndEntitySetIter;
const string& aFamilyName = aFamilyAndEntity.first;
- const VISU::TEntity& anEntity = aFamilyAndEntity.second;
- const VISU::PMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
+ VISU::TEntity anEntity = aFamilyAndEntity.second;
+ VISU::PMeshOnEntityImpl aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
pair<int,int> aCellsDim = aMeshOnEntity->GetCellsDims(aFamilyName);
aNbCells += aCellsDim.first;
aCellsSize += aCellsDim.second;
const VISU::TEntity& anEntity = aFamilyAndEntity.second;
PMeshOnEntityImpl aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
PFamilyImpl aFamily = GetFamily(aMeshOnEntity,aFamilyName);
- const VISU::TMeshOnEntityImpl::TCellsConn &aCellsConn = aMeshOnEntity->myCellsConn;
- VISU::TMeshOnEntityImpl::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
- for(; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
- const VISU::TMeshOnEntityImpl::TConnForCellType& anArray = aCellsConnIter->second;
- int aVtkType = aCellsConnIter->first;
+ const VISU::TGeom2Cell2Connect &aGeom2Cell2Connect = aMeshOnEntity->myGeom2Cell2Connect;
+ 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 = "<<aVtkType<<"; anArray.size() = "<<anArray.size());
- const VISU::TFamilyImpl::TSubMesh& aSubMesh = aFamily->mySubMesh;
- if(aSubMesh.empty())
+ const VISU::TGeom2SubMeshID& aGeom2SubMeshID = aFamily->myGeom2SubMeshID;
+ if(aGeom2SubMeshID.empty())
EXCEPTION(runtime_error,"GetCells >> There is no elements on the family !!!");
- VISU::TFamilyImpl::TSubMesh::const_iterator aSubMeshIter = aSubMesh.find(aVtkType);
- if(aSubMeshIter == aSubMesh.end()) continue;
- const VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aSubMeshIter->second;
- MSG(MYDEBUG,"GetCellsOnGroup - aSubMeshOnCellType.size() = "<<aSubMeshOnCellType.size());
- VISU::TFamilyImpl::TSubMeshOnCellType::const_iterator aSubMeshOnCellTypeIter = aSubMeshOnCellType.begin();
- for(; aSubMeshOnCellTypeIter != aSubMeshOnCellType.end(); aSubMeshOnCellTypeIter++, i++){
- PrintCells(i,aConnectivity,anArray[*aSubMeshOnCellTypeIter]);
+ VISU::TGeom2SubMeshID::const_iterator aGeom2SubMeshIDIter = aGeom2SubMeshID.find(aVtkType);
+ if(aGeom2SubMeshIDIter == aGeom2SubMeshID.end()) continue;
+ const VISU::TSubMeshID& aSubMeshID = aGeom2SubMeshIDIter->second;
+ MSG(MYDEBUG,"GetCellsOnGroup - aSubMeshID.size() = "<<aSubMeshID.size());
+ VISU::TSubMeshID::const_iterator aSubMeshIDIter = aSubMeshID.begin();
+ for(; aSubMeshIDIter != aSubMeshID.end(); aSubMeshIDIter++, i++){
+ PrintCells(i,aConnectivity,anArray[*aSubMeshIDIter]);
aCellTypesArray->SetValue(j++,(unsigned char)aVtkType);
}
}
aConnectivity->InitTraversal();
for(int i = 0; aConnectivity->GetNextCell(npts,pts); i++)
aCellLocationsArray->SetValue(i,aConnectivity->GetTraversalLocation(npts));
- theStorage->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
+ theSource->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
aCellLocationsArray->Delete();
aCellTypesArray->Delete();
aConnectivity->Delete();
}
- void InitProfile(VISU::TVTKExtractFilter& theFilter,
- PMeshOnEntityImpl theMeshOnEntity,
- PValForTimeImpl theValForTime)
- {
- const VISU::TValForTimeImpl::TValForCells& aValForCells = theValForTime->myValForCells;
- const VISU::TMeshOnEntityImpl::TCellsConn &aCellsConn = theMeshOnEntity->myCellsConn;
- VISU::TMeshOnEntityImpl::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
- for(; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
- const vtkIdType& aCellType = aCellsConnIter->first;
- if(aValForCells.find(aCellType) == aValForCells.end())
- theFilter->RemoveCellsWithType(aCellType);
- }
- }
-
-
- void GetValsOnTimeStamp(vtkFloatArray *theFloatArray,
- const vtkIdType& theNumberOfTuples,
- const std::string& theFieldName,
- VISU::PFieldImpl theField,
- VISU::PValForTimeImpl theValForTime)
+ void
+ GetTimeStamp3(vtkFloatArray *theFloatArray,
+ const vtkIdType& theNumberOfTuples,
+ const std::string& theFieldName,
+ VISU::PFieldImpl theField,
+ VISU::PValForTimeImpl theValForTime)
{
//theFloatArray->DebugOn();
theFloatArray->SetNumberOfTuples(theNumberOfTuples);
theFloatArray->SetName(theFieldName.c_str());
- MSG(MYDEBUG,"GetValsOnTimeStamp - theNumberOfTuples = "<<theNumberOfTuples);
- const VISU::TValForTimeImpl::TValForCells& aValForCells = theValForTime->myValForCells;
- VISU::TValForTimeImpl::TValForCells::const_iterator aValForCellsIter = aValForCells.begin();
- for(int k = 0; aValForCellsIter != aValForCells.end(); aValForCellsIter++) {
- const VISU::TValForTimeImpl::TValForCellsWithType& anArray = aValForCellsIter->second;
- int iEnd = anArray.size()/theField->myNbComp;
- int aVtkType = aValForCellsIter->first;
- MSG(MYDEBUG,"GetValsOnTimeStamp - iEnd = "<<iEnd<<"; aVtkType = "<<aVtkType);
- switch(theField->myNbComp) {
+ int aNbComp = theField->myNbComp;
+
+ const VISU::TValForCells& aValForCells = theValForTime->myValForCells;
+ VISU::TValForCells::const_iterator anIter = aValForCells.begin();
+ for(int k = 0; anIter != aValForCells.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;
+
+ INITMSG(MYDEBUG,"GetTimeStamp3 - aGeom = "<<aGeom<<
+ "; aNbElem = "<<aNbElem<<
+ "; aNbComp = "<<aNbComp<<
+ "; aNbGauss = "<<aNbGauss<<
+ endl);
+
+ switch(aNbComp){
case 1:
- for (int i = 0; i < iEnd; i++)
- theFloatArray->SetTuple1(k++,anArray[i]);
+ for(int iElem = 0; iElem < aNbElem; iElem++){
+ for(int iComp = 0; iComp < aNbComp; iComp++){
+ float aValue = 0;
+ int aFirstId = iElem*aStep + iComp*aNbGauss;
+ if(aNbGauss > 0){
+ for(int iGauss = 0, anId = aFirstId; iGauss < aNbGauss; iGauss++, anId++)
+ aValue += anArray.at(anId);
+ aValue /= aNbGauss;
+ }else
+ aValue = anArray.at(aFirstId);
+
+ theFloatArray->SetTuple1(k++,aValue);
+ }
+ }
break;
case 2:
- for (int i = 0, ji = 0; i < iEnd; ++i, ji = i*2)
- theFloatArray->SetTuple3(k++,anArray[ji],anArray[ji+1],0.0);
- break;
- case 3:
- for (int i = 0, ji = 0; i < iEnd; ++i, ji = i*3)
- theFloatArray->SetTuple3(k++,anArray[ji],anArray[ji+1],anArray[ji+2]);
+ for(int iElem = 0; iElem < aNbElem; iElem++){
+ float aValue[2] = {0.0, 0.0};
+ for(int iComp = 0; iComp < aNbComp; iComp++){
+ int aFirstId = iElem*aStep + iComp*aNbGauss;
+ if(aNbGauss > 0){
+ for(int iGauss = 0, anId = aFirstId; iGauss < aNbGauss; iGauss++, anId++)
+ aValue[iComp] += anArray[anId];
+ aValue[iComp] /= aNbGauss;
+ }else
+ aValue[iComp] = anArray[aFirstId];
+
+ }
+ theFloatArray->SetTuple3(k++,aValue[0],aValue[1],0.0);
+ }
break;
case 4:
- for (int i = 0, ji = 0; i < iEnd; ++i, ji = i*4)
- theFloatArray->SetTuple3(k++,anArray[ji],anArray[ji+1],0.0);
- break;
- case 6:
- for (int i = 0, ji = 0; i < iEnd; ++i, ji = i*6)
- theFloatArray->SetTuple3(k++,anArray[ji],anArray[ji+1],anArray[ji+2]);
+ for(int iElem = 0; iElem < aNbElem; iElem++){
+ float aValue[2] = {0.0, 0.0};
+ for(int iComp = 0; iComp < 2; iComp++){
+ int aFirstId = iElem*aStep + iComp*aNbGauss;
+ if(aNbGauss > 0){
+ for(int iGauss = 0, anId = aFirstId; iGauss < aNbGauss; iGauss++, anId++)
+ aValue[iComp] += anArray[anId];
+ aValue[iComp] /= aNbGauss;
+ }else
+ aValue[iComp] = anArray[aFirstId];
+
+ }
+ theFloatArray->SetTuple3(k++,aValue[0],aValue[1],0.0);
+ }
break;
default:
- EXCEPTION(runtime_error,"GetValsOnTimeStamp - There is no an algorithm for representation of the field !!!");
+ if(aNbComp > 0)
+ for(int iElem = 0; iElem < aNbElem; iElem++){
+ float aValue[3] = {0.0, 0.0, 0.0};
+ for(int iComp = 0; iComp < 3; iComp++){
+ int aFirstId = iElem*aStep + iComp*aNbGauss;
+ if(aNbGauss > 0){
+ for(int iGauss = 0, anId = aFirstId; iGauss < aNbGauss; iGauss++, anId++)
+ aValue[iComp] += anArray[anId];
+ aValue[iComp] /= aNbGauss;
+ }else
+ aValue[iComp] = anArray[aFirstId];
+
+ }
+ theFloatArray->SetTuple3(k++,aValue[0],aValue[1],aValue[2]);
+ }
+ else
+ EXCEPTION(runtime_error,"GetTimeStamp3 - There is no an algorithm for representation of the field !!!");
+ break;
}
}
}
- string GenerateFieldName(const VISU::PFieldImpl theField,
- const VISU::PValForTimeImpl theValForTime)
+ std::string
+ GenerateFieldName(const VISU::PFieldImpl theField,
+ const VISU::PValForTimeImpl theValForTime)
{
const VISU::TTime& aTime = theValForTime->myTime;
string aFieldName = theField->myMeshName + ", " + theField->myName + ": " +
return aFieldName;
}
- void GetTimeStamp(VISU::TVTKSource& theStorage,
- const VISU::PFieldImpl theField,
- const VISU::PValForTimeImpl theValForTime)
+ void
+ GetTimeStamp2(VISU::TVTKSource& theSource,
+ const VISU::PFieldImpl theField,
+ const VISU::PValForTimeImpl theValForTime)
{
int aNumberOfTuples = theField->myDataSize/theField->myNbComp;
string aFieldName = GenerateFieldName(theField,theValForTime);
- MSG(MYDEBUG,"GetTimeStamp(TVTKSource) - aFieldName = "<<aFieldName<<
- "; aNumberOfTuples = "<<aNumberOfTuples);
+ INITMSG(MYDEBUG,"GetTimeStamp2"<<
+ "; aNumberOfTuples = "<<aNumberOfTuples<<
+ endl);
vtkDataSetAttributes* aDataSetAttributes;
switch(theField->myEntity){
case VISU::NODE_ENTITY :
- aDataSetAttributes = theStorage->GetPointData();
+ aDataSetAttributes = theSource->GetPointData();
break;
default:
- aDataSetAttributes = theStorage->GetCellData();
+ aDataSetAttributes = theSource->GetCellData();
}
vtkFloatArray *aFloatArray = vtkFloatArray::New();
aDataSetAttributes->SetVectors(aFloatArray);
}
- GetValsOnTimeStamp(aFloatArray,aNumberOfTuples,aFieldName,theField,theValForTime);
- }
-
- void GetTimeStamp(VISU::TVTKAttribyteFilter& theAttribyteFilter,
- VISU::TVTKMergetFilter& theMergeFilter,
- VISU::TVTKExtractFilter& theExtractFilter,
- const VISU::PFieldImpl theField,
- const VISU::PValForTimeImpl theValForTime)
- {
- int aNumberOfTuples = theField->myDataSize/theField->myNbComp;
- string aFieldName = GenerateFieldName(theField,theValForTime);
- MSG(MYDEBUG,"GetTimeStamp(TVTKAttribyteFilter) - aFieldName = "<<aFieldName<<
- "; aNumberOfTuples = "<<aNumberOfTuples);
-
- vtkDataObject* aDataObject = vtkDataObject::New();
- theMergeFilter->SetDataObject(aDataObject);
- aDataObject->Delete();
-
- theMergeFilter->SetInput(theExtractFilter->GetOutput());
- theAttribyteFilter->SetInput(theMergeFilter->GetOutput());
-
- switch(theField->myEntity){
- case VISU::NODE_ENTITY :
- theMergeFilter->SetOutputFieldToPointDataField();
- theAttribyteFilter->SetInputFieldToPointDataField();
- theAttribyteFilter->SetOutputAttributeDataToPointData();
- break;
- default:
- theMergeFilter->SetOutputFieldToCellDataField();
- theAttribyteFilter->SetInputFieldToCellDataField();
- theAttribyteFilter->SetOutputAttributeDataToCellData();
- }
-
- vtkFloatArray *aFloatArray = vtkFloatArray::New();
- switch(theField->myNbComp) {
- case 1:
- aFloatArray->SetNumberOfComponents(1);
- theAttribyteFilter->SetScalarComponent(0,aFieldName.c_str(),0);
- break;
- default:
- aFloatArray->SetNumberOfComponents(3);
- theAttribyteFilter->SetVectorComponent(0,aFieldName.c_str(),0);
- theAttribyteFilter->SetVectorComponent(1,aFieldName.c_str(),1);
- theAttribyteFilter->SetVectorComponent(2,aFieldName.c_str(),2);
- }
-
- vtkFieldData* aFieldData = aDataObject->GetFieldData();
- aFieldData->AddArray(aFloatArray);
- aFloatArray->Delete();
-
- GetValsOnTimeStamp(aFloatArray,aNumberOfTuples,aFieldName,theField,theValForTime);
+ GetTimeStamp3(aFloatArray,
+ aNumberOfTuples,
+ aFieldName,
+ theField,
+ theValForTime);
}
}
-VISU_Convertor_impl::VISU_Convertor_impl() {
+
+VISU_Convertor_impl
+::VISU_Convertor_impl()
+{
myIsDone = false;
}
-VISU_Convertor_impl::~VISU_Convertor_impl() {}
+VISU_Convertor_impl
+::~VISU_Convertor_impl()
+{}
VISU_Convertor::TOutput*
-VISU_Convertor_impl::GetMeshOnEntity(const string& theMeshName,
- const VISU::TEntity& theEntity,
- const string& theFamilyName)
+VISU_Convertor_impl
+::GetMeshOnEntity(const string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const string& theFamilyName)
{
- MSG(MYDEBUG,"GetMeshOnEntity - theMeshName = '"<<theMeshName<<
- "'; theEntity = "<<theEntity<<"; theFamilyName = '"<<theFamilyName<<"'");
+ INITMSG(MYDEBUG,"GetMeshOnEntity"<<
+ "; theMeshName = '"<<theMeshName<<"'"<<
+ "; theEntity = "<<theEntity<<
+ "; theFamilyName = '"<<theFamilyName<<"'"<<
+ endl);
+
//Cheching possibility do the query
- TFindMeshOnEntity aFindMeshOnEntity =
- FindMeshOnEntity(theMeshName,theEntity,theFamilyName);
- VISU::TVTKSource* pSource;
+ TFindMeshOnEntity aFindMeshOnEntity = FindMeshOnEntity(theMeshName,
+ theEntity,
+ theFamilyName);
PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);;
PFamilyImpl aFamily = boost::get<2>(aFindMeshOnEntity);
PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity);
- if(aFamily)
- pSource = &(aFamily->myStorage);
- else
- pSource = &(aMeshOnEntity->myStorage);
- VISU::TVTKSource& aSource = *pSource;
+
+ TVTKSource aSource;
+ bool *anIsInitialized;
+ if(aFamily){
+ aSource = aFamily->mySource;
+ anIsInitialized = &(aFamily->myIsInitialized);
+ }else{
+ aSource = aMeshOnEntity->mySource;
+ anIsInitialized = &(aMeshOnEntity->myIsInitialized);
+ }
+
//Main part of code
try{
- if(aSource.GetPointer() == NULL){
- aSource = TOutput::New();
- aSource->Delete();
+
+ if(!(*anIsInitialized)){
if(MYVTKDEBUG) aSource->DebugOn();
+
LoadMeshOnEntity(aMeshOnEntity,theFamilyName);
GetPoints(aSource,aMesh);
GetCellsOnEntity(aSource,aMeshOnEntity,theFamilyName);
+
+ (*anIsInitialized) = true;
+
if(MYDEBUGWITHFILES){
string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
string aFamilyName = QString(theFamilyName.c_str()).simplifyWhiteSpace().latin1();
VISU::WriteToFile(aSource.GetPointer(),aFileName);
}
}
+
if(MYVTKDEBUG){
GetMeshOnEntitySize(theMeshName,theEntity,theFamilyName);
- vtkUnstructuredGrid* aDataSet = aSource.GetPointer();
- aDataSet->Update();
- MSG(MYVTKDEBUG,"GetMeshOnEntity - GetPoints() = "<<float(aDataSet->GetPoints()->GetActualMemorySize()*1000));
- MSG(MYVTKDEBUG,"GetMeshOnEntity - GetCells() = "<<float(aDataSet->GetCells()->GetActualMemorySize()*1000));
- MSG(MYVTKDEBUG,"GetMeshOnEntity - GetCellTypesArray() = "<<float(aDataSet->GetCellTypesArray()->GetActualMemorySize()*1000));
- MSG(MYVTKDEBUG,"GetMeshOnEntity - GetCellLocationsArray() = "<<float(aDataSet->GetCellLocationsArray()->GetActualMemorySize()*1000));
- aDataSet->BuildLinks();
- MSG(MYVTKDEBUG,"GetMeshOnEntity - GetCellLinks() = "<<float(aDataSet->GetCellLinks()->GetActualMemorySize()*1000));
- MSG(MYVTKDEBUG,"GetMeshOnEntity - GetActualMemorySize() = "<<float(aDataSet->GetActualMemorySize()*1000));
+ aSource->Update();
+ BEGMSG(MYVTKDEBUG,"GetPoints() = "<<float(aSource->GetPoints()->GetActualMemorySize()*1000)<<endl);
+ BEGMSG(MYVTKDEBUG,"GetCells() = "<<float(aSource->GetCells()->GetActualMemorySize()*1000)<<endl);
+ BEGMSG(MYVTKDEBUG,"GetCellTypesArray() = "<<float(aSource->GetCellTypesArray()->GetActualMemorySize()*1000)<<endl);
+ BEGMSG(MYVTKDEBUG,"GetCellLocationsArray() = "<<float(aSource->GetCellLocationsArray()->GetActualMemorySize()*1000)<<endl);
+ aSource->BuildLinks();
+ BEGMSG(MYVTKDEBUG,"GetCellLinks() = "<<float(aSource->GetCellLinks()->GetActualMemorySize()*1000)<<endl);
+ BEGMSG(MYVTKDEBUG,"GetActualMemorySize() = "<<float(aSource->GetActualMemorySize()*1000)<<endl);
}
+
}catch(...){
- aSource = vtkSmartPointerBase();
throw;
}
+
return aSource.GetPointer();
}
VISU_Convertor::TOutput*
-VISU_Convertor_impl::GetMeshOnGroup(const string& theMeshName,
- const string& theGroupName)
+VISU_Convertor_impl
+::GetMeshOnGroup(const string& theMeshName,
+ const string& theGroupName)
{
MSG(MYDEBUG,"GetMeshOnGroup - theMeshName = '"<<theMeshName<<
"'; theGroupName = '"<<theGroupName<<"'");
PMeshImpl aMesh = boost::get<0>(aFindMeshOnGroup);
PGroupImpl aGroup = boost::get<1>(aFindMeshOnGroup);
const VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup->myFamilyAndEntitySet;
- VISU::TVTKSource& aSource = aGroup->myStorage;
//Main part of code
+ TVTKSource& aSource = aGroup->mySource;
try{
- if(aSource.GetPointer() == NULL){
- aSource = TOutput::New();
- aSource->Delete();
+ if(!aGroup->myIsInitialized){
LoadMeshOnGroup(aMesh,aFamilyAndEntitySet);
GetPoints(aSource,aMesh);
GetCellsOnGroup(aSource,aMesh,aFamilyAndEntitySet);
+
+ aGroup->myIsInitialized = true;
+
if(MYDEBUGWITHFILES){
string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
string aGroupName = QString(theGroupName.c_str()).simplifyWhiteSpace().latin1();
VISU::WriteToFile(aSource.GetPointer(),aFileName);
}
}
+
}catch(...){
- aSource = vtkSmartPointerBase();
throw;
}
+
return aSource.GetPointer();
}
-VISU_Convertor::TOutput*
-VISU_Convertor_impl::GetTimeStampOnMesh(const string& theMeshName,
- const VISU::TEntity& theEntity,
- const string& theFieldName,
- int theStampsNum)
+
+void
+GetCells(VISU::TVTKSource& theSource,
+ PSubProfileImpl theSubProfile,
+ PMeshOnEntityImpl theMeshOnEntity)
{
- MSG(MYDEBUG,"GetTimeStampOnMesh - theMeshName = '"<<theMeshName<<"; theEntity = "<<theEntity);
- MSG(MYDEBUG,"GetTimeStampOnMesh - theFieldName = '"<<theFieldName<<"'; theStampsNum = "<<theStampsNum);
+ vtkIdType aNbCells = theSubProfile->myNbCells;
+ vtkIdType aCellsSize = theSubProfile->myCellsSize;
+ vtkIdType aVGeom = theSubProfile->myGeom;
+ vtkIdType aNbNodes = VTKGeom2NbNodes(aVGeom);
+
+ const TSubMeshID& aSubMeshID = theSubProfile->mySubMeshID;
+ const TGeom2Cell2Connect& aGeom2Cell2Connect = theMeshOnEntity->myGeom2Cell2Connect;
+ TGeom2Cell2Connect::const_iterator aConnectIter = aGeom2Cell2Connect.find(aVGeom);
+ if(aConnectIter == aGeom2Cell2Connect.end())
+ EXCEPTION(runtime_error,"GetCells >> There is no elements for the GEOM("<<aVGeom<<")");
+
+ const TCell2Connect& aCell2Connect = aConnectIter->second;
+
+ vtkCellArray* aConnectivity = vtkCellArray::New();
+ aConnectivity->Allocate(aCellsSize,0);
+ vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
+ aCellTypesArray->SetNumberOfComponents(1);
+ aCellTypesArray->SetNumberOfTuples(aNbCells);
+
+ if(theSubProfile->myStatus == eAddAll){
+ VISU::TCell2Connect::const_iterator anIter = aCell2Connect.begin();
+ 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);
+ aConnId += aNbNodes;
+ anId++;
+ }
+ }else{
+ VISU::TSubMeshID::const_iterator anIter = aSubMeshID.begin();
+ for(vtkIdType anId = 0, aConnId = 0; anIter != aSubMeshID.end(); anIter++){
+ vtkIdType aSubId = *anIter;
+ const TConnect& anArray = aCell2Connect[aSubId];
+ PrintCells(aConnId,aConnectivity,anArray);
+ aCellTypesArray->SetValue(anId,(unsigned char)aVGeom);
+ aConnId += aNbNodes;
+ anId++;
+ }
+ }
+
+ vtkIdType *pts = 0, npts = 0;
+ vtkIntArray* aCellLocationsArray = vtkIntArray::New();
+
+ aCellLocationsArray->SetNumberOfComponents(1);
+ aCellLocationsArray->SetNumberOfTuples(aNbCells);
+ aConnectivity->InitTraversal();
+ for(int i=0; aConnectivity->GetNextCell(npts,pts); i++)
+ aCellLocationsArray->SetValue(i,aConnectivity->GetTraversalLocation(npts));
+ theSource->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
+
+ aCellLocationsArray->Delete();
+ aCellTypesArray->Delete();
+ aConnectivity->Delete();
+}
+
+
+void
+GetMeshOnSubProfile(PMeshImpl theMesh,
+ PMeshOnEntityImpl theMeshOnEntity,
+ PProfileImpl theProfile,
+ PSubProfileImpl theSubProfile)
+{
+ INITMSG(MYDEBUG,"GetMeshOnSubProfile"<<endl);
+
+ TVTKSource& aSource = theSubProfile->mySource;
+ if(theSubProfile->myIsInitialized)
+ return;
+
+ GetPoints(aSource,theMesh);
+ BEGMSG(MYDEBUG,"GetNumberOfPoints = "<<aSource->GetNumberOfPoints()<<endl);
+ GetCells(aSource,theSubProfile,theMeshOnEntity);
+ BEGMSG(MYDEBUG,"GetNumberOfCells - "<<aSource->GetNumberOfCells()<<endl);
+
+ theSubProfile->myIsInitialized = true;
+}
+
+void
+GetMeshOnProfile(PMeshImpl theMesh,
+ PMeshOnEntityImpl theMeshOnEntity,
+ PProfileImpl theProfile)
+{
+ if(theProfile->myIsInitialized)
+ return;
+
+ TVTKAppendFilter& anAppendFilter = theProfile->myAppendFilter;
+ if(theProfile->myIsAll){
+ TVTKSource& aSource = theMeshOnEntity->mySource;
+ anAppendFilter->AddInput(aSource.GetPointer());
+ }else{
+ const TGeom2SubProfile& aGeom2SubProfile = theProfile->myGeom2SubProfile;
+ TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
+ for(; anIter != aGeom2SubProfile.end(); anIter++){
+ PSubProfileImpl aSubProfile = anIter->second;
+ if(aSubProfile->myStatus == eRemoveAll)
+ continue;
+
+ GetMeshOnSubProfile(theMesh,
+ theMeshOnEntity,
+ theProfile,
+ aSubProfile);
+
+ TVTKSource& aSource = aSubProfile->mySource;
+ anAppendFilter->AddInput(aSource.GetPointer());
+ }
+ }
+ anAppendFilter->Update(); // Fix on VTK
+ theProfile->myIsInitialized = true;
+}
+
+
+VISU_Convertor::TOutput*
+VISU_Convertor_impl
+::GetTimeStampOnMesh(const string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const string& theFieldName,
+ int theStampsNum)
+{
+ INITMSG(MYDEBUG,"GetTimeStampOnMesh"<<
+ "; theMeshName = '"<<theMeshName<<"'"<<
+ "; theEntity = "<<theEntity<<
+ "; theFieldName = '"<<theFieldName<<"'"<<
+ "; theStampsNum = "<<theStampsNum<<
+ endl);
//Cheching possibility do the query
TFindTimeStamp aFindTimeStamp =
FindTimeStamp(theMeshName,theEntity,theFieldName,theStampsNum);
PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp);
PFieldImpl aField = boost::get<3>(aFindTimeStamp);
- VISU::TVTKAttribyteFilter& anAttribyteFilter = aValForTime->myAttribyteFilter;
- VISU::TVTKSource& aSource = aValForTime->myStorage;
- TOutput* anOutput = NULL;
//Main part of code
+ TVTKSource& aSource = aValForTime->mySource;
try{
- if(aSource.GetPointer())
- return aSource.GetPointer();
- else if(anAttribyteFilter.GetPointer())
- return anAttribyteFilter->GetUnstructuredGridOutput();
- else{
+ if(!aValForTime->myIsInitialized){
LoadFieldOnMesh(aMesh,aMeshOnEntity,aField,aValForTime);
- VISU::TVTKExtractFilter& anExtractFilter = aField->myExtractFilter;
- if(anExtractFilter.GetPointer() == NULL){
- anExtractFilter = VISU_ExtractUnstructuredGrid::New();
- anExtractFilter->Delete();
- //anExtractFilter->DebugOn();
- try{
- LoadMeshOnEntity(aVTKMeshOnEntity);
- }catch(std::exception& exc){
- aVTKMeshOnEntity = aMeshOnEntity;
- MSG(MYDEBUG,"Follow exception was occured :\n"<<exc.what());
- }catch(...){
- aVTKMeshOnEntity = aMeshOnEntity;
- MSG(MYDEBUG,"Unknown exception was occured!");
- }
- GetMeshOnEntity(aVTKMeshOnEntity->myMeshName,aVTKMeshOnEntity->myEntity);
-
- anExtractFilter->SetInput(aVTKMeshOnEntity->myStorage.GetPointer());
- ::InitProfile(anExtractFilter,aMeshOnEntity,aValForTime);
- }
- if(!anExtractFilter->IsRemoving()){
- aSource = TOutput::New();
- aSource->Delete();
- aSource->ShallowCopy(aVTKMeshOnEntity->myStorage.GetPointer());
- ::GetTimeStamp(aSource,aField,aValForTime);
- anOutput = aSource.GetPointer();
- }else{
- anAttribyteFilter = vtkFieldDataToAttributeDataFilter::New();
- anAttribyteFilter->Delete();
- //anAttribyteFilter->DebugOn();
-
- VISU::TVTKMergetFilter& aMergeFilter = aValForTime->myMergeFilter;
- aMergeFilter = vtkMergeDataObjectFilter::New();
- aMergeFilter->Delete();
- //aMergeFilter->DebugOn();
-
- ::GetTimeStamp(anAttribyteFilter,aMergeFilter,anExtractFilter,
- aField,aValForTime);
- anOutput = anAttribyteFilter->GetUnstructuredGridOutput();
+ try{
+ LoadMeshOnEntity(aVTKMeshOnEntity);
+ }catch(std::exception& exc){
+ aVTKMeshOnEntity = aMeshOnEntity;
+ MSG(MYDEBUG,"Follow exception was occured :\n"<<exc.what());
+ }catch(...){
+ aVTKMeshOnEntity = aMeshOnEntity;
+ MSG(MYDEBUG,"Unknown exception was occured!");
}
+
+ GetMeshOnEntity(aVTKMeshOnEntity->myMeshName,aVTKMeshOnEntity->myEntity);
+
+ PProfileImpl aProfile = aValForTime->myProfile;
+ GetMeshOnProfile(aMesh,aVTKMeshOnEntity,aProfile);
+
+ TVTKAppendFilter& anAppendFilter = aProfile->myAppendFilter;
+
+ aSource->ShallowCopy(anAppendFilter->GetOutput());
+ GetTimeStamp2(aSource,aField,aValForTime);
+
+ aValForTime->myIsInitialized = true;
+
if(MYDEBUGWITHFILES){
string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
string aFieldName = QString(theFieldName.c_str()).simplifyWhiteSpace().latin1();
string aPrefix = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
string aFileName = aPrefix + aMeshName + dtos("-%d-",int(theEntity)) +
aFieldName + dtos("-%d",theStampsNum) + "-Conv.vtk";
- VISU::WriteToFile(anOutput,aFileName);
+ VISU::WriteToFile(aSource.GetPointer(),aFileName);
}
if(MYVTKDEBUG){
GetTimeStampSize(theMeshName,theEntity,theFieldName,theStampsNum);
- vtkUnstructuredGrid *aDataSet = anAttribyteFilter->GetUnstructuredGridOutput();
- aDataSet->Update();
+ aSource->Update();
if(theEntity == VISU::NODE_ENTITY)
- MSG(MYVTKDEBUG,"GetTimeStampOnMesh - GetData() = "<<float(aDataSet->GetPointData()->GetActualMemorySize()*1000));
+ BEGMSG(MYVTKDEBUG,"GetPointData() = "<<float(aSource->GetPointData()->GetActualMemorySize()*1000)<<endl);
else
- MSG(MYVTKDEBUG,"GetMeshOnEntity - GetData() = "<<float(aDataSet->GetCellData()->GetActualMemorySize()*1000));
- MSG(MYVTKDEBUG,"GetTimeStampOnMesh - GetActualMemorySize() = "<<float(aDataSet->GetActualMemorySize()*1000));
+ BEGMSG(MYVTKDEBUG,"GetCellData() = "<<float(aSource->GetCellData()->GetActualMemorySize()*1000)<<endl);
+ BEGMSG(MYVTKDEBUG,"GetActualMemorySize() = "<<float(aSource->GetActualMemorySize()*1000)<<endl);
}
}
+ }catch(std::exception& exc){
+ throw;
}catch(...){
- aSource = vtkSmartPointerBase();
- anAttribyteFilter = vtkSmartPointerBase();
throw;
}
- return anOutput;
+
+ return aSource.GetPointer();
}
VISU::PMeshImpl
-VISU_Convertor_impl::FindMesh(const string& theMeshName)
+VISU_Convertor_impl
+::FindMesh(const string& theMeshName)
{
GetMeshMap();
TMeshMap::iterator aMeshMapIter = myMeshMap.find(theMeshName);
VISU_Convertor_impl::TFindMeshOnEntity
-VISU_Convertor_impl::FindMeshOnEntity(const string& theMeshName,
- const VISU::TEntity& theEntity,
- const string& theFamilyName)
+VISU_Convertor_impl
+::FindMeshOnEntity(const string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const string& theFamilyName)
{
PMeshImpl aMesh = FindMesh(theMeshName);
VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
}
-float VISU_Convertor_impl::GetSize() {
+float
+VISU_Convertor_impl
+::GetSize()
+{
float aResult = 0.0;
const VISU::TMeshMap& aMeshMap = GetMeshMap();
VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
}
-float VISU_Convertor_impl::GetMeshOnEntitySize(const std::string& theMeshName,
- const VISU::TEntity& theEntity,
- const std::string& theFamilyName)
+float
+VISU_Convertor_impl
+::GetMeshOnEntitySize(const std::string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const std::string& theFamilyName)
{
TFindMeshOnEntity aFindMeshOnEntity =
FindMeshOnEntity(theMeshName,theEntity,theFamilyName);
VISU_Convertor_impl::TFindMeshOnGroup
-VISU_Convertor_impl::FindMeshOnGroup(const std::string& theMeshName,
- const std::string& theGroupName)
+VISU_Convertor_impl
+::FindMeshOnGroup(const std::string& theMeshName,
+ const std::string& theGroupName)
{
PMeshImpl aMesh = FindMesh(theMeshName);
VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
}
-float VISU_Convertor_impl::GetMeshOnGroupSize(const std::string& theMeshName,
- const std::string& theGroupName)
+float
+VISU_Convertor_impl
+::GetMeshOnGroupSize(const std::string& theMeshName,
+ const std::string& theGroupName)
{
TFindMeshOnGroup aFindMeshOnGroup = FindMeshOnGroup(theMeshName,theGroupName);
PMeshImpl aMesh = boost::get<0>(aFindMeshOnGroup);
return aResult;
}
+
VISU_Convertor_impl::TFindField
-VISU_Convertor_impl::FindField(const string& theMeshName,
- const VISU::TEntity& theEntity,
- const string& theFieldName)
+VISU_Convertor_impl
+::FindField(const string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const string& theFieldName)
{
TFindMeshOnEntity aFindMeshOnEntity = FindMeshOnEntity(theMeshName,theEntity,"");
PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);;
}
-float VISU_Convertor_impl::GetFieldOnMeshSize(const std::string& theMeshName,
- const VISU::TEntity& theEntity,
- const std::string& theFieldName)
+float
+VISU_Convertor_impl
+::GetFieldOnMeshSize(const std::string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const std::string& theFieldName)
{
TFindField aFindField = FindField(theMeshName,theEntity,theFieldName);
PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindField);
- PField aField = boost::get<3>(aFindField);
+ PFieldImpl aField = boost::get<3>(aFindField);
float aMeshSize = GetMeshOnEntitySize(theMeshName,aVTKMeshOnEntity->myEntity);
float aFieldOnMeshSize = float(aField->myDataSize*sizeof(float)*aField->myValField.size()*ERR_SIZE_CALC);
VISU_Convertor_impl::TFindTimeStamp
-VISU_Convertor_impl::FindTimeStamp(const std::string& theMeshName,
- const VISU::TEntity& theEntity,
- const std::string& theFieldName,
- int theStampsNum)
+VISU_Convertor_impl
+::FindTimeStamp(const std::string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const std::string& theFieldName,
+ int theStampsNum)
{
TFindField aFindField = FindField(theMeshName,theEntity,theFieldName);
PField aField = boost::get<3>(aFindField);
}
-float VISU_Convertor_impl::GetTimeStampSize(const std::string& theMeshName,
- const VISU::TEntity& theEntity,
- const std::string& theFieldName,
- int theStampsNum)
+float
+VISU_Convertor_impl
+::GetTimeStampSize(const std::string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const std::string& theFieldName,
+ int theStampsNum)
{
TFindTimeStamp aFindTimeStamp =
FindTimeStamp(theMeshName,theEntity,theFieldName,theStampsNum);
PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindTimeStamp);
- PField aField = boost::get<3>(aFindTimeStamp);
+ PFieldImpl aField = boost::get<3>(aFindTimeStamp);
float aMeshSize = GetMeshOnEntitySize(theMeshName,aVTKMeshOnEntity->myEntity);
float aTimeStampSize = float(aField->myDataSize*sizeof(float) * ERR_SIZE_CALC);
const VISU::PField
-VISU_Convertor_impl::GetField(const string& theMeshName,
- VISU::TEntity theEntity,
- const string& theFieldName)
+VISU_Convertor_impl
+::GetField(const string& theMeshName,
+ VISU::TEntity theEntity,
+ const string& theFieldName)
{
TFindField aFindField = FindField(theMeshName,theEntity,theFieldName);
PField aField = boost::get<3>(aFindField);
const VISU::PValForTime
-VISU_Convertor_impl::GetTimeStamp(const std::string& theMeshName,
- const VISU::TEntity& theEntity,
- const std::string& theFieldName,
- int theStampsNum)
+VISU_Convertor_impl
+::GetTimeStamp(const std::string& theMeshName,
+ const VISU::TEntity& theEntity,
+ const std::string& theFieldName,
+ int theStampsNum)
{
TFindTimeStamp aFindTimeStamp =
FindTimeStamp(theMeshName,theEntity,theFieldName,theStampsNum);
#include <vtkSystemIncludes.h>
-#include <vtkPoints.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkMergeDataObjectFilter.h>
-#include <vtkFieldDataToAttributeDataFilter.h>
-#include "VISU_ExtractUnstructuredGrid.hxx"
-
-#include <qstring.h>
-#include <qfileinfo.h>
-
#include <vtkSmartPointer.h>
#include <boost/tuple/tuple.hpp>
-namespace VISU{
+class vtkPoints;
+class vtkAppendFilter;
+class vtkUnstructuredGrid;
+
+namespace VISU
+{
typedef vtkSmartPointer<vtkPoints> TVTKPoints;
typedef vtkSmartPointer<vtkUnstructuredGrid> TVTKSource;
- typedef vtkSmartPointer<vtkMergeDataObjectFilter> TVTKMergetFilter;
- typedef vtkSmartPointer<VISU_ExtractUnstructuredGrid> TVTKExtractFilter;
- typedef vtkSmartPointer<vtkFieldDataToAttributeDataFilter> TVTKAttribyteFilter;
+ typedef vtkSmartPointer<vtkAppendFilter> TVTKAppendFilter;
typedef float TCoord;
- struct TMeshImpl: TMesh{
- TVTKPoints myPoints;
+ //---------------------------------------------------------------
+ struct TSource: virtual TBaseStructure
+ {
+ TSource();
+
+ vtkIdType myNbCells;
+ vtkIdType myCellsSize;
+
+ TVTKSource mySource;
+ bool myIsInitialized;
+ };
+
+
+ struct TIntId: virtual TBaseStructure
+ {
+ vtkIdType myId;
+
+ TIntId(): myId(0)
+ {}
+ };
+
+ //---------------------------------------------------------------
+ struct TMeshImpl: virtual TMesh
+ {
typedef std::vector<TCoord> TPointsCoord;
TPointsCoord myPointsCoord;
typedef std::vector<std::string> TPointsDim;
TPointsDim myPointsDim;
+
+ TVTKPoints myPoints;
+ bool myIsInitialized;
+ vtkIdType myNbPoints;
+
+ TMeshImpl();
};
- typedef shared_ptr<TMeshImpl> PMeshImpl;
-
- struct TMeshOnEntityImpl: TMeshOnEntity{
- TVTKSource myStorage;
- typedef std::vector<vtkIdType> TConnect;
- typedef std::vector<TConnect> TConnForCellType;
- typedef std::map<vtkIdType,TConnForCellType> TCellsConn;
- TCellsConn myCellsConn;
+ typedef SharedPtr<TMeshImpl> PMeshImpl;
+
+
+ //---------------------------------------------------------------
+ typedef std::vector<vtkIdType> TSubMeshID;
+ typedef std::map<vtkIdType,TSubMeshID> TGeom2SubMeshID;
+ typedef enum {eRemoveAll, eAddAll, eAddPart, eNone} ESubMeshStatus;
+
+ struct TSubProfileImpl: virtual TSubProfile, virtual TSource
+ {
+ TSubProfileImpl();
+
+ vtkIdType myGeom;
+ std::string myName;
+
+ ESubMeshStatus myStatus;
+ TSubMeshID mySubMeshID;
};
- typedef shared_ptr<TMeshOnEntityImpl> PMeshOnEntityImpl;
+ typedef SharedPtr<TSubProfileImpl> PSubProfileImpl;
+
- struct TFamilyImpl: TFamily{
- TVTKSource myStorage;
+ //---------------------------------------------------------------
+ typedef std::map<vtkIdType,PSubProfile> TGeom2SubProfile;
+ struct TProfileImpl: virtual TProfile
+ {
+ TProfileImpl();
- typedef std::set<vtkIdType> TSubMeshOnCellType;
- typedef std::map<vtkIdType,TSubMeshOnCellType> TSubMesh;
- TSubMesh mySubMesh;
+ vtkIdType myNbCells;
+ vtkIdType myCellsSize;
+
+ bool myIsAll;
+ bool myIsInitialized;
+ TVTKAppendFilter myAppendFilter;
+ TGeom2SubProfile myGeom2SubProfile;
};
- typedef shared_ptr<TFamilyImpl> PFamilyImpl;
+ typedef SharedPtr<TProfileImpl> PProfileImpl;
+
- struct TGroupImpl: TGroup{
- TVTKSource myStorage;
+ //---------------------------------------------------------------
+ typedef std::vector<vtkIdType> TConnect;
+ typedef std::vector<TConnect> TCell2Connect;
+ typedef std::map<vtkIdType,TCell2Connect> TGeom2Cell2Connect;
+
+ struct TMeshOnEntityImpl: virtual TMeshOnEntity, virtual TSource
+ {
+ TGeom2Cell2Connect myGeom2Cell2Connect;
+
+ std::pair<int,int>
+ GetCellsDims(const std::string& theFamilyName = "") const;
+ };
+ typedef SharedPtr<TMeshOnEntityImpl> PMeshOnEntityImpl;
+
+
+ //---------------------------------------------------------------
+ struct TFamilyImpl: virtual TFamily, virtual TSource, virtual TIntId
+ {
+ TGeom2SubMeshID myGeom2SubMeshID;
+ };
+ typedef SharedPtr<TFamilyImpl> PFamilyImpl;
+
+
+ //---------------------------------------------------------------
+ struct TGroupImpl: virtual TGroup, virtual TSource
+ {
+ };
+ typedef SharedPtr<TGroupImpl> PGroupImpl;
+
+
+ //---------------------------------------------------------------
+ struct TFieldImpl: virtual TField, virtual TIntId
+ {
+ vtkIdType myDataSize;
+
+ TFieldImpl(): myDataSize(0)
+ {}
};
- typedef shared_ptr<TGroupImpl> PGroupImpl;
-
- struct TFieldImpl: TField{
- TVTKExtractFilter myExtractFilter;
- ~TFieldImpl()
- {
- if(myExtractFilter.GetPointer())
- myExtractFilter->UnRegisterAllOutputs();
- }
+ typedef SharedPtr<TFieldImpl> PFieldImpl;
+
+
+ //---------------------------------------------------------------
+ struct TGaussImpl: virtual TGauss
+ {
+ vtkIdType myNbPts;
};
- typedef shared_ptr<TFieldImpl> PFieldImpl;
+ typedef SharedPtr<TGaussImpl> PGaussImpl;
- struct TValForTimeImpl: TValForTime{
- TVTKAttribyteFilter myAttribyteFilter;
- TVTKMergetFilter myMergeFilter;
- TVTKSource myStorage;
- typedef std::vector<float> TValForCellsWithType;
- typedef std::map<vtkIdType,TValForCellsWithType> TValForCells;
+ //---------------------------------------------------------------
+ typedef std::vector<float> TValForCellsWithType;
+ typedef std::map<vtkIdType,TValForCellsWithType> TValForCells;
+
+ struct TValForTimeImpl: virtual TValForTime, virtual TSource, virtual TIntId
+ {
TValForCells myValForCells;
- ~TValForTimeImpl()
- {
- if(myMergeFilter.GetPointer())
- myMergeFilter->UnRegisterAllOutputs();
- if(myAttribyteFilter.GetPointer())
- myAttribyteFilter->UnRegisterAllOutputs();
- }
+ int
+ GetNbGauss(vtkIdType theGeom) const;
+ int myNbGauss;
};
- typedef shared_ptr<TValForTimeImpl> PValForTimeImpl;
+ typedef SharedPtr<TValForTimeImpl> PValForTimeImpl;
+ vtkIdType
+ VTKGeom2NbNodes(vtkIdType theGeom);
}
-class VISU_Convertor_impl: public VISU_Convertor{
+
+class VISU_Convertor_impl: public VISU_Convertor
+{
public:
- virtual float GetSize() ;
+ virtual
+ float
+ GetSize();
virtual
float
public:
VISU_Convertor_impl();
- virtual ~VISU_Convertor_impl();
+ virtual
+ ~VISU_Convertor_impl();
- virtual VISU_Convertor* Build() { return this;};
+ virtual
+ VISU_Convertor* Build() { return this;};
virtual
TOutput*
int theStampsNum);
protected:
- virtual int LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity,
- const std::string& theFamilyName = "") = 0;
+ virtual
+ int
+ LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity,
+ const std::string& theFamilyName = "") = 0;
- virtual int LoadMeshOnGroup(VISU::PMeshImpl theMesh,
- const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet) = 0;
+ virtual
+ int
+ LoadMeshOnGroup(VISU::PMeshImpl theMesh,
+ const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet) = 0;
- virtual int LoadFieldOnMesh(VISU::PMeshImpl theMesh,
- VISU::PMeshOnEntityImpl theMeshOnEntity,
- VISU::PFieldImpl theField,
- VISU::PValForTimeImpl theValForTime) = 0;
+ virtual
+ int
+ LoadFieldOnMesh(VISU::PMeshImpl theMesh,
+ VISU::PMeshOnEntityImpl theMeshOnEntity,
+ VISU::PFieldImpl theField,
+ VISU::PValForTimeImpl theValForTime) = 0;
};
#endif
using namespace MED;
using namespace VISU;
- int MEDGeom2NbNodes(MED::EGeometrieElement theMEDGeomType)
+
+ int
+ MEDGeom2NbNodes(MED::EGeometrieElement theMEDGeomType)
{
return theMEDGeomType % 100;
}
- int MEDGeomToVTK(MED::EGeometrieElement theMEDGeomType)
+
+ int
+ MEDGeomToVTK(MED::EGeometrieElement theMEDGeomType)
{
switch(theMEDGeomType){
case ePOINT1: return VTK_VERTEX;
return -1;
}
- int VTKGeom2NbNodes(int theVTKGeomType)
- {
- switch(theVTKGeomType){
- case VTK_VERTEX: return 1;
- case VTK_LINE: return 2;
- case VTK_TRIANGLE: return 3;
- case VTK_QUAD: return 4;
- case VTK_TETRA: return 4;
- case VTK_HEXAHEDRON: return 8;
- case VTK_WEDGE: return 6;
- case VTK_PYRAMID: return 5;
- }
- return -1;
- }
- MED::EGeometrieElement VTKGeomToMED(int theVTKGeomType)
+ MED::EGeometrieElement
+ VTKGeomToMED(int theVTKGeomType)
{
switch(theVTKGeomType){
case VTK_VERTEX: return ePOINT1;
return EGeometrieElement(-1);
}
- TEntity MEDEntityToVTK(MED::EEntiteMaillage theMEDEntity)
+
+ TEntity
+ MEDEntityToVTK(MED::EEntiteMaillage theMEDEntity)
{
switch(theMEDEntity){
case eNOEUD: return NODE_ENTITY;
return TEntity(-1);
}
- MED::EEntiteMaillage VTKEntityToMED(TEntity theVTKEntity)
+
+ MED::EEntiteMaillage
+ VTKEntityToMED(TEntity theVTKEntity)
{
switch(theVTKEntity){
case NODE_ENTITY: return eNOEUD;
return MED::EEntiteMaillage(-1);
}
+
+ 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++){
+ MED::EGeometrieElement aMGeom = anIter->first;
+ 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);
+ if(aTimeStampIter == theGeom2Size.end())
+ aSubProfile->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;
+ }
+ }
+ aSubProfile->myCellsSize = aSubProfile->myNbCells*aVNbNodes;
+
+ INITMSG(MYDEBUG,"aVGeom = "<<aVGeom<<
+ "; aNbCells = "<<aSubProfile->myNbCells<<
+ "; aCellsSize = "<<aSubProfile->myCellsSize<<
+ "; aStatus = "<<aSubProfile->myStatus<<
+ "; aName = '"<<aSubProfile->myName<<"'"<<
+ endl);
+
+ aProfileKey.insert(aSubProfile);
+ }
+
+ return aProfileKey;
+ }
+
+
+ void
+ InitProfile(MED::TTimeStampVal& theTimeStampVal,
+ VISU::TMEDValForTime& theValForTime,
+ VISU::TMEDMeshOnEntity& theMeshOnEntity,
+ const MED::TGeom2Size& theGeom2Size)
+ {
+ 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;
+ }
+ }
+
}
extern "C"
-VISU_Convertor* CreateConvertor(const string& theFileName)
+VISU_Convertor*
+CreateConvertor(const string& theFileName)
{
return new VISU_MedConvertor(theFileName);
}
-VISU_MedConvertor::VISU_MedConvertor(const string& theFileName) {
+VISU_MedConvertor
+::VISU_MedConvertor(const string& theFileName)
+{
myFileInfo.setFile(QString(theFileName.c_str()));
myName = myFileInfo.baseName().latin1();
}
-VISU_Convertor* VISU_MedConvertor::Build() {
+VISU_Convertor*
+VISU_MedConvertor
+::Build()
+{
PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
+
+ TKey2Gauss aKey2Gauss = GetKey2Gauss(aMed);
+ TMKey2Profile aMKey2Profile = GetMKey2Profile(aMed);
+
TInt aNbMeshes = aMed->GetNbMeshes();
TMeshMap& aMeshMap = myMeshMap;
MSG(MYDEBUG,"VISU_MedConvertor::Build()");
INITMSG(MYDEBUG,"GetNbMeshes() = "<<aNbMeshes<<"\n");
- for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++)
+ for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
try{
- PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
-
- PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
-
- MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
-
- TElemGroup aElemGroup = GetElemsByEntity(aMed,aMeshInfo,aEntityInfo);
-
- TFamilyGroup aFamilyGroup = GetFamilies(aMed,aMeshInfo);
-
- TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,aElemGroup,aFamilyGroup);
-
- TGroupInfo aGroupInfo = GetFamiliesByGroup(aFamilyGroup);
-
- // creating TMesh structure and TMeshOnEntityMap
- typedef map<TInt,TInt> TFamilyCounterMap;
- TFamilyCounterMap aFamilyNbCellsCounterMap, aFamilyCellsSizeCounterMap;
-
- TInt aDim = aMeshInfo->GetDim();
- const string& aMeshName = aMeshInfo->GetName();
-
- PMEDMesh aMesh = aMeshMap[aMeshName](new TMEDMesh());
- aMesh->myDim = aDim;
- aMesh->myName = aMeshName;
- aMesh->myNbPoints = aNodeInfo->GetNbElem();
- aMesh->myMeshInfo = aMeshInfo;
- aMesh->myEntityInfo = aEntityInfo;
-
- INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<
- "'; myNbPoints = "<<aMesh->myNbPoints<<
- "; aDim = "<<aDim<<"\n");
-
- BEGMSG(MYDEBUG,"aEntityInfo.size() = "<<aEntityInfo.size()<<"\n");
-
- TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
- MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin();
- for(; anEntityIter != aEntityInfo.end(); anEntityIter++){
- const EEntiteMaillage& aMEntity = anEntityIter->first;
- const MED::TGeom& aTGeom = anEntityIter->second;
-
- TEntity aVEntity = MEDEntityToVTK(aMEntity);
- PMEDMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[aVEntity](new TMEDMeshOnEntity());
- aMeshOnEntity->myEntity = aVEntity;
- aMeshOnEntity->myMeshName = aMeshName;
- aMeshOnEntity->myGeom = aTGeom;
-
- INITMSG(MYDEBUG,"aMEntity = "<<aMEntity<<"; aVEntity = "<<aVEntity<<"\n");
-
- if(aMEntity == eNOEUD){
- aMeshOnEntity->myNbCells = aMesh->myNbPoints;
- aMeshOnEntity->myCellsSize = 2*aMesh->myNbPoints;
+ PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
+
+ PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
+
+ MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
+
+ TElemGroup aElemGroup = GetElemsByEntity(aMed,aMeshInfo,aEntityInfo);
+
+ TFamilyGroup aFamilyGroup = GetFamilies(aMed,aMeshInfo);
+
+ TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,aElemGroup,aFamilyGroup);
+
+ TGroupInfo aGroupInfo = GetFamiliesByGroup(aFamilyGroup);
+
+ // creating TMesh structure and TMeshOnEntityMap
+ typedef map<TInt,TInt> TFamilyCounterMap;
+ TFamilyCounterMap aFamilyNbCellsCounterMap, aFamilyCellsSizeCounterMap;
+
+ TInt aDim = aMeshInfo->GetDim();
+ const string& aMeshName = aMeshInfo->GetName();
+
+ PMEDMesh aMesh = aMeshMap[aMeshName](new TMEDMesh());
+ aMesh->myDim = aDim;
+ aMesh->myName = aMeshName;
+ aMesh->myNbPoints = aNodeInfo->GetNbElem();
+ aMesh->myMeshInfo = aMeshInfo;
+ aMesh->myEntityInfo = aEntityInfo;
+
+ INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<
+ "'; myNbPoints = "<<aMesh->myNbPoints<<
+ "; aDim = "<<aDim<<"\n");
+
+ BEGMSG(MYDEBUG,"aEntityInfo.size() = "<<aEntityInfo.size()<<"\n");
+
+ TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+ MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin();
+ for(; anEntityIter != aEntityInfo.end(); anEntityIter++){
+ const EEntiteMaillage& aMEntity = anEntityIter->first;
+ const MED::TGeom2Size& aGeom2Size = anEntityIter->second;
- for(TInt iElem = 0; iElem < aMesh->myNbPoints; iElem++){
- TInt aFamId = aNodeInfo->GetFamNum(iElem);
- if(aFamId != 0){
- aFamilyNbCellsCounterMap[aFamId] += 1;
- aFamilyCellsSizeCounterMap[aFamId] += 2;
+ TEntity aVEntity = MEDEntityToVTK(aMEntity);
+ PMEDMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[aVEntity](new TMEDMeshOnEntity());
+ aMeshOnEntity->myEntity = aVEntity;
+ aMeshOnEntity->myMeshName = aMeshName;
+ aMeshOnEntity->myGeom2Size = aGeom2Size;
+
+ INITMSG(MYDEBUG,"aMEntity = "<<aMEntity<<
+ "; aVEntity = "<<aVEntity<<
+ endl);
+
+ if(aMEntity == eNOEUD){
+ aMeshOnEntity->myNbCells = aMesh->myNbPoints;
+ aMeshOnEntity->myCellsSize = 2*aMesh->myNbPoints;
+
+ for(TInt iElem = 0; iElem < aMesh->myNbPoints; iElem++){
+ TInt aFamId = aNodeInfo->GetFamNum(iElem);
+ if(aFamId != 0){
+ aFamilyNbCellsCounterMap[aFamId] += 1;
+ aFamilyCellsSizeCounterMap[aFamId] += 2;
+ }
}
- }
-
- INITMSG(MYDEBUG,"myNbCells = "<<aMeshOnEntity->myNbCells<<
- "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<"\n");;
-
- }else{
- MED::TGeom::const_iterator anTGeomIter = aTGeom.begin();
- aMeshOnEntity->myNbCells = 0;
- aMeshOnEntity->myCellsSize = 0;
- for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
- const EGeometrieElement& aGeom = anTGeomIter->first;
-
- switch(aGeom){
- case ePOLYGONE:
- {
- PPolygoneInfo aPolygoneInfo = aMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aGeom);
+
+ INITMSG(MYDEBUG,"myNbCells = "<<aMeshOnEntity->myNbCells<<
+ "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
+ endl);;
+
+ }else{
+ MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
+ aMeshOnEntity->myNbCells = 0;
+ aMeshOnEntity->myCellsSize = 0;
+ for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
+ const EGeometrieElement& aMGeom = aGeom2SizeIter->first;
+
+ switch(aMGeom){
+ case ePOLYGONE: {
+ PPolygoneInfo aPolygoneInfo = aMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
TInt aNbElem = aPolygoneInfo->GetNbElem();
TElemNum aConn = aPolygoneInfo->GetConnectivite();
TElemNum aIndex = aPolygoneInfo->GetIndex();
TInt aNbIndex = aIndex.size();
TInt aNbConn = aConn.size();
-
- aMeshOnEntity->myNbCells += aNbElem;
- for (int ii = 0; ii<aNbElem ; ii++){
+ aMeshOnEntity->myNbCells += aNbElem;
+
+ for (int ii = 0; ii<aNbElem ; ii++){
int aNbConnii = aPolygoneInfo->GetNbConn(ii);
- aMeshOnEntity->myCellsSize += aNbConnii;
- }
- INITMSG(MYDEBUG,"aGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<
- "; myNbPolygones = "<<aNbElem<<
- "; nbConn= "<<aNbConn<<"\n");
+ aMeshOnEntity->myCellsSize += aNbConnii;
+ }
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- TInt aFamId = aPolygoneInfo->GetFamNum(iElem);
- if(aFamId != 0){
- aFamilyNbCellsCounterMap[aFamId] += 1;
- ADDMSG(MYDEBUG,"aFamId="<<aFamId<<" ");
- aFamilyCellsSizeCounterMap[aFamId] += aPolygoneInfo->GetNbConn(iElem) + 1;
- }
- }
+ INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<
+ "; aNbElem = "<<aNbElem<<
+ "; aNbConn= "<<aNbConn<<
+ endl);
+
+ for(TInt iElem = 0; iElem < aNbElem; iElem++){
+ TInt aFamId = aPolygoneInfo->GetFamNum(iElem);
+ if(aFamId != 0){
+ aFamilyNbCellsCounterMap[aFamId] += 1;
+ aFamilyCellsSizeCounterMap[aFamId] += aPolygoneInfo->GetNbConn(iElem) + 1;
+ }
+ }
ADDMSG(MYDEBUG,endl);
break;
}
- case ePOLYEDRE:
- {
- PPolyedreInfo aPolyedreInfo = aMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aGeom);
+ case ePOLYEDRE: {
+ PPolyedreInfo aPolyedreInfo = aMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
TInt aNbElem = aPolyedreInfo->GetNbElem();
TElemNum aConn = aPolyedreInfo->GetConnectivite();
TElemNum aIndex = aPolyedreInfo->GetIndex();
TInt aNbIndex = aIndex.size();
TInt aNbConn = aConn.size();
-
- aMeshOnEntity->myNbCells += aNbElem;
- for (int ii = 0; ii<aNbElem ; ii++){
+ aMeshOnEntity->myNbCells += aNbElem;
+
+ for (int ii = 0; ii<aNbElem ; ii++){
int aNbConnii = aPolyedreInfo->GetNbConn(ii);
- aMeshOnEntity->myCellsSize += aNbConnii;
- }
- INITMSG(MYDEBUG,"aGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<
- "; myNbPolyedres = "<<aNbElem<<
- "; nbConn= "<<aNbConn<<"\n");
+ aMeshOnEntity->myCellsSize += aNbConnii;
+ }
+ INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<
+ "; aNbElem = "<<aNbElem<<
+ "; aNbConn= "<<aNbConn<<
+ endl);
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- TInt aFamId = aPolyedreInfo->GetFamNum(iElem);
- std::string aName = aPolyedreInfo->GetElemName(iElem);
- if(aFamId != 0){
- aFamilyNbCellsCounterMap[aFamId] += 1;
- ADDMSG(MYDEBUG,"(aFamId="<<aFamId<<";Name='"<<aName<<"') ");
- aFamilyCellsSizeCounterMap[aFamId] += aPolyedreInfo->GetNbConn(iElem) + 1;
- }
- }
+ for(TInt iElem = 0; iElem < aNbElem; iElem++){
+ TInt aFamId = aPolyedreInfo->GetFamNum(iElem);
+ if(aFamId != 0){
+ aFamilyNbCellsCounterMap[aFamId] += 1;
+ aFamilyCellsSizeCounterMap[aFamId] += aPolyedreInfo->GetNbConn(iElem) + 1;
+ }
+ }
ADDMSG(MYDEBUG,endl);
break;
}
- default:
- {
- int aVNbNodes = VTKGeom2NbNodes(MEDGeomToVTK(aGeom));
- PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,aMEntity,aGeom);
+ default: {
+ vtkIdType aVGeom = MEDGeomToVTK(aMGeom);
+ int aVNbNodes = VTKGeom2NbNodes(aVGeom);
+ PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
TInt aNbElem = aCellInfo->GetNbElem();
aMeshOnEntity->myNbCells += aNbElem;
aMeshOnEntity->myCellsSize += aNbElem*(aVNbNodes+1);
- INITMSG(MYDEBUG,"aGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<
+ INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<
+ "; aNbElem = "<<aNbElem<<
"; myNbCells = "<<aMeshOnEntity->myNbCells<<
- "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<"\n");
+ "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
+ endl);
for(TInt iElem = 0; iElem < aNbElem; iElem++){
TInt aFamId = aCellInfo->GetFamNum(iElem);
if(aFamId != 0){
aFamilyNbCellsCounterMap[aFamId] += 1;
- ADDMSG(MYDEBUG,"aFamId = "<<aFamId<<" ");
aFamilyCellsSizeCounterMap[aFamId] += aVNbNodes + 1;
}
}
ADDMSG(MYDEBUG,endl);
}
- } // end switch(...)
+ } // end switch(...)
+ }
}
}
- }
-
- TFamilyByEntity::const_iterator aFamilyByEntityIter = aFamilyByEntity.begin();
- BEGMSG(MYDEBUG,"TFamilyByEntity:\n");
- for(; aFamilyByEntityIter != aFamilyByEntity.end(); aFamilyByEntityIter++){
- const EEntiteMaillage& aMEntity = aFamilyByEntityIter->first;
- const TFamilyGroup& aFamilyGroup = aFamilyByEntityIter->second;
-
- TEntity aVEntity = MEDEntityToVTK(aMEntity);
- VISU::PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
- VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
- if(aFamilyGroup.empty())
- continue;
-
- INITMSG(MYDEBUG,"aMEntity = "<<aMEntity<<"; aVEntity = "<<aVEntity<<"\n");
- TFamilyGroup::const_iterator aFamilyGroupIter = aFamilyGroup.begin();
- for(; aFamilyGroupIter != aFamilyGroup.end(); aFamilyGroupIter++){
- const PFamilyInfo& aFamilyInfo = *aFamilyGroupIter;
- if (aFamilyInfo->GetId() == 0)
- continue;
-
- const std::string& aFamilyName = aFamilyInfo->GetName();
- PMEDFamily aFamily = aFamilyMap[aFamilyName](new TMEDFamily());
+ TFamilyByEntity::const_iterator aFamilyByEntityIter = aFamilyByEntity.begin();
+ BEGMSG(MYDEBUG,"TFamilyByEntity:\n");
+ for(; aFamilyByEntityIter != aFamilyByEntity.end(); aFamilyByEntityIter++){
+ const EEntiteMaillage& aMEntity = aFamilyByEntityIter->first;
+ const TFamilyGroup& aFamilyGroup = aFamilyByEntityIter->second;
- aFamily->myId = aFamilyInfo->GetId();
- aFamily->myName = aFamilyInfo->GetName();
- aFamily->myEntity = aVEntity;
- aFamily->myNbCells = aFamilyNbCellsCounterMap[aFamily->myId];
- aFamily->myCellsSize = aFamilyCellsSizeCounterMap[aFamily->myId];
+ TEntity aVEntity = MEDEntityToVTK(aMEntity);
+ VISU::PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
+ VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+
+ if(aFamilyGroup.empty())
+ continue;
- INITMSG(MYDEBUG,"aFamilyName = '"<<aFamily->myName<<
- "'; myId = "<<aFamily->myId<<"; "<<
- "; aNbAttr = "<<aFamilyInfo->GetNbAttr()<<
- "; aNbGroup = "<<aFamilyInfo->GetNbGroup()<<
- "; myEntity = "<<aFamily->myEntity<<
- "; myNbCells = "<<aFamily->myNbCells<<
- "; myCellsSize = "<<aFamily->myCellsSize<<"\n");
-
- VISU::TBindGroups& aBindGroups = aFamily->myGroups;
- const TInt aNbGroup = aFamilyInfo->GetNbGroup();
- for(TInt i = 0; i < aNbGroup; i++){
- const string& aGroupName = aFamilyInfo->GetGroupName(i);
- aBindGroups.insert(aGroupName);
- INITMSG(MYDEBUG,"aGroupName = '"<<aGroupName<<"'\n");
+ INITMSG(MYDEBUG,"aMEntity = "<<aMEntity<<"; aVEntity = "<<aVEntity<<"\n");
+ TFamilyGroup::const_iterator aFamilyGroupIter = aFamilyGroup.begin();
+ for(; aFamilyGroupIter != aFamilyGroup.end(); aFamilyGroupIter++){
+ const PFamilyInfo& aFamilyInfo = *aFamilyGroupIter;
+ if (aFamilyInfo->GetId() == 0)
+ continue;
+
+ const std::string& aFamilyName = aFamilyInfo->GetName();
+ PMEDFamily aFamily = aFamilyMap[aFamilyName](new TMEDFamily());
+
+ aFamily->myId = aFamilyInfo->GetId();
+ aFamily->myName = aFamilyInfo->GetName();
+ aFamily->myEntity = aVEntity;
+ aFamily->myNbCells = aFamilyNbCellsCounterMap[aFamily->myId];
+ aFamily->myCellsSize = aFamilyCellsSizeCounterMap[aFamily->myId];
+
+ INITMSG(MYDEBUG,"aFamilyName = '"<<aFamily->myName<<
+ "'; myId = "<<aFamily->myId<<"; "<<
+ "; aNbAttr = "<<aFamilyInfo->GetNbAttr()<<
+ "; aNbGroup = "<<aFamilyInfo->GetNbGroup()<<
+ "; myEntity = "<<aFamily->myEntity<<
+ "; myNbCells = "<<aFamily->myNbCells<<
+ "; myCellsSize = "<<aFamily->myCellsSize<<"\n");
+
+ VISU::TBindGroups& aBindGroups = aFamily->myGroups;
+ const TInt aNbGroup = aFamilyInfo->GetNbGroup();
+ for(TInt i = 0; i < aNbGroup; i++){
+ const string& aGroupName = aFamilyInfo->GetGroupName(i);
+ aBindGroups.insert(aGroupName);
+ INITMSG(MYDEBUG,"aGroupName = '"<<aGroupName<<"'\n");
+ }
}
}
- }
-
- BEGMSG(MYDEBUG,"VISU::TGroup:\n");
-
- VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
- TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin();
- for(;aGroupInfoIter != aGroupInfo.end(); aGroupInfoIter++){
- const string& aGroupName = aGroupInfoIter->first;
- const TFamilyGroup& aFamilyGroup = aGroupInfoIter->second;
- PMEDGroup aGroup(new TMEDGroup());
- aGroup->myName = aGroupName;
- aGroup->myMeshName = aMesh->myName;
-
- INITMSG(MYDEBUG,"aGroup->myName = '"<<aGroup->myName<<"'\n");
-
- TFamilyGroup::const_iterator aFamilyIter = aFamilyGroup.begin();
- for(; aFamilyIter != aFamilyGroup.end(); aFamilyIter++){
- const PFamilyInfo& aFamilyInfo = *aFamilyIter;
- const string& aFamilyName = aFamilyInfo->GetName();
-
- TEntity aVEntity = TEntity(-1);
- PFamily aFamily;
-
- // Find aVisuEntity
- const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->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 string& aName = aFamilyMapIter->first;
- aFamily = aFamilyMapIter->second;
- if(aName == aFamilyName){
- aVEntity = aFamily->myEntity;
- goto exit_lable;
+
+ BEGMSG(MYDEBUG,"VISU::TGroup:\n");
+
+ VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
+ TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin();
+ for(;aGroupInfoIter != aGroupInfo.end(); aGroupInfoIter++){
+ const string& aGroupName = aGroupInfoIter->first;
+ const TFamilyGroup& aFamilyGroup = aGroupInfoIter->second;
+ PMEDGroup aGroup(new TMEDGroup());
+ aGroup->myName = aGroupName;
+ aGroup->myMeshName = aMesh->myName;
+
+ INITMSG(MYDEBUG,"aGroup->myName = '"<<aGroup->myName<<"'\n");
+
+ TFamilyGroup::const_iterator aFamilyIter = aFamilyGroup.begin();
+ for(; aFamilyIter != aFamilyGroup.end(); aFamilyIter++){
+ const PFamilyInfo& aFamilyInfo = *aFamilyIter;
+ const string& aFamilyName = aFamilyInfo->GetName();
+
+ TEntity aVEntity = TEntity(-1);
+ PMEDFamily aFamily;
+
+ // Find aVisuEntity
+ const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->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 string& aName = aFamilyMapIter->first;
+ aFamily = aFamilyMapIter->second;
+ if(aName == aFamilyName){
+ aVEntity = aFamily->myEntity;
+ goto exit_lable;
+ }
}
}
+ exit_lable:
+ if(aFamily && aVEntity >= 0){
+ aGroup->myFamilyAndEntitySet.insert(TFamilyAndEntity(aFamilyName,aVEntity));
+ INITMSG(MYDEBUG,"aFamilyName = '"<<aFamilyName<<"'; '"<<aFamily->myName<<"'; aVEntity = "<<aVEntity<<"\n");
+
+ aGroup->myNbCells += aFamily->myNbCells;
+ aGroup->myCellsSize += aFamily->myCellsSize;
+ }
}
- exit_lable:
- if(aFamily && aVEntity >= 0){
- aGroup->myFamilyAndEntitySet.insert(TFamilyAndEntity(aFamilyName,aVEntity));
- INITMSG(MYDEBUG,"aFamilyName = '"<<aFamilyName<<"'; '"<<aFamily->myName<<"'; aVEntity = "<<aVEntity<<"\n");
-
- aGroup->myNbCells += aFamily->myNbCells;
- aGroup->myCellsSize += aFamily->myCellsSize;
+ if(!aGroup->myFamilyAndEntitySet.empty() && aGroup->myNbCells > 0){
+ BEGMSG(MYDEBUG,"myNbCells = "<<aGroup->myNbCells<<
+ "; myCellsSize = "<<aGroup->myCellsSize<<"\n\n");
+ aGroupMap.insert(VISU::TGroupMap::value_type(aGroupName,aGroup));
}
}
- if(!aGroup->myFamilyAndEntitySet.empty() && aGroup->myNbCells > 0){
- BEGMSG(MYDEBUG,"myNbCells = "<<aGroup->myNbCells<<
- "; myCellsSize = "<<aGroup->myCellsSize<<"\n\n");
- aGroupMap.insert(VISU::TGroupMap::value_type(aGroupName,aGroup));
- }
- }
-
- TInt aNbFields = aMed->GetNbFields();
- BEGMSG(MYDEBUG,"VISU::TField: NbFields="<<aNbFields<<"\n");
- for(TInt iField = 1; iField <= aNbFields; iField++){
- PFieldInfo aFieldInfo = aMed->GetPFieldInfo(aMeshInfo,iField);
- TInt aNbComp = aFieldInfo->GetNbComp();
- const string& aFieldName = aFieldInfo->GetName();
-
- MED::TGeom aTGeom;
- EEntiteMaillage aMEntity;
- TInt aNbTimeStamps = aMed->GetNbTimeStamps(aFieldInfo,aEntityInfo,aMEntity,aTGeom);
- if (aNbTimeStamps<1)
- continue;
- TEntity aVEntity = MEDEntityToVTK(aMEntity);
- VISU::PMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
- TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
- PMEDField aField = aFieldMap[aFieldName](new TMEDField());
- aField->myId = iField;
- aField->myNbComp = aNbComp;
- aField->myEntity = aVEntity;
- aField->myName = aFieldName;
- aField->myMeshName = aMeshName;
- aField->myDataSize = aMeshOnEntity->myNbCells * aNbComp;
- aField->myCompNames.resize(aNbComp);
- aField->myUnitNames.resize(aNbComp);
-
- INITMSG(MYDEBUG,"myName = '"<<aField->myName<<
- "'; myId = "<<aField->myId<<
- "; myEntity = "<<aField->myEntity<<
- "; myDataSize = "<<aField->myDataSize<<
- "; myNbComp = "<<aField->myNbComp<<"\n");
-
- for(TInt iComp = 0; iComp < aNbComp; iComp++){
- aField->myCompNames[iComp] = aFieldInfo->GetCompName(iComp);
- aField->myUnitNames[iComp] = aFieldInfo->GetUnitName(iComp);
- }
-
- for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
- PTimeStampInfo aTimeStamp = aMed->GetPTimeStampInfo(aFieldInfo,
- aMEntity,
- aTGeom,
- iTimeStamp);
- TFloat aDt = aTimeStamp->GetDt();
- const string& anUnitDt = aTimeStamp->GetUnitDt();
- PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStamp);
- 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->myNbComp = aField->myNbComp;
- aValForTime->myTime = VISU::TTime(aDt,anUnitDt);
- INITMSG(MYDEBUG,"aDt = "<<aDt<<", "<<anUnitDt<<"\n");
+
+ TInt aNbFields = aMed->GetNbFields();
+ BEGMSG(MYDEBUG,"TField: aNbFields = "<<aNbFields<<"\n");
+ for(TInt iField = 1; iField <= aNbFields; iField++){
+ PFieldInfo aFieldInfo = aMed->GetPFieldInfo(aMeshInfo,iField);
+ TInt aNbComp = aFieldInfo->GetNbComp();
+ const string& aFieldName = aFieldInfo->GetName();
+
+ MED::TGeom2Size aGeom2Size;
+ EEntiteMaillage aMEntity;
+ TInt aNbTimeStamps = aMed->GetNbTimeStamps(aFieldInfo,
+ aEntityInfo,
+ aMEntity,
+ aGeom2Size);
+ if(aNbTimeStamps < 1)
+ continue;
+
+ TEntity aVEntity = MEDEntityToVTK(aMEntity);
+ PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
+ TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+ PMEDField aField = aFieldMap[aFieldName](new TMEDField());
+ aField->myId = iField;
+ aField->myNbComp = aNbComp;
+ aField->myEntity = aVEntity;
+ aField->myName = aFieldName;
+ aField->myMeshName = aMeshName;
+ aField->myDataSize = aMeshOnEntity->myNbCells * aNbComp;
+ aField->myCompNames.resize(aNbComp);
+ aField->myUnitNames.resize(aNbComp);
+
+ INITMSG(MYDEBUG,"myName = '"<<aField->myName<<
+ "'; myId = "<<aField->myId<<
+ "; myEntity = "<<aField->myEntity<<
+ "; myDataSize = "<<aField->myDataSize<<
+ "; myNbComp = "<<aField->myNbComp<<"\n");
+
+ for(TInt iComp = 0; iComp < aNbComp; iComp++){
+ aField->myCompNames[iComp] = aFieldInfo->GetCompName(iComp);
+ aField->myUnitNames[iComp] = aFieldInfo->GetUnitName(iComp);
+ }
+
+ for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
+ PTimeStampInfo aTimeStampInfo = aMed->GetPTimeStampInfo(aFieldInfo,
+ aMEntity,
+ aGeom2Size,
+ iTimeStamp);
+ TFloat aDt = aTimeStampInfo->GetDt();
+ const string& anUnitDt = aTimeStampInfo->GetUnitDt();
+ PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStampInfo,
+ aMKey2Profile,
+ aKey2Gauss);
+ 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->myNbGauss = aTimeStampInfo->GetNbGauss();
+ aValForTime->myTime = VISU::TTime(aDt,anUnitDt);
+ INITMSG(MYDEBUG,"aDt = "<<aDt<<", "<<anUnitDt<<"\n");
+
+ InitProfile(aTimeStampVal,
+ aValForTime,
+ aMeshOnEntity,
+ aGeom2Size);
+
+ 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->myNbPts = aGaussInfo->GetNbGauss();
+ aGaussMap[MEDGeomToVTK(aMGeom)] = aMEDGauss;
+ }
+ }
}
+ } catch(std::exception& exc){
+ MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
+ } catch(...){
+ EXCEPTION(runtime_error,"Unknown exception !!!");
}
- } catch (std::runtime_error& exc){
- MSG(MYDEBUG,"Follow exception wqs occured in:\n"<<exc.what());
- } catch(...){
- EXCEPTION(runtime_error,"Unknown exception !!!");
- }
-
+ }
return this;
}
-int VISU_MedConvertor::LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity,
- const string& theFamilyName)
+int
+VISU_MedConvertor
+::LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity,
+ const string& theFamilyName)
{
PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
const string& aMeshName = theMeshOnEntity->myMeshName;
return (isPointsUpdated || isCellsOnEntityUpdated);
}
-int VISU_MedConvertor::LoadMeshOnGroup(VISU::PMeshImpl theMesh,
- const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
+
+int
+VISU_MedConvertor
+::LoadMeshOnGroup(VISU::PMeshImpl theMesh,
+ const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
{
PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
return (isPointsUpdated || isCellsOnEntityUpdated);
}
-int VISU_MedConvertor::LoadFieldOnMesh(VISU::PMeshImpl theMesh,
- VISU::PMeshOnEntityImpl theMeshOnEntity,
- VISU::PFieldImpl theField,
- VISU::PValForTimeImpl theValForTime)
+int
+VISU_MedConvertor
+::LoadFieldOnMesh(VISU::PMeshImpl theMesh,
+ VISU::PMeshOnEntityImpl theMeshOnEntity,
+ VISU::PFieldImpl theField,
+ VISU::PValForTimeImpl theValForTime)
{
PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
int isPointsUpdated = LoadPoints(aMed,theMesh);
int
-VISU_MedConvertor::LoadPoints(const MED::PWrapper& theMed,
- VISU::PMEDMesh theMesh,
- const string& theFamilyName)
+VISU_MedConvertor
+::LoadPoints(const MED::PWrapper& theMed,
+ VISU::PMEDMesh theMesh,
+ const string& theFamilyName)
{
try{
//Check on existing family
if(isPointsLoaded)
if(!aFamily)
return 0;
- else if(!aFamily->mySubMesh.empty())
+ else if(!aFamily->myGeom2SubMeshID.empty())
return 0;
INITMSG(MYDEBUG,"LoadPoints - isPointsLoaded = "<<isPointsLoaded<<"; theFamilyName = '"<<theFamilyName<<"'\n");
for(int iDim = 0, iElem2Dim = iElem*theMesh->myDim; iDim < theMesh->myDim; iDim++, iElem2Dim++)
aPointsCoord[iElem2Dim] = aNodeInfo->GetNodeCoord(iElem,iDim);
- VISU::TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aMeshOnEntity->myCellsConn[VTK_VERTEX];
+ VISU::TCell2Connect& aConnForCellType = aMeshOnEntity->myGeom2Cell2Connect[VTK_VERTEX];
aConnForCellType.resize(aNbElem);
for (int iElem = 0; iElem < aNbElem; iElem++)
- aConnForCellType[iElem] = VISU::TMeshOnEntityImpl::TConnect(1,iElem);
+ aConnForCellType[iElem] = VISU::TConnect(1,iElem);
}
if(aFamily && aNbElem > 0){
- VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[VTK_VERTEX];
+ VISU::TSubMeshID& aSubMeshID = aFamily->myGeom2SubMeshID[VTK_VERTEX];
for (int iElem = 0; iElem < aNbElem; iElem++)
if(aNodeInfo->GetFamNum(iElem) == aFamily->myId)
- aSubMeshOnCellType.insert(iElem);
+ aSubMeshID.push_back(iElem);
}
return 1;
- }catch(std::runtime_error& exc){
+ }catch(std::exception& exc){
theMesh->myPointsCoord.clear();
throw;
}catch(...){
int
-VISU_MedConvertor::LoadCellsOnEntity(const MED::PWrapper& theMed,
- VISU::PMEDMesh theMesh,
- VISU::PMEDMeshOnEntity theMeshOnEntity,
- const string& theFamilyName)
+VISU_MedConvertor
+::LoadCellsOnEntity(const MED::PWrapper& theMed,
+ VISU::PMEDMesh theMesh,
+ VISU::PMEDMeshOnEntity theMeshOnEntity,
+ const string& theFamilyName)
{
try{
//Check on existing family
PFamilyImpl aFamily = GetFamily(theMeshOnEntity,theFamilyName);
//Check on loading already done
- bool isCellsLoaded = !theMeshOnEntity->myCellsConn.empty();
+ bool isCellsLoaded = !theMeshOnEntity->myGeom2Cell2Connect.empty();
if(isCellsLoaded)
if(!aFamily)
return 0;
- else if(!aFamily->mySubMesh.empty())
+ else if(!aFamily->myGeom2SubMeshID.empty())
return 0;
INITMSG(MYDEBUG,"LoadCellsOnEntity - theFamilyName = '"<<theFamilyName<<"'\n");
}
#endif
- const MED::TGeom& aTGeom = theMeshOnEntity->myGeom;
- MED::TGeom::const_iterator anTGeomIter = aTGeom.begin();
- TMeshOnEntityImpl::TCellsConn& aCellsConn = theMeshOnEntity->myCellsConn;
-
- for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
- const EGeometrieElement& aGeom = anTGeomIter->first;
- int aVTKGeomType = MEDGeomToVTK(aGeom);
- ADDMSG(MYDEBUG,"LoadCellsOnEntity aGeom="<<aGeom<<"\n");
- switch(aGeom){
- case ePOLYGONE:
- {
- PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aGeom);
- TInt aNbElem = aPolygoneInfo->GetNbElem();
+ const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
+ MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
+ TGeom2Cell2Connect& aGeom2Cell2Connect = theMeshOnEntity->myGeom2Cell2Connect;
+
+ for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
+ const EGeometrieElement& aMGeom = aGeom2SizeIter->first;
+ int aVGeom = MEDGeomToVTK(aMGeom);
+ INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
+ switch(aMGeom){
+ case ePOLYGONE: {
+ 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();
+
+ for (int iElem = 0; iElem < aNbElem; iElem++) {
+ TConnect& anArray = aCell2Connect[iElem];
+ int aNbConn = aPolygoneInfo->GetNbConn(iElem);
+ anArray.resize(aNbConn);
+ for(int i = 0; i < aNbConn; i++)
+ anArray[i] = aConnect[aIndex[iElem]-1+i]-1;
+ }
+ }
+ if(aFamily){
+ TSubMeshID& aSubMeshID = aFamily->myGeom2SubMeshID[aVGeom];
+ for(int iElem = 0; iElem < aNbElem; iElem++)
+ if(aPolygoneInfo->GetFamNum(iElem) == aFamily->myId)
+ aSubMeshID.push_back(iElem);
+ }
+ break;
+ }
+ case ePOLYEDRE: {
+ 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();
- if(!isCellsLoaded){
- VISU::TMeshOnEntityImpl::TConnForCellType& aConnForPolygoneType = aCellsConn[aVTKGeomType];
- aConnForPolygoneType.resize(aNbElem);
+ for(int iElem = 0; iElem < aNbElem; iElem++){
+ typedef set<TInt> TConnectSet;
+ TConnectSet aConnectSet;
+ TConnect& anArray = aCell2Connect[iElem];
- int aMNbNodes = aPolygoneInfo->GetConnDim();
+ int aInd1 = aIndex[iElem]-1;
+ int aInd2 = aIndex[iElem+1]-2;
- vector<TInt> aConnect(aMNbNodes);
- vector<TInt> aIndex = aPolygoneInfo->GetIndex();
-
- for (int iElem = 0; iElem < aNbElem; iElem++) {
- VISU::TMeshOnEntityImpl::TConnect& anArray = aConnForPolygoneType[iElem];
- int aNbConn = aPolygoneInfo->GetNbConn(iElem);
-
- anArray.resize(aNbConn);
-
- aConnect = aPolygoneInfo->GetConnectivite();
-
- for (int i=0;i<aNbConn;i++){
- anArray[i] = aConnect[aIndex[iElem]-1+i]-1;
+ for(int i = aInd1; i <= aInd2; i++){
+ for(int j = aFaces[i]-1; j < aFaces[i+1]-1; j++){
+ aConnectSet.insert(aConnect[j]);
}
}
- }
- if(aFamily){
- VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVTKGeomType];
- for(int iElem = 0; iElem < aNbElem; iElem++)
- if(aPolygoneInfo->GetFamNum(iElem) == aFamily->myId)
- aSubMeshOnCellType.insert(iElem);
- }
- break;
- }
- case ePOLYEDRE:
- {
- PPolyedreInfo aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aGeom);
- TInt aNbElem = aPolyedreInfo->GetNbElem();
-
- int aMNbNodes = aPolyedreInfo->GetNbConn();
- vector<TInt> aConnect(aMNbNodes);
- aConnect = aPolyedreInfo->GetConnectivite();
-
- if(!isCellsLoaded){
- VISU::TMeshOnEntityImpl::TConnForCellType& aConnForPolyedreType = aCellsConn[aVTKGeomType];
- aConnForPolyedreType.resize(aNbElem);
- vector<TInt> aFacesIndex = aPolyedreInfo->GetFacesIndex();
- vector<TInt> aIndex = aPolyedreInfo->GetIndex();
-
- for (int iElem = 0; iElem < aNbElem; iElem++) {
- set<TInt> aArrayNew;
- VISU::TMeshOnEntityImpl::TConnect& anArray = aConnForPolyedreType[iElem];
-
- int aInd1 = aIndex[iElem]-1;
- int aInd2 = aIndex[iElem+1]-2;
-
- for (int i=aInd1;i<=aInd2;i++){
- for (int j=aFacesIndex[i]-1;j<aFacesIndex[i+1]-1;j++){
- aArrayNew.insert(aConnect[j]);
- }
- }
-
- int aNbConnNew = aArrayNew.size();
- anArray.resize(aNbConnNew);
- set<TInt>::iterator aIter = aArrayNew.begin();
- for (int i=0; aIter!=aArrayNew.end();aIter++, i++)
- anArray[i] = (*aIter)-1;
-
+ int aNbConn = aConnectSet.size();
+ anArray.resize(aNbConn);
+ TConnectSet::iterator aIter = aConnectSet.begin();
+ for(int i = 0; aIter != aConnectSet.end(); aIter++, i++){
+ TInt anId = *aIter;
+ anArray[i] = anId-1;
}
}
- if(aFamily){
- VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVTKGeomType];
- for(int iElem = 0; iElem < aNbElem; iElem++)
- if(aPolyedreInfo->GetFamNum(iElem) == aFamily->myId)
- aSubMeshOnCellType.insert(iElem);
- }
- break;
}
- default:
- {
- int aVNbNodes = VTKGeom2NbNodes(aVTKGeomType);
+ if(aFamily){
+ TSubMeshID& aSubMeshID = aFamily->myGeom2SubMeshID[aVGeom];
+ for(int iElem = 0; iElem < aNbElem; iElem++)
+ if(aPolyedreInfo->GetFamNum(iElem) == aFamily->myId)
+ aSubMeshID.push_back(iElem);
+ }
+ break;
+ }
+ default: {
+ int aVNbNodes = VTKGeom2NbNodes(aVGeom);
+
+ PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
+ TInt aNbElem = aCellInfo->GetNbElem();
+
+ if(!isCellsLoaded){
+ VISU::TCell2Connect& aConnForCellType = aGeom2Cell2Connect[aVGeom];
+ aConnForCellType.resize(aNbElem);
- PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aGeom);
- TInt aNbElem = aCellInfo->GetNbElem();
+ int aMNbNodes = MEDGeom2NbNodes(aMGeom);
+ vector<TInt> aConnect(aMNbNodes);
- if(!isCellsLoaded){
- VISU::TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aCellsConn[aVTKGeomType];
- aConnForCellType.resize(aNbElem);
+ for (int iElem = 0; iElem < aNbElem; iElem++) {
+ VISU::TConnect& anArray = aConnForCellType[iElem];
+ anArray.resize(aVNbNodes);
- int aMNbNodes = MEDGeom2NbNodes(aGeom);
- vector<TInt> aConnect(aMNbNodes);
-
- for (int iElem = 0; iElem < aNbElem; iElem++) {
- VISU::TMeshOnEntityImpl::TConnect& anArray = aConnForCellType[iElem];
- anArray.resize(aVNbNodes);
-
- if(anIsNodeNum){
- for(int i = 0; i < aMNbNodes; i++){
- aConnect[i] = aNodeIdMap[aCellInfo->GetConn(iElem,i)-1];
- }
- }else{
- for(int i = 0; i < aMNbNodes; i++){
- aConnect[i] = aCellInfo->GetConn(iElem,i)-1;
- }
+ if(anIsNodeNum){
+ for(int i = 0; i < aMNbNodes; i++){
+ aConnect[i] = aNodeIdMap[aCellInfo->GetConn(iElem,i)-1];
}
-
- switch(aGeom){
- case eTETRA4:
- case eTETRA10:
- anArray[0] = aConnect[0];
- anArray[1] = aConnect[1];
- anArray[2] = aConnect[3];
- anArray[3] = aConnect[2];
- break;
- case ePYRA5:
- case ePYRA13:
- 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];
+ }else{
+ for(int i = 0; i < aMNbNodes; i++){
+ aConnect[i] = aCellInfo->GetConn(iElem,i)-1;
}
+ }
+
+ switch(aMGeom){
+ case eTETRA4:
+ case eTETRA10:
+ anArray[0] = aConnect[0];
+ anArray[1] = aConnect[1];
+ anArray[2] = aConnect[3];
+ anArray[3] = aConnect[2];
+ break;
+ case ePYRA5:
+ case ePYRA13:
+ 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++)
- if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
- EXCEPTION(runtime_error,"ImportCells >> aNbPoints("<<aNbPoints<<") "<<
- "<= anArray["<<iElem<<"]"<<
- "["<<iNode<<"]"<<
- "("<<anArray[iNode]<<") < 0");
+ anArray[iNode] = aConnect[iNode];
}
+ for(int iNode = 0; iNode < aVNbNodes; iNode++)
+ if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
+ EXCEPTION(runtime_error,"LoadCellsOnEntity - "<<
+ " aNbPoints("<<aNbPoints<<") "<<
+ "<= anArray["<<iElem<<"]"<<
+ "["<<iNode<<"]"<<
+ "("<<anArray[iNode]<<") < 0");
}
- //Filling aFamily SubMesh
- if(aFamily){
- VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVTKGeomType];
- for(int iElem = 0; iElem < aNbElem; iElem++)
- if(aCellInfo->GetFamNum(iElem) == aFamily->myId)
- aSubMeshOnCellType.insert(iElem);
- }
+ }
+ //Filling aFamily Geom2SubMeshID
+ if(aFamily){
+ VISU::TSubMeshID& aSubMeshID = aFamily->myGeom2SubMeshID[aVGeom];
+ for(int iElem = 0; iElem < aNbElem; iElem++)
+ if(aCellInfo->GetFamNum(iElem) == aFamily->myId)
+ aSubMeshID.push_back(iElem);
}
}
+ }
}
return 1;
- }catch(std::runtime_error& exc){
- theMeshOnEntity->myCellsConn.clear();
+ }catch(std::exception& exc){
+ theMeshOnEntity->myGeom2Cell2Connect.clear();
throw;
}catch(...){
- theMeshOnEntity->myCellsConn.clear();
+ theMeshOnEntity->myGeom2Cell2Connect.clear();
EXCEPTION(runtime_error,"Unknown exception !!!");
}
return 0;
}
+void
+LoadProfile(MED::TTimeStampVal& theTimeStampVal,
+ VISU::TMEDValForTime& theValForTime,
+ VISU::TMEDMeshOnEntity& theMeshOnEntity)
+{
+ INITMSG(MYDEBUG,"LoadProfile"<<endl);
+
+ PMEDProfile aProfile = theValForTime.myProfile;
+ if(aProfile->myIsInitialized)
+ return;
+
+ const TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+ const TGeom2Profile& aGeom2Profile = theTimeStampVal.GetGeom2Profile();
+ TGeom2Profile::const_iterator anIter = aGeom2Profile.begin();
+ for(; anIter != aGeom2Profile.end(); anIter++){
+ MED::PProfileInfo aProfileInfo = anIter->second;
+ MED::EGeometrieElement aMGeom = anIter->first;
+ vtkIdType aVGeom = MEDGeomToVTK(aMGeom);
+
+ TGeom2SubProfile::const_iterator anIter2 = aGeom2SubProfile.find(aVGeom);
+ if(anIter2 != aGeom2SubProfile.end()){
+ PMEDSubProfile aSubProfile = anIter2->second;
+ aSubProfile->mySubMeshID = aProfileInfo->myElemNum;
+
+ INITMSG(MYDEBUG,"aVGeom = "<<aVGeom<<
+ "; aNbCells = "<<aSubProfile->mySubMeshID.size()<<
+ endl);
+ }
+ }
+}
+
+
int
-VISU_MedConvertor::LoadField(const MED::PWrapper& theMed,
- VISU::PMEDMesh theMesh,
- VISU::PMEDMeshOnEntity theMeshOnEntity,
- VISU::PMEDField theField,
- VISU::PMEDValForTime theValForTime)
+VISU_MedConvertor
+::LoadField(const MED::PWrapper& theMed,
+ VISU::PMEDMesh theMesh,
+ VISU::PMEDMeshOnEntity theMeshOnEntity,
+ VISU::PMEDField theField,
+ VISU::PMEDValForTime theValForTime)
{
+ INITMSG(MYDEBUG,"LoadField"<<endl);
+
//Check on loading already done
- if(!theValForTime->myValForCells.empty()) return 0;
+ if(!theValForTime->myValForCells.empty())
+ return 0;
//Main part of code
const std::string& aMeshName = theMeshOnEntity->myMeshName;
const PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
- PFieldInfo aFieldInfo = theMed->GetPFieldInfo(aMeshInfo,theField->myId);
+ PFieldInfo aFieldInfo = theMed->GetPFieldInfo(aMeshInfo,
+ theField->myId);
- MED::TGeom aTGeom;
+ MED::TGeom2Size aGeom2Size;
EEntiteMaillage aMEntity;
- theMed->GetNbTimeStamps(aFieldInfo,theMesh->myEntityInfo,aMEntity,aTGeom);
+ theMed->GetNbTimeStamps(aFieldInfo,
+ theMesh->myEntityInfo,
+ aMEntity,
+ aGeom2Size);
+
+ PTimeStampInfo aTimeStampInfo =
+ theMed->GetPTimeStampInfo(aFieldInfo,
+ aMEntity,
+ aGeom2Size,
+ theValForTime->myId);
+
+ TKey2Gauss aKey2Gauss = GetKey2Gauss(*theMed);
+ TMKey2Profile aMKey2Profile = GetMKey2Profile(*theMed);
+
+ PTimeStampVal aTimeStampVal =
+ theMed->GetPTimeStampVal(aTimeStampInfo,
+ aMKey2Profile,
+ aKey2Gauss);
+
+ LoadProfile(aTimeStampVal,
+ theValForTime,
+ theMeshOnEntity);
+
+ PMEDProfile aProfile = theValForTime->myProfile;
+ TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
- PTimeStampInfo aTimeStampInfo = theMed->GetPTimeStampInfo(aFieldInfo,
- aMEntity,
- aTGeom,
- theValForTime->myId);
- TInt aNbGauss = aTimeStampInfo->GetNbGauss();
+ const TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss();
TInt aNbComp = theField->myNbComp;
- PTimeStampVal aTimeStampVal = theMed->GetPTimeStampVal(aTimeStampInfo);
- bool anIsTrimmed = theField->myIsTrimmed;
- INITMSG(MYDEBUG,"LoadField - aMeshName = '"<<aMeshName<<
- "'; aFieldName = '"<<aFieldInfo->GetName()<<
- "'; aMEntity = "<<aMEntity<<
- "; anId = "<<theValForTime->myId<<endl);
- BEGMSG(MYDEBUG,"LoadField - aNbComp = "<<aNbComp<<
- "; aNbGauss = "<<aNbGauss<<endl);
-
- const MED::TGeom& anEntityTGeom = theMeshOnEntity->myGeom;
- MED::TGeom::const_iterator aTGeomIter = anEntityTGeom.begin();
- for(; aTGeomIter != anEntityTGeom.end(); aTGeomIter++){
- const EGeometrieElement& aGeom = aTGeomIter->first;
- const TInt& aNbElem = aTGeomIter->second;
-
- INITMSG(MYDEBUG,"LoadField - aGeom = "<<aGeom<<"; aNbElem = '"<<aNbElem<<endl);
-
- if(aTGeom.find(aGeom) == aTGeom.end()){
- if(!theField->myIsTrimmed){
- theField->myDataSize -= aNbElem*theField->myNbComp;
- anIsTrimmed = true;
- }
- }else{
- int aVTKGeomType = MEDGeomToVTK(aGeom);
- VISU::TValForTimeImpl::TValForCellsWithType& anArray = theValForTime->myValForCells[aVTKGeomType];
- anArray.resize(aNbComp*aNbElem);
+ BEGMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<"'"<<
+ "; aFieldName = '"<<aFieldInfo->GetName()<<"'"<<
+ "; aMEntity = "<<aMEntity<<
+ "; aNbComp = "<<aNbComp<<
+ endl);
+
+ theField->myDataSize = 0;
+
+ TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
+ for(; anIter != aGeom2SubProfile.end(); anIter++){
+ vtkIdType aVGeom = anIter->first;
+ PMEDSubProfile aSubProfile(anIter->second);
+
+ TInt aNbElem = aSubProfile->myNbCells;
+ theField->myDataSize += aNbElem*aNbComp;
+
+ MED::EGeometrieElement aMGeom = VTKGeomToMED(aVGeom);
+ TInt aNbGauss = theValForTime->GetNbGauss(aMGeom);
+
+ if(aSubProfile->myStatus != eRemoveAll){
+ INITMSG(MYDEBUG,"aVGeom = "<<aVGeom<<
+ "; aNbElem = "<<aNbElem<<
+ "; aNbGauss = "<<aNbGauss<<
+ endl);
+
+ TValForCellsWithType& anArray = theValForTime->myValForCells[aVGeom];
+ anArray.resize(aNbComp*aNbElem*aNbGauss);
for(TInt iElem = 0, anId = 0; iElem < aNbElem; iElem++){
- for(TInt iComp = 0; iComp < aNbComp; iComp++, anId++){
- for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
- anArray[anId] += aTimeStampVal->GetVal(aGeom,iElem,iComp,iGauss);
+ for(TInt iComp = 0; iComp < aNbComp; iComp++){
+ for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++, anId++){
+ anArray[anId] = aTimeStampVal->GetVal(aMGeom,iElem,iComp,iGauss);
}
- anArray[anId] /= aNbGauss;
}
}
}
}
- theField->myIsTrimmed = anIsTrimmed;
+
return 1;
}
#include "MED_Common.hxx"
+#include <qfileinfo.h>
+
namespace VISU{
- struct TMEDMesh: TMeshImpl{
+ struct TMEDMesh: TMeshImpl
+ {
MED::PMeshInfo myMeshInfo;
MED::TEntityInfo myEntityInfo;
};
- typedef shared_ptr<TMEDMesh> PMEDMesh;
+ typedef SharedPtr<TMEDMesh> PMEDMesh;
- struct TMEDMeshOnEntity: TMeshOnEntityImpl{
- MED::TGeom myGeom;
- };
- typedef shared_ptr<TMEDMeshOnEntity> PMEDMeshOnEntity;
+ struct TMEDSubProfile: TSubProfileImpl
+ {};
+ typedef SharedPtr<TMEDSubProfile> PMEDSubProfile;
- struct TMEDFamily: TFamilyImpl{
+ struct TMEDProfile: TProfileImpl
+ {};
+ typedef SharedPtr<TMEDProfile> PMEDProfile;
+
+ struct TMEDMeshOnEntity: TMeshOnEntityImpl
+ {
+ MED::TGeom2Size myGeom2Size;
};
- typedef shared_ptr<TMEDFamily> PMEDFamily;
+ typedef SharedPtr<TMEDMeshOnEntity> PMEDMeshOnEntity;
+
+ struct TMEDFamily: TFamilyImpl
+ {};
+ typedef SharedPtr<TMEDFamily> PMEDFamily;
- struct TMEDGroup: TGroupImpl{
- };
- typedef shared_ptr<TMEDGroup> PMEDGroup;
+ struct TMEDGroup: TGroupImpl
+ {};
+ typedef SharedPtr<TMEDGroup> PMEDGroup;
- struct TMEDField: TFieldImpl{
- };
- typedef shared_ptr<TMEDField> PMEDField;
+ struct TMEDField: TFieldImpl
+ {};
+ typedef SharedPtr<TMEDField> PMEDField;
- struct TMEDValForTime: TValForTimeImpl{
+ struct TMEDGauss: TGaussImpl
+ {
+ MED::PGaussInfo myGaussInfo;
};
- typedef shared_ptr<TMEDValForTime> PMEDValForTime;
+ typedef SharedPtr<TMEDGauss> PMEDGauss;
+
+ struct TMEDValForTime: TValForTimeImpl
+ {};
+ typedef SharedPtr<TMEDValForTime> PMEDValForTime;
}
return -1;
}
- int VTKGeom2NbNodes(int theVTKGeomType)
- {
- switch(theVTKGeomType){
- case VTK_VERTEX: return 1;
- case VTK_LINE: return 2;
- case VTK_TRIANGLE: return 3;
- case VTK_QUAD: return 4;
- case VTK_TETRA: return 4;
- case VTK_HEXAHEDRON: return 8;
- case VTK_WEDGE: return 6;
- case VTK_PYRAMID: return 5;
- }
- return -1;
- }
-
medGeometryElement VTKGeomToMED(int theVTKGeomType)
{
switch(theVTKGeomType){
for(int iFamaily = 0; iFamaily < iFamilyEnd; iFamaily++){
SALOME_MED::FAMILY_var aMEDFamily = aFamilies[iFamaily];
CORBA::String_var aFamilyName = aMEDFamily->getName();
- PFamily aFamily = FindFamily(aMesh,aFamilyName.in());
+ PCFamily aFamily = FindFamily(aMesh,aFamilyName.in());
if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aGroup - aFamilyName = '"<<aFamilyName.in()<<"' = "<<bool(aFamily));
if(aFamily){
TFamilyAndEntity aFamilyAndEntity(aFamilyName.in(),aFamily->myEntity);
if(isPointsLoaded)
if(!aFamily)
return 0;
- else if(!aFamily->mySubMesh.empty())
+ else if(!aFamily->myGeom2SubMeshID.empty())
return 0;
if(MYDEBUG)
if(MYDEBUG) MESSAGE("LoadPoints - Filling aMeshOnEntity with type NODE_ENTITY");
- TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aMeshOnEntity->myCellsConn[VTK_VERTEX];
- aConnForCellType.resize(iNumElemEnd);
+ TCell2Connect& aCell2Connect = aMeshOnEntity->myGeom2Cell2Connect[VTK_VERTEX];
+ aCell2Connect.resize(iNumElemEnd);
for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
- aConnForCellType[iNumElem] = TMeshOnEntityImpl::TConnect(1,iNumElem);
+ aCell2Connect[iNumElem] = TConnect(1,iNumElem);
}
if(aFamily){
- if(MYDEBUG) MESSAGE("LoadPoints - Filling aFamily SubMesh");
+ if(MYDEBUG) MESSAGE("LoadPoints - Filling aFamily Geom2SubMeshID");
SALOME_MED::FAMILY_var aMedFamily = aFamily->myFamily;
CORBA::Boolean anIsOnAllElements = aMedFamily->isOnAllElements();
- TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[VTK_VERTEX];
+ TSubMeshID& aSubMeshID = aFamily->myGeom2SubMeshID[VTK_VERTEX];
if(!anIsOnAllElements){
SALOME_MED::medGeometryElement_array_var aGeom = aMedFamily->getTypes();
aString.sprintf("LoadPoints >> iNumElemEndTmp(%d) <= aCellNumForType[%d]=%d < 0 !!!",iNumElemEnd,iNumElem,tmp);
throw std::runtime_error(aString.latin1());
}
- aSubMeshOnCellType.insert(tmp);
+ aSubMeshID.push_back(tmp);
}
}else{
for(int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++){
- aSubMeshOnCellType.insert(iNumElem);
+ aSubMeshID.push_back(iNumElem);
}
}
}
//Check on existing family
PCFamily aFamily = GetFamily(theMeshOnEntity,theFamilyName);
//Check on loading already done
- bool isCellsLoaded = !theMeshOnEntity->myCellsConn.empty();
+ bool isCellsLoaded = !theMeshOnEntity->myGeom2Cell2Connect.empty();
if(isCellsLoaded)
if(!aFamily)
return 0;
- else if(!aFamily->mySubMesh.empty())
+ else if(!aFamily->myGeom2SubMeshID.empty())
return 0;
SALOME_MED::SUPPORT_var& aMedSupport = theMeshOnEntity->mySupport;
if (iNumElemEnd > 0) {
SALOME_MED::long_array_var conn =
aMedMesh->getConnectivity(SALOME_MED::MED_FULL_INTERLACE,SALOME_MED::MED_NODAL,aMEntity,aGeom);
- TMeshOnEntityImpl::TConnForCellType& aConnForCellType = theMeshOnEntity->myCellsConn[aVGeom];
- //APO - aConnForCellType.resize(iNumElemEnd);
+ TCell2Connect& aCell2Connect = theMeshOnEntity->myGeom2Cell2Connect[aVGeom];
+ //APO - aCell2Connect.resize(iNumElemEnd);
vector<int> aConnect(aMNbNodes);
int aNbConnForElem = conn->length()/iNumElemEnd;
if(MYDEBUG) MESSAGE("LoadCellsOnEntity - aGeom = "<<aGeom<<
"; iNumElemEnd = "<<iNumElemEnd<<
"; aNbConnForElem = "<<aNbConnForElem);
for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
- VISU::TMeshOnEntityImpl::TConnect anArray(aVNbNodes);
+ VISU::TConnect anArray(aVNbNodes);
for (int k = 0, kj = iNumElem*aNbConnForElem; k < aMNbNodes; k++) {
aConnect[k] = conn[kj+k] - 1;
}
aString.sprintf("ImportCells >> aNbPoints(%d) <= anArray[%d][%d]=%d < 0 !!!",aNbPoints,iNumElem,k,anArray[k]);
throw std::runtime_error(aString.latin1());
}
- aConnForCellType.push_back(anArray);
+ aCell2Connect.push_back(anArray);
}
//Workaround for MED Component data structure
- int aSize = aConnForCellType.size();
+ int aSize = aCell2Connect.size();
theMeshOnEntity->myCellsFirstIndex[aGeom] = TCMeshOnEntity::TIndexAndSize(aCounter,aSize);
aCounter += aSize;
}
}
}
- //Filling aFamily SubMesh
+ //Filling aFamily Geom2SubMeshID
if(aFamily){
SALOME_MED::FAMILY_var aMedFamily = aFamily->myFamily;
CORBA::Boolean anIsOnAllElements = aMedFamily->isOnAllElements();
SALOME_MED::medGeometryElement aGeom = aGeoms[iGeom];
SALOME_MED::long_array_var aCellNumForType = aMedFamily->getNumber(aGeom);
int aVGeom = MEDGeomToVTK(aGeom);
- TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVGeom];
- int iNumElemEndTmp = theMeshOnEntity->myCellsConn[aVGeom].size();
+ TSubMeshID& aSubMeshID = aFamily->myGeom2SubMeshID[aVGeom];
+ int iNumElemEndTmp = theMeshOnEntity->myGeom2Cell2Connect[aVGeom].size();
int iNumElemEnd = aCellNumForType->length();
int aCounter = theMeshOnEntity->myCellsFirstIndex[aGeom].first;
if(MYDEBUG)
aString.sprintf("LoadCellsOnEntity >> iNumElemEndTmp(%d) <= aCellNumForType[%d]=%d < 0 !!!",iNumElemEndTmp,iNumElem,tmp);
throw std::runtime_error(aString.latin1());
}
- aSubMeshOnCellType.insert(tmp);
+ aSubMeshID.push_back(tmp);
}
}
}else{
- const TMeshOnEntityImpl::TCellsConn& aCellsConn = theMeshOnEntity->myCellsConn;
- TMeshOnEntityImpl::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
+ const TGeom2Cell2Connect& aCellsConn = theMeshOnEntity->myGeom2Cell2Connect;
+ TGeom2Cell2Connect::const_iterator aCellsConnIter = aCellsConn.begin();
for(; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
int aVGeom = aCellsConnIter->first;
- const TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aCellsConnIter->second;
- TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVGeom];
- int iNumElemEnd = aConnForCellType.size();
+ const TCell2Connect& aCell2Connect = aCellsConnIter->second;
+ TSubMeshID& aSubMeshID = aFamily->myGeom2SubMeshID[aVGeom];
+ int iNumElemEnd = aCell2Connect.size();
for(int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
- aSubMeshOnCellType.insert(iNumElem);
+ aSubMeshID.push_back(iNumElem);
}
}
}
VISU::PCMeshOnEntity theMeshOnEntity)
{
if(theField->myEntity == NODE_ENTITY){
- TValForTimeImpl::TValForCellsWithType& aValForCellsWithType =
+ TValForCellsWithType& aValForCellsWithType =
theValForTime->myValForCells[VTK_VERTEX];
int iNumElemEnd = theMesh->myPointsCoord.size()/theMesh->myDim*theField->myNbComp;
if(MYDEBUG) MESSAGE("ImportField - iNumElemEnd = "<<iNumElemEnd);
MESSAGE("ImportField - aGeom = "<<aGeom<<
"; aIndexAndSize = {"<<aIndexAndSize.first<<
","<<aIndexAndSize.second<<"}");
- TValForTimeImpl::TValForCellsWithType& aValForCellsWithType = theValForTime->myValForCells[aVGeom];
+ TValForCellsWithType& aValForCellsWithType = theValForTime->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++)
struct TCMesh: TMeshImpl{
SALOME_MED::MESH_var myMesh;
};
- typedef shared_ptr<TCMesh> PCMesh;
+ typedef SharedPtr<TCMesh> PCMesh;
struct TCMeshOnEntity: TMeshOnEntityImpl{
SALOME_MED::SUPPORT_var mySupport;
typedef std::map<int,TIndexAndSize> TCellsFirstIndex;
TCellsFirstIndex myCellsFirstIndex;
};
- typedef shared_ptr<TCMeshOnEntity> PCMeshOnEntity;
+ typedef SharedPtr<TCMeshOnEntity> PCMeshOnEntity;
struct TCFamily: TFamilyImpl{
SALOME_MED::FAMILY_var myFamily;
};
- typedef shared_ptr<TCFamily> PCFamily;
+ typedef SharedPtr<TCFamily> PCFamily;
struct TCGroup: TGroupImpl{
SALOME_MED::GROUP_var myGroup;
};
- typedef shared_ptr<TCGroup> PCGroup;
+ typedef SharedPtr<TCGroup> PCGroup;
struct TCField: TFieldImpl{
};
- typedef shared_ptr<TCField> PCField;
+ typedef SharedPtr<TCField> PCField;
struct TCValForTime: TValForTimeImpl{
SALOME_MED::FIELD_var myField;
};
- typedef shared_ptr<TCValForTime> PCValForTime;
+ typedef SharedPtr<TCValForTime> PCValForTime;
}