3
3
//
4
4
// SPDX-License-Identifier: (BSD-3-Clause)
5
5
6
- #include " axom/core.hpp"
7
- #include " axom/slic.hpp"
8
- #include " axom/primal.hpp"
6
+ #include " axom/core/NumericArray.hpp"
7
+ #include " axom/core/execution/execution_space.hpp"
8
+ #include " axom/core/execution/for_all.hpp"
9
+ #include " axom/core/memory_management.hpp"
9
10
10
11
#include " gtest/gtest.h"
11
12
12
- namespace primal = axom::primal;
13
-
14
13
// ------------------------------------------------------------------------------
15
14
template <typename ExecSpace>
16
15
void check_numeric_array_policy ()
17
16
{
18
17
constexpr int DIM = 3 ;
19
- using NumericArrayType = primal ::NumericArray<double , DIM>;
18
+ using NumericArrayType = axom ::NumericArray<double , DIM>;
20
19
21
20
double * coords =
22
21
axom::allocate<double >(DIM, axom::execution_space<ExecSpace>::allocatorID ());
@@ -41,7 +40,7 @@ TEST(primal_numeric_array, constructors)
41
40
{
42
41
constexpr int DIM = 5 ;
43
42
using CoordType = double ;
44
- using QArray = primal ::NumericArray<CoordType, DIM>;
43
+ using QArray = axom ::NumericArray<CoordType, DIM>;
45
44
46
45
QArray arr1;
47
46
EXPECT_EQ (QArray::size (), DIM);
@@ -82,19 +81,19 @@ TEST(primal_numeric_array, constructors)
82
81
EXPECT_EQ (arrHalfVec[i], expVal);
83
82
}
84
83
85
- primal ::NumericArray<int , 3 > fromInitializerListRightSize = {10 , 20 , 30 };
84
+ axom ::NumericArray<int , 3 > fromInitializerListRightSize = {10 , 20 , 30 };
86
85
for (int i = 0 ; i < 3 ; ++i)
87
86
{
88
87
EXPECT_EQ (10 * (i + 1 ), fromInitializerListRightSize[i]);
89
88
}
90
89
91
- primal ::NumericArray<int , 3 > fromInitializerListTooLong = {10 , 20 , 30 , 40 };
90
+ axom ::NumericArray<int , 3 > fromInitializerListTooLong = {10 , 20 , 30 , 40 };
92
91
for (int i = 0 ; i < 3 ; ++i)
93
92
{
94
93
EXPECT_EQ (10 * (i + 1 ), fromInitializerListTooLong[i]);
95
94
}
96
95
97
- primal ::NumericArray<int , 5 > fromInitializerListTooShort = {10 , 20 };
96
+ axom ::NumericArray<int , 5 > fromInitializerListTooShort = {10 , 20 };
98
97
for (int i = 0 ; i < 2 ; ++i)
99
98
{
100
99
EXPECT_EQ (10 * (i + 1 ), fromInitializerListTooShort[i]);
@@ -104,7 +103,7 @@ TEST(primal_numeric_array, constructors)
104
103
EXPECT_EQ (0 , fromInitializerListTooShort[i]);
105
104
}
106
105
107
- primal ::NumericArray<int , 3 > fromInitializerNoEqualsSign {10 , 20 , 30 };
106
+ axom ::NumericArray<int , 3 > fromInitializerNoEqualsSign {10 , 20 , 30 };
108
107
for (int i = 0 ; i < 3 ; ++i)
109
108
{
110
109
EXPECT_EQ (10 * (i + 1 ), fromInitializerNoEqualsSign[i]);
@@ -116,7 +115,7 @@ TEST(primal_numeric_array, num_array_to_array)
116
115
{
117
116
constexpr int DIM = 5 ;
118
117
using CoordType = double ;
119
- using QArray = primal ::NumericArray<CoordType, DIM>;
118
+ using QArray = axom ::NumericArray<CoordType, DIM>;
120
119
121
120
// Compare array initialized from arbitrary array
122
121
CoordType valsArr[DIM] = {12 ., 23 ., 34 ., 45 ., 56.432 };
@@ -142,7 +141,7 @@ TEST(primal_numeric_array, component_wise_arithmetic)
142
141
{
143
142
constexpr int DIM = 3 ;
144
143
using CoordType = double ;
145
- using QArray = primal ::NumericArray<CoordType, DIM>;
144
+ using QArray = axom ::NumericArray<CoordType, DIM>;
146
145
147
146
CoordType ca1[] = {3 , 0 , 1.2 };
148
147
CoordType ca2[] = {0 , 4 , 1.2 };
@@ -191,7 +190,7 @@ TEST(primal_numeric_array, component_min_max)
191
190
{
192
191
constexpr int DIM = 3 ;
193
192
using CoordType = int ;
194
- using QArray = primal ::NumericArray<CoordType, DIM>;
193
+ using QArray = axom ::NumericArray<CoordType, DIM>;
195
194
196
195
QArray incArr {1 , 2 , 3 };
197
196
QArray decArr {3 , 2 , 1 };
@@ -221,7 +220,7 @@ TEST(primal_numeric_array, component_sum)
221
220
{
222
221
constexpr int DIM = 3 ;
223
222
using CoordType = int ;
224
- using QArray = primal ::NumericArray<CoordType, DIM>;
223
+ using QArray = axom ::NumericArray<CoordType, DIM>;
225
224
226
225
QArray incArr {1 , 2 , 3 };
227
226
QArray decArr {3 , 2 , 1 };
@@ -241,7 +240,7 @@ TEST(primal_numeric_array, clamping)
241
240
{
242
241
constexpr int DIM = 3 ;
243
242
using CoordType = int ;
244
- using QArray = primal ::NumericArray<CoordType, DIM>;
243
+ using QArray = axom ::NumericArray<CoordType, DIM>;
245
244
246
245
CoordType seq[] = {15 , 4 , 2 };
247
246
CoordType seqClampUp7[] = {7 , 4 , 2 };
@@ -274,9 +273,9 @@ TEST(primal_numeric_array, clamping)
274
273
275
274
#ifdef AXOM_DEBUG
276
275
// NOTE: AXOM_DEBUG is disabled in release mode, so this test will only fail
277
- // in
278
- // debug mode
279
- SLIC_INFO ( " Checking that clamping with ill-formed range throws an assert. " ) ;
276
+ // in debug mode
277
+ std::cout << " Checking that clamping with ill-formed range throws an assert. "
278
+ << std::endl ;
280
279
281
280
::testing::FLAGS_gtest_death_test_style = " threadsafe" ;
282
281
EXPECT_DEATH_IF_SUPPORTED (QArray (seq).clamp (7 , 3 ), " " );
@@ -314,18 +313,3 @@ AXOM_CUDA_TEST(primal_numeric_array, numeric_array_check_policies)
314
313
check_numeric_array_policy<hip_exec>();
315
314
#endif
316
315
}
317
-
318
- // ----------------------------------------------------------------------
319
- // ----------------------------------------------------------------------
320
-
321
- int main (int argc, char * argv[])
322
- {
323
- int result = 0 ;
324
-
325
- ::testing::InitGoogleTest (&argc, argv);
326
- axom::slic::SimpleLogger logger;
327
-
328
- result = RUN_ALL_TESTS ();
329
-
330
- return result;
331
- }
0 commit comments