From 9eb7bdc7c509ea1ffd8992a399bc134d32b6a581 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Wed, 27 Nov 2024 13:14:52 -0500 Subject: [PATCH 1/5] moved read_mesh/sources/receivers to the IO/interface.hpp --- CMakeLists.txt | 12 +- include/IO/interface.hpp | 56 ++++++ include/IO/mesh/read_mesh.hpp | 23 --- include/IO/receivers/read_receivers.hpp | 26 --- include/IO/sources/read_sources.hpp | 29 ---- src/IO/{mesh/read_mesh.cpp => interface.cpp} | 164 +++++++++++++++++- src/IO/receivers/read_receivers.cpp | 45 ----- src/IO/sources/read_sources.cpp | 126 -------------- src/specfem2d.cpp | 4 +- .../algorithms/interpolate_function.cpp | 2 +- tests/unit-tests/algorithms/locate.cpp | 2 +- tests/unit-tests/assembly/test_fixture.hpp | 4 +- .../acoustic/compute_properties_tests.cpp | 2 +- .../coupled_interfaces_tests.cpp | 2 +- .../elastic/compute_properties_tests.cpp | 2 +- .../compute/index/compute_tests.cpp | 2 +- .../compute_partial_derivatives_tests.cpp | 2 +- .../Newmark/acoustic/newmark_tests.cpp | 2 +- .../Newmark/elastic/newmark_tests.cpp | 2 +- .../Newmark/newmark_tests.cpp | 4 +- .../domain/acoustic/rmass_inverse_tests.cpp | 2 +- .../domain/elastic/rmass_inverse_tests.cpp | 2 +- .../unit-tests/domain/rmass_inverse_tests.cpp | 2 +- tests/unit-tests/mesh/mesh_tests.cpp | 2 +- .../seismogram/acoustic/seismogram_tests.cpp | 3 +- .../seismogram/elastic/seismogram_tests.cpp | 3 +- .../source/source_location_tests.cpp | 2 +- 27 files changed, 239 insertions(+), 288 deletions(-) create mode 100644 include/IO/interface.hpp delete mode 100644 include/IO/mesh/read_mesh.hpp delete mode 100644 include/IO/receivers/read_receivers.hpp delete mode 100644 include/IO/sources/read_sources.hpp rename src/IO/{mesh/read_mesh.cpp => interface.cpp} (52%) delete mode 100644 src/IO/receivers/read_receivers.cpp delete mode 100644 src/IO/sources/read_sources.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index d795c74b..4b7c9f11 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,15 +108,13 @@ add_library( src/IO/fortranio/fortran_io.cpp src/IO/HDF5/native_type.cpp # src/IO/ASCII/native_type.cpp - src/IO/mesh/read_mesh.cpp + src/IO/interface.cpp src/IO/mesh/impl/fortran/read_boundaries.cpp src/IO/mesh/impl/fortran/read_elements.cpp src/IO/mesh/impl/fortran/read_material_properties.cpp src/IO/mesh/impl/fortran/read_mesh_database.cpp src/IO/mesh/impl/fortran/read_interfaces.cpp src/IO/mesh/impl/fortran/read_properties.cpp - src/IO/sources/read_sources.cpp - src/IO/receivers/read_receivers.cpp ) if (NOT HDF5_CXX_BUILD) @@ -142,15 +140,7 @@ endif() target_link_libraries( IO mesh -) - -target_link_libraries( - IO source_class -) - -target_link_libraries( - IO receiver_class ) diff --git a/include/IO/interface.hpp b/include/IO/interface.hpp new file mode 100644 index 00000000..e6a17a18 --- /dev/null +++ b/include/IO/interface.hpp @@ -0,0 +1,56 @@ +#pragma once + +#include "enumerations/simulation.hpp" +#include "mesh/mesh.hpp" +#include "receiver/interface.hpp" +#include "source/interface.hpp" +#include "specfem_mpi/interface.hpp" +#include "specfem_setup.hpp" + +namespace specfem { + +namespace IO { + +/** + * @brief Construct a mesh object from a Fortran binary database file + * + * @param filename Fortran binary database filename + * @param mpi pointer to MPI object to manage communication + * @return specfem::mesh::mesh Specfem mesh object + * + */ +specfem::mesh::mesh read_mesh(const std::string filename, + const specfem::MPI::MPI *mpi); + +/** + * @brief Read receiver station file + * + * Parse receiver stations file and create a vector of + * specfem::source::source * object + * + * @param stations_file Stations file describing receiver locations + * @param angle Angle of the receivers + * @return std::vector vector of instantiated + * receiver objects + */ +std::vector > +read_receivers(const std::string stations_file, const type_real angle); + +/** + * @brief Read sources file written in .yml format + * + * Parse source specification file written in yaml format and create a vector of + * specfem::source::source * object + * + * @param sources_file Name of the yml file + * @param mpi Pointer to specfem MPI object + * @return std::vector vector of instantiated source + * objects + */ +std::tuple >, type_real> +read_sources(const std::string sources_file, const int nsteps, + const type_real user_t0, const type_real dt, + const specfem::simulation::type simulation_type); + +} // namespace IO +} // namespace specfem diff --git a/include/IO/mesh/read_mesh.hpp b/include/IO/mesh/read_mesh.hpp deleted file mode 100644 index 7e05bfe3..00000000 --- a/include/IO/mesh/read_mesh.hpp +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include "mesh/mesh.hpp" -#include "specfem_mpi/interface.hpp" -#include "specfem_setup.hpp" - -namespace specfem { - -namespace IO { - -/** - * @brief Construct a mesh object from a Fortran binary database file - * - * @param filename Fortran binary database filename - * @param mpi pointer to MPI object to manage communication - * @return specfem::mesh::mesh Specfem mesh object - * - */ -specfem::mesh::mesh read_mesh(const std::string filename, - const specfem::MPI::MPI *mpi); - -} // namespace IO -} // namespace specfem diff --git a/include/IO/receivers/read_receivers.hpp b/include/IO/receivers/read_receivers.hpp deleted file mode 100644 index 7e7cf7e9..00000000 --- a/include/IO/receivers/read_receivers.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef _READ_RECEIVER_HPP -#define _READ_RECEIVER_HPP - -#include "receiver/interface.hpp" -#include "specfem_setup.hpp" -#include - -namespace specfem { -namespace IO { -/** - * @brief Read receiver station file - * - * Parse receiver stations file and create a vector of - * specfem::source::source * object - * - * @param stations_file Stations file describing receiver locations - * @param angle Angle of the receivers - * @return std::vector vector of instantiated - * receiver objects - */ -std::vector > -read_receivers(const std::string stations_file, const type_real angle); -} // namespace IO -} // namespace specfem - -#endif diff --git a/include/IO/sources/read_sources.hpp b/include/IO/sources/read_sources.hpp deleted file mode 100644 index a6e2ebe9..00000000 --- a/include/IO/sources/read_sources.hpp +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef _READ_SOURCES_HPP -#define _READ_SOURCES_HPP - -#include "enumerations/simulation.hpp" -#include "source/interface.hpp" -#include - -namespace specfem { -namespace IO { -/** - * @brief Read sources file written in .yml format - * - * Parse source specification file written in yaml format and create a vector of - * specfem::source::source * object - * - * @param sources_file Name of the yml file - * @param mpi Pointer to specfem MPI object - * @return std::vector vector of instantiated source - * objects - */ -std::tuple >, type_real> -read_sources(const std::string sources_file, const int nsteps, - const type_real user_t0, const type_real dt, - const specfem::simulation::type simulation_type); - -} // namespace IO -} // namespace specfem - -#endif diff --git a/src/IO/mesh/read_mesh.cpp b/src/IO/interface.cpp similarity index 52% rename from src/IO/mesh/read_mesh.cpp rename to src/IO/interface.cpp index d9c0322f..0471ed04 100644 --- a/src/IO/mesh/read_mesh.cpp +++ b/src/IO/interface.cpp @@ -1,4 +1,5 @@ -#include "IO/mesh/read_mesh.hpp" +// Internal Includes +#include "IO/interface.hpp" #include "IO/fortranio/interface.hpp" #include "IO/mesh/impl/fortran/read_boundaries.hpp" #include "IO/mesh/impl/fortran/read_elements.hpp" @@ -11,15 +12,176 @@ #include "material/material.hpp" #include "mesh/mesh.hpp" #include "mesh/tags/tags.hpp" +#include "receiver/interface.hpp" +#include "source/interface.hpp" #include "specfem_mpi/interface.hpp" #include "specfem_setup.hpp" +#include "utilities/interface.hpp" +#include "yaml-cpp/yaml.h" + +// External/Standard Libraries #include #include +#include +#include #include #include +#include #include #include +std::tuple >, type_real> +specfem::IO::read_sources(const std::string sources_file, const int nsteps, + const type_real user_t0, const type_real dt, + const specfem::simulation::type simulation_type) { + + const bool user_defined_start_time = + (std::abs(user_t0) > std::numeric_limits::epsilon()); + + const specfem::wavefield::type source_wavefield_type = + [&simulation_type]() -> specfem::wavefield::type { + switch (simulation_type) { + case specfem::simulation::type::forward: + return specfem::wavefield::type::forward; + case specfem::simulation::type::combined: + return specfem::wavefield::type::backward; + default: + throw std::runtime_error("Unknown simulation type"); + } + }(); + + // read sources file + std::vector > sources; + YAML::Node yaml = YAML::LoadFile(sources_file); + int nsources = yaml["number-of-sources"].as(); + YAML::Node Node = yaml["sources"]; + assert(Node.IsSequence()); + + // Note: Make sure you name the YAML node different from the name of the + // source class Otherwise, the compiler will get confused and throw an error + // I've spent hours debugging this issue. It is very annoying since it only + // shows up on CUDA compiler + int number_of_sources = 0; + int number_of_adjoint_sources = 0; + for (auto N : Node) { + if (YAML::Node force_source = N["force"]) { + sources.push_back(std::make_shared( + force_source, nsteps, dt, source_wavefield_type)); + number_of_sources++; + } else if (YAML::Node moment_tensor_source = N["moment-tensor"]) { + sources.push_back(std::make_shared( + moment_tensor_source, nsteps, dt, source_wavefield_type)); + number_of_sources++; + } else if (YAML::Node external_source = N["user-defined"]) { + sources.push_back(std::make_shared( + external_source, nsteps, dt, source_wavefield_type)); + number_of_sources++; + } else if (YAML::Node adjoint_node = N["adjoint-source"]) { + if (!adjoint_node["station_name"] || !adjoint_node["network_name"]) { + throw std::runtime_error( + "Station name and network name are required for adjoint source"); + } + sources.push_back(std::make_shared( + adjoint_node, nsteps, dt)); + number_of_adjoint_sources++; + } else { + throw std::runtime_error("Unknown source type"); + } + } + + if (number_of_sources == 0) { + throw std::runtime_error("No sources found in the sources file"); + } + + if (simulation_type == specfem::simulation::type::combined && + number_of_adjoint_sources == 0) { + throw std::runtime_error("No adjoint sources found in the sources file"); + } + + if (simulation_type == specfem::simulation::type::forward && + number_of_adjoint_sources > 0) { + throw std::runtime_error("Adjoint sources found in the sources file for " + "forward simulation"); + } + + if (sources.size() != nsources) { + std::ostringstream message; + message << "Found only " << sources.size() + << " number of sources. Total number of sources in " << sources_file + << " are" << nsources + << " Please check if there is a error in sources file."; + throw std::runtime_error(message.str()); + } + + type_real min_t0 = std::numeric_limits::max(); + type_real min_tshift = std::numeric_limits::max(); + for (auto &source : sources) { + type_real cur_t0 = source->get_t0(); + type_real cur_tshift = source->get_tshift(); + if (cur_t0 < min_t0) { + min_t0 = cur_t0; + } + if (cur_tshift < min_tshift) { + min_tshift = cur_tshift; + } + } + + type_real t0; + if (user_defined_start_time) { + if (user_t0 > min_t0 - min_tshift) + throw std::runtime_error("User defined start time is less than minimum " + "required for stability"); + + t0 = user_t0; + } else { + // Update tshift for auto detected start time + for (auto &source : sources) { + type_real cur_t0 = source->get_t0(); + source->update_tshift(cur_t0 - min_t0); + } + + t0 = min_t0; + } + + return std::make_tuple(sources, t0); +} + +std::vector > +specfem::IO::read_receivers(const std::string stations_file, + const type_real angle) { + + boost::char_separator sep(" "); + std::vector > receivers; + std::fstream stations; + stations.open(stations_file, std::ios::in); + if (stations.is_open()) { + std::string line; + // Read stations file line by line + while (std::getline(stations, line)) { + // split every line with " " delimiter + boost::tokenizer > tokens(line, sep); + std::vector current_station; + for (const auto &t : tokens) { + current_station.push_back(t); + } + // check if the read line meets the format + assert(current_station.size() == 6); + // get the x and z coordinates of the station; + const std::string network_name = current_station[0]; + const std::string station_name = current_station[1]; + const type_real x = static_cast(std::stod(current_station[2])); + const type_real z = static_cast(std::stod(current_station[3])); + + receivers.push_back(std::make_shared( + network_name, station_name, x, z, angle)); + } + + stations.close(); + } + + return receivers; +} + specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, const specfem::MPI::MPI *mpi) { diff --git a/src/IO/receivers/read_receivers.cpp b/src/IO/receivers/read_receivers.cpp deleted file mode 100644 index 48995f8b..00000000 --- a/src/IO/receivers/read_receivers.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include "IO/receivers/read_receivers.hpp" -#include "receiver/interface.hpp" -#include "specfem_setup.hpp" -#include "utilities/interface.hpp" -#include "yaml-cpp/yaml.h" -#include -#include -#include -#include - -std::vector > -specfem::IO::read_receivers(const std::string stations_file, - const type_real angle) { - - boost::char_separator sep(" "); - std::vector > receivers; - std::fstream stations; - stations.open(stations_file, std::ios::in); - if (stations.is_open()) { - std::string line; - // Read stations file line by line - while (std::getline(stations, line)) { - // split every line with " " delimiter - boost::tokenizer > tokens(line, sep); - std::vector current_station; - for (const auto &t : tokens) { - current_station.push_back(t); - } - // check if the read line meets the format - assert(current_station.size() == 6); - // get the x and z coordinates of the station; - const std::string network_name = current_station[0]; - const std::string station_name = current_station[1]; - const type_real x = static_cast(std::stod(current_station[2])); - const type_real z = static_cast(std::stod(current_station[3])); - - receivers.push_back(std::make_shared( - network_name, station_name, x, z, angle)); - } - - stations.close(); - } - - return receivers; -} diff --git a/src/IO/sources/read_sources.cpp b/src/IO/sources/read_sources.cpp deleted file mode 100644 index 7c95e612..00000000 --- a/src/IO/sources/read_sources.cpp +++ /dev/null @@ -1,126 +0,0 @@ -#include "IO/sources/read_sources.hpp" -#include "source/interface.hpp" -#include "specfem_setup.hpp" -#include "utilities/interface.hpp" -#include "yaml-cpp/yaml.h" -#include -#include -#include -#include -#include - -std::tuple >, type_real> -specfem::IO::read_sources(const std::string sources_file, const int nsteps, - const type_real user_t0, const type_real dt, - const specfem::simulation::type simulation_type) { - - const bool user_defined_start_time = - (std::abs(user_t0) > std::numeric_limits::epsilon()); - - const specfem::wavefield::type source_wavefield_type = - [&simulation_type]() -> specfem::wavefield::type { - switch (simulation_type) { - case specfem::simulation::type::forward: - return specfem::wavefield::type::forward; - case specfem::simulation::type::combined: - return specfem::wavefield::type::backward; - default: - throw std::runtime_error("Unknown simulation type"); - } - }(); - - // read sources file - std::vector > sources; - YAML::Node yaml = YAML::LoadFile(sources_file); - int nsources = yaml["number-of-sources"].as(); - YAML::Node Node = yaml["sources"]; - assert(Node.IsSequence()); - - // Note: Make sure you name the YAML node different from the name of the - // source class Otherwise, the compiler will get confused and throw an error - // I've spent hours debugging this issue. It is very annoying since it only - // shows up on CUDA compiler - int number_of_sources = 0; - int number_of_adjoint_sources = 0; - for (auto N : Node) { - if (YAML::Node force_source = N["force"]) { - sources.push_back(std::make_shared( - force_source, nsteps, dt, source_wavefield_type)); - number_of_sources++; - } else if (YAML::Node moment_tensor_source = N["moment-tensor"]) { - sources.push_back(std::make_shared( - moment_tensor_source, nsteps, dt, source_wavefield_type)); - number_of_sources++; - } else if (YAML::Node external_source = N["user-defined"]) { - sources.push_back(std::make_shared( - external_source, nsteps, dt, source_wavefield_type)); - number_of_sources++; - } else if (YAML::Node adjoint_node = N["adjoint-source"]) { - if (!adjoint_node["station_name"] || !adjoint_node["network_name"]) { - throw std::runtime_error( - "Station name and network name are required for adjoint source"); - } - sources.push_back(std::make_shared( - adjoint_node, nsteps, dt)); - number_of_adjoint_sources++; - } else { - throw std::runtime_error("Unknown source type"); - } - } - - if (number_of_sources == 0) { - throw std::runtime_error("No sources found in the sources file"); - } - - if (simulation_type == specfem::simulation::type::combined && - number_of_adjoint_sources == 0) { - throw std::runtime_error("No adjoint sources found in the sources file"); - } - - if (simulation_type == specfem::simulation::type::forward && - number_of_adjoint_sources > 0) { - throw std::runtime_error("Adjoint sources found in the sources file for " - "forward simulation"); - } - - if (sources.size() != nsources) { - std::ostringstream message; - message << "Found only " << sources.size() - << " number of sources. Total number of sources in " << sources_file - << " are" << nsources - << " Please check if there is a error in sources file."; - throw std::runtime_error(message.str()); - } - - type_real min_t0 = std::numeric_limits::max(); - type_real min_tshift = std::numeric_limits::max(); - for (auto &source : sources) { - type_real cur_t0 = source->get_t0(); - type_real cur_tshift = source->get_tshift(); - if (cur_t0 < min_t0) { - min_t0 = cur_t0; - } - if (cur_tshift < min_tshift) { - min_tshift = cur_tshift; - } - } - - type_real t0; - if (user_defined_start_time) { - if (user_t0 > min_t0 - min_tshift) - throw std::runtime_error("User defined start time is less than minimum " - "required for stability"); - - t0 = user_t0; - } else { - // Update tshift for auto detected start time - for (auto &source : sources) { - type_real cur_t0 = source->get_t0(); - source->update_tshift(cur_t0 - min_t0); - } - - t0 = min_t0; - } - - return std::make_tuple(sources, t0); -} diff --git a/src/specfem2d.cpp b/src/specfem2d.cpp index 6bc4a141..06971517 100644 --- a/src/specfem2d.cpp +++ b/src/specfem2d.cpp @@ -1,9 +1,7 @@ #include "compute/interface.hpp" // #include "coupled_interface/interface.hpp" // #include "domain/interface.hpp" -#include "IO/mesh/read_mesh.hpp" -#include "IO/receivers/read_receivers.hpp" -#include "IO/sources/read_sources.hpp" +#include "IO/interface.hpp" #include "kokkos_abstractions.h" #include "mesh/mesh.hpp" #include "parameter_parser/interface.hpp" diff --git a/tests/unit-tests/algorithms/interpolate_function.cpp b/tests/unit-tests/algorithms/interpolate_function.cpp index fd31d00a..3bfecefa 100644 --- a/tests/unit-tests/algorithms/interpolate_function.cpp +++ b/tests/unit-tests/algorithms/interpolate_function.cpp @@ -1,4 +1,4 @@ -#include "IO/mesh/read_mesh.hpp" +#include "IO/interface.hpp" #include "Kokkos_Environment.hpp" #include "MPI_environment.hpp" #include "algorithms/interpolate.hpp" diff --git a/tests/unit-tests/algorithms/locate.cpp b/tests/unit-tests/algorithms/locate.cpp index c1b6eebd..607732c1 100644 --- a/tests/unit-tests/algorithms/locate.cpp +++ b/tests/unit-tests/algorithms/locate.cpp @@ -1,4 +1,4 @@ -#include "IO/mesh/read_mesh.hpp" +#include "IO/interface.hpp" #include "Kokkos_Environment.hpp" #include "MPI_environment.hpp" #include "algorithms/locate_point.hpp" diff --git a/tests/unit-tests/assembly/test_fixture.hpp b/tests/unit-tests/assembly/test_fixture.hpp index dba725a0..c1783c90 100644 --- a/tests/unit-tests/assembly/test_fixture.hpp +++ b/tests/unit-tests/assembly/test_fixture.hpp @@ -1,9 +1,7 @@ #pragma once #include "../MPI_environment.hpp" -#include "IO/mesh/read_mesh.hpp" -#include "IO/receivers/read_receivers.hpp" -#include "IO/sources/read_sources.hpp" +#include "IO/interface.hpp" #include "compute/assembly/assembly.hpp" #include "enumerations/specfem_enums.hpp" #include "mesh/mesh.hpp" diff --git a/tests/unit-tests/compute/acoustic/compute_properties_tests.cpp b/tests/unit-tests/compute/acoustic/compute_properties_tests.cpp index b462c901..e6156786 100644 --- a/tests/unit-tests/compute/acoustic/compute_properties_tests.cpp +++ b/tests/unit-tests/compute/acoustic/compute_properties_tests.cpp @@ -1,7 +1,7 @@ #include "../../Kokkos_Environment.hpp" #include "../../MPI_environment.hpp" #include "../../utilities/include/interface.hpp" -#include "IO/mesh/read_mesh.hpp" +#include "IO/interface.hpp" #include "compute/interface.hpp" #include "material/interface.hpp" #include "mesh/mesh.hpp" diff --git a/tests/unit-tests/compute/coupled_interfaces/coupled_interfaces_tests.cpp b/tests/unit-tests/compute/coupled_interfaces/coupled_interfaces_tests.cpp index f982a75e..7933745d 100644 --- a/tests/unit-tests/compute/coupled_interfaces/coupled_interfaces_tests.cpp +++ b/tests/unit-tests/compute/coupled_interfaces/coupled_interfaces_tests.cpp @@ -1,7 +1,7 @@ #include "../../Kokkos_Environment.hpp" #include "../../MPI_environment.hpp" #include "../../utilities/include/interface.hpp" -#include "IO/mesh/read_mesh.hpp" +#include "IO/interface.hpp" #include "compute/interface.hpp" #include "edge/interface.hpp" #include "material/interface.hpp" diff --git a/tests/unit-tests/compute/elastic/compute_properties_tests.cpp b/tests/unit-tests/compute/elastic/compute_properties_tests.cpp index ac7b9a30..13b09dda 100644 --- a/tests/unit-tests/compute/elastic/compute_properties_tests.cpp +++ b/tests/unit-tests/compute/elastic/compute_properties_tests.cpp @@ -1,7 +1,7 @@ #include "../../Kokkos_Environment.hpp" #include "../../MPI_environment.hpp" #include "../../utilities/include/interface.hpp" -#include "IO/mesh/read_mesh.hpp" +#include "IO/interface.hpp" #include "compute/interface.hpp" #include "mesh/mesh.hpp" #include "quadrature/interface.hpp" diff --git a/tests/unit-tests/compute/index/compute_tests.cpp b/tests/unit-tests/compute/index/compute_tests.cpp index 0b0ff4a3..a624d0e1 100644 --- a/tests/unit-tests/compute/index/compute_tests.cpp +++ b/tests/unit-tests/compute/index/compute_tests.cpp @@ -1,7 +1,7 @@ #include "../../Kokkos_Environment.hpp" #include "../../MPI_environment.hpp" #include "../../utilities/include/interface.hpp" -#include "IO/mesh/read_mesh.hpp" +#include "IO/interface.hpp" #include "compute/interface.hpp" #include "mesh/mesh.hpp" #include "quadrature/interface.hpp" diff --git a/tests/unit-tests/compute/partial_derivatives/compute_partial_derivatives_tests.cpp b/tests/unit-tests/compute/partial_derivatives/compute_partial_derivatives_tests.cpp index c116e513..c7bd1a15 100644 --- a/tests/unit-tests/compute/partial_derivatives/compute_partial_derivatives_tests.cpp +++ b/tests/unit-tests/compute/partial_derivatives/compute_partial_derivatives_tests.cpp @@ -1,7 +1,7 @@ #include "../../Kokkos_Environment.hpp" #include "../../MPI_environment.hpp" #include "../../utilities/include/interface.hpp" -#include "IO/mesh/read_mesh.hpp" +#include "IO/interface.hpp" #include "compute/interface.hpp" #include "quadrature/interface.hpp" #include "yaml-cpp/yaml.h" diff --git a/tests/unit-tests/displacement_tests/Newmark/acoustic/newmark_tests.cpp b/tests/unit-tests/displacement_tests/Newmark/acoustic/newmark_tests.cpp index 4c81c233..e340a677 100644 --- a/tests/unit-tests/displacement_tests/Newmark/acoustic/newmark_tests.cpp +++ b/tests/unit-tests/displacement_tests/Newmark/acoustic/newmark_tests.cpp @@ -1,7 +1,7 @@ #include "../../../Kokkos_Environment.hpp" #include "../../../MPI_environment.hpp" #include "../../../utilities/include/compare_array.h" -#include "IO/mesh/read_mesh.hpp" +#include "IO/interface.hpp" #include "compute/interface.hpp" #include "constants.hpp" #include "domain/interface.hpp" diff --git a/tests/unit-tests/displacement_tests/Newmark/elastic/newmark_tests.cpp b/tests/unit-tests/displacement_tests/Newmark/elastic/newmark_tests.cpp index 9b492f96..0122b7d5 100644 --- a/tests/unit-tests/displacement_tests/Newmark/elastic/newmark_tests.cpp +++ b/tests/unit-tests/displacement_tests/Newmark/elastic/newmark_tests.cpp @@ -1,7 +1,7 @@ #include "../../../Kokkos_Environment.hpp" #include "../../../MPI_environment.hpp" #include "../../../utilities/include/compare_array.h" -#include "IO/mesh/read_mesh.hpp" +#include "IO/interface.hpp" #include "compute/interface.hpp" #include "constants.hpp" #include "domain/interface.hpp" diff --git a/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp b/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp index 0f1c78c1..adbc47fc 100644 --- a/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp +++ b/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp @@ -1,9 +1,7 @@ #include "../../Kokkos_Environment.hpp" #include "../../MPI_environment.hpp" #include "../../utilities/include/interface.hpp" -#include "IO/mesh/read_mesh.hpp" -#include "IO/receivers/read_receivers.hpp" -#include "IO/sources/read_sources.hpp" +#include "IO/interface.hpp" #include "compute/interface.hpp" #include "constants.hpp" #include "domain/domain.hpp" diff --git a/tests/unit-tests/domain/acoustic/rmass_inverse_tests.cpp b/tests/unit-tests/domain/acoustic/rmass_inverse_tests.cpp index ee6d9938..547885ec 100644 --- a/tests/unit-tests/domain/acoustic/rmass_inverse_tests.cpp +++ b/tests/unit-tests/domain/acoustic/rmass_inverse_tests.cpp @@ -1,7 +1,7 @@ #include "../../Kokkos_Environment.hpp" #include "../../MPI_environment.hpp" #include "../../utilities/include/compare_array.h" -#include "IO/mesh/read_mesh.hpp" +#include "IO/interface.hpp" #include "compute/interface.hpp" #include "constants.hpp" #include "domain/interface.hpp" diff --git a/tests/unit-tests/domain/elastic/rmass_inverse_tests.cpp b/tests/unit-tests/domain/elastic/rmass_inverse_tests.cpp index 5d78af93..df6df3be 100644 --- a/tests/unit-tests/domain/elastic/rmass_inverse_tests.cpp +++ b/tests/unit-tests/domain/elastic/rmass_inverse_tests.cpp @@ -1,7 +1,7 @@ #include "../../Kokkos_Environment.hpp" #include "../../MPI_environment.hpp" #include "../../utilities/include/compare_array.h" -#include "IO/mesh/read_mesh.hpp" +#include "IO/interface.hpp" #include "compute/interface.hpp" #include "constants.hpp" #include "domain/interface.hpp" diff --git a/tests/unit-tests/domain/rmass_inverse_tests.cpp b/tests/unit-tests/domain/rmass_inverse_tests.cpp index d903aca0..8e309bd4 100644 --- a/tests/unit-tests/domain/rmass_inverse_tests.cpp +++ b/tests/unit-tests/domain/rmass_inverse_tests.cpp @@ -1,7 +1,7 @@ #include "../Kokkos_Environment.hpp" #include "../MPI_environment.hpp" #include "../utilities/include/interface.hpp" -#include "IO/mesh/read_mesh.hpp" +#include "IO/interface.hpp" #include "compute/interface.hpp" #include "constants.hpp" #include "domain/domain.hpp" diff --git a/tests/unit-tests/mesh/mesh_tests.cpp b/tests/unit-tests/mesh/mesh_tests.cpp index 662d2e57..94dd0334 100644 --- a/tests/unit-tests/mesh/mesh_tests.cpp +++ b/tests/unit-tests/mesh/mesh_tests.cpp @@ -1,7 +1,7 @@ #include "../Kokkos_Environment.hpp" #include "../MPI_environment.hpp" +#include "IO/interface.hpp" #include "IO/mesh/impl/fortran/read_mesh_database.hpp" -#include "IO/mesh/read_mesh.hpp" #include "mesh/mesh.hpp" #include "yaml-cpp/yaml.h" #include diff --git a/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp b/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp index c3a7d309..748b12c5 100644 --- a/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp +++ b/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp @@ -2,8 +2,7 @@ #include "../../MPI_environment.hpp" // #include "../../utilities/include/compare_array.h" #include "IO/fortranio/interface.hpp" -#include "IO/mesh/read_mesh.hpp" -#include "IO/receivers/read_receivers.hpp" +#include "IO/interface.hpp" #include "compute/interface.hpp" #include "constants.hpp" #include "domain/domain.hpp" diff --git a/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp b/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp index 2b349836..70c154e9 100644 --- a/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp +++ b/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp @@ -2,8 +2,7 @@ #include "../../MPI_environment.hpp" // #include "../../utilities/include/compare_array.h" #include "IO/fortranio/interface.hpp" -#include "IO/mesh/read_mesh.hpp" -#include "IO/receivers/read_receivers.hpp" +#include "IO/interface.hpp" #include "compute/interface.hpp" #include "constants.hpp" #include "domain/domain.hpp" diff --git a/tests/unit-tests/source/source_location_tests.cpp b/tests/unit-tests/source/source_location_tests.cpp index 0f58abab..c3fe5bea 100644 --- a/tests/unit-tests/source/source_location_tests.cpp +++ b/tests/unit-tests/source/source_location_tests.cpp @@ -1,6 +1,6 @@ #include "../Kokkos_Environment.hpp" #include "../MPI_environment.hpp" -#include "IO/mesh/read_mesh.hpp" +#include "IO/interface.hpp" #include "compute/interface.hpp" #include "material/interface.hpp" #include "mesh/mesh.hpp" From 03c458443eee39b16a3478a7e5b243f4c137e61b Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Wed, 27 Nov 2024 13:47:31 -0500 Subject: [PATCH 2/5] Updated the tests and the fixed merge conflicts --- src/IO/interface.cpp | 8 ++++---- tests/unit-tests/assembly/test_fixture/test_fixture.cpp | 4 +--- tests/unit-tests/assembly/test_fixture/test_fixture.hpp | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/IO/interface.cpp b/src/IO/interface.cpp index 0471ed04..900498b3 100644 --- a/src/IO/interface.cpp +++ b/src/IO/interface.cpp @@ -38,13 +38,13 @@ specfem::IO::read_sources(const std::string sources_file, const int nsteps, const bool user_defined_start_time = (std::abs(user_t0) > std::numeric_limits::epsilon()); - const specfem::wavefield::type source_wavefield_type = - [&simulation_type]() -> specfem::wavefield::type { + const specfem::wavefield::simulation_field source_wavefield_type = + [&simulation_type]() -> specfem::wavefield::simulation_field { switch (simulation_type) { case specfem::simulation::type::forward: - return specfem::wavefield::type::forward; + return specfem::wavefield::simulation_field::forward; case specfem::simulation::type::combined: - return specfem::wavefield::type::backward; + return specfem::wavefield::simulation_field::backward; default: throw std::runtime_error("Unknown simulation type"); } diff --git a/tests/unit-tests/assembly/test_fixture/test_fixture.cpp b/tests/unit-tests/assembly/test_fixture/test_fixture.cpp index be66c194..fe4df41f 100644 --- a/tests/unit-tests/assembly/test_fixture/test_fixture.cpp +++ b/tests/unit-tests/assembly/test_fixture/test_fixture.cpp @@ -1,7 +1,5 @@ #include "test_fixture.hpp" -#include "IO/mesh/read_mesh.hpp" -#include "IO/receivers/read_receivers.hpp" -#include "IO/sources/read_sources.hpp" +#include "IO/interface.hpp" #include "test_fixture.tpp" // ------------------------------------------------------------------------ diff --git a/tests/unit-tests/assembly/test_fixture/test_fixture.hpp b/tests/unit-tests/assembly/test_fixture/test_fixture.hpp index 33cb2e81..4327f9ba 100644 --- a/tests/unit-tests/assembly/test_fixture/test_fixture.hpp +++ b/tests/unit-tests/assembly/test_fixture/test_fixture.hpp @@ -1,6 +1,6 @@ #pragma once -#include "../MPI_environment.hpp" +#include "../../MPI_environment.hpp" #include "IO/interface.hpp" #include "compute/assembly/assembly.hpp" #include "enumerations/specfem_enums.hpp" From 76e9eb4602abe56993e50b15e8adb96e4c5b66a7 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Wed, 27 Nov 2024 14:11:27 -0500 Subject: [PATCH 3/5] moved the implementation for read_sources/_receivers/_mesh to src/IO/{sources,receivers,mesh}.cpp --- CMakeLists.txt | 4 +- src/IO/{interface.cpp => mesh.cpp} | 166 +---------------------------- src/IO/receivers.cpp | 45 ++++++++ src/IO/sources.cpp | 126 ++++++++++++++++++++++ 4 files changed, 176 insertions(+), 165 deletions(-) rename src/IO/{interface.cpp => mesh.cpp} (51%) create mode 100644 src/IO/receivers.cpp create mode 100644 src/IO/sources.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 447b32ba..dd1745c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,7 +129,9 @@ add_library( src/IO/fortranio/fortran_io.cpp src/IO/HDF5/native_type.cpp # src/IO/ASCII/native_type.cpp - src/IO/interface.cpp + src/IO/sources.cpp + src/IO/receivers.cpp + src/IO/mesh.cpp src/IO/mesh/impl/fortran/read_boundaries.cpp src/IO/mesh/impl/fortran/read_elements.cpp src/IO/mesh/impl/fortran/read_material_properties.cpp diff --git a/src/IO/interface.cpp b/src/IO/mesh.cpp similarity index 51% rename from src/IO/interface.cpp rename to src/IO/mesh.cpp index 900498b3..d8d13ca6 100644 --- a/src/IO/interface.cpp +++ b/src/IO/mesh.cpp @@ -1,5 +1,4 @@ -// Internal Includes -#include "IO/interface.hpp" +#include "mesh/mesh.hpp" #include "IO/fortranio/interface.hpp" #include "IO/mesh/impl/fortran/read_boundaries.hpp" #include "IO/mesh/impl/fortran/read_elements.hpp" @@ -7,181 +6,20 @@ #include "IO/mesh/impl/fortran/read_material_properties.hpp" #include "IO/mesh/impl/fortran/read_mesh_database.hpp" #include "IO/mesh/impl/fortran/read_properties.hpp" +#include "IO/mesh/read_mesh.hpp" #include "enumerations/specfem_enums.hpp" #include "kokkos_abstractions.h" #include "material/material.hpp" -#include "mesh/mesh.hpp" #include "mesh/tags/tags.hpp" -#include "receiver/interface.hpp" -#include "source/interface.hpp" #include "specfem_mpi/interface.hpp" #include "specfem_setup.hpp" -#include "utilities/interface.hpp" -#include "yaml-cpp/yaml.h" - -// External/Standard Libraries #include #include -#include -#include #include #include -#include #include #include -std::tuple >, type_real> -specfem::IO::read_sources(const std::string sources_file, const int nsteps, - const type_real user_t0, const type_real dt, - const specfem::simulation::type simulation_type) { - - const bool user_defined_start_time = - (std::abs(user_t0) > std::numeric_limits::epsilon()); - - const specfem::wavefield::simulation_field source_wavefield_type = - [&simulation_type]() -> specfem::wavefield::simulation_field { - switch (simulation_type) { - case specfem::simulation::type::forward: - return specfem::wavefield::simulation_field::forward; - case specfem::simulation::type::combined: - return specfem::wavefield::simulation_field::backward; - default: - throw std::runtime_error("Unknown simulation type"); - } - }(); - - // read sources file - std::vector > sources; - YAML::Node yaml = YAML::LoadFile(sources_file); - int nsources = yaml["number-of-sources"].as(); - YAML::Node Node = yaml["sources"]; - assert(Node.IsSequence()); - - // Note: Make sure you name the YAML node different from the name of the - // source class Otherwise, the compiler will get confused and throw an error - // I've spent hours debugging this issue. It is very annoying since it only - // shows up on CUDA compiler - int number_of_sources = 0; - int number_of_adjoint_sources = 0; - for (auto N : Node) { - if (YAML::Node force_source = N["force"]) { - sources.push_back(std::make_shared( - force_source, nsteps, dt, source_wavefield_type)); - number_of_sources++; - } else if (YAML::Node moment_tensor_source = N["moment-tensor"]) { - sources.push_back(std::make_shared( - moment_tensor_source, nsteps, dt, source_wavefield_type)); - number_of_sources++; - } else if (YAML::Node external_source = N["user-defined"]) { - sources.push_back(std::make_shared( - external_source, nsteps, dt, source_wavefield_type)); - number_of_sources++; - } else if (YAML::Node adjoint_node = N["adjoint-source"]) { - if (!adjoint_node["station_name"] || !adjoint_node["network_name"]) { - throw std::runtime_error( - "Station name and network name are required for adjoint source"); - } - sources.push_back(std::make_shared( - adjoint_node, nsteps, dt)); - number_of_adjoint_sources++; - } else { - throw std::runtime_error("Unknown source type"); - } - } - - if (number_of_sources == 0) { - throw std::runtime_error("No sources found in the sources file"); - } - - if (simulation_type == specfem::simulation::type::combined && - number_of_adjoint_sources == 0) { - throw std::runtime_error("No adjoint sources found in the sources file"); - } - - if (simulation_type == specfem::simulation::type::forward && - number_of_adjoint_sources > 0) { - throw std::runtime_error("Adjoint sources found in the sources file for " - "forward simulation"); - } - - if (sources.size() != nsources) { - std::ostringstream message; - message << "Found only " << sources.size() - << " number of sources. Total number of sources in " << sources_file - << " are" << nsources - << " Please check if there is a error in sources file."; - throw std::runtime_error(message.str()); - } - - type_real min_t0 = std::numeric_limits::max(); - type_real min_tshift = std::numeric_limits::max(); - for (auto &source : sources) { - type_real cur_t0 = source->get_t0(); - type_real cur_tshift = source->get_tshift(); - if (cur_t0 < min_t0) { - min_t0 = cur_t0; - } - if (cur_tshift < min_tshift) { - min_tshift = cur_tshift; - } - } - - type_real t0; - if (user_defined_start_time) { - if (user_t0 > min_t0 - min_tshift) - throw std::runtime_error("User defined start time is less than minimum " - "required for stability"); - - t0 = user_t0; - } else { - // Update tshift for auto detected start time - for (auto &source : sources) { - type_real cur_t0 = source->get_t0(); - source->update_tshift(cur_t0 - min_t0); - } - - t0 = min_t0; - } - - return std::make_tuple(sources, t0); -} - -std::vector > -specfem::IO::read_receivers(const std::string stations_file, - const type_real angle) { - - boost::char_separator sep(" "); - std::vector > receivers; - std::fstream stations; - stations.open(stations_file, std::ios::in); - if (stations.is_open()) { - std::string line; - // Read stations file line by line - while (std::getline(stations, line)) { - // split every line with " " delimiter - boost::tokenizer > tokens(line, sep); - std::vector current_station; - for (const auto &t : tokens) { - current_station.push_back(t); - } - // check if the read line meets the format - assert(current_station.size() == 6); - // get the x and z coordinates of the station; - const std::string network_name = current_station[0]; - const std::string station_name = current_station[1]; - const type_real x = static_cast(std::stod(current_station[2])); - const type_real z = static_cast(std::stod(current_station[3])); - - receivers.push_back(std::make_shared( - network_name, station_name, x, z, angle)); - } - - stations.close(); - } - - return receivers; -} - specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, const specfem::MPI::MPI *mpi) { diff --git a/src/IO/receivers.cpp b/src/IO/receivers.cpp new file mode 100644 index 00000000..29a7c660 --- /dev/null +++ b/src/IO/receivers.cpp @@ -0,0 +1,45 @@ +#include "IO/interface.hpp" +#include "receiver/interface.hpp" +#include "specfem_setup.hpp" +#include "utilities/interface.hpp" +#include "yaml-cpp/yaml.h" +#include +#include +#include +#include + +std::vector > +specfem::IO::read_receivers(const std::string stations_file, + const type_real angle) { + + boost::char_separator sep(" "); + std::vector > receivers; + std::fstream stations; + stations.open(stations_file, std::ios::in); + if (stations.is_open()) { + std::string line; + // Read stations file line by line + while (std::getline(stations, line)) { + // split every line with " " delimiter + boost::tokenizer > tokens(line, sep); + std::vector current_station; + for (const auto &t : tokens) { + current_station.push_back(t); + } + // check if the read line meets the format + assert(current_station.size() == 6); + // get the x and z coordinates of the station; + const std::string network_name = current_station[0]; + const std::string station_name = current_station[1]; + const type_real x = static_cast(std::stod(current_station[2])); + const type_real z = static_cast(std::stod(current_station[3])); + + receivers.push_back(std::make_shared( + network_name, station_name, x, z, angle)); + } + + stations.close(); + } + + return receivers; +} diff --git a/src/IO/sources.cpp b/src/IO/sources.cpp new file mode 100644 index 00000000..badad1a7 --- /dev/null +++ b/src/IO/sources.cpp @@ -0,0 +1,126 @@ +#include "IO/interface.hpp" +#include "source/interface.hpp" +#include "specfem_setup.hpp" +#include "utilities/interface.hpp" +#include "yaml-cpp/yaml.h" +#include +#include +#include +#include +#include + +std::tuple >, type_real> +specfem::IO::read_sources(const std::string sources_file, const int nsteps, + const type_real user_t0, const type_real dt, + const specfem::simulation::type simulation_type) { + + const bool user_defined_start_time = + (std::abs(user_t0) > std::numeric_limits::epsilon()); + + const specfem::wavefield::simulation_field source_wavefield_type = + [&simulation_type]() -> specfem::wavefield::simulation_field { + switch (simulation_type) { + case specfem::simulation::type::forward: + return specfem::wavefield::simulation_field::forward; + case specfem::simulation::type::combined: + return specfem::wavefield::simulation_field::backward; + default: + throw std::runtime_error("Unknown simulation type"); + } + }(); + + // read sources file + std::vector > sources; + YAML::Node yaml = YAML::LoadFile(sources_file); + int nsources = yaml["number-of-sources"].as(); + YAML::Node Node = yaml["sources"]; + assert(Node.IsSequence()); + + // Note: Make sure you name the YAML node different from the name of the + // source class Otherwise, the compiler will get confused and throw an error + // I've spent hours debugging this issue. It is very annoying since it only + // shows up on CUDA compiler + int number_of_sources = 0; + int number_of_adjoint_sources = 0; + for (auto N : Node) { + if (YAML::Node force_source = N["force"]) { + sources.push_back(std::make_shared( + force_source, nsteps, dt, source_wavefield_type)); + number_of_sources++; + } else if (YAML::Node moment_tensor_source = N["moment-tensor"]) { + sources.push_back(std::make_shared( + moment_tensor_source, nsteps, dt, source_wavefield_type)); + number_of_sources++; + } else if (YAML::Node external_source = N["user-defined"]) { + sources.push_back(std::make_shared( + external_source, nsteps, dt, source_wavefield_type)); + number_of_sources++; + } else if (YAML::Node adjoint_node = N["adjoint-source"]) { + if (!adjoint_node["station_name"] || !adjoint_node["network_name"]) { + throw std::runtime_error( + "Station name and network name are required for adjoint source"); + } + sources.push_back(std::make_shared( + adjoint_node, nsteps, dt)); + number_of_adjoint_sources++; + } else { + throw std::runtime_error("Unknown source type"); + } + } + + if (number_of_sources == 0) { + throw std::runtime_error("No sources found in the sources file"); + } + + if (simulation_type == specfem::simulation::type::combined && + number_of_adjoint_sources == 0) { + throw std::runtime_error("No adjoint sources found in the sources file"); + } + + if (simulation_type == specfem::simulation::type::forward && + number_of_adjoint_sources > 0) { + throw std::runtime_error("Adjoint sources found in the sources file for " + "forward simulation"); + } + + if (sources.size() != nsources) { + std::ostringstream message; + message << "Found only " << sources.size() + << " number of sources. Total number of sources in " << sources_file + << " are" << nsources + << " Please check if there is a error in sources file."; + throw std::runtime_error(message.str()); + } + + type_real min_t0 = std::numeric_limits::max(); + type_real min_tshift = std::numeric_limits::max(); + for (auto &source : sources) { + type_real cur_t0 = source->get_t0(); + type_real cur_tshift = source->get_tshift(); + if (cur_t0 < min_t0) { + min_t0 = cur_t0; + } + if (cur_tshift < min_tshift) { + min_tshift = cur_tshift; + } + } + + type_real t0; + if (user_defined_start_time) { + if (user_t0 > min_t0 - min_tshift) + throw std::runtime_error("User defined start time is less than minimum " + "required for stability"); + + t0 = user_t0; + } else { + // Update tshift for auto detected start time + for (auto &source : sources) { + type_real cur_t0 = source->get_t0(); + source->update_tshift(cur_t0 - min_t0); + } + + t0 = min_t0; + } + + return std::make_tuple(sources, t0); +} From 71c4df493ee5ead85fbc6ea7008d139308927556 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Wed, 27 Nov 2024 14:17:47 -0500 Subject: [PATCH 4/5] Moved some of the includes around --- src/IO/mesh.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/IO/mesh.cpp b/src/IO/mesh.cpp index d8d13ca6..c7428b8e 100644 --- a/src/IO/mesh.cpp +++ b/src/IO/mesh.cpp @@ -1,18 +1,21 @@ +// Internal Includes #include "mesh/mesh.hpp" #include "IO/fortranio/interface.hpp" +#include "IO/interface.hpp" #include "IO/mesh/impl/fortran/read_boundaries.hpp" #include "IO/mesh/impl/fortran/read_elements.hpp" #include "IO/mesh/impl/fortran/read_interfaces.hpp" #include "IO/mesh/impl/fortran/read_material_properties.hpp" #include "IO/mesh/impl/fortran/read_mesh_database.hpp" #include "IO/mesh/impl/fortran/read_properties.hpp" -#include "IO/mesh/read_mesh.hpp" #include "enumerations/specfem_enums.hpp" #include "kokkos_abstractions.h" #include "material/material.hpp" #include "mesh/tags/tags.hpp" #include "specfem_mpi/interface.hpp" #include "specfem_setup.hpp" + +// External/Standard Libraries #include #include #include From fec214a242c481ec6a864aa6302c301ddfade766 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Wed, 27 Nov 2024 14:18:48 -0500 Subject: [PATCH 5/5] Added some include adds --- src/IO/receivers.cpp | 3 +++ src/IO/sources.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/IO/receivers.cpp b/src/IO/receivers.cpp index 29a7c660..61732b26 100644 --- a/src/IO/receivers.cpp +++ b/src/IO/receivers.cpp @@ -1,8 +1,11 @@ +// Internal Includes #include "IO/interface.hpp" #include "receiver/interface.hpp" #include "specfem_setup.hpp" #include "utilities/interface.hpp" #include "yaml-cpp/yaml.h" + +// External Includes #include #include #include diff --git a/src/IO/sources.cpp b/src/IO/sources.cpp index badad1a7..3478830e 100644 --- a/src/IO/sources.cpp +++ b/src/IO/sources.cpp @@ -1,8 +1,11 @@ +// Internal Includes #include "IO/interface.hpp" #include "source/interface.hpp" #include "specfem_setup.hpp" #include "utilities/interface.hpp" #include "yaml-cpp/yaml.h" + +// External Includes #include #include #include