/usr/include/vtk-7.1/vtkCellLinks.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 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkCellLinks.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 vtkCellLinks
* @brief object represents upward pointers from points to list of cells using each point
*
* vtkCellLinks is a supplemental object to vtkCellArray and vtkCellTypes,
* enabling access from points to the cells using the points. vtkCellLinks is
* a list of cell ids, each such link representing a dynamic list of cell ids
* using the point. The information provided by this object can be used to
* determine neighbors and construct other local topological information.
*
* @warning
* Note that this class is designed to support incremental link construction.
* More efficient cell links structures can be built with vtkStaticCellLinks
* (and vtkStaticCellLinksTemplate). However these other classes are typically
* meant for one-time (static) construction.
*
* @sa
* vtkCellArray vtkCellTypes vtkStaticCellLinks vtkStaticCellLinksTemplate
*/
#ifndef vtkCellLinks_h
#define vtkCellLinks_h
#include "vtkCommonDataModelModule.h" // For export macro
#include "vtkAbstractCellLinks.h"
class vtkDataSet;
class vtkCellArray;
class VTKCOMMONDATAMODEL_EXPORT vtkCellLinks : public vtkAbstractCellLinks
{
public:
class Link {
public:
unsigned short ncells;
vtkIdType *cells;
};
//@{
/**
* Standard methods to instantiate, print, and obtain type information.
*/
static vtkCellLinks *New();
vtkTypeMacro(vtkCellLinks,vtkAbstractCellLinks);
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
//@}
/**
* Build the link list array. All subclasses of vtkAbstractCellLinks
* must support this method.
*/
void BuildLinks(vtkDataSet *data) VTK_OVERRIDE;
/**
* Build the link list array with a provided connectivity array.
*/
void BuildLinks(vtkDataSet *data, vtkCellArray *Connectivity);
/**
* Allocate the specified number of links (i.e., number of points) that
* will be built.
*/
void Allocate(vtkIdType numLinks, vtkIdType ext=1000);
/**
* Clear out any previously allocated data structures
*/
void Initialize();
/**
* Get a link structure given a point id.
*/
Link &GetLink(vtkIdType ptId) {return this->Array[ptId];};
/**
* Get the number of cells using the point specified by ptId.
*/
unsigned short GetNcells(vtkIdType ptId) { return this->Array[ptId].ncells;};
/**
* Return a list of cell ids using the point.
*/
vtkIdType *GetCells(vtkIdType ptId) {return this->Array[ptId].cells;};
/**
* Insert a new point into the cell-links data structure. The size parameter
* is the initial size of the list.
*/
vtkIdType InsertNextPoint(int numLinks);
/**
* Insert a cell id into the list of cells (at the end) using the cell id
* provided. (Make sure to extend the link list (if necessary) using the
* method ResizeCellList().)
*/
void InsertNextCellReference(vtkIdType ptId, vtkIdType cellId);
/**
* Delete point (and storage) by destroying links to using cells.
*/
void DeletePoint(vtkIdType ptId);
/**
* Delete the reference to the cell (cellId) from the point (ptId). This
* removes the reference to the cellId from the cell list, but does not
* resize the list (recover memory with ResizeCellList(), if necessary).
*/
void RemoveCellReference(vtkIdType cellId, vtkIdType ptId);
/**
* Add the reference to the cell (cellId) from the point (ptId). This
* adds a reference to the cellId from the cell list, but does not resize
* the list (extend memory with ResizeCellList(), if necessary).
*/
void AddCellReference(vtkIdType cellId, vtkIdType ptId);
/**
* Change the length of a point's link list (i.e., list of cells using a
* point) by the size specified.
*/
void ResizeCellList(vtkIdType ptId, int size);
/**
* Reclaim any unused memory.
*/
void Squeeze();
/**
* Reset to a state of no entries without freeing the memory.
*/
void Reset();
/**
* 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.
*/
unsigned long GetActualMemorySize();
/**
* Standard DeepCopy method. Since this object contains no reference
* to other objects, there is no ShallowCopy.
*/
void DeepCopy(vtkCellLinks *src);
protected:
vtkCellLinks():Array(NULL),Size(0),MaxId(-1),Extend(1000) {}
~vtkCellLinks() VTK_OVERRIDE;
/**
* Increment the count of the number of cells using the point.
*/
void IncrementLinkCount(vtkIdType ptId) { this->Array[ptId].ncells++;};
void AllocateLinks(vtkIdType n);
/**
* Insert a cell id into the list of cells using the point.
*/
void InsertCellReference(vtkIdType ptId, unsigned short pos,
vtkIdType cellId);
Link *Array; // pointer to data
vtkIdType Size; // allocated size of data
vtkIdType MaxId; // maximum index inserted thus far
vtkIdType Extend; // grow array by this point
Link *Resize(vtkIdType sz); // function to resize data
private:
vtkCellLinks(const vtkCellLinks&) VTK_DELETE_FUNCTION;
void operator=(const vtkCellLinks&) VTK_DELETE_FUNCTION;
};
//----------------------------------------------------------------------------
inline void vtkCellLinks::InsertCellReference(vtkIdType ptId,
unsigned short pos,
vtkIdType cellId)
{
this->Array[ptId].cells[pos] = cellId;
}
//----------------------------------------------------------------------------
inline void vtkCellLinks::DeletePoint(vtkIdType ptId)
{
this->Array[ptId].ncells = 0;
delete [] this->Array[ptId].cells;
this->Array[ptId].cells = NULL;
}
//----------------------------------------------------------------------------
inline void vtkCellLinks::InsertNextCellReference(vtkIdType ptId,
vtkIdType cellId)
{
this->Array[ptId].cells[this->Array[ptId].ncells++] = cellId;
}
//----------------------------------------------------------------------------
inline void vtkCellLinks::RemoveCellReference(vtkIdType cellId, vtkIdType ptId)
{
vtkIdType *cells=this->Array[ptId].cells;
int ncells=this->Array[ptId].ncells;
for (int i=0; i < ncells; i++)
{
if (cells[i] == cellId)
{
for (int j=i; j < (ncells-1); j++)
{
cells[j] = cells[j+1];
}
this->Array[ptId].ncells--;
break;
}
}
}
//----------------------------------------------------------------------------
inline void vtkCellLinks::AddCellReference(vtkIdType cellId, vtkIdType ptId)
{
this->Array[ptId].cells[this->Array[ptId].ncells++] = cellId;
}
//----------------------------------------------------------------------------
inline void vtkCellLinks::ResizeCellList(vtkIdType ptId, int size)
{
int newSize;
vtkIdType *cells;
newSize = this->Array[ptId].ncells + size;
cells = new vtkIdType[newSize];
memcpy(cells, this->Array[ptId].cells,
this->Array[ptId].ncells*sizeof(vtkIdType));
delete [] this->Array[ptId].cells;
this->Array[ptId].cells = cells;
}
#endif
|