Skip to content

Commit

Permalink
Test Ascent_Insitu_SOA Compiles
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed Nov 21, 2023
1 parent b178ad9 commit 433db1e
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions Tests/Particles/Ascent_Insitu_SOA/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <AMReX.H>
#include <AMReX_ParmParse.H>
#include <AMReX_MultiFab.H>
#include <AMReX_Particles.H>

#if !defined(AMREX_PARTICLES) || !defined(AMREX_USE_CONDUIT)
Expand All @@ -11,6 +10,9 @@

#include <ascent.hpp>

#include <string>


using namespace amrex;

static constexpr int NR = 7;
Expand Down Expand Up @@ -118,7 +120,7 @@ class TestParticleContainer
}

auto& particle_tile = DefineAndReturnParticleTile(lev, mfi.index(), mfi.LocalTileIndex());
auto old_size = particle_tile.GetArrayOfStructs().size();
auto old_size = particle_tile.size();
auto new_size = old_size + host_real[0].size();
particle_tile.resize(new_size);

Expand Down Expand Up @@ -170,19 +172,19 @@ struct TestParams
int nlevs;
};

void testRedistribute();
void testAscent ();

int main (int argc, char* argv[])
{
amrex::Initialize(argc,argv);

amrex::Print() << "Running redistribute test \n";
testRedistribute();
testAscent();

amrex::Finalize();
}

void get_test_params(TestParams& params, const std::string& prefix)
void get_test_params (TestParams& params, const std::string& prefix)
{
ParmParse pp(prefix);
pp.get("size", params.size);
Expand All @@ -194,7 +196,7 @@ void get_test_params(TestParams& params, const std::string& prefix)
pp.query("num_runtime_int", num_runtime_int);
}

void testRedistribute ()
void testAscent ()
{
BL_PROFILE("testAscent");
TestParams params;
Expand Down Expand Up @@ -250,6 +252,7 @@ void testRedistribute ()

{
conduit::Node bp_mesh;
/* TODO
amrex::MultiLevelToBlueprint(
nlev,
amrex::GetVecOfConstPtrs(mf),
Expand All @@ -260,14 +263,25 @@ void testRedistribute ()
warpx.refRatio(),
bp_mesh
);
*/

// wrap pc for current species into a blueprint topology
amrex::ParticleContainerToBlueprint(*pc,
std::string const prefix = "particle";
Vector<std::string> particle_varnames;
for (int i = 0; i < pc.NumRealComps(); ++i) {
particle_varnames.push_back(prefix + "_real_" + std::to_string(i));
}
Vector<std::string> particle_int_varnames;
for (int i = 0; i < pc.NumIntComps(); ++i) {
particle_int_varnames.push_back(prefix + "_int_" + std::to_string(i));
}

amrex::ParticleContainerToBlueprint(pc,
particle_varnames,
particle_int_varnames,
a_bp_mesh,
bp_mesh,
prefix);
// mesh
// publish
ascent::Ascent ascent;
conduit::Node opts;
opts["exceptions"] = "catch";
Expand All @@ -278,7 +292,7 @@ void testRedistribute ()
// If you want to save blueprint HDF5 files w/o using an Ascent
// extract, you can call the following AMReX helper:
// const auto step = istep[0];
// WriteBlueprintFiles(bp_mesh,"bp_export",step,"hdf5");
// amrex::WriteBlueprintFiles(bp_mesh, "bp_export", step, "hdf5");

// render
conduit::Node actions;
Expand Down

0 comments on commit 433db1e

Please sign in to comment.