/usr/include/vtk-6.2/vtkDenseArray.h is in libvtk6-dev 6.2.0+dfsg1-10build1.
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 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkDenseArray.h
-------------------------------------------------------------------------
Copyright 2008 Sandia Corporation.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------
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 vtkDenseArray - Contiguous storage for N-way arrays.
//
// .SECTION Description
// vtkDenseArray is a concrete vtkArray implementation that stores values
// using a contiguous block of memory. Values are stored with fortran ordering,
// meaning that if you iterated over the memory block, the left-most coordinates
// would vary the fastest.
//
// In addition to the retrieval and update methods provided by vtkTypedArray,
// vtkDenseArray provides methods to:
//
// Fill the entire array with a specific value.
//
// Retrieve a pointer to the storage memory block.
//
// .SECTION See Also
// vtkArray, vtkTypedArray, vtkSparseArray
//
// .SECTION Thanks
// Developed by Timothy M. Shead (tshead@sandia.gov) at Sandia National Laboratories.
#ifndef vtkDenseArray_h
#define vtkDenseArray_h
#include "vtkArrayCoordinates.h"
#include "vtkObjectFactory.h"
#include "vtkTypedArray.h"
#include "vtkTypeTemplate.h"
template<typename T>
class vtkDenseArray :
public vtkTypeTemplate<vtkDenseArray<T>, vtkTypedArray<T> >
{
public:
static vtkDenseArray<T>* New();
void PrintSelf(ostream &os, vtkIndent indent);
typedef typename vtkArray::CoordinateT CoordinateT;
typedef typename vtkArray::DimensionT DimensionT;
typedef typename vtkArray::SizeT SizeT;
// vtkArray API
bool IsDense();
const vtkArrayExtents& GetExtents();
SizeT GetNonNullSize();
void GetCoordinatesN(const SizeT n, vtkArrayCoordinates& coordinates);
vtkArray* DeepCopy();
// vtkTypedArray API
const T& GetValue(CoordinateT i);
const T& GetValue(CoordinateT i, CoordinateT j);
const T& GetValue(CoordinateT i, CoordinateT j, CoordinateT k);
const T& GetValue(const vtkArrayCoordinates& coordinates);
const T& GetValueN(const SizeT n);
void SetValue(CoordinateT i, const T& value);
void SetValue(CoordinateT i, CoordinateT j, const T& value);
void SetValue(CoordinateT i, CoordinateT j, CoordinateT k, const T& value);
void SetValue(const vtkArrayCoordinates& coordinates, const T& value);
void SetValueN(const SizeT n, const T& value);
// vtkDenseArray API
// Description:
// Strategy object that contains a block of memory to be used by vtkDenseArray
// for value storage. The MemoryBlock object is responsible for freeing
// memory when destroyed.
class MemoryBlock
{
public:
virtual ~MemoryBlock();
// Description:
// Returns a pointer to the block of memory to be used for storage.
virtual T* GetAddress() = 0;
};
// Description:
// MemoryBlock implementation that manages internally-allocated memory using
// new[] and delete[]. Note: HeapMemoryBlock is the default used by vtkDenseArray
// for its "normal" internal memory allocation.
class HeapMemoryBlock :
public MemoryBlock
{
public:
HeapMemoryBlock(const vtkArrayExtents& extents);
virtual ~HeapMemoryBlock();
virtual T* GetAddress();
private:
T* Storage;
};
// Description:
// MemoryBlock implementation that manages a static (will not be freed) memory block.
class StaticMemoryBlock :
public MemoryBlock
{
public:
StaticMemoryBlock(T* const storage);
virtual T* GetAddress();
private:
T* Storage;
};
// Description:
// Initializes the array to use an externally-allocated memory block. The supplied
// MemoryBlock must be large enough to store extents.GetSize() values. The contents of
// the memory must be stored contiguously with fortran ordering,
//
// Dimension-labels are undefined after calling ExternalStorage() - you should
// initialize them accordingly.
//
// The array will use the supplied memory for storage until the array goes out of
// scope, is configured to use a different memory block by calling ExternalStorage()
// again, or is configured to use internally-allocated memory by calling Resize().
//
// Note that the array will delete the supplied memory block when it is no longer in use.
// caller's responsibility to ensure that the memory does not go out-of-scope until
// the array has been destroyed or is no longer using it.
void ExternalStorage(const vtkArrayExtents& extents, MemoryBlock* storage);
// Description:
// Fills every element in the array with the given value.
void Fill(const T& value);
// Description:
// Returns a value by-reference, which is useful for performance and code-clarity.
T& operator[](const vtkArrayCoordinates& coordinates);
// Description:
// Returns a read-only reference to the underlying storage. Values are stored
// contiguously with fortran ordering.
const T* GetStorage() const;
// Description:
// Returns a mutable reference to the underlying storage. Values are stored
// contiguously with fortran ordering. Use at your own risk!
T* GetStorage();
protected:
vtkDenseArray();
~vtkDenseArray();
private:
vtkDenseArray(const vtkDenseArray&); // Not implemented
void operator=(const vtkDenseArray&); // Not implemented
void InternalResize(const vtkArrayExtents& extents);
void InternalSetDimensionLabel(DimensionT i, const vtkStdString& label);
vtkStdString InternalGetDimensionLabel(DimensionT i);
inline vtkIdType MapCoordinates(CoordinateT i);
inline vtkIdType MapCoordinates(CoordinateT i, CoordinateT j);
inline vtkIdType MapCoordinates(CoordinateT i, CoordinateT j, CoordinateT k);
inline vtkIdType MapCoordinates(const vtkArrayCoordinates& coordinates);
void Reconfigure(const vtkArrayExtents& extents, MemoryBlock* storage);
typedef vtkDenseArray<T> ThisT;
// Description:
// Stores the current array extents (its size along each dimension)
vtkArrayExtents Extents;
// Description:
// Stores labels for each array dimension
std::vector<vtkStdString> DimensionLabels;
// Description:
// Manages array value memory storage.
MemoryBlock* Storage;
// Description:
// Stores array values using a contiguous range of memory
// with constant-time value lookup.
T* Begin;
T* End;
// Description:
// Stores the offset along each array dimension (used for fast lookups).
std::vector<vtkIdType> Offsets;
// Description:
// Stores the stride along each array dimension (used for fast lookups).
std::vector<vtkIdType> Strides;
};
#include "vtkDenseArray.txx"
#endif
// VTK-HeaderTest-Exclude: vtkDenseArray.h
|