#include "VISU_Convertor_impl.hxx"
#include "VISU_ConvertorUtils.hxx"
+#include "VTKViewer_AppendFilter.h"
#include <vtkPoints.h>
#include <vtkUnstructuredGrid.h>
#include <vtkCellData.h>
#include <vtkCellLinks.h>
-#include <vtkMergeDataObjectFilter.h>
+#include <vtkMergeFilter.h>
#include <qstring.h>
#include <qfileinfo.h>
#include <valarray>
#include <memory>
-#include "VTKViewer_AppendFilter.h"
using namespace std;
using namespace VISU;
}
+ //---------------------------------------------------------------
+ TMergeFilter::TMergeFilter()
+ {}
+
+ const TVTKMergeFilter&
+ TMergeFilter
+ ::GetFilter() const
+ {
+ if(!myFilter.GetPointer()){
+ myFilter = vtkMergeFilter::New();
+ myFilter->Delete();
+ }
+ return myFilter;
+ }
+
+ TVTKOutput*
+ TMergeFilter
+ ::GetVTKOutput()
+ {
+ GetFilter()->Update();
+ return GetFilter()->GetUnstructuredGridOutput();
+ }
+
+
//---------------------------------------------------------------
TPointCoords
::TPointCoords():
return mySource.GetVTKOutput();
}
+
+ //---------------------------------------------------------------
+ TVTKOutput*
+ TProfileMergeFilter
+ ::GetVTKOutput()
+ {
+ if(!myFilter.GetPointer()){
+ const TVTKAppendFilter& anAppendFilter = myProfile.GetFilter();
+ TVTKOutput* aGeometry = anAppendFilter->GetOutput();
+
+ const TVTKSource& aSource = mySource.GetSource();
+ TDataSet* aDataSet = aSource.GetPointer();
+ aDataSet->ShallowCopy(aGeometry);
+
+ const TVTKMergeFilter& aFilter = GetFilter();
+ aFilter->SetGeometry(aGeometry);
+ aFilter->SetScalars(aDataSet);
+ aFilter->SetVectors(aDataSet);
+ aFilter->AddField("VISU_FIELD",aDataSet);
+ }
+ return myFilter->GetUnstructuredGridOutput();
+ }
+
+ vtkIdType
+ TProfileMergeFilter
+ ::GetNodeObjID(vtkIdType theID) const
+ {
+ return myProfile.GetNodeObjID(theID);
+ }
+
+ vtkIdType
+ TProfileMergeFilter
+ ::GetNodeVTKID(vtkIdType theID) const
+ {
+ return myProfile.GetNodeVTKID(theID);
+ }
+
+ float*
+ TProfileMergeFilter
+ ::GetNodeCoord(vtkIdType theObjID)
+ {
+ return myProfile.GetNodeCoord(theObjID);
+ }
+
+ vtkIdType
+ TProfileMergeFilter
+ ::GetElemObjID(vtkIdType theID) const
+ {
+ return myProfile.GetElemObjID(theID);
+ }
+
+ vtkIdType
+ TProfileMergeFilter
+ ::GetElemVTKID(vtkIdType theID) const
+ {
+ return myProfile.GetElemVTKID(theID);
+ }
+
+ vtkCell*
+ TProfileMergeFilter
+ ::GetElemCell(vtkIdType theObjID)
+ {
+ return myProfile.GetElemCell(theObjID);
+ }
+
+
//---------------------------------------------------------------
TGaussSubMeshImpl::TGaussSubMeshImpl():
myStatus(eNone)
//---------------------------------------------------------------
+ TValForTimeImpl
+ ::TValForTimeImpl():
+ myProfileMergeFilter(new TProfileMergeFilter())
+ {}
+
const TMeshValue&
TValForTimeImpl
::GetMeshValue(vtkIdType theGeom) const
PFieldImpl aField = boost::get<3>(aFindTimeStamp);
//Main part of code
- PProfileImpl aProfile = aValForTime->myProfile;
- TSource& aProfileSource = aProfile->mySource;
+ PProfileMergeFilter aProfileMergeFilter = aValForTime->myProfileMergeFilter;
#ifndef _DEXCEPT_
try{
#endif
- if(!aProfileSource.myIsVTKDone){
+ if(!aProfileMergeFilter->myIsVTKDone){
LoadValForTimeOnMesh(aMesh,aMeshOnEntity,aField,aValForTime);
try{
}
GetMeshOnEntity(aVTKMeshOnEntity->myMeshName,aVTKMeshOnEntity->myEntity);
- GetMeshOnProfile(aMesh,aVTKMeshOnEntity,aProfile);
-
- const TVTKAppendFilter& anAppendFilter = aProfile->GetFilter();
- const TVTKSource& aSource = aProfile->mySource.GetSource();
- aSource->ShallowCopy(anAppendFilter->GetOutput());
+
+ PProfileImpl aProfile = aValForTime->myProfile;
+ TSource& aProfileSource = aProfile->mySource;
+ if(!aProfileSource.myIsVTKDone){
+ GetMeshOnProfile(aMesh,aVTKMeshOnEntity,aProfile);
+ aProfileSource.myIsVTKDone = true;
+ }
+
+ aProfileMergeFilter->myProfile = aProfile;
+ TVTKOutput* anOutput = aProfileMergeFilter->GetVTKOutput();
+ const TVTKSource& aSource = aProfileMergeFilter->mySource.GetSource();
GetTimeStampOnProfile(aSource,aField,aValForTime);
- aProfileSource.myIsVTKDone = true;
+ aProfileMergeFilter->myIsVTKDone = true;
if(MYDEBUGWITHFILES){
string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
string aPrefix = string(getenv("HOME"))+"/"+getenv("USER")+"-";
string aFileName = aPrefix + aMeshName + dtos("-%d-",int(theEntity)) +
aFieldName + dtos("-%d",theStampsNum) + "-Conv.vtk";
- VISU::WriteToFile(aSource.GetPointer(),aFileName);
+ VISU::WriteToFile(anOutput,aFileName);
}
if(MYVTKDEBUG){
GetTimeStampSize(theMeshName,theEntity,theFieldName,theStampsNum);
- aSource->Update();
+ anOutput->Update();
if(theEntity == VISU::NODE_ENTITY)
- BEGMSG(MYVTKDEBUG,"GetPointData() = "<<float(aSource->GetPointData()->GetActualMemorySize()*1000)<<endl);
+ BEGMSG(MYVTKDEBUG,"GetPointData() = "<<float(anOutput->GetPointData()->GetActualMemorySize()*1000)<<endl);
else
- BEGMSG(MYVTKDEBUG,"GetCellData() = "<<float(aSource->GetCellData()->GetActualMemorySize()*1000)<<endl);
- BEGMSG(MYVTKDEBUG,"GetActualMemorySize() = "<<float(aSource->GetActualMemorySize()*1000)<<endl);
+ BEGMSG(MYVTKDEBUG,"GetCellData() = "<<float(anOutput->GetCellData()->GetActualMemorySize()*1000)<<endl);
+ BEGMSG(MYVTKDEBUG,"GetActualMemorySize() = "<<float(anOutput->GetActualMemorySize()*1000)<<endl);
}
}
#ifndef _DEXCEPT_
}
#endif
- return aValForTime->myProfile;
+ return aProfileMergeFilter;
}
class vtkCell;
class vtkPoints;
-class VTKViewer_AppendFilter;
+class vtkMergeFilter;
class vtkUnstructuredGrid;
+class VTKViewer_AppendFilter;
#include "VISU_Convertor.hxx"
#include "MED_SliceArray.hxx"
using MED::TSlice;
typedef vtkUnstructuredGrid TDataSet;
- typedef vtkSmartPointer<TDataSet> TVTKSource;
+ typedef vtkSmartPointer<TDataSet> TVTKSource;
typedef vtkSmartPointer<vtkPoints> TVTKPoints;
+ typedef vtkSmartPointer<vtkMergeFilter> TVTKMergeFilter;
+
typedef vtkSmartPointer<VTKViewer_AppendFilter> TVTKAppendFilter;
+
typedef float TCoord;
//---------------------------------------------------------------
//---------------------------------------------------------------
class TSource: public virtual TSizeCounter
{
+ protected:
mutable TVTKSource mySource;
public:
TSource();
class TAppendFilter: public virtual TIsVTKDone,
public virtual TIDMapper
{
+ protected:
mutable TVTKAppendFilter myFilter;
public:
TAppendFilter();
};
+ //---------------------------------------------------------------
+ class TMergeFilter: public virtual TIsVTKDone,
+ public virtual TIDMapper
+ {
+ protected:
+ mutable TVTKMergeFilter myFilter;
+ public:
+ TMergeFilter();
+
+ const TVTKMergeFilter&
+ GetFilter() const;
+
+ virtual
+ TVTKOutput*
+ GetVTKOutput();
+ };
+
+
//---------------------------------------------------------------
typedef TVector<TCoord> TCoordArray;
typedef TSlice<TCoordArray> TCoordSlice;
class TPointCoords: public virtual TBaseStructure
{
+ protected:
vtkIdType myDim;
vtkIdType myNbPoints;
class TNamedPointCoords: public virtual TPointCoords
{
+ protected:
typedef TVector<std::string> TPointsDim;
TPointsDim myPointsDim;
TVectorID myVectorID;
typedef SharedPtr<TProfileImpl> PProfileImpl;
+ //---------------------------------------------------------------
+ struct TProfileMergeFilter: virtual TMergeFilter
+ {
+ TProfileImpl myProfile;
+ TSource mySource;
+
+ virtual
+ vtkIdType
+ GetNodeObjID(vtkIdType theID) const;
+
+ virtual
+ vtkIdType
+ GetNodeVTKID(vtkIdType theID) const;
+
+ virtual
+ float*
+ GetNodeCoord(vtkIdType theObjID);
+
+ virtual
+ vtkIdType
+ GetElemObjID(vtkIdType theID) const;
+
+ virtual
+ vtkIdType
+ GetElemVTKID(vtkIdType theID) const;
+
+ virtual
+ vtkCell*
+ GetElemCell(vtkIdType theObjID);
+
+ virtual
+ TVTKOutput*
+ GetVTKOutput();
+ };
+ typedef SharedPtr<TProfileMergeFilter> PProfileMergeFilter;
+
+
//---------------------------------------------------------------
struct TGaussImpl: virtual TGauss
{
struct TValForTimeImpl: virtual TValForTime
{
+ PProfileMergeFilter myProfileMergeFilter;
TGeom2Value myGeom2Value;
+ vtkIdType myNbGauss;
+
+ TValForTimeImpl();
const TMeshValue&
GetMeshValue(vtkIdType theGeom) const;
TMeshValue&
GetMeshValue(vtkIdType theGeom);
- vtkIdType myNbGauss;
-
virtual
int
GetNbGauss(vtkIdType theGeom) const;