58 const int narg = amrex::command_argument_count();
68 while (farg <= narg) {
69 const std::string fname = amrex::get_command_argument(farg);
70 if (fname ==
"-h" || fname ==
"--help") {
72 }
else if (fname ==
"-v") {
81 amrex::Print() <<
"No plotfilename specified " << std::endl;
85 if (iFile.back() ==
'/') {
89 amrex::Print() <<
"Reading " << iFile << std::endl;
93 PlotFileData pf_data(iFile);
95 int finest_level = pf_data.finestLevel();
97 int ncomp = pf_data.nComp();
100 amrex::Print() <<
"Finished defining pf with finest level " << finest_level <<
" and ncomp " << ncomp << std::endl;
103 const Vector<std::string>& varnames = pf_data.varNames();
105 Vector<int> istep{3};
108 int max_grid_size = 64;
110 Vector<MultiFab> mfvec(finest_level+1);
111 Vector<Geometry> geom(finest_level+1);
113 Real start_bdy_time = time;
115 for (
int lev = 0; lev <= finest_level; lev++)
117 mfvec[lev].define(pf_data.boxArray(lev), pf_data.DistributionMap(lev), ncomp, 0);
119 for (
int icomp = 0; icomp < ncomp; icomp++) {
120 MultiFab tmp_data = pf_data.get(lev, varnames[icomp]);
121 MultiFab::Copy(mfvec[lev],tmp_data,0,icomp,1,0);
125 BoxArray ba(pf_data.boxArray(lev));
126 Box bounding_region = (lev == 0) ? pf_data.probDomain(lev) : ba.minimalBox();
131 writeNCPlotFile(lev, which, iFile, GetVecOfConstPtrs(mfvec), varnames, istep,
132 pf_data.probLo(), pf_data.probHi(), pf_data.cellSize(lev), bounding_region, time, start_bdy_time);
static void PrintUsage()
Definition: ERF_PlotfileToNetCDF.cpp:41
void writeNCPlotFile(int lev, int which, const std::string &dir, const amrex::Vector< const amrex::MultiFab * > &mf, const amrex::Vector< std::string > &plot_var_names, const amrex::Vector< int > &level_steps, amrex::Array< amrex::Real, AMREX_SPACEDIM > prob_lo, amrex::Array< amrex::Real, AMREX_SPACEDIM > prob_hi, amrex::Array< amrex::Real, AMREX_SPACEDIM > dx, const amrex::Box &bounding_region, amrex::Real time, amrex::Real start_bdy_time)