MCPcopy Create free account
hub / github.com/AMReX-Astro/Castro / ReadCheckpointFile

Function ReadCheckpointFile

Util/ConvertCheckpoint/Embiggen.cpp:164–473  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162// ---------------------------------------------------------------
163
164static void ReadCheckpointFile(const std::string& fileName) {
165 int i;
166 std::string File = fileName;
167
168 File += '/';
169 File += "Header";
170
171 VisMF::IO_Buffer io_buffer(VisMF::IO_Buffer_Size);
172
173 std::ifstream is;
174 is.rdbuf()->pubsetbuf(io_buffer.dataPtr(), io_buffer.size());
175 is.open(File.c_str(), std::ios::in);
176 if( ! is.good()) {
177 amrex::FileOpenFailed(File);
178 }
179
180 //
181 // Read global data.
182 //
183 // Attempt to differentiate between old and new CheckPointFiles.
184 //
185 int spdim;
186 bool new_checkpoint_format = false;
187 std::string first_line;
188
189 std::getline(is,first_line);
190
191 if (first_line == CheckPointVersion) {
192 new_checkpoint_format = true;
193 is >> spdim;
194 } else {
195 spdim = atoi(first_line.c_str());
196 }
197
198 if(spdim != AMREX_SPACEDIM) {
199 cerr << "Amr::restart(): bad spacedim = " << spdim << '\n';
200 amrex::Abort();
201 }
202
203 is >> fakeAmr.cumtime;
204 int mx_lev;
205 is >> mx_lev;
206 is >> fakeAmr.finest_level;
207
208 if(ParallelDescriptor::IOProcessor())
209 std::cout << "previous finest_lev is " << fakeAmr.finest_level << std::endl;
210
211 // ADDING LEVELS
212 int n = num_new_levels;
213 mx_lev = mx_lev + n;
214 fakeAmr.finest_level = fakeAmr.finest_level + n;
215
216 if(ParallelDescriptor::IOProcessor()) {
217 std::cout << " new finest_lev is " << fakeAmr.finest_level << std::endl;
218 std::cout << "previous mx_lev is " << mx_lev-n << std::endl;
219 std::cout << " new mx_lev is " << mx_lev << std::endl;
220 }
221

Callers 1

mainFunction · 0.85

Calls 4

atoiFunction · 0.85
sizeMethod · 0.80
defineMethod · 0.80
emptyMethod · 0.80

Tested by

no test coverage detected