#ifndef vtkStaticDataSetSurfaceFilter_h
#define vtkStaticDataSetSurfaceFilter_h
-#include "vtkDataSetSurfaceFilter.h"
-#include "vtkNew.h"
+#include <vtkDataSetSurfaceFilter.h>
+#include <vtkNew.h>
class vtkPolyData;
static vtkStaticDataSetSurfaceFilter* New();
typedef vtkDataSetSurfaceFilter
Superclass; // vtkTypeMacro can't be used with a factory built object
- void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
+ void PrintSelf(ostream& os, vtkIndent indent) override;
- int UnstructuredGridExecute(vtkDataSet* input, vtkPolyData* output) VTK_OVERRIDE;
+ int UnstructuredGridExecute(vtkDataSet* input, vtkPolyData* output) override;
protected:
vtkStaticDataSetSurfaceFilter();
- ~vtkStaticDataSetSurfaceFilter() VTK_OVERRIDE;
+ ~vtkStaticDataSetSurfaceFilter() override;
vtkNew<vtkPolyData> Cache;
vtkMTimeType InputMeshTime;
private:
// Hide these from the user and the compiler.
- vtkStaticDataSetSurfaceFilter(const vtkStaticDataSetSurfaceFilter&) VTK_DELETE_FUNCTION;
- void operator=(const vtkStaticDataSetSurfaceFilter&) VTK_DELETE_FUNCTION;
+ vtkStaticDataSetSurfaceFilter(const vtkStaticDataSetSurfaceFilter&) = delete;
+ void operator=(const vtkStaticDataSetSurfaceFilter&) = delete;
};
#endif
#ifndef vtkStaticEnSight6BinaryReader_h
#define vtkStaticEnSight6BinaryReader_h
-#include "vtkEnSight6BinaryReader.h"
-#include "vtkNew.h"
+#include <vtkEnSight6BinaryReader.h>
+#include <vtkNew.h>
class vtkMultiBlockDataSet;
#ifndef vtkStaticEnSight6Reader_h
#define vtkStaticEnSight6Reader_h
-#include "vtkEnSight6Reader.h"
-#include "vtkNew.h"
+#include <vtkEnSight6Reader.h>
+#include <vtkNew.h>
class vtkMultiBlockDataSet;
#ifndef vtkStaticEnSightGoldBinaryReader_h
#define vtkStaticEnSightGoldBinaryReader_h
-#include "vtkEnSightGoldBinaryReader.h"
-#include "vtkNew.h"
+#include <vtkEnSightGoldBinaryReader.h>
+#include <vtkNew.h>
class vtkMultiBlockDataSet;
#ifndef vtkStaticEnSightGoldReader_h
#define vtkStaticEnSightGoldReader_h
-#include "vtkEnSightGoldReader.h"
-#include "vtkNew.h"
+#include <vtkEnSightGoldReader.h>
+#include <vtkNew.h>
class vtkMultiBlockDataSet;
#ifndef vtkStaticMeshObjectFactory_h
#define vtkStaticMeshObjectFactory_h
-#include "vtkObjectFactory.h" // Must be included before singletons
+#include <vtkObjectFactory.h> // Must be included before singletons
class vtkStaticMeshObjectFactory : public vtkObjectFactory
{
public:
vtkTypeMacro(vtkStaticMeshObjectFactory, vtkObjectFactory);
static vtkStaticMeshObjectFactory* New();
- void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
+ void PrintSelf(ostream& os, vtkIndent indent) override;
/**
* All sub-classes of vtkObjectFactory must return the version of
* As the version needs to be compiled into the file as a string constant.
* This is critical to determine possible incompatible dynamic factory loads.
*/
- const char* GetVTKSourceVersion() VTK_OVERRIDE;
+ const char* GetVTKSourceVersion() override;
/**
* Return a descriptive string describing the factory.
*/
- const char* GetDescription() VTK_OVERRIDE;
+ const char* GetDescription() override;
protected:
vtkStaticMeshObjectFactory();
- ~vtkStaticMeshObjectFactory() VTK_OVERRIDE;
+ ~vtkStaticMeshObjectFactory() override;
private:
- vtkStaticMeshObjectFactory(const vtkStaticMeshObjectFactory&) VTK_DELETE_FUNCTION;
- void operator=(const vtkStaticMeshObjectFactory&) VTK_DELETE_FUNCTION;
+ vtkStaticMeshObjectFactory(const vtkStaticMeshObjectFactory&) = delete;
+ void operator=(const vtkStaticMeshObjectFactory&) = delete;
};
#endif
static vtkStaticPUnstructuredGridGhostCellsGenerator* New();
typedef vtkPUnstructuredGridGhostCellsGenerator
Superclass; // vtkTypeMacro can't be used with a factory built object
- void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
+ void PrintSelf(ostream& os, vtkIndent indent) override;
- int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) VTK_OVERRIDE;
+ int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
protected:
vtkStaticPUnstructuredGridGhostCellsGenerator();
- ~vtkStaticPUnstructuredGridGhostCellsGenerator() VTK_OVERRIDE;
+ ~vtkStaticPUnstructuredGridGhostCellsGenerator() override;
/**
* Check input for "ProcessId" and "Ids" point and cell array,
private:
// Hide these from the user and the compiler.
vtkStaticPUnstructuredGridGhostCellsGenerator(
- const vtkStaticPUnstructuredGridGhostCellsGenerator&) VTK_DELETE_FUNCTION;
- void operator=(const vtkStaticPUnstructuredGridGhostCellsGenerator&) VTK_DELETE_FUNCTION;
+ const vtkStaticPUnstructuredGridGhostCellsGenerator&) = delete;
+ void operator=(const vtkStaticPUnstructuredGridGhostCellsGenerator&) = delete;
};
#endif
#include <vtkPointData.h>
#include <vtkPolyData.h>
#include <vtkUnstructuredGrid.h>
+#include <vtkGenericCell.h>
vtkStandardNewMacro(vtkStaticPlaneCutter);
+static const char* IdsArrayName = "__vtkSPC_Ids";
+
//----------------------------------------------------------------------------
vtkStaticPlaneCutter::vtkStaticPlaneCutter()
{
//----------------------------------------------------------------------------
vtkStaticPlaneCutter::~vtkStaticPlaneCutter()
{
+ this->ClearWeightsVector();
}
//-----------------------------------------------------------------------------
return 0;
}
- // Recover the fisrt and only block so this works with single block mb
+ // Recover the first and only block so this works with single block mb
if (inputMB && inputMB->GetNumberOfBlocks() == 1)
{
input = vtkUnstructuredGrid::SafeDownCast(inputMB->GetBlock(0));
vtkErrorMacro("Output is not of expected type");
return 0;
}
- this->RemovePointData(output);
this->Cache->ShallowCopy(output);
this->InputMeshTime = input->GetMeshMTime();
this->FilterMTime = this->GetMTime();
- // Compute the cell ids to be passed from the input to the cache
- this->ComputeCellIds();
-
+ // Compute the ids to be passed from the input to the cache
+ this->ComputeIds(input);
+ this->RemoveIdsArray(this->Cache);
return ret;
}
}
//-----------------------------------------------------------------------------
void vtkStaticPlaneCutter::AddIdsArray(vtkDataSet* input, vtkDataSet* output)
{
- vtkDataSet* tmpInput;
- tmpInput = input;
+ vtkDataSet* tmpInput = input;
vtkNew<vtkIdFilter> generateIdScalars;
// Check for Ids array
- vtkAbstractArray* cellIdsTmp = input->GetCellData()->GetAbstractArray("Ids");
+ vtkIdTypeArray *cellIdsTmp = vtkIdTypeArray::SafeDownCast(input->GetCellData()->GetAbstractArray(IdsArrayName));
if (!cellIdsTmp)
{
// Create Ids array
generateIdScalars->SetInputData(tmpInput);
- generateIdScalars->SetIdsArrayName("Ids");
+ generateIdScalars->SetIdsArrayName(IdsArrayName);
+ generateIdScalars->FieldDataOn();
generateIdScalars->Update();
tmpInput = generateIdScalars->GetOutput();
}
}
//-----------------------------------------------------------------------------
-void vtkStaticPlaneCutter::RemovePointData(vtkMultiPieceDataSet* dataset)
+void vtkStaticPlaneCutter::RemoveIdsArray(vtkMultiPieceDataSet* output)
{
- // Iterate over each piece of the multipiece output
- vtkCompositeDataIterator* iter = dataset->NewIterator();
+ vtkSmartPointer<vtkCompositeDataIterator> iter;
+ iter.TakeReference(output->NewIterator());
iter->SkipEmptyNodesOn();
for (iter->GoToFirstItem(); !iter->IsDoneWithTraversal(); iter->GoToNextItem())
{
vtkPolyData* slice = vtkPolyData::SafeDownCast(iter->GetCurrentDataObject());
if (slice)
{
- // Remove all point data array on each slice
- vtkPointData* pd = slice->GetPointData();
- for (int i = pd->GetNumberOfArrays() - 1; i >= 0; i--)
- {
- pd->RemoveArray(i);
- }
+ slice->GetCellData()->RemoveArray(IdsArrayName);
}
}
- iter->Delete();
}
//-----------------------------------------------------------------------------
-void vtkStaticPlaneCutter::ComputeCellIds()
+void vtkStaticPlaneCutter::ClearWeightsVector()
+{
+ for(auto& weightsVector : this->WeightsVectorCompo)
+ {
+ delete[] weightsVector[0].second;
+ }
+ this->WeightsVectorCompo.clear();
+}
+
+//-----------------------------------------------------------------------------
+void vtkStaticPlaneCutter::ComputeIds(vtkUnstructuredGrid* input)
{
this->CellToCopyFrom.clear();
this->CellToCopyTo.clear();
+ this->ClearWeightsVector();
// Iterate over each piece of the multipiece output
- vtkCompositeDataIterator* iter = this->Cache->NewIterator();
+ vtkNew<vtkGenericCell> tmpCell;
+ vtkSmartPointer<vtkCompositeDataIterator> iter;
+ iter.TakeReference(this->Cache->NewIterator());
iter->SkipEmptyNodesOn();
for (iter->GoToFirstItem(); !iter->IsDoneWithTraversal(); iter->GoToNextItem())
{
vtkPolyData* slice = vtkPolyData::SafeDownCast(iter->GetCurrentDataObject());
- if (slice)
+ vtkIdType sliceNbPoints = slice ? slice->GetNumberOfPoints() : 0;
+ if (sliceNbPoints > 0)
{
// For each piece, recover the Ids of the cells sliced and the corresponding
// cellId in the slice
this->CellToCopyFrom.push_back(cellIdsFrom);
this->CellToCopyTo.push_back(cellIdsTo);
- vtkIdTypeArray* ids = vtkIdTypeArray::SafeDownCast(slice->GetCellData()->GetArray("Ids"));
+ vtkIdTypeArray* ids = vtkIdTypeArray::SafeDownCast(slice->GetCellData()->GetArray(IdsArrayName));
+ assert(ids);
cellIdsFrom->SetNumberOfIds(ids->GetNumberOfValues());
cellIdsTo->SetNumberOfIds(ids->GetNumberOfValues());
for (vtkIdType i = 0; i < ids->GetNumberOfValues(); i++)
cellIdsFrom->SetId(i, ids->GetValue(i));
cellIdsTo->SetId(i, i);
}
+ if (input->GetPointData()->GetNumberOfArrays() > 0)
+ {
+ slice->BuildLinks();
+ vtkIdType maxCellSize = input->GetMaxCellSize();
+ std::vector<std::pair<vtkSmartPointer<vtkIdList>, double*>> weightsVector;
+ weightsVector.resize(sliceNbPoints);
+ double *allWeights = new double[maxCellSize * sliceNbPoints];
+ for (vtkIdType i = 0; i < sliceNbPoints; i++)
+ {
+ vtkNew<vtkIdList> ptIds;
+ double *weights = &allWeights[maxCellSize * i];
+ unsigned short ncells;
+ vtkIdType *cells;
+ slice->GetPointCells(i, ncells, cells);
+ vtkIdType cellId = cellIdsFrom->GetId(cells[0]);
+ assert(cellId < input->GetNumberOfCells());
+ input->GetCell(cellId, tmpCell);
+ input->GetCellPoints(cellId, ptIds);
+ double dist, pcoords[3], x[3], p[3];
+ int subId = 0;
+ slice->GetPoint(i, p);
+ tmpCell->EvaluatePosition(p, x, subId, pcoords, dist, weights);
+ weightsVector[i] = { ptIds, weights };
+ }
+ this->WeightsVectorCompo.push_back(weightsVector);
+ }
}
}
- iter->Delete();
}
//-----------------------------------------------------------------------------
mpFieldData->RemoveArray(i);
}
- // Recover cell data
- // We may want to improve this and support PointData at some point
+ // Recover cell/point data
vtkCellData* inCD = input->GetCellData();
+ vtkPointData* inPD = input->GetPointData();
- vtkCompositeDataIterator* iter = this->Cache->NewIterator();
+ vtkSmartPointer<vtkCompositeDataIterator> iter;
+ iter.TakeReference(this->Cache->NewIterator());
iter->SkipEmptyNodesOn();
- int i = 0;
+ int blockId = 0;
for (iter->GoToFirstItem(); !iter->IsDoneWithTraversal(); iter->GoToNextItem())
{
vtkPolyData* slice = vtkPolyData::SafeDownCast(iter->GetCurrentDataObject());
- if (slice)
+ if (slice && slice->GetNumberOfPoints() > 0)
{
vtkCellData* sliceCD = slice->GetCellData();
for (int iArr = 0; iArr < inCD->GetNumberOfArrays(); iArr++)
if (arrayToCopyIn)
{
// Copy the tuples from the input cell ids to the slice cell ids
- arrayToCopyIn->InsertTuples(this->CellToCopyTo[i].Get(), this->CellToCopyFrom[i].Get(),
+ arrayToCopyIn->InsertTuples(this->CellToCopyTo[blockId].Get(), this->CellToCopyFrom[blockId].Get(),
inCD->GetAbstractArray(iArr));
}
}
+
+ if (input->GetPointData()->GetNumberOfArrays() > 0)
+ {
+ vtkPointData* slicePD = slice->GetPointData();
+ vtkIdType sliceNbPoints = slice->GetNumberOfPoints();
+ slicePD->InterpolateAllocate(inPD, sliceNbPoints);
+ auto& weightsVector = this->WeightsVectorCompo[blockId];
+ for (vtkIdType ptIdx = 0; ptIdx < sliceNbPoints; ptIdx++)
+ {
+ slicePD->InterpolatePoint(inPD, ptIdx, weightsVector[ptIdx].first, weightsVector[ptIdx].second);
+ }
+ }
+
// Update field data
slice->GetFieldData()->PassData(input->GetFieldData());
+ blockId++;
}
- i++;
}
- iter->Delete();
}
//----------------------------------------------------------------------------
public:
static vtkStaticPlaneCutter* New();
typedef vtkPlaneCutter Superclass; // vtkTypeMacro can't be used with a factory built object
- void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
+ void PrintSelf(ostream &os, vtkIndent indent) override;
- int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) VTK_OVERRIDE;
+ int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
protected:
vtkStaticPlaneCutter();
- ~vtkStaticPlaneCutter() VTK_OVERRIDE;
+ ~vtkStaticPlaneCutter() override;
/**
- * Check input for "Ids" cell array, if absent, compute and add them.
+ * Check input for Ids cell array, if absent, compute and add them.
*/
static void AddIdsArray(vtkDataSet* input, vtkDataSet* output);
/**
- * Update cache point, cell and field data using input
+ * Remove an Ids cell array in all polydata pieces of output
*/
- void UpdateCacheData(vtkDataSet* input);
+ static void RemoveIdsArray(vtkMultiPieceDataSet* output);
/**
- * Compute the cells ids to be used when updating the cache later
+ * Update cache point, cell and field data using input
*/
- void ComputeCellIds();
+ void UpdateCacheData(vtkDataSet* input);
/**
- * Remove all point data array of a multipiece input with polydata leafs
+ * Compute the ids and weights to be used when updating the cache later
*/
- static void RemovePointData(vtkMultiPieceDataSet* dataset);
+ void ComputeIds(vtkUnstructuredGrid* input);
+
+ void ClearWeightsVector();
vtkNew<vtkMultiPieceDataSet> Cache;
std::vector<vtkSmartPointer<vtkIdList> > CellToCopyFrom;
std::vector<vtkSmartPointer<vtkIdList> > CellToCopyTo;
+ std::vector<std::vector<std::pair<vtkSmartPointer<vtkIdList>, double*>>> WeightsVectorCompo;
vtkMTimeType InputMeshTime;
vtkMTimeType FilterMTime;
private:
// Hide these from the user and the compiler.
- vtkStaticPlaneCutter(const vtkStaticPlaneCutter&) VTK_DELETE_FUNCTION;
- void operator=(const vtkStaticPlaneCutter&) VTK_DELETE_FUNCTION;
+ vtkStaticPlaneCutter(const vtkStaticPlaneCutter&) = delete;
+ void operator=(const vtkStaticPlaneCutter&) = delete;
};
#endif
=========================================================================*/
#include "vtkTemporalUGWavelet.h"
-#include "vtkCellData.h"
-#include "vtkDataSetTriangleFilter.h"
-#include "vtkFloatArray.h"
-#include "vtkImageData.h"
-#include "vtkInformation.h"
-#include "vtkInformationVector.h"
-#include "vtkMultiProcessController.h"
-#include "vtkNew.h"
-#include "vtkObjectFactory.h"
-#include "vtkPointData.h"
-#include "vtkRTAnalyticSource.h"
-#include "vtkStreamingDemandDrivenPipeline.h"
-#include "vtkUnstructuredGrid.h"
+#include <vtkCellData.h>
+#include <vtkDataSetTriangleFilter.h>
+#include <vtkFloatArray.h>
+#include <vtkImageData.h>
+#include <vtkInformation.h>
+#include <vtkInformationVector.h>
+#include <vtkMultiProcessController.h>
+#include <vtkNew.h>
+#include <vtkObjectFactory.h>
+#include <vtkPointData.h>
+#include <vtkRTAnalyticSource.h>
+#include <vtkStreamingDemandDrivenPipeline.h>
+#include <vtkUnstructuredGrid.h>
vtkStandardNewMacro(vtkTemporalUGWavelet);
#ifndef vtkTemporalUGWavelet_h
#define vtkTemporalUGWavelet_h
-#include "vtkRTAnalyticSource.h"
+#include <vtkRTAnalyticSource.h>
class vtkUnstructuredGrid;
public:
static vtkTemporalUGWavelet* New();
vtkTypeMacro(vtkTemporalUGWavelet, vtkRTAnalyticSource);
- void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
+ void PrintSelf(ostream& os, vtkIndent indent) override;
//@{
/**
vtkTemporalUGWavelet();
~vtkTemporalUGWavelet();
- int FillOutputPortInformation(int vtkNotUsed(port), vtkInformation* info) VTK_OVERRIDE;
+ int FillOutputPortInformation(int vtkNotUsed(port), vtkInformation* info) override;
int RequestInformation(vtkInformation* request, vtkInformationVector** inputVector,
- vtkInformationVector* outputVector) VTK_OVERRIDE;
+ vtkInformationVector* outputVector) override;
- int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) VTK_OVERRIDE;
+ int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
int NumberOfTimeSteps;
vtkUnstructuredGrid* Cache;
vtkTimeStamp CacheMTime;
private:
- vtkTemporalUGWavelet(const vtkTemporalUGWavelet&) VTK_DELETE_FUNCTION;
- void operator=(const vtkTemporalUGWavelet&) VTK_DELETE_FUNCTION;
+ vtkTemporalUGWavelet(const vtkTemporalUGWavelet&) = delete;
+ void operator=(const vtkTemporalUGWavelet&) = delete;
};
#endif