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

Method checkPoint

Source/driver/Castro_io.cpp:385–500  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

383}
384
385void
386Castro::checkPoint(const std::string& dir,
387 std::ostream& os,
388 VisMF::How how,
389 bool /*dump_old_default*/)
390{
391
392 const Real io_start_time = ParallelDescriptor::second();
393
394 AmrLevel::checkPoint(dir, os, how, dump_old);
395
396 const Real io_time = ParallelDescriptor::second() - io_start_time;
397
398#ifdef RADIATION
399 if (do_radiation) {
400 radiation->checkPoint(level, dir, os, how);
401 }
402#endif
403
404#ifdef AMREX_PARTICLES
405 ParticleCheckPoint(dir);
406#endif
407
408 if (level == 0 && ParallelDescriptor::IOProcessor())
409 {
410 {
411 std::ofstream CastroHeaderFile;
412 std::string FullPathCastroHeaderFile = dir;
413 FullPathCastroHeaderFile += "/CastroHeader";
414 CastroHeaderFile.open(FullPathCastroHeaderFile.c_str(), std::ios::out);
415
416 CastroHeaderFile << "Checkpoint version: " << current_version << std::endl;
417 CastroHeaderFile.close();
418
419 writeJobInfo(dir, io_time);
420
421 // output the list of state variables, so we can do a sanity check on restart
422 std::ofstream StateListFile;
423 std::string FullPathStateList = dir;
424 FullPathStateList += "/state_names.txt";
425 StateListFile.open(FullPathStateList.c_str(), std::ios::out);
426
427 for (int n = 0; n < NUM_STATE; n++) {
428 StateListFile << desc_lst[State_Type].name(n) << "\n";
429 }
430 StateListFile.close();
431 }
432
433 // If we have limited this last timestep to hit a plot interval,
434 // store the timestep we took before limiting. After the restart,
435 // this dt will be read in and used to limit the next timestep
436 // appropriately, rather than the shortened timestep.
437
438 if (lastDtPlotLimited == 1) {
439
440 std::ofstream dtHeaderFile;
441 std::string FullPathdtHeaderFile = dir;
442 FullPathdtHeaderFile += "/dtHeader";

Callers 1

mainFunction · 0.45

Calls 2

closeMethod · 0.80
problem_checkpointFunction · 0.50

Tested by

no test coverage detected