escript Revision_
DataVectorTaipan.h
Go to the documentation of this file.
1
2/*****************************************************************************
3*
4* Copyright (c) 2003-2020 by The University of Queensland
5* http://www.uq.edu.au
6*
7* Primary Business: Queensland, Australia
8* Licensed under the Apache License, version 2.0
9* http://www.apache.org/licenses/LICENSE-2.0
10*
11* Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12* Development 2012-2013 by School of Earth Sciences
13* Development from 2014-2017 by Centre for Geoscience Computing (GeoComp)
14* Development from 2019 by School of Earth and Environmental Sciences
15**
16*****************************************************************************/
17
18
19#if !defined escript_DataVectorTaipan_H
20#define escript_DataVectorTaipan_H
21#include "system_dep.h"
22
23#include "Assert.h"
24#include "DataTypes.h"
25#include "WrappedArray.h"
26
27namespace escript
28{
29
30namespace DataTypes
31{
32
46
47 public:
48
49 //
50 // The type of the elements stored in the vector.
51 typedef double ElementType;
52
53 //
54 // The underlying type used to implement the vector.
56
57
58 //
59 // Various types exported to clients of this class.
60 typedef const ElementType * const_pointer;
62 typedef long size_type;
65
74
84
103 DataVectorTaipan(const size_type size,
104 const value_type val=0.0,
105 const size_type blockSize=1);
106
115
126 void
127 resize(const size_type newSize,
128 const value_type newVal=0.0,
129 const size_type newBlockSize=1);
130
137 void
138 copyFromArray(const escript::WrappedArray& value, size_type copies);
139
140 void
141 copyFromArrayToOffset(const escript::WrappedArray& value, size_type offset, size_type copies);
142
143
148 inline
150 size() const;
151
158 operator=(const DataVectorTaipan& other);
159
165 bool
166 operator==(const DataVectorTaipan& other) const;
167
173 bool
174 operator!=(const DataVectorTaipan& other) const;
175
184 inline
186 operator[](const size_type i);
187
188 inline
190 operator[](const size_type i) const;
191
192
193 protected:
194
195 private:
196
200
201 //
202 // The container for the elements contained in this DataVectorTaipan.
204};
205
206
213
214
215
216inline
219{
220 return m_size;
221}
222
223inline
226{
227 ESYS_ASSERT(i<size(), "DataVectorTaipan: invalid index specified. " << i << " of " << size());
228 return m_array_data[i];
229}
230
231inline
234{
235 ESYS_ASSERT(i<size(),"DataVectorTaipan: invalid index specified. " << i << " of " << size());
236 return m_array_data[i];
237}
238
239
240} // end of namespace
241} // end of namespace
242
243
244
245#endif
#define ESYS_ASSERT(a, b)
EsysAssert is a MACRO that will throw an exception if the boolean condition specified is false.
Definition Assert.h:79
DataVectorTaipan implements an arbitrarily long vector of data values. DataVectorTaipan is the underl...
Definition DataVectorTaipan.h:45
VectorStorageType m_array_data
Definition DataVectorTaipan.h:203
double ElementType
Definition DataVectorTaipan.h:51
ElementType * VectorStorageType
Definition DataVectorTaipan.h:55
size_type m_size
Definition DataVectorTaipan.h:197
size_type m_N
Definition DataVectorTaipan.h:199
const ElementType * const_pointer
Definition DataVectorTaipan.h:60
reference operator[](const size_type i)
Return a reference to the element at position i in this DataVectorTaipan. Will throw an exception if ...
Definition DataVectorTaipan.h:225
size_type size() const
Return the number of elements in this DataVectorTaipan.
Definition DataVectorTaipan.h:218
ElementType value_type
Definition DataVectorTaipan.h:61
ElementType & reference
Definition DataVectorTaipan.h:63
const ElementType & const_reference
Definition DataVectorTaipan.h:64
long size_type
Definition DataVectorTaipan.h:62
size_type m_dim
Definition DataVectorTaipan.h:198
Definition WrappedArray.h:33
#define ESCRIPT_DLL_API
Definition escriptcore/src/system_dep.h:30
void releaseUnusedMemory()
releases unused memory in the memory manager.
Definition DataVectorTaipan.cpp:41
Definition AbstractContinuousDomain.cpp:23