WARPXM v1.10.0
Loading...
Searching...
No Matches
wmarraybase.h
Go to the documentation of this file.
1#ifndef wmarraybase_h
2#define wmarraybase_h
3
4// WarpX includes
5#include "lib/wmindexer.h"
6#include "lib/wxrange.h"
7
23template<int MAJOR_ORDER_TYPE> class WmArrayBase
24{
25public:
26 inline const WxRange& range() const
27 {
28 return _range;
29 }
30
31protected:
36 {
37 }
38
45 // ndims(range.ndims())
46 {
47 }
48
55 : _indexer(that._indexer), _range(that._range)
56 {
57 }
58
67 {
68 if (this == &that)
69 {
70 return *this;
71 }
72 _indexer = that._indexer;
73 _range = that._range;
74 return *this;
75 }
76
86 {
87 }
88
93
98
104 void setRange(const WxRange& range)
105 {
106 _range = range;
107 _indexer = range;
108 // ndims = range.ndims();
109 }
110
114 unsigned rank() const
115 {
116 // return ndims;
117 return _range.ndims();
118 }
119
120 static const int max_dims = 8;
121
122private:
123 // unsigned ndims;
124};
125
126// template < int MAJOR_ORDER_TYPE>
127// WmArrayBase< MAJOR_ORDER_TYPE>::
128// WmArrayBase( )
129//: ndims(0 )
130//{
131
132//}
133
134// template < int MAJOR_ORDER_TYPE>
135// WmArrayBase< MAJOR_ORDER_TYPE>::
136// WmArrayBase( const WxRange& range )
137//: _indexer(range), _range(range), ndims( range.ndims() )
138//{
139
140//}
141
142// template < int MAJOR_ORDER_TYPE>
143// void
144// WmArrayBase< MAJOR_ORDER_TYPE>::
145// setRange( const WxRange& range )
146//{
147// _range = range;
148// _indexer = range;
149// ndims = range.ndims();
150//}
151
152// template < int MAJOR_ORDER_TYPE>
153// WmArrayBase< MAJOR_ORDER_TYPE>::
154// WmArrayBase(const WmArrayBase< MAJOR_ORDER_TYPE>& that)
155//:_indexer(that._indexer), _range(that._range)
156//{
157//}
158
159// template < int MAJOR_ORDER_TYPE>
160// WmArrayBase< MAJOR_ORDER_TYPE>&
161// WmArrayBase< MAJOR_ORDER_TYPE>::operator=(const WmArrayBase< MAJOR_ORDER_TYPE>& that) {
162// if (this==&that)
163// return *this;
164// _indexer = that._indexer;
165// _range = that._range;
166// return *this;
167//}
168
169// template < int MAJOR_ORDER_TYPE>
170// const WxRange &
171// WmArrayBase< MAJOR_ORDER_TYPE>::range() const
172//{
173// return _range;
174//}
175
178#endif // wmarraybase_h
Defines common interface for variables that are arrays.
Definition: wmarraybase.h:24
WmIndexer< MAJOR_ORDER_TYPE > _indexer
Indexer assists finding linear position of array elements.
Definition: wmarraybase.h:92
WmArrayBase< MAJOR_ORDER_TYPE > & operator=(const WmArrayBase< MAJOR_ORDER_TYPE > &that)
Assignment operator duplicates the array geometry properties of right hand side one.
Definition: wmarraybase.h:66
~WmArrayBase()
Delete object which only describes the array geometry, no array allocation is deleted.
Definition: wmarraybase.h:85
WmArrayBase(const WmArrayBase< MAJOR_ORDER_TYPE > &that)
Copy constructor duplicates the array geometry properties of original one.
Definition: wmarraybase.h:54
unsigned rank() const
Rank of array.
Definition: wmarraybase.h:114
WmArrayBase()
Default ctor does not set up array geometry initially, this must be done later.
Definition: wmarraybase.h:35
void setRange(const WxRange &range)
Array spanning given range object.
Definition: wmarraybase.h:104
const WxRange & range() const
Definition: wmarraybase.h:26
WmArrayBase(const WxRange &range)
Array spanning given range object.
Definition: wmarraybase.h:44
static const int max_dims
Definition: wmarraybase.h:120
WxRange _range
Range covered by this array.
Definition: wmarraybase.h:97
template<typename T> class WxArray;
Definition: wmindexer.h:28
unsigned ndims() const
Dimensionality of box.
Definition: wxbox.h:113
WxRange represents a hyper-rectangular domain of an n-dimensional space of integers.
Definition: wxrange.h:23