MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / main

Function main

Tests/ArrayND/main.cpp:124–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124int main (int argc, char* argv[])
125{
126 amrex::Initialize(argc, argv);
127
128 {
129 ArrayND<Real,5> a{};
130 AMREX_ALWAYS_ASSERT(!a && !a.ok() && a.size() == 0);
131 }
132
133 {
134 BoxND<1> box(IntVectND<1>(-1), IntVectND<1>(50));
135 auto* p = (Long*) The_Arena()->alloc(box.numPts()*sizeof(Long));
136 ArrayND<Long, 1> a(p, box);
137 test(a);
138 The_Arena()->free(p);
139 }
140
141 {
142 BoxND<2> box(IntVectND<2>(0,1), IntVectND<2>(100,99));
143 auto* p = (Long*) The_Arena()->alloc(box.numPts()*sizeof(Long));
144 ArrayND<Long, 2> a(p, box);
145 ArrayND<Long const, 2> b(a);
146 test(a);
147 AMREX_ALWAYS_ASSERT(a.size() == b.size() && a.dataPtr() == b.dataPtr());
148 The_Arena()->free(p);
149 }
150
151 {
152 BoxND<1> box(IntVectND<1>(1), IntVectND<1>(100));
153 int ncomp = 3;
154 auto* p = (Long*) The_Arena()->alloc(box.numPts()*ncomp*sizeof(Long));
155 ArrayND<Long, 2, true> a(p, box, ncomp);
156 test(a);
157 The_Arena()->free(p);
158 }
159
160 {
161 BoxND<3> box(IntVectND<3>(-2), IntVectND<3>(100,-1,99));
162 auto* p = (Long*) The_Arena()->alloc(box.numPts()*sizeof(Long));
163 ArrayND<Long, 3> a(p, box);
164 test(a);
165 The_Arena()->free(p);
166 }
167
168 {
169 BoxND<2> box(IntVectND<2>(-2), IntVectND<2>(100));
170 int ncomp = 1;
171 auto* p = (Long*) The_Arena()->alloc(box.numPts()*ncomp*sizeof(Long));
172 ArrayND<Long, 3, true> a(p, box, ncomp);
173 test(a);
174 The_Arena()->free(p);
175 }
176
177 {
178 BoxND<4> box(IntVectND<4>(100), IntVectND<4>(150));
179 auto* p = (Long*) The_Arena()->alloc(box.numPts()*sizeof(Long));
180 ArrayND<Long, 4> a(p, box);
181 test(a);

Callers

nothing calls this directly

Calls 12

The_ArenaFunction · 0.85
LongFunction · 0.85
testFunction · 0.70
InitializeFunction · 0.50
FinalizeFunction · 0.50
okMethod · 0.45
sizeMethod · 0.45
allocMethod · 0.45
numPtsMethod · 0.45
freeMethod · 0.45
dataPtrMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected