Block-Structured AMR Software Framework
AMReX_Conduit_Blueprint.H
Go to the documentation of this file.
1 #ifndef AMREX_CONDUIT_BLUEPRINT_H_
2 #define AMREX_CONDUIT_BLUEPRINT_H_
3 #include <AMReX_Config.H>
4 
6 //
7 // Conduit Mesh Blueprint Support for AMReX
8 //
9 // This file is only included when USE_CONDUIT = TRUE
10 //
12 
13 #include <string>
14 
15 #include <AMReX_Geometry.H>
16 #include <AMReX_MultiFab.H>
17 #ifdef AMREX_PARTICLES
18 #include <AMReX_Particles.H>
19 #endif
20 
22 // These functions generate a Conduit Blueprint Mesh representation of
23 // AMReX AMR meshes and particle containers.
24 //
25 // Data from MultiFABs and ParticleContainers are zero copied and annotated
26 // in Conduit Node Trees. This is the format used to pass meshes to ALPINE
27 // Ascent for in situ rendering and analysis.
28 //
29 // For more details, please see:
30 //
31 // Conduit:
32 // Repo: https://github.com/llnl/conduit
33 // Docs http://llnl-conduit.readthedocs.io/en/latest/
34 // Blueprint Docs: http://llnl-conduit.readthedocs.io/en/latest/blueprint.html
35 //
36 // Ascent:
37 // Ascent Repo: http://github.com/alpine-dav/ascent
38 // Ascent Docs: http://ascent.readthedocs.io/en/latest/
39 //
40 //
41 // Or ping Cyrus Harrison <cyrush@llnl.gov> or Matt Larsen <<larsen30@llnl.gov>
43 
55 
56 #include <conduit/conduit.hpp>
57 
58 namespace amrex
59 {
60 
61  // Creates an in-memory Mesh Blueprint representation of a single level
62  // AMReX mesh.
63  //
64  // This method's signature mirrors WriteSingleLevelPlotfile(), sans the
65  // file name parameters.
67  const Vector<std::string> &varnames,
68  const Geometry &geom,
69  Real time_value,
70  int level_step,
71  conduit::Node &bp_mesh);
72 
73  // Creates an in-memory Mesh Blueprint representation of a multi-level
74  // AMReX mesh.
75  //
76  // This method's signature mirrors WriteMultiLevelPlotfile(), sans the
77  // file name parameters.
78  void MultiLevelToBlueprint (int n_levels,
79  const Vector<const MultiFab*> &mfs,
80  const Vector<std::string> &varnames,
81  const Vector<Geometry> &geoms,
82  Real time_value,
83  const Vector<int> &level_steps,
84  const Vector<IntVect> &ref_ratio,
85  conduit::Node &bp_mesh);
86 
87 #ifdef AMREX_PARTICLES
88  // Creates an in-memory Mesh Blueprint representation of an AMReX
89  // particle container.
90  //
91  // This method's signature is similar to ParticleContainer::Checkpoint()
92  // real_comp_names are first mapped in order to the aos then soa reals
93  // int_comp_names are first mapped in order to the aos then soa ints
94  //
95  // `topology_name` allows you to control the name of the topology,
96  // coordset and fields used to represent the passed particle container.
97  // This allows you to use unique names to wrap multiple particle containers
98  // into a single blueprint tree.
99  template <typename ParticleType, int NArrayReal, int NArrayInt>
100  void ParticleContainerToBlueprint (const ParticleContainer_impl<ParticleType,
101  NArrayReal,
102  NArrayInt> &pc,
103  const Vector<std::string> &real_comp_names,
104  const Vector<std::string> &int_comp_names,
105  conduit::Node &bp_mesh,
106  const std::string &topology_name="particles");
107 #endif
108 
109  // Writes a Mesh Blueprint representation to a set of files that
110  // can be visualized in VisIt using the Blueprint plugin.
111  //
112  // Note: The default protocol "json", is ASCII-based, which is great
113  // for debugging, but can be quite slow for large data sets.
114  // For binary output, you can use:
115  // "conduit_bin"
116  // "hdf5" (if conduit was built with hdf5 support)
117  //
118  void WriteBlueprintFiles (const conduit::Node &bp_mesh,
119  const std::string &fname_base = "blueprint_out_",
120  int step = 0,
121  const std::string &protocol = "json");
122 
123 }
124 
125 #ifdef AMREX_PARTICLES
127 #endif
128 
129 
130 #endif
Rectangular problem domain geometry.
Definition: AMReX_Geometry.H:73
A collection (stored as an array) of FArrayBox objects.
Definition: AMReX_MultiFab.H:38
A distributed container for Particles sorted onto the levels, grids, and tiles of a block-structured ...
Definition: AMReX_ParticleContainer.H:145
Definition: AMReX_Amr.cpp:49
void MultiLevelToBlueprint(int n_levels, const Vector< const MultiFab * > &mfs, const Vector< std::string > &varnames, const Vector< Geometry > &geoms, Real time_value, const Vector< int > &level_steps, const Vector< IntVect > &ref_ratio, Node &res)
Definition: AMReX_Conduit_Blueprint.cpp:341
void ParticleContainerToBlueprint(const ParticleContainer_impl< ParticleType, NArrayReal, NArrayInt > &pc, const Vector< std::string > &real_comp_names, const Vector< std::string > &int_comp_names, conduit::Node &res, const std::string &topology_name)
Definition: AMReX_Conduit_Blueprint_ParticlesI.H:249
void WriteBlueprintFiles(const conduit::Node &bp_mesh, const std::string &fname_base, int step, const std::string &protocol)
Definition: AMReX_Conduit_Blueprint.cpp:463
void SingleLevelToBlueprint(const MultiFab &mf, const Vector< std::string > &varnames, const Geometry &geom, Real time_value, int level_step, Node &res)
Definition: AMReX_Conduit_Blueprint.cpp:313