| 14 | } |
| 15 | |
| 16 | PlotFileDataImpl::PlotFileDataImpl (std::string const& plotfile_name) |
| 17 | : m_plotfile_name(plotfile_name) |
| 18 | { |
| 19 | // Header |
| 20 | std::string File(plotfile_name+"/Header"); |
| 21 | Vector<char> fileCharPtr; |
| 22 | ParallelDescriptor::ReadAndBcastFile(File, fileCharPtr); |
| 23 | std::istringstream is(std::string(fileCharPtr.dataPtr()), std::istringstream::in); |
| 24 | |
| 25 | is >> m_file_version; |
| 26 | |
| 27 | is >> m_ncomp; |
| 28 | AMREX_ASSERT(m_ncomp >= 0 && m_ncomp < std::numeric_limits<int>::max()); |
| 29 | m_var_names.resize(m_ncomp); |
| 30 | GotoNextLine(is); // This is needed, otherwise the next getline will get an empty string. |
| 31 | for (int i = 0; i < m_ncomp; ++i) { |
| 32 | std::string tmp; |
| 33 | std::getline(is, tmp); |
| 34 | m_var_names[i] = amrex::trim(std::move(tmp)); |
| 35 | } |
| 36 | |
| 37 | is >> m_spacedim >> m_time >> m_finest_level; |
| 38 | m_nlevels = m_finest_level+1; |
| 39 | AMREX_ASSERT(m_finest_level >= 0 && m_finest_level < 1000 && m_spacedim >= 1 && m_spacedim <= AMREX_SPACEDIM); |
| 40 | |
| 41 | for (int i = 0; i < m_spacedim; ++i) { |
| 42 | is >> m_prob_lo[i]; |
| 43 | } |
| 44 | for (int i = 0; i < m_spacedim; ++i) { |
| 45 | is >> m_prob_hi[i]; |
| 46 | m_prob_size[i] = m_prob_hi[i] - m_prob_lo[i]; |
| 47 | } |
| 48 | |
| 49 | AMREX_ASSERT(m_nlevels > 0 && m_nlevels <= 1000); |
| 50 | m_ref_ratio.resize(m_nlevels, 0); |
| 51 | for (int i = 0; i < m_finest_level; ++i) { |
| 52 | is >> m_ref_ratio[i]; |
| 53 | } |
| 54 | GotoNextLine(is); |
| 55 | |
| 56 | m_prob_domain.resize(m_nlevels); |
| 57 | for (int i = 0; i < m_nlevels; ++i) { |
| 58 | is >> m_prob_domain[i]; |
| 59 | } |
| 60 | |
| 61 | m_level_steps.resize(m_nlevels); |
| 62 | for (int i = 0; i < m_nlevels; ++i) { |
| 63 | is >> m_level_steps[i]; |
| 64 | } |
| 65 | |
| 66 | m_cell_size.resize(m_nlevels, Array<Real,AMREX_SPACEDIM>{{AMREX_D_DECL(1.,1.,1.)}}); |
| 67 | for (int ilev = 0; ilev < m_nlevels; ++ilev) { |
| 68 | for (int idim = 0; idim < m_spacedim; ++idim) { |
| 69 | is >> m_cell_size[ilev][idim]; |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | is >> m_coordsys; |
nothing calls this directly
no test coverage detected