/usr/include/vtk-7.1/vtkSPHInterpolator.h is in libvtk7-dev 7.1.1+dfsg1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkSPHInterpolator.h
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.
=========================================================================*/
/**
* @class vtkSPHInterpolator
* @brief interpolate over point cloud using SPH kernels
*
*
* This filter uses SPH (smooth particle hydrodynamics) kernels to
* interpolate a data source onto an input structure. For example, while the
* data source is a set of particles, the data from these particles can be
* interpolated onto an input object such as a line, plane or volume. Then
* the output (which consists of the input structure plus interpolated data)
* can then be visualized using classical visualization techniques such as
* isocontouring, slicing, heat maps and so on.
*
* To use this filter, besides setting the input P and source Pc, specify a
* point locator (which accelerates queries about points and their neighbors)
* and an interpolation kernel (a subclass of vtkSPHKernel). In addition, the
* name of the source's density and mass arrays can optionally be provided;
* however if not provided then the local volume is computed from the
* kernel's spatial step. Finally, a cutoff distance array can optionall be
* provided when the local neighborhood around each point varies. The cutoff
* distance defines a local neighborhood in which the points in that
* neighborhood are used to interpolate values. If not provided, then the
* cutoff distance is computed from the spatial step size times the cutoff
* factor (see vtkSPHKernel).
*
* Other options to the filter include specifying which data attributes to
* interpolate from the source. By default, all data attributes contained in
* the source are interpolated. However, by adding array names to the
* exclusion list, these arrays will not be interpolated. Also, it is
* possible to use a SPH derivative formulation to interpolate from the
* source data attributes. This requires adding arrays (by name) to the
* derivative list, in which case the derivative formulation will be applied
* to create a new output array named "X_deriv" where X is the name of a
* source point attribute array.
*
* @warning
* This class has been threaded with vtkSMPTools. Using TBB or other
* non-sequential type (set in the CMake variable
* VTK_SMP_IMPLEMENTATION_TYPE) may improve performance significantly.
*
* @warning
* For widely spaced points in Pc, or when p is located outside the bounding
* region of Pc, the interpolation may behave badly and the interpolation
* process will adapt as necessary to produce output. For example, if the N
* closest points within R are requested to interpolate p, if N=0 then the
* interpolation will switch to a different strategy (which can be controlled
* as in the NullPointsStrategy).
*
* @warning
* For more information and technical reference, see D.J. Price, Smoothed
* particle hydrodynamics and magnetohydrodynamics,
* J. Comput. Phys. 231:759-794, 2012. Especially equation 49.
*
* @par Acknowledgments:
* The following work has been generously supported by Altair Engineering
* and FluiDyna GmbH. Please contact Steve Cosgrove or Milos Stanic for
* more information.
*
* @sa
* vtkPointInterpolator vtkSPHKernel vtkSPHQuinticKernel
*/
#ifndef vtkSPHInterpolator_h
#define vtkSPHInterpolator_h
#include "vtkFiltersPointsModule.h" // For export macro
#include "vtkDataSetAlgorithm.h"
#include "vtkStdString.h" // For vtkStdString ivars
#include <vector> //For STL vector
class vtkAbstractPointLocator;
class vtkIdList;
class vtkDoubleArray;
class vtkSPHKernel;
class vtkCharArray;
class vtkFloatArray;
class VTKFILTERSPOINTS_EXPORT vtkSPHInterpolator : public vtkDataSetAlgorithm
{
public:
//@{
/**
* Standard methods for instantiating, obtaining type information, and
* printing.
*/
static vtkSPHInterpolator *New();
vtkTypeMacro(vtkSPHInterpolator,vtkDataSetAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
//@}
//@{
/**
* Specify the dataset Pc that will be probed by the input points P. The
* Input P defines the dataset structure (the points and cells) for the
* output, while the Source Pc is probed (interpolated) to generate the
* scalars, vectors, etc. for the output points based on the point
* locations.
*/
void SetSourceData(vtkDataObject *source);
vtkDataObject *GetSource();
//@}
/**
* Specify the dataset Pc that will be probed by the input points P. The
* Input P defines the structure (the points and cells) for the output,
* while the Source Pc is probed (interpolated) to generate the scalars,
* vectors, etc. for the output points based on the point locations.
*/
void SetSourceConnection(vtkAlgorithmOutput* algOutput);
//@{
/**
* Specify a point locator. By default a vtkStaticPointLocator is
* used. The locator performs efficient searches to locate near a
* specified interpolation position.
*/
void SetLocator(vtkAbstractPointLocator *locator);
vtkGetObjectMacro(Locator,vtkAbstractPointLocator);
//@}
//@{
/**
* Specify an interpolation kernel. By default a vtkSPHQuinticKernel is used
* (i.e., closest point). The interpolation kernel changes the basis of the
* interpolation.
*/
void SetKernel(vtkSPHKernel *kernel);
vtkGetObjectMacro(Kernel,vtkSPHKernel);
//@}
//@{
/**
* Specify an (optional) cutoff distance for each point in the input P. If
* not specified, then the kernel cutoff is used.
*/
vtkSetMacro(CutoffArrayName,vtkStdString);
vtkGetMacro(CutoffArrayName,vtkStdString);
//@}
//@{
/**
* Specify the density array name. This is optional. Typically both the density
* and mass arrays are specified together (in order to compute the local volume).
* Both the mass and density arrays must consist of tuples of 1-component. (Note that
* the density array name specifies a point array found in the Pc source.)
*/
vtkSetMacro(DensityArrayName,vtkStdString);
vtkGetMacro(DensityArrayName,vtkStdString);
//@}
//@{
/**
* Specify the mass array name. This is optional. Typically both the
* density and mass arrays are specified together (in order to compute the
* local volume). Both the mass and density arrays must consist of tuples
* of 1-component. (Note that the mass array name specifies a point
* array found in the Pc source.)
*/
vtkSetMacro(MassArrayName,vtkStdString);
vtkGetMacro(MassArrayName,vtkStdString);
//@}
//@{
/**
* Adds an array to the list of arrays which are to be excluded from the
* interpolation process.
*/
void AddExcludedArray(const vtkStdString &excludedArray)
{
this->ExcludedArrays.push_back(excludedArray);
this->Modified();
}
//@}
//@{
/**
* Clears the contents of excluded array list.
*/
void ClearExcludedArrays()
{
this->ExcludedArrays.clear();
this->Modified();
}
//@}
/**
* Return the number of excluded arrays.
*/
int GetNumberOfExcludedArrays()
{return static_cast<int>(this->ExcludedArrays.size());}
//@{
/**
* Return the name of the ith excluded array.
*/
const char* GetExcludedArray(int i)
{
if ( i < 0 || i >= static_cast<int>(this->ExcludedArrays.size()) )
{
return NULL;
}
return this->ExcludedArrays[i].c_str();
}
//@}
//@{
/**
* Adds an array to the list of arrays whose derivative is to be taken. If
* the name of the array is "derivArray" this will produce an output array
* with the name "derivArray_deriv" (after filter execution).
*/
void AddDerivativeArray(const vtkStdString &derivArray)
{
this->DerivArrays.push_back(derivArray);
this->Modified();
}
//@}
//@{
/**
* Clears the contents of derivative array list.
*/
void ClearDerivativeArrays()
{
this->DerivArrays.clear();
this->Modified();
}
//@}
/**
* Return the number of derivative arrays.
*/
int GetNumberOfDerivativeArrays()
{return static_cast<int>(this->DerivArrays.size());}
//@{
/**
* Return the name of the ith derivative array.
*/
const char* GetDerivativeArray(int i)
{
if ( i < 0 || i >= static_cast<int>(this->DerivArrays.size()) )
{
return NULL;
}
return this->DerivArrays[i].c_str();
}
//@}
// How to handle NULL points
enum NullStrategy
{
MASK_POINTS=0,
NULL_VALUE=1
};
//@{
/**
* Specify a strategy to use when encountering a "null" point during the
* interpolation process. Null points occur when the local neighborhood (of
* nearby points to interpolate from) is empty. If the strategy is set to
* MaskPoints, then an output array is created that marks points as being
* valid (=1) or null (invalid =0) (and the NullValue is set as well). If
* the strategy is set to NullValue, then the output data value(s) are set
* to the NullPoint value.
*/
vtkSetMacro(NullPointsStrategy,int);
vtkGetMacro(NullPointsStrategy,int);
void SetNullPointsStrategyToMaskPoints()
{ this->SetNullPointsStrategy(MASK_POINTS); }
void SetNullPointsStrategyToNullValue()
{ this->SetNullPointsStrategy(NULL_VALUE); }
//@}
//@{
/**
* If the NullPointsStrategy == MASK_POINTS, then an array is generated for
* each input point. This vtkCharArray is placed into the output of the filter,
* with a non-zero value for a valid point, and zero otherwise. The name of
* this masking array is specified here.
*/
vtkSetMacro(ValidPointsMaskArrayName, vtkStdString);
vtkGetMacro(ValidPointsMaskArrayName, vtkStdString);
//@}
//@{
/**
* Specify the null point value. When a null point is encountered then all
* components of each null tuple are set to this value. By default the
* null value is set to zero.
*/
vtkSetMacro(NullValue,double);
vtkGetMacro(NullValue,double);
//@}
//@{
/**
* Indicate whether to compute the summation of weighting coefficients (the
* so-called Shepard sum). In the interior of a SPH point cloud, the
* Shephard summation value should be ~1.0. Towards the boundary, the
* Shepard summation generally falls off <1.0. If ComputeShepardSum is specified, then the
* output will contain an array of summed Shepard weights for each output
* point. On by default.
*/
vtkSetMacro(ComputeShepardSum, bool);
vtkBooleanMacro(ComputeShepardSum, bool);
vtkGetMacro(ComputeShepardSum, bool);
//@}
//@{
/**
* If ComputeShepardSum is on, then an array is generated with name
* ShepardSumArrayName for each input point. This vtkFloatArray is placed
* into the output of the filter, and NullPoints have value =0.0. The
* default name is "Shepard Summation".
*/
vtkSetMacro(ShepardSumArrayName, vtkStdString);
vtkGetMacro(ShepardSumArrayName, vtkStdString);
//@}
//@{
/**
* If enabled, then input arrays that are non-real types (i.e., not float
* or double) are promoted to float type on output. This is because the
* interpolation process may not be well behaved when integral types are
* combined using interpolation weights.
*/
vtkSetMacro(PromoteOutputArrays, bool);
vtkBooleanMacro(PromoteOutputArrays, bool);
vtkGetMacro(PromoteOutputArrays, bool);
//@}
//@{
/**
* Indicate whether to shallow copy the input point data arrays to the
* output. On by default.
*/
vtkSetMacro(PassPointArrays, bool);
vtkBooleanMacro(PassPointArrays, bool);
vtkGetMacro(PassPointArrays, bool);
//@}
//@{
/**
* Indicate whether to shallow copy the input cell data arrays to the
* output. On by default.
*/
vtkSetMacro(PassCellArrays, bool);
vtkBooleanMacro(PassCellArrays, bool);
vtkGetMacro(PassCellArrays, bool);
//@}
//@{
/**
* Indicate whether to pass the field-data arrays from the input to the
* output. On by default.
*/
vtkSetMacro(PassFieldArrays, bool);
vtkBooleanMacro(PassFieldArrays, bool);
vtkGetMacro(PassFieldArrays, bool);
//@}
/**
* Get the MTime of this object also considering the locator and kernel.
*/
vtkMTimeType GetMTime();
protected:
vtkSPHInterpolator();
~vtkSPHInterpolator();
vtkAbstractPointLocator *Locator;
vtkSPHKernel *Kernel;
vtkStdString CutoffArrayName;
vtkStdString DensityArrayName;
vtkStdString MassArrayName;
std::vector<vtkStdString> ExcludedArrays;
std::vector<vtkStdString> DerivArrays;
int NullPointsStrategy;
double NullValue;
vtkStdString ValidPointsMaskArrayName;
vtkCharArray *ValidPointsMask;
bool ComputeShepardSum;
vtkStdString ShepardSumArrayName;
vtkFloatArray *ShepardSumArray;
bool PromoteOutputArrays;
bool PassCellArrays;
bool PassPointArrays;
bool PassFieldArrays;
virtual int RequestData(vtkInformation *, vtkInformationVector **,
vtkInformationVector *);
virtual int RequestInformation(vtkInformation *, vtkInformationVector **,
vtkInformationVector *);
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **,
vtkInformationVector *);
/**
* Virtual for specialized subclass(es)
*/
virtual void Probe(vtkDataSet *input, vtkDataSet *source, vtkDataSet *output);
/**
* Call at end of RequestData() to pass attribute data respecting the
* PassCellArrays, PassPointArrays, PassFieldArrays flags.
*/
virtual void PassAttributeData(
vtkDataSet* input, vtkDataObject* source, vtkDataSet* output);
/**
* Internal method to extract image metadata
*/
void ExtractImageDescription(vtkImageData *input, int dims[3],
double origin[3], double spacing[3]);
private:
vtkSPHInterpolator(const vtkSPHInterpolator&) VTK_DELETE_FUNCTION;
void operator=(const vtkSPHInterpolator&) VTK_DELETE_FUNCTION;
};
#endif
|