| 77 | } |
| 78 | |
| 79 | ParticleHeader |
| 80 | ParticleHeader::read (const std::string& dir, const std::string& file) |
| 81 | { |
| 82 | AMREX_ASSERT(!dir.empty()); |
| 83 | AMREX_ASSERT(!file.empty()); |
| 84 | |
| 85 | std::string fullname = dir; |
| 86 | if (!fullname.empty() && fullname.back() != '/') { |
| 87 | fullname += '/'; |
| 88 | } |
| 89 | fullname += file; |
| 90 | |
| 91 | std::string HdrFileName = fullname; |
| 92 | if (!HdrFileName.empty() && HdrFileName.back() != '/') { |
| 93 | HdrFileName += '/'; |
| 94 | } |
| 95 | HdrFileName += "Header"; |
| 96 | |
| 97 | Vector<char> fileCharPtr; |
| 98 | ParallelDescriptor::ReadAndBcastFile(HdrFileName, fileCharPtr); |
| 99 | std::string fileCharPtrString(fileCharPtr.dataPtr()); |
| 100 | std::istringstream HdrFile(fileCharPtrString, std::istringstream::in); |
| 101 | |
| 102 | ParticleHeader header; |
| 103 | header.parse(HdrFile); |
| 104 | return header; |
| 105 | } |
| 106 | |
| 107 | } |
no test coverage detected