VTK
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
dox
Common
vtkSparseArray.h
Go to the documentation of this file.
1
/*=========================================================================
2
3
Program: Visualization Toolkit
4
Module: vtkSparseArray.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
71
#ifndef __vtkSparseArray_h
72
#define __vtkSparseArray_h
73
74
#include "
vtkArrayCoordinates.h
"
75
#include "
vtkArraySort.h
"
76
#include "
vtkObjectFactory.h
"
77
#include "
vtkTypeTemplate.h
"
78
#include "
vtkTypedArray.h
"
79
80
template
<
typename
T>
81
class
vtkSparseArray
:
82
public
vtkTypeTemplate
<vtkSparseArray<T>, vtkTypedArray<T> >
83
{
84
public
:
85
static
vtkSparseArray<T>
*
New
();
86
void
PrintSelf
(ostream &os,
vtkIndent
indent);
87
88
typedef
typename
vtkArray::CoordinateT
CoordinateT
;
89
typedef
typename
vtkArray::DimensionT
DimensionT
;
90
typedef
typename
vtkArray::SizeT
SizeT
;
91
92
// vtkArray API
93
bool
IsDense
();
94
const
vtkArrayExtents
&
GetExtents
();
95
SizeT
GetNonNullSize
();
96
void
GetCoordinatesN
(
const
SizeT
n,
vtkArrayCoordinates
& coordinates);
97
vtkArray
*
DeepCopy
();
98
99
// vtkTypedArray API
100
const
T&
GetValue
(
CoordinateT
i);
101
const
T&
GetValue
(
CoordinateT
i,
CoordinateT
j);
102
const
T&
GetValue
(
CoordinateT
i,
CoordinateT
j,
CoordinateT
k);
103
const
T&
GetValue
(
const
vtkArrayCoordinates
& coordinates);
104
const
T&
GetValueN
(
const
SizeT
n);
105
void
SetValue
(
CoordinateT
i,
const
T&
value
);
106
void
SetValue
(
CoordinateT
i,
CoordinateT
j,
const
T&
value
);
107
void
SetValue
(
CoordinateT
i,
CoordinateT
j,
CoordinateT
k,
const
T&
value
);
108
void
SetValue
(
const
vtkArrayCoordinates
& coordinates,
const
T&
value
);
109
void
SetValueN
(
const
SizeT
n,
const
T&
value
);
110
111
// vtkSparseArray API
112
115
void
SetNullValue
(
const
T&
value
);
116
119
const
T&
GetNullValue
();
120
124
void
Clear
();
125
131
void
Sort
(
const
vtkArraySort
& sort);
132
134
vtkstd::vector<CoordinateT>
GetUniqueCoordinates
(
DimensionT
dimension);
135
140
const
CoordinateT
*
GetCoordinateStorage
(
DimensionT
dimension)
const
;
141
147
CoordinateT
*
GetCoordinateStorage
(
DimensionT
dimension);
148
153
const
T*
GetValueStorage
()
const
;
154
159
T*
GetValueStorage
();
160
169
void
ReserveStorage
(
const
SizeT
value_count);
170
172
175
void
SetExtentsFromContents
();
176
// Description:
177
// Specify arbitrary array extents, without altering the contents of the array. Note
178
// that the extents must be as-large-or-larger-than the extents of the actual values
179
// stored in the array. The number of dimensions in the supplied extents must match the
180
// number of dimensions currently stored in the array.
181
void
SetExtents
(
const
vtkArrayExtents
& extents);
183
185
189
inline
void
AddValue
(
CoordinateT
i,
const
T&
value
);
190
inline
void
AddValue
(
CoordinateT
i,
CoordinateT
j,
const
T&
value
);
191
inline
void
AddValue
(
CoordinateT
i,
CoordinateT
j,
CoordinateT
k,
const
T&
value
);
192
void
AddValue
(
const
vtkArrayCoordinates
& coordinates,
const
T&
value
);
194
201
bool
Validate
();
202
203
protected
:
204
vtkSparseArray
();
205
~vtkSparseArray
();
206
207
private
:
208
vtkSparseArray
(
const
vtkSparseArray
&);
// Not implemented
209
void
operator=(
const
vtkSparseArray
&);
// Not implemented
210
211
void
InternalResize(
const
vtkArrayExtents
& extents);
212
void
InternalSetDimensionLabel(
DimensionT
i,
const
vtkStdString
& label);
213
vtkStdString
InternalGetDimensionLabel(
DimensionT
i);
214
215
typedef
vtkSparseArray<T>
ThisT
;
216
218
vtkArrayExtents
Extents;
219
221
vtkstd::vector<vtkStdString> DimensionLabels;
222
226
vtkstd::vector<vtkstd::vector<CoordinateT> > Coordinates;
227
229
vtkstd::vector<T> Values;
230
232
234
T NullValue;
235
};
237
238
#include "vtkSparseArray.txx"
239
240
#endif
Generated on Wed May 30 2012 13:21:52 for VTK by
1.8.1