VISU_ElnoAssembleFilter.hxx \
VISU_DeformationPL.hxx \
VISU_OptionalDeformationPL.hxx \
- VISU_XYPlotActor.hxx
+ VISU_XYPlotActor.hxx \
+ VISU_CellDataToPointData.hxx
dist_libVisuPipeLine_la_SOURCES= \
VISU_MapperHolder.cxx \
VISU_ElnoAssembleFilter.cxx \
VISU_DeformationPL.cxx \
VISU_OptionalDeformationPL.cxx\
- VISU_XYPlotActor.cxx
+ VISU_XYPlotActor.cxx \
+ VISU_CellDataToPointData.cxx
libVisuPipeLine_la_CPPFLAGS= \
$(VTK_INCLUDES) \
--- /dev/null
+/*=========================================================================
+
+ Program: Visualization Toolkit
+ Module: $RCSfile$
+
+ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
+ All rights reserved.
+ See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notice for more information.
+
+ Note from SALOME:
+ This file is a part of VTK library
+ It has been renamed and modified for SALOME project
+
+=========================================================================*/
+
+#include "VISU_CellDataToPointData.hxx"
+
+#include <vtkCellData.h>
+#include <vtkDataSet.h>
+#include <vtkIdList.h>
+#include <vtkInformation.h>
+#include <vtkInformationVector.h>
+#include <vtkObjectFactory.h>
+#include <vtkPointData.h>
+
+vtkCxxRevisionMacro(VISU_CellDataToPointData, "$Revision$");
+vtkStandardNewMacro(VISU_CellDataToPointData);
+
+//----------------------------------------------------------------------------
+// Instantiate object so that cell data is not passed to output.
+VISU_CellDataToPointData::VISU_CellDataToPointData()
+{
+ this->PassCellData = 0;
+}
+
+#define VTK_MAX_CELLS_PER_POINT 4096
+
+//----------------------------------------------------------------------------
+int VISU_CellDataToPointData::RequestData(
+ vtkInformation*,
+ vtkInformationVector** inputVector,
+ vtkInformationVector* outputVector)
+{
+ vtkInformation* info = outputVector->GetInformationObject(0);
+ vtkDataSet *output = vtkDataSet::SafeDownCast(
+ info->Get(vtkDataObject::DATA_OBJECT()));
+
+ vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
+ vtkDataSet *input = vtkDataSet::SafeDownCast(
+ inInfo->Get(vtkDataObject::DATA_OBJECT()));
+
+ vtkIdType cellId, ptId;
+ vtkIdType numCells, numPts;
+ vtkCellData *inPD=input->GetCellData();
+ vtkPointData *outPD=output->GetPointData();
+ vtkIdList *cellIds;
+ double weight;
+ double *weights;
+
+ vtkDebugMacro(<<"Mapping cell data to point data");
+
+ // First, copy the input to the output as a starting point
+ output->CopyStructure( input );
+
+ cellIds = vtkIdList::New();
+ cellIds->Allocate(VTK_MAX_CELLS_PER_POINT);
+
+ if ( (numPts=input->GetNumberOfPoints()) < 1 )
+ {
+ vtkDebugMacro(<<"No input point data!");
+ cellIds->Delete();
+ return 1;
+ }
+ weights = new double[VTK_MAX_CELLS_PER_POINT];
+
+ // Pass the point data first. The fields and attributes
+ // which also exist in the cell data of the input will
+ // be over-written during CopyAllocate
+ output->GetPointData()->CopyGlobalIdsOff();
+ output->GetPointData()->PassData(input->GetPointData());
+ output->GetPointData()->CopyFieldOff("vtkGhostLevels");
+
+ // notice that inPD and outPD are vtkCellData and vtkPointData; respectively.
+ // It's weird, but it works.
+ outPD->InterpolateAllocate(inPD,numPts);
+
+ int abort=0;
+ vtkIdType progressInterval=numPts/20 + 1;
+ for (ptId=0; ptId < numPts && !abort; ptId++)
+ {
+ if ( !(ptId % progressInterval) )
+ {
+ this->UpdateProgress(static_cast<double>(ptId)/numPts);
+ abort = GetAbortExecute();
+ }
+
+ input->GetPointCells(ptId, cellIds);
+ numCells = cellIds->GetNumberOfIds();
+ if ( numCells > 0 )
+ {
+ weight = 1.0 / numCells;
+ for (cellId=0; cellId < numCells; cellId++)
+ {
+ weights[cellId] = weight;
+ }
+ outPD->InterpolatePoint(inPD, ptId, cellIds, weights);
+ }
+ else
+ {
+ outPD->NullPoint(ptId);
+ }
+ }
+
+ if ( !this->PassCellData )
+ {
+ output->GetCellData()->CopyAllOff();
+ output->GetCellData()->CopyFieldOn("vtkGhostLevels");
+ }
+ output->GetCellData()->PassData(input->GetCellData());
+
+ cellIds->Delete();
+ delete [] weights;
+
+ return 1;
+}
+
+//----------------------------------------------------------------------------
+void VISU_CellDataToPointData::PrintSelf(ostream& os, vtkIndent indent)
+{
+ this->Superclass::PrintSelf(os,indent);
+
+ os << indent << "Pass Cell Data: " << (this->PassCellData ? "On\n" : "Off\n");
+}
--- /dev/null
+/*=========================================================================
+
+ Program: Visualization Toolkit
+ Module: $RCSfile$
+
+ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
+ All rights reserved.
+ See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notice for more information.
+
+=========================================================================*/
+// .NAME VISU_CellDataToPointData - map cell data to point data
+// .SECTION Description
+// VISU_CellDataToPointData is a filter that transforms cell data (i.e., data
+// specified per cell) into point data (i.e., data specified at cell
+// points). The method of transformation is based on averaging the data
+// values of all cells using a particular point. Optionally, the input cell
+// data can be passed through to the output as well.
+
+// .SECTION Caveats
+// This filter is an abstract filter, that is, the output is an abstract type
+// (i.e., vtkDataSet). Use the convenience methods (e.g.,
+// GetPolyDataOutput(), GetStructuredPointsOutput(), etc.) to get the type
+// of output you want.
+
+// .SECTION See Also
+// vtkPointData vtkCellData vtkPointDataToCellData
+
+// note from SALOME:
+// This file is a part of VTK library
+// It has been renamed and modified for SALOME project
+
+#ifndef __VISU_CellDataToPointData_h
+#define __VISU_CellDataToPointData_h
+
+#include <vtkDataSetAlgorithm.h>
+
+class vtkDataSet;
+
+class VTK_GRAPHICS_EXPORT VISU_CellDataToPointData : public vtkDataSetAlgorithm
+{
+public:
+ static VISU_CellDataToPointData *New();
+ vtkTypeRevisionMacro(VISU_CellDataToPointData,vtkDataSetAlgorithm);
+ void PrintSelf(ostream& os, vtkIndent indent);
+
+ // Description:
+ // Control whether the input cell data is to be passed to the output. If
+ // on, then the input cell data is passed through to the output; otherwise,
+ // only generated point data is placed into the output.
+ vtkSetMacro(PassCellData,int);
+ vtkGetMacro(PassCellData,int);
+ vtkBooleanMacro(PassCellData,int);
+
+protected:
+ VISU_CellDataToPointData();
+ ~VISU_CellDataToPointData() {};
+
+ virtual int RequestData(vtkInformation* request,
+ vtkInformationVector** inputVector,
+ vtkInformationVector* outputVector);
+
+ int PassCellData;
+private:
+ VISU_CellDataToPointData(const VISU_CellDataToPointData&); // Not implemented.
+ void operator=(const VISU_CellDataToPointData&); // Not implemented.
+};
+
+#endif
+
+
#include <vtkDataSet.h>
#include <vtkPassThroughFilter.h>
#include <vtkWarpVector.h>
-#include <vtkCellDataToPointData.h>
#include <vtkUnstructuredGrid.h>
#ifdef _DEBUG_
static int MYDEBUG = 0;
myVectorMergeFilter->SetMergingInputs(true);
myInputPassFilter = vtkPassThroughFilter::New();
myOutputPassFiler = vtkPassThroughFilter::New();
- myCellDataToPointData = vtkCellDataToPointData::New();
+ myCellDataToPointData = VISU_CellDataToPointData::New();
myCellDataToPointData->PassCellDataOn();
myInputPassFilter->SetInput(vtkUnstructuredGrid::New());
class VISU_MergeFilter;
class vtkPassThroughFilter;
class vtkWarpVector;
-class vtkCellDataToPointData;
+class VISU_CellDataToPointData;
class VISU_PIPELINE_EXPORT VISU_DeformationPL {
vtkSmartPointer<VISU_MergeFilter> myVectorMergeFilter;
vtkPassThroughFilter *myInputPassFilter;
vtkPassThroughFilter *myOutputPassFiler;
- vtkCellDataToPointData *myCellDataToPointData;
+ VISU_CellDataToPointData *myCellDataToPointData;
private:
vtkFloatingPointType myScaleFactor;
#include <vtkImplicitBoolean.h>
#include <vtkImplicitFunction.h>
#include <vtkUnstructuredGrid.h>
-#include <vtkCellDataToPointData.h>
#include <vtkPointDataToCellData.h>
#include <vtkImplicitFunctionCollection.h>
myScalarsFieldTransform = VISU_FieldTransform::New();
- myCellDataToPointData = vtkCellDataToPointData::New();
+ myCellDataToPointData = VISU_CellDataToPointData::New();
myScalarsElnoDisassembleFilter = VISU_ElnoDisassembleFilter::New();
vtkImplicitBoolean* anImplicitBoolean = vtkImplicitBoolean::New();
class VISU_MergeFilter;
class vtkWarpVector;
class vtkUnstructuredGrid;
-class vtkCellDataToPointData;
+class VISU_CellDataToPointData;
class vtkPointDataToCellData;
class VISU_ElnoDisassembleFilter;
class SALOME_ExtractGeometry;
vtkWarpVector *myWarpVector;
VISU_MergeFilter *myScalarsMergeFilter;
vtkSmartPointer<vtkUnstructuredGrid> myScalars;
- vtkCellDataToPointData* myCellDataToPointData;
+ VISU_CellDataToPointData* myCellDataToPointData;
VISU_FieldTransform* myScalarsFieldTransform;
VISU_Extractor* myScalarsExtractor;
VISU_ElnoDisassembleFilter* myScalarsElnoDisassembleFilter;
SetIsFeatureEdgesAllowed(true);
myWarpVector = vtkWarpVector::New();
- myCellDataToPointData = vtkCellDataToPointData::New();
+ myCellDataToPointData = VISU_CellDataToPointData::New();
}
#include "VISUPipeline.hxx"
#include "VISU_ScalarMapPL.hxx"
-class vtkCellDataToPointData;
+class VISU_CellDataToPointData;
class SALOME_Transform;
class vtkWarpVector;
vtkFloatingPointType myScaleFactor;
vtkFloatingPointType myMapScaleFactor;
vtkWarpVector *myWarpVector;
- vtkCellDataToPointData* myCellDataToPointData;
+ VISU_CellDataToPointData* myCellDataToPointData;
private:
VISU_DeformedShapePL(const VISU_DeformedShapePL&); // Not implemented.
myContourFilter = vtkContourFilter::New();
- myCellDataToPointData = vtkCellDataToPointData::New();
+ myCellDataToPointData = VISU_CellDataToPointData::New();
}
#include "VISU_ScalarMapPL.hxx"
class vtkContourFilter;
-class vtkCellDataToPointData;
+class VISU_CellDataToPointData;
//----------------------------------------------------------------------------
int myNbParts;
vtkFloatingPointType myRange[2];
bool myIsRangeFixed;
- vtkCellDataToPointData* myCellDataToPointData;
+ VISU_CellDataToPointData* myCellDataToPointData;
vtkContourFilter *myContourFilter;
private:
#include <vtkDataSet.h>
#include <vtkPassThroughFilter.h>
#include <vtkWarpVector.h>
-#include <vtkCellDataToPointData.h>
#ifdef _DEBUG_
static int MYDEBUG = 0;
#else
#include "VISUPipeline.hxx"
#include "VISU_ConvertorUtils.hxx"
+#include "VISU_CellDataToPointData.hxx"
#include <vtkProperty.h>
#include <vtkObjectFactory.h>
#include <vtkDataSetMapper.h>
#include <vtkUnstructuredGrid.h>
-#include <vtkCellDataToPointData.h>
#include <vtkPointData.h>
#include <vtkCellData.h>
#include <vtkPolyData.h>
template<class TOutputFilter>
void
CellDataToPoint(TOutputFilter* theOutputFilter,
- vtkCellDataToPointData *theCellDataToPointData,
+ VISU_CellDataToPointData *theCellDataToPointData,
vtkDataSet* theDataSet)
{
#include <vtkCutter.h>
#include <vtkPlane.h>
-#include <vtkCellDataToPointData.h>
#include <vtkGeometryFilter.h>
#include <vtkContourFilter.h>
#include <vtkWarpScalar.h>
//----------------------------------------------------------------------------
VISU_Plot3DPL
::VISU_Plot3DPL():
- myCellDataToPointData(vtkCellDataToPointData::New()),
+ myCellDataToPointData(VISU_CellDataToPointData::New()),
myAppendPolyData(vtkAppendPolyData::New()),
myGeometryFilter(vtkGeometryFilter::New()),
myContourFilter(vtkContourFilter::New()),
class vtkWarpScalar;
class vtkContourFilter;
class vtkGeometryFilter;
-class vtkCellDataToPointData;
+class VISU_CellDataToPointData;
//----------------------------------------------------------------------------
vtkFloatingPointType myPosition, myScaleFactor, myMapScaleFactor;
VISU_CutPlanesPL::PlaneOrientation myOrientation;
- vtkSmartPointer<vtkCellDataToPointData> myCellDataToPointData;
+ vtkSmartPointer<VISU_CellDataToPointData> myCellDataToPointData;
vtkSmartPointer<vtkAppendPolyData> myAppendPolyData;
vtkSmartPointer<vtkGeometryFilter> myGeometryFilter;
vtkSmartPointer<vtkContourFilter> myContourFilter;