Skip to content

Commit

Permalink
add changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldouglas92 committed Nov 7, 2024
1 parent 0598cb9 commit 7c6c9a8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
5 changes: 5 additions & 0 deletions doc/modules/changes/20241106_danieldouglas92
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Added: When using the Geodynamic World Builder, ASPECT will create a file
called 'original.wb' in the output directory which contains the exact
worldbuilder file used to run the ASPECT model.
<br>
(Daniel Douglas, 2024/11/06)
14 changes: 7 additions & 7 deletions source/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
#include <aspect/simulator.h>
#include <aspect/utilities.h>

#ifdef ASPECT_WITH_WORLD_BUILDER
#include <world_builder/world.h>
#endif

#include <deal.II/base/utilities.h>
#include <deal.II/base/mpi.h>
#include <deal.II/base/multithread_info.h>
Expand Down Expand Up @@ -626,9 +622,13 @@ run_simulator(const std::string &raw_input_as_string,
std::string world_builder_file = prm.get("World builder file");
if (world_builder_file != "")
{
std::stringstream json_input_stream(WorldBuilder::Utilities::read_and_distribute_file_content(world_builder_file));
std::ofstream wb_file(output_directory + "original.wb");
wb_file << json_input_stream.str();
// TODO: We just want to make a copy of the file, but to do this
// platform-independently we need the C++17 filesystem header.
// Update this when we require C++17
std::ifstream wb_source(world_builder_file, std::ios::binary);
std::ofstream wb_destination(output_directory + "original.wb", std::ios::binary);

wb_destination << wb_source.rdbuf();
}
}

Expand Down
3 changes: 1 addition & 2 deletions tests/original_wb.prm
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# test that output/original.wb is written correctly

# based on world_builder_simple.prm:
# set World builder file = $ASPECT_SOURCE_DIR/tests/world_builder_simple.wb
include $ASPECT_SOURCE_DIR/tests/world_builder_simple.prm
set World builder file = $ASPECT_SOURCE_DIR/tests/world_builder_simple.wb
set World builder file = $ASPECT_SOURCE_DIR/tests/world_builder_simple.wb

0 comments on commit 7c6c9a8

Please sign in to comment.