Skip to content

Commit 4d5d2fc

Browse files
authored
add table lookup to utility unit test (#601)
1 parent 69ce07f commit 4d5d2fc

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ jobs:
190190
ccache -z
191191
make -j ${{env.NPROCS}} TINY_PROFILE=TRUE USE_CCACHE=TRUE USE_AMREX_LIB=TRUE ${{matrix.amrex_build_args}}; \
192192
if [ "${{matrix.comp}}" == 'gnu' ] || [ "${{matrix.comp}}" == 'llvm' ]; then \
193-
./Pele2d.${{matrix.comp}}.TPROF.ex;
193+
./Pele2d.${{matrix.comp}}.TPROF.ex input;
194194
fi;
195195
make realclean;
196196
if [ $? -ne 0 ]; then exit 1; fi; \

Source/Utility/BlackBoxFunction/Table.H

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#define MAXD_TABLE 5
55
#include <iostream>
66
#include <fstream>
7+
#include <AMReX_ParmParse.H>
78
#include "BlackBoxFunction.H"
89
#include "Utilities.H"
910

Testing/Exec/UtilityUnitTest/input

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test.table.filename = ../../../Support/CMLM/peletable_2dim_10grid

Testing/Exec/UtilityUnitTest/main.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#include <AMReX.H>
22
#include <AMReX_Print.H>
33
#include "Utilities.H"
4+
#include "Table.H"
5+
#include "BlackBoxFunction.H"
46

57
namespace m2c = pele::physics::utilities::mks2cgs;
68
namespace c2m = pele::physics::utilities::cgs2mks;
@@ -10,6 +12,23 @@ main(int argc, char* argv[])
1012
{
1113
amrex::Initialize(argc, argv);
1214

15+
// Test table interpolation
16+
pele::physics::TabulatedFunctionParams tabfunc_par;
17+
tabfunc_par.host_only_parm().parm_parse_prefix = "test";
18+
tabfunc_par.initialize();
19+
pele::physics::TabulatedFunction tabfunc(
20+
static_cast<const pele::physics::TabulatedFunctionData*>(
21+
&tabfunc_par.host_parm()));
22+
amrex::Real outval;
23+
const amrex::GpuArray<amrex::Real, 2> invals{1.0, 1.0};
24+
const std::string varname = "T";
25+
const int idxT =
26+
pele::physics::get_var_index(varname.c_str(), &tabfunc_par.host_parm());
27+
tabfunc.get_value(idxT, invals.data(), outval);
28+
AMREX_ALWAYS_ASSERT(amrex::almostEqual(outval, 3.60));
29+
tabfunc_par.deallocate();
30+
amrex::Print() << "TabulatedFunction Tests passed" << std::endl;
31+
1332
// Test Unit Conversions
1433
AMREX_ALWAYS_ASSERT(m2c::Length(1.0) == 100.0);
1534
AMREX_ALWAYS_ASSERT(c2m::Length(1.0, 2) == 1.0e-4);

0 commit comments

Comments
 (0)