VTK
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
dox
Common
Core
vtkDenseArray.h
Go to the documentation of this file.
1
/*=========================================================================
2
3
Program: Visualization Toolkit
4
Module: vtkDenseArray.h
5
6
-------------------------------------------------------------------------
7
Copyright 2008 Sandia Corporation.
8
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9
the U.S. Government retains certain rights in this software.
10
-------------------------------------------------------------------------
11
12
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
13
All rights reserved.
14
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
15
16
This software is distributed WITHOUT ANY WARRANTY; without even
17
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18
PURPOSE. See the above copyright notice for more information.
19
20
=========================================================================*/
21
51
#ifndef __vtkDenseArray_h
52
#define __vtkDenseArray_h
53
54
#include "
vtkArrayCoordinates.h
"
55
#include "
vtkObjectFactory.h
"
56
#include "
vtkTypedArray.h
"
57
#include "
vtkTypeTemplate.h
"
58
59
template
<
typename
T>
60
class
vtkDenseArray
:
61
public
vtkTypeTemplate
<vtkDenseArray<T>, vtkTypedArray<T> >
62
{
63
public
:
64
static
vtkDenseArray<T>
*
New
();
65
void
PrintSelf
(ostream &os,
vtkIndent
indent);
66
67
typedef
typename
vtkArray::CoordinateT
CoordinateT
;
68
typedef
typename
vtkArray::DimensionT
DimensionT
;
69
typedef
typename
vtkArray::SizeT
SizeT
;
70
71
// vtkArray API
72
bool
IsDense
();
73
const
vtkArrayExtents
&
GetExtents
();
74
SizeT
GetNonNullSize
();
75
void
GetCoordinatesN
(
const
SizeT
n,
vtkArrayCoordinates
& coordinates);
76
vtkArray
*
DeepCopy
();
77
78
// vtkTypedArray API
79
const
T&
GetValue
(
CoordinateT
i);
80
const
T&
GetValue
(
CoordinateT
i,
CoordinateT
j);
81
const
T&
GetValue
(
CoordinateT
i,
CoordinateT
j,
CoordinateT
k);
82
const
T&
GetValue
(
const
vtkArrayCoordinates
& coordinates);
83
const
T&
GetValueN
(
const
SizeT
n);
84
void
SetValue
(
CoordinateT
i,
const
T&
value
);
85
void
SetValue
(
CoordinateT
i,
CoordinateT
j,
const
T&
value
);
86
void
SetValue
(
CoordinateT
i,
CoordinateT
j,
CoordinateT
k,
const
T&
value
);
87
void
SetValue
(
const
vtkArrayCoordinates
& coordinates,
const
T&
value
);
88
void
SetValueN
(
const
SizeT
n,
const
T&
value
);
89
90
// vtkDenseArray API
91
93
96
class
MemoryBlock
97
{
98
public
:
99
virtual
~MemoryBlock
();
101
102
103
virtual
T*
GetAddress
() = 0;
104
};
106
108
111
class
HeapMemoryBlock
:
112
public
MemoryBlock
113
{
114
public
:
115
HeapMemoryBlock
(
const
vtkArrayExtents
& extents);
116
virtual
~HeapMemoryBlock
();
117
virtual
T*
GetAddress
();
119
120
private
:
121
T* Storage;
122
};
123
125
127
class
StaticMemoryBlock
:
128
public
MemoryBlock
129
{
130
public
:
131
StaticMemoryBlock
(T*
const
storage);
132
virtual
T*
GetAddress
();
134
135
private
:
136
T* Storage;
137
};
138
152
void
ExternalStorage
(
const
vtkArrayExtents
& extents,
MemoryBlock
* storage);
153
155
void
Fill
(
const
T&
value
);
156
159
T&
operator[]
(
const
vtkArrayCoordinates
& coordinates);
160
163
const
T*
GetStorage
()
const
;
164
167
T*
GetStorage
();
168
169
protected
:
170
vtkDenseArray
();
171
~vtkDenseArray
();
172
173
private
:
174
vtkDenseArray
(
const
vtkDenseArray
&);
// Not implemented
175
void
operator=(
const
vtkDenseArray
&);
// Not implemented
176
177
void
InternalResize(
const
vtkArrayExtents
& extents);
178
void
InternalSetDimensionLabel(
DimensionT
i,
const
vtkStdString
& label);
179
vtkStdString
InternalGetDimensionLabel(
DimensionT
i);
180
inline
vtkIdType
MapCoordinates(
CoordinateT
i);
181
inline
vtkIdType
MapCoordinates(
CoordinateT
i,
CoordinateT
j);
182
inline
vtkIdType
MapCoordinates(
CoordinateT
i,
CoordinateT
j,
CoordinateT
k);
183
inline
vtkIdType
MapCoordinates(
const
vtkArrayCoordinates
& coordinates);
184
185
void
Reconfigure(
const
vtkArrayExtents
& extents,
MemoryBlock
* storage);
186
187
typedef
vtkDenseArray<T>
ThisT
;
188
190
vtkArrayExtents
Extents;
191
193
std::vector<vtkStdString> DimensionLabels;
194
196
MemoryBlock
* Storage;
197
199
201
T* Begin;
202
T* End;
204
206
std::vector<vtkIdType> Offsets;
208
209
std::vector<vtkIdType> Strides;
210
};
212
213
#include "vtkDenseArray.txx"
214
215
#endif
216
217
// VTK-HeaderTest-Exclude: vtkDenseArray.h
Generated on Thu May 24 2012 22:22:08 for VTK by
1.8.1