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
|
/*=========================================================================
Program: Visualization Toolkit
Module: vtkAbstractCellLinks.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 vtkAbstractCellLinks
* @brief an abstract base class for classes that build
* topological links from points to cells
*
* vtkAbstractCellLinks is a family of supplemental objects to vtkCellArray and
* vtkCellTypes, enabling fast access from points to the cells using the
* points. vtkAbstractCellLinks is an array of links, each link representing a
* list of cell ids using a particular point. The information provided by
* this object can be used to determine neighbors and construct other local
* topological information.
*
* @sa
* vtkCellLinks vtkStaticCellLinks vtkStaticCellLinksTemplate
*/
#ifndef vtkAbstractCellLinks_h
#define vtkAbstractCellLinks_h
#include "vtkCommonDataModelModule.h" // For export macro
#include "vtkObject.h"
class vtkDataSet;
class vtkCellArray;
class vtkIdList;
class VTKCOMMONDATAMODEL_EXPORT vtkAbstractCellLinks : public vtkObject
{
public:
//@{
/**
* Standard type and print methods.
*/
vtkTypeMacro(vtkAbstractCellLinks, vtkObject);
void PrintSelf(ostream& os, vtkIndent indent) override;
//@}
/**
* Build the link list array. All subclasses must implement this method.
*/
virtual void BuildLinks(vtkDataSet* data) = 0;
/**
* Release memory and revert to empty state.
*/
virtual void Initialize() = 0;
/**
* Reclaim any unused memory.
*/
virtual void Squeeze() = 0;
/**
* Reset to a state of no entries without freeing the memory.
*/
virtual void Reset() = 0;
/**
* Return the memory in kibibytes (1024 bytes) consumed by this cell links array.
* Used to support streaming and reading/writing data. The value
* returned is guaranteed to be greater than or equal to the memory
* required to actually represent the data represented by this object.
* The information returned is valid only after the pipeline has
* been updated.
*/
virtual unsigned long GetActualMemorySize() = 0;
/**
* Standard DeepCopy method. Since this object contains no reference
* to other objects, there is no ShallowCopy.
*/
virtual void DeepCopy(vtkAbstractCellLinks* src) = 0;
// Enums for cell links type. Note that the specialized type is
// set when users do not use ComputeType() and roll their own type.
enum CellLinksTypes
{
LINKS_NOT_DEFINED = 0,
CELL_LINKS = 1,
STATIC_CELL_LINKS_USHORT = 2,
STATIC_CELL_LINKS_UINT = 3,
STATIC_CELL_LINKS_IDTYPE = 4,
STATIC_CELL_LINKS_SPECIALIZED = 5
};
/**
* Based on the input (i.e., number of points, number of cells, and length
* of connectivity array) this helper method returns the integral type to
* use when instantiating cell link-related classes in order to properly
* represent the data. The return value is one of the types
* defined in the enum CellLinksType enum defined previously. Subclasses
* may choose to instantiate themselves with different integral types for
* performance and/or memory reasons. This method is useful when instantiating
* a vtkStaticCellLinksTemplate; when instantiating a vtkCellLinks the class
* is hardwired for vtkIdType.
*/
static int ComputeType(vtkIdType maxPtId, vtkIdType maxCellId, vtkCellArray* ca);
/**
* Return the type of locator (see enum above).
*/
int GetType() { return this->Type; }
/**
* These methods are not virtual due to performance concerns. However,
* subclasses of this class will implement them, using a combination of
* static_cast<> and templating used to invoke the methods in a way that
* the compiler can optimize.
*
* Get the number of cells using the point specified by ptId:
* vtkIdType GetNcells(vtkIdType ptId)
*
* Return a list of cell ids using the point.
* TIds *GetCells(vtkIdType ptId)
*/
//@{
/**
* Force sequential processing (i.e. single thread) of the link building
* process. By default, sequential processing is off. Note this flag only
* applies if the class has been compiled with VTK_SMP_IMPLEMENTATION_TYPE
* set to something other than Sequential. (If set to Sequential, then the
* filter always runs in serial mode.) This flag is typically used for
* benchmarking purposes.
*/
vtkSetMacro(SequentialProcessing, bool);
vtkGetMacro(SequentialProcessing, bool);
vtkBooleanMacro(SequentialProcessing, bool);
//@}
protected:
vtkAbstractCellLinks();
~vtkAbstractCellLinks() override;
bool SequentialProcessing; // control whether to thread or not
int Type; // derived classes set this instance variable when constructed
private:
vtkAbstractCellLinks(const vtkAbstractCellLinks&) = delete;
void operator=(const vtkAbstractCellLinks&) = delete;
};
#endif
|