VTK
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
dox
Common
Core
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
std::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
174
void
SetExtentsFromContents
();
180
void
SetExtents
(
const
vtkArrayExtents
& extents);
181
183
187
inline
void
AddValue
(
CoordinateT
i,
const
T&
value
);
188
inline
void
AddValue
(
CoordinateT
i,
CoordinateT
j,
const
T&
value
);
189
inline
void
AddValue
(
CoordinateT
i,
CoordinateT
j,
CoordinateT
k,
const
T&
value
);
190
void
AddValue
(
const
vtkArrayCoordinates
& coordinates,
const
T&
value
);
192
199
bool
Validate
();
200
201
protected
:
202
vtkSparseArray
();
203
~vtkSparseArray
();
204
205
private
:
206
vtkSparseArray
(
const
vtkSparseArray
&);
// Not implemented
207
void
operator=(
const
vtkSparseArray
&);
// Not implemented
208
209
void
InternalResize(
const
vtkArrayExtents
& extents);
210
void
InternalSetDimensionLabel(
DimensionT
i,
const
vtkStdString
& label);
211
vtkStdString
InternalGetDimensionLabel(
DimensionT
i);
212
213
typedef
vtkSparseArray<T>
ThisT
;
214
216
vtkArrayExtents
Extents;
217
219
std::vector<vtkStdString> DimensionLabels;
220
224
std::vector<std::vector<CoordinateT> > Coordinates;
225
227
std::vector<T> Values;
228
230
232
T NullValue;
233
};
235
236
#include "vtkSparseArray.txx"
237
238
#endif
239
// VTK-HeaderTest-Exclude: vtkSparseArray.h
Generated on Thu May 24 2012 22:22:09 for VTK by
1.8.1