class VISU_AppendFilter;
class VISU_MergeFilter;
+class VISU_CommonCellsFilter;
namespace VISU
{
//---------------------------------------------------------------
typedef vtkSmartPointer<VISU_MergeFilter> PMergeFilter;
-
-
+ typedef vtkSmartPointer<VISU_CommonCellsFilter> PCommonCellsFilter;
+
+ struct TCommonCellsFilterHolder;
+ typedef MED::SharedPtr<TCommonCellsFilterHolder> PCommonCellsFilterHolder;
+
+
//---------------------------------------------------------------
typedef vtkSmartPointer<vtkPolyData> PPolyData;
typedef vtkSmartPointer<VISU_AppendPolyData> PAppendPolyData;
#include "VISU_AppendFilter.hxx"
#include "VISU_AppendPolyData.hxx"
#include "VTKViewer_CellLocationsArray.h"
+#include "VISU_CommonCellsFilter.hxx"
#include "VISU_ConvertorUtils.hxx"
const VISU::PProfileImpl& theProfile,
const VISU::TEntity& theEntity)
{
+ vtkUnstructuredGrid* anOutput = NULL;
+
LoadMeshOnEntity(theMesh, theMeshOnEntity);
GetMeshOnEntity(theMeshOnEntity->myMeshName, theMeshOnEntity->myEntity);
GetMeshOnProfile(theMesh, theMeshOnEntity, theProfile);
-
+
+ bool isNeedInCells = false;
+
theUnstructuredGridIDMapper->myIDMapper = theProfile;
+ if(theMeshOnEntity->myEntity == VISU::NODE_ENTITY){
+ // add geometry elements to output,
+ // if timestamp on NODE_ENTITY and
+ // on profiles with status eAddPart
+ VISU::TGeom2SubProfile::const_iterator anIter = theProfile->myGeom2SubProfile.begin();
+ for(; anIter != (theProfile->myGeom2SubProfile).end(); anIter++){
+ const VISU::EGeometry aGeom = anIter->first;
+ const VISU::PSubProfileImpl aSubProfile = anIter->second;
+ if(aSubProfile->myStatus == VISU::eAddPart && aGeom == VISU::ePOINT1){
+ isNeedInCells = true;
+ break;
+ }
+ }
+ if(isNeedInCells){
+ theUnstructuredGridIDMapper->myIsSpecialKey = true;
+ GetTimeStampOnNodalProfile(theMesh,theUnstructuredGridIDMapper,theField,theValForTime,theEntity);
+ anOutput = theUnstructuredGridIDMapper->GetUnstructuredGridOutput();
+ }
+ }
+ /*
vtkUnstructuredGrid* anOutput = theUnstructuredGridIDMapper->GetUnstructuredGridOutput();
const VISU::PUnstructuredGrid& aSource = theUnstructuredGridIDMapper->mySource.GetSource();
VISU::GetTimeStampOnProfile(aSource, theField, theValForTime, theEntity);
+ */
return anOutput;
}
+void
+VISU_Convertor_impl
+::GetTimeStampOnNodalProfile(const VISU::PMeshImpl& theMesh,
+ const VISU::PUnstructuredGridIDMapperImpl& theIDMapperFilter,
+ const VISU::PFieldImpl& theField,
+ const VISU::PValForTimeImpl& theValForTime,
+ const VISU::TEntity& theEntity)
+{
+ const VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
+ VISU::TMeshOnEntityMap::const_iterator aIter = aMeshOnEntityMap.begin();
+ for(;aIter!=aMeshOnEntityMap.end();aIter++){
+ VISU::TEntity aEntity = aIter->first;
+ if(aEntity != VISU::NODE_ENTITY){
+ VISU::PNamedIDMapper aMapper = GetMeshOnEntity(theMesh->myName,aEntity);
+ if(aMapper)
+ theIDMapperFilter->myMappers[aEntity] = aMapper;
+ }
+ }
+
+ theIDMapperFilter->GetUnstructuredGridOutput();
+ const VISU::PUnstructuredGrid& aSource = theIDMapperFilter->mySource.GetSource();
+ VISU::GetTimeStampOnProfile(aSource,theField,theValForTime,theEntity);
+}
+
//---------------------------------------------------------------
VISU::PUnstructuredGridIDMapper
VISU_Convertor_impl
const VISU::PUnstructuredGridIDMapperImpl& theIDMapperFilter,
const VISU::PProfileImpl& theProfile,
const VISU::TEntity& theEntity);
+
+ void
+ GetTimeStampOnNodalProfile(const VISU::PMeshImpl& theMesh,
+ const VISU::PUnstructuredGridIDMapperImpl& theIDMapperFilter,
+ const VISU::PFieldImpl& theField,
+ const VISU::PValForTimeImpl& theValForTime,
+ const VISU::TEntity& theEntity);
protected:
//! Implemention of the VISU_Convertor::GetTimeStampSize
typedef std::map<std::string, PMesh> TMeshMap;
+ typedef std::map<VISU::TEntity,VISU::PNamedIDMapper> PNamedIDMapperMap;
+
//---------------------------------------------------------------
//! Define a basic class which corresponds to MED PROFILE entity
struct VISU_CONVERTOR_EXPORT TSubProfile: virtual TBaseStructure
#include "VISU_MergeFilter.hxx"
#include "VISU_ConvertorUtils.hxx"
+#include "VISU_CommonCellsFilter.hxx"
#include <vtkUnstructuredGrid.h>
#include <vtkPolyData.h>
return 0;
}
-
//---------------------------------------------------------------
unsigned long int
TMemoryCheckIDMapper
//---------------------------------------------------------------
+
+
+ TUnstructuredGridIDMapperImpl
+ ::TUnstructuredGridIDMapperImpl():
+ myIsSpecialKey(false)
+ {
+ if(!myCommonCellsFilter.GetPointer()){
+ myCommonCellsFilter = VISU_CommonCellsFilter::New();
+ myCommonCellsFilter->Delete();
+ }
+ }
+
vtkIdType
TUnstructuredGridIDMapperImpl
::GetNodeObjID(vtkIdType theID) const
::GetUnstructuredGridOutput()
{
if(!myFilter.GetPointer()){
- const PAppendFilter& anAppendFilter = myIDMapper->GetFilter();
- vtkUnstructuredGrid* aGeometry = anAppendFilter->GetOutput();
+ const PAppendFilter& anAppendFilter = myIDMapper->GetFilter();
+ vtkUnstructuredGrid* aGeometry;
+
const PUnstructuredGrid& aSource = mySource.GetSource();
- vtkUnstructuredGrid* aDataSet = aSource.GetPointer();
- aDataSet->ShallowCopy(aGeometry);
+ vtkUnstructuredGrid* aDataSet;
+ if(myIsSpecialKey){
+ PNamedIDMapperMap::iterator aIter;
+ aIter = myMappers.find(VISU::CELL_ENTITY);
+ if(aIter!=myMappers.end()) myCommonCellsFilter->SetCellsUG((aIter->second)->GetUnstructuredGridOutput());
+ else {
+ aIter = myMappers.find(VISU::FACE_ENTITY);
+ if(aIter!=myMappers.end()) myCommonCellsFilter->SetCellsUG((aIter->second)->GetUnstructuredGridOutput());
+ else {
+ aIter = myMappers.find(VISU::EDGE_ENTITY);
+ if(aIter!=myMappers.end()) myCommonCellsFilter->SetCellsUG((aIter->second)->GetUnstructuredGridOutput());
+ }
+ }
+ }
+
+ aGeometry = anAppendFilter->GetOutput();
+ aDataSet = aSource.GetPointer();
+ aDataSet->ShallowCopy(aGeometry);
+
const PMergeFilter& aFilter = GetFilter();
aFilter->SetGeometry(aGeometry);
aFilter->SetScalars(aDataSet);
aFilter->AddField("VISU_FIELD",aDataSet);
aFilter->AddField("VISU_CELLS_MAPPER",aDataSet);
aFilter->AddField("VISU_POINTS_MAPPER",aDataSet);
- }
- return myFilter->GetUnstructuredGridOutput();
+
+ myCommonCellsFilter->SetProfileUG(aFilter->GetUnstructuredGridOutput());
+ }
+ return myCommonCellsFilter->GetOutput();
}
vtkDataSet*
{
size_t aSize = myIDMapper->GetMemorySize();
aSize += mySource.GetMemorySize();
+ if(vtkUnstructuredGrid* anOutput = myCommonCellsFilter->GetOutput())
+ aSize += anOutput->GetActualMemorySize() * 1024;
+ PNamedIDMapperMap::const_iterator aIter = myMappers.begin();
+ for(;aIter!=myMappers.end();aIter++)
+ aSize += (aIter->second)->GetMemorySize();
return aSize;
}
-
//---------------------------------------------------------------
vtkIdType
TPolyDataIDMapperImpl
GetUnstructuredGridOutput();
};
+ /*!
+ This container allow to combine other VTK representation into single one.
+ */
+ class VISU_CONVERTOR_EXPORT TCommonCellsFilterHolder: public virtual TMemoryCheckIDMapper
+ {
+ protected:
+ mutable PCommonCellsFilter myFilter;
+ mutable PMergeFilter myMergeFilter;
+ public:
+ TCommonCellsFilterHolder();
+
+ //! This method allow to create corresponding VTK filter by demand (not at once)
+ const PCommonCellsFilter&
+ GetFilter() const;
+
+ //! Reimplement the TNamedIDMapper::GetUnstructuredGridOutput
+ virtual
+ vtkUnstructuredGrid*
+ GetUnstructuredGridOutput();
+
+ virtual
+ unsigned long int
+ GetMemorySize();
+
+ //! if false, TIDCommonCellsFilter - same as TIDMapperFilter
+ //! if true, TIDCommonCellsFilter - use VISU_CommonCellsFilter
+ bool myIsSpecialKey;
+
+ //! Vector of id mappers, which consist of meshonentity in next sequence:
+ //! CELL_ENTITY,FACE_ENTITY,EDGE_ENTITY
+ PNamedIDMapperMap myMappers;
+ };
//---------------------------------------------------------------
//! Define a container for VTK representation
struct TUnstructuredGridIDMapperImpl: virtual TMergeFilterHolder,
virtual TUnstructuredGridIDMapper
{
- PAppendFilterHolder myIDMapper; //!< Responsible for numbering
- TUnstructuredGridHolder mySource; //!< Keeps assigned data
+ PAppendFilterHolder myIDMapper; //!< Responsible for numbering
+ PCommonCellsFilter myCommonCellsFilter;
+ TUnstructuredGridHolder mySource; //!< Keeps assigned data
+ TUnstructuredGridIDMapperImpl();
+
//! Reimplement the TIDMapper::GetNodeObjID
virtual
vtkIdType
virtual
unsigned long int
GetMemorySize();
- };
+
+ //! if false, Not using CommonCellsFilter
+ //! if true, Using CommonCellsFilter
+ bool myIsSpecialKey;
+ //! Vector of id mappers, which consist of meshonentity in next sequence:
+ //! CELL_ENTITY,FACE_ENTITY,EDGE_ENTITY
+ PNamedIDMapperMap myMappers;
+ };
//---------------------------------------------------------------
//! Specialize TIDMapper to provide VTK mapping for MED TIMESTAMP mesh