MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / main

Function main

Tools/Plotfile/faverage.cpp:19–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17
18
19int main(int argc, char* argv[])
20{
21
22 amrex::Initialize(argc, argv, false);
23
24 {
25
26 // timer for profiling
27 BL_PROFILE_VAR("main()", pmain);
28
29 // Input arguments
30 std::string varname{"density"};
31 bool do_favre{false};
32
33 const int narg = amrex::command_argument_count();
34
35 int farg = 1;
36 while (farg <= narg) {
37 const std::string& name = amrex::get_command_argument(farg);
38 if (name == "-v" || name == "--variable") {
39 varname = amrex::get_command_argument(++farg);
40 } else if (name == "-f" || name == "--favre") {
41 do_favre = true;
42 } else {
43 break;
44 }
45 ++farg;
46 }
47
48 if (farg > narg) {
49 PrintUsage();
50 return -1;
51 }
52
53 const std::string& pltfile = amrex::get_command_argument(farg);
54 std::string slcfile = pltfile + ".slice";
55
56 PlotFileData pf(pltfile);
57
58 int fine_level = pf.finestLevel();
59 const int dim = pf.spaceDim();
60
61 // get the index bounds and dx.
62 Box domain = pf.probDomain(fine_level);
63 auto dx_fine = pf.cellSize(fine_level);
64 auto problo = pf.probLo();
65 auto probhi = pf.probHi();
66
67 // compute the size of the radially-binned array -- we'll take the
68 // vertical direction to be the dimensionality
69
70 int nbins = static_cast<int>(std::abs(probhi[dim-1] - problo[dim-1]) / dx_fine[dim-1]);
71
72 // height coordinate
73 Vector<Real> h(nbins);
74
75 for (auto i = 0; i < nbins; i++) {
76 h[i] = (i + 0.5) * dx_fine[dim-1];

Callers

nothing calls this directly

Calls 15

PrintClass · 0.85
DistributionMapMethod · 0.80
PrintUsageFunction · 0.70
InitializeFunction · 0.50
makeFineMaskFunction · 0.50
ReduceRealSumFunction · 0.50
FinalizeFunction · 0.50
finestLevelMethod · 0.45
spaceDimMethod · 0.45
probDomainMethod · 0.45
cellSizeMethod · 0.45
probLoMethod · 0.45

Tested by

no test coverage detected