| 101 | }; |
| 102 | |
| 103 | int |
| 104 | main (int argc, |
| 105 | char* argv[]) |
| 106 | { |
| 107 | amrex::Initialize(argc,argv); |
| 108 | { |
| 109 | if (argc < 2) |
| 110 | print_usage(argc,argv); |
| 111 | |
| 112 | ParmParse pp; |
| 113 | |
| 114 | const std::string farg = amrex::get_command_argument(1); |
| 115 | if (farg == "-h" || farg == "--help") |
| 116 | print_usage(argc,argv); |
| 117 | |
| 118 | // Create the AmrData object from a pltfile on disk |
| 119 | std::string infile; pp.get("infile",infile); |
| 120 | DataServices::SetBatchMode(); |
| 121 | Amrvis::FileType fileType(Amrvis::NEWPLT); |
| 122 | DataServices dataServices(infile, fileType); |
| 123 | if( ! dataServices.AmrDataOk()) { |
| 124 | DataServices::Dispatch(DataServices::ExitRequest, NULL); |
| 125 | } |
| 126 | AmrData& amrData = dataServices.AmrDataRef(); |
| 127 | |
| 128 | int nv = pp.countval("varNames"); |
| 129 | Vector<std::string> varNames(nv); pp.getarr("varNames",varNames,0,nv); |
| 130 | |
| 131 | // Make a data struct for just the variables needed |
| 132 | AMReXDataHierarchy data(amrData,varNames); |
| 133 | const AMReXMeshHierarchy& mesh = data.Mesh(); |
| 134 | |
| 135 | |
| 136 | |
| 137 | // Compute the volume integrals |
| 138 | const int nGrow = 0; |
| 139 | const int finestLevel = mesh.FinestLevel(); |
| 140 | const int nLev = finestLevel + 1; |
| 141 | const int nComp = varNames.size(); |
| 142 | |
| 143 | Vector<Real> integrals(nComp,0); // Results, initialized to zero |
| 144 | for (int lev=0; lev<nLev; ++lev) { |
| 145 | const BoxArray ba = mesh.boxArray(lev); |
| 146 | |
| 147 | // Make boxes that are projection of finer ones (if exist) |
| 148 | const BoxArray baf = lev < finestLevel |
| 149 | ? BoxArray(mesh.boxArray(lev+1)).coarsen(mesh.RefRatio()[lev]) |
| 150 | : BoxArray(); |
| 151 | |
| 152 | // Compute volume of a cell at this level |
| 153 | Real vol=1.0; |
| 154 | for (int d=0; d<AMREX_SPACEDIM; ++d) { |
| 155 | vol *= mesh.ProbSize()[d] / mesh.ProbDomain()[lev].length(d); |
| 156 | } |
| 157 | |
| 158 | // For each component listed... |
| 159 | for (int n=0; n<nComp; ++n) { |
| 160 |
nothing calls this directly
no test coverage detected