From 85dd704bd72ef8c2320d581d76cc9f33032e81e0 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Fri, 4 Oct 2024 15:00:11 -0400 Subject: [PATCH 01/53] commit before pull --- CMakeLists.txt | 27 ++++ .../tutorials/tutorial1/Chapter2/index.rst | 2 +- include/compute/assembly/assembly.hpp | 2 +- include/policies/range.hpp | 117 ++++++++++-------- 4 files changed, 96 insertions(+), 52 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 258fbc25..b5def661 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -473,6 +473,8 @@ add_executable( src/specfem2d.cpp ) + + target_link_libraries( specfem2d specfem_mpi @@ -493,6 +495,31 @@ target_link_libraries( ${HDF5_LIBRARIES} ) +add_executable( + homo2d + examples/homogeneous-medium-flat-topography/homo2d.cpp +) + +target_link_libraries( + homo2d + specfem_mpi + Kokkos::kokkos + mesh + quadrature + compute + source_class + parameter_reader + receiver_class + writer + reader + domain + coupled_interface + kernels + solver + Boost::program_options + ${HDF5_LIBRARIES} +) + # Include tests if (BUILD_TESTS) message("-- Including tests.") diff --git a/docs/developer_documentation/tutorials/tutorial1/Chapter2/index.rst b/docs/developer_documentation/tutorials/tutorial1/Chapter2/index.rst index 28e046ed..7f3a4f41 100644 --- a/docs/developer_documentation/tutorials/tutorial1/Chapter2/index.rst +++ b/docs/developer_documentation/tutorials/tutorial1/Chapter2/index.rst @@ -40,7 +40,7 @@ Next we will read the sources and receivers generated in :ref:`Chapter1`. .. code:: cpp - #include "sources/sources.hpp" + #include "source/source.hpp" #include "receivers/receivers.hpp" #include "specfem_setup.hpp" #include diff --git a/include/compute/assembly/assembly.hpp b/include/compute/assembly/assembly.hpp index 91b61b76..710994db 100644 --- a/include/compute/assembly/assembly.hpp +++ b/include/compute/assembly/assembly.hpp @@ -62,7 +62,7 @@ struct assembly { * @param t0 Start time of simulation * @param dt Time step * @param max_timesteps Maximum number of time steps - * @param max_sig_step Maximum number of siesmogram time steps + * @param max_sig_step Maximum number of seismogram time steps * @param simulation Type of simulation (forward, adjoint, etc.) */ assembly( diff --git a/include/policies/range.hpp b/include/policies/range.hpp index b17220b6..d65bc07a 100644 --- a/include/policies/range.hpp +++ b/include/policies/range.hpp @@ -6,38 +6,45 @@ namespace specfem { namespace iterator { + namespace impl { -/** - * @brief Index type for the range iterator. - * - * @tparam UseSIMD Indicates whether SIMD is used or not. - */ -template struct range_index_type; -/** - * @brief Template specialization when not using SIMD. - * - */ -template <> struct range_index_type { - specfem::point::assembly_index index; ///< Assembly index + /** + * @brief Index type for the range iterator. + * + * @tparam UseSIMD Indicates whether SIMD is used or not. + */ + template struct range_index_type; - KOKKOS_INLINE_FUNCTION - range_index_type(const specfem::point::assembly_index index) : index(index) {} -}; -/** - * @brief Template specialization when using SIMD. - * - */ -template <> struct range_index_type { - specfem::point::simd_assembly_index index; ///< SIMD assembly index + /** + * @brief Template specialization when not using SIMD. + * + */ + template <> struct range_index_type { + specfem::point::assembly_index index; ///< Assembly index + + KOKKOS_INLINE_FUNCTION + range_index_type(const specfem::point::assembly_index index) : index(index) {} + }; + + + /** + * @brief Template specialization when using SIMD. + * + */ + template <> struct range_index_type { + specfem::point::simd_assembly_index index; ///< SIMD assembly index + + KOKKOS_INLINE_FUNCTION + range_index_type(const specfem::point::simd_assembly_index index) + : index(index) {} + }; - KOKKOS_INLINE_FUNCTION - range_index_type(const specfem::point::simd_assembly_index index) - : index(index) {} -}; } // namespace impl + + /** * @brief Iterator to generate indices for quadrature points defined within this * iterator. @@ -51,35 +58,45 @@ template <> struct range_index_type { * @tparam SIMD type to generate a SIMD index. */ template struct range { -private: - int starting_index; ///< Starting index for the iterator range. - int number_points; ///< Number of points in the iterator range. Equal to or - ///< less than SIMD size when using SIMD. + + private: - constexpr static bool using_simd = SIMD::using_simd; - constexpr static int simd_size = SIMD::size(); + int starting_index; ///< Starting index for the iterator range. + int number_points; ///< Number of points in the iterator range. Equal to or + ///< less than SIMD size when using SIMD. - KOKKOS_INLINE_FUNCTION - range(const int starting_index, const int number_points, std::true_type) - : starting_index(starting_index), - number_points((number_points < simd_size) ? number_points : simd_size) { - } - KOKKOS_INLINE_FUNCTION - range(const int starting_index, const int number_points, std::false_type) - : starting_index(starting_index), number_points(number_points) {} + constexpr static bool using_simd = SIMD::using_simd; + constexpr static int simd_size = SIMD::size(); - KOKKOS_INLINE_FUNCTION - impl::range_index_type operator()(const int i, std::false_type) const { - return impl::range_index_type( - specfem::point::assembly_index{ starting_index }); - } + // --- SIMD + // Range constructor for simd execution + KOKKOS_INLINE_FUNCTION + range(const int starting_index, const int number_points, std::true_type) + : starting_index(starting_index), + number_points((number_points < simd_size) ? number_points : simd_size) {} + + // range_index_type operator for simd execution + KOKKOS_INLINE_FUNCTION + impl::range_index_type operator()(const int i, std::true_type) const { + return impl::range_index_type( + specfem::point::simd_assembly_index{ starting_index, number_points }); + } + + + // --- NON-SIMD + // Range constructor for non-simd execution + KOKKOS_INLINE_FUNCTION + range(const int starting_index, const int number_points, std::false_type) + : starting_index(starting_index), number_points(number_points) {} + + // range_index_type operator for non-simd execution + KOKKOS_INLINE_FUNCTION + impl::range_index_type operator()(const int i, std::false_type) const { + return impl::range_index_type( + specfem::point::assembly_index{ starting_index }); + } - KOKKOS_INLINE_FUNCTION - impl::range_index_type operator()(const int i, std::true_type) const { - return impl::range_index_type( - specfem::point::simd_assembly_index{ starting_index, number_points }); - } public: /** @@ -144,7 +161,7 @@ struct range : Kokkos::RangePolicy { public: static_assert(ParallelConfig::is_point_parallel_config, "Wrong parallel config type"); - + /** * @name Type definitions * From ba82afd70c7d65bfaabb8eb1e43fdc888a00f2ac Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Wed, 9 Oct 2024 15:42:46 -0400 Subject: [PATCH 02/53] First intermediate save --- include/IO/mesh/fortran/read_boundaries.hpp | 73 ++++++ include/IO/mesh/fortran/read_interface.hpp | 42 ++++ .../fortran/read_material_properties.hpp | 5 +- .../mesh}/fortran/read_mesh_database.hpp | 3 +- include/IO/mesh/fortran/read_properties.hpp | 22 ++ include/IO/mesh/mesh.hpp | 27 ++ .../mesh/boundaries/absorbing_boundaries.hpp | 12 - .../mesh/boundaries/acoustic_free_surface.hpp | 15 +- include/mesh/boundaries/boundaries.hpp | 20 -- .../coupled_interfaces/coupled_interfaces.hpp | 36 ++- .../interface_container.hpp | 13 +- .../interface_container.tpp | 17 +- include/mesh/elements/tangential_elements.hpp | 7 +- include/mesh/mesh.hpp | 21 +- include/mesh/properties/properties.hpp | 37 ++- src/IO/mesh/fortran/read_boundaries.cpp | 234 ++++++++++++++++++ src/IO/mesh/fortran/read_interfaces.cpp | 68 +++++ .../fortran/read_material_properties.cpp | 15 +- .../mesh}/fortran/read_mesh_database.cpp | 24 +- src/IO/mesh/fortran/read_properties.cpp | 62 +++++ src/IO/mesh/read_mesh.cpp | 233 +++++++++++++++++ src/mesh/boundaries/absorbing_boundaries.cpp | 79 ------ src/mesh/boundaries/acoustic_free_surface.cpp | 74 ------ src/mesh/boundaries/forcing_boundaries.cpp | 51 +--- .../coupled_interfaces/coupled_interfaces.cpp | 23 +- src/mesh/properties/properties.cpp | 30 --- 26 files changed, 883 insertions(+), 360 deletions(-) create mode 100644 include/IO/mesh/fortran/read_boundaries.hpp create mode 100644 include/IO/mesh/fortran/read_interface.hpp rename include/{mesh/IO => IO/mesh}/fortran/read_material_properties.hpp (97%) rename include/{mesh/IO => IO/mesh}/fortran/read_mesh_database.hpp (98%) create mode 100644 include/IO/mesh/fortran/read_properties.hpp create mode 100644 include/IO/mesh/mesh.hpp create mode 100644 src/IO/mesh/fortran/read_boundaries.cpp create mode 100644 src/IO/mesh/fortran/read_interfaces.cpp rename src/{mesh/IO => IO/mesh}/fortran/read_material_properties.cpp (92%) rename src/{mesh/IO => IO/mesh}/fortran/read_mesh_database.cpp (94%) create mode 100644 src/IO/mesh/fortran/read_properties.cpp create mode 100644 src/IO/mesh/read_mesh.cpp delete mode 100644 src/mesh/properties/properties.cpp diff --git a/include/IO/mesh/fortran/read_boundaries.hpp b/include/IO/mesh/fortran/read_boundaries.hpp new file mode 100644 index 00000000..9fbdf33d --- /dev/null +++ b/include/IO/mesh/fortran/read_boundaries.hpp @@ -0,0 +1,73 @@ +#include "mesh/boundaries/boundaries.hpp" +#include "specfem_mpi/interface.hpp" +#include "mesh/boundaries/absorbing_boundaries.hpp" +#include "mesh/boundaries/acoustic_free_surface.hpp" +#include "mesh/boundaries/forcing_boundaries.hpp" +#include +#include + + +namespace specfem { +namespace IO { +namespace mesh { +namespace fortran { + + /** + * @brief Read absorbing boundaries from mesh database + * + * @param stream Input stream + * @param nspec Number of spectral elements + * @param n_absorbing Number of absorbing boundaries + * @param mpi MPI object + * @return specfem::mesh::absorbing_boundary + */ + specfem::mesh::absorbing_boundary read_absorbing_boundaries( + std::ifstream &stream, const int n_absorbing, const int nspec, + const specfem::MPI::MPI *mpi) {}; + + /** + * @brief Read acoustic free surface from mesh database + * + * @param stream Input stream + * @param nspec Number of spectral elements + * @param n_acoustic_surface Number of acoustic surfaces + * @param mpi MPI object + * @return specfem::mesh::acoustic_free_surface + */ + specfem::mesh::acoustic_free_surface read_acoustic_free_surface( + std::ifstream &stream, const int nspec, const int n_acoustic_surface, + const specfem::MPI::MPI *mpi) {}; + + /** + * @brief Read forcing boundaries from mesh database + * + * @param stream Input stream + * @param nspec Number of spectral elements + * @param n_acforcing Number of acoustic forcing boundaries + * @param mpi MPI object + * @return specfem::mesh::forcing_boundary + */ + specfem::mesh::forcing_boundary read_forcing_boundaries( + std::ifstream &stream, const int nspec, const int n_acforcing, + const specfem::MPI::MPI *mpi) {}; + + /** + * @brief Read boundaries from mesh database + * + * @param stream Input stream + * @param nspec Number of spectral elements + * @param n_absorbing Number of absorbing boundaries + * @param n_acforcing Number of acoustic forcing boundaries + * @param n_acoustic_surface Number of acoustic surfaces + * @param mpi MPI object + * @return specfem::mesh::boundaries + */ + specfem::mesh::boundaries read_boundaries( + std::ifstream &stream, const int nspec, const int n_absorbing, + const int n_acforcing, const int n_acoustic_surface, + const specfem::MPI::MPI *mpi) {}; + +} // namespace fortran +} // namespace mesh +} // namespace IO +} // namespace specfem diff --git a/include/IO/mesh/fortran/read_interface.hpp b/include/IO/mesh/fortran/read_interface.hpp new file mode 100644 index 00000000..bc9e0acb --- /dev/null +++ b/include/IO/mesh/fortran/read_interface.hpp @@ -0,0 +1,42 @@ + +#include "interface_container.hpp" +#include "specfem_mpi/interface.hpp" + +namespace specfem { +namespace IO { +namespace mesh { +namespace fortran { + +template +specfem::mesh::interface_container +read_interface( + const int num_interfaces, std::ifstream &stream, + const specfem::MPI::MPI *mpi) { + + if (!num_interfaces) + return; + + int medium1_ispec_l, medium2_ispec_l; + + specfem::mesh::interface_container interface(num_interfaces); + interface.medium1_index_mapping("medium1_index_mapping", num_interfaces); + interface.medium2_index_mapping("medium2_index_mapping", num_interfaces); + + for (int i = 0; i < num_interfaces; i++) { + specfem::IO::fortran_read_line(stream, &medium2_ispec_l, + &medium1_ispec_l); + interface.medium1_index_mapping(i) = medium1_ispec_l - 1; + interface.medium2_index_mapping(i) = medium2_ispec_l - 1; + } + + return interface; +} + + + + +} // namespace fortran +} // namespace mesh +} // namespace IO +} // namespace specfem \ No newline at end of file diff --git a/include/mesh/IO/fortran/read_material_properties.hpp b/include/IO/mesh/fortran/read_material_properties.hpp similarity index 97% rename from include/mesh/IO/fortran/read_material_properties.hpp rename to include/IO/mesh/fortran/read_material_properties.hpp index 5a4f07d4..3a0aa23d 100644 --- a/include/mesh/IO/fortran/read_material_properties.hpp +++ b/include/IO/mesh/fortran/read_material_properties.hpp @@ -9,8 +9,8 @@ #include namespace specfem { -namespace mesh { namespace IO { +namespace mesh { namespace fortran { /** @@ -26,8 +26,9 @@ namespace fortran { std::vector > read_material_properties(std::ifstream &stream, const int numat, const specfem::MPI::MPI *mpi); + } // namespace fortran -} // namespace IO } // namespace mesh +} // namespace IO } // namespace specfem #endif diff --git a/include/mesh/IO/fortran/read_mesh_database.hpp b/include/IO/mesh/fortran/read_mesh_database.hpp similarity index 98% rename from include/mesh/IO/fortran/read_mesh_database.hpp rename to include/IO/mesh/fortran/read_mesh_database.hpp index 2fcf3a1b..1ac238c4 100644 --- a/include/mesh/IO/fortran/read_mesh_database.hpp +++ b/include/IO/mesh/fortran/read_mesh_database.hpp @@ -13,8 +13,8 @@ namespace specfem { * Helper routines to read fortran binary database * */ -namespace mesh { namespace IO { +namespace mesh { namespace fortran { /** @@ -53,7 +53,6 @@ read_mesh_database_attenuation(std::ifstream &stream, const specfem::MPI::MPI *mpi); } // namespace fortran } // namespace IO -} // namespace mesh } // namespace specfem #endif diff --git a/include/IO/mesh/fortran/read_properties.hpp b/include/IO/mesh/fortran/read_properties.hpp new file mode 100644 index 00000000..79a789f0 --- /dev/null +++ b/include/IO/mesh/fortran/read_properties.hpp @@ -0,0 +1,22 @@ +#include "mesh/properties/properties.hpp" +#include "IO/fortranio/interface.hpp" + +namespace specfem { +namespace IO { +namespace mesh { +namespace fortran { + +/* +* @brief Read properties from mesh database +* +* @param stream Input stream +* @param mpi MPI object +* @return specfem::mesh::properties +*/ +specfem::mesh::properties read_properties(std::ifstream &stream, + const specfem::MPI::MPI *mpi) {}; + +} // namespace fortran +} // namespace mesh +} // namespace IO +} // namespace specfem \ No newline at end of file diff --git a/include/IO/mesh/mesh.hpp b/include/IO/mesh/mesh.hpp new file mode 100644 index 00000000..660294ac --- /dev/null +++ b/include/IO/mesh/mesh.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include "boundaries/boundaries.hpp" +#include "control_nodes/control_nodes.hpp" +#include "coupled_interfaces/coupled_interfaces.hpp" +#include "elements/axial_elements.hpp" +#include "elements/tangential_elements.hpp" +#include "materials/materials.hpp" +#include "mesh/tags/tags.hpp" +#include "properties/properties.hpp" +#include "specfem_mpi/interface.hpp" +#include "specfem_setup.hpp" +#include + +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 + */ + specfem::mesh::mesh read_mesh(const std::string filename, const specfem::MPI::MPI *mpi); + +} // namespace IO +} // namespace specfem diff --git a/include/mesh/boundaries/absorbing_boundaries.hpp b/include/mesh/boundaries/absorbing_boundaries.hpp index 45f1abf0..4016d44e 100644 --- a/include/mesh/boundaries/absorbing_boundaries.hpp +++ b/include/mesh/boundaries/absorbing_boundaries.hpp @@ -34,18 +34,6 @@ struct absorbing_boundary { absorbing_boundary(const int num_abs_boundaries_faces); - /** - * @brief Constructor to read and assign values from fortran binary database - * file - * - * @param stream Stream object for fortran binary file buffered to absorbing - * boundary section - * @param num_abs_boundary_faces Number of absorbing boundary faces - * @param nspec Number of spectral elements - * @param mpi Pointer to MPI object - */ - absorbing_boundary(std::ifstream &stream, int num_abs_boundary_faces, - const int nspec, const specfem::MPI::MPI *mpi); ///@} }; } // namespace mesh diff --git a/include/mesh/boundaries/acoustic_free_surface.hpp b/include/mesh/boundaries/acoustic_free_surface.hpp index bc52ad32..6338dc57 100644 --- a/include/mesh/boundaries/acoustic_free_surface.hpp +++ b/include/mesh/boundaries/acoustic_free_surface.hpp @@ -22,20 +22,7 @@ struct acoustic_free_surface { acoustic_free_surface(){}; acoustic_free_surface(const int nelem_acoustic_surface); - /** - * @brief Constructor to read and assign values from fortran binary database - * file - * - * @param stream Stream object for fortran binary file buffered to absorbing - * boundary section - * @param nelem_acoustic_surface Number of absorbing boundary faces - * @param knods Spectral element node connectivity - * @param mpi Pointer to MPI object - */ - acoustic_free_surface(std::ifstream &stream, - const int &nelem_acoustic_surface, - const Kokkos::View knods, - const specfem::MPI::MPI *mpi); + ///@} int nelem_acoustic_surface; ///< Number of elements on the acoustic free diff --git a/include/mesh/boundaries/boundaries.hpp b/include/mesh/boundaries/boundaries.hpp index 6375f2a8..d4e4908f 100644 --- a/include/mesh/boundaries/boundaries.hpp +++ b/include/mesh/boundaries/boundaries.hpp @@ -40,26 +40,6 @@ struct boundaries { : absorbing_boundary(absorbing_boundary), acoustic_free_surface(acoustic_free_surface) {} - /** - * @brief Constructor to read and assign values from fortran binary database - * file - * - * @param stream Stream object for fortran binary file buffered to absorbing - * boundary section - * @param nspec Number of spectral elements - * @param n_absorbing Number of absorbing boundary faces - * @param n_acoustic_surface Number of acoustic free surface boundary faces - * @param n_acforcing Number of acoustic forcing boundary faces - * @param knods Spectral element control nodes - * @param mpi Pointer to MPI object - */ - boundaries(std::ifstream &stream, const int nspec, const int n_absorbing, - const int n_acoustic_surface, const int n_acforcing, - const Kokkos::View knods, - const specfem::MPI::MPI *mpi) - : absorbing_boundary(stream, n_absorbing, nspec, mpi), - forcing_boundary(stream, n_acoustic_surface, nspec, mpi), - acoustic_free_surface(stream, n_acforcing, knods, mpi){}; ///@} }; } // namespace mesh diff --git a/include/mesh/coupled_interfaces/coupled_interfaces.hpp b/include/mesh/coupled_interfaces/coupled_interfaces.hpp index 38648ecf..0bb3eaac 100644 --- a/include/mesh/coupled_interfaces/coupled_interfaces.hpp +++ b/include/mesh/coupled_interfaces/coupled_interfaces.hpp @@ -25,25 +25,23 @@ struct coupled_interfaces { */ coupled_interfaces() : elastic_acoustic(), acoustic_poroelastic(), elastic_poroelastic(){}; - /** - * @brief Constructor to read and assign values from fortran binary database - * file - * - * @param stream Stream object for fortran binary file buffered to coupled - * interfaces section - * @param num_interfaces_elastic_acoustic Number of elastic-acoustic - * interfaces - * @param num_interfaces_acoustic_poroelastic Number of acoustic-poroelastic - * interfaces - * @param num_interfaces_elastic_poroelastic Number of elastic-poroelastic - * interfaces - * @param mpi Pointer to MPI object - */ - coupled_interfaces(std::ifstream &stream, - const int num_interfaces_elastic_acoustic, - const int num_interfaces_acoustic_poroelastic, - const int num_interfaces_elastic_poroelastic, - const specfem::MPI::MPI *mpi); + + coupled_interfaces( + specfem::mesh::interface_container< + specfem::element::medium_tag::elastic, + specfem::element::medium_tag::acoustic + > elastic_acoustic, + specfem::mesh::interface_container< + specfem::element::medium_tag::acoustic, + specfem::element::medium_tag::poroelastic + > acoustic_poroelastic, + specfem::mesh::interface_container< + specfem::element::medium_tag::elastic, + specfem::element::medium_tag::poroelastic + > elastic_poroelastic){} : + elastic_acoustic(elastic_acoustic) + acoustic_poroelastic(acoustic_poroelastic) + elastic_poroelastic(elastic_poroelastic); ///@} /** diff --git a/include/mesh/coupled_interfaces/interface_container.hpp b/include/mesh/coupled_interfaces/interface_container.hpp index c43093d6..9ee1c1f1 100644 --- a/include/mesh/coupled_interfaces/interface_container.hpp +++ b/include/mesh/coupled_interfaces/interface_container.hpp @@ -29,17 +29,8 @@ struct interface_container { */ interface_container(){}; - /** - * @brief Constructor to read and assign values from fortran binary database - * file - * - * @param num_interfaces Number of interfaces - * @param stream Stream object for fortran binary file buffered to coupled - * interfaces section - * @param mpi Pointer to MPI object - */ - interface_container(const int num_interfaces, std::ifstream &stream, - const specfem::MPI::MPI *mpi); + interface_container(const int num_interfaces) {}; + ///@} int num_interfaces = 0; ///< Number of edges within this interface diff --git a/include/mesh/coupled_interfaces/interface_container.tpp b/include/mesh/coupled_interfaces/interface_container.tpp index c46d773f..3b9215bc 100644 --- a/include/mesh/coupled_interfaces/interface_container.tpp +++ b/include/mesh/coupled_interfaces/interface_container.tpp @@ -9,25 +9,10 @@ template specfem::mesh::interface_container< - medium1, medium2>::interface_container(const int num_interfaces, - std::ifstream &stream, - const specfem::MPI::MPI *mpi) + medium1, medium2>::interface_container(const int num_interfaces) : num_interfaces(num_interfaces), medium1_index_mapping("medium1_index_mapping", num_interfaces), medium2_index_mapping("medium2_index_mapping", num_interfaces) { - - if (!num_interfaces) - return; - - int medium1_ispec_l, medium2_ispec_l; - - for (int i = 0; i < num_interfaces; i++) { - specfem::IO::fortran_read_line(stream, &medium2_ispec_l, - &medium1_ispec_l); - medium1_index_mapping(i) = medium1_ispec_l - 1; - medium2_index_mapping(i) = medium2_ispec_l - 1; - } - return; } diff --git a/include/mesh/elements/tangential_elements.hpp b/include/mesh/elements/tangential_elements.hpp index a3d5edc2..22c538df 100644 --- a/include/mesh/elements/tangential_elements.hpp +++ b/include/mesh/elements/tangential_elements.hpp @@ -18,7 +18,12 @@ struct tangential_elements { specfem::kokkos::HostView1d x, y; tangential_elements(){}; tangential_elements(const int nnodes_tangential_curve); - tangential_elements(std::ifstream &stream, const int nnodes_tangential_curve); + + /** + * @brief Construct a new tangential elements object + * + */ + tangential_elements }; } // namespace elements } // namespace mesh diff --git a/include/mesh/mesh.hpp b/include/mesh/mesh.hpp index f849ca94..00d04b9c 100644 --- a/include/mesh/mesh.hpp +++ b/include/mesh/mesh.hpp @@ -58,13 +58,20 @@ struct mesh { */ mesh(){}; - /** - * @brief Construct mesh from a fortran binary database file - * - * @param filename Fortran binary database filename - * @param mpi pointer to MPI object to manage communication - */ - mesh(const std::string filename, const specfem::MPI::MPI *mpi); + mesh(const int npgeo, const int nspec, const int nproc, + const specfem::mesh::control_nodes &control_nodes, + const specfem::mesh::properties ¶meters, + const specfem::mesh::coupled_interfaces &coupled_interfaces, + const specfem::mesh::boundaries &boundaries, + const specfem::mesh::tags &tags, + const specfem::mesh::elements::tangential_elements &tangential_nodes, + const specfem::mesh::elements::axial_elements &axial_nodes, + const specfem::mesh::materials &materials) + : npgeo(npgeo), nspec(nspec), nproc(nproc), + control_nodes(control_nodes), parameters(parameters), + coupled_interfaces(coupled_interfaces), boundaries(boundaries), + tags(tags), tangential_nodes(tangential_nodes), + axial_nodes(axial_nodes), materials(materials){}; ///@} std::string print() const; diff --git a/include/mesh/properties/properties.hpp b/include/mesh/properties/properties.hpp index b5c63b3e..71921ecc 100644 --- a/include/mesh/properties/properties.hpp +++ b/include/mesh/properties/properties.hpp @@ -33,14 +33,41 @@ struct properties { * */ properties(){}; + /** - * Constructor to read and assign values from fortran binary database file + * @brief Construct a properties object * - * @param stream Stream object for fortran binary file buffered to properties - * section - * @param mpi Pointer to MPI object + * @param numat Total number of materials + * @param ngnod Total number of control nodes + * @param nspec Total number of spectral elements + * @param pointsdisp Total number of points to display + * @param nelemabs Number of elements on absorbing boundary + * @param nelem_acforcing Number of elements on acoustic forcing boundary + * @param nelem_acoustic_surface Number of elements on acoustic surface + * @param num_fluid_solid_edges Number of solid-fluid edges + * @param num_fluid_poro_edges Number of fluid-poroelastic edges + * @param num_solid_poro_edges Number of solid-poroelastic edges + * @param nnodes_tangential_curve Number of elements on tangential curve + * @param nelem_on_the_axis Number of axial elements + * @param plot_lowerleft_corner_only Flag to plot only lower left corner */ - properties(std::ifstream &stream, const specfem::MPI::MPI *mpi); + + properties(const int numat, const int ngnod, const int nspec, + const int pointsdisp, const int nelemabs, + const int nelem_acforcing, const int nelem_acoustic_surface, + const int num_fluid_solid_edges, const int num_fluid_poro_edges, + const int num_solid_poro_edges, const int nnodes_tangential_curve, + const int nelem_on_the_axis, const bool plot_lowerleft_corner_only) + : numat(numat), ngnod(ngnod), nspec(nspec), pointsdisp(pointsdisp), + nelemabs(nelemabs), nelem_acforcing(nelem_acforcing), + nelem_acoustic_surface(nelem_acoustic_surface), + num_fluid_solid_edges(num_fluid_solid_edges), + num_fluid_poro_edges(num_fluid_poro_edges), + num_solid_poro_edges(num_solid_poro_edges), + nnodes_tangential_curve(nnodes_tangential_curve), + nelem_on_the_axis(nelem_on_the_axis), + plot_lowerleft_corner_only(plot_lowerleft_corner_only){}; + }; } // namespace mesh } // namespace specfem diff --git a/src/IO/mesh/fortran/read_boundaries.cpp b/src/IO/mesh/fortran/read_boundaries.cpp new file mode 100644 index 00000000..df7254e6 --- /dev/null +++ b/src/IO/mesh/fortran/read_boundaries.cpp @@ -0,0 +1,234 @@ +#include "mesh/boundaries/boundaries.hpp" +#include "mesh/boundaries/absorbing_boundaries.hpp" +#include "mesh/boundaries/acoustic_free_surface.hpp" +#include "mesh/boundaries/forcing_boundaries.hpp" +#include "IO/mesh/fortran/read_boundaries.hpp" +#include "IO/fortranio/interface.hpp" +#include "specfem_mpi/interface.hpp" +#include "utilities/interface.hpp" +#include "utilities.cpp" +#include +#include + +namespace specfem { +namespace IO { +namespace mesh { +namespace fortran { + + specfem::mesh::absorbing_boundary + read_absorbing_boundaries( + std::ifstream &stream, int num_abs_boundary_faces, const int nspec, + const specfem::MPI::MPI *mpi) { + + // Create base instance of the absorbing boundary + specfem::mesh::absorbing_boundary absorbing_boundary(num_abs_boundary_faces); + + // I have to do this because std::vector is a fake container type that + // causes issues when getting a reference + bool codeabsread1 = true, codeabsread2 = true, codeabsread3 = true, + codeabsread4 = true; + std::vector iedgeread(8, 0); + int numabsread, typeabsread; + if (num_abs_boundary_faces < 0) { + mpi->cout("Warning: read in negative nelemabs resetting to 0!"); + num_abs_boundary_faces = 0; + } + + specfem::kokkos::HostView1d type_edge( + "specfem::mesh::absorbing_boundary::type_edge", num_abs_boundary_faces); + + specfem::kokkos::HostView1d ispec_edge( + "specfem::mesh::absorbing_boundary::ispec_edge", num_abs_boundary_faces); + + if (num_abs_boundary_faces > 0) { + for (int inum = 0; inum < num_abs_boundary_faces; inum++) { + specfem::IO::fortran_read_line(stream, &numabsread, &codeabsread1, + &codeabsread2, &codeabsread3, + &codeabsread4, &typeabsread, &iedgeread); + if (numabsread < 1 || numabsread > nspec) + throw std::runtime_error("Wrong absorbing element number"); + ispec_edge(inum) = numabsread - 1; + std::vector codeabsread = { codeabsread1, codeabsread2, + codeabsread3, codeabsread4 }; + if (std::count(codeabsread.begin(), codeabsread.end(), true) != 1) { + throw std::runtime_error("must have one and only one absorbing edge " + "per absorbing line cited"); + } + if (codeabsread1) + type_edge(inum) = specfem::enums::boundaries::type::BOTTOM; + + if (codeabsread2) + type_edge(inum) = specfem::enums::boundaries::type::RIGHT; + + if (codeabsread3) + type_edge(inum) = specfem::enums::boundaries::type::TOP; + + if (codeabsread4) + type_edge(inum) = specfem::enums::boundaries::type::LEFT; + } + + // Find corner elements + auto [ispec_corners, type_corners] = specfem::mesh::absorbing_boundaries::find_corners(ispec_edge, type_edge); + + const int nelements = ispec_corners.extent(0) + ispec_edge.extent(0); + + absorbing_boundary.nelements = nelements; + + absorbing_boundary.index_mapping = Kokkos::View( + "specfem::mesh::absorbing_boundary::index_mapping", nelements); + + absorbing_boundary.type = + Kokkos::View( + "specfem::mesh::absorbing_boundary::type", nelements); + // Populate ispec and type arrays + + for (int inum = 0; inum < ispec_edge.extent(0); inum++) { + absorbing_boundary.index_mapping(inum) = ispec_edge(inum); + absorbing_boundary.type(inum) = type_edge(inum); + } + + for (int inum = 0; inum < ispec_corners.extent(0); inum++) { + absorbing_boundary.index_mapping(inum + ispec_edge.extent(0)) = ispec_corners(inum); + absorbing_boundary.type(inum + ispec_edge.extent(0)) = type_corners(inum); + } + } else { + absorbing_boundary.nelements = 0; + } + + return absorbing_boundary; + } + + using view_type = + Kokkos::Subview, + std::remove_const_t, int>; + + /** + * @brief Get the type of boundary + * + * @param type int indicating if the boundary is edge of node + * @param e1 control node index for the starting node of the if the boundary is + * edge else control node index of the node if the boundary is node + * @param e2 control node index for the ending node of the if the boundary is + * edge + * @return specfem::enums::boundaries::type type of the boundary + */ + specfem::enums::boundaries::type + get_boundary_type(const int type, const int e1, const int e2, + const view_type &control_nodes) { + // if this is a node type + if (type == 1) { + if (e1 == control_nodes(0)) { + return specfem::enums::boundaries::type::BOTTOM_LEFT; + } else if (e1 == control_nodes(1)) { + return specfem::enums::boundaries::type::BOTTOM_RIGHT; + } else if (e1 == control_nodes(2)) { + return specfem::enums::boundaries::type::TOP_RIGHT; + } else if (e1 == control_nodes(3)) { + return specfem::enums::boundaries::type::TOP_LEFT; + } else { + throw std::invalid_argument( + "Error: Could not generate type of acoustic free surface boundary"); + } + } else { + if ((e1 == control_nodes(0) && e2 == control_nodes(1)) || + (e1 == control_nodes(1) && e2 == control_nodes(0))) { + return specfem::enums::boundaries::type::BOTTOM; + } else if ((e1 == control_nodes(0) && e2 == control_nodes(3)) || + (e1 == control_nodes(3) && e2 == control_nodes(0))) { + return specfem::enums::boundaries::type::LEFT; + } else if ((e1 == control_nodes(1) && e2 == control_nodes(2)) || + (e1 == control_nodes(2) && e2 == control_nodes(1))) { + return specfem::enums::boundaries::type::RIGHT; + } else if ((e1 == control_nodes(2) && e2 == control_nodes(3)) || + (e1 == control_nodes(3) && e2 == control_nodes(2))) { + return specfem::enums::boundaries::type::TOP; + } else { + throw std::invalid_argument( + "Error: Could not generate type of acoustic free surface boundary"); + } + } + } + + specfem::mesh::acoustic_free_surface + read_acoustic_free_surface(std::ifstream &stream, + const int &nelem_acoustic_surface, + const Kokkos::View knods, + const specfem::MPI::MPI *mpi) { + + std::vector acfree_edge(4, 0); + specfem::mesh::acoustic_free_surface acoustic_free_surface(nelem_acoustic_surface); + + if (nelem_acoustic_surface > 0) { + for (int inum = 0; inum < nelem_acoustic_surface; inum++) { + specfem::IO::fortran_read_line(stream, &acfree_edge); + acoustic_free_surface.index_mapping(inum) = acfree_edge[0] - 1; + const auto control_nodes = + Kokkos::subview(knods, Kokkos::ALL, acoustic_free_surface.index_mapping(inum)); + acoustic_free_surface.type(inum) = get_boundary_type(acfree_edge[1], acfree_edge[2] - 1, + acfree_edge[3] - 1, control_nodes); + } + } + + mpi->sync_all(); + + return acoustic_free_surface; + } + + + specfem::mesh::forcing_boundary read_forcing_boundaries( + std::ifstream &stream, const int nelement_acforcing, const int nspec, + const specfem::MPI::MPI *mpi) { + + bool codeacread1 = true, codeacread2 = true, + codeacread3 = true, codeacread4 = true; + std::vector iedgeread(8, 0); + int numacread, typeacread; + + specfem::mesh::forcing_boundary forcing_boundary(nelement_acforcing); + + if (nelement_acforcing > 0) { + for (int inum = 0; inum < nelement_acforcing; inum++) { + specfem::IO::fortran_read_line(stream, &numacread, &codeacread1, + &codeacread2, &codeacread3, &codeacread4, + &typeacread, &iedgeread); + std::vector codeacread(4, false); + if (numacread < 1 || numacread > nspec) { + std::runtime_error("Wrong absorbing element number"); + } + forcing_boundary.numacforcing(inum) = numacread - 1; + forcing_boundary.typeacforcing(inum) = typeacread; + codeacread[0] = codeacread1; + codeacread[1] = codeacread2; + codeacread[2] = codeacread3; + codeacread[3] = codeacread4; + if (std::count(codeacread.begin(), codeacread.end(), true) != 1) { + throw std::runtime_error("must have one and only one acoustic forcing " + "per acoustic forcing line cited"); + } + forcing_boundary.codeacforcing(inum, 0) = codeacread[0]; + forcing_boundary.codeacforcing(inum, 1) = codeacread[1]; + forcing_boundary.codeacforcing(inum, 2) = codeacread[2]; + forcing_boundary.codeacforcing(inum, 3) = codeacread[3]; + forcing_boundary.ibegin_edge1(inum) = iedgeread[0]; + forcing_boundary.iend_edge1(inum) = iedgeread[1]; + forcing_boundary.ibegin_edge2(inum) = iedgeread[2]; + forcing_boundary.iend_edge2(inum) = iedgeread[3]; + forcing_boundary.ibegin_edge3(inum) = iedgeread[4]; + forcing_boundary.iend_edge3(inum) = iedgeread[5]; + forcing_boundary.ibegin_edge4(inum) = iedgeread[6]; + forcing_boundary.iend_edge4(inum) = iedgeread[7]; + } + } + + // populate ib_bottom, ib_top, ib_left, ib_right arrays + calculate_ib(forcing_boundary.codeacforcing,forcing_boundary.ib_bottom, + forcing_boundary.ib_top, forcing_boundary.ib_left, + forcing_boundary.ib_right, nelement_acforcing); + + return forcing_boundary; + } + +} // namespace fortran +} // namespace mesh +} // namespace IO +} // namespace specfem \ No newline at end of file diff --git a/src/IO/mesh/fortran/read_interfaces.cpp b/src/IO/mesh/fortran/read_interfaces.cpp new file mode 100644 index 00000000..b1a3bb8b --- /dev/null +++ b/src/IO/mesh/fortran/read_interfaces.cpp @@ -0,0 +1,68 @@ +#include "IO/mesh/fortran/read_interfaces.hpp" +#include "interface_container.hpp" +#include "specfem_mpi/interface.hpp" + +namespace specfem { +namespace IO { +namespace mesh { +namespace fortran { + + template + specfem::mesh::interface_container + read_interface( + const int num_interfaces, std::ifstream &stream, + const specfem::MPI::MPI *mpi) { + + if (!num_interfaces) + return; + + int medium1_ispec_l, medium2_ispec_l; + + specfem::mesh::interface_container interface(num_interfaces); + interface.medium1_index_mapping("medium1_index_mapping", num_interfaces); + interface.medium2_index_mapping("medium2_index_mapping", num_interfaces); + + for (int i = 0; i < num_interfaces; i++) { + specfem::IO::fortran_read_line(stream, &medium2_ispec_l, + &medium1_ispec_l); + interface.medium1_index_mapping(i) = medium1_ispec_l - 1; + interface.medium2_index_mapping(i) = medium2_ispec_l - 1; + } + + return interface; + } + + specfem::mesh::coupled_interfaces + read_coupled_interfaces ( + std::ifstream &stream, const int num_interfaces_elastic_acoustic, + const int num_interfaces_acoustic_poroelastic, + const int num_interfaces_elastic_poroelastic, const specfem::MPI::MPI *mpi) { + + auto elastic_acoustic = + read_interface< + specfem::element::medium_tag::elastic, + specfem::element::medium_tag::acoustic + >(num_interfaces_elastic_acoustic, stream, mpi); + + auto acoustic_poroelastic = + read_interface< + specfem::element::medium_tag::acoustic, + specfem::element::medium_tag::poroelastic + >(num_interfaces_acoustic_poroelastic, stream, mpi); + + auto elastic_poroelastic = + read_interface< + specfem::element::medium_tag::elastic, + specfem::element::medium_tag::poroelastic + >(num_interfaces_elastic_poroelastic, stream, mpi); + + return coupled_interfaces(elastic_acoustic, acoustic_poroelastic, elastic_poroelastic); + } + + + +} // namespace fortran +} // namespace mesh +} // namespace IO +} // namespace specfem \ No newline at end of file diff --git a/src/mesh/IO/fortran/read_material_properties.cpp b/src/IO/mesh/fortran/read_material_properties.cpp similarity index 92% rename from src/mesh/IO/fortran/read_material_properties.cpp rename to src/IO/mesh/fortran/read_material_properties.cpp index b5a94e58..5c24a0da 100644 --- a/src/mesh/IO/fortran/read_material_properties.cpp +++ b/src/IO/mesh/fortran/read_material_properties.cpp @@ -6,6 +6,12 @@ #include #include + +namespace specfem { +namespace IO { +namespace mesh { +namespace fortran { + struct input_holder { // Struct to hold temporary variables read from database file type_real val0, val1, val2, val3, val4, val5, val6, val7, val8, val9, val10, @@ -13,8 +19,8 @@ struct input_holder { int n, indic; }; -std::vector > -specfem::mesh::IO::fortran::read_material_properties( +std::vector> +read_material_properties( std::ifstream &stream, const int numat, const specfem::MPI::MPI *mpi) { input_holder read_values; @@ -80,3 +86,8 @@ specfem::mesh::IO::fortran::read_material_properties( return materials; } + +} // namespace fortran +} // namespace mesh +} // namespace IO +} // namespace specfem \ No newline at end of file diff --git a/src/mesh/IO/fortran/read_mesh_database.cpp b/src/IO/mesh/fortran/read_mesh_database.cpp similarity index 94% rename from src/mesh/IO/fortran/read_mesh_database.cpp rename to src/IO/mesh/fortran/read_mesh_database.cpp index 8341b7f2..51345fed 100644 --- a/src/mesh/IO/fortran/read_mesh_database.cpp +++ b/src/IO/mesh/fortran/read_mesh_database.cpp @@ -9,7 +9,12 @@ #include #include -std::tuple specfem::mesh::IO::fortran::read_mesh_database_header( +namespace specfem { +namespace IO { +namespace mesh { +namespace fortran { + +std::tuple read_mesh_database_header( std::ifstream &stream, const specfem::MPI::MPI *mpi) { // This subroutine reads header values of the database which are skipped std::string dummy_s; @@ -144,15 +149,15 @@ std::tuple specfem::mesh::IO::fortran::read_mesh_database_header( } specfem::kokkos::HostView2d -specfem::mesh::IO::fortran::read_coorg_elements(std::ifstream &stream, - const int npgeo, - const specfem::MPI::MPI *mpi) { +read_coorg_elements( + std::ifstream &stream, const int npgeo, + const specfem::MPI::MPI *mpi) { int ipoin = 0; type_real coorgi, coorgj; - specfem::kokkos::HostView2d coorg("specfem::mesh::coorg", ndim, - npgeo); + specfem::kokkos::HostView2d + coorg("specfem::mesh::coorg", ndim, npgeo); for (int i = 0; i < npgeo; i++) { specfem::IO::fortran_read_line(stream, &ipoin, &coorgi, &coorgj); @@ -169,7 +174,7 @@ specfem::mesh::IO::fortran::read_coorg_elements(std::ifstream &stream, } std::tuple -specfem::mesh::IO::fortran::read_mesh_database_attenuation( +read_mesh_database_attenuation( std::ifstream &stream, const specfem::MPI::MPI *mpi) { int n_sls; @@ -187,3 +192,8 @@ specfem::mesh::IO::fortran::read_mesh_database_attenuation( return std::make_tuple(n_sls, attenuation_f0_reference, read_velocities_at_f0); } + +} // namespace fortran +} // namespace mesh +} // namespace IO +} // namespace specfem \ No newline at end of file diff --git a/src/IO/mesh/fortran/read_properties.cpp b/src/IO/mesh/fortran/read_properties.cpp new file mode 100644 index 00000000..04980b0d --- /dev/null +++ b/src/IO/mesh/fortran/read_properties.cpp @@ -0,0 +1,62 @@ +#include "mesh/properties/properties.hpp" +#include "IO/fortranio/interface.hpp" + +namespace specfem { +namespace IO { +namespace mesh { +namespace fortran { + +specfem::mesh::properties read_roperties(std::ifstream &stream, + const specfem::MPI::MPI *mpi) { + // --------------------------------------------------------------------- + // reading mesh properties + + int numat; ///< Total number of different materials + int ngnod; ///< Number of control nodes + int nspec; ///< Number of spectral elements + int pointsdisp; // Total number of points to display (Only used for + // visualization) + int nelemabs; ///< Number of elements on absorbing boundary + int nelem_acforcing; ///< Number of elements on acoustic forcing boundary + int nelem_acoustic_surface; ///< Number of elements on acoustic surface + int num_fluid_solid_edges; ///< Number of solid-fluid edges + int num_fluid_poro_edges; ///< Number of fluid-poroelastic edges + int num_solid_poro_edges; ///< Number of solid-poroelastic edges + int nnodes_tangential_curve; ///< Number of elements on tangential curve + int nelem_on_the_axis; ///< Number of axial elements + bool plot_lowerleft_corner_only; + + specfem::IO::fortran_read_line(stream, numat, ngnod, nspec, pointsdisp, + plot_lowerleft_corner_only); + + // --------------------------------------------------------------------- + if (ngnod != 9) { + std::ostringstream error_message; + error_message << "Number of control nodes per element must be 9, but is " + << ngnod << "\n" + << "Currently, there is a bug when NGNOD == 4 \n"; + throw std::runtime_error(error_message.str()); + } + + specfem::IO::fortran_read_line( + stream, nelemabs, nelem_acforcing, + nelem_acoustic_surface, num_fluid_solid_edges, + num_fluid_poro_edges, num_solid_poro_edges, + nnodes_tangential_curve, nelem_on_the_axis); + // ---------------------------------------------------------------------- + + mpi->sync_all(); + + return specfem::mesh::properties( + numat, ngnod, nspec, pointsdisp, nelemabs, + nelem_acforcing, nelem_acoustic_surface, + num_fluid_solid_edges, num_fluid_poro_edges, + num_solid_poro_edges, nnodes_tangential_curve, + nelem_on_the_axis, plot_lowerleft_corner_only); + +} + +} // namespace fortran +} // namespace mesh +} // namespace IO +} // namespace specfem \ No newline at end of file diff --git a/src/IO/mesh/read_mesh.cpp b/src/IO/mesh/read_mesh.cpp new file mode 100644 index 00000000..7612bb5e --- /dev/null +++ b/src/IO/mesh/read_mesh.cpp @@ -0,0 +1,233 @@ +#include "mesh/mesh.hpp" +#include "IO/fortranio/interface.hpp" +#include "enumerations/specfem_enums.hpp" +#include "kokkos_abstractions.h" +#include "material/material.hpp" +#include "mesh/IO/fortran/read_mesh_database.hpp" +#include "specfem_mpi/interface.hpp" +#include "specfem_setup.hpp" +#include +#include +#include +#include +#include + +namespace specfem { +namespace IO { + +specfem::mesh::mesh read_mesh(const std::string filename, + const specfem::MPI::MPI *mpi) { + + std::ifstream stream; + stream.open(filename); + + if (!stream.is_open()) { + throw std::runtime_error("Could not open database file"); + } + + try { + auto [nspec, npgeo, nproc] = + specfem::mesh::IO::fortran::read_mesh_database_header(stream, mpi); + } catch (std::runtime_error &e) { + throw; + } + + // Mesh class to be populated from the database file. + specfem::mesh::mesh mesh(); + + try { + auto mesh->control_nodes.coord = specfem::mesh::IO::fortran::read_coorg_elements( + stream, npgeo, mpi); + } catch (std::runtime_error &e) { + throw; + } + + try { + mesh->parameters = specfem::IO::mesh::fortran::read_properties(stream, mpi); + } catch (std::runtime_error &e) { + throw; + } + + mesh->control_nodes.ngnod = mesh->parameters.ngnod; + mesh->control_nodes.nspec = mesh->nspec; + mesh->control_nodes.knods = specfem::kokkos::HostView2d( + "specfem::mesh::knods", mesh->parameters.ngnod, mesh->nspec); + + + int nspec_all = mpi->reduce(mesh->parameters.nspec, specfem::MPI::sum); + int nelem_acforcing_all = + mpi->reduce(mesh->parameters.nelem_acforcing, specfem::MPI::sum); + int nelem_acoustic_surface_all = + mpi->reduce(mesh->parameters.nelem_acoustic_surface, specfem::MPI::sum); + + try { + auto [n_sls, attenuation_f0_reference, read_velocities_at_f0] = + specfem::IO::mesh::fortran::read_mesh_database_attenuation(stream, mpi); + } catch (std::runtime_error &e) { + throw; + } + + try { + auto materials = + specfem::IO::mesh::fortran::read_material_properties( + stream, mesh->parameters.numat, mesh->nspec, + mesh->control_nodes.knods, mpi); + } catch (std::runtime_error &e) { + throw; + } + + // try { + // materials = specfem::mesh::IO::fortran::read_material_properties( + // stream, this->parameters.numat, mpi); + // } catch (std::runtime_error &e) { + // throw; + // } + + // try { + // this->material_ind = specfem::mesh::material_ind( + // stream, this->parameters.ngnod, this->nspec, this->parameters.numat, + // this->control_nodes.knods, mpi); + // } catch (std::runtime_error &e) { + // throw; + // } + + // try { + // this->interface = specfem::mesh::interfaces::interface(stream, mpi); + // } catch (std::runtime_error &e) { + // throw; + // } + + int ninterfaces; + int max_interface_size; + + specfem::IO::fortran_read_line(stream, &ninterfaces, &max_interface_size); + + try { + mesh->boundaries = specfem::IO::mesh::fortran::read_boundaries( + stream, mesh->parameters.nspec, mesh->parameters.nelemabs, + mesh->parameters.nelem_acforcing, + mesh->parameters.nelem_acoustic_surface, mesh->control_nodes.knods, + mpi); + } catch (std::runtime_error &e) { + throw; + } + + // try { + // this->boundaries.absorbing_boundary = specfem::mesh::absorbing_boundary( + // stream, this->parameters.nelemabs, this->parameters.nspec, mpi); + // } catch (std::runtime_error &e) { + // throw; + // } + + // try { + // this->boundaries.forcing_boundary = specfem::mesh::forcing_boundary( + // stream, this->parameters.nelem_acforcing, this->parameters.nspec, + // mpi); + // } catch (std::runtime_error &e) { + // throw; + // } + + // try { + // this->boundaries.acoustic_free_surface = + // specfem::mesh::acoustic_free_surface( + // stream, this->parameters.nelem_acoustic_surface, + // this->control_nodes.knods, mpi); + // } catch (std::runtime_error &e) { + // throw; + // } + + try { + mesh->coupled_interfaces = specfem::IO::mesh::fortran::read_coupled_interfaces( + stream, mesh->parameters.num_fluid_solid_edges, + mesh->parameters.num_fluid_poro_edges, + mesh->parameters.num_solid_poro_edges, mpi); + } catch (std::runtime_error &e) { + throw; + } + + try { + this->tangential_nodes = specfem::mesh::elements::tangential_elements( + stream, this->parameters.nnodes_tangential_curve); + } catch (std::runtime_error &e) { + throw; + } + + try { + this->axial_nodes = specfem::mesh::elements::axial_elements( + stream, this->parameters.nelem_on_the_axis, this->nspec, mpi); + } catch (std::runtime_error &e) { + throw; + } + + // Check if database file was read completely + if (stream.get() && !stream.eof()) { + throw std::runtime_error("The Database file wasn't fully read. Is there " + "anything written after axial elements?"); + } + + stream.close(); + + // Print material properties + + mpi->cout("Material systems:\n" + "------------------------------"); + + mpi->cout("Number of material systems = " + + std::to_string(this->materials.n_materials) + "\n\n"); + + const auto l_elastic_isotropic = + this->materials.elastic_isotropic.material_properties; + const auto l_acoustic_isotropic = + this->materials.acoustic_isotropic.material_properties; + + for (const auto material : l_elastic_isotropic) { + mpi->cout(material.print()); + } + + for (const auto material : l_acoustic_isotropic) { + mpi->cout(material.print()); + } + + assert(l_elastic_isotropic.size() + l_acoustic_isotropic.size() == + this->materials.n_materials); + + this->tags = specfem::mesh::tags(this->materials, this->boundaries); + + return; +} + +std::string specfem::mesh::mesh::print() const { + + int n_elastic; + int n_acoustic; + + Kokkos::parallel_reduce( + "specfem::mesh::mesh::print", specfem::kokkos::HostRange(0, this->nspec), + KOKKOS_CLASS_LAMBDA(const int ispec, int &n_elastic, int &n_acoustic) { + if (this->materials.material_index_mapping(ispec).type == + specfem::element::medium_tag::elastic) { + n_elastic++; + } else if (this->materials.material_index_mapping(ispec).type == + specfem::element::medium_tag::acoustic) { + n_acoustic++; + } + }, + n_elastic, n_acoustic); + + std::ostringstream message; + + message + << "Spectral element information:\n" + << "------------------------------\n" + << "Total number of spectral elements : " << this->nspec << "\n" + << "Total number of spectral elements assigned to elastic material : " + << n_elastic << "\n" + << "Total number of spectral elements assigned to acoustic material : " + << n_acoustic << "\n" + << "Total number of geometric points : " << this->npgeo << "\n"; + + return message.str(); +} + +} // namespace IO +} // namespace specfem \ No newline at end of file diff --git a/src/mesh/boundaries/absorbing_boundaries.cpp b/src/mesh/boundaries/absorbing_boundaries.cpp index 00f3859d..b5299321 100644 --- a/src/mesh/boundaries/absorbing_boundaries.cpp +++ b/src/mesh/boundaries/absorbing_boundaries.cpp @@ -118,82 +118,3 @@ find_corners(const specfem::kokkos::HostView1d ispec_edge, return std::make_tuple(ispec_corners, type_corners); } - -specfem::mesh::absorbing_boundary::absorbing_boundary( - std::ifstream &stream, int num_abs_boundary_faces, const int nspec, - const specfem::MPI::MPI *mpi) { - - // I have to do this because std::vector is a fake container type that - // causes issues when getting a reference - bool codeabsread1 = true, codeabsread2 = true, codeabsread3 = true, - codeabsread4 = true; - std::vector iedgeread(8, 0); - int numabsread, typeabsread; - if (num_abs_boundary_faces < 0) { - mpi->cout("Warning: read in negative nelemabs resetting to 0!"); - num_abs_boundary_faces = 0; - } - - specfem::kokkos::HostView1d type_edge( - "specfem::mesh::absorbing_boundary::type_edge", num_abs_boundary_faces); - - specfem::kokkos::HostView1d ispec_edge( - "specfem::mesh::absorbing_boundary::ispec_edge", num_abs_boundary_faces); - - if (num_abs_boundary_faces > 0) { - for (int inum = 0; inum < num_abs_boundary_faces; inum++) { - specfem::IO::fortran_read_line(stream, &numabsread, &codeabsread1, - &codeabsread2, &codeabsread3, - &codeabsread4, &typeabsread, &iedgeread); - if (numabsread < 1 || numabsread > nspec) - throw std::runtime_error("Wrong absorbing element number"); - ispec_edge(inum) = numabsread - 1; - std::vector codeabsread = { codeabsread1, codeabsread2, - codeabsread3, codeabsread4 }; - if (std::count(codeabsread.begin(), codeabsread.end(), true) != 1) { - throw std::runtime_error("must have one and only one absorbing edge " - "per absorbing line cited"); - } - if (codeabsread1) - type_edge(inum) = specfem::enums::boundaries::type::BOTTOM; - - if (codeabsread2) - type_edge(inum) = specfem::enums::boundaries::type::RIGHT; - - if (codeabsread3) - type_edge(inum) = specfem::enums::boundaries::type::TOP; - - if (codeabsread4) - type_edge(inum) = specfem::enums::boundaries::type::LEFT; - } - - // Find corner elements - auto [ispec_corners, type_corners] = find_corners(ispec_edge, type_edge); - - const int nelements = ispec_corners.extent(0) + ispec_edge.extent(0); - - this->nelements = nelements; - - this->index_mapping = Kokkos::View( - "specfem::mesh::absorbing_boundary::index_mapping", nelements); - - this->type = - Kokkos::View( - "specfem::mesh::absorbing_boundary::type", nelements); - // Populate ispec and type arrays - - for (int inum = 0; inum < ispec_edge.extent(0); inum++) { - this->index_mapping(inum) = ispec_edge(inum); - this->type(inum) = type_edge(inum); - } - - for (int inum = 0; inum < ispec_corners.extent(0); inum++) { - this->index_mapping(inum + ispec_edge.extent(0)) = ispec_corners(inum); - this->type(inum + ispec_edge.extent(0)) = type_corners(inum); - } - } else { - this->nelements = 0; - } - - return; -} diff --git a/src/mesh/boundaries/acoustic_free_surface.cpp b/src/mesh/boundaries/acoustic_free_surface.cpp index c2a80e22..161029b3 100644 --- a/src/mesh/boundaries/acoustic_free_surface.cpp +++ b/src/mesh/boundaries/acoustic_free_surface.cpp @@ -3,58 +3,6 @@ #include "specfem_mpi/interface.hpp" #include -using view_type = - Kokkos::Subview, - std::remove_const_t, int>; - -/** - * @brief Get the type of boundary - * - * @param type int indicating if the boundary is edge of node - * @param e1 control node index for the starting node of the if the boundary is - * edge else control node index of the node if the boundary is node - * @param e2 control node index for the ending node of the if the boundary is - * edge - * @return specfem::enums::boundaries::type type of the boundary - */ -specfem::enums::boundaries::type -get_boundary_type(const int type, const int e1, const int e2, - const view_type &control_nodes) { - - // if this is a node type - if (type == 1) { - if (e1 == control_nodes(0)) { - return specfem::enums::boundaries::type::BOTTOM_LEFT; - } else if (e1 == control_nodes(1)) { - return specfem::enums::boundaries::type::BOTTOM_RIGHT; - } else if (e1 == control_nodes(2)) { - return specfem::enums::boundaries::type::TOP_RIGHT; - } else if (e1 == control_nodes(3)) { - return specfem::enums::boundaries::type::TOP_LEFT; - } else { - throw std::invalid_argument( - "Error: Could not generate type of acoustic free surface boundary"); - } - } else { - if ((e1 == control_nodes(0) && e2 == control_nodes(1)) || - (e1 == control_nodes(1) && e2 == control_nodes(0))) { - return specfem::enums::boundaries::type::BOTTOM; - } else if ((e1 == control_nodes(0) && e2 == control_nodes(3)) || - (e1 == control_nodes(3) && e2 == control_nodes(0))) { - return specfem::enums::boundaries::type::LEFT; - } else if ((e1 == control_nodes(1) && e2 == control_nodes(2)) || - (e1 == control_nodes(2) && e2 == control_nodes(1))) { - return specfem::enums::boundaries::type::RIGHT; - } else if ((e1 == control_nodes(2) && e2 == control_nodes(3)) || - (e1 == control_nodes(3) && e2 == control_nodes(2))) { - return specfem::enums::boundaries::type::TOP; - } else { - throw std::invalid_argument( - "Error: Could not generate type of acoustic free surface boundary"); - } - } -} - specfem::mesh::acoustic_free_surface::acoustic_free_surface( const int nelem_acoustic_surface) : nelem_acoustic_surface(nelem_acoustic_surface) { @@ -70,25 +18,3 @@ specfem::mesh::acoustic_free_surface::acoustic_free_surface( return; } -specfem::mesh::acoustic_free_surface::acoustic_free_surface( - std::ifstream &stream, const int &nelem_acoustic_surface, - const Kokkos::View knods, - const specfem::MPI::MPI *mpi) { - - std::vector acfree_edge(4, 0); - *this = specfem::mesh::acoustic_free_surface(nelem_acoustic_surface); - - if (nelem_acoustic_surface > 0) { - for (int inum = 0; inum < nelem_acoustic_surface; inum++) { - specfem::IO::fortran_read_line(stream, &acfree_edge); - this->index_mapping(inum) = acfree_edge[0] - 1; - const auto control_nodes = - Kokkos::subview(knods, Kokkos::ALL, this->index_mapping(inum)); - this->type(inum) = get_boundary_type(acfree_edge[1], acfree_edge[2] - 1, - acfree_edge[3] - 1, control_nodes); - } - } - - mpi->sync_all(); - return; -} diff --git a/src/mesh/boundaries/forcing_boundaries.cpp b/src/mesh/boundaries/forcing_boundaries.cpp index 8aab89cb..1d176aad 100644 --- a/src/mesh/boundaries/forcing_boundaries.cpp +++ b/src/mesh/boundaries/forcing_boundaries.cpp @@ -7,6 +7,7 @@ specfem::mesh::forcing_boundary::forcing_boundary( const int nelement_acforcing) { + if (nelement_acforcing > 0) { this->numacforcing = specfem::kokkos::HostView1d( "specfem::mesh::forcing_boundary::numacforcing", nelement_acforcing); @@ -111,53 +112,3 @@ specfem::mesh::forcing_boundary::forcing_boundary( return; } -specfem::mesh::forcing_boundary::forcing_boundary( - std::ifstream &stream, const int nelement_acforcing, const int nspec, - const specfem::MPI::MPI *mpi) { - bool codeacread1 = true, codeacread2 = true, codeacread3 = true, - codeacread4 = true; - std::vector iedgeread(8, 0); - int numacread, typeacread; - - *this = specfem::mesh::forcing_boundary(nelement_acforcing); - - if (nelement_acforcing > 0) { - for (int inum = 0; inum < nelement_acforcing; inum++) { - specfem::IO::fortran_read_line(stream, &numacread, &codeacread1, - &codeacread2, &codeacread3, &codeacread4, - &typeacread, &iedgeread); - std::vector codeacread(4, false); - if (numacread < 1 || numacread > nspec) { - std::runtime_error("Wrong absorbing element number"); - } - this->numacforcing(inum) = numacread - 1; - this->typeacforcing(inum) = typeacread; - codeacread[0] = codeacread1; - codeacread[1] = codeacread2; - codeacread[2] = codeacread3; - codeacread[3] = codeacread4; - if (std::count(codeacread.begin(), codeacread.end(), true) != 1) { - throw std::runtime_error("must have one and only one acoustic forcing " - "per acoustic forcing line cited"); - } - this->codeacforcing(inum, 0) = codeacread[0]; - this->codeacforcing(inum, 1) = codeacread[1]; - this->codeacforcing(inum, 2) = codeacread[2]; - this->codeacforcing(inum, 3) = codeacread[3]; - this->ibegin_edge1(inum) = iedgeread[0]; - this->iend_edge1(inum) = iedgeread[1]; - this->ibegin_edge2(inum) = iedgeread[2]; - this->iend_edge2(inum) = iedgeread[3]; - this->ibegin_edge3(inum) = iedgeread[4]; - this->iend_edge3(inum) = iedgeread[5]; - this->ibegin_edge4(inum) = iedgeread[6]; - this->iend_edge4(inum) = iedgeread[7]; - } - } - - // populate ib_bottom, ib_top, ib_left, ib_right arrays - calculate_ib(this->codeacforcing, this->ib_bottom, this->ib_top, - this->ib_left, this->ib_right, nelement_acforcing); - - return; -} diff --git a/src/mesh/coupled_interfaces/coupled_interfaces.cpp b/src/mesh/coupled_interfaces/coupled_interfaces.cpp index 1fd873a7..bfaaa512 100644 --- a/src/mesh/coupled_interfaces/coupled_interfaces.cpp +++ b/src/mesh/coupled_interfaces/coupled_interfaces.cpp @@ -2,15 +2,20 @@ #include "mesh/coupled_interfaces/interface_container.hpp" #include "mesh/coupled_interfaces/interface_container.tpp" -specfem::mesh::coupled_interfaces::coupled_interfaces::coupled_interfaces( - std::ifstream &stream, const int num_interfaces_elastic_acoustic, - const int num_interfaces_acoustic_poroelastic, - const int num_interfaces_elastic_poroelastic, const specfem::MPI::MPI *mpi) - : elastic_acoustic(num_interfaces_elastic_acoustic, stream, mpi), - acoustic_poroelastic(num_interfaces_acoustic_poroelastic, stream, mpi), - elastic_poroelastic(num_interfaces_elastic_poroelastic, stream, mpi) { - return; -} + + +specfem::mesh::coupled_interfaces coupled_interfaces( + specfem::mesh::interface_container< + specfem::element::medium_tag::elastic, + specfem::element::medium_tag::acoustic> elastic_acoustic, + specfem::mesh::interface_container< + specfem::element::medium_tag::acoustic, + specfem::element::medium_tag::poroelastic> acoustic_poroelastic, + specfem::mesh::interface_container< + specfem::element::medium_tag::elastic, + specfem::element::medium_tag::poroelastic> elastic_poroelastic) { + + } template diff --git a/src/mesh/properties/properties.cpp b/src/mesh/properties/properties.cpp deleted file mode 100644 index 6fba389c..00000000 --- a/src/mesh/properties/properties.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "mesh/properties/properties.hpp" -#include "IO/fortranio/interface.hpp" - -specfem::mesh::properties::properties(std::ifstream &stream, - const specfem::MPI::MPI *mpi) { - // --------------------------------------------------------------------- - // reading mesh properties - - specfem::IO::fortran_read_line(stream, &this->numat, &this->ngnod, - &this->nspec, &this->pointsdisp, - &this->plot_lowerleft_corner_only); - - // --------------------------------------------------------------------- - if (this->ngnod != 9) { - std::ostringstream error_message; - error_message << "Number of control nodes per element must be 9, but is " - << this->ngnod << "\n" - << "Currently, there is a bug when NGNOD == 4 \n"; - throw std::runtime_error(error_message.str()); - } - - specfem::IO::fortran_read_line( - stream, &this->nelemabs, &this->nelem_acforcing, - &this->nelem_acoustic_surface, &this->num_fluid_solid_edges, - &this->num_fluid_poro_edges, &this->num_solid_poro_edges, - &this->nnodes_tangential_curve, &this->nelem_on_the_axis); - // ---------------------------------------------------------------------- - - mpi->sync_all(); -} From 1eafc93ea2a6c33a365e8753214dd2edb4c03822 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Thu, 10 Oct 2024 10:59:08 -0400 Subject: [PATCH 03/53] First potential full reader --- include/IO/mesh/fortran/read_elements.hpp | 41 ++ include/IO/mesh/fortran/read_interface.hpp | 42 -- include/IO/mesh/fortran/read_interfaces.hpp | 28 + src/IO/mesh/fortran/read_boundaries.cpp | 498 +++++++++++------- src/IO/mesh/fortran/read_elements.cpp | 50 ++ src/IO/mesh/fortran/read_interfaces.cpp | 6 +- .../mesh/fortran/read_material_properties.cpp | 16 +- src/IO/mesh/fortran/read_mesh_database.cpp | 12 +- src/IO/mesh/fortran/read_properties.cpp | 12 +- src/IO/mesh/read_mesh.cpp | 24 +- src/mesh/boundaries/absorbing_boundaries.cpp | 98 ---- src/mesh/boundaries/utilities.cpp | 77 --- src/mesh/elements/axial_elements.cpp | 16 - src/mesh/elements/tangential_elements.cpp | 23 - 14 files changed, 447 insertions(+), 496 deletions(-) create mode 100644 include/IO/mesh/fortran/read_elements.hpp delete mode 100644 include/IO/mesh/fortran/read_interface.hpp create mode 100644 include/IO/mesh/fortran/read_interfaces.hpp create mode 100644 src/IO/mesh/fortran/read_elements.cpp delete mode 100644 src/mesh/boundaries/utilities.cpp diff --git a/include/IO/mesh/fortran/read_elements.hpp b/include/IO/mesh/fortran/read_elements.hpp new file mode 100644 index 00000000..3acf33db --- /dev/null +++ b/include/IO/mesh/fortran/read_elements.hpp @@ -0,0 +1,41 @@ +#pragma once +#include "mesh/elements/tangential_elements.hpp" +#include "mesh/elements/axial_elements.hpp" +#include "specfem_mpi/interface.hpp" + + +namespace specfem { +namespace IO { +namespace mesh { +namespace fortran { + +/** + * @brief Read tangential elements from mesh database + * + * @param stream Input stream + * @param nnodes_tangential_curve Number of nodes on the tangential curve + * @return specfem::mesh::elements::tangential_elements + * + */ +specfem::mesh::elements::tangential_elements read_tangential_elements( + std::ifstream &stream, const int nnodes_tangential_curve) {}; + + +/** + * @brief Read axial elements from mesh database + * + * @param stream Input stream + * @param nelem_on_the_axis Number of elements on the axis + * @param nspec Number of spectral elements + * @param mpi MPI object + * @return specfem::mesh::elements::axial_elements + * + */ +specfem::mesh::elements::axial_elements read_axial_elements( + std::ifstream &stream, const int nelem_on_the_axis, const int nspec, + const specfem::MPI::MPI *mpi) {}; + +} // namespace fortran +} // namespace mesh +} // namespace IO +} // namespace specfem diff --git a/include/IO/mesh/fortran/read_interface.hpp b/include/IO/mesh/fortran/read_interface.hpp deleted file mode 100644 index bc9e0acb..00000000 --- a/include/IO/mesh/fortran/read_interface.hpp +++ /dev/null @@ -1,42 +0,0 @@ - -#include "interface_container.hpp" -#include "specfem_mpi/interface.hpp" - -namespace specfem { -namespace IO { -namespace mesh { -namespace fortran { - -template -specfem::mesh::interface_container -read_interface( - const int num_interfaces, std::ifstream &stream, - const specfem::MPI::MPI *mpi) { - - if (!num_interfaces) - return; - - int medium1_ispec_l, medium2_ispec_l; - - specfem::mesh::interface_container interface(num_interfaces); - interface.medium1_index_mapping("medium1_index_mapping", num_interfaces); - interface.medium2_index_mapping("medium2_index_mapping", num_interfaces); - - for (int i = 0; i < num_interfaces; i++) { - specfem::IO::fortran_read_line(stream, &medium2_ispec_l, - &medium1_ispec_l); - interface.medium1_index_mapping(i) = medium1_ispec_l - 1; - interface.medium2_index_mapping(i) = medium2_ispec_l - 1; - } - - return interface; -} - - - - -} // namespace fortran -} // namespace mesh -} // namespace IO -} // namespace specfem \ No newline at end of file diff --git a/include/IO/mesh/fortran/read_interfaces.hpp b/include/IO/mesh/fortran/read_interfaces.hpp new file mode 100644 index 00000000..3a8d46f6 --- /dev/null +++ b/include/IO/mesh/fortran/read_interfaces.hpp @@ -0,0 +1,28 @@ + +#include "interface_container.hpp" +#include "specfem_mpi/interface.hpp" +#include "mesh/coupled_interfaces/coupled_interfaces.hpp" + +namespace specfem { +namespace IO { +namespace mesh { +namespace fortran { + + template + specfem::mesh::interface_container + read_interface( + const int num_interfaces, std::ifstream &stream, + const specfem::MPI::MPI *mpi) {} + + specfem::mesh::coupled_interfaces read_coupled_interfaces ( + std::ifstream &stream, const int num_interfaces_elastic_acoustic, + const int num_interfaces_acoustic_poroelastic, + const int num_interfaces_elastic_poroelastic, const specfem::MPI::MPI *mpi) {} + + + +} // namespace fortran +} // namespace mesh +} // namespace IO +} // namespace specfem \ No newline at end of file diff --git a/src/IO/mesh/fortran/read_boundaries.cpp b/src/IO/mesh/fortran/read_boundaries.cpp index df7254e6..67a01c1d 100644 --- a/src/IO/mesh/fortran/read_boundaries.cpp +++ b/src/IO/mesh/fortran/read_boundaries.cpp @@ -1,7 +1,4 @@ #include "mesh/boundaries/boundaries.hpp" -#include "mesh/boundaries/absorbing_boundaries.hpp" -#include "mesh/boundaries/acoustic_free_surface.hpp" -#include "mesh/boundaries/forcing_boundaries.hpp" #include "IO/mesh/fortran/read_boundaries.hpp" #include "IO/fortranio/interface.hpp" #include "specfem_mpi/interface.hpp" @@ -10,225 +7,346 @@ #include #include -namespace specfem { -namespace IO { -namespace mesh { -namespace fortran { - - specfem::mesh::absorbing_boundary - read_absorbing_boundaries( - std::ifstream &stream, int num_abs_boundary_faces, const int nspec, - const specfem::MPI::MPI *mpi) { - - // Create base instance of the absorbing boundary - specfem::mesh::absorbing_boundary absorbing_boundary(num_abs_boundary_faces); - - // I have to do this because std::vector is a fake container type that - // causes issues when getting a reference - bool codeabsread1 = true, codeabsread2 = true, codeabsread3 = true, - codeabsread4 = true; - std::vector iedgeread(8, 0); - int numabsread, typeabsread; - if (num_abs_boundary_faces < 0) { - mpi->cout("Warning: read in negative nelemabs resetting to 0!"); - num_abs_boundary_faces = 0; - } - specfem::kokkos::HostView1d type_edge( - "specfem::mesh::absorbing_boundary::type_edge", num_abs_boundary_faces); - - specfem::kokkos::HostView1d ispec_edge( - "specfem::mesh::absorbing_boundary::ispec_edge", num_abs_boundary_faces); - - if (num_abs_boundary_faces > 0) { - for (int inum = 0; inum < num_abs_boundary_faces; inum++) { - specfem::IO::fortran_read_line(stream, &numabsread, &codeabsread1, - &codeabsread2, &codeabsread3, - &codeabsread4, &typeabsread, &iedgeread); - if (numabsread < 1 || numabsread > nspec) - throw std::runtime_error("Wrong absorbing element number"); - ispec_edge(inum) = numabsread - 1; - std::vector codeabsread = { codeabsread1, codeabsread2, - codeabsread3, codeabsread4 }; - if (std::count(codeabsread.begin(), codeabsread.end(), true) != 1) { - throw std::runtime_error("must have one and only one absorbing edge " - "per absorbing line cited"); - } - if (codeabsread1) - type_edge(inum) = specfem::enums::boundaries::type::BOTTOM; +specfem::mesh::absorbing_boundary +specfem::IO::mesh::fortran::read_absorbing_boundaries( + std::ifstream &stream, int num_abs_boundary_faces, const int nspec, + const specfem::MPI::MPI *mpi) { - if (codeabsread2) - type_edge(inum) = specfem::enums::boundaries::type::RIGHT; + // Create base instance of the absorbing boundary + specfem::mesh::absorbing_boundary absorbing_boundary(num_abs_boundary_faces); - if (codeabsread3) - type_edge(inum) = specfem::enums::boundaries::type::TOP; + // I have to do this because std::vector is a fake container type that + // causes issues when getting a reference + bool codeabsread1 = true, codeabsread2 = true, codeabsread3 = true, + codeabsread4 = true; + std::vector iedgeread(8, 0); + int numabsread, typeabsread; + if (num_abs_boundary_faces < 0) { + mpi->cout("Warning: read in negative nelemabs resetting to 0!"); + num_abs_boundary_faces = 0; + } - if (codeabsread4) - type_edge(inum) = specfem::enums::boundaries::type::LEFT; + specfem::kokkos::HostView1d type_edge( + "specfem::mesh::absorbing_boundary::type_edge", num_abs_boundary_faces); + + specfem::kokkos::HostView1d ispec_edge( + "specfem::mesh::absorbing_boundary::ispec_edge", num_abs_boundary_faces); + + if (num_abs_boundary_faces > 0) { + for (int inum = 0; inum < num_abs_boundary_faces; inum++) { + specfem::IO::fortran_read_line(stream, &numabsread, &codeabsread1, + &codeabsread2, &codeabsread3, + &codeabsread4, &typeabsread, &iedgeread); + if (numabsread < 1 || numabsread > nspec) + throw std::runtime_error("Wrong absorbing element number"); + ispec_edge(inum) = numabsread - 1; + std::vector codeabsread = { codeabsread1, codeabsread2, + codeabsread3, codeabsread4 }; + if (std::count(codeabsread.begin(), codeabsread.end(), true) != 1) { + throw std::runtime_error("must have one and only one absorbing edge " + "per absorbing line cited"); } + if (codeabsread1) + type_edge(inum) = specfem::enums::boundaries::type::BOTTOM; - // Find corner elements - auto [ispec_corners, type_corners] = specfem::mesh::absorbing_boundaries::find_corners(ispec_edge, type_edge); + if (codeabsread2) + type_edge(inum) = specfem::enums::boundaries::type::RIGHT; - const int nelements = ispec_corners.extent(0) + ispec_edge.extent(0); + if (codeabsread3) + type_edge(inum) = specfem::enums::boundaries::type::TOP; - absorbing_boundary.nelements = nelements; + if (codeabsread4) + type_edge(inum) = specfem::enums::boundaries::type::LEFT; + } - absorbing_boundary.index_mapping = Kokkos::View( - "specfem::mesh::absorbing_boundary::index_mapping", nelements); + // Find corner elements + auto [ispec_corners, type_corners] = find_corners(ispec_edge, type_edge); - absorbing_boundary.type = - Kokkos::View( - "specfem::mesh::absorbing_boundary::type", nelements); - // Populate ispec and type arrays + const int nelements = ispec_corners.extent(0) + ispec_edge.extent(0); - for (int inum = 0; inum < ispec_edge.extent(0); inum++) { - absorbing_boundary.index_mapping(inum) = ispec_edge(inum); - absorbing_boundary.type(inum) = type_edge(inum); - } + absorbing_boundary.nelements = nelements; - for (int inum = 0; inum < ispec_corners.extent(0); inum++) { - absorbing_boundary.index_mapping(inum + ispec_edge.extent(0)) = ispec_corners(inum); - absorbing_boundary.type(inum + ispec_edge.extent(0)) = type_corners(inum); - } - } else { - absorbing_boundary.nelements = 0; + absorbing_boundary.index_mapping = Kokkos::View( + "specfem::mesh::absorbing_boundary::index_mapping", nelements); + + absorbing_boundary.type = + Kokkos::View( + "specfem::mesh::absorbing_boundary::type", nelements); + // Populate ispec and type arrays + + for (int inum = 0; inum < ispec_edge.extent(0); inum++) { + absorbing_boundary.index_mapping(inum) = ispec_edge(inum); + absorbing_boundary.type(inum) = type_edge(inum); } - return absorbing_boundary; + for (int inum = 0; inum < ispec_corners.extent(0); inum++) { + absorbing_boundary.index_mapping(inum + ispec_edge.extent(0)) = ispec_corners(inum); + absorbing_boundary.type(inum + ispec_edge.extent(0)) = type_corners(inum); + } + } else { + absorbing_boundary.nelements = 0; } - using view_type = - Kokkos::Subview, - std::remove_const_t, int>; - - /** - * @brief Get the type of boundary - * - * @param type int indicating if the boundary is edge of node - * @param e1 control node index for the starting node of the if the boundary is - * edge else control node index of the node if the boundary is node - * @param e2 control node index for the ending node of the if the boundary is - * edge - * @return specfem::enums::boundaries::type type of the boundary - */ - specfem::enums::boundaries::type - get_boundary_type(const int type, const int e1, const int e2, - const view_type &control_nodes) { - // if this is a node type - if (type == 1) { - if (e1 == control_nodes(0)) { - return specfem::enums::boundaries::type::BOTTOM_LEFT; - } else if (e1 == control_nodes(1)) { - return specfem::enums::boundaries::type::BOTTOM_RIGHT; - } else if (e1 == control_nodes(2)) { - return specfem::enums::boundaries::type::TOP_RIGHT; - } else if (e1 == control_nodes(3)) { - return specfem::enums::boundaries::type::TOP_LEFT; - } else { - throw std::invalid_argument( - "Error: Could not generate type of acoustic free surface boundary"); - } + return absorbing_boundary; +} + +using view_type = + Kokkos::Subview, + std::remove_const_t, int>; + +/** + * @brief Get the type of boundary + * + * @param type int indicating if the boundary is edge of node + * @param e1 control node index for the starting node of the if the boundary is + * edge else control node index of the node if the boundary is node + * @param e2 control node index for the ending node of the if the boundary is + * edge + * @return specfem::enums::boundaries::type type of the boundary + */ +specfem::enums::boundaries::type +get_boundary_type(const int type, const int e1, const int e2, + const view_type &control_nodes) { + // if this is a node type + if (type == 1) { + if (e1 == control_nodes(0)) { + return specfem::enums::boundaries::type::BOTTOM_LEFT; + } else if (e1 == control_nodes(1)) { + return specfem::enums::boundaries::type::BOTTOM_RIGHT; + } else if (e1 == control_nodes(2)) { + return specfem::enums::boundaries::type::TOP_RIGHT; + } else if (e1 == control_nodes(3)) { + return specfem::enums::boundaries::type::TOP_LEFT; } else { - if ((e1 == control_nodes(0) && e2 == control_nodes(1)) || - (e1 == control_nodes(1) && e2 == control_nodes(0))) { - return specfem::enums::boundaries::type::BOTTOM; - } else if ((e1 == control_nodes(0) && e2 == control_nodes(3)) || - (e1 == control_nodes(3) && e2 == control_nodes(0))) { - return specfem::enums::boundaries::type::LEFT; - } else if ((e1 == control_nodes(1) && e2 == control_nodes(2)) || - (e1 == control_nodes(2) && e2 == control_nodes(1))) { - return specfem::enums::boundaries::type::RIGHT; - } else if ((e1 == control_nodes(2) && e2 == control_nodes(3)) || - (e1 == control_nodes(3) && e2 == control_nodes(2))) { - return specfem::enums::boundaries::type::TOP; - } else { - throw std::invalid_argument( - "Error: Could not generate type of acoustic free surface boundary"); - } + throw std::invalid_argument( + "Error: Could not generate type of acoustic free surface boundary"); + } + } else { + if ((e1 == control_nodes(0) && e2 == control_nodes(1)) || + (e1 == control_nodes(1) && e2 == control_nodes(0))) { + return specfem::enums::boundaries::type::BOTTOM; + } else if ((e1 == control_nodes(0) && e2 == control_nodes(3)) || + (e1 == control_nodes(3) && e2 == control_nodes(0))) { + return specfem::enums::boundaries::type::LEFT; + } else if ((e1 == control_nodes(1) && e2 == control_nodes(2)) || + (e1 == control_nodes(2) && e2 == control_nodes(1))) { + return specfem::enums::boundaries::type::RIGHT; + } else if ((e1 == control_nodes(2) && e2 == control_nodes(3)) || + (e1 == control_nodes(3) && e2 == control_nodes(2))) { + return specfem::enums::boundaries::type::TOP; + } else { + throw std::invalid_argument( + "Error: Could not generate type of acoustic free surface boundary"); } } - - specfem::mesh::acoustic_free_surface - read_acoustic_free_surface(std::ifstream &stream, - const int &nelem_acoustic_surface, - const Kokkos::View knods, - const specfem::MPI::MPI *mpi) { - - std::vector acfree_edge(4, 0); - specfem::mesh::acoustic_free_surface acoustic_free_surface(nelem_acoustic_surface); - - if (nelem_acoustic_surface > 0) { - for (int inum = 0; inum < nelem_acoustic_surface; inum++) { - specfem::IO::fortran_read_line(stream, &acfree_edge); - acoustic_free_surface.index_mapping(inum) = acfree_edge[0] - 1; - const auto control_nodes = - Kokkos::subview(knods, Kokkos::ALL, acoustic_free_surface.index_mapping(inum)); - acoustic_free_surface.type(inum) = get_boundary_type(acfree_edge[1], acfree_edge[2] - 1, - acfree_edge[3] - 1, control_nodes); - } +} + +specfem::mesh::acoustic_free_surface +read_acoustic_free_surface(std::ifstream &stream, + const int &nelem_acoustic_surface, + const Kokkos::View knods, + const specfem::MPI::MPI *mpi) { + + std::vector acfree_edge(4, 0); + specfem::mesh::acoustic_free_surface acoustic_free_surface(nelem_acoustic_surface); + + if (nelem_acoustic_surface > 0) { + for (int inum = 0; inum < nelem_acoustic_surface; inum++) { + specfem::IO::fortran_read_line(stream, &acfree_edge); + acoustic_free_surface.index_mapping(inum) = acfree_edge[0] - 1; + const auto control_nodes = + Kokkos::subview(knods, Kokkos::ALL, acoustic_free_surface.index_mapping(inum)); + acoustic_free_surface.type(inum) = get_boundary_type(acfree_edge[1], acfree_edge[2] - 1, + acfree_edge[3] - 1, control_nodes); } + } - mpi->sync_all(); + mpi->sync_all(); + + return acoustic_free_surface; +} - return acoustic_free_surface; - } +specfem::mesh::forcing_boundary read_forcing_boundaries( + std::ifstream &stream, const int nelement_acforcing, const int nspec, + const specfem::MPI::MPI *mpi) { - specfem::mesh::forcing_boundary read_forcing_boundaries( - std::ifstream &stream, const int nelement_acforcing, const int nspec, - const specfem::MPI::MPI *mpi) { + bool codeacread1 = true, codeacread2 = true, + codeacread3 = true, codeacread4 = true; + std::vector iedgeread(8, 0); + int numacread, typeacread; - bool codeacread1 = true, codeacread2 = true, - codeacread3 = true, codeacread4 = true; - std::vector iedgeread(8, 0); - int numacread, typeacread; + specfem::mesh::forcing_boundary forcing_boundary(nelement_acforcing); - specfem::mesh::forcing_boundary forcing_boundary(nelement_acforcing); + if (nelement_acforcing > 0) { + for (int inum = 0; inum < nelement_acforcing; inum++) { + specfem::IO::fortran_read_line(stream, &numacread, &codeacread1, + &codeacread2, &codeacread3, &codeacread4, + &typeacread, &iedgeread); + std::vector codeacread(4, false); + if (numacread < 1 || numacread > nspec) { + std::runtime_error("Wrong absorbing element number"); + } + forcing_boundary.numacforcing(inum) = numacread - 1; + forcing_boundary.typeacforcing(inum) = typeacread; + codeacread[0] = codeacread1; + codeacread[1] = codeacread2; + codeacread[2] = codeacread3; + codeacread[3] = codeacread4; + if (std::count(codeacread.begin(), codeacread.end(), true) != 1) { + throw std::runtime_error("must have one and only one acoustic forcing " + "per acoustic forcing line cited"); + } + forcing_boundary.codeacforcing(inum, 0) = codeacread[0]; + forcing_boundary.codeacforcing(inum, 1) = codeacread[1]; + forcing_boundary.codeacforcing(inum, 2) = codeacread[2]; + forcing_boundary.codeacforcing(inum, 3) = codeacread[3]; + forcing_boundary.ibegin_edge1(inum) = iedgeread[0]; + forcing_boundary.iend_edge1(inum) = iedgeread[1]; + forcing_boundary.ibegin_edge2(inum) = iedgeread[2]; + forcing_boundary.iend_edge2(inum) = iedgeread[3]; + forcing_boundary.ibegin_edge3(inum) = iedgeread[4]; + forcing_boundary.iend_edge3(inum) = iedgeread[5]; + forcing_boundary.ibegin_edge4(inum) = iedgeread[6]; + forcing_boundary.iend_edge4(inum) = iedgeread[7]; + } + } - if (nelement_acforcing > 0) { - for (int inum = 0; inum < nelement_acforcing; inum++) { - specfem::IO::fortran_read_line(stream, &numacread, &codeacread1, - &codeacread2, &codeacread3, &codeacread4, - &typeacread, &iedgeread); - std::vector codeacread(4, false); - if (numacread < 1 || numacread > nspec) { - std::runtime_error("Wrong absorbing element number"); + // populate ib_bottom, ib_top, ib_left, ib_right arrays + calculate_ib(forcing_boundary.codeacforcing,forcing_boundary.ib_bottom, + forcing_boundary.ib_top, forcing_boundary.ib_left, + forcing_boundary.ib_right, nelement_acforcing); + + return forcing_boundary; +} + + + +static std::tuple< + specfem::kokkos::HostView1d, + specfem::kokkos::HostView1d > +find_corners(const specfem::kokkos::HostView1d ispec_edge, + const specfem::kokkos::HostView1d + type_edge) { + + int ncorner = 0; + int num_abs_boundary_faces = ispec_edge.extent(0); + for (int inum = 0; inum < num_abs_boundary_faces; inum++) { + if (type_edge(inum) == specfem::enums::boundaries::type::BOTTOM) { + for (int inum_duplicate = 0; inum_duplicate < num_abs_boundary_faces; + inum_duplicate++) { + if (inum != inum_duplicate) { + if (ispec_edge(inum) == ispec_edge(inum_duplicate)) { + if (type_edge(inum) == specfem::enums::boundaries::type::LEFT) { + ncorner++; + } + if (type_edge(inum) == specfem::enums::boundaries::type::RIGHT) { + ncorner++; + } + } } - forcing_boundary.numacforcing(inum) = numacread - 1; - forcing_boundary.typeacforcing(inum) = typeacread; - codeacread[0] = codeacread1; - codeacread[1] = codeacread2; - codeacread[2] = codeacread3; - codeacread[3] = codeacread4; - if (std::count(codeacread.begin(), codeacread.end(), true) != 1) { - throw std::runtime_error("must have one and only one acoustic forcing " - "per acoustic forcing line cited"); + } + if (type_edge(inum) == specfem::enums::boundaries::type::TOP) { + for (int inum_duplicate = 0; inum_duplicate < num_abs_boundary_faces; + inum_duplicate++) { + if (inum != inum_duplicate) { + if (ispec_edge(inum) == ispec_edge(inum_duplicate)) { + if (type_edge(inum) == specfem::enums::boundaries::type::LEFT) { + ncorner++; + } + if (type_edge(inum) == specfem::enums::boundaries::type::RIGHT) { + ncorner++; + } + } + } } - forcing_boundary.codeacforcing(inum, 0) = codeacread[0]; - forcing_boundary.codeacforcing(inum, 1) = codeacread[1]; - forcing_boundary.codeacforcing(inum, 2) = codeacread[2]; - forcing_boundary.codeacforcing(inum, 3) = codeacread[3]; - forcing_boundary.ibegin_edge1(inum) = iedgeread[0]; - forcing_boundary.iend_edge1(inum) = iedgeread[1]; - forcing_boundary.ibegin_edge2(inum) = iedgeread[2]; - forcing_boundary.iend_edge2(inum) = iedgeread[3]; - forcing_boundary.ibegin_edge3(inum) = iedgeread[4]; - forcing_boundary.iend_edge3(inum) = iedgeread[5]; - forcing_boundary.ibegin_edge4(inum) = iedgeread[6]; - forcing_boundary.iend_edge4(inum) = iedgeread[7]; } } + } - // populate ib_bottom, ib_top, ib_left, ib_right arrays - calculate_ib(forcing_boundary.codeacforcing,forcing_boundary.ib_bottom, - forcing_boundary.ib_top, forcing_boundary.ib_left, - forcing_boundary.ib_right, nelement_acforcing); + specfem::kokkos::HostView1d ispec_corners( + "specfem:IO::mesh::fortran::read_boundaries::find_corners::ispec_corners", ncorner); + + specfem::kokkos::HostView1d type_corners( + "specfem:IO::mesh::fortran::read_boundaries::find_corners::type_corners", ncorner); + + int icorner = 0; + + for (int inum = 0; inum < num_abs_boundary_faces; inum++) { + if (type_edge(inum) == specfem::enums::boundaries::type::BOTTOM) { + for (int inum_duplicate = 0; inum_duplicate < num_abs_boundary_faces; + inum_duplicate++) { + if (inum != inum_duplicate) { + if (ispec_edge(inum) == ispec_edge(inum_duplicate)) { + if (type_edge(inum) == specfem::enums::boundaries::type::LEFT) { + ispec_corners(icorner) = ispec_edge(inum); + type_corners(icorner) = + specfem::enums::boundaries::type::BOTTOM_LEFT; + icorner++; + } + if (type_edge(inum) == specfem::enums::boundaries::type::RIGHT) { + ispec_corners(icorner) = ispec_edge(inum); + type_corners(icorner) = + specfem::enums::boundaries::type::BOTTOM_RIGHT; + icorner++; + } + } + } + } + if (type_edge(inum) == specfem::enums::boundaries::type::TOP) { + for (int inum_duplicate = 0; inum_duplicate < num_abs_boundary_faces; + inum_duplicate++) { + if (inum != inum_duplicate) { + if (ispec_edge(inum) == ispec_edge(inum_duplicate)) { + if (type_edge(inum) == specfem::enums::boundaries::type::LEFT) { + ispec_corners(icorner) = ispec_edge(inum); + type_corners(icorner) = + specfem::enums::boundaries::type::TOP_LEFT; + icorner++; + } + if (type_edge(inum) == specfem::enums::boundaries::type::RIGHT) { + ispec_corners(icorner) = ispec_edge(inum); + type_corners(icorner) = + specfem::enums::boundaries::type::TOP_RIGHT; + icorner++; + } + } + } + } + } + } + } - return forcing_boundary; + return std::make_tuple(ispec_corners, type_corners); +} + + +inline void calculate_ib(const specfem::kokkos::HostView2d code, + specfem::kokkos::HostView1d ib_bottom, + specfem::kokkos::HostView1d ib_top, + specfem::kokkos::HostView1d ib_left, + specfem::kokkos::HostView1d ib_right, + const int nelements) { + + int nspec_left = 0, nspec_right = 0, nspec_top = 0, nspec_bottom = 0; + for (int inum = 0; inum < nelements; inum++) { + if (code(inum, 0)) { + ib_bottom(inum) = nspec_bottom; + nspec_bottom++; + } else if (code(inum, 1)) { + ib_right(inum) = nspec_right; + nspec_right++; + } else if (code(inum, 2)) { + ib_top(inum) = nspec_top; + nspec_top++; + } else if (code(inum, 3)) { + ib_left(inum) = nspec_left; + nspec_left++; + } else { + throw std::runtime_error("Incorrect acoustic boundary element type read"); + } } -} // namespace fortran -} // namespace mesh -} // namespace IO -} // namespace specfem \ No newline at end of file + assert(nspec_left + nspec_right + nspec_bottom + nspec_top == nelements); +} \ No newline at end of file diff --git a/src/IO/mesh/fortran/read_elements.cpp b/src/IO/mesh/fortran/read_elements.cpp new file mode 100644 index 00000000..3f70acd3 --- /dev/null +++ b/src/IO/mesh/fortran/read_elements.cpp @@ -0,0 +1,50 @@ +#include "IO/fortranio/interface.hpp" +#include "IO/mesh/fortran/read_elements.hpp" +#include "mesh/elements/axial_elements.hpp" +#include "mesh/elements/tangential_elements.hpp" +#include "specfem_mpi/interface.hpp" + + + +specfem::mesh::elements::axial_elements specfem::IO::mesh::fortran::read_axial_elements( + std::ifstream &stream, const int nelem_on_the_axis, const int nspec, + const specfem::MPI::MPI *mpi) { + + int ispec; + + specfem::mesh::elements::axial_elements axial_elements(nspec); + + for (int inum = 0; inum < nelem_on_the_axis; inum++) { + specfem::IO::fortran_read_line(stream, &ispec); + if (ispec < 0 || ispec > nspec - 1) + throw std::runtime_error( + "ispec out of range when reading axial elements"); + axial_elements.is_on_the_axis(ispec) = true; + } + + return axial_elements; +} + + +specfem::mesh::elements::tangential_elements specfem::IO::mesh::fortran::read_tangential_elements( + std::ifstream &stream, const int nnodes_tangential_curve) { + type_real xread, yread; + + specfem::mesh::elements::tangential_elements tangential_elements(nnodes_tangential_curve); + + specfem::IO::fortran_read_line(stream, tangential_elements.force_normal_to_surface, + tangential_elements.rec_normal_to_surface); + + if (nnodes_tangential_curve > 0) { + for (int inum = 0; inum < nnodes_tangential_curve; inum++) { + specfem::IO::fortran_read_line(stream, &xread, &yread); + tangential_elements.x(inum) = xread; + tangential_elements.y(inum) = yread; + } + } else { + tangential_elements.force_normal_to_surface = false; + tangential_elements.rec_normal_to_surface = false; + } + + return tangential_elements; +} diff --git a/src/IO/mesh/fortran/read_interfaces.cpp b/src/IO/mesh/fortran/read_interfaces.cpp index b1a3bb8b..febe5748 100644 --- a/src/IO/mesh/fortran/read_interfaces.cpp +++ b/src/IO/mesh/fortran/read_interfaces.cpp @@ -1,5 +1,6 @@ #include "IO/mesh/fortran/read_interfaces.hpp" #include "interface_container.hpp" +#include "mesh/coupled_interfaces/coupled_interfaces.hpp" #include "specfem_mpi/interface.hpp" namespace specfem { @@ -10,7 +11,7 @@ namespace fortran { template specfem::mesh::interface_container - read_interface( + read_interfaces( const int num_interfaces, std::ifstream &stream, const specfem::MPI::MPI *mpi) { @@ -57,7 +58,8 @@ namespace fortran { specfem::element::medium_tag::poroelastic >(num_interfaces_elastic_poroelastic, stream, mpi); - return coupled_interfaces(elastic_acoustic, acoustic_poroelastic, elastic_poroelastic); + return specfem::mesh::coupled_interfaces( + elastic_acoustic, acoustic_poroelastic, elastic_poroelastic); } diff --git a/src/IO/mesh/fortran/read_material_properties.cpp b/src/IO/mesh/fortran/read_material_properties.cpp index 5c24a0da..e145628f 100644 --- a/src/IO/mesh/fortran/read_material_properties.cpp +++ b/src/IO/mesh/fortran/read_material_properties.cpp @@ -1,17 +1,12 @@ -#include "mesh/IO/fortran/read_material_properties.hpp" #include "fortranio/interface.hpp" -#include "material/interface.hpp" #include "specfem_mpi/interface.hpp" #include "utilities/interface.hpp" +#include "material/material.hpp" +#include "mesh/IO/fortran/read_material_properties.hpp" #include #include -namespace specfem { -namespace IO { -namespace mesh { -namespace fortran { - struct input_holder { // Struct to hold temporary variables read from database file type_real val0, val1, val2, val3, val4, val5, val6, val7, val8, val9, val10, @@ -20,7 +15,7 @@ struct input_holder { }; std::vector> -read_material_properties( +specfem::IO::mesh::fortran::read_material_properties( std::ifstream &stream, const int numat, const specfem::MPI::MPI *mpi) { input_holder read_values; @@ -86,8 +81,3 @@ read_material_properties( return materials; } - -} // namespace fortran -} // namespace mesh -} // namespace IO -} // namespace specfem \ No newline at end of file diff --git a/src/IO/mesh/fortran/read_mesh_database.cpp b/src/IO/mesh/fortran/read_mesh_database.cpp index 51345fed..5729102c 100644 --- a/src/IO/mesh/fortran/read_mesh_database.cpp +++ b/src/IO/mesh/fortran/read_mesh_database.cpp @@ -9,12 +9,9 @@ #include #include -namespace specfem { -namespace IO { -namespace mesh { -namespace fortran { -std::tuple read_mesh_database_header( + +std::tuple specfem::IO::mesh::fortran::read_mesh_database_header( std::ifstream &stream, const specfem::MPI::MPI *mpi) { // This subroutine reads header values of the database which are skipped std::string dummy_s; @@ -192,8 +189,3 @@ read_mesh_database_attenuation( return std::make_tuple(n_sls, attenuation_f0_reference, read_velocities_at_f0); } - -} // namespace fortran -} // namespace mesh -} // namespace IO -} // namespace specfem \ No newline at end of file diff --git a/src/IO/mesh/fortran/read_properties.cpp b/src/IO/mesh/fortran/read_properties.cpp index 04980b0d..2dc4dc5a 100644 --- a/src/IO/mesh/fortran/read_properties.cpp +++ b/src/IO/mesh/fortran/read_properties.cpp @@ -1,12 +1,9 @@ #include "mesh/properties/properties.hpp" #include "IO/fortranio/interface.hpp" +#include "IO/mesh/fortran/read_properties.hpp" -namespace specfem { -namespace IO { -namespace mesh { -namespace fortran { -specfem::mesh::properties read_roperties(std::ifstream &stream, +specfem::mesh::properties specfem::IO::mesh::fortran::read_properties(std::ifstream &stream, const specfem::MPI::MPI *mpi) { // --------------------------------------------------------------------- // reading mesh properties @@ -55,8 +52,3 @@ specfem::mesh::properties read_roperties(std::ifstream &stream, nelem_on_the_axis, plot_lowerleft_corner_only); } - -} // namespace fortran -} // namespace mesh -} // namespace IO -} // namespace specfem \ No newline at end of file diff --git a/src/IO/mesh/read_mesh.cpp b/src/IO/mesh/read_mesh.cpp index 7612bb5e..46f6bfd0 100644 --- a/src/IO/mesh/read_mesh.cpp +++ b/src/IO/mesh/read_mesh.cpp @@ -12,10 +12,7 @@ #include #include -namespace specfem { -namespace IO { - -specfem::mesh::mesh read_mesh(const std::string filename, +specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, const specfem::MPI::MPI *mpi) { std::ifstream stream; @@ -146,15 +143,15 @@ specfem::mesh::mesh read_mesh(const std::string filename, } try { - this->tangential_nodes = specfem::mesh::elements::tangential_elements( - stream, this->parameters.nnodes_tangential_curve); + mesh->tangential_nodes = specfem::IO::mesh::fortran::read_elements::read_tangential_elements( + stream, mesh->parameters.nnodes_tangential_curve); } catch (std::runtime_error &e) { throw; } try { - this->axial_nodes = specfem::mesh::elements::axial_elements( - stream, this->parameters.nelem_on_the_axis, this->nspec, mpi); + mesh->axial_nodes = specfem::IO::mesh::fortran::read_elements::axial_elements( + stream, mesh->parameters.nelem_on_the_axis, mesh->nspec, mpi); } catch (std::runtime_error &e) { throw; } @@ -173,12 +170,12 @@ specfem::mesh::mesh read_mesh(const std::string filename, "------------------------------"); mpi->cout("Number of material systems = " + - std::to_string(this->materials.n_materials) + "\n\n"); + std::to_string(mesh->materials.n_materials) + "\n\n"); const auto l_elastic_isotropic = - this->materials.elastic_isotropic.material_properties; + mesh->materials.elastic_isotropic.material_properties; const auto l_acoustic_isotropic = - this->materials.acoustic_isotropic.material_properties; + mesh->materials.acoustic_isotropic.material_properties; for (const auto material : l_elastic_isotropic) { mpi->cout(material.print()); @@ -191,7 +188,7 @@ specfem::mesh::mesh read_mesh(const std::string filename, assert(l_elastic_isotropic.size() + l_acoustic_isotropic.size() == this->materials.n_materials); - this->tags = specfem::mesh::tags(this->materials, this->boundaries); + mesh->tags = specfem::mesh::tags(mesh->materials, mesh->boundaries); return; } @@ -228,6 +225,3 @@ std::string specfem::mesh::mesh::print() const { return message.str(); } - -} // namespace IO -} // namespace specfem \ No newline at end of file diff --git a/src/mesh/boundaries/absorbing_boundaries.cpp b/src/mesh/boundaries/absorbing_boundaries.cpp index b5299321..c08d7dbf 100644 --- a/src/mesh/boundaries/absorbing_boundaries.cpp +++ b/src/mesh/boundaries/absorbing_boundaries.cpp @@ -20,101 +20,3 @@ specfem::mesh::absorbing_boundary::absorbing_boundary( return; } - -static std::tuple< - specfem::kokkos::HostView1d, - specfem::kokkos::HostView1d > -find_corners(const specfem::kokkos::HostView1d ispec_edge, - const specfem::kokkos::HostView1d - type_edge) { - - int ncorner = 0; - int num_abs_boundary_faces = ispec_edge.extent(0); - for (int inum = 0; inum < num_abs_boundary_faces; inum++) { - if (type_edge(inum) == specfem::enums::boundaries::type::BOTTOM) { - for (int inum_duplicate = 0; inum_duplicate < num_abs_boundary_faces; - inum_duplicate++) { - if (inum != inum_duplicate) { - if (ispec_edge(inum) == ispec_edge(inum_duplicate)) { - if (type_edge(inum) == specfem::enums::boundaries::type::LEFT) { - ncorner++; - } - if (type_edge(inum) == specfem::enums::boundaries::type::RIGHT) { - ncorner++; - } - } - } - } - if (type_edge(inum) == specfem::enums::boundaries::type::TOP) { - for (int inum_duplicate = 0; inum_duplicate < num_abs_boundary_faces; - inum_duplicate++) { - if (inum != inum_duplicate) { - if (ispec_edge(inum) == ispec_edge(inum_duplicate)) { - if (type_edge(inum) == specfem::enums::boundaries::type::LEFT) { - ncorner++; - } - if (type_edge(inum) == specfem::enums::boundaries::type::RIGHT) { - ncorner++; - } - } - } - } - } - } - } - - specfem::kokkos::HostView1d ispec_corners( - "specfem::mesh::absorbing_boundary::ispec_corners", ncorner); - - specfem::kokkos::HostView1d type_corners( - "specfem::mesh::absorbing_boundary::type_corners", ncorner); - - int icorner = 0; - - for (int inum = 0; inum < num_abs_boundary_faces; inum++) { - if (type_edge(inum) == specfem::enums::boundaries::type::BOTTOM) { - for (int inum_duplicate = 0; inum_duplicate < num_abs_boundary_faces; - inum_duplicate++) { - if (inum != inum_duplicate) { - if (ispec_edge(inum) == ispec_edge(inum_duplicate)) { - if (type_edge(inum) == specfem::enums::boundaries::type::LEFT) { - ispec_corners(icorner) = ispec_edge(inum); - type_corners(icorner) = - specfem::enums::boundaries::type::BOTTOM_LEFT; - icorner++; - } - if (type_edge(inum) == specfem::enums::boundaries::type::RIGHT) { - ispec_corners(icorner) = ispec_edge(inum); - type_corners(icorner) = - specfem::enums::boundaries::type::BOTTOM_RIGHT; - icorner++; - } - } - } - } - if (type_edge(inum) == specfem::enums::boundaries::type::TOP) { - for (int inum_duplicate = 0; inum_duplicate < num_abs_boundary_faces; - inum_duplicate++) { - if (inum != inum_duplicate) { - if (ispec_edge(inum) == ispec_edge(inum_duplicate)) { - if (type_edge(inum) == specfem::enums::boundaries::type::LEFT) { - ispec_corners(icorner) = ispec_edge(inum); - type_corners(icorner) = - specfem::enums::boundaries::type::TOP_LEFT; - icorner++; - } - if (type_edge(inum) == specfem::enums::boundaries::type::RIGHT) { - ispec_corners(icorner) = ispec_edge(inum); - type_corners(icorner) = - specfem::enums::boundaries::type::TOP_RIGHT; - icorner++; - } - } - } - } - } - } - } - - return std::make_tuple(ispec_corners, type_corners); -} diff --git a/src/mesh/boundaries/utilities.cpp b/src/mesh/boundaries/utilities.cpp deleted file mode 100644 index 1af8c8b9..00000000 --- a/src/mesh/boundaries/utilities.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// Find corner elements of the absorbing boundary -inline void find_corners(const specfem::kokkos::HostView1d numabs, - const specfem::kokkos::HostView2d codeabs, - specfem::kokkos::HostView2d codeabscorner, - const int num_abs_boundary_faces, - const specfem::MPI::MPI *mpi) { - int ncorner = 0; - for (int inum = 0; inum < num_abs_boundary_faces; inum++) { - if (codeabs(inum, 0)) { - for (int inum_duplicate = 0; inum_duplicate < num_abs_boundary_faces; - inum_duplicate++) { - if (inum != inum_duplicate) { - if (numabs(inum) == numabs(inum_duplicate)) { - if (codeabs(inum_duplicate, 3)) { - codeabscorner(inum, 1) = true; - ncorner++; - } - if (codeabs(inum_duplicate, 1)) { - codeabscorner(inum, 2) = true; - ncorner++; - } - } - } - } - } - if (codeabs(inum, 2)) { - for (int inum_duplicate = 0; inum_duplicate < num_abs_boundary_faces; - inum_duplicate++) { - if (inum != inum_duplicate) { - if (numabs(inum) == numabs(inum_duplicate)) { - if (codeabs(inum_duplicate, 3)) { - codeabscorner(inum, 3) = true; - ncorner++; - } - if (codeabs(inum_duplicate, 1)) { - codeabscorner(inum, 4) = true; - ncorner++; - } - } - } - } - } - } - - int ncorner_all = mpi->reduce(ncorner, specfem::MPI::sum); - if (mpi->get_rank() == 0) - assert(ncorner_all <= 4); -} - -inline void calculate_ib(const specfem::kokkos::HostView2d code, - specfem::kokkos::HostView1d ib_bottom, - specfem::kokkos::HostView1d ib_top, - specfem::kokkos::HostView1d ib_left, - specfem::kokkos::HostView1d ib_right, - const int nelements) { - - int nspec_left = 0, nspec_right = 0, nspec_top = 0, nspec_bottom = 0; - for (int inum = 0; inum < nelements; inum++) { - if (code(inum, 0)) { - ib_bottom(inum) = nspec_bottom; - nspec_bottom++; - } else if (code(inum, 1)) { - ib_right(inum) = nspec_right; - nspec_right++; - } else if (code(inum, 2)) { - ib_top(inum) = nspec_top; - nspec_top++; - } else if (code(inum, 3)) { - ib_left(inum) = nspec_left; - nspec_left++; - } else { - throw std::runtime_error("Incorrect acoustic boundary element type read"); - } - } - - assert(nspec_left + nspec_right + nspec_bottom + nspec_top == nelements); -} diff --git a/src/mesh/elements/axial_elements.cpp b/src/mesh/elements/axial_elements.cpp index 83f8d435..9864b9ce 100644 --- a/src/mesh/elements/axial_elements.cpp +++ b/src/mesh/elements/axial_elements.cpp @@ -13,19 +13,3 @@ specfem::mesh::elements::axial_elements::axial_elements(const int nspec) { return; } -specfem::mesh::elements::axial_elements::axial_elements( - std::ifstream &stream, const int nelem_on_the_axis, const int nspec, - const specfem::MPI::MPI *mpi) { - int ispec; - - *this = specfem::mesh::elements::axial_elements(nspec); - for (int inum = 0; inum < nelem_on_the_axis; inum++) { - specfem::IO::fortran_read_line(stream, &ispec); - if (ispec < 0 || ispec > nspec - 1) - throw std::runtime_error( - "ispec out of range when reading axial elements"); - this->is_on_the_axis(ispec) = true; - } - - return; -} diff --git a/src/mesh/elements/tangential_elements.cpp b/src/mesh/elements/tangential_elements.cpp index 1bc5dab9..aff29188 100644 --- a/src/mesh/elements/tangential_elements.cpp +++ b/src/mesh/elements/tangential_elements.cpp @@ -27,26 +27,3 @@ specfem::mesh::elements::tangential_elements::tangential_elements( } return; } - -specfem::mesh::elements::tangential_elements::tangential_elements( - std::ifstream &stream, const int nnodes_tangential_curve) { - type_real xread, yread; - - *this = specfem::mesh::elements::tangential_elements(nnodes_tangential_curve); - - specfem::IO::fortran_read_line(stream, &this->force_normal_to_surface, - &this->rec_normal_to_surface); - - if (nnodes_tangential_curve > 0) { - for (int inum = 0; inum < nnodes_tangential_curve; inum++) { - specfem::IO::fortran_read_line(stream, &xread, &yread); - this->x(inum) = xread; - this->y(inum) = yread; - } - } else { - this->force_normal_to_surface = false; - this->rec_normal_to_surface = false; - } - - return; -} From 7ecf72b6b6d2336618a73c29eac6ea4b31522d97 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Thu, 10 Oct 2024 14:35:28 -0400 Subject: [PATCH 04/53] intermediate commit --- CMakeLists.txt | 9 +- include/IO/mesh/fortran/read_boundaries.hpp | 2 + include/IO/mesh/fortran/read_elements.hpp | 1 + include/IO/mesh/fortran/read_interfaces.hpp | 12 +- .../mesh/fortran/read_material_properties.hpp | 13 +- .../IO/mesh/fortran/read_mesh_database.hpp | 4 +- include/IO/mesh/fortran/read_properties.hpp | 2 + include/IO/mesh/mesh.hpp | 27 --- .../coupled_interfaces/coupled_interfaces.hpp | 7 +- include/mesh/elements/tangential_elements.hpp | 5 - include/mesh/materials/materials.hpp | 15 +- src/IO/mesh/fortran/read_boundaries.cpp | 1 - src/IO/mesh/fortran/read_interfaces.cpp | 41 +++- .../mesh/fortran/read_material_properties.cpp | 198 ++++++++++++++++-- src/IO/mesh/fortran/read_mesh_database.cpp | 2 +- src/IO/mesh/read_mesh.cpp | 14 +- src/mesh/materials/materials.cpp | 52 +---- src/specfem2d.cpp | 3 +- 18 files changed, 257 insertions(+), 151 deletions(-) delete mode 100644 include/IO/mesh/mesh.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index b5def661..21cae8c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,6 +112,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/mesh/fortran/read_boundaries.cpp + src/IO/mesh/fortran/read_elements.cpp + src/IO/mesh/fortran/read_material_properties.cpp + src/IO/mesh/fortran/read_mesh_database.cpp + src/IO/mesh/fortran/read_interfaces.cpp + ) target_link_libraries( @@ -171,13 +178,11 @@ endif(MPI_PARALLEL) add_library( mesh - src/mesh/IO/fortran/read_mesh_database.cpp src/mesh/boundaries/forcing_boundaries.cpp src/mesh/boundaries/absorbing_boundaries.cpp src/mesh/boundaries/acoustic_free_surface.cpp src/mesh/elements/tangential_elements.cpp src/mesh/elements/axial_elements.cpp - src/mesh/properties/properties.cpp src/mesh/mpi_interfaces/mpi_interfaces.cpp src/mesh/materials/materials.cpp src/mesh/coupled_interfaces/interface_container.cpp diff --git a/include/IO/mesh/fortran/read_boundaries.hpp b/include/IO/mesh/fortran/read_boundaries.hpp index 9fbdf33d..254346c1 100644 --- a/include/IO/mesh/fortran/read_boundaries.hpp +++ b/include/IO/mesh/fortran/read_boundaries.hpp @@ -1,3 +1,5 @@ +#pragma once + #include "mesh/boundaries/boundaries.hpp" #include "specfem_mpi/interface.hpp" #include "mesh/boundaries/absorbing_boundaries.hpp" diff --git a/include/IO/mesh/fortran/read_elements.hpp b/include/IO/mesh/fortran/read_elements.hpp index 3acf33db..0b255253 100644 --- a/include/IO/mesh/fortran/read_elements.hpp +++ b/include/IO/mesh/fortran/read_elements.hpp @@ -1,4 +1,5 @@ #pragma once + #include "mesh/elements/tangential_elements.hpp" #include "mesh/elements/axial_elements.hpp" #include "specfem_mpi/interface.hpp" diff --git a/include/IO/mesh/fortran/read_interfaces.hpp b/include/IO/mesh/fortran/read_interfaces.hpp index 3a8d46f6..4734e379 100644 --- a/include/IO/mesh/fortran/read_interfaces.hpp +++ b/include/IO/mesh/fortran/read_interfaces.hpp @@ -1,7 +1,8 @@ +#pragma once -#include "interface_container.hpp" -#include "specfem_mpi/interface.hpp" +#include "mesh/coupled_interfaces/interface_container.hpp" #include "mesh/coupled_interfaces/coupled_interfaces.hpp" +#include "specfem_mpi/interface.hpp" namespace specfem { namespace IO { @@ -13,14 +14,13 @@ namespace fortran { specfem::mesh::interface_container read_interface( const int num_interfaces, std::ifstream &stream, - const specfem::MPI::MPI *mpi) {} + const specfem::MPI::MPI *mpi) {}; + specfem::mesh::coupled_interfaces read_coupled_interfaces ( std::ifstream &stream, const int num_interfaces_elastic_acoustic, const int num_interfaces_acoustic_poroelastic, - const int num_interfaces_elastic_poroelastic, const specfem::MPI::MPI *mpi) {} - - + const int num_interfaces_elastic_poroelastic, const specfem::MPI::MPI *mpi) {}; } // namespace fortran } // namespace mesh diff --git a/include/IO/mesh/fortran/read_material_properties.hpp b/include/IO/mesh/fortran/read_material_properties.hpp index 3a0aa23d..3f49eaeb 100644 --- a/include/IO/mesh/fortran/read_material_properties.hpp +++ b/include/IO/mesh/fortran/read_material_properties.hpp @@ -1,8 +1,7 @@ -#ifndef _READ_MATERIAL_PROPERTIES_HPP -#define _READ_MATERIAL_PROPERTIES_HPP +#pragma once -#include "material/interface.hpp" -#include "specfem_mpi/interface.hpp" +// #include "mesh/materials/materials.hpp" +// #include "specfem_mpi/interface.hpp" #include #include #include @@ -23,7 +22,8 @@ namespace fortran { * @return std::vector Pointer to material objects read * from the database file */ -std::vector > + +specfem::mesh::materials read_material_properties(std::ifstream &stream, const int numat, const specfem::MPI::MPI *mpi); @@ -31,4 +31,5 @@ read_material_properties(std::ifstream &stream, const int numat, } // namespace mesh } // namespace IO } // namespace specfem -#endif + + diff --git a/include/IO/mesh/fortran/read_mesh_database.hpp b/include/IO/mesh/fortran/read_mesh_database.hpp index 1ac238c4..41f377be 100644 --- a/include/IO/mesh/fortran/read_mesh_database.hpp +++ b/include/IO/mesh/fortran/read_mesh_database.hpp @@ -1,5 +1,4 @@ -#ifndef _READ_MESH_DATABASE_HPP -#define _READ_MESH_DATABASE_HPP +#pragma once #include "kokkos_abstractions.h" #include "specfem_mpi/interface.hpp" @@ -55,4 +54,3 @@ read_mesh_database_attenuation(std::ifstream &stream, } // namespace IO } // namespace specfem -#endif diff --git a/include/IO/mesh/fortran/read_properties.hpp b/include/IO/mesh/fortran/read_properties.hpp index 79a789f0..520dd5b1 100644 --- a/include/IO/mesh/fortran/read_properties.hpp +++ b/include/IO/mesh/fortran/read_properties.hpp @@ -1,3 +1,5 @@ +#pragma once + #include "mesh/properties/properties.hpp" #include "IO/fortranio/interface.hpp" diff --git a/include/IO/mesh/mesh.hpp b/include/IO/mesh/mesh.hpp deleted file mode 100644 index 660294ac..00000000 --- a/include/IO/mesh/mesh.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#include "boundaries/boundaries.hpp" -#include "control_nodes/control_nodes.hpp" -#include "coupled_interfaces/coupled_interfaces.hpp" -#include "elements/axial_elements.hpp" -#include "elements/tangential_elements.hpp" -#include "materials/materials.hpp" -#include "mesh/tags/tags.hpp" -#include "properties/properties.hpp" -#include "specfem_mpi/interface.hpp" -#include "specfem_setup.hpp" -#include - -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 - */ - specfem::mesh::mesh read_mesh(const std::string filename, const specfem::MPI::MPI *mpi); - -} // namespace IO -} // namespace specfem diff --git a/include/mesh/coupled_interfaces/coupled_interfaces.hpp b/include/mesh/coupled_interfaces/coupled_interfaces.hpp index 0bb3eaac..d2630811 100644 --- a/include/mesh/coupled_interfaces/coupled_interfaces.hpp +++ b/include/mesh/coupled_interfaces/coupled_interfaces.hpp @@ -38,10 +38,9 @@ struct coupled_interfaces { specfem::mesh::interface_container< specfem::element::medium_tag::elastic, specfem::element::medium_tag::poroelastic - > elastic_poroelastic){} : - elastic_acoustic(elastic_acoustic) - acoustic_poroelastic(acoustic_poroelastic) - elastic_poroelastic(elastic_poroelastic); + > elastic_poroelastic) : elastic_acoustic(elastic_acoustic), + acoustic_poroelastic(acoustic_poroelastic), + elastic_poroelastic(elastic_poroelastic) {}; ///@} /** diff --git a/include/mesh/elements/tangential_elements.hpp b/include/mesh/elements/tangential_elements.hpp index 22c538df..7bdfaf5a 100644 --- a/include/mesh/elements/tangential_elements.hpp +++ b/include/mesh/elements/tangential_elements.hpp @@ -19,11 +19,6 @@ struct tangential_elements { tangential_elements(){}; tangential_elements(const int nnodes_tangential_curve); - /** - * @brief Construct a new tangential elements object - * - */ - tangential_elements }; } // namespace elements } // namespace mesh diff --git a/include/mesh/materials/materials.hpp b/include/mesh/materials/materials.hpp index e3911f32..4b2fc580 100644 --- a/include/mesh/materials/materials.hpp +++ b/include/mesh/materials/materials.hpp @@ -79,20 +79,7 @@ struct materials { * @param ngnod Number of control nodes per spectral element */ materials(const int nspec, const int ngnod); - /** - * @brief Constructor used to allocate and assign views from fortran database - * file - * - * @param stream Stream object for fortran binary file buffered to material - * definition section - * @param ngnod Number of control nodes per spectral element - * @param nspec Number of spectral elements - * @param numat Total number of different materials - * @param mpi Pointer to a MPI object - */ - materials(std::ifstream &stream, const int numat, const int nspec, - const specfem::kokkos::HostView2d knods, - const specfem::MPI::MPI *mpi); + ///@} /** diff --git a/src/IO/mesh/fortran/read_boundaries.cpp b/src/IO/mesh/fortran/read_boundaries.cpp index 67a01c1d..ce409b75 100644 --- a/src/IO/mesh/fortran/read_boundaries.cpp +++ b/src/IO/mesh/fortran/read_boundaries.cpp @@ -3,7 +3,6 @@ #include "IO/fortranio/interface.hpp" #include "specfem_mpi/interface.hpp" #include "utilities/interface.hpp" -#include "utilities.cpp" #include #include diff --git a/src/IO/mesh/fortran/read_interfaces.cpp b/src/IO/mesh/fortran/read_interfaces.cpp index febe5748..d461f863 100644 --- a/src/IO/mesh/fortran/read_interfaces.cpp +++ b/src/IO/mesh/fortran/read_interfaces.cpp @@ -1,17 +1,13 @@ #include "IO/mesh/fortran/read_interfaces.hpp" -#include "interface_container.hpp" #include "mesh/coupled_interfaces/coupled_interfaces.hpp" +#include "mesh/coupled_interfaces/interface_container.hpp" #include "specfem_mpi/interface.hpp" -namespace specfem { -namespace IO { -namespace mesh { -namespace fortran { template specfem::mesh::interface_container - read_interfaces( + specfem::IO::mesh::fortran::read_interfaces( const int num_interfaces, std::ifstream &stream, const specfem::MPI::MPI *mpi) { @@ -21,6 +17,7 @@ namespace fortran { int medium1_ispec_l, medium2_ispec_l; specfem::mesh::interface_container interface(num_interfaces); + interface.medium1_index_mapping("medium1_index_mapping", num_interfaces); interface.medium2_index_mapping("medium2_index_mapping", num_interfaces); @@ -34,6 +31,38 @@ namespace fortran { return interface; } + // Explicit instantiation of the template function for the different medium interfaces + // elastic/acoustic + template specfem::mesh::interface_container< + specfem::element::medium_tag::elastic, + specfem::element::medium_tag::acoustic + > specfem::IO::mesh::fortran::read_interfaces< + specfem::element::medium_tag::elastic, + specfem::element::medium_tag::acoustic + >(const int num_interfaces, std::ifstream &stream, + const specfem::MPI::MPI *mpi) {}; + + // acoustic/poroelastic + template specfem::mesh::interface_container< + specfem::element::medium_tag::acoustic, + specfem::element::medium_tag::poroelastic + > specfem::IO::mesh::fortran::read_interfaces< + specfem::element::medium_tag::acoustic, + specfem::element::medium_tag::poroelastic + >(const int num_interfaces, std::ifstream &stream, + const specfem::MPI::MPI *mpi) {}; + + // elastic/poroelastic + template specfem::mesh::interface_container< + specfem::element::medium_tag::elastic, + specfem::element::medium_tag::poroelastic + > specfem::IO::mesh::fortran::read_interfaces< + specfem::element::medium_tag::elastic, + specfem::element::medium_tag::poroelastic + >(const int num_interfaces, std::ifstream &stream, + const specfem::MPI::MPI *mpi) {}; + + specfem::mesh::coupled_interfaces read_coupled_interfaces ( std::ifstream &stream, const int num_interfaces_elastic_acoustic, diff --git a/src/IO/mesh/fortran/read_material_properties.cpp b/src/IO/mesh/fortran/read_material_properties.cpp index e145628f..b0c461ea 100644 --- a/src/IO/mesh/fortran/read_material_properties.cpp +++ b/src/IO/mesh/fortran/read_material_properties.cpp @@ -1,11 +1,17 @@ -#include "fortranio/interface.hpp" +#include "IO/fortranio/fortran_io.hpp" #include "specfem_mpi/interface.hpp" #include "utilities/interface.hpp" -#include "material/material.hpp" +#include "mesh/materials/materials.hpp" #include "mesh/IO/fortran/read_material_properties.hpp" #include #include +namespace { + +constexpr auto elastic = specfem::element::medium_tag::elastic; +constexpr auto isotropic = specfem::element::property_tag::isotropic; +constexpr auto acoustic = specfem::element::medium_tag::acoustic; + struct input_holder { // Struct to hold temporary variables read from database file @@ -14,15 +20,19 @@ struct input_holder { int n, indic; }; -std::vector> -specfem::IO::mesh::fortran::read_material_properties( - std::ifstream &stream, const int numat, const specfem::MPI::MPI *mpi) { +std::vector read_materials( + std::ifstream &stream, const int numat, + specfem::mesh::materials::material &elastic_isotropic, + specfem::mesh::materials::material &acoustic_isotropic, + const specfem::MPI::MPI *mpi) { input_holder read_values; - std::vector > materials(numat); - std::ostringstream message; + + std::vector index_mapping( + numat); + message << "Material systems:\n" << "------------------------------"; @@ -31,9 +41,23 @@ specfem::IO::mesh::fortran::read_material_properties( if (mpi->get_rank() == 0) std::cout << "Number of material systems = " << numat << "\n\n"; + std::vector > + l_elastic_isotropic; + + l_elastic_isotropic.reserve(numat); + + int index_elastic_isotropic = 0; + + std::vector > + l_acoustic_isotropic; + + l_acoustic_isotropic.reserve(numat); + + int index_acoustic_isotropic = 0; + for (int i = 0; i < numat; i++) { - specfem::fortran_IO::fortran_read_line( + specfem::IO::fortran_read_line( stream, &read_values.n, &read_values.indic, &read_values.val0, &read_values.val1, &read_values.val2, &read_values.val3, &read_values.val4, &read_values.val5, &read_values.val6, @@ -41,9 +65,12 @@ specfem::IO::mesh::fortran::read_material_properties( &read_values.val10, &read_values.val11, &read_values.val12); if (read_values.n < 1 || read_values.n > numat) { - throw std::runtime_error("Wrong material set number"); + throw std::runtime_error( + "Wrong material set number. Check database file."); } + assert(read_values.n == i + 1); + if (read_values.indic == 1) { // Acoustic Material if (read_values.val2 == 0) { @@ -52,32 +79,161 @@ specfem::IO::mesh::fortran::read_material_properties( const type_real compaction_grad = read_values.val3; const type_real Qkappa = read_values.val5; const type_real Qmu = read_values.val6; - std::shared_ptr acoustic_holder = - std::make_shared( - density, cp, Qkappa, Qmu, compaction_grad); - materials[read_values.n - 1] = acoustic_holder; + specfem::material::material acoustic_holder( + density, cp, Qkappa, Qmu, compaction_grad); + + acoustic_holder.print(); + + l_acoustic_isotropic.push_back(acoustic_holder); + + index_mapping[i] = specfem::mesh::materials::material_specification( + specfem::element::medium_tag::acoustic, + specfem::element::property_tag::isotropic, + index_acoustic_isotropic); + + index_acoustic_isotropic++; + } else { + const type_real density = read_values.val0; const type_real cp = read_values.val1; const type_real cs = read_values.val2; const type_real compaction_grad = read_values.val3; const type_real Qkappa = read_values.val5; const type_real Qmu = read_values.val6; - std::shared_ptr elastic_holder = - std::make_shared( - density, cs, cp, Qkappa, Qmu, compaction_grad); - materials[read_values.n - 1] = elastic_holder; + + specfem::material::material elastic_holder( + density, cs, cp, Qkappa, Qmu, compaction_grad); + + elastic_holder.print(); + + l_elastic_isotropic.push_back(elastic_holder); + + index_mapping[i] = specfem::mesh::materials::material_specification( + specfem::element::medium_tag::elastic, + specfem::element::property_tag::isotropic, index_elastic_isotropic); + + index_elastic_isotropic++; } } else { - throw std::runtime_error( - "Error reading material properties. Invalid material type"); + throw std::runtime_error("Material type not supported"); + } + } + + assert(l_elastic_isotropic.size() + l_acoustic_isotropic.size() == numat); + + elastic_isotropic = specfem::mesh::materials::material( + l_elastic_isotropic.size(), l_elastic_isotropic); + + acoustic_isotropic = specfem::mesh::materials::material( + l_acoustic_isotropic.size(), l_acoustic_isotropic); + + return index_mapping; +} + +void read_material_indices( + std::ifstream &stream, const int nspec, const int numat, + const std::vector + &index_mapping, + const specfem::kokkos::HostView1d< + specfem::mesh::materials::material_specification> + material_index_mapping, + const specfem::kokkos::HostView2d knods, + const specfem::MPI::MPI *mpi) { + + const int ngnod = knods.extent(0); + + int n, kmato_read, pml_read; + + std::vector knods_read(ngnod, -1); + + for (int ispec = 0; ispec < nspec; ispec++) { + // format: #element_id #material_id #node_id1 #node_id2 #... + specfem::IO::fortran_read_line(stream, &n, &kmato_read, &knods_read, + &pml_read); + + if (n < 1 || n > nspec) { + throw std::runtime_error("Error reading material indices"); } + + if (kmato_read < 1 || kmato_read > numat) { + throw std::runtime_error("Error reading material indices"); + } + + for (int i = 0; i < ngnod; i++) { + if (knods_read[i] == 0) + throw std::runtime_error("Error reading knods (node_id) values"); + + knods(i, n - 1) = knods_read[i] - 1; + } + + material_index_mapping(n - 1) = index_mapping[kmato_read - 1]; } - for (int i = 0; i < materials.size(); i++) { - mpi->cout(materials[i]->print()); + return; +} + + +void read_material_indices( + std::ifstream &stream, const int nspec, const int numat, + const std::vector + &index_mapping, + const specfem::kokkos::HostView1d< + specfem::mesh::materials::material_specification> + material_index_mapping, + const specfem::kokkos::HostView2d knods, + const specfem::MPI::MPI *mpi) { + + const int ngnod = knods.extent(0); + int n, kmato_read, pml_read; + + std::vector knods_read(ngnod, -1); + + for (int ispec = 0; ispec < nspec; ispec++) { + // format: #element_id #material_id #node_id1 #node_id2 #... + specfem::IO::fortran_read_line(stream, &n, &kmato_read, &knods_read, + &pml_read); + + if (n < 1 || n > nspec) { + throw std::runtime_error("Error reading material indices"); + } + + if (kmato_read < 1 || kmato_read > numat) { + throw std::runtime_error("Error reading material indices"); + } + + for (int i = 0; i < ngnod; i++) { + if (knods_read[i] == 0) + throw std::runtime_error("Error reading knods (node_id) values"); + + knods(i, n - 1) = knods_read[i] - 1; + } + + material_index_mapping(n - 1) = index_mapping[kmato_read - 1]; } + return; +} + +specfem::mesh::materials specfem::IO:mesh:fortran::read_material_properties( + std::ifstream &stream, const int numat, const int nspec, + const specfem::kokkos::HostView2d knods, const specfem::MPI::MPI *mpi) + : n_materials(numat), + material_index_mapping("specfem::mesh::material_index_mapping", nspec) { + + specfem:mesh::materials materials(nspec, knods); + + // Read material properties + auto index_mapping = read_materials(stream, numat, materials.elastic_isotropic, + materials.acoustic_isotropic, mpi); + + // Read material indices + read_material_indices(stream, nspec, numat, index_mapping, + materials.material_index_mapping, knods, mpi); + return materials; } + + +} // namespace \ No newline at end of file diff --git a/src/IO/mesh/fortran/read_mesh_database.cpp b/src/IO/mesh/fortran/read_mesh_database.cpp index 5729102c..8fd05e98 100644 --- a/src/IO/mesh/fortran/read_mesh_database.cpp +++ b/src/IO/mesh/fortran/read_mesh_database.cpp @@ -1,4 +1,4 @@ -#include "mesh/IO/fortran/read_mesh_database.hpp" +#include "IO/mesh/fortran/read_mesh_database.hpp" #include "IO/fortranio/interface.hpp" #include "kokkos_abstractions.h" // #include "mesh/IO/fortran/read_material_properties.hpp" diff --git a/src/IO/mesh/read_mesh.cpp b/src/IO/mesh/read_mesh.cpp index 46f6bfd0..590e6bc6 100644 --- a/src/IO/mesh/read_mesh.cpp +++ b/src/IO/mesh/read_mesh.cpp @@ -3,7 +3,13 @@ #include "enumerations/specfem_enums.hpp" #include "kokkos_abstractions.h" #include "material/material.hpp" -#include "mesh/IO/fortran/read_mesh_database.hpp" +#include "IO/mesh/read_mesh.hpp" +#include "IO/mesh/fortran/read_mesh_database.hpp" +#include "IO/mesh/fortran/read_material_properties.hpp" +#include "IO/mesh/fortran/read_interfaces.hpp" +#include "IO/mesh/fortran/read_boundaries.hpp" +#include "IO/mesh/fortran/read_elements.hpp" +#include "IO/mesh/fortran/read_material_properties.hpp" #include "specfem_mpi/interface.hpp" #include "specfem_setup.hpp" #include @@ -24,7 +30,7 @@ specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, try { auto [nspec, npgeo, nproc] = - specfem::mesh::IO::fortran::read_mesh_database_header(stream, mpi); + specfem::IO::mesh::fortran::read_mesh_database_header(stream, mpi); } catch (std::runtime_error &e) { throw; } @@ -33,7 +39,7 @@ specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, specfem::mesh::mesh mesh(); try { - auto mesh->control_nodes.coord = specfem::mesh::IO::fortran::read_coorg_elements( + auto mesh->control_nodes.coord = specfem::IO::mesh::fortran::read_coorg_elements( stream, npgeo, mpi); } catch (std::runtime_error &e) { throw; @@ -223,5 +229,5 @@ std::string specfem::mesh::mesh::print() const { << n_acoustic << "\n" << "Total number of geometric points : " << this->npgeo << "\n"; - return message.str(); + return mesh; } diff --git a/src/mesh/materials/materials.cpp b/src/mesh/materials/materials.cpp index 387e47e3..2ad766f1 100644 --- a/src/mesh/materials/materials.cpp +++ b/src/mesh/materials/materials.cpp @@ -4,18 +4,10 @@ #include "mesh/materials/materials.tpp" #include -namespace { +// Anonymous namespace to hide internal functions, and help the compiler. + -constexpr auto elastic = specfem::element::medium_tag::elastic; -constexpr auto isotropic = specfem::element::property_tag::isotropic; -constexpr auto acoustic = specfem::element::medium_tag::acoustic; -struct input_holder { - // Struct to hold temporary variables read from database file - type_real val0, val1, val2, val3, val4, val5, val6, val7, val8, val9, val10, - val11, val12; - int n, indic; -}; std::vector read_materials( std::ifstream &stream, const int numat, @@ -129,46 +121,6 @@ std::vector read_materials( return index_mapping; } -void read_material_indices( - std::ifstream &stream, const int nspec, const int numat, - const std::vector - &index_mapping, - const specfem::kokkos::HostView1d< - specfem::mesh::materials::material_specification> - material_index_mapping, - const specfem::kokkos::HostView2d knods, - const specfem::MPI::MPI *mpi) { - - const int ngnod = knods.extent(0); - int n, kmato_read, pml_read; - - std::vector knods_read(ngnod, -1); - - for (int ispec = 0; ispec < nspec; ispec++) { - // format: #element_id #material_id #node_id1 #node_id2 #... - specfem::IO::fortran_read_line(stream, &n, &kmato_read, &knods_read, - &pml_read); - - if (n < 1 || n > nspec) { - throw std::runtime_error("Error reading material indices"); - } - - if (kmato_read < 1 || kmato_read > numat) { - throw std::runtime_error("Error reading material indices"); - } - - for (int i = 0; i < ngnod; i++) { - if (knods_read[i] == 0) - throw std::runtime_error("Error reading knods (node_id) values"); - - knods(i, n - 1) = knods_read[i] - 1; - } - - material_index_mapping(n - 1) = index_mapping[kmato_read - 1]; - } - - return; -} } // namespace // specfem::mesh::material_ind::material_ind(const int nspec, const int ngnod) { diff --git a/src/specfem2d.cpp b/src/specfem2d.cpp index 7834715d..c3ef04e6 100644 --- a/src/specfem2d.cpp +++ b/src/specfem2d.cpp @@ -8,6 +8,7 @@ #include "solver/solver.hpp" #include "source/interface.hpp" #include "specfem_mpi/interface.hpp" +#include "IO/mesh/read_mesh.hpp" #include "specfem_setup.hpp" #include "timescheme/timescheme.hpp" #include "yaml-cpp/yaml.h" @@ -97,7 +98,7 @@ void execute(const std::string ¶meter_file, const std::string &default_file, // Read mesh and materials // -------------------------------------------------------------- const auto quadrature = setup.instantiate_quadrature(); - const specfem::mesh::mesh mesh(database_filename, mpi); + const specfem::mesh::mesh specfem::IO::read_mesh(database_filename, mpi); // -------------------------------------------------------------- // -------------------------------------------------------------- From 6611553319c42267a9be69c659a6a85b4a69a728 Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Wed, 30 Oct 2024 12:58:15 -0400 Subject: [PATCH 05/53] Added display section to runtime configuration --- CMakeLists.txt | 1 + include/enumerations/display.hpp | 10 +++ include/parameter_parser/setup.hpp | 13 ++++ .../writer/plot_wavefield.hpp | 31 ++++++++ include/writer/plot_wavefield.hpp | 22 ++++++ src/parameter_parser/setup.cpp | 17 +++++ .../writer/plot_wavefield.cpp | 75 +++++++++++++++++++ src/writer/plot_wavefield.cpp | 0 8 files changed, 169 insertions(+) create mode 100644 include/enumerations/display.hpp create mode 100644 include/parameter_parser/writer/plot_wavefield.hpp create mode 100644 include/writer/plot_wavefield.hpp create mode 100644 src/parameter_parser/writer/plot_wavefield.cpp create mode 100644 src/writer/plot_wavefield.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 65ddcee0..1b2be8f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -460,6 +460,7 @@ add_library( src/parameter_parser/writer/seismogram.cpp src/parameter_parser/setup.cpp src/parameter_parser/writer/wavefield.cpp + src/parameter_parser/writer/plot_wavefield.cpp src/parameter_parser/writer/kernel.cpp ) diff --git a/include/enumerations/display.hpp b/include/enumerations/display.hpp new file mode 100644 index 00000000..6d6dcc23 --- /dev/null +++ b/include/enumerations/display.hpp @@ -0,0 +1,10 @@ +#pragma once + +namespace specfem { +namespace display { + +enum class format { PNG, JPG }; + +enum class wavefield { displacement, velocity, acceleration }; +} // namespace display +} // namespace specfem diff --git a/include/parameter_parser/setup.hpp b/include/parameter_parser/setup.hpp index 678ee67f..db706e00 100644 --- a/include/parameter_parser/setup.hpp +++ b/include/parameter_parser/setup.hpp @@ -11,6 +11,7 @@ #include "specfem_setup.hpp" #include "time_scheme/interface.hpp" #include "writer/kernel.hpp" +#include "writer/plot_wavefield.hpp" #include "writer/seismogram.hpp" #include "writer/wavefield.hpp" #include "yaml-cpp/yaml.h" @@ -159,6 +160,15 @@ class setup { } } + std::shared_ptr instantiate_wavefield_plotter( + const specfem::compute::assembly &assembly) const { + if (this->plot_wavefield) { + return this->plot_wavefield->instantiate_wavefield_plotter(assembly); + } else { + return nullptr; + } + } + std::shared_ptr instantiate_kernel_writer(const specfem::compute::assembly &assembly) const { if (this->kernel) { @@ -203,6 +213,9 @@ class setup { std::unique_ptr wavefield; ///< Pointer to ///< wavefield object + std::unique_ptr + plot_wavefield; ///< Pointer to + ///< plot_wavefield object std::unique_ptr kernel; std::unique_ptr databases; ///< Get database filenames diff --git a/include/parameter_parser/writer/plot_wavefield.hpp b/include/parameter_parser/writer/plot_wavefield.hpp new file mode 100644 index 00000000..41cf19ea --- /dev/null +++ b/include/parameter_parser/writer/plot_wavefield.hpp @@ -0,0 +1,31 @@ +#pragma once + +#include "compute/assembly/assembly.hpp" +#include "enumerations/display.hpp" +#include "writer/writer.hpp" +#include "yaml-cpp/yaml.h" +#include + +namespace specfem { +namespace runtime_configuration { +class plot_wavefield { + +public: + plot_wavefield(const std::string output_format, + const std::string output_folder, + const std::string wavefield_type) + : output_format(output_format), output_folder(output_folder), + wavefield_type(wavefield_type) {} + + plot_wavefield(const YAML::Node &Node); + + std::shared_ptr instantiate_wavefield_plotter( + const specfem::compute::assembly &assembly) const; + +private: + std::string output_format; ///< format of output file + std::string output_folder; ///< Path to output folder + std::string wavefield_type; ///< Type of wavefield to plot +}; +} // namespace runtime_configuration +} // namespace specfem diff --git a/include/writer/plot_wavefield.hpp b/include/writer/plot_wavefield.hpp new file mode 100644 index 00000000..b96fec80 --- /dev/null +++ b/include/writer/plot_wavefield.hpp @@ -0,0 +1,22 @@ +#pragma once + +#include "enumerations/display.hpp" + +namespace specfem { +namespace writer { +class plot_wavefield : public writer { +public: + plot_wavefield(const specfem::compute::assembly &assembly, + const specfem::display::format &output_format, + const specfem::display::wavefield &wavefield_type, + const std::string &output_folder) + : output_format(output_format), wavefield_type(wavefield_type), + output_folder(output_folder) {} + +private: + specfem::display::format output_format; + specfem::display::wavefield wavefield_type; + std::string output_folder; +}; +} // namespace writer +} // namespace specfem diff --git a/src/parameter_parser/setup.cpp b/src/parameter_parser/setup.cpp index 46db13dc..275fb4f4 100644 --- a/src/parameter_parser/setup.cpp +++ b/src/parameter_parser/setup.cpp @@ -120,6 +120,15 @@ specfem::runtime_configuration::setup::setup(const std::string ¶meter_file, this->wavefield = nullptr; } + if (const YAML::Node &n_plotter = n_writer["display"]) { + at_least_one_writer = true; + this->plot_wavefield = + std::make_unique( + n_plotter); + } else { + this->plot_wavefield = nullptr; + } + this->kernel = nullptr; if (!at_least_one_writer) { @@ -186,6 +195,14 @@ specfem::runtime_configuration::setup::setup(const std::string ¶meter_file, throw std::runtime_error(message.str()); } + + if (const YAML::Node &n_plotter = n_writer["display"]) { + this->plot_wavefield = + std::make_unique( + n_plotter); + } else { + this->plot_wavefield = nullptr; + } } } diff --git a/src/parameter_parser/writer/plot_wavefield.cpp b/src/parameter_parser/writer/plot_wavefield.cpp new file mode 100644 index 00000000..1c9b8a2c --- /dev/null +++ b/src/parameter_parser/writer/plot_wavefield.cpp @@ -0,0 +1,75 @@ +#include "parameter_parser/writer/plot_wavefield.hpp" +#include "writer/plot_wavefield.hpp" +#include "writer/writer.hpp" +#include + +specfem::runtime_configuration::plot_wavefield::plot_wavefield( + const YAML::Node &Node) { + + const std::string output_format = [&]() -> std::string { + if (Node["format"]) { + return Node["format"].as(); + } else { + return "PNG"; + } + }(); + + const std::string output_folder = [&]() -> std::string { + if (Node["directory"]) { + return Node["directory"].as(); + } else { + return boost::filesystem::current_path().string(); + } + }(); + + if (!boost::filesystem::is_directory( + boost::filesystem::path(output_folder))) { + std::ostringstream message; + message << "Output folder : " << output_folder << " does not exist."; + throw std::runtime_error(message.str()); + } + + const std::string wavefield_type = [&]() -> std::string { + if (Node["type"]) { + return Node["type"].as(); + } else { + throw std::runtime_error( + "Display type not specified in plotter configuration"); + } + }(); + + *this = specfem::runtime_configuration::plot_wavefield( + output_format, output_folder, wavefield_type); + + return; +} + +std::shared_ptr +specfem::runtime_configuration::plot_wavefield::instantiate_wavefield_plotter( + const specfem::compute::assembly &assembly) const { + + const auto output_format = [&]() { + if (this->output_format == "PNG") { + return specfem::display::format::PNG; + } else if (this->output_format == "JPG") { + return specfem::display::format::JPG; + } else { + throw std::runtime_error("Unknown plotter format"); + } + }(); + + const auto wavefield_type = [&]() { + if (this->wavefield_type == "displacement") { + return specfem::display::wavefield::displacement; + } else if (this->wavefield_type == "velocity") { + return specfem::display::wavefield::velocity; + } else if (this->wavefield_type == "acceleration") { + return specfem::display::wavefield::acceleration; + } else { + throw std::runtime_error("Unknown wavefield type"); + } + }(); + + return std::make_shared( + assembly, output_format, wavefield_type, this->output_folder); +} diff --git a/src/writer/plot_wavefield.cpp b/src/writer/plot_wavefield.cpp new file mode 100644 index 00000000..e69de29b From aef92d1d55e2a95b1562c096792993e3250727b2 Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Wed, 30 Oct 2024 15:21:35 -0400 Subject: [PATCH 06/53] Documentation update --- docs/api/setup_parameters/display.rst | 8 ++++ docs/api/setup_parameters/index.rst | 2 + .../api/setup_parameters/wavefield_writer.rst | 6 +++ .../writer/plot_wavefield.hpp | 30 +++++++++++++++ include/parameter_parser/writer/wavefield.hpp | 38 +++++++++++++++++++ 5 files changed, 84 insertions(+) create mode 100644 docs/api/setup_parameters/display.rst create mode 100644 docs/api/setup_parameters/wavefield_writer.rst diff --git a/docs/api/setup_parameters/display.rst b/docs/api/setup_parameters/display.rst new file mode 100644 index 00000000..8cfbf005 --- /dev/null +++ b/docs/api/setup_parameters/display.rst @@ -0,0 +1,8 @@ + +Display Parameters +================== + +Plotting parameters for the wavefield. + +.. doxygenclass:: specfem::runtime_configuration::plot_wavefield + :members: diff --git a/docs/api/setup_parameters/index.rst b/docs/api/setup_parameters/index.rst index 31dae51c..ee7ef4fd 100644 --- a/docs/api/setup_parameters/index.rst +++ b/docs/api/setup_parameters/index.rst @@ -16,4 +16,6 @@ Methods used to read the runtime configuration file and set up the simulation. E run_setup database_configuration seismogram + wavefield_writer + display setup diff --git a/docs/api/setup_parameters/wavefield_writer.rst b/docs/api/setup_parameters/wavefield_writer.rst new file mode 100644 index 00000000..586674b5 --- /dev/null +++ b/docs/api/setup_parameters/wavefield_writer.rst @@ -0,0 +1,6 @@ + +Wavefield Writer Parameters +=========================== + +.. doxygenclass:: specfem::runtime_configuration::wavefield_writer + :members: diff --git a/include/parameter_parser/writer/plot_wavefield.hpp b/include/parameter_parser/writer/plot_wavefield.hpp index 41cf19ea..1447dc77 100644 --- a/include/parameter_parser/writer/plot_wavefield.hpp +++ b/include/parameter_parser/writer/plot_wavefield.hpp @@ -8,17 +8,47 @@ namespace specfem { namespace runtime_configuration { +/** + * @brief Runtime configuration class for instantiating wavefield plotter + * + */ class plot_wavefield { public: + /** + * @name Constructors + * + */ + ///@{ + /** + * @brief Construct a new plotter configuration object + * + * @param output_format output format for the resulting plot (PNG, JPG) + * @param output_folder path to the folder where the plot will be stored + * @param wavefield_type type of wavefield to plot (displacement, velocity, + * acceleration) + */ plot_wavefield(const std::string output_format, const std::string output_folder, const std::string wavefield_type) : output_format(output_format), output_folder(output_folder), wavefield_type(wavefield_type) {} + /** + * @brief Construct a new plotter configuration object from YAML node + * + * @param Node YAML node describing the plotter configuration + */ plot_wavefield(const YAML::Node &Node); + ///@} + /** + * @brief Instantiate a wavefield plotter object + * + * @param assembly SPECFEM++ assembly object + * @return std::shared_ptr Pointer to an instantiated + * plotter object + */ std::shared_ptr instantiate_wavefield_plotter( const specfem::compute::assembly &assembly) const; diff --git a/include/parameter_parser/writer/wavefield.hpp b/include/parameter_parser/writer/wavefield.hpp index a29474ee..5884a359 100644 --- a/include/parameter_parser/writer/wavefield.hpp +++ b/include/parameter_parser/writer/wavefield.hpp @@ -8,19 +8,57 @@ namespace specfem { namespace runtime_configuration { + +/** + * @brief Wavefield configuration class is used to instantiate wavefield writers + * + */ class wavefield { public: + /** + * @name Constructors + * + */ + ///@{ + /** + * @brief Construct a new wavefield configuration object + * + * @param output_format Output wavefield file format + * @param output_folder Path to folder location where wavefield will be stored + * @param type Type of simulation (forward or adjoint) + */ wavefield(const std::string output_format, const std::string output_folder, const specfem::simulation::type type) : output_format(output_format), output_folder(output_folder), simulation_type(type) {} + /** + * @brief Construct a new wavefield configuration object from YAML node + * + * @param Node YAML node describing the wavefield writer + * @param type Type of simulation (forward or adjoint) + */ wavefield(const YAML::Node &Node, const specfem::simulation::type type); + ///@} + /** + * @brief Instantiate a wavefield writer object + * + * @param assembly SPECFEM++ assembly object + * @return std::shared_ptr Pointer to an instantiated + * writer object + */ std::shared_ptr instantiate_wavefield_writer( const specfem::compute::assembly &assembly) const; + /** + * @brief Instantiate a wavefield reader object + * + * @param assembly SPECFEM++ assembly object + * @return std::shared_ptr Pointer to an instantiated + * reader object + */ std::shared_ptr instantiate_wavefield_reader( const specfem::compute::assembly &assembly) const; From 12481d06fda60707e13ae5584df3e3e535770961 Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Wed, 30 Oct 2024 15:28:13 -0400 Subject: [PATCH 07/53] Fixed broken links --- docs/api/setup_parameters/wavefield_writer.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/api/setup_parameters/wavefield_writer.rst b/docs/api/setup_parameters/wavefield_writer.rst index 586674b5..a8714c55 100644 --- a/docs/api/setup_parameters/wavefield_writer.rst +++ b/docs/api/setup_parameters/wavefield_writer.rst @@ -1,6 +1,6 @@ -Wavefield Writer Parameters -=========================== +Wavefield Writer/Reader Parameters +================================== -.. doxygenclass:: specfem::runtime_configuration::wavefield_writer +.. doxygenclass:: specfem::runtime_configuration::wavefield :members: From dfcf97fa39fa678379d8a84108da9f7d93ee40a6 Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Fri, 1 Nov 2024 10:10:13 -0400 Subject: [PATCH 08/53] Added write method for the plotter --- CMakeLists.txt | 28 +++ include/compute/assembly/assembly.hpp | 19 ++ include/enumerations/display.hpp | 10 +- .../writer/plot_wavefield.hpp | 5 +- include/writer/plot_wavefield.hpp | 20 ++- .../writer/plot_wavefield.cpp | 54 ++++-- src/writer/plot_wavefield.cpp | 166 ++++++++++++++++++ 7 files changed, 281 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b2be8f1..72dd28ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,7 @@ project(specfem2d_kokkos VERSION 0.1.0) set(CMAKE_CXX_STANDARD 17) option(HDF5_CXX_BUILD "Build HDF5 C++" ON) +option(VTK_CXX_BUILD "Build VTK C++" ON) option(MPI_PARALLEL "MPI enabled" OFF) option(BUILD_TESTS "Tests included" OFF) option(BUILD_EXAMPLES "Examples included" OFF) @@ -48,6 +49,31 @@ FetchContent_MakeAvailable(yaml) include_directories(BEFORE SYSTEM ${yaml_BINARY_DIR} ${yaml_SOURCE_DIR}/include) +# # Add VTK as a dependency using FetchContent_Declare +# FetchContent_Declare( +# vtk +# GIT_REPOSITORY https://gitlab.kitware.com/vtk/vtk.git +# GIT_TAG v9.3.1 +# ) +# FetchContent_MakeAvailable(vtk) + +find_package(VTK COMPONENTS + CommonColor + CommonCore + FiltersSources + InteractionStyle + RenderingContextOpenGL2 + RenderingCore + RenderingFreeType + RenderingGL2PSOpenGL2 + RenderingOpenGL2 +) + +message(STATUS " LIB: ${VTK_LIBRARIES}") +message(STATUS " INC: ${VTK_INCLUDE_DIRS}") +message(STATUS " LIBSO: ${VTK_LIBRARIES}") + + # Try finding boost and if not found install. find_package(Boost 1.73.0 COMPONENTS program_options filesystem system) @@ -439,6 +465,7 @@ add_library( src/writer/seismogram.cpp src/writer/wavefield.cpp src/writer/kernel.cpp + src/writer/plot_wavefield.cpp ) target_link_libraries( @@ -446,6 +473,7 @@ target_link_libraries( compute receiver_class IO + ${VTK_LIBRARIES} ) add_library( diff --git a/include/compute/assembly/assembly.hpp b/include/compute/assembly/assembly.hpp index 91b61b76..ca08f597 100644 --- a/include/compute/assembly/assembly.hpp +++ b/include/compute/assembly/assembly.hpp @@ -12,6 +12,7 @@ #include "compute/kernels/kernels.hpp" #include "compute/properties/interface.hpp" #include "compute/sources/sources.hpp" +#include "enumerations/display.hpp" #include "enumerations/specfem_enums.hpp" #include "mesh/mesh.hpp" #include "receiver/interface.hpp" @@ -74,6 +75,24 @@ struct assembly { const std::vector &stypes, const type_real t0, const type_real dt, const int max_timesteps, const int max_sig_step, const specfem::simulation::type simulation); + + /** + * @brief Maps the component of wavefield on the entire spectral element grid + * + * This field can be used to generate a plot of the wavefield + * + * @param component Component of the wavefield to map + * @return Kokkos::View + * Wavefield mapped on the entire grid. Dimensions of the view are nspec, + * ngllz, ngllx + */ + Kokkos::View + generate_wavefield_on_entire_grid( + const specfem::display::wavefield &component) const { + // dummy implementation + return Kokkos::View( + "result", mesh.nspec, mesh.ngllz, mesh.ngllx); + }; }; } // namespace compute diff --git a/include/enumerations/display.hpp b/include/enumerations/display.hpp index 6d6dcc23..9605dbce 100644 --- a/include/enumerations/display.hpp +++ b/include/enumerations/display.hpp @@ -5,6 +5,14 @@ namespace display { enum class format { PNG, JPG }; -enum class wavefield { displacement, velocity, acceleration }; +enum class wavefield { + displacement_x, + displacement_z, + velocity_x, + velocity_z, + acceleration_x, + acceleration_z, + pressure +}; } // namespace display } // namespace specfem diff --git a/include/parameter_parser/writer/plot_wavefield.hpp b/include/parameter_parser/writer/plot_wavefield.hpp index 1447dc77..fb585a5a 100644 --- a/include/parameter_parser/writer/plot_wavefield.hpp +++ b/include/parameter_parser/writer/plot_wavefield.hpp @@ -29,10 +29,10 @@ class plot_wavefield { * acceleration) */ plot_wavefield(const std::string output_format, - const std::string output_folder, + const std::string output_folder, const std::string component, const std::string wavefield_type) : output_format(output_format), output_folder(output_folder), - wavefield_type(wavefield_type) {} + component(component), wavefield_type(wavefield_type) {} /** * @brief Construct a new plotter configuration object from YAML node @@ -55,6 +55,7 @@ class plot_wavefield { private: std::string output_format; ///< format of output file std::string output_folder; ///< Path to output folder + std::string component; ///< Component of the wavefield to plot std::string wavefield_type; ///< Type of wavefield to plot }; } // namespace runtime_configuration diff --git a/include/writer/plot_wavefield.hpp b/include/writer/plot_wavefield.hpp index b96fec80..a43a0f89 100644 --- a/include/writer/plot_wavefield.hpp +++ b/include/writer/plot_wavefield.hpp @@ -1,6 +1,10 @@ #pragma once +#include "compute/assembly/assembly.hpp" #include "enumerations/display.hpp" +#include "enumerations/wavefield.hpp" +#include "writer.hpp" +#include namespace specfem { namespace writer { @@ -8,15 +12,21 @@ class plot_wavefield : public writer { public: plot_wavefield(const specfem::compute::assembly &assembly, const specfem::display::format &output_format, - const specfem::display::wavefield &wavefield_type, + const specfem::display::wavefield &component, + const specfem::wavefield::type &wavefield, const std::string &output_folder) - : output_format(output_format), wavefield_type(wavefield_type), - output_folder(output_folder) {} + : output_format(output_format), component(component), + output_folder(output_folder), wavefield(wavefield), assembly(assembly) { + } + + void write() override; private: specfem::display::format output_format; - specfem::display::wavefield wavefield_type; - std::string output_folder; + specfem::display::wavefield component; + specfem::wavefield::type wavefield; + boost::filesystem::path output_folder; + specfem::compute::assembly assembly; }; } // namespace writer } // namespace specfem diff --git a/src/parameter_parser/writer/plot_wavefield.cpp b/src/parameter_parser/writer/plot_wavefield.cpp index 1c9b8a2c..bf4b1c1b 100644 --- a/src/parameter_parser/writer/plot_wavefield.cpp +++ b/src/parameter_parser/writer/plot_wavefield.cpp @@ -29,17 +29,26 @@ specfem::runtime_configuration::plot_wavefield::plot_wavefield( throw std::runtime_error(message.str()); } + const std::string component = [&]() -> std::string { + if (Node["component"]) { + return Node["component"].as(); + } else { + throw std::runtime_error( + "Wavefield component not specified in the display section"); + } + }(); + const std::string wavefield_type = [&]() -> std::string { - if (Node["type"]) { - return Node["type"].as(); + if (Node["wavefield_type"]) { + return Node["wavefield_type"].as(); } else { throw std::runtime_error( - "Display type not specified in plotter configuration"); + "Wavefield type not specified in the display section"); } }(); *this = specfem::runtime_configuration::plot_wavefield( - output_format, output_folder, wavefield_type); + output_format, output_folder, component, wavefield_type); return; } @@ -58,18 +67,37 @@ specfem::runtime_configuration::plot_wavefield::instantiate_wavefield_plotter( } }(); - const auto wavefield_type = [&]() { - if (this->wavefield_type == "displacement") { - return specfem::display::wavefield::displacement; - } else if (this->wavefield_type == "velocity") { - return specfem::display::wavefield::velocity; - } else if (this->wavefield_type == "acceleration") { - return specfem::display::wavefield::acceleration; + const auto component = [&]() { + if (this->component == "displacement_x") { + return specfem::display::wavefield::displacement_x; + } else if (this->component == "displacement_z") { + return specfem::display::wavefield::displacement_z; + } else if (this->component == "velocity_x") { + return specfem::display::wavefield::velocity_x; + } else if (this->component == "velocity_z") { + return specfem::display::wavefield::velocity_z; + } else if (this->component == "acceleration_x") { + return specfem::display::wavefield::acceleration_x; + } else if (this->component == "acceleration_z") { + return specfem::display::wavefield::acceleration_z; + } else if (this->component == "pressure") { + return specfem::display::wavefield::pressure; + } else { + throw std::runtime_error( + "Unknown wavefield component in the display section"); + } + }(); + + const auto wavefield = [&]() { + if (this->wavefield_type == "forward") { + return specfem::wavefield::type::forward; + } else if (this->wavefield_type == "adjoint") { + return specfem::wavefield::type::adjoint; } else { - throw std::runtime_error("Unknown wavefield type"); + throw std::runtime_error("Unknown wavefield type in the display section"); } }(); return std::make_shared( - assembly, output_format, wavefield_type, this->output_folder); + assembly, output_format, component, wavefield, this->output_folder); } diff --git a/src/writer/plot_wavefield.cpp b/src/writer/plot_wavefield.cpp index e69de29b..6900aba8 100644 --- a/src/writer/plot_wavefield.cpp +++ b/src/writer/plot_wavefield.cpp @@ -0,0 +1,166 @@ + +#include "writer/plot_wavefield.hpp" +#include "compute/assembly/assembly.hpp" +#include "enumerations/display.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace { + +vtkSmartPointer +get_wavefield_on_vtk_grid(const specfem::compute::assembly &assembly, + const specfem::display::wavefield &component) { + + const auto &wavefield = assembly.generate_wavefield_on_entire_grid(component); + const auto &coordinates = assembly.mesh.points.h_coord; + + const int ncells = wavefield.extent(0); + const int ngllz = wavefield.extent(1); + const int ngllx = wavefield.extent(2); + + auto points = vtkSmartPointer::New(); + points->SetNumberOfPoints(ncells * 9); + auto scalars = vtkSmartPointer::New(); + scalars->SetName("Wavefield"); + scalars->SetNumberOfTuples(ncells * 9); + + auto unstructured_grid = vtkSmartPointer::New(); + + for (int icell = 0; icell < ncells; ++icell) { + auto biquad = vtkSmartPointer::New(); + // Bottom Corner + points->SetPoint(icell * ncells + 0, coordinates(icell, 0, 0, 0), 0.0, + coordinates(icell, 0, 0, 1)); + scalars->SetTuple1(icell * ncells + 0, wavefield(icell, 0, 0)); + biquad->GetPointIds()->SetId(0, icell * ncells + 0); + + // Bottom Right + points->SetPoint(icell * ncells + 1, coordinates(icell, 0, ngllx - 1, 0), + 0.0, coordinates(icell, 0, ngllx - 1, 1)); + scalars->SetTuple1(icell * ncells + 1, wavefield(icell, 0, ngllx - 1)); + biquad->GetPointIds()->SetId(1, icell * ncells + 1); + + // Top Right + points->SetPoint(icell * ncells + 2, + coordinates(icell, ngllz - 1, ngllx - 1, 0), 0.0, + coordinates(icell, ngllz - 1, ngllx - 1, 1)); + scalars->SetTuple1(icell * ncells + 2, + wavefield(icell, ngllz - 1, ngllx - 1)); + biquad->GetPointIds()->SetId(2, icell * ncells + 2); + + // Top Left + points->SetPoint(icell * ncells + 3, coordinates(icell, ngllz - 1, 0, 0), + 0.0, coordinates(icell, ngllz - 1, 0, 1)); + scalars->SetTuple1(icell * ncells + 3, wavefield(icell, ngllz - 1, 0)); + biquad->GetPointIds()->SetId(3, icell * ncells + 3); + + // Bottom middle + points->SetPoint(icell * ncells + 4, coordinates(icell, 0, ngllx / 2, 0), + 0.0, coordinates(icell, 0, ngllx / 2, 1)); + scalars->SetTuple1(icell * ncells + 4, wavefield(icell, 0, ngllx / 2)); + biquad->GetPointIds()->SetId(4, icell * ncells + 4); + + // Right middle + points->SetPoint(icell * ncells + 5, + coordinates(icell, ngllz / 2, ngllx - 1, 0), 0.0, + coordinates(icell, ngllz / 2, ngllx - 1, 1)); + scalars->SetTuple1(icell * ncells + 5, + wavefield(icell, ngllz / 2, ngllx - 1)); + biquad->GetPointIds()->SetId(5, icell * ncells + 5); + + // Top middle + points->SetPoint(icell * ncells + 6, + coordinates(icell, ngllz - 1, ngllx / 2, 0), 0.0, + coordinates(icell, ngllz - 1, ngllx / 2, 1)); + scalars->SetTuple1(icell * ncells + 6, + wavefield(icell, ngllz - 1, ngllx / 2)); + biquad->GetPointIds()->SetId(6, icell * ncells + 6); + + // Left middle + points->SetPoint(icell * ncells + 7, coordinates(icell, ngllz / 2, 0, 0), + 0.0, coordinates(icell, ngllz / 2, 0, 1)); + scalars->SetTuple1(icell * ncells + 7, wavefield(icell, ngllz / 2, 0)); + biquad->GetPointIds()->SetId(7, icell * ncells + 7); + + // Center + points->SetPoint(icell * ncells + 8, + coordinates(icell, ngllz / 2, ngllx / 2, 0), 0.0, + coordinates(icell, ngllz / 2, ngllx / 2, 1)); + scalars->SetTuple1(icell * ncells + 8, + wavefield(icell, ngllz / 2, ngllx / 2)); + biquad->GetPointIds()->SetId(8, icell * ncells + 8); + unstructured_grid->InsertNextCell(biquad->GetCellType(), + biquad->GetPointIds()); + } + + unstructured_grid->SetPoints(points); + unstructured_grid->GetPointData()->SetScalars(scalars); + + return unstructured_grid; +} +} // namespace + +void specfem::writer::plot_wavefield::write() { + + const auto unstructured_grid = + get_wavefield_on_vtk_grid(this->assembly, this->component); + + // Plot a contour plot of the wavefield + auto contour = vtkSmartPointer::New(); + contour->SetInputData(unstructured_grid); + contour->GenerateValues(10, 0.0, 1.0); + + // Create a mapper + auto mapper = vtkSmartPointer::New(); + mapper->SetInputConnection(contour->GetOutputPort()); + mapper->ScalarVisibilityOn(); + + // Create an actor + auto actor = vtkSmartPointer::New(); + actor->SetMapper(mapper); + + // Create a renderer + auto renderer = vtkSmartPointer::New(); + renderer->AddActor(actor); + renderer->SetBackground(1.0, 1.0, 1.0); + + // Create a render window + auto render_window = vtkSmartPointer::New(); + render_window->AddRenderer(renderer); + render_window->SetSize(800, 800); + + // Create an interactor + auto image_filter = vtkSmartPointer::New(); + image_filter->SetInput(render_window); + + // Save the plot + if (this->output_format == specfem::display::format::PNG) { + const auto filename = this->output_folder / "wavefield.png"; + auto writer = vtkSmartPointer::New(); + writer->SetFileName(filename.string().c_str()); + writer->SetInputConnection(image_filter->GetOutputPort()); + writer->Write(); + } else if (this->output_format == specfem::display::format::JPG) { + const auto filename = this->output_folder / "wavefield.jpg"; + auto writer = vtkSmartPointer::New(); + writer->SetFileName(filename.string().c_str()); + writer->SetInputConnection(image_filter->GetOutputPort()); + writer->Write(); + } else { + throw std::runtime_error("Unsupported output format"); + } +} From be4cc9563363a6c09807feb7c199a6689691e807 Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Fri, 1 Nov 2024 15:15:58 -0400 Subject: [PATCH 09/53] Added compiler guards for builds without VTK --- CMakeLists.txt | 52 ++++++++++++++++--------------- include/writer/plot_wavefield.hpp | 11 +++++++ src/writer/plot_wavefield.cpp | 24 ++++++++++++++ 3 files changed, 62 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 72dd28ed..0defcaf3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,29 +49,17 @@ FetchContent_MakeAvailable(yaml) include_directories(BEFORE SYSTEM ${yaml_BINARY_DIR} ${yaml_SOURCE_DIR}/include) -# # Add VTK as a dependency using FetchContent_Declare -# FetchContent_Declare( -# vtk -# GIT_REPOSITORY https://gitlab.kitware.com/vtk/vtk.git -# GIT_TAG v9.3.1 -# ) -# FetchContent_MakeAvailable(vtk) - find_package(VTK COMPONENTS CommonColor CommonCore - FiltersSources - InteractionStyle - RenderingContextOpenGL2 - RenderingCore - RenderingFreeType - RenderingGL2PSOpenGL2 - RenderingOpenGL2 ) -message(STATUS " LIB: ${VTK_LIBRARIES}") -message(STATUS " INC: ${VTK_INCLUDE_DIRS}") -message(STATUS " LIBSO: ${VTK_LIBRARIES}") +if (NOT VTK_FOUND) + message("VTK not found: ${VTK_NOT_FOUND_MESSAGE}") + set(VTK_CXX_BUILD OFF) +else () + message(STATUS " VTK: ${VTK_LIBRARIES}") +endif() # Try finding boost and if not found install. @@ -468,13 +456,27 @@ add_library( src/writer/plot_wavefield.cpp ) -target_link_libraries( - writer - compute - receiver_class - IO - ${VTK_LIBRARIES} -) +if (NOT VTK_CXX_BUILD) + target_compile_definitions( + writer + PUBLIC -DNO_VTK + ) + + target_link_libraries( + writer + compute + receiver_class + IO + ) +else () + target_link_libraries( + writer + compute + receiver_class + IO + ${VTK_LIBRARIES} + ) +endif() add_library( parameter_reader diff --git a/include/writer/plot_wavefield.hpp b/include/writer/plot_wavefield.hpp index a43a0f89..6eed0e35 100644 --- a/include/writer/plot_wavefield.hpp +++ b/include/writer/plot_wavefield.hpp @@ -5,6 +5,9 @@ #include "enumerations/wavefield.hpp" #include "writer.hpp" #include +#ifdef NO_VTK +#include +#endif namespace specfem { namespace writer { @@ -17,6 +20,14 @@ class plot_wavefield : public writer { const std::string &output_folder) : output_format(output_format), component(component), output_folder(output_folder), wavefield(wavefield), assembly(assembly) { +#ifdef NO_VTK + std::ostringstream message; + message << "Display section is not enabled, since SPECFEM++ was built " + "without VTK\n" + << "Please install VTK and rebuild SPECFEM++ with " + "-DVTK_DIR=/path/to/vtk"; + throw std::runtime_error(message.str()); +#endif } void write() override; diff --git a/src/writer/plot_wavefield.cpp b/src/writer/plot_wavefield.cpp index 6900aba8..24285f6d 100644 --- a/src/writer/plot_wavefield.cpp +++ b/src/writer/plot_wavefield.cpp @@ -2,6 +2,13 @@ #include "writer/plot_wavefield.hpp" #include "compute/assembly/assembly.hpp" #include "enumerations/display.hpp" + +#ifdef NO_VTK + +#include + +#else + #include #include #include @@ -19,6 +26,21 @@ #include #include +#endif // NO_VTK + +#ifdef NO_VTK + +void specfem::writer::plot_wavefield::write() { + std::ostringstream message; + message + << "Display section is not enabled, since SPECFEM++ was built without " + "VTK\n" + << "Please install VTK and rebuild SPECFEM++ with -DVTK_DIR=/path/to/vtk"; + throw std::runtime_error(message.str()); +} + +#else + namespace { vtkSmartPointer @@ -164,3 +186,5 @@ void specfem::writer::plot_wavefield::write() { throw std::runtime_error("Unsupported output format"); } } + +#endif // NO_VTK From 1500d42cc00c6ad70cc7b6c69c202b4154fc7e59 Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Mon, 4 Nov 2024 16:22:56 -0500 Subject: [PATCH 10/53] Added VTK tp tests and cmake --- .jenkins/gnu_compiler_checks.gvy | 2 +- .jenkins/intel_compiler_checks.gvy | 2 +- .jenkins/nvidia_compiler_checks.gvy | 2 +- CMakeLists.txt | 11 +++++++++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.jenkins/gnu_compiler_checks.gvy b/.jenkins/gnu_compiler_checks.gvy index 68c0d911..144a00ea 100644 --- a/.jenkins/gnu_compiler_checks.gvy +++ b/.jenkins/gnu_compiler_checks.gvy @@ -68,7 +68,7 @@ pipeline{ sh """ module load boost/1.73.0 module load ${GNU_COMPILER_MODULE} - cmake3 -S . -B build_cpu_${GNU_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.GIT_COMMIT} -DCMAKE_BUILD_TYPE=Release ${CMAKE_HOST_FLAGS} ${SIMD_FLAGS} -DBUILD_TESTS=ON + cmake3 -S . -B build_cpu_${GNU_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.GIT_COMMIT} -DCMAKE_BUILD_TYPE=Release ${CMAKE_HOST_FLAGS} ${SIMD_FLAGS} -DBUILD_TESTS=ON -DVTK_DIR:PATH=/home/TROMP/Modules/modulefiles-shared/vtk/build/ cmake3 --build build_cpu_${GNU_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.GIT_COMMIT} """ echo ' Build completed ' diff --git a/.jenkins/intel_compiler_checks.gvy b/.jenkins/intel_compiler_checks.gvy index f3fa66cd..75cf415e 100644 --- a/.jenkins/intel_compiler_checks.gvy +++ b/.jenkins/intel_compiler_checks.gvy @@ -69,7 +69,7 @@ pipeline{ module load ${INTEL_MODULE} export CC=icx export CXX=icpx - cmake3 -S . -B build_cpu_${INTEL_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.GIT_COMMIT} -DCMAKE_BUILD_TYPE=Release ${CMAKE_HOST_FLAGS} ${SIMD_FLAGS} -D BUILD_TESTS=ON + cmake3 -S . -B build_cpu_${INTEL_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.GIT_COMMIT} -DCMAKE_BUILD_TYPE=Release ${CMAKE_HOST_FLAGS} ${SIMD_FLAGS} -D BUILD_TESTS=ON -DVTK_DIR:PATH=/home/TROMP/Modules/modulefiles-shared/vtk/build/ cmake3 --build build_cpu_${INTEL_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.GIT_COMMIT} """ echo ' Build completed ' diff --git a/.jenkins/nvidia_compiler_checks.gvy b/.jenkins/nvidia_compiler_checks.gvy index fff1db9e..83f82ef3 100644 --- a/.jenkins/nvidia_compiler_checks.gvy +++ b/.jenkins/nvidia_compiler_checks.gvy @@ -83,7 +83,7 @@ pipeline{ sh """ module load boost/1.73.0 module load ${CUDA_MODULE} - cmake3 -S . -B build_cuda_${CUDA_COMPILER_NAME}_${CMAKE_HOST_NAME}_${CMAKE_DEVICE_NAME}_${SIMD_NAME}_${env.GIT_COMMIT} -DCMAKE_BUILD_TYPE=Release ${CMAKE_HOST_FLAGS} ${CMAKE_DEVICE_FLAGS} ${SIMD_FLAGS} -D BUILD_TESTS=ON + cmake3 -S . -B build_cuda_${CUDA_COMPILER_NAME}_${CMAKE_HOST_NAME}_${CMAKE_DEVICE_NAME}_${SIMD_NAME}_${env.GIT_COMMIT} -DCMAKE_BUILD_TYPE=Release ${CMAKE_HOST_FLAGS} ${CMAKE_DEVICE_FLAGS} ${SIMD_FLAGS} -D BUILD_TESTS=ON -DVTK_DIR:PATH=/home/TROMP/Modules/modulefiles-shared/vtk/build/ cmake3 --build build_cuda_${CUDA_COMPILER_NAME}_${CMAKE_HOST_NAME}_${CMAKE_DEVICE_NAME}_${SIMD_NAME}_${env.GIT_COMMIT} """ echo ' Build completed ' diff --git a/CMakeLists.txt b/CMakeLists.txt index 0defcaf3..c9a81a74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,8 +50,15 @@ FetchContent_MakeAvailable(yaml) include_directories(BEFORE SYSTEM ${yaml_BINARY_DIR} ${yaml_SOURCE_DIR}/include) find_package(VTK COMPONENTS - CommonColor - CommonCore +CommonColor +CommonCore +FiltersSources +InteractionStyle +RenderingContextOpenGL2 +RenderingCore +RenderingFreeType +RenderingGL2PSOpenGL2 +RenderingOpenGL2 ) if (NOT VTK_FOUND) From 38bcf6c10990b3943b86de83297c2e2f67c5a817 Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Wed, 6 Nov 2024 10:52:34 -0500 Subject: [PATCH 11/53] Implemented compute wavefield function - Still need to implement compute stress function for elements --- include/compute/properties/properties.hpp | 64 ++++ include/enumerations/specfem_enums.hpp | 2 + include/enumerations/wavefield.hpp | 34 ++ src/compute/compute_assembly.cpp | 426 ++++++++++++++++++++++ src/compute/compute_properties.cpp | 158 ++++++++ 5 files changed, 684 insertions(+) diff --git a/include/compute/properties/properties.hpp b/include/compute/properties/properties.hpp index 9e4ed93b..3e06b4f0 100644 --- a/include/compute/properties/properties.hpp +++ b/include/compute/properties/properties.hpp @@ -16,6 +16,17 @@ namespace specfem { namespace compute { +namespace impl { +class elements_of_type { + bool computed; + Kokkos::View + elements; + Kokkos::View::HostMirror h_elements; + elements_of_type() : computed(false) {} +}; +} // namespace impl + /** * @brief Material properties at every quadrature point in the finite element * mesh @@ -84,6 +95,59 @@ struct properties { const specfem::mesh::materials &materials); ///@} + + /** + * @brief Get the indices of elements of a given type as a view on the device + * + * @param medium Medium tag of the elements + * @return Kokkos::View View of the indices of elements of the given + * type + */ + Kokkos::View + get_elements_on_device(const specfem::element::medium_tag medium) const; + + /** + * @brief Get the indices of elements of a given type as a view on the device + * + * @param medium Medium tag of the elements + * @param property Property tag of the elements + * @return Kokkos::View View of the indices of elements of the given + * type + */ + Kokkos::View + get_elements_on_device(const specfem::element::medium_tag medium, + const specfem::element::property_tag property) const; + + /** + * @brief Get the indices of elements of a given type as a view on the host + * + * @param medium Medium tag of the elements + * @return Kokkos::View View of + * the indices of elements of the given type + */ + Kokkos::View + get_elements_on_host(const specfem::element::medium_tag medium) const; + + /** + * @brief Get the indices of elements of a given type as a view on the host + * + * @param medium Medium tag of the elements + * @param property Property tag of the elements + * @return Kokkos::View View of + * the indices of elements of the given type + */ + Kokkos::View + get_elements_on_host(const specfem::element::medium_tag medium, + const specfem::element::property_tag property) const; + +private: + // Stores the indices of elements of a given type + impl::elements_of_type elastic_isotropic_elements; + impl::elements_of_type acoustic_isotropic_elements; + impl::elements_of_type elastic_elements; + impl::elements_of_type acoustic_elements; }; /** diff --git a/include/enumerations/specfem_enums.hpp b/include/enumerations/specfem_enums.hpp index 320672fc..c980deb9 100644 --- a/include/enumerations/specfem_enums.hpp +++ b/include/enumerations/specfem_enums.hpp @@ -81,6 +81,8 @@ namespace time_scheme { enum class type { newmark, ///< Newmark time scheme }; + } // namespace time_scheme + } // namespace enums } // namespace specfem diff --git a/include/enumerations/wavefield.hpp b/include/enumerations/wavefield.hpp index 9799c96b..8382ff0c 100644 --- a/include/enumerations/wavefield.hpp +++ b/include/enumerations/wavefield.hpp @@ -7,5 +7,39 @@ namespace wavefield { * */ enum class type { forward, adjoint, backward, buffer }; + +enum class component { displacement, velocity, acceleration }; + +template +class wavefield; + +template <> +class wavefield { +public: + static constexpr auto dimension = specfem::dimension::type::dim2; + static constexpr auto component = specfem::wavefield::component::displacement; + static constexpr int num_components = 2; +}; + +template <> +class wavefield { +public: + static constexpr auto dimension = specfem::dimension::type::dim2; + static constexpr auto component = specfem::wavefield::component::velocity; + static constexpr int num_components = 2; +}; + +template <> +class wavefield { +public: + static constexpr auto dimension = specfem::dimension::type::dim2; + static constexpr auto component = specfem::wavefield::component::acceleration; + static constexpr int num_components = 2; +}; + } // namespace wavefield } // namespace specfem diff --git a/src/compute/compute_assembly.cpp b/src/compute/compute_assembly.cpp index 9a34df05..ce1da5a8 100644 --- a/src/compute/compute_assembly.cpp +++ b/src/compute/compute_assembly.cpp @@ -2,6 +2,366 @@ #include "compute/assembly/assembly.hpp" #include "mesh/mesh.hpp" +namespace { + +template +class field_type_parameters; + +template +class field_type_parameters { +public: + constexpr static auto medium_tag = MediumTag; + constexpr static auto store_displacement = true; + constexpr static auto store_velocity = false; + constexpr static auto store_acceleration = false; + constexpr static auto store_mass_matrix = false; + constexpr static auto num_components = 2; +}; + +template +class field_type_parameters { +public: + constexpr static auto medium_tag = MediumTag; + constexpr static auto store_displacement = false; + constexpr static auto store_velocity = true; + constexpr static auto store_acceleration = false; + constexpr static auto store_mass_matrix = false; + constexpr static auto num_components = 2; +}; + +template +class field_type_parameters { +public: + constexpr static auto medium_tag = MediumTag; + constexpr static auto store_displacement = false; + constexpr static auto store_velocity = false; + constexpr static auto store_acceleration = true; + constexpr static auto store_mass_matrix = false; + constexpr static auto num_components = 2; +}; + +template +class helper; + +template +class helper { +public: + using field_parameters = + field_type_parameters; + helper(const specfem::compute::assembly &assembly, + Kokkos::View + wavefield_on_entire_grid) + : assembly(assembly), wavefield_on_entire_grid(wavefield_on_entire_grid) { + return; + } + + void compute_wavefield() { + const auto buffer = assembly.fields.buffer; + + const int nspec = assembly.mesh.nspec; + const int ngllz = assembly.mesh.ngllz; + const int ngllx = assembly.mesh.ngllx; + + const auto elements = + assembly.properties.get_elements_on_device(MediumTag, PropertyTag); + + using PointFieldType = + specfem::point::field; + + using ParallelConfig = specfem::parallel_config::point_config< + specfem::dimension::type::dim2, + specfem::datatype::simd, + Kokkos::DefaultExecutionSpace>; + + using ChunkPolicyType = specfem::policy::element_chunk; + + ChunkPolicyType chunk_policy(elements, ngllz, ngllx); + const int nelements = elements.extent(0); + + Kokkos::parallel_for( + "specfem::domain::impl::kernels::elements::compute_mass_matrix", + static_cast( + chunk_policy), + KOKKOS_CLASS_LAMBDA(const typename ChunkPolicyType::member_type &team) { + for (int tile = 0; tile < ChunkPolicyType::tile_size * simd_size; + tile += ChunkPolicyType::chunk_size * simd_size) { + const int starting_element_index = + team.league_rank() * ChunkPolicyType::tile_size * simd_size + + tile; + + if (starting_element_index >= nelements) { + break; + } + + const auto iterator = + chunk_policy.league_iterator(starting_element_index); + + Kokkos::parallel_for( + Kokkos::TeamThreadRange(team, iterator.chunk_size()), + [&](const int i) { + const auto iterator_index = iterator(i); + const auto index = iterator_index.index; + + PointFieldType field; + + specfem::compute::load_on_device(index, buffer, field); + + for (int icomponent = 0; + icomponent < field_parameters::num_components; + icomponent++) { + wavefield_on_entire_grid(index.ispec, index.iz, index.ix, + icomponent) = field(icomponent); + } + }); + } + }); + + return; + } + +private: + const specfem::compute::assembly &assembly; + Kokkos::View + wavefield_on_entire_grid; +}; + +template +class helper { +public: + using field_parameters = + field_type_parameters; + helper(const specfem::compute::assembly &assembly, + Kokkos::View + wavefield_on_entire_grid) + : assembly(assembly), wavefield_on_entire_grid(wavefield_on_entire_grid) { + } + + void compute_wavefield() { + const auto buffer = assembly.fields.buffer; + + const int nspec = assembly.mesh.nspec; + const int ngllz = assembly.mesh.ngllz; + const int ngllx = assembly.mesh.ngllx; + + const auto elements = + assembly.properties.get_elements_on_device(MediumTag, PropertyTag); + const int nelements = elements.extent(0); + + using ChunkElementFieldType = specfem::chunk_element::field< + ParallelConfig::chunk_size, ngll, specfem::dimension::type::dim2, + MediumTag, specfem::kokkos::DevScratchSpace, + Kokkos::MemoryTraits, + field_parameters::store_displacement, field_parameters::store_velocity, + field_parameters::store_acceleration, + field_parameters::store_mass_matrix, false>; + + using QuadratureType = specfem::element::quadrature< + ngll, specfem::dimension::type::dim2, specfem::kokkos::DevScratchSpace, + Kokkos::MemoryTraits, true, false>; + + using simd = specfem::datatype::simd; + using ParallelConfig = specfem::parallel_config::chunk_config< + specfem::dimension::type::dim2, simd, Kokkos::DefaultExecutionSpace>; + using ChunkPolicyType = specfem::policy::element_chunk; + + int scratch_size = + ChunkElementFieldType::shmem_size() + QuadratureType::shmem_size(); + ChunkPolicyType chunk_policy(elements, ngllz, ngllx); + + Kokkos::parallel_for( + "compute_wavefield", + chunk_policy.set_scratch_size(0, Kokkos::PerTeam(scratch_size)), + KOKKOS_CLASS_LAMBDA(const typename ChunkPolicyType::member_type &team) { + QuadratureType quadrature(team); + ChunkElementFieldType field(team); + + specfem::compute::load_on_device(team, assembly.mesh.quadratures, + quadrature); + + for (int tile = 0; tile < ChunkPolicyType::tile_size * simd_size; + tile += ChunkPolicyType::chunk_size * simd_size) { + const int starting_element_index = + team.league_rank() * ChunkPolicyType::tile_size * simd_size + + tile; + + if (starting_element_index >= nelements) { + break; + } + + const auto iterator = + chunk_policy.league_iterator(starting_element_index); + specfem::compute::load_on_device(team, iterator, buffer, field); + team.team_barrier(); + + const auto &active_field = [&]() { + if constexpr (Component == + specfem::wavefield::component::displacement) { + return field.displacement; + } else if constexpr (Component == + specfem::wavefield::component::velocity) { + return field.velocity; + } else if constexpr (Component == specfem::wavefield::component:: + acceleration) { + return field.acceleration; + } else { + static_assert("component not supported"); + } + }(); + + specfem::algorithms::gradient( + team, iterator, quadrature.hprime, active_field, + [&](const typename ChunkPolicyType::iterator_type::index_type + &iterator_index, + const typename PointFieldDerivatives::ViewType &du) { + PointPropertyType point_property; + PointFieldDerivativesType field_derivatives(du); + + PointStressType stress = specfem::element::compute_stress( + point_property, field_derivatives); + + for (int icomponent = 0; icomponent < num_components; + icomponent++) { + wavefield_on_entire_grid( + iterator_index.index.ispec, iterator_index.index.iz, + iterator_index.index.ix, icomponent) = + stress(icomponent, 0); + } + }); + } + }); + + return; + } + +private: + const specfem::compute::assembly &assembly; + Kokkos::View + wavefield_on_entire_grid; +}; + +template +void get_wavefield_on_entire_grid( + const specfem::compute::assembly &assembly, + Kokkos::View + wavefield_on_entire_grid) { + + helper handle(assembly, + wavefield_on_entire_grid); + + handle.compute_wavefield(); + return; +} + +} // namespace + +// template <> +// get_wavefield_on_entire_grid( +// const specfem::compute::assembly &assembly, +// Kokkos::View +// wavefield_on_entire_grid) { + +// const auto buffer = assembly.fields.buffer; + +// const int nspec = assembly.mesh.nspec; +// const int ngllz = assembly.mesh.ngllz; +// const int ngllx = assembly.mesh.ngllx; +// // Get parameters for the chunk field type +// using field_parameters = field_parameters; + +// using simd = specfem::datatype::simd; +// using parallel_config = specfem::parallel_config::chunk_config< +// specfem::dimension::type::dim2, simd, Kokkos::DefaultExecutionSpace>; +// using ChunkPolicyType = specfem::policy::element_chunk; + +// using ChunkElementFieldType = specfem::chunk_element::field< +// ParallelConfig::chunk_size, ngll, specfem::dimension::type::dim2, +// MediumTag, specfem::kokkos::DevScratchSpace, +// Kokkos::MemoryTraits, +// field_parameters::store_displacement, field_parameters::store_velocity, +// field_parameters::store_acceleration, +// field_parameters::store_mass_matrix, false>; +// using QuadratureType = specfem::element::quadrature< +// ngll, specfem::dimension::type::dim2, specfem::kokkos::DevScratchSpace, +// Kokkos::MemoryTraits, true, false>; + +// using ScalarPointViewType = specfem::datatype::ScalarPointViewType< +// type_real, field_parameters::num_components, false>; + +// const auto elements = +// assembly.properties.get_elements_on_device(MediumTag); const +// ChunkPolicyType chunk_policy(elements, ngllz, ngllx); const int nelements = +// elements.extent(0); + +// Kokkos::parallel_for( +// "get_wavefield_on_entire_grid", +// chunk_policy.set_scratch_size( +// 0, Kokkos::PerTeam(ChunkElementFieldType::shmem_size())), +// KOKKOS_CLASS_LAMBDA(const typename ChunkPolicyType::member_type &team) +// { +// QuadratureType quadrature(team); +// ChunkElementFieldType field(team); + +// specfem::compute::load_on_device(team, assembly.mesh.quadratures, +// quadrature); + +// for (int tile = 0; tile < ChunkPolicyType::tile_size * simd_size; +// tile += ChunkPolicyType::chunk_size * simd_size) { +// const int starting_element_index = +// team.league_rank() * ChunkPolicyType::tile_size * simd_size + +// tile; + +// if (starting_element_index >= nelements) { +// break; +// } + +// const auto iterator = +// chunk_policy.league_iterator(starting_element_index); +// specfem::compute::load_on_device(team, iterator, buffer, field); +// team.team_barrier(); + +// specfem::element::compute_wavefield( +// iterator, quadrature, field, +// [&](const ChunkPolicyType::iterator_type::index_type +// &iterator_index, +// const ScalarPointViewType &point_field) { +// const int ispec = iterator_index.index.ispec; +// const int iz = iterator_index.index.iz; +// const int ix = iterator_index.index.ix; +// for (int icomponent = 0; icomponent < num_components; +// icomponent++) { +// wavefield_on_entire_grid(ispec, iz, ix) = +// point_field(icomponent); +// } +// }); +// } +// }); + +// return; +// } + +} // namespace + specfem::compute::assembly::assembly( const specfem::mesh::mesh &mesh, const specfem::quadrature::quadratures &quadratures, @@ -36,3 +396,69 @@ specfem::compute::assembly::assembly( this->boundaries }; return; } + +Kokkos::View +specfem::compute::assembly::generate_wavefield_on_entire_grid( + const specfem::wavefield::type wavefield, + const specfem::wavefield::component component) { + + const int ncomponents = [&]() -> int { + if (component == specfem::wavefield::component::displacement) { + return 2; + } else if (component == specfem::wavefield::component::velocity) { + return 2; + } else if (component == specfem::wavefield::component::acceleration) { + return 2; + } else { + throw std::runtime_error("Wavefield component not supported"); + } + }(); + + // Copy the required wavefield into the buffer + if (wavefield == specfem::wavefield::type::forward) { + Kokkos::deep_copy(this->fields.buffer, this->fields.forward); + } else if (wavefield == specfem::wavefield::type::adjoint) { + Kokkos::deep_copy(this->fields.buffer, this->fields.adjoint); + } else if (wavefield == specfem::wavefield::type::backward) { + Kokkos::deep_copy(this->fields.buffer, this->fields.backward); + } else { + throw std::runtime_error("Wavefield type not supported"); + } + + Kokkos::View + wavefield_on_entire_grid("wavefield_on_entire_grid", this->mesh.nspec, + this->mesh.ngllz, this->mesh.ngllx, ncomponents); + + const auto h_wavefield_on_entire_grid = + Kokkos::create_mirror_view(wavefield_on_entire_grid); + + if (component == specfem::wavefield::component::displacement) { + get_wavefield_on_entire_grid( + *this, wavefield_on_entire_grid); + get_wavefield_on_entire_grid( + *this, wavefield_on_entire_grid); + } else if (component == specfem::wavefield::component::velocity) { + get_wavefield_on_entire_grid( + *this, wavefield_on_entire_grid); + get_wavefield_on_entire_grid( + *this, wavefield_on_entire_grid); + } else if (component == specfem::wavefield::component::acceleration) { + get_wavefield_on_entire_grid( + *this, wavefield_on_entire_grid); + get_wavefield_on_entire_grid( + *this, wavefield_on_entire_grid); + } else { + throw std::runtime_error("Wavefield component not supported"); + } + + Kokkos::deep_copy(h_wavefield_on_entire_grid, wavefield_on_entire_grid); + + return h_wavefield_on_entire_grid; +} diff --git a/src/compute/compute_properties.cpp b/src/compute/compute_properties.cpp index 6bc1776f..df082e5e 100644 --- a/src/compute/compute_properties.cpp +++ b/src/compute/compute_properties.cpp @@ -94,3 +94,161 @@ specfem::compute::properties::properties( return; } + +Kokkos::View +specfem::compute::properties::get_elements_on_host( + const specfem::element::medium_tag medium) const { + const auto &elements = [&]() -> impl::elements_of_type & { + if (medium == specfem::element::medium_tag::elastic) { + return elastic_elements; + } else if (medium == specfem::element::medium_tag::acoustic) { + return acoustic_elements; + } else { + throw std::runtime_error("Unknown medium tag"); + } + }(); + + if (elements.computed) + return elements.h_elements; + + const int nspec = this->nspec; + + int nelements = 0; + for (int ispec = 0; ispec < nspec; ispec++) { + if (element_types(ispec) == medium) { + nelements++; + } + } + + elements.elements = + Kokkos::View( + "specfem::compute::properties::get_elements_on_host", nelements); + + elements.h_elements = Kokkos::create_mirror_view(elements.elements); + + nelements = 0; + for (int ispec = 0; ispec < nspec; ispec++) { + if (element_types(ispec) == medium) { + elements.h_elements(nelements) = ispec; + nelements++; + } + } + + Kokkos::deep_copy(elements.elements, elements.h_elements); + + elements.computed = true; + + return elements.h_elements; +} + +Kokkos::View +get_elements_on_device(const specfem::element::medium_tag medium) const { + const auto &elements = [&]() { + if (medium == specfem::element::medium_tag::elastic) { + return elastic_elements; + } else if (medium == specfem::element::medium_tag::acoustic) { + return acoustic_elements; + } else { + throw std::runtime_error("Unknown medium tag"); + } + }(); + + if (elements.computed) + return elements.elements; + + // If the elements have not been computed, compute them. + // The elements need to be computed in serial on the host. + // This function computes the host elements on host and then + // copies them to the device. + const auto dummy = this->get_elements_on_host(medium); + + return elements.elements; +} + +Kokkos::View +specfem::compute::properties::get_elements_on_host( + const specfem::element::medium_tag medium, + const specfem::element::property_tag property) const { + const auto &elements = [&]() -> impl::elements_of_type & { + if (medium == specfem::element::medium_tag::elastic) { + if (property == specfem::element::property_tag::isotropic) { + return elastic_isotropic_elements; + } else { + throw std::runtime_error("Unknown property tag"); + } + } else if (medium == specfem::element::medium_tag::acoustic) { + if (property == specfem::element::property_tag::isotropic) { + return acoustic_isotropic_elements; + } else { + throw std::runtime_error("Unknown property tag"); + } + } else { + throw std::runtime_error("Unknown medium tag"); + } + }(); + + if (elements.computed) + return elements.h_elements; + + const int nspec = this->nspec; + + int nelements = 0; + for (int ispec = 0; ispec < nspec; ispec++) { + if (element_types(ispec) == medium && element_property(ispec) == property) { + nelements++; + } + } + + elements.elements = + Kokkos::View( + "specfem::compute::properties::get_elements_on_host", nelements); + + elements.h_elements = Kokkos::create_mirror_view(elements.elements); + + nelements = 0; + for (int ispec = 0; ispec < nspec; ispec++) { + if (element_types(ispec) == medium && element_property(ispec) == property) { + elements.h_elements(nelements) = ispec; + nelements++; + } + } + + Kokkos::deep_copy(elements.elements, elements.h_elements); + + elements.computed = true; + + return elements.h_elements; +} + +Kokkos::View +get_elements_on_device(const specfem::element::medium_tag medium, + const specfem::element::property_tag property) const { + const auto &elements = [&]() { + if (medium == specfem::element::medium_tag::elastic) { + if (property == specfem::element::property_tag::isotropic) { + return elastic_isotropic_elements; + } else { + throw std::runtime_error("Unknown property tag"); + } + } else if (medium == specfem::element::medium_tag::acoustic) { + if (property == specfem::element::property_tag::isotropic) { + return acoustic_isotropic_elements; + } else { + throw std::runtime_error("Unknown property tag"); + } + } else { + throw std::runtime_error("Unknown medium tag"); + } + }(); + + if (elements.computed) + return elements.elements; + + // If the elements have not been computed, compute them. + // The elements need to be computed in serial on the host. + // This function computes the host elements on host and then + // copies them to the device. + const auto dummy = this->get_elements_on_host(medium, property); + + return elements.elements; +} From 7bd2cfd488fd61fc6e88750825bd0b7aa4b29c1b Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Fri, 8 Nov 2024 16:45:56 -0500 Subject: [PATCH 12/53] Moved compute stress to specfem::medium --- CMakeLists.txt | 8 +- include/chunk_element/field.hpp | 16 +- include/chunk_element/stress_integrand.hpp | 14 +- .../impl/boundary_medium_container.hpp | 2 +- include/compute/fields/impl/field_impl.hpp | 5 +- include/compute/fields/impl/field_impl.tpp | 40 +- include/compute/fields/simulation_field.hpp | 7 - include/compute/fields/simulation_field.tpp | 7 +- include/compute/properties/properties.hpp | 9 +- include/compute/sources/source_medium.hpp | 9 +- include/domain/domain.hpp | 8 +- include/domain/domain.tpp | 2 - include/domain/impl/elements/kernel.hpp | 4 +- include/domain/impl/elements/kernel.tpp | 15 +- include/domain/impl/kernels.tpp | 9 +- .../acoustic/acoustic2d_isotropic.hpp | 47 +- .../acoustic/acoustic2d_isotropic.tpp | 6 +- .../receivers/elastic/elastic2d_isotropic.hpp | 31 +- .../receivers/elastic/elastic2d_isotropic.tpp | 26 +- include/domain/impl/receivers/kernel.hpp | 10 +- include/domain/impl/receivers/kernel.tpp | 5 +- .../sources/acoustic/acoustic2d_isotropic.hpp | 26 +- .../sources/acoustic/acoustic2d_isotropic.tpp | 3 +- .../sources/elastic/elastic2d_isotropic.hpp | 26 +- .../sources/elastic/elastic2d_isotropic.tpp | 6 +- include/domain/impl/sources/kernel.hpp | 12 +- include/domain/impl/sources/kernel.tpp | 17 +- include/element/field.hpp | 16 +- include/enumerations/medium.hpp | 71 +-- include/enumerations/wavefield.hpp | 2 + .../frechet_derivatives.hpp | 10 +- .../acoustic_isotropic2d.hpp | 36 ++ include/medium/compute_stress.hpp | 49 ++ .../elastic_isotropic2d.hpp | 52 ++ include/medium/medium.hpp | 3 + include/point/field.hpp | 17 +- include/point/field_derivatives.hpp | 13 +- include/point/properties.hpp | 2 + include/point/stress_integrand.hpp | 4 +- include/timescheme/newmark.hpp | 15 - include/timescheme/newmark.tpp | 25 +- include/writer/wavefield.hpp | 7 - src/compute/assembly/assembly.cpp | 38 ++ src/compute/compute_assembly.cpp | 464 ------------------ src/compute/compute_properties.cpp | 29 +- src/enumerations/medium.cpp | 27 + 46 files changed, 484 insertions(+), 766 deletions(-) create mode 100644 include/medium/acoustic_isotropic2d/acoustic_isotropic2d.hpp create mode 100644 include/medium/compute_stress.hpp create mode 100644 include/medium/elastic_isotropic2d/elastic_isotropic2d.hpp create mode 100644 include/medium/medium.hpp create mode 100644 src/compute/assembly/assembly.cpp delete mode 100644 src/compute/compute_assembly.cpp create mode 100644 src/enumerations/medium.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index c9a81a74..02dc90eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,6 +162,11 @@ target_link_libraries( Kokkos::kokkos ) +add_library( + enumerations + src/enumerations/medium.cpp +) + add_library( edge src/edge/interface.cpp @@ -340,7 +345,7 @@ add_library( src/compute/boundaries/boundaries.cpp src/compute/fields/fields.cpp src/compute/compute_boundary_values.cpp - src/compute/compute_assembly.cpp + src/compute/assembly/assembly.cpp ) target_link_libraries( @@ -380,6 +385,7 @@ add_library( target_link_libraries( domain Kokkos::kokkos + enumerations ) add_library(coupled_interface diff --git a/include/chunk_element/field.hpp b/include/chunk_element/field.hpp index 68087577..f704bd6d 100644 --- a/include/chunk_element/field.hpp +++ b/include/chunk_element/field.hpp @@ -237,16 +237,16 @@ template struct FieldTraits - : public ImplFieldTraits< - specfem::datatype::ScalarChunkViewType< - type_real, NumElements, NGLL, - specfem::medium::medium::components, - MemorySpace, MemoryTraits, UseSIMD>, - StoreDisplacement, StoreVelocity, StoreAcceleration, - StoreMassMatrix> { + : public ImplFieldTraits::components(), + MemorySpace, MemoryTraits, UseSIMD>, + StoreDisplacement, StoreVelocity, + StoreAcceleration, StoreMassMatrix> { constexpr static int components = - specfem::medium::medium::components; + specfem::element::attributes::components(); using ViewType = specfem::datatype::ScalarChunkViewType::components; ///< Number of components. - ///@} + ///@} private: constexpr static int num_dimensions = - specfem::dimension::dimension::dim; ///< Number of - ///< dimensions. + specfem::element::attributes::dimension(); ///< Number of + ///< dimensions. + constexpr static int components = + specfem::element::attributes::components(); ///< Number of + ///< components. public: /** diff --git a/include/compute/boundary_values/impl/boundary_medium_container.hpp b/include/compute/boundary_values/impl/boundary_medium_container.hpp index b9919557..b80f726c 100644 --- a/include/compute/boundary_values/impl/boundary_medium_container.hpp +++ b/include/compute/boundary_values/impl/boundary_medium_container.hpp @@ -19,7 +19,7 @@ template ::components; + specfem::element::attributes::components(); constexpr static auto dimension = DimensionType; public: diff --git a/include/compute/fields/impl/field_impl.hpp b/include/compute/fields/impl/field_impl.hpp index 749a8479..2ba1527d 100644 --- a/include/compute/fields/impl/field_impl.hpp +++ b/include/compute/fields/impl/field_impl.hpp @@ -13,9 +13,8 @@ template class field_impl { public: - using medium_type = specfem::medium::medium; - - constexpr static int components = medium_type::components; + constexpr static int components = + specfem::element::attributes::components(); field_impl() = default; diff --git a/include/compute/fields/impl/field_impl.tpp b/include/compute/fields/impl/field_impl.tpp index 26d915c4..ce09afb0 100644 --- a/include/compute/fields/impl/field_impl.tpp +++ b/include/compute/fields/impl/field_impl.tpp @@ -9,17 +9,14 @@ template specfem::compute::impl::field_impl::field_impl( const int nglob) - : nglob(nglob), - field("specfem::compute::fields::field", nglob, medium_type::components), + : nglob(nglob), field("specfem::compute::fields::field", nglob, components), h_field(Kokkos::create_mirror_view(field)), - field_dot("specfem::compute::fields::field_dot", nglob, - medium_type::components), + field_dot("specfem::compute::fields::field_dot", nglob, components), h_field_dot(Kokkos::create_mirror_view(field_dot)), field_dot_dot("specfem::compute::fields::field_dot_dot", nglob, - medium_type::components), + components), h_field_dot_dot(Kokkos::create_mirror_view(field_dot_dot)), - mass_inverse("specfem::compute::fields::mass_inverse", nglob, - medium_type::components), + mass_inverse("specfem::compute::fields::mass_inverse", nglob, components), h_mass_inverse(Kokkos::create_mirror_view(mass_inverse)) {} template ::field_impl( nglob = count; field = specfem::kokkos::DeviceView2d( - "specfem::compute::fields::field", nglob, medium_type::components); + "specfem::compute::fields::field", nglob, components); h_field = specfem::kokkos::HostMirror2d( Kokkos::create_mirror_view(field)); field_dot = specfem::kokkos::DeviceView2d( - "specfem::compute::fields::field_dot", nglob, medium_type::components); + "specfem::compute::fields::field_dot", nglob, components); h_field_dot = specfem::kokkos::HostMirror2d( Kokkos::create_mirror_view(field_dot)); field_dot_dot = specfem::kokkos::DeviceView2d( - "specfem::compute::fields::field_dot_dot", nglob, - medium_type::components); + "specfem::compute::fields::field_dot_dot", nglob, components); h_field_dot_dot = specfem::kokkos::HostMirror2d( Kokkos::create_mirror_view(field_dot_dot)); mass_inverse = specfem::kokkos::DeviceView2d( - "specfem::compute::fields::mass_inverse", nglob, medium_type::components); + "specfem::compute::fields::mass_inverse", nglob, components); h_mass_inverse = specfem::kokkos::HostMirror2d( Kokkos::create_mirror_view(mass_inverse)); - Kokkos::parallel_for( - "specfem::compute::fields::field_impl::initialize_field", - specfem::kokkos::HostRange(0, nglob), [=](const int &iglob) { - for (int icomp = 0; icomp < medium_type::components; ++icomp) { - h_field(iglob, icomp) = 0.0; - h_field_dot(iglob, icomp) = 0.0; - h_field_dot_dot(iglob, icomp) = 0.0; - h_mass_inverse(iglob, icomp) = 0.0; - } - }); + Kokkos::parallel_for("specfem::compute::fields::field_impl::initialize_field", + specfem::kokkos::HostRange(0, nglob), + [=](const int &iglob) { + for (int icomp = 0; icomp < components; ++icomp) { + h_field(iglob, icomp) = 0.0; + h_field_dot(iglob, icomp) = 0.0; + h_field_dot_dot(iglob, icomp) = 0.0; + h_mass_inverse(iglob, icomp) = 0.0; + } + }); Kokkos::fence(); diff --git a/include/compute/fields/simulation_field.hpp b/include/compute/fields/simulation_field.hpp index 3709b73a..29ca1b6c 100644 --- a/include/compute/fields/simulation_field.hpp +++ b/include/compute/fields/simulation_field.hpp @@ -22,13 +22,6 @@ namespace compute { */ template struct simulation_field { private: - using elastic_type = - specfem::medium::medium; - - using acoustic_type = - specfem::medium::medium; using ViewType = Kokkos::View; ///< Underlying view type to diff --git a/include/compute/fields/simulation_field.tpp b/include/compute/fields/simulation_field.tpp index 4f0108f5..8fa29cf5 100644 --- a/include/compute/fields/simulation_field.tpp +++ b/include/compute/fields/simulation_field.tpp @@ -9,8 +9,7 @@ #include namespace { -template -int compute_nglob(const ViewType index_mapping) { +template int compute_nglob(const ViewType index_mapping) { const int nspec = index_mapping.extent(0); const int ngllz = index_mapping.extent(1); const int ngllx = index_mapping.extent(2); @@ -60,11 +59,11 @@ specfem::compute::simulation_field::simulation_field( auto acoustic_index = Kokkos::subview(h_assembly_index_mapping, Kokkos::ALL, - static_cast(acoustic_type::medium_tag)); + static_cast(specfem::element::medium_tag::acoustic)); auto elastic_index = Kokkos::subview(h_assembly_index_mapping, Kokkos::ALL, - static_cast(elastic_type::medium_tag)); + static_cast(specfem::element::medium_tag::elastic)); elastic = specfem::compute::impl::field_impl elements; @@ -105,7 +106,7 @@ struct properties { * type */ Kokkos::View - get_elements_on_device(const specfem::element::medium_tag medium) const; + get_elements_on_device(const specfem::element::medium_tag medium); /** * @brief Get the indices of elements of a given type as a view on the device @@ -118,7 +119,7 @@ struct properties { */ Kokkos::View get_elements_on_device(const specfem::element::medium_tag medium, - const specfem::element::property_tag property) const; + const specfem::element::property_tag property); /** * @brief Get the indices of elements of a given type as a view on the host @@ -128,7 +129,7 @@ struct properties { * the indices of elements of the given type */ Kokkos::View - get_elements_on_host(const specfem::element::medium_tag medium) const; + get_elements_on_host(const specfem::element::medium_tag medium); /** * @brief Get the indices of elements of a given type as a view on the host @@ -140,7 +141,7 @@ struct properties { */ Kokkos::View get_elements_on_host(const specfem::element::medium_tag medium, - const specfem::element::property_tag property) const; + const specfem::element::property_tag property); private: // Stores the indices of elements of a given type diff --git a/include/compute/sources/source_medium.hpp b/include/compute/sources/source_medium.hpp index e28e432a..3ccc656b 100644 --- a/include/compute/sources/source_medium.hpp +++ b/include/compute/sources/source_medium.hpp @@ -34,9 +34,12 @@ struct source_medium { ///< store source arrays constexpr static int components = - specfem::medium::medium::components; ///< Number of - ///< components in - ///< the medium + specfem::element::attributes::components(); ///< Number + ///< of + ///< components + ///< in the + ///< medium public: /** diff --git a/include/domain/domain.hpp b/include/domain/domain.hpp index c1bdf66d..48909fe8 100644 --- a/include/domain/domain.hpp +++ b/include/domain/domain.hpp @@ -25,8 +25,12 @@ template { public: - using dimension = specfem::dimension::dimension; - using medium_type = specfem::medium::medium; + constexpr static auto dimension = DimensionType; ///< Dimension of the domain + constexpr static auto medium_tag = MediumTag; ///< Medium tag + constexpr static int num_dimensions = + specfem::element::attributes::dimension(); + constexpr static int components = + specfem::element::attributes::components(); using quadrature_points_type = qp_type; /** diff --git a/include/domain/domain.tpp b/include/domain/domain.tpp index 8df53f1e..986593fb 100644 --- a/include/domain/domain.tpp +++ b/include/domain/domain.tpp @@ -10,7 +10,6 @@ template void specfem::domain::domain::divide_mass_matrix() { - constexpr int components = medium_type::components; const int nglob = field.template get_nglob(); constexpr bool using_simd = true; using LoadFieldType = specfem::point::field void specfem::domain::domain::invert_mass_matrix() { - constexpr int components = medium_type::components; const int nglob = field.template get_nglob(); constexpr bool using_simd = true; using PointFieldType = specfem::point::field; constexpr static int num_dimensions = - specfem::dimension::dimension::dim; + specfem::element::attributes::dimension(); constexpr static int components = - specfem::medium::medium::components; + specfem::element::attributes::components(); using ChunkElementFieldType = specfem::chunk_element::field< ParallelConfig::chunk_size, ngll, DimensionType, MediumTag, diff --git a/include/domain/impl/elements/kernel.tpp b/include/domain/impl/elements/kernel.tpp index c95b3c97..681434b6 100644 --- a/include/domain/impl/elements/kernel.tpp +++ b/include/domain/impl/elements/kernel.tpp @@ -9,6 +9,7 @@ #include "enumerations/medium.hpp" #include "enumerations/specfem_enums.hpp" #include "kernel.hpp" +#include "medium/medium.hpp" #include "specfem_setup.hpp" #include @@ -215,10 +216,10 @@ void specfem::domain::impl::kernels::element_kernel_base< PointFieldDerivativesType field_derivatives(du); - const auto point_stress_integrand = - specfem::domain::impl::elements::compute_stress_integrands( - point_partial_derivatives, point_property, - field_derivatives); + const auto point_stress = specfem::medium::compute_stress( + point_property, field_derivatives); + + const auto F = point_stress * point_partial_derivatives; const int &ielement = iterator_index.ielement; @@ -226,8 +227,7 @@ void specfem::domain::impl::kernels::element_kernel_base< ++icomponent) { for (int idim = 0; idim < num_dimensions; ++idim) { stress_integrand.F(ielement, index.iz, index.ix, idim, - icomponent) = - point_stress_integrand.F(idim, icomponent); + icomponent) = F(idim, icomponent); } } }); @@ -237,7 +237,8 @@ void specfem::domain::impl::kernels::element_kernel_base< specfem::algorithms::divergence( team, iterator, partial_derivatives, wgll, element_quadrature.hprime_wgll, stress_integrand.F, - [&, istep = istep](const typename ChunkPolicyType::iterator_type::index_type + [&, istep = istep]( + const typename ChunkPolicyType::iterator_type::index_type &iterator_index, const typename PointAccelerationType::ViewType &result) { const auto &index = iterator_index.index; diff --git a/include/domain/impl/kernels.tpp b/include/domain/impl/kernels.tpp index 97dcc40e..1050869a 100644 --- a/include/domain/impl/kernels.tpp +++ b/include/domain/impl/kernels.tpp @@ -33,7 +33,7 @@ void allocate_elements( using dimension = specfem::dimension::dimension; using medium_type = - specfem::medium::medium; + specfem::element::attributes; const int nspec = assembly.mesh.nspec; @@ -79,7 +79,8 @@ void allocate_elements( std::cout << " - Element type: \n" << " - dimension : " << dimension::to_string() << "\n" - << " - Element type : " << medium_type::to_string() + << " - Element type : " << specfem::element::to_string( + medium_tag, property_tag) << "\n" << " - Boundary Conditions : " << specfem::domain::impl::boundary_conditions::print_boundary_tag< @@ -196,8 +197,6 @@ specfem::domain::impl::kernels:: const type_real dt, const specfem::compute::assembly &assembly, const qp_type &quadrature_points) { - using medium_type = specfem::medium::medium; - const int nspec = assembly.mesh.nspec; specfem::kokkos::HostView1d element_tags( "specfem::domain::domain::element_tag", nspec); @@ -214,7 +213,7 @@ specfem::domain::impl::kernels:: WavefieldType == specfem::wavefield::type::adjoint) { std::cout << " Element Statistics \n" << "------------------------------\n" - << "- Types of elements in " << medium_type::to_string() + << "- Types of elements in " << specfem::element::to_string(medium) << " medium :\n\n"; } diff --git a/include/domain/impl/receivers/acoustic/acoustic2d_isotropic.hpp b/include/domain/impl/receivers/acoustic/acoustic2d_isotropic.hpp index c814e8a6..c659b7c8 100644 --- a/include/domain/impl/receivers/acoustic/acoustic2d_isotropic.hpp +++ b/include/domain/impl/receivers/acoustic/acoustic2d_isotropic.hpp @@ -26,15 +26,17 @@ class receiver< using_simd> { private: - constexpr static auto DimensionType = specfem::dimension::type::dim2; - constexpr static auto MediumTag = specfem::element::medium_tag::acoustic; + constexpr static auto dimension = specfem::dimension::type::dim2; + constexpr static auto medium_tag = specfem::element::medium_tag::acoustic; + constexpr static auto property_tag = + specfem::element::property_tag::isotropic; using ElementQuadratureViewType = typename specfem::element::quadrature< - NGLL, DimensionType, specfem::kokkos::DevScratchSpace, + NGLL, dimension, specfem::kokkos::DevScratchSpace, Kokkos::MemoryTraits, true, true>::ViewType; using ElementFieldViewType = typename specfem::element::field< - NGLL, DimensionType, MediumTag, specfem::kokkos::DevScratchSpace, + NGLL, dimension, medium_tag, specfem::kokkos::DevScratchSpace, Kokkos::MemoryTraits, true, true, true, false, using_simd>::ViewType; @@ -43,13 +45,13 @@ class receiver< * @name Typedefs */ ///@{ - using dimension = - specfem::dimension::dimension; + constexpr static int num_dimensions = + specfem::element::attributes::dimension(); + + constexpr static int components = + specfem::element::attributes::components(); + ///@} - using medium_type = - specfem::medium::medium; /** * @brief Number of Gauss-Lobatto-Legendre quadrature points */ @@ -101,19 +103,18 @@ class receiver< * @param hprime_zz Derivates of Lagrange interpolants in the z direction */ KOKKOS_FUNCTION - void get_field(const int iz, const int ix, - const specfem::point::partial_derivatives - partial_derivatives, - const specfem::point::properties< - specfem::dimension::type::dim2, medium_type::medium_tag, - medium_type::property_tag, using_simd> - properties, - const ElementQuadratureViewType hprime, - const ElementFieldViewType active_field, - Kokkos::View - receiver_field) const; + void get_field( + const int iz, const int ix, + const specfem::point::partial_derivatives + partial_derivatives, + const specfem::point::properties + properties, + const ElementQuadratureViewType hprime, + const ElementFieldViewType active_field, + Kokkos::View + receiver_field) const; // /** // * @brief Compute the seismogram components for a given receiver and diff --git a/include/domain/impl/receivers/acoustic/acoustic2d_isotropic.tpp b/include/domain/impl/receivers/acoustic/acoustic2d_isotropic.tpp index 9144d4a9..45813ce4 100644 --- a/include/domain/impl/receivers/acoustic/acoustic2d_isotropic.tpp +++ b/include/domain/impl/receivers/acoustic/acoustic2d_isotropic.tpp @@ -55,10 +55,10 @@ KOKKOS_INLINE_FUNCTION void specfem::domain::impl::receivers::receiver< specfem::enums::element::quadrature::static_quadrature_points, using_simd>:: get_field( const int iz, const int ix, - const specfem::point::partial_derivatives + const specfem::point::partial_derivatives partial_derivatives, - const specfem::point::properties + const specfem::point::properties properties, const ElementQuadratureViewType hprime, const ElementFieldViewType active_field, diff --git a/include/domain/impl/receivers/elastic/elastic2d_isotropic.hpp b/include/domain/impl/receivers/elastic/elastic2d_isotropic.hpp index 6def10dd..a3ee47e4 100644 --- a/include/domain/impl/receivers/elastic/elastic2d_isotropic.hpp +++ b/include/domain/impl/receivers/elastic/elastic2d_isotropic.hpp @@ -27,15 +27,17 @@ class receiver< specfem::enums::element::quadrature::static_quadrature_points, using_simd> { private: - constexpr static auto DimensionType = specfem::dimension::type::dim2; - constexpr static auto MediumTag = specfem::element::medium_tag::elastic; + constexpr static auto dimension = specfem::dimension::type::dim2; + constexpr static auto property_tag = + specfem::element::property_tag::isotropic; + constexpr static auto medium_tag = specfem::element::medium_tag::elastic; using ElementQuadratureViewType = typename specfem::element::quadrature< - NGLL, DimensionType, specfem::kokkos::DevScratchSpace, + NGLL, dimension, specfem::kokkos::DevScratchSpace, Kokkos::MemoryTraits, true, false>::ViewType; using ElementFieldViewType = typename specfem::element::field< - NGLL, DimensionType, MediumTag, specfem::kokkos::DevScratchSpace, + NGLL, dimension, medium_tag, specfem::kokkos::DevScratchSpace, Kokkos::MemoryTraits, true, true, true, false, using_simd>::ViewType; @@ -48,12 +50,13 @@ class receiver< * @brief Dimension of the element * */ - using dimension = - specfem::dimension::dimension; - using medium_type = - specfem::medium::medium; + constexpr static int num_dimensions = + specfem::element::attributes::dimension(); + + constexpr static int components = + specfem::element::attributes::components(); + ///@} + /** * @brief Number of Gauss-Lobatto-Legendre quadrature points */ @@ -106,12 +109,10 @@ class receiver< KOKKOS_FUNCTION void get_field( const int iz, const int ix, - const specfem::point::partial_derivatives + const specfem::point::partial_derivatives partial_derivatives, - const specfem::point::properties + const specfem::point::properties properties, const ElementQuadratureViewType hprime, const ElementFieldViewType active_field, diff --git a/include/domain/impl/receivers/elastic/elastic2d_isotropic.tpp b/include/domain/impl/receivers/elastic/elastic2d_isotropic.tpp index 2276f5c4..aef25bb4 100644 --- a/include/domain/impl/receivers/elastic/elastic2d_isotropic.tpp +++ b/include/domain/impl/receivers/elastic/elastic2d_isotropic.tpp @@ -33,20 +33,18 @@ KOKKOS_INLINE_FUNCTION void specfem::domain::impl::receivers::receiver< specfem::dimension::type::dim2, specfem::element::medium_tag::elastic, specfem::element::property_tag::isotropic, specfem::enums::element::quadrature::static_quadrature_points, - using_simd>:: - get_field(const int iz, const int ix, - const specfem::point::partial_derivatives< - specfem::dimension::type::dim2, false, using_simd> - partial_derivatives, - const specfem::point::properties< - specfem::dimension::type::dim2, medium_type::medium_tag, - medium_type::property_tag, using_simd> - properties, - const ElementQuadratureViewType hprime, - const ElementFieldViewType active_field, - Kokkos::View - receiver_field) const { + using_simd>::get_field(const int iz, const int ix, + const specfem::point::partial_derivatives< + dimension, false, using_simd> + partial_derivatives, + const specfem::point::properties< + dimension, medium_tag, property_tag, using_simd> + properties, + const ElementQuadratureViewType hprime, + const ElementFieldViewType active_field, + Kokkos::View + receiver_field) const { // Receiver field is probably not the best way of storing this, since this // would require global memory accesses. A better way for doing this would be diff --git a/include/domain/impl/receivers/kernel.hpp b/include/domain/impl/receivers/kernel.hpp index b8d1a46e..36e5cd18 100644 --- a/include/domain/impl/receivers/kernel.hpp +++ b/include/domain/impl/receivers/kernel.hpp @@ -19,9 +19,13 @@ template class receiver_kernel { public: - using dimension = specfem::dimension::dimension; - using medium_type = - specfem::medium::medium; + constexpr static int num_dimensions = + specfem::element::attributes::dimension(); + constexpr static int components = + specfem::element::attributes::components(); + constexpr static auto medium_tag = MediumTag; + constexpr static auto property_tag = PropertyTag; + constexpr static auto dimension = DimensionType; using quadrature_points_type = qp_type; constexpr static bool using_simd = false; diff --git a/include/domain/impl/receivers/kernel.tpp b/include/domain/impl/receivers/kernel.tpp index 67d52930..2a083a3a 100644 --- a/include/domain/impl/receivers/kernel.tpp +++ b/include/domain/impl/receivers/kernel.tpp @@ -34,9 +34,9 @@ specfem::domain::impl::kernels::receiver_kernel< for (int ireceiver = 0; ireceiver < nreceivers; ++ireceiver) { const int ispec = h_receiver_kernel_index_mapping(ireceiver); if ((assembly.properties.h_element_types(ispec) != - medium_type::medium_tag) && + medium_tag) && (assembly.properties.h_element_property(ispec) != - medium_type::property_tag)) { + property_tag)) { throw std::runtime_error("Invalid element detected in kernel"); } } @@ -78,7 +78,6 @@ void specfem::domain::impl::kernels::receiver_kernel< // within the element. Scratch views speed up this computation by limiting // global memory accesses. - constexpr int components = medium_type::components; constexpr int NGLL = quadrature_points_type::NGLL; using ElementFieldType = specfem::element::field< NGLL, DimensionType, MediumTag, specfem::kokkos::DevScratchSpace, diff --git a/include/domain/impl/sources/acoustic/acoustic2d_isotropic.hpp b/include/domain/impl/sources/acoustic/acoustic2d_isotropic.hpp index ae6a83ac..b913da28 100644 --- a/include/domain/impl/sources/acoustic/acoustic2d_isotropic.hpp +++ b/include/domain/impl/sources/acoustic/acoustic2d_isotropic.hpp @@ -32,12 +32,16 @@ class source< * @name Typedefs */ ///@{ - using dimension = - specfem::dimension::dimension; - using medium_type = - specfem::medium::medium; + constexpr static int num_dimensions = specfem::element::attributes< + specfem::dimension::type::dim2, + specfem::element::medium_tag::acoustic>::dimension(); + constexpr static int components = specfem::element::attributes< + specfem::dimension::type::dim2, + specfem::element::medium_tag::acoustic>::components(); + constexpr static auto medium_tag = specfem::element::medium_tag::acoustic; + constexpr static auto property_tag = + specfem::element::property_tag::isotropic; + constexpr static auto dimension = specfem::dimension::type::dim2; using quadrature_points_type = specfem::enums::element::quadrature::static_quadrature_points; @@ -78,12 +82,12 @@ class source< * the source */ KOKKOS_INLINE_FUNCTION void compute_interaction( + const specfem::datatype::ScalarPointViewType &source_array, const specfem::datatype::ScalarPointViewType< - type_real, medium_type::components, using_simd> &stf, - const specfem::datatype::ScalarPointViewType< - type_real, medium_type::components, using_simd> &lagrange_interpolant, - specfem::datatype::ScalarPointViewType &acceleration) const; + type_real, components, using_simd> &lagrange_interpolants, + specfem::datatype::ScalarPointViewType + &acceleration) const; }; } // namespace sources } // namespace impl diff --git a/include/domain/impl/sources/acoustic/acoustic2d_isotropic.tpp b/include/domain/impl/sources/acoustic/acoustic2d_isotropic.tpp index e12529ba..5d469715 100644 --- a/include/domain/impl/sources/acoustic/acoustic2d_isotropic.tpp +++ b/include/domain/impl/sources/acoustic/acoustic2d_isotropic.tpp @@ -47,8 +47,7 @@ KOKKOS_INLINE_FUNCTION void specfem::domain::impl::sources::source< compute_interaction( const specfem::datatype::ScalarPointViewType &stf, const specfem::datatype::ScalarPointViewType &lagrange_interpolant, - specfem::datatype::ScalarPointViewType - &acceleration) const { + specfem::datatype::ScalarPointViewType &acceleration) const { acceleration(0) = lagrange_interpolant(0) * stf(0); diff --git a/include/domain/impl/sources/elastic/elastic2d_isotropic.hpp b/include/domain/impl/sources/elastic/elastic2d_isotropic.hpp index d20908ea..38d825b1 100644 --- a/include/domain/impl/sources/elastic/elastic2d_isotropic.hpp +++ b/include/domain/impl/sources/elastic/elastic2d_isotropic.hpp @@ -32,12 +32,16 @@ class source< * @name Typedefs */ ///@{ - using dimension = - specfem::dimension::dimension; - using medium_type = - specfem::medium::medium; + constexpr static int num_dimensions = specfem::element::attributes< + specfem::dimension::type::dim2, + specfem::element::medium_tag::elastic>::dimension(); + constexpr static int components = specfem::element::attributes< + specfem::dimension::type::dim2, + specfem::element::medium_tag::elastic>::components(); + constexpr static auto medium_tag = specfem::element::medium_tag::elastic; + constexpr static auto property_tag = + specfem::element::property_tag::isotropic; + constexpr static auto dimension = specfem::dimension::type::dim2; /** * @brief Number of Gauss-Lobatto-Legendre quadrature points @@ -80,12 +84,12 @@ class source< * the source */ KOKKOS_INLINE_FUNCTION void compute_interaction( + const specfem::datatype::ScalarPointViewType &stf, const specfem::datatype::ScalarPointViewType< - type_real, medium_type::components, using_simd> &stf, - const specfem::datatype::ScalarPointViewType< - type_real, medium_type::components, using_simd> &lagrange_interpolant, - specfem::datatype::ScalarPointViewType &acceleration) const; + type_real, components, using_simd> &lagrange_interpolant, + specfem::datatype::ScalarPointViewType + &acceleration) const; }; } // namespace sources } // namespace impl diff --git a/include/domain/impl/sources/elastic/elastic2d_isotropic.tpp b/include/domain/impl/sources/elastic/elastic2d_isotropic.tpp index 0d9255aa..9c4d3a62 100644 --- a/include/domain/impl/sources/elastic/elastic2d_isotropic.tpp +++ b/include/domain/impl/sources/elastic/elastic2d_isotropic.tpp @@ -40,12 +40,12 @@ KOKKOS_INLINE_FUNCTION void specfem::domain::impl::sources::source< using_simd>:: compute_interaction( const specfem::datatype::ScalarPointViewType< - type_real, medium_type::components, using_simd> &stf, + type_real, components, using_simd> &stf, const specfem::datatype::ScalarPointViewType< - type_real, medium_type::components, using_simd> + type_real, components, using_simd> &lagrange_interpolant, specfem::datatype::ScalarPointViewType< - type_real, medium_type::components, using_simd> &acceleration) + type_real, components, using_simd> &acceleration) const { if constexpr (specfem::globals::simulation_wave == specfem::wave::p_sv) { diff --git a/include/domain/impl/sources/kernel.hpp b/include/domain/impl/sources/kernel.hpp index e6b91247..46de4b92 100644 --- a/include/domain/impl/sources/kernel.hpp +++ b/include/domain/impl/sources/kernel.hpp @@ -19,9 +19,13 @@ template class source_kernel { public: - using dimension = specfem::dimension::dimension; - using medium_type = - specfem::medium::medium; + constexpr static int num_dimensions = + specfem::element::attributes::dimension(); + constexpr static int components = + specfem::element::attributes::components(); + constexpr static auto medium_tag = MediumTag; + constexpr static auto property_tag = PropertyTag; + constexpr static auto dimension = DimensionType; using quadrature_point_type = qp_type; constexpr static bool using_simd = false; @@ -44,7 +48,7 @@ class source_kernel { specfem::compute::simulation_field field; specfem::compute::source_medium sources; quadrature_point_type quadrature_points; - specfem::domain::impl::sources::source source; }; diff --git a/include/domain/impl/sources/kernel.tpp b/include/domain/impl/sources/kernel.tpp index 18f693f9..002b3b2a 100644 --- a/include/domain/impl/sources/kernel.tpp +++ b/include/domain/impl/sources/kernel.tpp @@ -32,9 +32,9 @@ specfem::domain::impl::kernels::source_kernel< for (int isource = 0; isource < nsources; isource++) { const int ispec = sources.h_source_index_mapping(isource); if ((assembly.properties.h_element_types(ispec) != - medium_type::medium_tag) && + medium_tag) && (assembly.properties.h_element_property(ispec) != - medium_type::property_tag)) { + property_tag)) { throw std::runtime_error("Invalid element detected in kernel"); } } @@ -49,7 +49,7 @@ specfem::domain::impl::kernels::source_kernel< Kokkos::deep_copy(source_domain_index_mapping, h_source_domain_index_mapping); source = specfem::domain::impl::sources::source< - DimensionType, MediumTag, PropertyTag, quadrature_point_type, using_simd>(); + dimension, medium_tag, property_tag, quadrature_point_type, using_simd>(); return; } @@ -61,8 +61,7 @@ void specfem::domain::impl::kernels::source_kernel< WavefieldType, DimensionType, MediumTag, PropertyTag, qp_type>::compute_source_interaction(const int timestep) const { - constexpr int components = medium_type::components; - using PointFieldType = specfem::point::field; if (nsources == 0) @@ -91,13 +90,13 @@ void specfem::domain::impl::kernels::source_kernel< specfem::point::index index(ispec_l, iz, ix); const specfem::datatype::ScalarPointViewType< - type_real, medium_type::components, using_simd> + type_real, components, using_simd> lagrange_interpolant(Kokkos::subview( sources.source_array, isource_l, Kokkos::ALL, iz, ix)); // Source time function // For acoustic medium, forward simulation, divide by kappa - const auto stf = [&, timestep, components]() { + const auto stf = [&, timestep]() { if constexpr ((WavefieldType == specfem::wavefield::type::forward) && (MediumTag == @@ -113,7 +112,7 @@ void specfem::domain::impl::kernels::source_kernel< return point_properties; }(); specfem::datatype::ScalarPointViewType< - type_real, medium_type::components, using_simd> + type_real, components, using_simd> stf(Kokkos::subview(sources.source_time_function, timestep, isource_l, Kokkos::ALL)); for (int i = 0; i < components; i++) { @@ -122,7 +121,7 @@ void specfem::domain::impl::kernels::source_kernel< return stf; } else { return specfem::datatype::ScalarPointViewType< - type_real, medium_type::components, using_simd>( + type_real, components, using_simd>( Kokkos::subview(sources.source_time_function, timestep, isource_l, Kokkos::ALL)); } diff --git a/include/element/field.hpp b/include/element/field.hpp index 0994d8cd..014fd812 100644 --- a/include/element/field.hpp +++ b/include/element/field.hpp @@ -244,17 +244,17 @@ template struct FieldTraits - : ImplFieldTraits< - specfem::datatype::ScalarElementViewType< - type_real, NGLL, - specfem::medium::medium::components, - MemorySpace, MemoryTraits, UseSIMD>, - StoreDisplacement, StoreVelocity, StoreAcceleration, - StoreMassMatrix> { + : ImplFieldTraits::components(), + MemorySpace, MemoryTraits, UseSIMD>, + StoreDisplacement, StoreVelocity, StoreAcceleration, + StoreMassMatrix> { public: using ViewType = specfem::datatype::ScalarElementViewType< type_real, NGLL, - specfem::medium::medium::components, + specfem::element::attributes::components(), MemorySpace, MemoryTraits, UseSIMD>; KOKKOS_FUNCTION FieldTraits() = default; diff --git a/include/enumerations/medium.hpp b/include/enumerations/medium.hpp index 39bcf3ab..05378291 100644 --- a/include/enumerations/medium.hpp +++ b/include/enumerations/medium.hpp @@ -18,66 +18,35 @@ enum class medium_tag { elastic, acoustic, poroelastic }; * */ enum class property_tag { isotropic }; -} // namespace element - -namespace medium { -/** - * @brief Medium - * - * @tparam Dimension dimension type - * @tparam MediumTag medium tag - * @tparam PropertyTag property tag - */ template -class medium; + specfem::element::medium_tag MediumTag> +class attributes; -/** - * @brief 2D Elastic, Isotropic medium specialization - * - */ template <> -class medium { +class attributes { + public: - static constexpr auto dimension = - specfem::dimension::type::dim2; ///< dimension type - static constexpr auto medium_tag = - specfem::element::medium_tag::elastic; ///< medium tag - static constexpr auto property_tag = - specfem::element::property_tag::isotropic; ///< property tag - static constexpr int components = - 2; ///< Number of components for the field inside the medium - static std::string to_string() { - return "Elastic, Isotropic"; - } ///< Convert medium to string + constexpr static int dimension() { return 2; } + + constexpr static int components() { return 2; } }; -/** - * @brief 2D Acoustic, Isotropic medium specialization - * - */ template <> -class medium { +class attributes { + public: - static constexpr auto dimension = - specfem::dimension::type::dim2; ///< dimension type - static constexpr auto medium_tag = - specfem::element::medium_tag::acoustic; ///< medium tag - static constexpr auto property_tag = - specfem::element::property_tag::isotropic; ///< property tag - static constexpr int components = - 1; ///< Number of components for the field inside the medium - static std::string to_string() { - return "Acoustic, Isotropic"; - } ///< Convert medium to string + constexpr static int dimension() { return 2; } + + constexpr static int components() { return 1; } }; -} // namespace medium +const std::string to_string(const medium_tag &medium, + const property_tag &property_tag); + +const std::string to_string(const medium_tag &medium); + +} // namespace element } // namespace specfem diff --git a/include/enumerations/wavefield.hpp b/include/enumerations/wavefield.hpp index 8382ff0c..41ede765 100644 --- a/include/enumerations/wavefield.hpp +++ b/include/enumerations/wavefield.hpp @@ -1,5 +1,7 @@ #pragma once +#include "dimension.hpp" + namespace specfem { namespace wavefield { /** diff --git a/include/frechet_derivatives/frechet_derivatives.hpp b/include/frechet_derivatives/frechet_derivatives.hpp index 278ad7f0..2af7e950 100644 --- a/include/frechet_derivatives/frechet_derivatives.hpp +++ b/include/frechet_derivatives/frechet_derivatives.hpp @@ -20,8 +20,14 @@ template class frechet_derivatives { public: - using dimension = specfem::dimension::dimension; - using medium_type = specfem::medium::medium; + constexpr static auto dimension = DimensionType; ///< Dimension of the domain + constexpr static auto medium_tag = MediumTag; ///< Medium tag + + constexpr static int num_dimensions = + specfem::element::attributes::dimension(); + constexpr static int components = + specfem::element::attributes::components(); + constexpr static int ngll = NGLL; /** * @name Constructor diff --git a/include/medium/acoustic_isotropic2d/acoustic_isotropic2d.hpp b/include/medium/acoustic_isotropic2d/acoustic_isotropic2d.hpp new file mode 100644 index 00000000..adf43988 --- /dev/null +++ b/include/medium/acoustic_isotropic2d/acoustic_isotropic2d.hpp @@ -0,0 +1,36 @@ +#pragma once + +#include "enumerations/dimension.hpp" +#include "enumerations/medium.hpp" +#include "point/field_derivatives.hpp" +#include "point/properties.hpp" +#include "point/stress.hpp" +#include + +namespace specfem { +namespace medium { + +template +KOKKOS_INLINE_FUNCTION specfem::point::stress< + specfem::dimension::type::dim2, specfem::element::medium_tag::acoustic, + UseSIMD> +impl_compute_stress( + const specfem::point::properties< + specfem::dimension::type::dim2, specfem::element::medium_tag::acoustic, + specfem::element::property_tag::isotropic, UseSIMD> &properties, + const specfem::point::field_derivatives< + specfem::dimension::type::dim2, specfem::element::medium_tag::acoustic, + UseSIMD> &field_derivatives) { + + const auto &du = field_derivatives.du; + + specfem::datatype::VectorPointViewType T; + + T(0, 0) = properties.rho_inverse * du(0, 0); + T(1, 0) = properties.rho_inverse * du(1, 0); + + return { T }; +} + +} // namespace medium +} // namespace specfem diff --git a/include/medium/compute_stress.hpp b/include/medium/compute_stress.hpp new file mode 100644 index 00000000..df3fa5a6 --- /dev/null +++ b/include/medium/compute_stress.hpp @@ -0,0 +1,49 @@ +#pragma once + +#include "acoustic_isotropic2d/acoustic_isotropic2d.hpp" +#include "elastic_isotropic2d/elastic_isotropic2d.hpp" + +namespace specfem { +namespace medium { + +/** + * @brief Compute the stress tensor at a quadrature point + * + * @tparam PointPropertiesType Material properties at the quadrature point + * specfem::point::properties + * @tparam PointFieldDerivativesType Field derivatives at the quadrature point + * specfem::point::field_derivatives + * @param properties Material properties at the quadrature point + * @param field_derivatives Field derivatives at the quadrature point + * @return specfem::point::stress The stress tensor at the quadrature point + */ +template +KOKKOS_INLINE_FUNCTION auto +compute_stress(const PointPropertiesType &properties, + const PointFieldDerivativesType &field_derivatives) + -> decltype(specfem::medium::impl_compute_stress(properties, + field_derivatives)) { + + static_assert(PointPropertiesType::is_point_properties, + "properties is not a point properties type"); + static_assert(PointFieldDerivativesType::is_point_field_derivatives, + "field_derivatives is not a point field derivatives type"); + + static_assert(PointPropertiesType::dimension == + PointFieldDerivativesType::dimension, + "properties and field_derivatives have different dimensions"); + + static_assert(PointPropertiesType::medium_tag == + PointFieldDerivativesType::medium_tag, + "properties and field_derivatives have different medium tags"); + + static_assert( + PointPropertiesType::simd::using_simd == + PointFieldDerivativesType::simd::using_simd, + "properties and field_derivatives have different SIMD settings"); + + return specfem::medium::impl_compute_stress(properties, field_derivatives); +} + +} // namespace medium +} // namespace specfem diff --git a/include/medium/elastic_isotropic2d/elastic_isotropic2d.hpp b/include/medium/elastic_isotropic2d/elastic_isotropic2d.hpp new file mode 100644 index 00000000..ba560aca --- /dev/null +++ b/include/medium/elastic_isotropic2d/elastic_isotropic2d.hpp @@ -0,0 +1,52 @@ +#pragma once + +#include "enumerations/dimension.hpp" +#include "enumerations/medium.hpp" +#include "point/field_derivatives.hpp" +#include "point/properties.hpp" +#include "point/stress.hpp" +#include + +namespace specfem { +namespace medium { + +template +KOKKOS_INLINE_FUNCTION specfem::point::stress< + specfem::dimension::type::dim2, specfem::element::medium_tag::elastic, + UseSIMD> +impl_compute_stress( + const specfem::point::properties< + specfem::dimension::type::dim2, specfem::element::medium_tag::elastic, + specfem::element::property_tag::isotropic, UseSIMD> &properties, + const specfem::point::field_derivatives< + specfem::dimension::type::dim2, specfem::element::medium_tag::elastic, + UseSIMD> &field_derivatives) { + + using datatype = + typename specfem::datatype::simd::datatype; + const auto &du = field_derivatives.du; + + datatype sigma_xx, sigma_zz, sigma_xz; + + // P_SV case + // sigma_xx + sigma_xx = properties.lambdaplus2mu * du(0, 0) + properties.lambda * du(1, 1); + + // sigma_zz + sigma_zz = properties.lambdaplus2mu * du(1, 1) + properties.lambda * du(0, 0); + + // sigma_xz + sigma_xz = properties.mu * (du(0, 1) + du(1, 0)); + + specfem::datatype::VectorPointViewType T; + + T(0, 0) = sigma_xx; + T(0, 1) = sigma_xz; + T(1, 0) = sigma_xz; + T(1, 1) = sigma_zz; + + return { T }; +} + +} // namespace medium +} // namespace specfem diff --git a/include/medium/medium.hpp b/include/medium/medium.hpp new file mode 100644 index 00000000..9e6f6ee7 --- /dev/null +++ b/include/medium/medium.hpp @@ -0,0 +1,3 @@ +#pragma once + +#include "compute_stress.hpp" diff --git a/include/point/field.hpp b/include/point/field.hpp index e009fe06..bd3022cb 100644 --- a/include/point/field.hpp +++ b/include/point/field.hpp @@ -207,16 +207,17 @@ template struct FieldTraits - : public ImplFieldTraits< - specfem::datatype::ScalarPointViewType< - type_real, - specfem::medium::medium::components, - UseSIMD>, - StoreDisplacement, StoreVelocity, StoreAcceleration, - StoreMassMatrix> { + : public ImplFieldTraits::components(), + UseSIMD>, + StoreDisplacement, StoreVelocity, + StoreAcceleration, StoreMassMatrix> { using ViewType = specfem::datatype::ScalarPointViewType< - type_real, specfem::medium::medium::components, + type_real, + specfem::element::attributes::components(), UseSIMD>; public: diff --git a/include/point/field_derivatives.hpp b/include/point/field_derivatives.hpp index f1678f14..fdc96004 100644 --- a/include/point/field_derivatives.hpp +++ b/include/point/field_derivatives.hpp @@ -29,11 +29,13 @@ struct field_derivatives { * */ ///@{ + constexpr static bool is_point_field_derivatives = true; static constexpr int components = - specfem::medium::medium::components; - - static constexpr int dimension = - specfem::dimension::dimension::dim; + specfem::element::attributes::components(); + constexpr static auto medium_tag = MediumTag; ///< Medium tag for the element + constexpr static auto dimension = DimensionType; ///< Dimension of the element + constexpr static int num_dimensions = + specfem::element::attributes::dimension(); ///@} /** @@ -44,7 +46,8 @@ struct field_derivatives { using simd = specfem::datatype::simd; ///< SIMD type using ViewType = - specfem::datatype::VectorPointViewType; ///< Underlying view type ///< to store the field ///< derivatives diff --git a/include/point/properties.hpp b/include/point/properties.hpp index 8b0f8bcd..eee52175 100644 --- a/include/point/properties.hpp +++ b/include/point/properties.hpp @@ -35,6 +35,7 @@ struct properties; ///< SIMD type constexpr static auto dimension = specfem::dimension::type::dim2; constexpr static auto medium_tag = specfem::element::medium_tag::elastic; @@ -110,6 +111,7 @@ struct properties; ///< SIMD type constexpr static auto dimension = specfem::dimension::type::dim2; constexpr static auto medium_tag = specfem::element::medium_tag::acoustic; diff --git a/include/point/stress_integrand.hpp b/include/point/stress_integrand.hpp index c80b9a72..ea786e2e 100644 --- a/include/point/stress_integrand.hpp +++ b/include/point/stress_integrand.hpp @@ -35,9 +35,9 @@ struct stress_integrand { */ ///@{ constexpr static int dimension = - specfem::dimension::dimension::dim; + specfem::element::attributes::dimension(); constexpr static int components = - specfem::medium::medium::components; + specfem::element::attributes::components(); ///@} /** diff --git a/include/timescheme/newmark.hpp b/include/timescheme/newmark.hpp index e2ad5e07..b2446d84 100644 --- a/include/timescheme/newmark.hpp +++ b/include/timescheme/newmark.hpp @@ -23,13 +23,6 @@ template <> class newmark : public time_scheme { public: - using elastic_type = - specfem::medium::medium; - using acoustic_type = - specfem::medium::medium; - constexpr static auto simulation_type = specfem::wavefield::type::forward; ///< Wavefield tag @@ -134,14 +127,6 @@ class newmark : public time_scheme { public: constexpr static auto simulation_type = specfem::simulation::type::combined; ///< Wavefield tag - - using elastic_type = - specfem::medium::medium; - using acoustic_type = - specfem::medium::medium; - /** * @name Constructors */ diff --git a/include/timescheme/newmark.tpp b/include/timescheme/newmark.tpp index d39de309..ff1dcbc6 100644 --- a/include/timescheme/newmark.tpp +++ b/include/timescheme/newmark.tpp @@ -6,22 +6,21 @@ #include "timescheme/newmark.hpp" namespace { -template void corrector_phase_impl( const specfem::compute::simulation_field &field, const type_real deltatover2) { constexpr int components = - specfem::medium::medium::components; - const int nglob = field.template get_nglob(); + specfem::element::attributes::components(); + const int nglob = field.template get_nglob(); constexpr bool using_simd = true; using LoadFieldType = - specfem::point::field; using AddFieldType = - specfem::point::field; using ParallelConfig = specfem::parallel_config::default_range_config< @@ -70,7 +69,7 @@ void corrector_phase_impl( return; } -template void predictor_phase_impl( const specfem::compute::simulation_field &field, @@ -78,18 +77,18 @@ void predictor_phase_impl( const type_real deltasquareover2) { constexpr int components = - specfem::medium::medium::components; - const int nglob = field.template get_nglob(); + specfem::element::attributes::components(); + const int nglob = field.template get_nglob(); constexpr bool using_simd = true; using LoadFieldType = - specfem::point::field; using AddFieldType = - specfem::point::field; using StoreFieldType = - specfem::point::field; using ParallelConfig = specfem::parallel_config::default_range_config< diff --git a/include/writer/wavefield.hpp b/include/writer/wavefield.hpp index d59562e8..edaf7241 100644 --- a/include/writer/wavefield.hpp +++ b/include/writer/wavefield.hpp @@ -15,13 +15,6 @@ namespace writer { template class wavefield : public writer { public: - using elastic_type = - specfem::medium::medium; - using acoustic_type = - specfem::medium::medium; - /** * @name Constructors * diff --git a/src/compute/assembly/assembly.cpp b/src/compute/assembly/assembly.cpp new file mode 100644 index 00000000..9a34df05 --- /dev/null +++ b/src/compute/assembly/assembly.cpp @@ -0,0 +1,38 @@ + +#include "compute/assembly/assembly.hpp" +#include "mesh/mesh.hpp" + +specfem::compute::assembly::assembly( + const specfem::mesh::mesh &mesh, + const specfem::quadrature::quadratures &quadratures, + const std::vector > &sources, + const std::vector > + &receivers, + const std::vector &stypes, + const type_real t0, const type_real dt, const int max_timesteps, + const int max_sig_step, const specfem::simulation::type simulation) { + this->mesh = { mesh.tags, mesh.control_nodes, quadratures }; + this->partial_derivatives = { this->mesh }; + this->properties = { this->mesh.nspec, this->mesh.ngllz, this->mesh.ngllx, + this->mesh.mapping, mesh.tags, mesh.materials }; + this->kernels = { this->mesh.nspec, this->mesh.ngllz, this->mesh.ngllx, + this->mesh.mapping, mesh.tags }; + this->sources = { sources, this->mesh, this->partial_derivatives, + this->properties, t0, dt, + max_timesteps }; + this->receivers = { max_sig_step, receivers, stypes, this->mesh }; + this->boundaries = { this->mesh.nspec, this->mesh.ngllz, + this->mesh.ngllx, mesh, + this->mesh.mapping, this->mesh.quadratures, + this->properties, this->partial_derivatives }; + this->coupled_interfaces = { mesh, + this->mesh.points, + this->mesh.quadratures, + this->partial_derivatives, + this->properties, + this->mesh.mapping }; + this->fields = { this->mesh, this->properties, simulation }; + this->boundary_values = { max_timesteps, this->mesh, this->properties, + this->boundaries }; + return; +} diff --git a/src/compute/compute_assembly.cpp b/src/compute/compute_assembly.cpp deleted file mode 100644 index ce1da5a8..00000000 --- a/src/compute/compute_assembly.cpp +++ /dev/null @@ -1,464 +0,0 @@ - -#include "compute/assembly/assembly.hpp" -#include "mesh/mesh.hpp" - -namespace { - -template -class field_type_parameters; - -template -class field_type_parameters { -public: - constexpr static auto medium_tag = MediumTag; - constexpr static auto store_displacement = true; - constexpr static auto store_velocity = false; - constexpr static auto store_acceleration = false; - constexpr static auto store_mass_matrix = false; - constexpr static auto num_components = 2; -}; - -template -class field_type_parameters { -public: - constexpr static auto medium_tag = MediumTag; - constexpr static auto store_displacement = false; - constexpr static auto store_velocity = true; - constexpr static auto store_acceleration = false; - constexpr static auto store_mass_matrix = false; - constexpr static auto num_components = 2; -}; - -template -class field_type_parameters { -public: - constexpr static auto medium_tag = MediumTag; - constexpr static auto store_displacement = false; - constexpr static auto store_velocity = false; - constexpr static auto store_acceleration = true; - constexpr static auto store_mass_matrix = false; - constexpr static auto num_components = 2; -}; - -template -class helper; - -template -class helper { -public: - using field_parameters = - field_type_parameters; - helper(const specfem::compute::assembly &assembly, - Kokkos::View - wavefield_on_entire_grid) - : assembly(assembly), wavefield_on_entire_grid(wavefield_on_entire_grid) { - return; - } - - void compute_wavefield() { - const auto buffer = assembly.fields.buffer; - - const int nspec = assembly.mesh.nspec; - const int ngllz = assembly.mesh.ngllz; - const int ngllx = assembly.mesh.ngllx; - - const auto elements = - assembly.properties.get_elements_on_device(MediumTag, PropertyTag); - - using PointFieldType = - specfem::point::field; - - using ParallelConfig = specfem::parallel_config::point_config< - specfem::dimension::type::dim2, - specfem::datatype::simd, - Kokkos::DefaultExecutionSpace>; - - using ChunkPolicyType = specfem::policy::element_chunk; - - ChunkPolicyType chunk_policy(elements, ngllz, ngllx); - const int nelements = elements.extent(0); - - Kokkos::parallel_for( - "specfem::domain::impl::kernels::elements::compute_mass_matrix", - static_cast( - chunk_policy), - KOKKOS_CLASS_LAMBDA(const typename ChunkPolicyType::member_type &team) { - for (int tile = 0; tile < ChunkPolicyType::tile_size * simd_size; - tile += ChunkPolicyType::chunk_size * simd_size) { - const int starting_element_index = - team.league_rank() * ChunkPolicyType::tile_size * simd_size + - tile; - - if (starting_element_index >= nelements) { - break; - } - - const auto iterator = - chunk_policy.league_iterator(starting_element_index); - - Kokkos::parallel_for( - Kokkos::TeamThreadRange(team, iterator.chunk_size()), - [&](const int i) { - const auto iterator_index = iterator(i); - const auto index = iterator_index.index; - - PointFieldType field; - - specfem::compute::load_on_device(index, buffer, field); - - for (int icomponent = 0; - icomponent < field_parameters::num_components; - icomponent++) { - wavefield_on_entire_grid(index.ispec, index.iz, index.ix, - icomponent) = field(icomponent); - } - }); - } - }); - - return; - } - -private: - const specfem::compute::assembly &assembly; - Kokkos::View - wavefield_on_entire_grid; -}; - -template -class helper { -public: - using field_parameters = - field_type_parameters; - helper(const specfem::compute::assembly &assembly, - Kokkos::View - wavefield_on_entire_grid) - : assembly(assembly), wavefield_on_entire_grid(wavefield_on_entire_grid) { - } - - void compute_wavefield() { - const auto buffer = assembly.fields.buffer; - - const int nspec = assembly.mesh.nspec; - const int ngllz = assembly.mesh.ngllz; - const int ngllx = assembly.mesh.ngllx; - - const auto elements = - assembly.properties.get_elements_on_device(MediumTag, PropertyTag); - const int nelements = elements.extent(0); - - using ChunkElementFieldType = specfem::chunk_element::field< - ParallelConfig::chunk_size, ngll, specfem::dimension::type::dim2, - MediumTag, specfem::kokkos::DevScratchSpace, - Kokkos::MemoryTraits, - field_parameters::store_displacement, field_parameters::store_velocity, - field_parameters::store_acceleration, - field_parameters::store_mass_matrix, false>; - - using QuadratureType = specfem::element::quadrature< - ngll, specfem::dimension::type::dim2, specfem::kokkos::DevScratchSpace, - Kokkos::MemoryTraits, true, false>; - - using simd = specfem::datatype::simd; - using ParallelConfig = specfem::parallel_config::chunk_config< - specfem::dimension::type::dim2, simd, Kokkos::DefaultExecutionSpace>; - using ChunkPolicyType = specfem::policy::element_chunk; - - int scratch_size = - ChunkElementFieldType::shmem_size() + QuadratureType::shmem_size(); - ChunkPolicyType chunk_policy(elements, ngllz, ngllx); - - Kokkos::parallel_for( - "compute_wavefield", - chunk_policy.set_scratch_size(0, Kokkos::PerTeam(scratch_size)), - KOKKOS_CLASS_LAMBDA(const typename ChunkPolicyType::member_type &team) { - QuadratureType quadrature(team); - ChunkElementFieldType field(team); - - specfem::compute::load_on_device(team, assembly.mesh.quadratures, - quadrature); - - for (int tile = 0; tile < ChunkPolicyType::tile_size * simd_size; - tile += ChunkPolicyType::chunk_size * simd_size) { - const int starting_element_index = - team.league_rank() * ChunkPolicyType::tile_size * simd_size + - tile; - - if (starting_element_index >= nelements) { - break; - } - - const auto iterator = - chunk_policy.league_iterator(starting_element_index); - specfem::compute::load_on_device(team, iterator, buffer, field); - team.team_barrier(); - - const auto &active_field = [&]() { - if constexpr (Component == - specfem::wavefield::component::displacement) { - return field.displacement; - } else if constexpr (Component == - specfem::wavefield::component::velocity) { - return field.velocity; - } else if constexpr (Component == specfem::wavefield::component:: - acceleration) { - return field.acceleration; - } else { - static_assert("component not supported"); - } - }(); - - specfem::algorithms::gradient( - team, iterator, quadrature.hprime, active_field, - [&](const typename ChunkPolicyType::iterator_type::index_type - &iterator_index, - const typename PointFieldDerivatives::ViewType &du) { - PointPropertyType point_property; - PointFieldDerivativesType field_derivatives(du); - - PointStressType stress = specfem::element::compute_stress( - point_property, field_derivatives); - - for (int icomponent = 0; icomponent < num_components; - icomponent++) { - wavefield_on_entire_grid( - iterator_index.index.ispec, iterator_index.index.iz, - iterator_index.index.ix, icomponent) = - stress(icomponent, 0); - } - }); - } - }); - - return; - } - -private: - const specfem::compute::assembly &assembly; - Kokkos::View - wavefield_on_entire_grid; -}; - -template -void get_wavefield_on_entire_grid( - const specfem::compute::assembly &assembly, - Kokkos::View - wavefield_on_entire_grid) { - - helper handle(assembly, - wavefield_on_entire_grid); - - handle.compute_wavefield(); - return; -} - -} // namespace - -// template <> -// get_wavefield_on_entire_grid( -// const specfem::compute::assembly &assembly, -// Kokkos::View -// wavefield_on_entire_grid) { - -// const auto buffer = assembly.fields.buffer; - -// const int nspec = assembly.mesh.nspec; -// const int ngllz = assembly.mesh.ngllz; -// const int ngllx = assembly.mesh.ngllx; -// // Get parameters for the chunk field type -// using field_parameters = field_parameters; - -// using simd = specfem::datatype::simd; -// using parallel_config = specfem::parallel_config::chunk_config< -// specfem::dimension::type::dim2, simd, Kokkos::DefaultExecutionSpace>; -// using ChunkPolicyType = specfem::policy::element_chunk; - -// using ChunkElementFieldType = specfem::chunk_element::field< -// ParallelConfig::chunk_size, ngll, specfem::dimension::type::dim2, -// MediumTag, specfem::kokkos::DevScratchSpace, -// Kokkos::MemoryTraits, -// field_parameters::store_displacement, field_parameters::store_velocity, -// field_parameters::store_acceleration, -// field_parameters::store_mass_matrix, false>; -// using QuadratureType = specfem::element::quadrature< -// ngll, specfem::dimension::type::dim2, specfem::kokkos::DevScratchSpace, -// Kokkos::MemoryTraits, true, false>; - -// using ScalarPointViewType = specfem::datatype::ScalarPointViewType< -// type_real, field_parameters::num_components, false>; - -// const auto elements = -// assembly.properties.get_elements_on_device(MediumTag); const -// ChunkPolicyType chunk_policy(elements, ngllz, ngllx); const int nelements = -// elements.extent(0); - -// Kokkos::parallel_for( -// "get_wavefield_on_entire_grid", -// chunk_policy.set_scratch_size( -// 0, Kokkos::PerTeam(ChunkElementFieldType::shmem_size())), -// KOKKOS_CLASS_LAMBDA(const typename ChunkPolicyType::member_type &team) -// { -// QuadratureType quadrature(team); -// ChunkElementFieldType field(team); - -// specfem::compute::load_on_device(team, assembly.mesh.quadratures, -// quadrature); - -// for (int tile = 0; tile < ChunkPolicyType::tile_size * simd_size; -// tile += ChunkPolicyType::chunk_size * simd_size) { -// const int starting_element_index = -// team.league_rank() * ChunkPolicyType::tile_size * simd_size + -// tile; - -// if (starting_element_index >= nelements) { -// break; -// } - -// const auto iterator = -// chunk_policy.league_iterator(starting_element_index); -// specfem::compute::load_on_device(team, iterator, buffer, field); -// team.team_barrier(); - -// specfem::element::compute_wavefield( -// iterator, quadrature, field, -// [&](const ChunkPolicyType::iterator_type::index_type -// &iterator_index, -// const ScalarPointViewType &point_field) { -// const int ispec = iterator_index.index.ispec; -// const int iz = iterator_index.index.iz; -// const int ix = iterator_index.index.ix; -// for (int icomponent = 0; icomponent < num_components; -// icomponent++) { -// wavefield_on_entire_grid(ispec, iz, ix) = -// point_field(icomponent); -// } -// }); -// } -// }); - -// return; -// } - -} // namespace - -specfem::compute::assembly::assembly( - const specfem::mesh::mesh &mesh, - const specfem::quadrature::quadratures &quadratures, - const std::vector > &sources, - const std::vector > - &receivers, - const std::vector &stypes, - const type_real t0, const type_real dt, const int max_timesteps, - const int max_sig_step, const specfem::simulation::type simulation) { - this->mesh = { mesh.tags, mesh.control_nodes, quadratures }; - this->partial_derivatives = { this->mesh }; - this->properties = { this->mesh.nspec, this->mesh.ngllz, this->mesh.ngllx, - this->mesh.mapping, mesh.tags, mesh.materials }; - this->kernels = { this->mesh.nspec, this->mesh.ngllz, this->mesh.ngllx, - this->mesh.mapping, mesh.tags }; - this->sources = { sources, this->mesh, this->partial_derivatives, - this->properties, t0, dt, - max_timesteps }; - this->receivers = { max_sig_step, receivers, stypes, this->mesh }; - this->boundaries = { this->mesh.nspec, this->mesh.ngllz, - this->mesh.ngllx, mesh, - this->mesh.mapping, this->mesh.quadratures, - this->properties, this->partial_derivatives }; - this->coupled_interfaces = { mesh, - this->mesh.points, - this->mesh.quadratures, - this->partial_derivatives, - this->properties, - this->mesh.mapping }; - this->fields = { this->mesh, this->properties, simulation }; - this->boundary_values = { max_timesteps, this->mesh, this->properties, - this->boundaries }; - return; -} - -Kokkos::View -specfem::compute::assembly::generate_wavefield_on_entire_grid( - const specfem::wavefield::type wavefield, - const specfem::wavefield::component component) { - - const int ncomponents = [&]() -> int { - if (component == specfem::wavefield::component::displacement) { - return 2; - } else if (component == specfem::wavefield::component::velocity) { - return 2; - } else if (component == specfem::wavefield::component::acceleration) { - return 2; - } else { - throw std::runtime_error("Wavefield component not supported"); - } - }(); - - // Copy the required wavefield into the buffer - if (wavefield == specfem::wavefield::type::forward) { - Kokkos::deep_copy(this->fields.buffer, this->fields.forward); - } else if (wavefield == specfem::wavefield::type::adjoint) { - Kokkos::deep_copy(this->fields.buffer, this->fields.adjoint); - } else if (wavefield == specfem::wavefield::type::backward) { - Kokkos::deep_copy(this->fields.buffer, this->fields.backward); - } else { - throw std::runtime_error("Wavefield type not supported"); - } - - Kokkos::View - wavefield_on_entire_grid("wavefield_on_entire_grid", this->mesh.nspec, - this->mesh.ngllz, this->mesh.ngllx, ncomponents); - - const auto h_wavefield_on_entire_grid = - Kokkos::create_mirror_view(wavefield_on_entire_grid); - - if (component == specfem::wavefield::component::displacement) { - get_wavefield_on_entire_grid( - *this, wavefield_on_entire_grid); - get_wavefield_on_entire_grid( - *this, wavefield_on_entire_grid); - } else if (component == specfem::wavefield::component::velocity) { - get_wavefield_on_entire_grid( - *this, wavefield_on_entire_grid); - get_wavefield_on_entire_grid( - *this, wavefield_on_entire_grid); - } else if (component == specfem::wavefield::component::acceleration) { - get_wavefield_on_entire_grid( - *this, wavefield_on_entire_grid); - get_wavefield_on_entire_grid( - *this, wavefield_on_entire_grid); - } else { - throw std::runtime_error("Wavefield component not supported"); - } - - Kokkos::deep_copy(h_wavefield_on_entire_grid, wavefield_on_entire_grid); - - return h_wavefield_on_entire_grid; -} diff --git a/src/compute/compute_properties.cpp b/src/compute/compute_properties.cpp index df082e5e..3ddaf172 100644 --- a/src/compute/compute_properties.cpp +++ b/src/compute/compute_properties.cpp @@ -97,12 +97,13 @@ specfem::compute::properties::properties( Kokkos::View specfem::compute::properties::get_elements_on_host( - const specfem::element::medium_tag medium) const { - const auto &elements = [&]() -> impl::elements_of_type & { + const specfem::element::medium_tag medium) { + + auto &elements = [&]() -> impl::elements_of_type & { if (medium == specfem::element::medium_tag::elastic) { - return elastic_elements; + return this->elastic_elements; } else if (medium == specfem::element::medium_tag::acoustic) { - return acoustic_elements; + return this->acoustic_elements; } else { throw std::runtime_error("Unknown medium tag"); } @@ -142,12 +143,13 @@ specfem::compute::properties::get_elements_on_host( } Kokkos::View -get_elements_on_device(const specfem::element::medium_tag medium) const { - const auto &elements = [&]() { +specfem::compute::properties::get_elements_on_device( + const specfem::element::medium_tag medium) { + auto &elements = [&]() -> impl::elements_of_type & { if (medium == specfem::element::medium_tag::elastic) { - return elastic_elements; + return this->elastic_elements; } else if (medium == specfem::element::medium_tag::acoustic) { - return acoustic_elements; + return this->acoustic_elements; } else { throw std::runtime_error("Unknown medium tag"); } @@ -168,8 +170,8 @@ get_elements_on_device(const specfem::element::medium_tag medium) const { Kokkos::View specfem::compute::properties::get_elements_on_host( const specfem::element::medium_tag medium, - const specfem::element::property_tag property) const { - const auto &elements = [&]() -> impl::elements_of_type & { + const specfem::element::property_tag property) { + auto &elements = [&]() -> impl::elements_of_type & { if (medium == specfem::element::medium_tag::elastic) { if (property == specfem::element::property_tag::isotropic) { return elastic_isotropic_elements; @@ -221,9 +223,10 @@ specfem::compute::properties::get_elements_on_host( } Kokkos::View -get_elements_on_device(const specfem::element::medium_tag medium, - const specfem::element::property_tag property) const { - const auto &elements = [&]() { +specfem::compute::properties::get_elements_on_device( + const specfem::element::medium_tag medium, + const specfem::element::property_tag property) { + auto &elements = [&]() -> impl::elements_of_type & { if (medium == specfem::element::medium_tag::elastic) { if (property == specfem::element::property_tag::isotropic) { return elastic_isotropic_elements; diff --git a/src/enumerations/medium.cpp b/src/enumerations/medium.cpp new file mode 100644 index 00000000..5b756e53 --- /dev/null +++ b/src/enumerations/medium.cpp @@ -0,0 +1,27 @@ +#include "enumerations/medium.hpp" + +const std::string specfem::element::to_string( + const specfem::element::medium_tag &medium, + const specfem::element::property_tag &property_tag) { + + if ((medium == specfem::element::medium_tag::elastic) && + (property_tag == specfem::element::property_tag::isotropic)) { + return "elastic isotropic"; + } else if ((medium == specfem::element::medium_tag::acoustic) && + (property_tag == specfem::element::property_tag::isotropic)) { + return "acoustic isotropic"; + } else { + return "unknown"; + } +} + +const std::string +specfem::element::to_string(const specfem::element::medium_tag &medium) { + if (medium == specfem::element::medium_tag::elastic) { + return "elastic"; + } else if (medium == specfem::element::medium_tag::acoustic) { + return "acoustic"; + } else { + return "unknown"; + } +} From 02a45d97166093465fbda46ca12f2e1f623af36e Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Fri, 8 Nov 2024 16:51:38 -0500 Subject: [PATCH 13/53] Implementation of point stress --- include/point/stress.hpp | 93 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 include/point/stress.hpp diff --git a/include/point/stress.hpp b/include/point/stress.hpp new file mode 100644 index 00000000..9b126564 --- /dev/null +++ b/include/point/stress.hpp @@ -0,0 +1,93 @@ +#pragma once + +#include "datatypes/point_view.hpp" +#include "enumerations/dimension.hpp" +#include "enumerations/medium.hpp" +#include + +namespace specfem { +namespace point { + +/** + * @brief Stress tensor at a quadrature point + * + * @tparam DimensionType Dimension of the element (2D or 3D) + * @tparam MediumTag Medium tag for the element + * @tparam UseSIMD Use SIMD instructions + */ +template +struct stress { + /** + * @name Compile time constants + * + */ + ///@{ + constexpr static int dimension = + specfem::element::attributes::dimension(); + constexpr static int components = + specfem::element::attributes::components(); + ///@} + + /** + * @name Typedefs + * + */ + ///@{ + using simd = specfem::datatype::simd; ///< SIMD type + + using ViewType = + specfem::datatype::VectorPointViewType; ///< Underlying view type + ///< to store the stress + ///< tensor + ///@} + + ViewType T; ///< View to store the stress tensor + + /** + * @name Constructors + * + */ + ///@{ + + /** + * @brief Default constructor + * + */ + KOKKOS_FUNCTION stress() = default; + + /** + * @brief Constructor + * + * @param T stress tensor + */ + KOKKOS_FUNCTION stress(const ViewType &T) : T(T) {} + ///@} + + /** + * @brief Compute the product of the stress tensor with spatial derivatives + * + * /f$ F_{ij} = \sum_{k=1}^{N} T_{ik} \partial_k xi_j /f$ + * + * @param partial_derivatives Spatial derivatives + * @return ViewType Result of the product + */ + KOKKOS_INLINE_FUNCTION + ViewType operator*(const specfem::point::partial_derivatives< + specfem::dimension::type::dim2, false, UseSIMD> + &partial_derivatives) const { + ViewType F; + + for (int icomponent = 0; icomponent < components; ++icomponent) { + F(0, icomponent) = T(0, icomponent) * partial_derivatives.xix + + T(1, icomponent) * partial_derivatives.xiz; + F(1, icomponent) = T(0, icomponent) * partial_derivatives.gammax + + T(1, icomponent) * partial_derivatives.gammaz; + } + + return F; + } +}; +} // namespace point +} // namespace specfem From 88f0d2a93373dbeb07c0bd96674666949736efee Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Wed, 13 Nov 2024 15:43:14 -0500 Subject: [PATCH 14/53] Added routine to generate wavefields. - Added tests for generating wavefields --- CMakeLists.txt | 1 + include/compute/assembly/assembly.hpp | 11 +- include/point/field.hpp | 51 +++ src/compute/assembly/compute_wavefield.cpp | 106 ++++++ src/compute/assembly/helper.hpp | 301 ++++++++++++++++++ src/compute/fields/fields.cpp | 2 +- tests/unit-tests/CMakeLists.txt | 4 +- .../compute_wavefield/compute_wavefield.cpp | 110 +++++++ .../compute_wavefield/generate_data.hpp | 120 +++++++ .../compute_wavefield/test_helper.hpp | 137 ++++++++ .../assembly/{ => kernels}/kernels.cpp | 2 +- .../assembly/test_fixture/test_fixture.cpp | 61 ++++ .../{ => test_fixture}/test_fixture.hpp | 66 +--- .../assembly/test_fixture/test_fixture.tpp | 17 + 14 files changed, 915 insertions(+), 74 deletions(-) create mode 100644 src/compute/assembly/compute_wavefield.cpp create mode 100644 src/compute/assembly/helper.hpp create mode 100644 tests/unit-tests/assembly/compute_wavefield/compute_wavefield.cpp create mode 100644 tests/unit-tests/assembly/compute_wavefield/generate_data.hpp create mode 100644 tests/unit-tests/assembly/compute_wavefield/test_helper.hpp rename tests/unit-tests/assembly/{ => kernels}/kernels.cpp (99%) create mode 100644 tests/unit-tests/assembly/test_fixture/test_fixture.cpp rename tests/unit-tests/assembly/{ => test_fixture}/test_fixture.hpp (58%) create mode 100644 tests/unit-tests/assembly/test_fixture/test_fixture.tpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 02dc90eb..140bcc97 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -346,6 +346,7 @@ add_library( src/compute/fields/fields.cpp src/compute/compute_boundary_values.cpp src/compute/assembly/assembly.cpp + src/compute/assembly/compute_wavefield.cpp ) target_link_libraries( diff --git a/include/compute/assembly/assembly.hpp b/include/compute/assembly/assembly.hpp index ca08f597..c5bf089c 100644 --- a/include/compute/assembly/assembly.hpp +++ b/include/compute/assembly/assembly.hpp @@ -82,17 +82,14 @@ struct assembly { * This field can be used to generate a plot of the wavefield * * @param component Component of the wavefield to map - * @return Kokkos::View + * @return Kokkos::View * Wavefield mapped on the entire grid. Dimensions of the view are nspec, * ngllz, ngllx */ - Kokkos::View + Kokkos::View generate_wavefield_on_entire_grid( - const specfem::display::wavefield &component) const { - // dummy implementation - return Kokkos::View( - "result", mesh.nspec, mesh.ngllz, mesh.ngllx); - }; + const specfem::wavefield::type wavefield, + const specfem::wavefield::component component); }; } // namespace compute diff --git a/include/point/field.hpp b/include/point/field.hpp index bd3022cb..e8d548be 100644 --- a/include/point/field.hpp +++ b/include/point/field.hpp @@ -159,6 +159,42 @@ struct ImplFieldTraits : public Displacement, "Acceleration and mass matrix are not stored"); } + KOKKOS_FUNCTION typename ViewType::value_type & + operator()(const int i, std::true_type, std::false_type, std::false_type, + std::false_type) { + return this->displacement(i); + } + + KOKKOS_FUNCTION typename ViewType::value_type & + operator()(const int i, std::false_type, std::true_type, std::false_type, + std::false_type) { + return this->velocity(i); + } + + KOKKOS_FUNCTION typename ViewType::value_type & + operator()(const int i, std::false_type, std::false_type, std::true_type, + std::false_type) { + return this->acceleration(i); + } + + KOKKOS_FUNCTION const typename ViewType::value_type & + operator()(const int i, std::true_type, std::false_type, std::false_type, + std::false_type) const { + return this->displacement(i); + } + + KOKKOS_FUNCTION const typename ViewType::value_type & + operator()(const int i, std::false_type, std::true_type, std::false_type, + std::false_type) const { + return this->velocity(i); + } + + KOKKOS_FUNCTION const typename ViewType::value_type & + operator()(const int i, std::false_type, std::false_type, std::true_type, + std::false_type) const { + return this->acceleration(i); + } + public: KOKKOS_FUNCTION ImplFieldTraits() = default; @@ -187,6 +223,21 @@ struct ImplFieldTraits : public Displacement, std::integral_constant{}, std::integral_constant{}) {} + KOKKOS_FUNCTION typename ViewType::value_type &operator()(const int i) { + return operator()(i, std::integral_constant{}, + std::integral_constant{}, + std::integral_constant{}, + std::integral_constant{}); + } + + KOKKOS_FUNCTION const typename ViewType::value_type & + operator()(const int i) const { + return operator()(i, std::integral_constant{}, + std::integral_constant{}, + std::integral_constant{}, + std::integral_constant{}); + } + /** * @brief Divide acceleration by mass matrix * diff --git a/src/compute/assembly/compute_wavefield.cpp b/src/compute/assembly/compute_wavefield.cpp new file mode 100644 index 00000000..52e06ac8 --- /dev/null +++ b/src/compute/assembly/compute_wavefield.cpp @@ -0,0 +1,106 @@ + +#include "compute/assembly/assembly.hpp" +#include "helper.hpp" + +namespace { + +template +void get_wavefield_on_entire_grid( + specfem::compute::assembly &assembly, + Kokkos::View + wavefield_on_entire_grid) { + + const int ngllx = assembly.mesh.ngllx; + const int ngllz = assembly.mesh.ngllz; + + if (ngllx == 5 && ngllz == 5) { + impl::helper helper( + assembly, wavefield_on_entire_grid); + helper(); + } else if (ngllx == 8 && ngllz == 8) { + impl::helper helper( + assembly, wavefield_on_entire_grid); + helper(); + } else { + throw std::runtime_error("Number of quadrature points not supported"); + } + + return; +} + +} // namespace + +Kokkos::View +specfem::compute::assembly::generate_wavefield_on_entire_grid( + const specfem::wavefield::type wavefield, + const specfem::wavefield::component component) { + + const int ncomponents = [&]() -> int { + if (component == specfem::wavefield::component::displacement) { + return 2; + } else if (component == specfem::wavefield::component::velocity) { + return 2; + } else if (component == specfem::wavefield::component::acceleration) { + return 2; + } else { + throw std::runtime_error("Wavefield component not supported"); + } + }(); + + // Copy the required wavefield into the buffer + if (wavefield == specfem::wavefield::type::forward) { + specfem::compute::deep_copy(this->fields.buffer, this->fields.forward); + } else if (wavefield == specfem::wavefield::type::adjoint) { + specfem::compute::deep_copy(this->fields.buffer, this->fields.adjoint); + } else if (wavefield == specfem::wavefield::type::backward) { + specfem::compute::deep_copy(this->fields.buffer, this->fields.backward); + } else { + throw std::runtime_error("Wavefield type not supported"); + } + + Kokkos::View + wavefield_on_entire_grid("wavefield_on_entire_grid", this->mesh.nspec, + this->mesh.ngllz, this->mesh.ngllx, ncomponents); + + const auto h_wavefield_on_entire_grid = + Kokkos::create_mirror_view(wavefield_on_entire_grid); + + if (component == specfem::wavefield::component::displacement) { + get_wavefield_on_entire_grid( + *this, wavefield_on_entire_grid); + get_wavefield_on_entire_grid( + *this, wavefield_on_entire_grid); + } else if (component == specfem::wavefield::component::velocity) { + get_wavefield_on_entire_grid( + *this, wavefield_on_entire_grid); + get_wavefield_on_entire_grid( + *this, wavefield_on_entire_grid); + } else if (component == specfem::wavefield::component::acceleration) { + get_wavefield_on_entire_grid( + *this, wavefield_on_entire_grid); + get_wavefield_on_entire_grid( + *this, wavefield_on_entire_grid); + } else { + throw std::runtime_error("Wavefield component not supported"); + } + + Kokkos::deep_copy(h_wavefield_on_entire_grid, wavefield_on_entire_grid); + + return h_wavefield_on_entire_grid; +} diff --git a/src/compute/assembly/helper.hpp b/src/compute/assembly/helper.hpp new file mode 100644 index 00000000..c823db04 --- /dev/null +++ b/src/compute/assembly/helper.hpp @@ -0,0 +1,301 @@ +#pragma once + +#include "algorithms/gradient.hpp" +#include "chunk_element/field.hpp" +#include "compute/assembly/assembly.hpp" +#include "enumerations/dimension.hpp" +#include "enumerations/medium.hpp" +#include "enumerations/wavefield.hpp" +#include "medium/medium.hpp" +#include "parallel_configuration/chunk_config.hpp" +#include "point/field.hpp" +#include "point/field_derivatives.hpp" +#include "point/properties.hpp" +#include "policies/chunk.hpp" + +namespace impl { +template +class field_type_parameters; + +template +class field_type_parameters { +public: + constexpr static auto medium_tag = MediumTag; + constexpr static auto store_displacement = true; + constexpr static auto store_velocity = false; + constexpr static auto store_acceleration = false; + constexpr static auto store_mass_matrix = false; + constexpr static auto num_components = 2; +}; + +template +class field_type_parameters { +public: + constexpr static auto medium_tag = MediumTag; + constexpr static auto store_displacement = false; + constexpr static auto store_velocity = true; + constexpr static auto store_acceleration = false; + constexpr static auto store_mass_matrix = false; + constexpr static auto num_components = 2; +}; + +template +class field_type_parameters { +public: + constexpr static auto medium_tag = MediumTag; + constexpr static auto store_displacement = false; + constexpr static auto store_velocity = false; + constexpr static auto store_acceleration = true; + constexpr static auto store_mass_matrix = false; + constexpr static auto num_components = 2; +}; + +template +class helper; + +template +class helper { +public: + constexpr static auto medium_tag = specfem::element::medium_tag::elastic; + constexpr static auto property_tag = PropertyTag; + constexpr static auto component = Component; + constexpr static auto ngll = NGLL; + using field_parameters = field_type_parameters; + helper(specfem::compute::assembly &assembly, + Kokkos::View + wavefield_on_entire_grid) + : assembly(assembly), wavefield_on_entire_grid(wavefield_on_entire_grid) { + if (assembly.mesh.ngllz != ngll || assembly.mesh.ngllx != ngll) { + throw std::runtime_error("Number of quadrature points not supported"); + } + return; + } + + void operator()() const { + const auto buffer = assembly.fields.buffer; + + const int nspec = assembly.mesh.nspec; + const int ngllz = assembly.mesh.ngllz; + const int ngllx = assembly.mesh.ngllx; + + const auto elements = + assembly.properties.get_elements_on_device(medium_tag, property_tag); + + using PointFieldType = + specfem::point::field; + + using simd = specfem::datatype::simd; + constexpr int simd_size = simd::size(); + + using ParallelConfig = specfem::parallel_config::default_chunk_config< + specfem::dimension::type::dim2, simd, Kokkos::DefaultExecutionSpace>; + + using ChunkPolicyType = specfem::policy::element_chunk; + + ChunkPolicyType chunk_policy(elements, ngllz, ngllx); + const int nelements = elements.extent(0); + + Kokkos::parallel_for( + "specfem::domain::impl::kernels::elements::compute_mass_matrix", + static_cast( + chunk_policy), + KOKKOS_CLASS_LAMBDA(const typename ChunkPolicyType::member_type &team) { + for (int tile = 0; tile < ChunkPolicyType::tile_size * simd_size; + tile += ChunkPolicyType::chunk_size * simd_size) { + const int starting_element_index = + team.league_rank() * ChunkPolicyType::tile_size * simd_size + + tile; + + if (starting_element_index >= nelements) { + break; + } + + const auto iterator = + chunk_policy.league_iterator(starting_element_index); + + Kokkos::parallel_for( + Kokkos::TeamThreadRange(team, iterator.chunk_size()), + [&](const int i) { + const auto iterator_index = iterator(i); + const auto index = iterator_index.index; + + PointFieldType field; + + specfem::compute::load_on_device(index, buffer, field); + + for (int icomponent = 0; + icomponent < field_parameters::num_components; + icomponent++) { + wavefield_on_entire_grid(index.ispec, index.iz, index.ix, + icomponent) = field(icomponent); + } + }); + } + }); + + return; + } + +private: + specfem::compute::assembly &assembly; + Kokkos::View + wavefield_on_entire_grid; +}; + +template +class helper { +public: + constexpr static auto medium_tag = specfem::element::medium_tag::acoustic; + constexpr static auto property_tag = PropertyTag; + constexpr static auto component = Component; + constexpr static auto ngll = NGLL; + using field_parameters = + field_type_parameters; + helper(specfem::compute::assembly &assembly, + Kokkos::View + wavefield_on_entire_grid) + : assembly(assembly), wavefield_on_entire_grid(wavefield_on_entire_grid) { + if (assembly.mesh.ngllz != ngll || assembly.mesh.ngllx != ngll) { + throw std::runtime_error("Number of quadrature points not supported"); + } + } + + void operator()() const { + const auto buffer = assembly.fields.buffer; + + const int nspec = assembly.mesh.nspec; + const int ngllz = assembly.mesh.ngllz; + const int ngllx = assembly.mesh.ngllx; + + const auto elements = + assembly.properties.get_elements_on_device(medium_tag, property_tag); + const int nelements = elements.extent(0); + + constexpr auto num_components = field_parameters::num_components; + + using simd = specfem::datatype::simd; + constexpr int simd_size = simd::size(); + using ParallelConfig = specfem::parallel_config::default_chunk_config< + specfem::dimension::type::dim2, simd, Kokkos::DefaultExecutionSpace>; + + using ChunkElementFieldType = specfem::chunk_element::field< + ParallelConfig::chunk_size, ngll, specfem::dimension::type::dim2, + medium_tag, specfem::kokkos::DevScratchSpace, + Kokkos::MemoryTraits, + field_parameters::store_displacement, field_parameters::store_velocity, + field_parameters::store_acceleration, + field_parameters::store_mass_matrix, false>; + + using QuadratureType = specfem::element::quadrature< + ngll, specfem::dimension::type::dim2, specfem::kokkos::DevScratchSpace, + Kokkos::MemoryTraits, true, false>; + + using PointPropertyType = + specfem::point::properties; + + using PointFieldDerivativesType = + specfem::point::field_derivatives; + + using ChunkPolicyType = specfem::policy::element_chunk; + + int scratch_size = + ChunkElementFieldType::shmem_size() + QuadratureType::shmem_size(); + ChunkPolicyType chunk_policy(elements, ngllz, ngllx); + + Kokkos::parallel_for( + "compute_wavefield", + chunk_policy.set_scratch_size(0, Kokkos::PerTeam(scratch_size)), + KOKKOS_CLASS_LAMBDA(const typename ChunkPolicyType::member_type &team) { + QuadratureType quadrature(team); + ChunkElementFieldType field(team); + + specfem::compute::load_on_device(team, assembly.mesh.quadratures, + quadrature); + + for (int tile = 0; tile < ChunkPolicyType::tile_size * simd_size; + tile += ChunkPolicyType::chunk_size * simd_size) { + const int starting_element_index = + team.league_rank() * ChunkPolicyType::tile_size * simd_size + + tile; + + if (starting_element_index >= nelements) { + break; + } + + const auto iterator = + chunk_policy.league_iterator(starting_element_index); + specfem::compute::load_on_device(team, iterator, buffer, field); + team.team_barrier(); + + const auto &active_field = [&]() { + if constexpr (Component == + specfem::wavefield::component::displacement) { + return field.displacement; + } else if constexpr (Component == + specfem::wavefield::component::velocity) { + return field.velocity; + } else if constexpr (Component == specfem::wavefield::component:: + acceleration) { + return field.acceleration; + } else { + static_assert("component not supported"); + } + }(); + + specfem::algorithms::gradient( + team, iterator, assembly.partial_derivatives, + quadrature.hprime_gll, active_field, + [&](const typename ChunkPolicyType::iterator_type::index_type + &iterator_index, + const typename PointFieldDerivativesType::ViewType &du) { + PointPropertyType point_property; + + specfem::compute::load_on_device(iterator_index.index, + assembly.properties, + point_property); + + PointFieldDerivativesType field_derivatives(du); + + auto stress = specfem::medium::compute_stress( + point_property, field_derivatives); + + for (int icomponent = 0; icomponent < num_components; + icomponent++) { + wavefield_on_entire_grid( + iterator_index.index.ispec, iterator_index.index.iz, + iterator_index.index.ix, icomponent) = + stress.T(icomponent, 0); + } + }); + } + }); + + return; + } + +private: + specfem::compute::assembly &assembly; + Kokkos::View + wavefield_on_entire_grid; +}; +} // namespace impl diff --git a/src/compute/fields/fields.cpp b/src/compute/fields/fields.cpp index e8d81dd0..c38d627c 100644 --- a/src/compute/fields/fields.cpp +++ b/src/compute/fields/fields.cpp @@ -58,7 +58,7 @@ specfem::compute::fields::fields(const specfem::compute::mesh &mesh, buffer([&]() -> specfem::compute::simulation_field< specfem::wavefield::type::buffer> { if (simulation == specfem::simulation::type::forward) { - return {}; + return { mesh, properties }; } else if (simulation == specfem::simulation::type::combined) { return { mesh, properties }; } else { diff --git a/tests/unit-tests/CMakeLists.txt b/tests/unit-tests/CMakeLists.txt index 90842351..b9f86ff1 100644 --- a/tests/unit-tests/CMakeLists.txt +++ b/tests/unit-tests/CMakeLists.txt @@ -182,8 +182,10 @@ target_link_libraries( add_executable( assembly_tests + assembly/test_fixture/test_fixture.cpp assembly/runner.cpp - assembly/kernels.cpp + assembly/kernels/kernels.cpp + assembly/compute_wavefield/compute_wavefield.cpp ) target_link_libraries( diff --git a/tests/unit-tests/assembly/compute_wavefield/compute_wavefield.cpp b/tests/unit-tests/assembly/compute_wavefield/compute_wavefield.cpp new file mode 100644 index 00000000..90e7f3f0 --- /dev/null +++ b/tests/unit-tests/assembly/compute_wavefield/compute_wavefield.cpp @@ -0,0 +1,110 @@ +#include "../test_fixture/test_fixture.hpp" +#include "enumerations/medium.hpp" +#include "enumerations/wavefield.hpp" +#include "generate_data.hpp" +#include "point/coordinates.hpp" +#include "point/field.hpp" +#include "test_helper.hpp" +#include +#include +#include +#include +#include + +template +void test_element_wavefield( + const int ispec, + const Kokkos::View + &wavefield, + specfem::compute::assembly &assembly) { + + const auto properties = assembly.properties; + + const auto medium = properties.h_element_types(ispec); + const auto property = properties.h_element_property(ispec); + + if ((medium == specfem::element::medium_tag::elastic) && + (property == specfem::element::property_tag::isotropic)) { + test_helper + handle(ispec, wavefield, assembly); + handle.test(); + } else if ((medium == specfem::element::medium_tag::acoustic) && + (property == specfem::element::property_tag::isotropic)) { + test_helper + handle(ispec, wavefield, assembly); + handle.test(); + } else { + throw std::runtime_error("Unsupported medium and property combination"); + } +} + +template +void test_compute_wavefield(specfem::compute::assembly &assembly) { + + const auto ispecs = generate_data(assembly); + + const auto wavefield = + assembly.generate_wavefield_on_entire_grid(type, component); + + for (const auto ispec : ispecs) { + test_element_wavefield(ispec, wavefield, assembly); + } +} + +void test_compute_wavefield(specfem::compute::assembly &assembly) { + + try { + test_compute_wavefield(assembly); + } catch (std::exception &e) { + std::ostringstream message; + message << "Error in computing displacement wavefield: \n\t" << e.what(); + throw std::runtime_error(message.str()); + } + + try { + test_compute_wavefield(assembly); + } catch (std::exception &e) { + std::ostringstream message; + message << "Error in computing displacement wavefield: \n\t" << e.what(); + throw std::runtime_error(message.str()); + } + + try { + test_compute_wavefield(assembly); + } catch (std::exception &e) { + std::ostringstream message; + message << "Error in computing displacement wavefield: \n\t" << e.what(); + throw std::runtime_error(message.str()); + } +} + +TEST_F(ASSEMBLY, compute_wavefield) { + for (auto parameters : *this) { + const auto Test = std::get<0>(parameters); + auto assembly = std::get<1>(parameters); + + try { + test_compute_wavefield(assembly); + + std::cout << "-------------------------------------------------------\n" + << "\033[0;32m[PASSED]\033[0m " << Test.name << "\n" + << "-------------------------------------------------------\n\n" + << std::endl; + } catch (std::exception &e) { + std::cout << "-------------------------------------------------------\n" + << "\033[0;31m[FAILED]\033[0m \n" + << "-------------------------------------------------------\n" + << "- Test: " << Test.name << "\n" + << "- Error: " << e.what() << "\n" + << "-------------------------------------------------------\n\n" + << std::endl; + ADD_FAILURE(); + } + } +} diff --git a/tests/unit-tests/assembly/compute_wavefield/generate_data.hpp b/tests/unit-tests/assembly/compute_wavefield/generate_data.hpp new file mode 100644 index 00000000..3f6967a2 --- /dev/null +++ b/tests/unit-tests/assembly/compute_wavefield/generate_data.hpp @@ -0,0 +1,120 @@ +// generate_data function generates wavefield data for compute_wavefield tests +// We pick a single element for different medium_tag and property_tag +// combinations and assign 1.0 to all the quadrature points in the element + +#pragma once +#include "enumerations/medium.hpp" +#include "enumerations/wavefield.hpp" +#include "point/coordinates.hpp" +#include "point/field.hpp" + +namespace impl { +template +class field_type_parameters; + +template +class field_type_parameters { +public: + constexpr static auto medium_tag = MediumTag; + constexpr static auto store_displacement = true; + constexpr static auto store_velocity = false; + constexpr static auto store_acceleration = false; + constexpr static auto store_mass_matrix = false; + constexpr static auto num_components = 2; +}; + +template +class field_type_parameters { +public: + constexpr static auto medium_tag = MediumTag; + constexpr static auto store_displacement = false; + constexpr static auto store_velocity = true; + constexpr static auto store_acceleration = false; + constexpr static auto store_mass_matrix = false; + constexpr static auto num_components = 2; +}; + +template +class field_type_parameters { +public: + constexpr static auto medium_tag = MediumTag; + constexpr static auto store_displacement = false; + constexpr static auto store_velocity = false; + constexpr static auto store_acceleration = true; + constexpr static auto store_mass_matrix = false; + constexpr static auto num_components = 2; +}; +} // namespace impl + +template +void generate_data(specfem::compute::assembly &assembly, + std::vector &ispecs) { + + auto field = assembly.fields.template get_simulation_field(); + + const int ngllx = assembly.mesh.ngllx; + const int ngllz = assembly.mesh.ngllz; + + const auto elements = + assembly.properties.get_elements_on_host(medium, property); + using field_parameters = impl::field_type_parameters; + + constexpr int num_components = + specfem::element::attributes::components(); + + using PointFieldType = + specfem::point::field; + + using IndexType = + specfem::point::index; + + const int nelements = elements.size(); + + if (nelements == 0) + return; + + const int ispec = elements(nelements / 2); + ispecs.push_back(ispec); + + for (int iz = 0; iz < ngllz; iz++) { + for (int ix = 0; ix < ngllx; ix++) { + const IndexType index(ispec, iz, ix); + + PointFieldType point_field; + + for (int ic = 0; ic < num_components; ic++) { + point_field(ic) = 1.0; + } + + specfem::compute::store_on_host(index, point_field, field); + } + } + + field.copy_to_device(); +} + +template +std::vector generate_data(specfem::compute::assembly &assembly) { + + std::vector ispecs; + + generate_data(assembly, ispecs); + + generate_data(assembly, ispecs); + + return ispecs; +} diff --git a/tests/unit-tests/assembly/compute_wavefield/test_helper.hpp b/tests/unit-tests/assembly/compute_wavefield/test_helper.hpp new file mode 100644 index 00000000..d1af6d9e --- /dev/null +++ b/tests/unit-tests/assembly/compute_wavefield/test_helper.hpp @@ -0,0 +1,137 @@ + +// Check if the wavefield is correctly generated for the given element. +// Given an element index, we check if the wavefield component was correctly +// generated. We compare the generated wavefield with the expected wavefield. + +// Expected wavefield: +// - When a component is present as on of the primary components for a medium +// type. +// We just check if the wavefield component is equal to 1.0. + +// - When a component is not present as on of the primary components for a +// medium type. +// We check that the value is equal to 0.0. +// Since, the computed strain for a uniform wavefield is zero. + +#pragma once +#include "enumerations/medium.hpp" +#include "enumerations/wavefield.hpp" +#include "point/coordinates.hpp" +#include "point/field.hpp" + +template +class test_helper; + +template +class test_helper { + +public: + test_helper(const int ispec, + const Kokkos::View &wavefield, + specfem::compute::assembly &assembly) + : ispec(ispec), wavefield(wavefield), assembly(assembly) {} + + void test() { + + constexpr static int num_components = + specfem::wavefield::wavefield::num_components; + + const int ngllz = assembly.mesh.ngllz; + const int ngllx = assembly.mesh.ngllx; + + for (int iz = 0; iz < ngllz; iz++) { + for (int ix = 0; ix < ngllx; ix++) { + + for (int ic = 0; ic < num_components; ic++) { + const auto computed = wavefield(ispec, iz, ix, ic); + const auto expected = 1.0; + + if (std::abs(computed - expected) > 1.0e-4) { + std::ostringstream message; + message << "Error in wavefield computation: \n" + << " ispec = " << ispec << "\n" + << " iz = " << iz << "\n" + << " ix = " << ix << "\n" + << " component = " << ic << "\n" + << " computed = " << computed << "\n" + << " expected = " << expected; + throw std::runtime_error(message.str()); + } + } + } + } + } + +private: + const int ispec; + const Kokkos::View + &wavefield; + specfem::compute::assembly &assembly; +}; + +template +class test_helper { + +public: + test_helper(const int ispec, + const Kokkos::View &wavefield, + specfem::compute::assembly &assembly) + : ispec(ispec), wavefield(wavefield), assembly(assembly) {} + + void test() { + + constexpr static int num_components = + specfem::wavefield::wavefield::num_components; + + const int ngllz = assembly.mesh.ngllz; + const int ngllx = assembly.mesh.ngllx; + + using PointProperties = specfem::point::properties< + specfem::dimension::type::dim2, specfem::element::medium_tag::acoustic, + specfem::element::property_tag::isotropic, false>; + + for (int iz = 0; iz < ngllz; iz++) { + for (int ix = 0; ix < ngllx; ix++) { + + const specfem::point::index + index(ispec, iz, ix); + + PointProperties point_properties; + specfem::compute::load_on_host(index, assembly.properties, + point_properties); + + for (int ic = 0; ic < num_components; ic++) { + const auto computed = + wavefield(ispec, iz, ix, ic) / point_properties.rho_inverse; + const auto expected = 0.0; + + if (std::abs(computed - expected) > 1.0e-4) { + std::ostringstream message; + message << "Error in wavefield computation: \n" + << " ispec = " << ispec << "\n" + << " iz = " << iz << "\n" + << " ix = " << ix << "\n" + << " component = " << ic << "\n" + << " computed = " << computed << "\n" + << " expected = " << expected; + throw std::runtime_error(message.str()); + } + } + } + } + } + +private: + const int ispec; + const Kokkos::View + &wavefield; + specfem::compute::assembly &assembly; +}; diff --git a/tests/unit-tests/assembly/kernels.cpp b/tests/unit-tests/assembly/kernels/kernels.cpp similarity index 99% rename from tests/unit-tests/assembly/kernels.cpp rename to tests/unit-tests/assembly/kernels/kernels.cpp index 0def02f0..183f2b8c 100644 --- a/tests/unit-tests/assembly/kernels.cpp +++ b/tests/unit-tests/assembly/kernels/kernels.cpp @@ -1,10 +1,10 @@ +#include "../test_fixture/test_fixture.hpp" #include "datatypes/simd.hpp" #include "enumerations/dimension.hpp" #include "enumerations/medium.hpp" #include "parallel_configuration/chunk_config.hpp" #include "policies/chunk.hpp" #include "specfem_setup.hpp" -#include "test_fixture.hpp" #include template &tests) { + YAML::Node all_tests = yaml["Tests"]; + assert(all_tests.IsSequence()); + + for (auto N : all_tests) + tests.push_back(test_configuration::Test(N)); + + return; +} + +ASSEMBLY::ASSEMBLY() { + + std::string config_filename = + "../../../tests/unit-tests/assembly/test_config.yaml"; + parse_test_config(YAML::LoadFile(config_filename), Tests); + + specfem::MPI::MPI *mpi = MPIEnvironment::get_mpi(); + + const auto quadrature = []() { + specfem::quadrature::gll::gll gll{}; + return specfem::quadrature::quadratures(gll); + }(); + + for (auto &Test : Tests) { + const auto [database_file, sources_file, stations_file] = + Test.get_databases(); + specfem::mesh::mesh mesh(database_file, mpi); + + const auto [sources, t0] = specfem::sources::read_sources( + sources_file, 0, 0, 0, specfem::simulation::type::forward); + + const auto receivers = specfem::receivers::read_receivers(stations_file, 0); + + std::vector seismogram_types = { + specfem::enums::seismogram::type::displacement + }; + + assemblies.push_back(specfem::compute::assembly( + mesh, quadrature, sources, receivers, seismogram_types, t0, 0, 0, 0, + specfem::simulation::type::forward)); + } +} + +// Instantiate template functions + +template KOKKOS_FUNCTION + specfem::point::index + get_index(const int ielement, const int num_elements, const int iz, + const int ix); + +template KOKKOS_FUNCTION + specfem::point::index + get_index(const int ielement, const int num_elements, const int iz, + const int ix); diff --git a/tests/unit-tests/assembly/test_fixture.hpp b/tests/unit-tests/assembly/test_fixture/test_fixture.hpp similarity index 58% rename from tests/unit-tests/assembly/test_fixture.hpp rename to tests/unit-tests/assembly/test_fixture/test_fixture.hpp index 0fac266a..cdce7b28 100644 --- a/tests/unit-tests/assembly/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 "compute/assembly/assembly.hpp" #include "enumerations/specfem_enums.hpp" #include "mesh/mesh.hpp" @@ -18,22 +18,6 @@ KOKKOS_FUNCTION get_index(const int ielement, const int num_elements, const int iz, const int ix); -template <> -KOKKOS_FUNCTION specfem::point::index -get_index(const int ielement, const int num_elements, const int iz, - const int ix) { - return specfem::point::simd_index( - ielement, num_elements, iz, ix); -} - -template <> -KOKKOS_FUNCTION specfem::point::index -get_index(const int ielement, const int num_elements, const int iz, - const int ix) { - return specfem::point::index(ielement, iz, - ix); -} - // ------------------------------------------------------------------------ // Test configuration namespace test_configuration { @@ -80,20 +64,6 @@ struct Test { }; } // namespace test_configuration -// ------------------------------------------------------------------------ -// Reading test config - -void parse_test_config(const YAML::Node &yaml, - std::vector &tests) { - YAML::Node all_tests = yaml["Tests"]; - assert(all_tests.IsSequence()); - - for (auto N : all_tests) - tests.push_back(test_configuration::Test(N)); - - return; -} - // ------------------------------------------------------------------------ class ASSEMBLY : public ::testing::Test { @@ -129,39 +99,7 @@ class ASSEMBLY : public ::testing::Test { specfem::compute::assembly *p_assembly; }; - ASSEMBLY() { - - std::string config_filename = - "../../../tests/unit-tests/assembly/test_config.yaml"; - parse_test_config(YAML::LoadFile(config_filename), Tests); - - specfem::MPI::MPI *mpi = MPIEnvironment::get_mpi(); - - const auto quadrature = []() { - specfem::quadrature::gll::gll gll{}; - return specfem::quadrature::quadratures(gll); - }(); - - for (auto &Test : Tests) { - const auto [database_file, sources_file, stations_file] = - Test.get_databases(); - specfem::mesh::mesh mesh(database_file, mpi); - - const auto [sources, t0] = specfem::sources::read_sources( - sources_file, 0, 0, 0, specfem::simulation::type::forward); - - const auto receivers = - specfem::receivers::read_receivers(stations_file, 0); - - std::vector seismogram_types = { - specfem::enums::seismogram::type::displacement - }; - - assemblies.push_back(specfem::compute::assembly( - mesh, quadrature, sources, receivers, seismogram_types, t0, 0, 0, 0, - specfem::simulation::type::forward)); - } - } + ASSEMBLY(); Iterator begin() { return Iterator(&Tests[0], &assemblies[0]); } diff --git a/tests/unit-tests/assembly/test_fixture/test_fixture.tpp b/tests/unit-tests/assembly/test_fixture/test_fixture.tpp new file mode 100644 index 00000000..b2a24da5 --- /dev/null +++ b/tests/unit-tests/assembly/test_fixture/test_fixture.tpp @@ -0,0 +1,17 @@ +#include "test_fixture.hpp" + +template <> +KOKKOS_FUNCTION specfem::point::index +get_index(const int ielement, const int num_elements, const int iz, + const int ix) { + return specfem::point::simd_index( + ielement, num_elements, iz, ix); +} + +template <> +KOKKOS_FUNCTION specfem::point::index +get_index(const int ielement, const int num_elements, const int iz, + const int ix) { + return specfem::point::index(ielement, iz, + ix); +} From ee1e7edac609f145329816b4a4bca1721cb613fd Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Wed, 13 Nov 2024 17:08:34 -0500 Subject: [PATCH 15/53] Fixed plotting script --- src/writer/plot_wavefield.cpp | 70 +++++++++++++++++++++++++++-------- 1 file changed, 54 insertions(+), 16 deletions(-) diff --git a/src/writer/plot_wavefield.cpp b/src/writer/plot_wavefield.cpp index 24285f6d..79d451a8 100644 --- a/src/writer/plot_wavefield.cpp +++ b/src/writer/plot_wavefield.cpp @@ -43,11 +43,45 @@ void specfem::writer::plot_wavefield::write() { namespace { -vtkSmartPointer -get_wavefield_on_vtk_grid(const specfem::compute::assembly &assembly, - const specfem::display::wavefield &component) { - - const auto &wavefield = assembly.generate_wavefield_on_entire_grid(component); +vtkSmartPointer get_wavefield_on_vtk_grid( + specfem::compute::assembly &assembly, const specfem::wavefield::type type, + const specfem::display::wavefield &display_component) { + + const auto component = [&display_component]() { + if (display_component == specfem::display::wavefield::displacement_x || + display_component == specfem::display::wavefield::displacement_z) { + return specfem::wavefield::component::displacement; + } else if (display_component == specfem::display::wavefield::velocity_x || + display_component == specfem::display::wavefield::velocity_z) { + return specfem::wavefield::component::velocity; + } else if (display_component == + specfem::display::wavefield::acceleration_x || + display_component == + specfem::display::wavefield::acceleration_z) { + return specfem::wavefield::component::acceleration; + } else { + throw std::runtime_error("Unsupported component"); + } + }(); + + const int plot_index = [&display_component]() { + if (display_component == specfem::display::wavefield::displacement_x || + display_component == specfem::display::wavefield::velocity_x || + display_component == specfem::display::wavefield::acceleration_x) { + return 0; + } else if (display_component == + specfem::display::wavefield::displacement_z || + display_component == specfem::display::wavefield::velocity_z || + display_component == + specfem::display::wavefield::acceleration_z) { + return 1; + } else { + throw std::runtime_error("Unsupported component"); + } + }(); + + const auto &wavefield = + assembly.generate_wavefield_on_entire_grid(type, component); const auto &coordinates = assembly.mesh.points.h_coord; const int ncells = wavefield.extent(0); @@ -67,13 +101,14 @@ get_wavefield_on_vtk_grid(const specfem::compute::assembly &assembly, // Bottom Corner points->SetPoint(icell * ncells + 0, coordinates(icell, 0, 0, 0), 0.0, coordinates(icell, 0, 0, 1)); - scalars->SetTuple1(icell * ncells + 0, wavefield(icell, 0, 0)); + scalars->SetTuple1(icell * ncells + 0, wavefield(icell, 0, 0, plot_index)); biquad->GetPointIds()->SetId(0, icell * ncells + 0); // Bottom Right points->SetPoint(icell * ncells + 1, coordinates(icell, 0, ngllx - 1, 0), 0.0, coordinates(icell, 0, ngllx - 1, 1)); - scalars->SetTuple1(icell * ncells + 1, wavefield(icell, 0, ngllx - 1)); + scalars->SetTuple1(icell * ncells + 1, + wavefield(icell, 0, ngllx - 1, plot_index)); biquad->GetPointIds()->SetId(1, icell * ncells + 1); // Top Right @@ -81,19 +116,21 @@ get_wavefield_on_vtk_grid(const specfem::compute::assembly &assembly, coordinates(icell, ngllz - 1, ngllx - 1, 0), 0.0, coordinates(icell, ngllz - 1, ngllx - 1, 1)); scalars->SetTuple1(icell * ncells + 2, - wavefield(icell, ngllz - 1, ngllx - 1)); + wavefield(icell, ngllz - 1, ngllx - 1, plot_index)); biquad->GetPointIds()->SetId(2, icell * ncells + 2); // Top Left points->SetPoint(icell * ncells + 3, coordinates(icell, ngllz - 1, 0, 0), 0.0, coordinates(icell, ngllz - 1, 0, 1)); - scalars->SetTuple1(icell * ncells + 3, wavefield(icell, ngllz - 1, 0)); + scalars->SetTuple1(icell * ncells + 3, + wavefield(icell, ngllz - 1, 0, plot_index)); biquad->GetPointIds()->SetId(3, icell * ncells + 3); // Bottom middle points->SetPoint(icell * ncells + 4, coordinates(icell, 0, ngllx / 2, 0), 0.0, coordinates(icell, 0, ngllx / 2, 1)); - scalars->SetTuple1(icell * ncells + 4, wavefield(icell, 0, ngllx / 2)); + scalars->SetTuple1(icell * ncells + 4, + wavefield(icell, 0, ngllx / 2, plot_index)); biquad->GetPointIds()->SetId(4, icell * ncells + 4); // Right middle @@ -101,7 +138,7 @@ get_wavefield_on_vtk_grid(const specfem::compute::assembly &assembly, coordinates(icell, ngllz / 2, ngllx - 1, 0), 0.0, coordinates(icell, ngllz / 2, ngllx - 1, 1)); scalars->SetTuple1(icell * ncells + 5, - wavefield(icell, ngllz / 2, ngllx - 1)); + wavefield(icell, ngllz / 2, ngllx - 1, plot_index)); biquad->GetPointIds()->SetId(5, icell * ncells + 5); // Top middle @@ -109,13 +146,14 @@ get_wavefield_on_vtk_grid(const specfem::compute::assembly &assembly, coordinates(icell, ngllz - 1, ngllx / 2, 0), 0.0, coordinates(icell, ngllz - 1, ngllx / 2, 1)); scalars->SetTuple1(icell * ncells + 6, - wavefield(icell, ngllz - 1, ngllx / 2)); + wavefield(icell, ngllz - 1, ngllx / 2, plot_index)); biquad->GetPointIds()->SetId(6, icell * ncells + 6); // Left middle points->SetPoint(icell * ncells + 7, coordinates(icell, ngllz / 2, 0, 0), 0.0, coordinates(icell, ngllz / 2, 0, 1)); - scalars->SetTuple1(icell * ncells + 7, wavefield(icell, ngllz / 2, 0)); + scalars->SetTuple1(icell * ncells + 7, + wavefield(icell, ngllz / 2, 0, plot_index)); biquad->GetPointIds()->SetId(7, icell * ncells + 7); // Center @@ -123,7 +161,7 @@ get_wavefield_on_vtk_grid(const specfem::compute::assembly &assembly, coordinates(icell, ngllz / 2, ngllx / 2, 0), 0.0, coordinates(icell, ngllz / 2, ngllx / 2, 1)); scalars->SetTuple1(icell * ncells + 8, - wavefield(icell, ngllz / 2, ngllx / 2)); + wavefield(icell, ngllz / 2, ngllx / 2, plot_index)); biquad->GetPointIds()->SetId(8, icell * ncells + 8); unstructured_grid->InsertNextCell(biquad->GetCellType(), biquad->GetPointIds()); @@ -138,8 +176,8 @@ get_wavefield_on_vtk_grid(const specfem::compute::assembly &assembly, void specfem::writer::plot_wavefield::write() { - const auto unstructured_grid = - get_wavefield_on_vtk_grid(this->assembly, this->component); + const auto unstructured_grid = get_wavefield_on_vtk_grid( + this->assembly, this->wavefield, this->component); // Plot a contour plot of the wavefield auto contour = vtkSmartPointer::New(); From 4d5b19b62662c20d015618d60f4dd8f78c5e18d7 Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Thu, 14 Nov 2024 11:56:03 -0500 Subject: [PATCH 16/53] Added Device impl fix --- include/compute/properties/properties.hpp | 27 +---- include/writer/plot_wavefield.hpp | 8 +- src/compute/assembly/compute_wavefield.cpp | 2 +- src/compute/assembly/helper.hpp | 20 +++- src/compute/compute_properties.cpp | 133 ++++++--------------- 5 files changed, 58 insertions(+), 132 deletions(-) diff --git a/include/compute/properties/properties.hpp b/include/compute/properties/properties.hpp index a55a9032..4dd47697 100644 --- a/include/compute/properties/properties.hpp +++ b/include/compute/properties/properties.hpp @@ -16,18 +16,6 @@ namespace specfem { namespace compute { -namespace impl { -class elements_of_type { -public: - bool computed; - Kokkos::View - elements; - Kokkos::View::HostMirror h_elements; - elements_of_type() : computed(false) {} -}; -} // namespace impl - /** * @brief Material properties at every quadrature point in the finite element * mesh @@ -106,7 +94,7 @@ struct properties { * type */ Kokkos::View - get_elements_on_device(const specfem::element::medium_tag medium); + get_elements_on_device(const specfem::element::medium_tag medium) const; /** * @brief Get the indices of elements of a given type as a view on the device @@ -119,7 +107,7 @@ struct properties { */ Kokkos::View get_elements_on_device(const specfem::element::medium_tag medium, - const specfem::element::property_tag property); + const specfem::element::property_tag property) const; /** * @brief Get the indices of elements of a given type as a view on the host @@ -129,7 +117,7 @@ struct properties { * the indices of elements of the given type */ Kokkos::View - get_elements_on_host(const specfem::element::medium_tag medium); + get_elements_on_host(const specfem::element::medium_tag medium) const; /** * @brief Get the indices of elements of a given type as a view on the host @@ -141,14 +129,7 @@ struct properties { */ Kokkos::View get_elements_on_host(const specfem::element::medium_tag medium, - const specfem::element::property_tag property); - -private: - // Stores the indices of elements of a given type - impl::elements_of_type elastic_isotropic_elements; - impl::elements_of_type acoustic_isotropic_elements; - impl::elements_of_type elastic_elements; - impl::elements_of_type acoustic_elements; + const specfem::element::property_tag property) const; }; /** diff --git a/include/writer/plot_wavefield.hpp b/include/writer/plot_wavefield.hpp index 6eed0e35..cf9717b6 100644 --- a/include/writer/plot_wavefield.hpp +++ b/include/writer/plot_wavefield.hpp @@ -33,10 +33,10 @@ class plot_wavefield : public writer { void write() override; private: - specfem::display::format output_format; - specfem::display::wavefield component; - specfem::wavefield::type wavefield; - boost::filesystem::path output_folder; + const specfem::display::format output_format; + const specfem::display::wavefield component; + const specfem::wavefield::type wavefield; + const boost::filesystem::path output_folder; specfem::compute::assembly assembly; }; } // namespace writer diff --git a/src/compute/assembly/compute_wavefield.cpp b/src/compute/assembly/compute_wavefield.cpp index 52e06ac8..5bc26711 100644 --- a/src/compute/assembly/compute_wavefield.cpp +++ b/src/compute/assembly/compute_wavefield.cpp @@ -8,7 +8,7 @@ template void get_wavefield_on_entire_grid( - specfem::compute::assembly &assembly, + const specfem::compute::assembly &assembly, Kokkos::View wavefield_on_entire_grid) { diff --git a/src/compute/assembly/helper.hpp b/src/compute/assembly/helper.hpp index c823db04..af29ec44 100644 --- a/src/compute/assembly/helper.hpp +++ b/src/compute/assembly/helper.hpp @@ -12,6 +12,7 @@ #include "point/field_derivatives.hpp" #include "point/properties.hpp" #include "policies/chunk.hpp" +#include namespace impl { template ; - helper(specfem::compute::assembly &assembly, + helper(specfem::compute::assembly assembly, Kokkos::View wavefield_on_entire_grid) @@ -90,6 +91,12 @@ class helper; ChunkPolicyType chunk_policy(elements, ngllz, ngllx); - const int nelements = elements.extent(0); Kokkos::parallel_for( "specfem::domain::impl::kernels::elements::compute_mass_matrix", @@ -150,7 +156,7 @@ class helper wavefield_on_entire_grid; @@ -167,7 +173,7 @@ class helper; - helper(specfem::compute::assembly &assembly, + helper(specfem::compute::assembly assembly, Kokkos::View wavefield_on_entire_grid) @@ -188,6 +194,10 @@ class helper; @@ -293,7 +303,7 @@ class helper wavefield_on_entire_grid; diff --git a/src/compute/compute_properties.cpp b/src/compute/compute_properties.cpp index 3ddaf172..872cb348 100644 --- a/src/compute/compute_properties.cpp +++ b/src/compute/compute_properties.cpp @@ -97,161 +97,96 @@ specfem::compute::properties::properties( Kokkos::View specfem::compute::properties::get_elements_on_host( - const specfem::element::medium_tag medium) { - - auto &elements = [&]() -> impl::elements_of_type & { - if (medium == specfem::element::medium_tag::elastic) { - return this->elastic_elements; - } else if (medium == specfem::element::medium_tag::acoustic) { - return this->acoustic_elements; - } else { - throw std::runtime_error("Unknown medium tag"); - } - }(); - - if (elements.computed) - return elements.h_elements; + const specfem::element::medium_tag medium) const { const int nspec = this->nspec; int nelements = 0; for (int ispec = 0; ispec < nspec; ispec++) { - if (element_types(ispec) == medium) { + if (h_element_types(ispec) == medium) { nelements++; } } - elements.elements = - Kokkos::View( - "specfem::compute::properties::get_elements_on_host", nelements); - - elements.h_elements = Kokkos::create_mirror_view(elements.elements); + Kokkos::View elements( + "specfem::compute::properties::get_elements_on_host", nelements); nelements = 0; for (int ispec = 0; ispec < nspec; ispec++) { - if (element_types(ispec) == medium) { - elements.h_elements(nelements) = ispec; + if (h_element_types(ispec) == medium) { + elements(nelements) = ispec; nelements++; } } - Kokkos::deep_copy(elements.elements, elements.h_elements); - - elements.computed = true; - - return elements.h_elements; + return elements; } Kokkos::View specfem::compute::properties::get_elements_on_device( - const specfem::element::medium_tag medium) { - auto &elements = [&]() -> impl::elements_of_type & { - if (medium == specfem::element::medium_tag::elastic) { - return this->elastic_elements; - } else if (medium == specfem::element::medium_tag::acoustic) { - return this->acoustic_elements; - } else { - throw std::runtime_error("Unknown medium tag"); - } - }(); - - if (elements.computed) - return elements.elements; + const specfem::element::medium_tag medium) const { // If the elements have not been computed, compute them. // The elements need to be computed in serial on the host. // This function computes the host elements on host and then // copies them to the device. - const auto dummy = this->get_elements_on_host(medium); + const auto host_elements = this->get_elements_on_host(medium); + + Kokkos::View + elements("specfem::compute::properties::get_elements_on_device", + host_elements.extent(0)); + + Kokkos::deep_copy(elements, host_elements); - return elements.elements; + return elements; } Kokkos::View specfem::compute::properties::get_elements_on_host( const specfem::element::medium_tag medium, - const specfem::element::property_tag property) { - auto &elements = [&]() -> impl::elements_of_type & { - if (medium == specfem::element::medium_tag::elastic) { - if (property == specfem::element::property_tag::isotropic) { - return elastic_isotropic_elements; - } else { - throw std::runtime_error("Unknown property tag"); - } - } else if (medium == specfem::element::medium_tag::acoustic) { - if (property == specfem::element::property_tag::isotropic) { - return acoustic_isotropic_elements; - } else { - throw std::runtime_error("Unknown property tag"); - } - } else { - throw std::runtime_error("Unknown medium tag"); - } - }(); - - if (elements.computed) - return elements.h_elements; + const specfem::element::property_tag property) const { const int nspec = this->nspec; int nelements = 0; for (int ispec = 0; ispec < nspec; ispec++) { - if (element_types(ispec) == medium && element_property(ispec) == property) { + if (h_element_types(ispec) == medium && + h_element_property(ispec) == property) { nelements++; } } - elements.elements = - Kokkos::View( - "specfem::compute::properties::get_elements_on_host", nelements); - - elements.h_elements = Kokkos::create_mirror_view(elements.elements); + Kokkos::View elements( + "specfem::compute::properties::get_elements_on_host", nelements); nelements = 0; for (int ispec = 0; ispec < nspec; ispec++) { - if (element_types(ispec) == medium && element_property(ispec) == property) { - elements.h_elements(nelements) = ispec; + if (h_element_types(ispec) == medium && + h_element_property(ispec) == property) { + elements(nelements) = ispec; nelements++; } } - Kokkos::deep_copy(elements.elements, elements.h_elements); - - elements.computed = true; - - return elements.h_elements; + return elements; } Kokkos::View specfem::compute::properties::get_elements_on_device( const specfem::element::medium_tag medium, - const specfem::element::property_tag property) { - auto &elements = [&]() -> impl::elements_of_type & { - if (medium == specfem::element::medium_tag::elastic) { - if (property == specfem::element::property_tag::isotropic) { - return elastic_isotropic_elements; - } else { - throw std::runtime_error("Unknown property tag"); - } - } else if (medium == specfem::element::medium_tag::acoustic) { - if (property == specfem::element::property_tag::isotropic) { - return acoustic_isotropic_elements; - } else { - throw std::runtime_error("Unknown property tag"); - } - } else { - throw std::runtime_error("Unknown medium tag"); - } - }(); - - if (elements.computed) - return elements.elements; + const specfem::element::property_tag property) const { // If the elements have not been computed, compute them. // The elements need to be computed in serial on the host. // This function computes the host elements on host and then // copies them to the device. - const auto dummy = this->get_elements_on_host(medium, property); + const auto host_elements = this->get_elements_on_host(medium, property); + + Kokkos::View + elements("specfem::compute::properties::get_elements_on_device", + host_elements.extent(0)); + + Kokkos::deep_copy(elements, host_elements); - return elements.elements; + return elements; } From 5e5c88ad7d80d688635a40a9b137c99f3e93d442 Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Fri, 15 Nov 2024 15:51:55 -0500 Subject: [PATCH 17/53] Implements plotting routines for wavefields - Enables PNG and JPG output formats --- CMakeLists.txt | 24 +- include/enumerations/display.hpp | 10 +- include/parameter_parser/setup.hpp | 9 +- include/parameter_parser/solver/solver.hpp | 8 +- include/parameter_parser/solver/solver.tpp | 6 +- .../writer/plot_wavefield.hpp | 10 +- include/plotter/plot_wavefield.hpp | 63 +++++ include/plotter/plotter.hpp | 45 ++++ include/solver/time_marching.hpp | 21 +- include/solver/time_marching.tpp | 12 + include/writer/kernel.hpp | 27 ++- include/writer/plot_wavefield.hpp | 51 +++- src/parameter_parser/setup.cpp | 16 ++ .../writer/plot_wavefield.cpp | 40 +-- src/plotter/plot_wavefield.cpp | 209 ++++++++++++++++ src/specfem2d.cpp | 10 +- src/writer/plot_wavefield.cpp | 228 ------------------ tests/unit-tests/CMakeLists.txt | 4 + .../Newmark/newmark_tests.cpp | 2 +- 19 files changed, 503 insertions(+), 292 deletions(-) create mode 100644 include/plotter/plot_wavefield.hpp create mode 100644 include/plotter/plotter.hpp create mode 100644 src/plotter/plot_wavefield.cpp delete mode 100644 src/writer/plot_wavefield.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 140bcc97..ed426898 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -467,27 +467,34 @@ add_library( src/writer/seismogram.cpp src/writer/wavefield.cpp src/writer/kernel.cpp - src/writer/plot_wavefield.cpp +) + +target_link_libraries( + writer + compute + receiver_class + IO +) + +add_library( + plotter + src/plotter/plot_wavefield.cpp ) if (NOT VTK_CXX_BUILD) target_compile_definitions( - writer + plotter PUBLIC -DNO_VTK ) target_link_libraries( - writer + plotter compute - receiver_class - IO ) else () target_link_libraries( - writer + plotter compute - receiver_class - IO ${VTK_LIBRARIES} ) endif() @@ -538,6 +545,7 @@ target_link_libraries( parameter_reader receiver_class writer + plotter reader domain coupled_interface diff --git a/include/enumerations/display.hpp b/include/enumerations/display.hpp index 9605dbce..698b366f 100644 --- a/include/enumerations/display.hpp +++ b/include/enumerations/display.hpp @@ -5,14 +5,6 @@ namespace display { enum class format { PNG, JPG }; -enum class wavefield { - displacement_x, - displacement_z, - velocity_x, - velocity_z, - acceleration_x, - acceleration_z, - pressure -}; +enum class wavefield { displacement, velocity, acceleration, pressure }; } // namespace display } // namespace specfem diff --git a/include/parameter_parser/setup.hpp b/include/parameter_parser/setup.hpp index db706e00..180a953f 100644 --- a/include/parameter_parser/setup.hpp +++ b/include/parameter_parser/setup.hpp @@ -160,7 +160,7 @@ class setup { } } - std::shared_ptr instantiate_wavefield_plotter( + std::shared_ptr instantiate_wavefield_plotter( const specfem::compute::assembly &assembly) const { if (this->plot_wavefield) { return this->plot_wavefield->instantiate_wavefield_plotter(assembly); @@ -186,8 +186,11 @@ class setup { std::shared_ptr instantiate_solver( const type_real dt, const specfem::compute::assembly &assembly, std::shared_ptr time_scheme, - const qp_type &quadrature) const { - return this->solver->instantiate(dt, assembly, time_scheme, quadrature); + const qp_type &quadrature, + const std::vector > &plotters) + const { + return this->solver->instantiate(dt, assembly, time_scheme, quadrature, + plotters); } int get_nsteps() const { return this->time_scheme->get_nsteps(); } diff --git a/include/parameter_parser/solver/solver.hpp b/include/parameter_parser/solver/solver.hpp index 8840a1cd..8d5d47f2 100644 --- a/include/parameter_parser/solver/solver.hpp +++ b/include/parameter_parser/solver/solver.hpp @@ -2,6 +2,7 @@ #define _SPECFEM_RUNTIME_CONFIGURATION_SOLVER_SOLVER_HPP_ #include "compute/interface.hpp" +#include "plotter/plotter.hpp" #include "solver/solver.hpp" #include "timescheme/newmark.hpp" #include @@ -46,7 +47,9 @@ class solver { std::shared_ptr instantiate(const type_real dt, const specfem::compute::assembly &assembly, std::shared_ptr time_scheme, - const qp_type &quadrature) const; + const qp_type &quadrature, + const std::vector > + &plotters) const; /** * @brief Get the type of the simulation (forward or combined) @@ -64,7 +67,8 @@ class solver { } private: - std::string simulation_type; ///< Type of the simulation (forward or combined) + std::string simulation_type; ///< Type of the simulation (forward or + ///< combined) }; } // namespace solver } // namespace runtime_configuration diff --git a/include/parameter_parser/solver/solver.tpp b/include/parameter_parser/solver/solver.tpp index 776e1a75..3852301e 100644 --- a/include/parameter_parser/solver/solver.tpp +++ b/include/parameter_parser/solver/solver.tpp @@ -13,7 +13,7 @@ std::shared_ptr specfem::runtime_configuration::solver::solver::instantiate(const type_real dt, const specfem::compute::assembly &assembly, std::shared_ptr time_scheme, - const qp_type &quadrature) const { + const qp_type &quadrature, const std::vector > &plotters) const { if (this->simulation_type == "forward") { std::cout << "Instantiating Kernels \n"; @@ -24,7 +24,7 @@ specfem::runtime_configuration::solver::solver::instantiate(const type_real dt, return std::make_shared< specfem::solver::time_marching>( - kernels, time_scheme); + kernels, time_scheme, plotters); } else if (this->simulation_type == "combined") { std::cout << "Instantiating Kernels \n"; std::cout << "-------------------------------\n"; @@ -37,7 +37,7 @@ specfem::runtime_configuration::solver::solver::instantiate(const type_real dt, return std::make_shared< specfem::solver::time_marching>( - assembly, adjoint_kernels, backward_kernels, time_scheme); + assembly, adjoint_kernels, backward_kernels, time_scheme, plotters); } else { throw std::runtime_error("Simulation type not recognized"); } diff --git a/include/parameter_parser/writer/plot_wavefield.hpp b/include/parameter_parser/writer/plot_wavefield.hpp index fb585a5a..46027611 100644 --- a/include/parameter_parser/writer/plot_wavefield.hpp +++ b/include/parameter_parser/writer/plot_wavefield.hpp @@ -2,7 +2,7 @@ #include "compute/assembly/assembly.hpp" #include "enumerations/display.hpp" -#include "writer/writer.hpp" +#include "plotter/plotter.hpp" #include "yaml-cpp/yaml.h" #include @@ -30,9 +30,10 @@ class plot_wavefield { */ plot_wavefield(const std::string output_format, const std::string output_folder, const std::string component, - const std::string wavefield_type) + const std::string wavefield_type, const int time_interval) : output_format(output_format), output_folder(output_folder), - component(component), wavefield_type(wavefield_type) {} + component(component), wavefield_type(wavefield_type), + time_interval(time_interval) {} /** * @brief Construct a new plotter configuration object from YAML node @@ -49,7 +50,7 @@ class plot_wavefield { * @return std::shared_ptr Pointer to an instantiated * plotter object */ - std::shared_ptr instantiate_wavefield_plotter( + std::shared_ptr instantiate_wavefield_plotter( const specfem::compute::assembly &assembly) const; private: @@ -57,6 +58,7 @@ class plot_wavefield { std::string output_folder; ///< Path to output folder std::string component; ///< Component of the wavefield to plot std::string wavefield_type; ///< Type of wavefield to plot + int time_interval; ///< Time interval for plotting }; } // namespace runtime_configuration } // namespace specfem diff --git a/include/plotter/plot_wavefield.hpp b/include/plotter/plot_wavefield.hpp new file mode 100644 index 00000000..df242ab3 --- /dev/null +++ b/include/plotter/plot_wavefield.hpp @@ -0,0 +1,63 @@ +#pragma once + +#include "compute/assembly/assembly.hpp" +#include "enumerations/display.hpp" +#include "enumerations/wavefield.hpp" +#include "plotter.hpp" +#include +#ifdef NO_VTK +#include +#endif + +namespace specfem { +namespace plotter { +/** + * @brief Writer to plot the wavefield + */ +class plot_wavefield : public plotter { +public: + /** + * @brief Construct a new plotter object + * + * @param assembly SPECFFEM++ assembly object + * @param output_format Output format of the plot (PNG, JPG, etc.) + * @param component Component of the wavefield to plot (displacement, + * velocity, etc.) + * @param wavefield Type of wavefield to plot (forward, adjoint, etc.) + * @param time_interval Time interval between subsequent plots + * @param output_folder Path to output folder where plots will be stored + */ + plot_wavefield(const specfem::compute::assembly &assembly, + const specfem::display::format &output_format, + const specfem::display::wavefield &component, + const specfem::wavefield::type &wavefield, + const int &time_interval, + const boost::filesystem::path &output_folder) + : plotter(time_interval), output_format(output_format), + component(component), output_folder(output_folder), + wavefield(wavefield), assembly(assembly) { +#ifdef NO_VTK + std::ostringstream message; + message << "Display section is not enabled, since SPECFEM++ was built " + "without VTK\n" + << "Please install VTK and rebuild SPECFEM++ with " + "-DVTK_DIR=/path/to/vtk"; + throw std::runtime_error(message.str()); +#endif + } + + /** + * @brief Plot the wavefield + * + */ + void plot() override; + +private: + const specfem::display::format output_format; ///< Output format of the plot + const specfem::display::wavefield component; ///< Component of the wavefield + const specfem::wavefield::type wavefield; ///< Type of wavefield to plot + const boost::filesystem::path output_folder; ///< Path to output folder + specfem::compute::assembly assembly; ///< Assembly object +}; +} // namespace plotter +} // namespace specfem diff --git a/include/plotter/plotter.hpp b/include/plotter/plotter.hpp new file mode 100644 index 00000000..80dd6e85 --- /dev/null +++ b/include/plotter/plotter.hpp @@ -0,0 +1,45 @@ +#pragma once + +namespace specfem { +namespace plotter { +/** + * @brief Base writer class + * + */ +class plotter { +public: + /** + * @brief Construct a new plotter object + * + * @param time_interval Time interval between subsequent plots + */ + plotter(const int time_interval) : time_interval(time_interval){}; + + /** + * @brief Method to plot the data + * + */ + virtual void plot(){}; + + /** + * @brief Returns true if the data should be plotted at the current + * timestep. Updates the internal timestep counter + * + * @param istep Current timestep + * @return true if the data should be plotted at the current timestep + */ + bool should_plot(const int istep) { + if (istep % time_interval == 0) { + this->m_istep = istep; + return true; + } + return false; + } + +protected: + int time_interval; + int m_istep; +}; + +} // namespace plotter +} // namespace specfem diff --git a/include/solver/time_marching.hpp b/include/solver/time_marching.hpp index 37dd90d4..83d11608 100644 --- a/include/solver/time_marching.hpp +++ b/include/solver/time_marching.hpp @@ -6,8 +6,10 @@ #include "enumerations/wavefield.hpp" #include "kernels/frechet_kernels.hpp" #include "kernels/kernels.hpp" +#include "plotter/plotter.hpp" #include "solver.hpp" #include "timescheme/newmark.hpp" +#include "timescheme/timescheme.hpp" namespace specfem { namespace solver { @@ -45,8 +47,9 @@ class time_marching time_marching( const specfem::kernels::kernels &kernels, - const std::shared_ptr time_scheme) - : kernels(kernels), time_scheme(time_scheme) {} + const std::shared_ptr time_scheme, + const std::vector > &plotters) + : kernels(kernels), time_scheme(time_scheme), plotters(plotters) {} ///@} @@ -61,6 +64,9 @@ class time_marching kernels; ///< Computational kernels std::shared_ptr time_scheme; ///< Time ///< scheme + std::vector > + plotters; ///< Plotter + ///< objects }; /** @@ -90,14 +96,16 @@ class time_marching DimensionType, qp_type> &adjoint_kernels, const specfem::kernels::kernels &backward_kernels, - const std::shared_ptr time_scheme) + const std::shared_ptr time_scheme, + const std::vector > &plotters) : assembly(assembly), adjoint_kernels(adjoint_kernels), frechet_kernels(assembly), backward_kernels(backward_kernels), - time_scheme(time_scheme) {} + time_scheme(time_scheme), plotters(plotters) {} ///@} /** - * @brief Run the time marching solver + * @brief + * */ void run() override; @@ -114,6 +122,9 @@ class time_marching specfem::compute::assembly assembly; ///< Spectral element assembly object std::shared_ptr time_scheme; ///< Time ///< scheme + std::vector > + plotters; ///< Plotter + ///< objects }; } // namespace solver } // namespace specfem diff --git a/include/solver/time_marching.tpp b/include/solver/time_marching.tpp index 14600395..4bd938c8 100644 --- a/include/solver/time_marching.tpp +++ b/include/solver/time_marching.tpp @@ -33,6 +33,12 @@ void specfem::solver::time_marchingincrement_seismogram_step(); } + for (const auto &plotter : plotters) { + if (plotter && plotter->should_plot(istep)) { + plotter->plot(); + } + } + if (istep % 10 == 0) { std::cout << "Progress : executed " << istep << " steps of " << nstep << " steps" << std::endl; @@ -94,6 +100,12 @@ void specfem::solver::time_marchingincrement_seismogram_step(); } + for (const auto &plotter : plotters) { + if (plotter && plotter->should_plot(istep)) { + plotter->plot(); + } + } + if (istep % 10 == 0) { std::cout << "Progress : executed " << istep << " steps of " << nstep << " steps" << std::endl; diff --git a/include/writer/kernel.hpp b/include/writer/kernel.hpp index c156c2b7..162c4b34 100644 --- a/include/writer/kernel.hpp +++ b/include/writer/kernel.hpp @@ -7,17 +7,38 @@ namespace specfem { namespace writer { +/** + * @brief Writer to output misfit kernel data to disk + * + * @tparam OutputLibrary Library to use for output (HDF5, ASCII, etc.) + */ template class kernel : public writer { public: + /** + * @name Constructors + * + */ + ///@{ + /** + * @brief Construct a writer object + * + * @param assembly SPECFEM++ assembly + * @param output_folder Path to output location (will be an .h5 file if using + * HDF5, and a folder if using ASCII) + */ kernel(const specfem::compute::assembly &assembly, const std::string output_folder); + /** + * @brief write the kernel data to disk + * + */ void write() override; private: - std::string output_folder; ///< Path to output folder - specfem::compute::mesh mesh; - specfem::compute::kernels kernels; + std::string output_folder; ///< Path to output folder + specfem::compute::mesh mesh; ///< Mesh object + specfem::compute::kernels kernels; ///< Kernels object }; } // namespace writer } // namespace specfem diff --git a/include/writer/plot_wavefield.hpp b/include/writer/plot_wavefield.hpp index cf9717b6..6051dd65 100644 --- a/include/writer/plot_wavefield.hpp +++ b/include/writer/plot_wavefield.hpp @@ -11,15 +11,31 @@ namespace specfem { namespace writer { +/** + * @brief Writer to plot the wavefield + */ class plot_wavefield : public writer { public: + /** + * @brief Construct a new plotter object + * + * @param assembly SPECFFEM++ assembly object + * @param output_format Output format of the plot (PNG, JPG, etc.) + * @param component Component of the wavefield to plot (displacement, + * velocity, etc.) + * @param wavefield Type of wavefield to plot (forward, adjoint, etc.) + * @param time_interval Time interval between subsequent plots + * @param output_folder Path to output folder where plots will be stored + */ plot_wavefield(const specfem::compute::assembly &assembly, const specfem::display::format &output_format, const specfem::display::wavefield &component, const specfem::wavefield::type &wavefield, - const std::string &output_folder) + const int &time_interval, + const boost::filesystem::path &output_folder) : output_format(output_format), component(component), - output_folder(output_folder), wavefield(wavefield), assembly(assembly) { + output_folder(output_folder), wavefield(wavefield), + time_interval(time_interval), assembly(assembly) { #ifdef NO_VTK std::ostringstream message; message << "Display section is not enabled, since SPECFEM++ was built " @@ -30,14 +46,35 @@ class plot_wavefield : public writer { #endif } + /** + * @brief Plot the wavefield + * + */ void write() override; + /** + * @brief Returns true if the wavefield should be plotted at the current + * timestep. Updates the internal timestep counter + * + * @param istep Current timestep + * @return true if the wavefield should be plotted at the current timestep + */ + bool compute_plotting(const int istep) { + if (istep % time_interval == 0) { + this->m_istep = istep; + return true; + } + return false; + } + private: - const specfem::display::format output_format; - const specfem::display::wavefield component; - const specfem::wavefield::type wavefield; - const boost::filesystem::path output_folder; - specfem::compute::assembly assembly; + const specfem::display::format output_format; ///< Output format of the plot + const specfem::display::wavefield component; ///< Component of the wavefield + const specfem::wavefield::type wavefield; ///< Type of wavefield to plot + const boost::filesystem::path output_folder; ///< Path to output folder + const int time_interval; ///< Time interval between plots + int m_istep = 0; ///< Current timestep + specfem::compute::assembly assembly; ///< Assembly object }; } // namespace writer } // namespace specfem diff --git a/src/parameter_parser/setup.cpp b/src/parameter_parser/setup.cpp index 275fb4f4..5dd563d1 100644 --- a/src/parameter_parser/setup.cpp +++ b/src/parameter_parser/setup.cpp @@ -121,6 +121,15 @@ specfem::runtime_configuration::setup::setup(const std::string ¶meter_file, } if (const YAML::Node &n_plotter = n_writer["display"]) { + if (n_plotter["wavefield_type"] && + n_plotter["wavefield_type"].as() != "forward") { + std::ostringstream message; + message << "Error: Plotting a " + << n_plotter["wavefield_type"].as() + << " wavefield in forward simulation mode. \n"; + throw std::runtime_error(message.str()); + } + at_least_one_writer = true; this->plot_wavefield = std::make_unique( @@ -197,6 +206,13 @@ specfem::runtime_configuration::setup::setup(const std::string ¶meter_file, } if (const YAML::Node &n_plotter = n_writer["display"]) { + if (n_plotter["wavefield_type"] && + n_plotter["wavefield_type"].as() == "forward") { + std::ostringstream message; + message << "Error: Plotting a forward wavefield in combined " + << "simulation mode. \n"; + throw std::runtime_error(message.str()); + } this->plot_wavefield = std::make_unique( n_plotter); diff --git a/src/parameter_parser/writer/plot_wavefield.cpp b/src/parameter_parser/writer/plot_wavefield.cpp index bf4b1c1b..b0b9beda 100644 --- a/src/parameter_parser/writer/plot_wavefield.cpp +++ b/src/parameter_parser/writer/plot_wavefield.cpp @@ -1,6 +1,6 @@ #include "parameter_parser/writer/plot_wavefield.hpp" -#include "writer/plot_wavefield.hpp" -#include "writer/writer.hpp" +#include "plotter/plot_wavefield.hpp" +#include "plotter/plotter.hpp" #include specfem::runtime_configuration::plot_wavefield::plot_wavefield( @@ -47,13 +47,22 @@ specfem::runtime_configuration::plot_wavefield::plot_wavefield( } }(); + const int time_interval = [&]() -> int { + if (Node["time_interval"]) { + return Node["time_interval"].as(); + } else { + throw std::runtime_error( + "Time interval not specified in the display section"); + } + }(); + *this = specfem::runtime_configuration::plot_wavefield( - output_format, output_folder, component, wavefield_type); + output_format, output_folder, component, wavefield_type, time_interval); return; } -std::shared_ptr +std::shared_ptr specfem::runtime_configuration::plot_wavefield::instantiate_wavefield_plotter( const specfem::compute::assembly &assembly) const { @@ -68,18 +77,12 @@ specfem::runtime_configuration::plot_wavefield::instantiate_wavefield_plotter( }(); const auto component = [&]() { - if (this->component == "displacement_x") { - return specfem::display::wavefield::displacement_x; - } else if (this->component == "displacement_z") { - return specfem::display::wavefield::displacement_z; - } else if (this->component == "velocity_x") { - return specfem::display::wavefield::velocity_x; - } else if (this->component == "velocity_z") { - return specfem::display::wavefield::velocity_z; - } else if (this->component == "acceleration_x") { - return specfem::display::wavefield::acceleration_x; - } else if (this->component == "acceleration_z") { - return specfem::display::wavefield::acceleration_z; + if (this->component == "displacement") { + return specfem::display::wavefield::displacement; + } else if (this->component == "velocity") { + return specfem::display::wavefield::velocity; + } else if (this->component == "acceleration") { + return specfem::display::wavefield::acceleration; } else if (this->component == "pressure") { return specfem::display::wavefield::pressure; } else { @@ -98,6 +101,7 @@ specfem::runtime_configuration::plot_wavefield::instantiate_wavefield_plotter( } }(); - return std::make_shared( - assembly, output_format, component, wavefield, this->output_folder); + return std::make_shared( + assembly, output_format, component, wavefield, time_interval, + this->output_folder); } diff --git a/src/plotter/plot_wavefield.cpp b/src/plotter/plot_wavefield.cpp new file mode 100644 index 00000000..330bb6a2 --- /dev/null +++ b/src/plotter/plot_wavefield.cpp @@ -0,0 +1,209 @@ + +#include "plotter/plot_wavefield.hpp" +#include "compute/assembly/assembly.hpp" +#include "enumerations/display.hpp" + +#ifdef NO_VTK + +#include + +#else + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // NO_VTK + +#ifdef NO_VTK + +void specfem::plotter::plot_wavefield::write() { + std::ostringstream message; + message + << "Display section is not enabled, since SPECFEM++ was built without " + "VTK\n" + << "Please install VTK and rebuild SPECFEM++ with -DVTK_DIR=/path/to/vtk"; + throw std::runtime_error(message.str()); +} + +#else + +namespace { + +vtkSmartPointer get_wavefield_on_vtk_grid( + specfem::compute::assembly &assembly, const specfem::wavefield::type type, + const specfem::display::wavefield &display_component) { + + const auto component = [&display_component]() { + if (display_component == specfem::display::wavefield::displacement) { + return specfem::wavefield::component::displacement; + } else if (display_component == specfem::display::wavefield::velocity) { + return specfem::wavefield::component::velocity; + } else if (display_component == specfem::display::wavefield::acceleration) { + return specfem::wavefield::component::acceleration; + } else { + throw std::runtime_error("Unsupported component"); + } + }(); + + const auto &wavefield = + assembly.generate_wavefield_on_entire_grid(type, component); + const auto &coordinates = assembly.mesh.points.h_coord; + + const int ncells = wavefield.extent(0); + const int ngllz = wavefield.extent(1); + const int ngllx = wavefield.extent(2); + + const int cell_points = 9; + + const std::array z_index = { 0, + 0, + ngllz - 1, + ngllz - 1, + 0, + (ngllz - 1) / 2, + ngllz - 1, + (ngllz - 1) / 2, + (ngllz - 1) / 2 }; + const std::array x_index = { 0, + ngllx - 1, + ngllx - 1, + 0, + (ngllx - 1) / 2, + ngllx - 1, + (ngllx - 1) / 2, + 0, + (ngllx - 1) / 2 }; + + auto points = vtkSmartPointer::New(); + auto cells = vtkSmartPointer::New(); + auto scalars = vtkSmartPointer::New(); + + for (int icell = 0; icell < ncells; ++icell) { + for (int i = 0; i < cell_points; ++i) { + points->InsertNextPoint(coordinates(0, icell, z_index[i], x_index[i]), + coordinates(1, icell, z_index[i], x_index[i]), + 0.0); + scalars->InsertNextValue( + std::sqrt((wavefield(icell, z_index[i], x_index[i], 0) * + wavefield(icell, z_index[i], x_index[i], 0)) + + (wavefield(icell, z_index[i], x_index[i], 1) * + wavefield(icell, z_index[i], x_index[i], 1)))); + } + auto quad = vtkSmartPointer::New(); + for (int i = 0; i < cell_points; ++i) { + quad->GetPointIds()->SetId(i, icell * cell_points + i); + } + cells->InsertNextCell(quad); + } + + auto unstructured_grid = vtkSmartPointer::New(); + unstructured_grid->SetPoints(points); + unstructured_grid->SetCells(VTK_BIQUADRATIC_QUAD, cells); + unstructured_grid->GetPointData()->SetScalars(scalars); + + return unstructured_grid; +} +} // namespace + +void specfem::plotter::plot_wavefield::plot() { + + auto colors = vtkSmartPointer::New(); + + vtkSmartPointer graphics_factory; + graphics_factory->SetOffScreenOnlyMode(1); + graphics_factory->SetUseMesaClasses(1); + + const auto unstructured_grid = get_wavefield_on_vtk_grid( + this->assembly, this->wavefield, this->component); + const int ncell = unstructured_grid->GetNumberOfCells(); + + double range[2]; + + unstructured_grid->GetPointData()->GetScalars()->GetRange(range); + + auto mapper = vtkSmartPointer::New(); + mapper->SetInputData(unstructured_grid); + + mapper->SetScalarRange(range[0], range[1]); + mapper->SetScalarModeToUsePointData(); + mapper->SetColorModeToMapScalars(); + mapper->SetScalarVisibility(1); + + // Create an actor + auto actor = vtkSmartPointer::New(); + actor->SetMapper(mapper); + + vtkSmartPointer edges = + vtkSmartPointer::New(); + edges->SetInputData(unstructured_grid); + edges->Update(); + + vtkSmartPointer outlineMapper = + vtkSmartPointer::New(); + outlineMapper->SetInputConnection(edges->GetOutputPort()); + outlineMapper->ScalarVisibilityOff(); + + vtkSmartPointer outlineActor = vtkSmartPointer::New(); + outlineActor->SetMapper(outlineMapper); + outlineActor->GetProperty()->SetColor(colors->GetColor3d("Black").GetData()); + outlineActor->GetProperty()->SetLineWidth(1.0); + + // Create a renderer + auto renderer = vtkSmartPointer::New(); + renderer->AddActor(actor); + renderer->AddActor(outlineActor); + renderer->SetBackground(colors->GetColor3d("White").GetData()); + renderer->ResetCamera(); + + // Create a render window + auto render_window = vtkSmartPointer::New(); + render_window->SetOffScreenRendering(1); + render_window->AddRenderer(renderer); + render_window->SetSize(1280, 1280); + render_window->SetWindowName("Wavefield"); + + auto image_filter = vtkSmartPointer::New(); + image_filter->SetInput(render_window); + image_filter->Update(); + + // Save the plot + if (this->output_format == specfem::display::format::PNG) { + const auto filename = + this->output_folder / + ("wavefield" + std::to_string(this->m_istep) + ".png"); + auto writer = vtkSmartPointer::New(); + writer->SetFileName(filename.string().c_str()); + writer->SetInputConnection(image_filter->GetOutputPort()); + writer->Write(); + } else if (this->output_format == specfem::display::format::JPG) { + const auto filename = + this->output_folder / + ("wavefield" + std::to_string(this->m_istep) + ".jpg"); + auto writer = vtkSmartPointer::New(); + writer->SetFileName(filename.string().c_str()); + writer->SetInputConnection(image_filter->GetOutputPort()); + writer->Write(); + } else { + throw std::runtime_error("Unsupported output format"); + } +} + +#endif // NO_VTK diff --git a/src/specfem2d.cpp b/src/specfem2d.cpp index 7834715d..9a8c7c3f 100644 --- a/src/specfem2d.cpp +++ b/src/specfem2d.cpp @@ -175,12 +175,20 @@ void execute(const std::string ¶meter_file, const std::string &default_file, } // -------------------------------------------------------------- + // -------------------------------------------------------------- + // Instantiate plotter + // -------------------------------------------------------------- + std::vector > plotters; + const auto wavefield_plotter = setup.instantiate_wavefield_plotter(assembly); + plotters.push_back(wavefield_plotter); + // -------------------------------------------------------------- + // -------------------------------------------------------------- // Instantiate Solver // -------------------------------------------------------------- specfem::enums::element::quadrature::static_quadrature_points<5> qp5; std::shared_ptr solver = - setup.instantiate_solver(dt, assembly, time_scheme, qp5); + setup.instantiate_solver(dt, assembly, time_scheme, qp5, plotters); // -------------------------------------------------------------- // -------------------------------------------------------------- diff --git a/src/writer/plot_wavefield.cpp b/src/writer/plot_wavefield.cpp deleted file mode 100644 index 79d451a8..00000000 --- a/src/writer/plot_wavefield.cpp +++ /dev/null @@ -1,228 +0,0 @@ - -#include "writer/plot_wavefield.hpp" -#include "compute/assembly/assembly.hpp" -#include "enumerations/display.hpp" - -#ifdef NO_VTK - -#include - -#else - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif // NO_VTK - -#ifdef NO_VTK - -void specfem::writer::plot_wavefield::write() { - std::ostringstream message; - message - << "Display section is not enabled, since SPECFEM++ was built without " - "VTK\n" - << "Please install VTK and rebuild SPECFEM++ with -DVTK_DIR=/path/to/vtk"; - throw std::runtime_error(message.str()); -} - -#else - -namespace { - -vtkSmartPointer get_wavefield_on_vtk_grid( - specfem::compute::assembly &assembly, const specfem::wavefield::type type, - const specfem::display::wavefield &display_component) { - - const auto component = [&display_component]() { - if (display_component == specfem::display::wavefield::displacement_x || - display_component == specfem::display::wavefield::displacement_z) { - return specfem::wavefield::component::displacement; - } else if (display_component == specfem::display::wavefield::velocity_x || - display_component == specfem::display::wavefield::velocity_z) { - return specfem::wavefield::component::velocity; - } else if (display_component == - specfem::display::wavefield::acceleration_x || - display_component == - specfem::display::wavefield::acceleration_z) { - return specfem::wavefield::component::acceleration; - } else { - throw std::runtime_error("Unsupported component"); - } - }(); - - const int plot_index = [&display_component]() { - if (display_component == specfem::display::wavefield::displacement_x || - display_component == specfem::display::wavefield::velocity_x || - display_component == specfem::display::wavefield::acceleration_x) { - return 0; - } else if (display_component == - specfem::display::wavefield::displacement_z || - display_component == specfem::display::wavefield::velocity_z || - display_component == - specfem::display::wavefield::acceleration_z) { - return 1; - } else { - throw std::runtime_error("Unsupported component"); - } - }(); - - const auto &wavefield = - assembly.generate_wavefield_on_entire_grid(type, component); - const auto &coordinates = assembly.mesh.points.h_coord; - - const int ncells = wavefield.extent(0); - const int ngllz = wavefield.extent(1); - const int ngllx = wavefield.extent(2); - - auto points = vtkSmartPointer::New(); - points->SetNumberOfPoints(ncells * 9); - auto scalars = vtkSmartPointer::New(); - scalars->SetName("Wavefield"); - scalars->SetNumberOfTuples(ncells * 9); - - auto unstructured_grid = vtkSmartPointer::New(); - - for (int icell = 0; icell < ncells; ++icell) { - auto biquad = vtkSmartPointer::New(); - // Bottom Corner - points->SetPoint(icell * ncells + 0, coordinates(icell, 0, 0, 0), 0.0, - coordinates(icell, 0, 0, 1)); - scalars->SetTuple1(icell * ncells + 0, wavefield(icell, 0, 0, plot_index)); - biquad->GetPointIds()->SetId(0, icell * ncells + 0); - - // Bottom Right - points->SetPoint(icell * ncells + 1, coordinates(icell, 0, ngllx - 1, 0), - 0.0, coordinates(icell, 0, ngllx - 1, 1)); - scalars->SetTuple1(icell * ncells + 1, - wavefield(icell, 0, ngllx - 1, plot_index)); - biquad->GetPointIds()->SetId(1, icell * ncells + 1); - - // Top Right - points->SetPoint(icell * ncells + 2, - coordinates(icell, ngllz - 1, ngllx - 1, 0), 0.0, - coordinates(icell, ngllz - 1, ngllx - 1, 1)); - scalars->SetTuple1(icell * ncells + 2, - wavefield(icell, ngllz - 1, ngllx - 1, plot_index)); - biquad->GetPointIds()->SetId(2, icell * ncells + 2); - - // Top Left - points->SetPoint(icell * ncells + 3, coordinates(icell, ngllz - 1, 0, 0), - 0.0, coordinates(icell, ngllz - 1, 0, 1)); - scalars->SetTuple1(icell * ncells + 3, - wavefield(icell, ngllz - 1, 0, plot_index)); - biquad->GetPointIds()->SetId(3, icell * ncells + 3); - - // Bottom middle - points->SetPoint(icell * ncells + 4, coordinates(icell, 0, ngllx / 2, 0), - 0.0, coordinates(icell, 0, ngllx / 2, 1)); - scalars->SetTuple1(icell * ncells + 4, - wavefield(icell, 0, ngllx / 2, plot_index)); - biquad->GetPointIds()->SetId(4, icell * ncells + 4); - - // Right middle - points->SetPoint(icell * ncells + 5, - coordinates(icell, ngllz / 2, ngllx - 1, 0), 0.0, - coordinates(icell, ngllz / 2, ngllx - 1, 1)); - scalars->SetTuple1(icell * ncells + 5, - wavefield(icell, ngllz / 2, ngllx - 1, plot_index)); - biquad->GetPointIds()->SetId(5, icell * ncells + 5); - - // Top middle - points->SetPoint(icell * ncells + 6, - coordinates(icell, ngllz - 1, ngllx / 2, 0), 0.0, - coordinates(icell, ngllz - 1, ngllx / 2, 1)); - scalars->SetTuple1(icell * ncells + 6, - wavefield(icell, ngllz - 1, ngllx / 2, plot_index)); - biquad->GetPointIds()->SetId(6, icell * ncells + 6); - - // Left middle - points->SetPoint(icell * ncells + 7, coordinates(icell, ngllz / 2, 0, 0), - 0.0, coordinates(icell, ngllz / 2, 0, 1)); - scalars->SetTuple1(icell * ncells + 7, - wavefield(icell, ngllz / 2, 0, plot_index)); - biquad->GetPointIds()->SetId(7, icell * ncells + 7); - - // Center - points->SetPoint(icell * ncells + 8, - coordinates(icell, ngllz / 2, ngllx / 2, 0), 0.0, - coordinates(icell, ngllz / 2, ngllx / 2, 1)); - scalars->SetTuple1(icell * ncells + 8, - wavefield(icell, ngllz / 2, ngllx / 2, plot_index)); - biquad->GetPointIds()->SetId(8, icell * ncells + 8); - unstructured_grid->InsertNextCell(biquad->GetCellType(), - biquad->GetPointIds()); - } - - unstructured_grid->SetPoints(points); - unstructured_grid->GetPointData()->SetScalars(scalars); - - return unstructured_grid; -} -} // namespace - -void specfem::writer::plot_wavefield::write() { - - const auto unstructured_grid = get_wavefield_on_vtk_grid( - this->assembly, this->wavefield, this->component); - - // Plot a contour plot of the wavefield - auto contour = vtkSmartPointer::New(); - contour->SetInputData(unstructured_grid); - contour->GenerateValues(10, 0.0, 1.0); - - // Create a mapper - auto mapper = vtkSmartPointer::New(); - mapper->SetInputConnection(contour->GetOutputPort()); - mapper->ScalarVisibilityOn(); - - // Create an actor - auto actor = vtkSmartPointer::New(); - actor->SetMapper(mapper); - - // Create a renderer - auto renderer = vtkSmartPointer::New(); - renderer->AddActor(actor); - renderer->SetBackground(1.0, 1.0, 1.0); - - // Create a render window - auto render_window = vtkSmartPointer::New(); - render_window->AddRenderer(renderer); - render_window->SetSize(800, 800); - - // Create an interactor - auto image_filter = vtkSmartPointer::New(); - image_filter->SetInput(render_window); - - // Save the plot - if (this->output_format == specfem::display::format::PNG) { - const auto filename = this->output_folder / "wavefield.png"; - auto writer = vtkSmartPointer::New(); - writer->SetFileName(filename.string().c_str()); - writer->SetInputConnection(image_filter->GetOutputPort()); - writer->Write(); - } else if (this->output_format == specfem::display::format::JPG) { - const auto filename = this->output_folder / "wavefield.jpg"; - auto writer = vtkSmartPointer::New(); - writer->SetFileName(filename.string().c_str()); - writer->SetInputConnection(image_filter->GetOutputPort()); - writer->Write(); - } else { - throw std::runtime_error("Unsupported output format"); - } -} - -#endif // NO_VTK diff --git a/tests/unit-tests/CMakeLists.txt b/tests/unit-tests/CMakeLists.txt index b9f86ff1..ff6e76f0 100644 --- a/tests/unit-tests/CMakeLists.txt +++ b/tests/unit-tests/CMakeLists.txt @@ -291,6 +291,7 @@ target_link_libraries( algorithms domain coupled_interface + plotter -lpthread -lm ) @@ -317,6 +318,7 @@ target_link_libraries( coupled_interface domain solver + plotter -lpthread -lm ) @@ -335,6 +337,7 @@ target_link_libraries( compute parameter_reader writer + plotter domain coupled_interface solver @@ -356,6 +359,7 @@ target_link_libraries( compute parameter_reader writer + plotter domain coupled_interface solver diff --git a/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp b/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp index 92e1958f..cc12107c 100644 --- a/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp +++ b/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp @@ -242,7 +242,7 @@ TEST(DISPLACEMENT_TESTS, newmark_scheme_tests) { specfem::enums::element::quadrature::static_quadrature_points<5> qp5; std::shared_ptr solver = - setup.instantiate_solver(setup.get_dt(), assembly, it, qp5); + setup.instantiate_solver(setup.get_dt(), assembly, it, qp5, {}); solver->run(); From 3107193a8d2a5a953cd7cc4631f08bf00dc7b81f Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Fri, 15 Nov 2024 17:44:18 -0500 Subject: [PATCH 18/53] Fixed no VTK builds --- src/plotter/plot_wavefield.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plotter/plot_wavefield.cpp b/src/plotter/plot_wavefield.cpp index 330bb6a2..883e14c7 100644 --- a/src/plotter/plot_wavefield.cpp +++ b/src/plotter/plot_wavefield.cpp @@ -34,7 +34,7 @@ #ifdef NO_VTK -void specfem::plotter::plot_wavefield::write() { +void specfem::plotter::plot_wavefield::plot() { std::ostringstream message; message << "Display section is not enabled, since SPECFEM++ was built without " From 6655ce5ea0640de848b369b60c987ed53a6a6d6c Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Mon, 18 Nov 2024 10:34:33 -0500 Subject: [PATCH 19/53] Implements adding colors to elements based on material types --- include/enumerations/display.hpp | 2 +- .../writer/plot_wavefield.cpp | 2 + src/plotter/plot_wavefield.cpp | 181 ++++++++++++++---- 3 files changed, 149 insertions(+), 36 deletions(-) diff --git a/include/enumerations/display.hpp b/include/enumerations/display.hpp index 698b366f..1c743747 100644 --- a/include/enumerations/display.hpp +++ b/include/enumerations/display.hpp @@ -3,7 +3,7 @@ namespace specfem { namespace display { -enum class format { PNG, JPG }; +enum class format { PNG, JPG, on_screen }; enum class wavefield { displacement, velocity, acceleration, pressure }; } // namespace display diff --git a/src/parameter_parser/writer/plot_wavefield.cpp b/src/parameter_parser/writer/plot_wavefield.cpp index b0b9beda..796d9f24 100644 --- a/src/parameter_parser/writer/plot_wavefield.cpp +++ b/src/parameter_parser/writer/plot_wavefield.cpp @@ -71,6 +71,8 @@ specfem::runtime_configuration::plot_wavefield::instantiate_wavefield_plotter( return specfem::display::format::PNG; } else if (this->output_format == "JPG") { return specfem::display::format::JPG; + } else if (this->output_format == "on_screen") { + return specfem::display::format::on_screen; } else { throw std::runtime_error("Unknown plotter format"); } diff --git a/src/plotter/plot_wavefield.cpp b/src/plotter/plot_wavefield.cpp index 883e14c7..581fbe4b 100644 --- a/src/plotter/plot_wavefield.cpp +++ b/src/plotter/plot_wavefield.cpp @@ -12,21 +12,26 @@ #include #include #include +#include #include #include #include #include #include +#include #include +#include #include #include #include #include #include +#include #include #include #include #include +#include #include #include @@ -47,6 +52,73 @@ void specfem::plotter::plot_wavefield::plot() { namespace { +// Sigmoid function centered at 0.0 +double sigmoid(double x) { return (1 / (1 + std::exp(-100 * x)) - 0.5) * 1.5; } + +// Maps different materials to different colors +vtkSmartPointer +map_materials_with_color(const specfem::compute::assembly &assembly) { + + const auto &properties = assembly.properties; + + const std::unordered_map > + material_colors = { + { specfem::element::medium_tag::elastic, // sienna color + { 160, 82, 45 } }, + { specfem::element::medium_tag::acoustic, // aqua color + { 0, 255, 255 } }, + }; + + const auto &coordinates = assembly.mesh.points.h_coord; + const int nspec = assembly.mesh.nspec; + const int ngllx = assembly.mesh.ngllx; + const int ngllz = assembly.mesh.ngllz; + + const int cell_points = 4; + + const std::array z_index = { 0, ngllz - 1, ngllz - 1, 0 }; + const std::array x_index = { 0, 0, ngllx - 1, ngllx - 1 }; + + auto points = vtkSmartPointer::New(); + + auto cells = vtkSmartPointer::New(); + + auto colors = vtkSmartPointer::New(); + colors->SetNumberOfComponents(3); + colors->SetName("Colors"); + + for (int icell = 0; icell < nspec; ++icell) { + for (int i = 0; i < cell_points; ++i) { + points->InsertNextPoint(coordinates(0, icell, z_index[i], x_index[i]), + coordinates(1, icell, z_index[i], x_index[i]), + 0.0); + } + auto quad = vtkSmartPointer::New(); + for (int i = 0; i < cell_points; ++i) { + quad->GetPointIds()->SetId(i, icell * cell_points + i); + } + cells->InsertNextCell(quad); + + const auto material = properties.h_element_types(icell); + const auto color = material_colors.at(material); + unsigned char color_uc[3] = { static_cast(color[0]), + static_cast(color[1]), + static_cast(color[2]) }; + colors->InsertNextTypedTuple(color_uc); + } + + auto unstructured_grid = vtkSmartPointer::New(); + unstructured_grid->SetPoints(points); + unstructured_grid->SetCells(VTK_QUAD, cells); + + unstructured_grid->GetCellData()->SetScalars(colors); + + auto mapper = vtkSmartPointer::New(); + mapper->SetInputData(unstructured_grid); + + return mapper; +} + vtkSmartPointer get_wavefield_on_vtk_grid( specfem::compute::assembly &assembly, const specfem::wavefield::type type, const specfem::display::wavefield &display_component) { @@ -127,9 +199,17 @@ void specfem::plotter::plot_wavefield::plot() { auto colors = vtkSmartPointer::New(); - vtkSmartPointer graphics_factory; - graphics_factory->SetOffScreenOnlyMode(1); - graphics_factory->SetUseMesaClasses(1); + if (this->output_format != specfem::display::format::on_screen) { + vtkSmartPointer graphics_factory; + graphics_factory->SetOffScreenOnlyMode(1); + graphics_factory->SetUseMesaClasses(1); + } + + auto material_mapper = map_materials_with_color(this->assembly); + + // Create an actor + auto material_actor = vtkSmartPointer::New(); + material_actor->SetMapper(material_mapper); const auto unstructured_grid = get_wavefield_on_vtk_grid( this->assembly, this->wavefield, this->component); @@ -139,9 +219,24 @@ void specfem::plotter::plot_wavefield::plot() { unstructured_grid->GetPointData()->GetScalars()->GetRange(range); + // create a lookup table to map cell data to colors. The range is from + // range[0] to range[1] + vtkSmartPointer lut = vtkSmartPointer::New(); + lut->SetNumberOfTableValues(256); + lut->SetRange(range[0], range[1]); + lut->Build(); + + // set color gradient from white to black + for (int i = 0; i < 256; ++i) { + double t = static_cast(i) / 255.0; + double transparency = sigmoid(t); + lut->SetTableValue(i, 1.0 - t, 1.0 - t, 1.0 - t, transparency); + } + + // Create a mapper auto mapper = vtkSmartPointer::New(); mapper->SetInputData(unstructured_grid); - + mapper->SetLookupTable(lut); mapper->SetScalarRange(range[0], range[1]); mapper->SetScalarModeToUsePointData(); mapper->SetColorModeToMapScalars(); @@ -164,45 +259,61 @@ void specfem::plotter::plot_wavefield::plot() { vtkSmartPointer outlineActor = vtkSmartPointer::New(); outlineActor->SetMapper(outlineMapper); outlineActor->GetProperty()->SetColor(colors->GetColor3d("Black").GetData()); - outlineActor->GetProperty()->SetLineWidth(1.0); + outlineActor->GetProperty()->SetLineWidth(0.5); // Create a renderer auto renderer = vtkSmartPointer::New(); - renderer->AddActor(actor); + renderer->AddActor(material_actor); renderer->AddActor(outlineActor); + renderer->AddActor(actor); renderer->SetBackground(colors->GetColor3d("White").GetData()); renderer->ResetCamera(); - // Create a render window - auto render_window = vtkSmartPointer::New(); - render_window->SetOffScreenRendering(1); - render_window->AddRenderer(renderer); - render_window->SetSize(1280, 1280); - render_window->SetWindowName("Wavefield"); - - auto image_filter = vtkSmartPointer::New(); - image_filter->SetInput(render_window); - image_filter->Update(); - - // Save the plot - if (this->output_format == specfem::display::format::PNG) { - const auto filename = - this->output_folder / - ("wavefield" + std::to_string(this->m_istep) + ".png"); - auto writer = vtkSmartPointer::New(); - writer->SetFileName(filename.string().c_str()); - writer->SetInputConnection(image_filter->GetOutputPort()); - writer->Write(); - } else if (this->output_format == specfem::display::format::JPG) { - const auto filename = - this->output_folder / - ("wavefield" + std::to_string(this->m_istep) + ".jpg"); - auto writer = vtkSmartPointer::New(); - writer->SetFileName(filename.string().c_str()); - writer->SetInputConnection(image_filter->GetOutputPort()); - writer->Write(); + if (this->output_format != specfem::display::format::on_screen) { + // Create a render window + auto render_window = vtkSmartPointer::New(); + render_window->SetOffScreenRendering(1); + render_window->AddRenderer(renderer); + render_window->SetSize(1280, 1280); + render_window->SetWindowName("Wavefield"); + auto image_filter = vtkSmartPointer::New(); + image_filter->SetInput(render_window); + image_filter->Update(); + + // Save the plot + if (this->output_format == specfem::display::format::PNG) { + const auto filename = + this->output_folder / + ("wavefield" + std::to_string(this->m_istep) + ".png"); + auto writer = vtkSmartPointer::New(); + writer->SetFileName(filename.string().c_str()); + writer->SetInputConnection(image_filter->GetOutputPort()); + writer->Write(); + } else if (this->output_format == specfem::display::format::JPG) { + const auto filename = + this->output_folder / + ("wavefield" + std::to_string(this->m_istep) + ".jpg"); + auto writer = vtkSmartPointer::New(); + writer->SetFileName(filename.string().c_str()); + writer->SetInputConnection(image_filter->GetOutputPort()); + writer->Write(); + } else { + throw std::runtime_error("Unsupported output format"); + } } else { - throw std::runtime_error("Unsupported output format"); + // Create a render window interactor + auto render_window = vtkSmartPointer::New(); + render_window->AddRenderer(renderer); + render_window->SetSize(1280, 1280); + render_window->SetWindowName("Wavefield"); + + auto render_window_interactor = + vtkSmartPointer::New(); + render_window_interactor->SetRenderWindow(render_window); + + // Start the event loop + render_window->Render(); + render_window_interactor->Start(); } } From d12981c87dc6491097ac3f65fcd2501b9c6bfcb1 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Tue, 19 Nov 2024 09:27:13 -0500 Subject: [PATCH 20/53] Edited a lot of files --- CMakeLists.txt | 2 +- include/IO/mesh/fortran/read_boundaries.hpp | 79 ++--- include/IO/mesh/fortran/read_elements.hpp | 4 +- include/IO/mesh/fortran/read_interfaces.hpp | 8 +- .../mesh/fortran/read_material_properties.hpp | 9 +- .../IO/mesh/fortran/read_mesh_database.hpp | 5 +- include/IO/mesh/fortran/read_properties.hpp | 5 +- include/mesh/boundaries/boundaries.hpp | 6 +- .../interface_container.hpp | 2 +- include/mesh/materials/materials.hpp | 4 +- src/IO/mesh/fortran/read_boundaries.cpp | 278 ++++++++++-------- src/IO/mesh/fortran/read_elements.cpp | 6 +- src/IO/mesh/fortran/read_interfaces.cpp | 152 +++++----- .../mesh/fortran/read_material_properties.cpp | 78 ++--- src/IO/mesh/fortran/read_mesh_database.cpp | 4 +- src/IO/mesh/fortran/read_properties.cpp | 17 +- src/IO/mesh/read_mesh.cpp | 115 +++----- src/mesh/boundaries/forcing_boundaries.cpp | 1 - src/mesh/materials/materials.cpp | 148 ---------- src/mesh/mesh.cpp | 181 +----------- src/specfem2d.cpp | 8 +- tests/unit-tests/mesh/mesh_tests.cpp | 3 +- 22 files changed, 381 insertions(+), 734 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 21cae8c6..adc4314b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,7 +118,7 @@ add_library( src/IO/mesh/fortran/read_material_properties.cpp src/IO/mesh/fortran/read_mesh_database.cpp src/IO/mesh/fortran/read_interfaces.cpp - + src/IO/mesh/fortran/read_properties.cpp ) target_link_libraries( diff --git a/include/IO/mesh/fortran/read_boundaries.hpp b/include/IO/mesh/fortran/read_boundaries.hpp index 254346c1..c9925f5b 100644 --- a/include/IO/mesh/fortran/read_boundaries.hpp +++ b/include/IO/mesh/fortran/read_boundaries.hpp @@ -14,44 +14,44 @@ namespace IO { namespace mesh { namespace fortran { - /** - * @brief Read absorbing boundaries from mesh database - * - * @param stream Input stream - * @param nspec Number of spectral elements - * @param n_absorbing Number of absorbing boundaries - * @param mpi MPI object - * @return specfem::mesh::absorbing_boundary - */ - specfem::mesh::absorbing_boundary read_absorbing_boundaries( - std::ifstream &stream, const int n_absorbing, const int nspec, - const specfem::MPI::MPI *mpi) {}; + // /** + // * @brief Read absorbing boundaries from mesh database + // * + // * @param stream Input stream + // * @param nspec Number of spectral elements + // * @param n_absorbing Number of absorbing boundaries + // * @param mpi MPI object + // * @return specfem::mesh::absorbing_boundary + // */ + // specfem::mesh::absorbing_boundary read_absorbing_boundaries( + // std::ifstream &stream, const int n_absorbing, const int nspec, + // const specfem::MPI::MPI *mpi); - /** - * @brief Read acoustic free surface from mesh database - * - * @param stream Input stream - * @param nspec Number of spectral elements - * @param n_acoustic_surface Number of acoustic surfaces - * @param mpi MPI object - * @return specfem::mesh::acoustic_free_surface - */ - specfem::mesh::acoustic_free_surface read_acoustic_free_surface( - std::ifstream &stream, const int nspec, const int n_acoustic_surface, - const specfem::MPI::MPI *mpi) {}; + // /** + // * @brief Read acoustic free surface from mesh database + // * + // * @param stream Input stream + // * @param nspec Number of spectral elements + // * @param n_acoustic_surface Number of acoustic surfaces + // * @param mpi MPI object + // * @return specfem::mesh::acoustic_free_surface + // */ + // specfem::mesh::acoustic_free_surface read_acoustic_free_surface( + // std::ifstream &stream, const int nspec, const int n_acoustic_surface, + // const specfem::MPI::MPI *mpi); - /** - * @brief Read forcing boundaries from mesh database - * - * @param stream Input stream - * @param nspec Number of spectral elements - * @param n_acforcing Number of acoustic forcing boundaries - * @param mpi MPI object - * @return specfem::mesh::forcing_boundary - */ - specfem::mesh::forcing_boundary read_forcing_boundaries( - std::ifstream &stream, const int nspec, const int n_acforcing, - const specfem::MPI::MPI *mpi) {}; + // /** + // * @brief Read forcing boundaries from mesh database + // * + // * @param stream Input stream + // * @param nspec Number of spectral elements + // * @param n_acforcing Number of acoustic forcing boundaries + // * @param mpi MPI object + // * @return specfem::mesh::forcing_boundary + // */ + // specfem::mesh::forcing_boundary read_forcing_boundaries( + // std::ifstream &stream, const int nspec, const int n_acforcing, + // const specfem::MPI::MPI *mpi); /** * @brief Read boundaries from mesh database @@ -65,9 +65,10 @@ namespace fortran { * @return specfem::mesh::boundaries */ specfem::mesh::boundaries read_boundaries( - std::ifstream &stream, const int nspec, const int n_absorbing, - const int n_acforcing, const int n_acoustic_surface, - const specfem::MPI::MPI *mpi) {}; + std::ifstream &stream, const int nspec, const int n_absorbing, + const int n_acoustic_surface, const int n_acforcing, + const Kokkos::View knods, + const specfem::MPI::MPI *mpi); } // namespace fortran } // namespace mesh diff --git a/include/IO/mesh/fortran/read_elements.hpp b/include/IO/mesh/fortran/read_elements.hpp index 0b255253..683aac10 100644 --- a/include/IO/mesh/fortran/read_elements.hpp +++ b/include/IO/mesh/fortran/read_elements.hpp @@ -19,7 +19,7 @@ namespace fortran { * */ specfem::mesh::elements::tangential_elements read_tangential_elements( - std::ifstream &stream, const int nnodes_tangential_curve) {}; + std::ifstream &stream, const int nnodes_tangential_curve); /** @@ -34,7 +34,7 @@ specfem::mesh::elements::tangential_elements read_tangential_elements( */ specfem::mesh::elements::axial_elements read_axial_elements( std::ifstream &stream, const int nelem_on_the_axis, const int nspec, - const specfem::MPI::MPI *mpi) {}; + const specfem::MPI::MPI *mpi); } // namespace fortran } // namespace mesh diff --git a/include/IO/mesh/fortran/read_interfaces.hpp b/include/IO/mesh/fortran/read_interfaces.hpp index 4734e379..36beb950 100644 --- a/include/IO/mesh/fortran/read_interfaces.hpp +++ b/include/IO/mesh/fortran/read_interfaces.hpp @@ -12,15 +12,15 @@ namespace fortran { template specfem::mesh::interface_container - read_interface( + read_interfaces( const int num_interfaces, std::ifstream &stream, - const specfem::MPI::MPI *mpi) {}; + const specfem::MPI::MPI *mpi); + - specfem::mesh::coupled_interfaces read_coupled_interfaces ( std::ifstream &stream, const int num_interfaces_elastic_acoustic, const int num_interfaces_acoustic_poroelastic, - const int num_interfaces_elastic_poroelastic, const specfem::MPI::MPI *mpi) {}; + const int num_interfaces_elastic_poroelastic, const specfem::MPI::MPI *mpi); } // namespace fortran } // namespace mesh diff --git a/include/IO/mesh/fortran/read_material_properties.hpp b/include/IO/mesh/fortran/read_material_properties.hpp index 3f49eaeb..d4e2d3fa 100644 --- a/include/IO/mesh/fortran/read_material_properties.hpp +++ b/include/IO/mesh/fortran/read_material_properties.hpp @@ -1,7 +1,7 @@ #pragma once -// #include "mesh/materials/materials.hpp" -// #include "specfem_mpi/interface.hpp" +#include "mesh/materials/materials.hpp" +#include "specfem_mpi/interface.hpp" #include #include #include @@ -25,11 +25,12 @@ namespace fortran { specfem::mesh::materials read_material_properties(std::ifstream &stream, const int numat, + const int nspec, + const specfem::kokkos::HostView2d knods, const specfem::MPI::MPI *mpi); - + } // namespace fortran } // namespace mesh } // namespace IO } // namespace specfem - diff --git a/include/IO/mesh/fortran/read_mesh_database.hpp b/include/IO/mesh/fortran/read_mesh_database.hpp index 41f377be..1825f9ea 100644 --- a/include/IO/mesh/fortran/read_mesh_database.hpp +++ b/include/IO/mesh/fortran/read_mesh_database.hpp @@ -8,10 +8,6 @@ #include namespace specfem { -/** - * Helper routines to read fortran binary database - * - */ namespace IO { namespace mesh { namespace fortran { @@ -52,5 +48,6 @@ read_mesh_database_attenuation(std::ifstream &stream, const specfem::MPI::MPI *mpi); } // namespace fortran } // namespace IO +} // namespace mesh } // namespace specfem diff --git a/include/IO/mesh/fortran/read_properties.hpp b/include/IO/mesh/fortran/read_properties.hpp index 520dd5b1..0657a97c 100644 --- a/include/IO/mesh/fortran/read_properties.hpp +++ b/include/IO/mesh/fortran/read_properties.hpp @@ -2,6 +2,7 @@ #include "mesh/properties/properties.hpp" #include "IO/fortranio/interface.hpp" +#include "specfem_mpi/interface.hpp" namespace specfem { namespace IO { @@ -15,8 +16,8 @@ namespace fortran { * @param mpi MPI object * @return specfem::mesh::properties */ -specfem::mesh::properties read_properties(std::ifstream &stream, - const specfem::MPI::MPI *mpi) {}; +specfem::mesh::properties read_properties(std::ifstream &stream, +const specfem::MPI::MPI *mpi); } // namespace fortran } // namespace mesh diff --git a/include/mesh/boundaries/boundaries.hpp b/include/mesh/boundaries/boundaries.hpp index d4e4908f..245d4f5e 100644 --- a/include/mesh/boundaries/boundaries.hpp +++ b/include/mesh/boundaries/boundaries.hpp @@ -36,9 +36,11 @@ struct boundaries { * @param forcing_boundary forcing boundary */ boundaries(const specfem::mesh::absorbing_boundary &absorbing_boundary, - const specfem::mesh::acoustic_free_surface &acoustic_free_surface) + const specfem::mesh::acoustic_free_surface &acoustic_free_surface, + const specfem::mesh::forcing_boundary &forcing_boundary) : absorbing_boundary(absorbing_boundary), - acoustic_free_surface(acoustic_free_surface) {} + acoustic_free_surface(acoustic_free_surface), + forcing_boundary(forcing_boundary) {} ///@} }; diff --git a/include/mesh/coupled_interfaces/interface_container.hpp b/include/mesh/coupled_interfaces/interface_container.hpp index 9ee1c1f1..8b5ae19e 100644 --- a/include/mesh/coupled_interfaces/interface_container.hpp +++ b/include/mesh/coupled_interfaces/interface_container.hpp @@ -29,7 +29,7 @@ struct interface_container { */ interface_container(){}; - interface_container(const int num_interfaces) {}; + interface_container(const int num_interfaces); ///@} diff --git a/include/mesh/materials/materials.hpp b/include/mesh/materials/materials.hpp index 4b2fc580..c2175331 100644 --- a/include/mesh/materials/materials.hpp +++ b/include/mesh/materials/materials.hpp @@ -78,7 +78,9 @@ struct materials { * @param nspec Number of spectral elements * @param ngnod Number of control nodes per spectral element */ - materials(const int nspec, const int ngnod); + materials( + const int nspec, const int numat) : + n_materials(numat), material_index_mapping("specfem::mesh::material_index_mapping", nspec) {}; ///@} diff --git a/src/IO/mesh/fortran/read_boundaries.cpp b/src/IO/mesh/fortran/read_boundaries.cpp index ce409b75..44a992a9 100644 --- a/src/IO/mesh/fortran/read_boundaries.cpp +++ b/src/IO/mesh/fortran/read_boundaries.cpp @@ -7,8 +7,139 @@ #include + + +static std::tuple< + specfem::kokkos::HostView1d, + specfem::kokkos::HostView1d > +find_corners(const specfem::kokkos::HostView1d ispec_edge, + const specfem::kokkos::HostView1d + type_edge) { + + int ncorner = 0; + int num_abs_boundary_faces = ispec_edge.extent(0); + for (int inum = 0; inum < num_abs_boundary_faces; inum++) { + if (type_edge(inum) == specfem::enums::boundaries::type::BOTTOM) { + for (int inum_duplicate = 0; inum_duplicate < num_abs_boundary_faces; + inum_duplicate++) { + if (inum != inum_duplicate) { + if (ispec_edge(inum) == ispec_edge(inum_duplicate)) { + if (type_edge(inum) == specfem::enums::boundaries::type::LEFT) { + ncorner++; + } + if (type_edge(inum) == specfem::enums::boundaries::type::RIGHT) { + ncorner++; + } + } + } + } + if (type_edge(inum) == specfem::enums::boundaries::type::TOP) { + for (int inum_duplicate = 0; inum_duplicate < num_abs_boundary_faces; + inum_duplicate++) { + if (inum != inum_duplicate) { + if (ispec_edge(inum) == ispec_edge(inum_duplicate)) { + if (type_edge(inum) == specfem::enums::boundaries::type::LEFT) { + ncorner++; + } + if (type_edge(inum) == specfem::enums::boundaries::type::RIGHT) { + ncorner++; + } + } + } + } + } + } + } + + specfem::kokkos::HostView1d ispec_corners( + "specfem:IO::mesh::fortran::read_boundaries::find_corners::ispec_corners", ncorner); + + specfem::kokkos::HostView1d type_corners( + "specfem:IO::mesh::fortran::read_boundaries::find_corners::type_corners", ncorner); + + int icorner = 0; + + for (int inum = 0; inum < num_abs_boundary_faces; inum++) { + if (type_edge(inum) == specfem::enums::boundaries::type::BOTTOM) { + for (int inum_duplicate = 0; inum_duplicate < num_abs_boundary_faces; + inum_duplicate++) { + if (inum != inum_duplicate) { + if (ispec_edge(inum) == ispec_edge(inum_duplicate)) { + if (type_edge(inum) == specfem::enums::boundaries::type::LEFT) { + ispec_corners(icorner) = ispec_edge(inum); + type_corners(icorner) = + specfem::enums::boundaries::type::BOTTOM_LEFT; + icorner++; + } + if (type_edge(inum) == specfem::enums::boundaries::type::RIGHT) { + ispec_corners(icorner) = ispec_edge(inum); + type_corners(icorner) = + specfem::enums::boundaries::type::BOTTOM_RIGHT; + icorner++; + } + } + } + } + if (type_edge(inum) == specfem::enums::boundaries::type::TOP) { + for (int inum_duplicate = 0; inum_duplicate < num_abs_boundary_faces; + inum_duplicate++) { + if (inum != inum_duplicate) { + if (ispec_edge(inum) == ispec_edge(inum_duplicate)) { + if (type_edge(inum) == specfem::enums::boundaries::type::LEFT) { + ispec_corners(icorner) = ispec_edge(inum); + type_corners(icorner) = + specfem::enums::boundaries::type::TOP_LEFT; + icorner++; + } + if (type_edge(inum) == specfem::enums::boundaries::type::RIGHT) { + ispec_corners(icorner) = ispec_edge(inum); + type_corners(icorner) = + specfem::enums::boundaries::type::TOP_RIGHT; + icorner++; + } + } + } + } + } + } + } + + return std::make_tuple(ispec_corners, type_corners); +} + + +inline void calculate_ib(const specfem::kokkos::HostView2d code, + specfem::kokkos::HostView1d ib_bottom, + specfem::kokkos::HostView1d ib_top, + specfem::kokkos::HostView1d ib_left, + specfem::kokkos::HostView1d ib_right, + const int nelements) { + + int nspec_left = 0, nspec_right = 0, nspec_top = 0, nspec_bottom = 0; + for (int inum = 0; inum < nelements; inum++) { + if (code(inum, 0)) { + ib_bottom(inum) = nspec_bottom; + nspec_bottom++; + } else if (code(inum, 1)) { + ib_right(inum) = nspec_right; + nspec_right++; + } else if (code(inum, 2)) { + ib_top(inum) = nspec_top; + nspec_top++; + } else if (code(inum, 3)) { + ib_left(inum) = nspec_left; + nspec_left++; + } else { + throw std::runtime_error("Incorrect acoustic boundary element type read"); + } + } + + assert(nspec_left + nspec_right + nspec_bottom + nspec_top == nelements); +} + + specfem::mesh::absorbing_boundary -specfem::IO::mesh::fortran::read_absorbing_boundaries( +read_absorbing_boundaries( std::ifstream &stream, int num_abs_boundary_faces, const int nspec, const specfem::MPI::MPI *mpi) { @@ -167,7 +298,8 @@ read_acoustic_free_surface(std::ifstream &stream, } -specfem::mesh::forcing_boundary read_forcing_boundaries( +specfem::mesh::forcing_boundary +read_forcing_boundaries( std::ifstream &stream, const int nelement_acforcing, const int nspec, const specfem::MPI::MPI *mpi) { @@ -221,131 +353,25 @@ specfem::mesh::forcing_boundary read_forcing_boundaries( } +specfem::mesh::boundaries +specfem::IO::mesh::fortran::read_boundaries( + std::ifstream &stream, const int nspec, const int n_absorbing, + const int n_acoustic_surface, const int n_acforcing, + const Kokkos::View knods, + const specfem::MPI::MPI *mpi) { -static std::tuple< - specfem::kokkos::HostView1d, - specfem::kokkos::HostView1d > -find_corners(const specfem::kokkos::HostView1d ispec_edge, - const specfem::kokkos::HostView1d - type_edge) { - - int ncorner = 0; - int num_abs_boundary_faces = ispec_edge.extent(0); - for (int inum = 0; inum < num_abs_boundary_faces; inum++) { - if (type_edge(inum) == specfem::enums::boundaries::type::BOTTOM) { - for (int inum_duplicate = 0; inum_duplicate < num_abs_boundary_faces; - inum_duplicate++) { - if (inum != inum_duplicate) { - if (ispec_edge(inum) == ispec_edge(inum_duplicate)) { - if (type_edge(inum) == specfem::enums::boundaries::type::LEFT) { - ncorner++; - } - if (type_edge(inum) == specfem::enums::boundaries::type::RIGHT) { - ncorner++; - } - } - } - } - if (type_edge(inum) == specfem::enums::boundaries::type::TOP) { - for (int inum_duplicate = 0; inum_duplicate < num_abs_boundary_faces; - inum_duplicate++) { - if (inum != inum_duplicate) { - if (ispec_edge(inum) == ispec_edge(inum_duplicate)) { - if (type_edge(inum) == specfem::enums::boundaries::type::LEFT) { - ncorner++; - } - if (type_edge(inum) == specfem::enums::boundaries::type::RIGHT) { - ncorner++; - } - } - } - } - } - } - } - - specfem::kokkos::HostView1d ispec_corners( - "specfem:IO::mesh::fortran::read_boundaries::find_corners::ispec_corners", ncorner); + // Read absorbing boundaries + auto absorbing_boundary = read_absorbing_boundaries( + stream, n_absorbing, nspec, mpi); - specfem::kokkos::HostView1d type_corners( - "specfem:IO::mesh::fortran::read_boundaries::find_corners::type_corners", ncorner); + // Read acoustic free surface + auto acoustic_free_surface = read_acoustic_free_surface( + stream, n_acoustic_surface, knods, mpi); - int icorner = 0; + // Read forcing boundaries + auto forcing_boundary = read_forcing_boundaries( + stream, n_acforcing, nspec, mpi); - for (int inum = 0; inum < num_abs_boundary_faces; inum++) { - if (type_edge(inum) == specfem::enums::boundaries::type::BOTTOM) { - for (int inum_duplicate = 0; inum_duplicate < num_abs_boundary_faces; - inum_duplicate++) { - if (inum != inum_duplicate) { - if (ispec_edge(inum) == ispec_edge(inum_duplicate)) { - if (type_edge(inum) == specfem::enums::boundaries::type::LEFT) { - ispec_corners(icorner) = ispec_edge(inum); - type_corners(icorner) = - specfem::enums::boundaries::type::BOTTOM_LEFT; - icorner++; - } - if (type_edge(inum) == specfem::enums::boundaries::type::RIGHT) { - ispec_corners(icorner) = ispec_edge(inum); - type_corners(icorner) = - specfem::enums::boundaries::type::BOTTOM_RIGHT; - icorner++; - } - } - } - } - if (type_edge(inum) == specfem::enums::boundaries::type::TOP) { - for (int inum_duplicate = 0; inum_duplicate < num_abs_boundary_faces; - inum_duplicate++) { - if (inum != inum_duplicate) { - if (ispec_edge(inum) == ispec_edge(inum_duplicate)) { - if (type_edge(inum) == specfem::enums::boundaries::type::LEFT) { - ispec_corners(icorner) = ispec_edge(inum); - type_corners(icorner) = - specfem::enums::boundaries::type::TOP_LEFT; - icorner++; - } - if (type_edge(inum) == specfem::enums::boundaries::type::RIGHT) { - ispec_corners(icorner) = ispec_edge(inum); - type_corners(icorner) = - specfem::enums::boundaries::type::TOP_RIGHT; - icorner++; - } - } - } - } - } - } - } - - return std::make_tuple(ispec_corners, type_corners); -} - - -inline void calculate_ib(const specfem::kokkos::HostView2d code, - specfem::kokkos::HostView1d ib_bottom, - specfem::kokkos::HostView1d ib_top, - specfem::kokkos::HostView1d ib_left, - specfem::kokkos::HostView1d ib_right, - const int nelements) { - - int nspec_left = 0, nspec_right = 0, nspec_top = 0, nspec_bottom = 0; - for (int inum = 0; inum < nelements; inum++) { - if (code(inum, 0)) { - ib_bottom(inum) = nspec_bottom; - nspec_bottom++; - } else if (code(inum, 1)) { - ib_right(inum) = nspec_right; - nspec_right++; - } else if (code(inum, 2)) { - ib_top(inum) = nspec_top; - nspec_top++; - } else if (code(inum, 3)) { - ib_left(inum) = nspec_left; - nspec_left++; - } else { - throw std::runtime_error("Incorrect acoustic boundary element type read"); - } - } - - assert(nspec_left + nspec_right + nspec_bottom + nspec_top == nelements); -} \ No newline at end of file + return specfem::mesh::boundaries( + absorbing_boundary, acoustic_free_surface, forcing_boundary); +} diff --git a/src/IO/mesh/fortran/read_elements.cpp b/src/IO/mesh/fortran/read_elements.cpp index 3f70acd3..2c8df9d1 100644 --- a/src/IO/mesh/fortran/read_elements.cpp +++ b/src/IO/mesh/fortran/read_elements.cpp @@ -30,10 +30,10 @@ specfem::mesh::elements::tangential_elements specfem::IO::mesh::fortran::read_ta std::ifstream &stream, const int nnodes_tangential_curve) { type_real xread, yread; - specfem::mesh::elements::tangential_elements tangential_elements(nnodes_tangential_curve); + auto tangential_elements = specfem::mesh::elements::tangential_elements(nnodes_tangential_curve); - specfem::IO::fortran_read_line(stream, tangential_elements.force_normal_to_surface, - tangential_elements.rec_normal_to_surface); + specfem::IO::fortran_read_line(stream, &tangential_elements.force_normal_to_surface, + &tangential_elements.rec_normal_to_surface); if (nnodes_tangential_curve > 0) { for (int inum = 0; inum < nnodes_tangential_curve; inum++) { diff --git a/src/IO/mesh/fortran/read_interfaces.cpp b/src/IO/mesh/fortran/read_interfaces.cpp index d461f863..4ee111cd 100644 --- a/src/IO/mesh/fortran/read_interfaces.cpp +++ b/src/IO/mesh/fortran/read_interfaces.cpp @@ -1,99 +1,93 @@ +#include "IO/fortranio/interface.hpp" #include "IO/mesh/fortran/read_interfaces.hpp" #include "mesh/coupled_interfaces/coupled_interfaces.hpp" #include "mesh/coupled_interfaces/interface_container.hpp" #include "specfem_mpi/interface.hpp" - template - specfem::mesh::interface_container - specfem::IO::mesh::fortran::read_interfaces( - const int num_interfaces, std::ifstream &stream, - const specfem::MPI::MPI *mpi) { +template +specfem::mesh::interface_container +specfem::IO::mesh::fortran::read_interfaces( + const int num_interfaces, std::ifstream &stream, + const specfem::MPI::MPI *mpi) { - if (!num_interfaces) - return; + specfem::mesh::interface_container interface(num_interfaces); - int medium1_ispec_l, medium2_ispec_l; + if (!num_interfaces) + return interface; - specfem::mesh::interface_container interface(num_interfaces); + int medium1_ispec_l, medium2_ispec_l; - interface.medium1_index_mapping("medium1_index_mapping", num_interfaces); - interface.medium2_index_mapping("medium2_index_mapping", num_interfaces); - - for (int i = 0; i < num_interfaces; i++) { - specfem::IO::fortran_read_line(stream, &medium2_ispec_l, - &medium1_ispec_l); - interface.medium1_index_mapping(i) = medium1_ispec_l - 1; - interface.medium2_index_mapping(i) = medium2_ispec_l - 1; - } - - return interface; + for (int i = 0; i < num_interfaces; i++) { + specfem::IO::fortran_read_line(stream, &medium2_ispec_l, + &medium1_ispec_l); + interface.medium1_index_mapping(i) = medium1_ispec_l - 1; + interface.medium2_index_mapping(i) = medium2_ispec_l - 1; } - // Explicit instantiation of the template function for the different medium interfaces - // elastic/acoustic - template specfem::mesh::interface_container< - specfem::element::medium_tag::elastic, - specfem::element::medium_tag::acoustic - > specfem::IO::mesh::fortran::read_interfaces< + return interface; +} + +// Explicit instantiation of the template function for the different medium interfaces +// elastic/acoustic +template specfem::mesh::interface_container< + specfem::element::medium_tag::elastic, + specfem::element::medium_tag::acoustic +> specfem::IO::mesh::fortran::read_interfaces< + specfem::element::medium_tag::elastic, + specfem::element::medium_tag::acoustic + >(const int num_interfaces, std::ifstream &stream, + const specfem::MPI::MPI *mpi); + + +// acoustic/poroelastic +template specfem::mesh::interface_container< + specfem::element::medium_tag::acoustic, + specfem::element::medium_tag::poroelastic +> specfem::IO::mesh::fortran::read_interfaces< + specfem::element::medium_tag::acoustic, + specfem::element::medium_tag::poroelastic +>(const int num_interfaces, std::ifstream &stream, + const specfem::MPI::MPI *mpi); + +// elastic/poroelastic +template specfem::mesh::interface_container< + specfem::element::medium_tag::elastic, + specfem::element::medium_tag::poroelastic +> specfem::IO::mesh::fortran::read_interfaces< + specfem::element::medium_tag::elastic, + specfem::element::medium_tag::poroelastic +>(const int num_interfaces, std::ifstream &stream, + const specfem::MPI::MPI *mpi); + + +specfem::mesh::coupled_interfaces +specfem::IO::mesh::fortran::read_coupled_interfaces ( + std::ifstream &stream, + const int num_interfaces_elastic_acoustic, + const int num_interfaces_acoustic_poroelastic, + const int num_interfaces_elastic_poroelastic, + const specfem::MPI::MPI *mpi) { + + auto elastic_acoustic = + specfem::IO::mesh::fortran::read_interfaces< specfem::element::medium_tag::elastic, specfem::element::medium_tag::acoustic - >(const int num_interfaces, std::ifstream &stream, - const specfem::MPI::MPI *mpi) {}; + >(num_interfaces_elastic_acoustic, stream, mpi); - // acoustic/poroelastic - template specfem::mesh::interface_container< - specfem::element::medium_tag::acoustic, - specfem::element::medium_tag::poroelastic - > specfem::IO::mesh::fortran::read_interfaces< + auto acoustic_poroelastic = + specfem::IO::mesh::fortran::read_interfaces< specfem::element::medium_tag::acoustic, specfem::element::medium_tag::poroelastic - >(const int num_interfaces, std::ifstream &stream, - const specfem::MPI::MPI *mpi) {}; + >(num_interfaces_acoustic_poroelastic, stream, mpi); - // elastic/poroelastic - template specfem::mesh::interface_container< + auto elastic_poroelastic = + specfem::IO::mesh::fortran::read_interfaces< specfem::element::medium_tag::elastic, specfem::element::medium_tag::poroelastic - > specfem::IO::mesh::fortran::read_interfaces< - specfem::element::medium_tag::elastic, - specfem::element::medium_tag::poroelastic - >(const int num_interfaces, std::ifstream &stream, - const specfem::MPI::MPI *mpi) {}; - - - specfem::mesh::coupled_interfaces - read_coupled_interfaces ( - std::ifstream &stream, const int num_interfaces_elastic_acoustic, - const int num_interfaces_acoustic_poroelastic, - const int num_interfaces_elastic_poroelastic, const specfem::MPI::MPI *mpi) { - - auto elastic_acoustic = - read_interface< - specfem::element::medium_tag::elastic, - specfem::element::medium_tag::acoustic - >(num_interfaces_elastic_acoustic, stream, mpi); - - auto acoustic_poroelastic = - read_interface< - specfem::element::medium_tag::acoustic, - specfem::element::medium_tag::poroelastic - >(num_interfaces_acoustic_poroelastic, stream, mpi); - - auto elastic_poroelastic = - read_interface< - specfem::element::medium_tag::elastic, - specfem::element::medium_tag::poroelastic - >(num_interfaces_elastic_poroelastic, stream, mpi); - - return specfem::mesh::coupled_interfaces( - elastic_acoustic, acoustic_poroelastic, elastic_poroelastic); - } - - - -} // namespace fortran -} // namespace mesh -} // namespace IO -} // namespace specfem \ No newline at end of file + >(num_interfaces_elastic_poroelastic, stream, mpi); + + return specfem::mesh::coupled_interfaces( + elastic_acoustic, acoustic_poroelastic, elastic_poroelastic); +} diff --git a/src/IO/mesh/fortran/read_material_properties.cpp b/src/IO/mesh/fortran/read_material_properties.cpp index b0c461ea..6fa8b231 100644 --- a/src/IO/mesh/fortran/read_material_properties.cpp +++ b/src/IO/mesh/fortran/read_material_properties.cpp @@ -1,13 +1,12 @@ -#include "IO/fortranio/fortran_io.hpp" -#include "specfem_mpi/interface.hpp" -#include "utilities/interface.hpp" +#include "IO/mesh/fortran/read_material_properties.hpp" #include "mesh/materials/materials.hpp" -#include "mesh/IO/fortran/read_material_properties.hpp" +#include "IO/fortranio/interface.hpp" +#include "utilities/interface.hpp" +#include "specfem_mpi/interface.hpp" #include #include namespace { - constexpr auto elastic = specfem::element::medium_tag::elastic; constexpr auto isotropic = specfem::element::property_tag::isotropic; constexpr auto acoustic = specfem::element::medium_tag::acoustic; @@ -174,66 +173,31 @@ void read_material_indices( return; } +} // namespace -void read_material_indices( - std::ifstream &stream, const int nspec, const int numat, - const std::vector - &index_mapping, - const specfem::kokkos::HostView1d< - specfem::mesh::materials::material_specification> - material_index_mapping, - const specfem::kokkos::HostView2d knods, - const specfem::MPI::MPI *mpi) { - - const int ngnod = knods.extent(0); - int n, kmato_read, pml_read; - - std::vector knods_read(ngnod, -1); - - for (int ispec = 0; ispec < nspec; ispec++) { - // format: #element_id #material_id #node_id1 #node_id2 #... - specfem::IO::fortran_read_line(stream, &n, &kmato_read, &knods_read, - &pml_read); - - if (n < 1 || n > nspec) { - throw std::runtime_error("Error reading material indices"); - } - - if (kmato_read < 1 || kmato_read > numat) { - throw std::runtime_error("Error reading material indices"); - } - - for (int i = 0; i < ngnod; i++) { - if (knods_read[i] == 0) - throw std::runtime_error("Error reading knods (node_id) values"); - - knods(i, n - 1) = knods_read[i] - 1; - } - - material_index_mapping(n - 1) = index_mapping[kmato_read - 1]; - } - - return; -} - -specfem::mesh::materials specfem::IO:mesh:fortran::read_material_properties( +specfem::mesh::materials +specfem::IO::mesh::fortran::read_material_properties( std::ifstream &stream, const int numat, const int nspec, - const specfem::kokkos::HostView2d knods, const specfem::MPI::MPI *mpi) - : n_materials(numat), - material_index_mapping("specfem::mesh::material_index_mapping", nspec) { - - specfem:mesh::materials materials(nspec, knods); + const specfem::kokkos::HostView2d knods, const specfem::MPI::MPI *mpi){ + + // Create materials instances + specfem::mesh::materials materials(nspec, numat); // Read material properties - auto index_mapping = read_materials(stream, numat, materials.elastic_isotropic, - materials.acoustic_isotropic, mpi); + auto index_mapping = read_materials( + stream, numat, + materials.elastic_isotropic, + materials.acoustic_isotropic, + mpi); // Read material indices - read_material_indices(stream, nspec, numat, index_mapping, - materials.material_index_mapping, knods, mpi); + read_material_indices( + stream, nspec, numat, + index_mapping, + materials.material_index_mapping, + knods, mpi); return materials; } -} // namespace \ No newline at end of file diff --git a/src/IO/mesh/fortran/read_mesh_database.cpp b/src/IO/mesh/fortran/read_mesh_database.cpp index 8fd05e98..0841152d 100644 --- a/src/IO/mesh/fortran/read_mesh_database.cpp +++ b/src/IO/mesh/fortran/read_mesh_database.cpp @@ -146,7 +146,7 @@ std::tuple specfem::IO::mesh::fortran::read_mesh_database_header( } specfem::kokkos::HostView2d -read_coorg_elements( +specfem::IO::mesh::fortran::read_coorg_elements( std::ifstream &stream, const int npgeo, const specfem::MPI::MPI *mpi) { @@ -171,7 +171,7 @@ read_coorg_elements( } std::tuple -read_mesh_database_attenuation( +specfem::IO::mesh::fortran::read_mesh_database_attenuation( std::ifstream &stream, const specfem::MPI::MPI *mpi) { int n_sls; diff --git a/src/IO/mesh/fortran/read_properties.cpp b/src/IO/mesh/fortran/read_properties.cpp index 2dc4dc5a..06696d14 100644 --- a/src/IO/mesh/fortran/read_properties.cpp +++ b/src/IO/mesh/fortran/read_properties.cpp @@ -3,8 +3,9 @@ #include "IO/mesh/fortran/read_properties.hpp" -specfem::mesh::properties specfem::IO::mesh::fortran::read_properties(std::ifstream &stream, - const specfem::MPI::MPI *mpi) { +specfem::mesh::properties +specfem::IO::mesh::fortran::read_properties( + std::ifstream &stream, const specfem::MPI::MPI *mpi) { // --------------------------------------------------------------------- // reading mesh properties @@ -23,8 +24,8 @@ specfem::mesh::properties specfem::IO::mesh::fortran::read_properties(std::ifstr int nelem_on_the_axis; ///< Number of axial elements bool plot_lowerleft_corner_only; - specfem::IO::fortran_read_line(stream, numat, ngnod, nspec, pointsdisp, - plot_lowerleft_corner_only); + specfem::IO::fortran_read_line(stream, &numat, &ngnod, &nspec, &pointsdisp, + &plot_lowerleft_corner_only); // --------------------------------------------------------------------- if (ngnod != 9) { @@ -36,10 +37,10 @@ specfem::mesh::properties specfem::IO::mesh::fortran::read_properties(std::ifstr } specfem::IO::fortran_read_line( - stream, nelemabs, nelem_acforcing, - nelem_acoustic_surface, num_fluid_solid_edges, - num_fluid_poro_edges, num_solid_poro_edges, - nnodes_tangential_curve, nelem_on_the_axis); + stream, &nelemabs, &nelem_acforcing, + &nelem_acoustic_surface, &num_fluid_solid_edges, + &num_fluid_poro_edges, &num_solid_poro_edges, + &nnodes_tangential_curve, &nelem_on_the_axis); // ---------------------------------------------------------------------- mpi->sync_all(); diff --git a/src/IO/mesh/read_mesh.cpp b/src/IO/mesh/read_mesh.cpp index 590e6bc6..0fa6d997 100644 --- a/src/IO/mesh/read_mesh.cpp +++ b/src/IO/mesh/read_mesh.cpp @@ -1,15 +1,15 @@ #include "mesh/mesh.hpp" -#include "IO/fortranio/interface.hpp" #include "enumerations/specfem_enums.hpp" #include "kokkos_abstractions.h" #include "material/material.hpp" +#include "IO/fortranio/interface.hpp" #include "IO/mesh/read_mesh.hpp" #include "IO/mesh/fortran/read_mesh_database.hpp" +#include "IO/mesh/fortran/read_properties.hpp" #include "IO/mesh/fortran/read_material_properties.hpp" -#include "IO/mesh/fortran/read_interfaces.hpp" -#include "IO/mesh/fortran/read_boundaries.hpp" #include "IO/mesh/fortran/read_elements.hpp" -#include "IO/mesh/fortran/read_material_properties.hpp" +#include "IO/mesh/fortran/read_boundaries.hpp" +#include "IO/mesh/fortran/read_interfaces.hpp" #include "specfem_mpi/interface.hpp" #include "specfem_setup.hpp" #include @@ -23,6 +23,15 @@ specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, std::ifstream stream; stream.open(filename); + int nspec, npgeo, nproc; + + specfem::mesh::control_nodes control_nodes; + specfem::mesh::properties parameters; + specfem::mesh::materials materials; + specfem::mesh::boundaries boundaries; + specfem::mesh::elements::axial_elements axial_nodes; + specfem::mesh::elements::tangential_elements tangential_nodes; + specfem::mesh::coupled_interfaces coupled_interfaces; if (!stream.is_open()) { throw std::runtime_error("Could not open database file"); @@ -36,32 +45,31 @@ specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, } // Mesh class to be populated from the database file. - specfem::mesh::mesh mesh(); - try { - auto mesh->control_nodes.coord = specfem::IO::mesh::fortran::read_coorg_elements( + + control_nodes.coord = specfem::IO::mesh::fortran::read_coorg_elements( stream, npgeo, mpi); } catch (std::runtime_error &e) { throw; } try { - mesh->parameters = specfem::IO::mesh::fortran::read_properties(stream, mpi); + auto parameters = specfem::IO::mesh::fortran::read_properties(stream, mpi); } catch (std::runtime_error &e) { throw; } - mesh->control_nodes.ngnod = mesh->parameters.ngnod; - mesh->control_nodes.nspec = mesh->nspec; - mesh->control_nodes.knods = specfem::kokkos::HostView2d( - "specfem::mesh::knods", mesh->parameters.ngnod, mesh->nspec); + control_nodes.ngnod = parameters.ngnod; + control_nodes.nspec = nspec; + control_nodes.knods = specfem::kokkos::HostView2d( + "specfem::mesh::knods", parameters.ngnod, nspec); - int nspec_all = mpi->reduce(mesh->parameters.nspec, specfem::MPI::sum); + int nspec_all = mpi->reduce(parameters.nspec, specfem::MPI::sum); int nelem_acforcing_all = - mpi->reduce(mesh->parameters.nelem_acforcing, specfem::MPI::sum); + mpi->reduce(parameters.nelem_acforcing, specfem::MPI::sum); int nelem_acoustic_surface_all = - mpi->reduce(mesh->parameters.nelem_acoustic_surface, specfem::MPI::sum); + mpi->reduce(parameters.nelem_acoustic_surface, specfem::MPI::sum); try { auto [n_sls, attenuation_f0_reference, read_velocities_at_f0] = @@ -73,8 +81,7 @@ specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, try { auto materials = specfem::IO::mesh::fortran::read_material_properties( - stream, mesh->parameters.numat, mesh->nspec, - mesh->control_nodes.knods, mpi); + stream, nspec, parameters.numat, control_nodes.knods, mpi); } catch (std::runtime_error &e) { throw; } @@ -106,10 +113,13 @@ specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, specfem::IO::fortran_read_line(stream, &ninterfaces, &max_interface_size); try { - mesh->boundaries = specfem::IO::mesh::fortran::read_boundaries( - stream, mesh->parameters.nspec, mesh->parameters.nelemabs, - mesh->parameters.nelem_acforcing, - mesh->parameters.nelem_acoustic_surface, mesh->control_nodes.knods, + auto boundaries = specfem::IO::mesh::fortran::read_boundaries( + stream, + parameters.nspec, + parameters.nelemabs, + parameters.nelem_acoustic_surface, + parameters.nelem_acforcing, + control_nodes.knods, mpi); } catch (std::runtime_error &e) { throw; @@ -140,24 +150,24 @@ specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, // } try { - mesh->coupled_interfaces = specfem::IO::mesh::fortran::read_coupled_interfaces( - stream, mesh->parameters.num_fluid_solid_edges, - mesh->parameters.num_fluid_poro_edges, - mesh->parameters.num_solid_poro_edges, mpi); + auto coupled_interfaces = specfem::IO::mesh::fortran::read_coupled_interfaces( + stream, parameters.num_fluid_solid_edges, + parameters.num_fluid_poro_edges, + parameters.num_solid_poro_edges, mpi); } catch (std::runtime_error &e) { throw; } try { - mesh->tangential_nodes = specfem::IO::mesh::fortran::read_elements::read_tangential_elements( - stream, mesh->parameters.nnodes_tangential_curve); + auto tangential_nodes = specfem::IO::mesh::fortran::read_tangential_elements( + stream, parameters.nnodes_tangential_curve); } catch (std::runtime_error &e) { throw; } try { - mesh->axial_nodes = specfem::IO::mesh::fortran::read_elements::axial_elements( - stream, mesh->parameters.nelem_on_the_axis, mesh->nspec, mpi); + auto axial_nodes = specfem::IO::mesh::fortran::read_axial_elements( + stream, parameters.nelem_on_the_axis, nspec, mpi); } catch (std::runtime_error &e) { throw; } @@ -176,12 +186,12 @@ specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, "------------------------------"); mpi->cout("Number of material systems = " + - std::to_string(mesh->materials.n_materials) + "\n\n"); + std::to_string(materials.n_materials) + "\n\n"); const auto l_elastic_isotropic = - mesh->materials.elastic_isotropic.material_properties; + materials.elastic_isotropic.material_properties; const auto l_acoustic_isotropic = - mesh->materials.acoustic_isotropic.material_properties; + materials.acoustic_isotropic.material_properties; for (const auto material : l_elastic_isotropic) { mpi->cout(material.print()); @@ -192,42 +202,11 @@ specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, } assert(l_elastic_isotropic.size() + l_acoustic_isotropic.size() == - this->materials.n_materials); - - mesh->tags = specfem::mesh::tags(mesh->materials, mesh->boundaries); + materials.n_materials); - return; -} + auto tags = specfem::mesh::tags(materials, boundaries); -std::string specfem::mesh::mesh::print() const { - - int n_elastic; - int n_acoustic; - - Kokkos::parallel_reduce( - "specfem::mesh::mesh::print", specfem::kokkos::HostRange(0, this->nspec), - KOKKOS_CLASS_LAMBDA(const int ispec, int &n_elastic, int &n_acoustic) { - if (this->materials.material_index_mapping(ispec).type == - specfem::element::medium_tag::elastic) { - n_elastic++; - } else if (this->materials.material_index_mapping(ispec).type == - specfem::element::medium_tag::acoustic) { - n_acoustic++; - } - }, - n_elastic, n_acoustic); - - std::ostringstream message; - - message - << "Spectral element information:\n" - << "------------------------------\n" - << "Total number of spectral elements : " << this->nspec << "\n" - << "Total number of spectral elements assigned to elastic material : " - << n_elastic << "\n" - << "Total number of spectral elements assigned to acoustic material : " - << n_acoustic << "\n" - << "Total number of geometric points : " << this->npgeo << "\n"; - - return mesh; + return specfem::mesh::mesh(npgeo, nspec, nproc, control_nodes, parameters, + coupled_interfaces, boundaries, tags, + tangential_nodes, axial_nodes, materials); } diff --git a/src/mesh/boundaries/forcing_boundaries.cpp b/src/mesh/boundaries/forcing_boundaries.cpp index 1d176aad..7d644e5d 100644 --- a/src/mesh/boundaries/forcing_boundaries.cpp +++ b/src/mesh/boundaries/forcing_boundaries.cpp @@ -1,7 +1,6 @@ #include "IO/fortranio/interface.hpp" #include "mesh/boundaries/boundaries.hpp" #include "specfem_mpi/interface.hpp" -#include "utilities.cpp" #include #include diff --git a/src/mesh/materials/materials.cpp b/src/mesh/materials/materials.cpp index 2ad766f1..c200d6e3 100644 --- a/src/mesh/materials/materials.cpp +++ b/src/mesh/materials/materials.cpp @@ -4,154 +4,6 @@ #include "mesh/materials/materials.tpp" #include -// Anonymous namespace to hide internal functions, and help the compiler. - - - - -std::vector read_materials( - std::ifstream &stream, const int numat, - specfem::mesh::materials::material &elastic_isotropic, - specfem::mesh::materials::material &acoustic_isotropic, - const specfem::MPI::MPI *mpi) { - - input_holder read_values; - - std::ostringstream message; - - std::vector index_mapping( - numat); - - message << "Material systems:\n" - << "------------------------------"; - - mpi->cout(message.str()); - - if (mpi->get_rank() == 0) - std::cout << "Number of material systems = " << numat << "\n\n"; - - std::vector > - l_elastic_isotropic; - - l_elastic_isotropic.reserve(numat); - - int index_elastic_isotropic = 0; - - std::vector > - l_acoustic_isotropic; - - l_acoustic_isotropic.reserve(numat); - - int index_acoustic_isotropic = 0; - - for (int i = 0; i < numat; i++) { - - specfem::IO::fortran_read_line( - stream, &read_values.n, &read_values.indic, &read_values.val0, - &read_values.val1, &read_values.val2, &read_values.val3, - &read_values.val4, &read_values.val5, &read_values.val6, - &read_values.val7, &read_values.val8, &read_values.val9, - &read_values.val10, &read_values.val11, &read_values.val12); - - if (read_values.n < 1 || read_values.n > numat) { - throw std::runtime_error( - "Wrong material set number. Check database file."); - } - - assert(read_values.n == i + 1); - - if (read_values.indic == 1) { - // Acoustic Material - if (read_values.val2 == 0) { - const type_real density = read_values.val0; - const type_real cp = read_values.val1; - const type_real compaction_grad = read_values.val3; - const type_real Qkappa = read_values.val5; - const type_real Qmu = read_values.val6; - - specfem::material::material acoustic_holder( - density, cp, Qkappa, Qmu, compaction_grad); - - acoustic_holder.print(); - - l_acoustic_isotropic.push_back(acoustic_holder); - - index_mapping[i] = specfem::mesh::materials::material_specification( - specfem::element::medium_tag::acoustic, - specfem::element::property_tag::isotropic, - index_acoustic_isotropic); - - index_acoustic_isotropic++; - - } else { - - const type_real density = read_values.val0; - const type_real cp = read_values.val1; - const type_real cs = read_values.val2; - const type_real compaction_grad = read_values.val3; - const type_real Qkappa = read_values.val5; - const type_real Qmu = read_values.val6; - - specfem::material::material elastic_holder( - density, cs, cp, Qkappa, Qmu, compaction_grad); - - elastic_holder.print(); - - l_elastic_isotropic.push_back(elastic_holder); - - index_mapping[i] = specfem::mesh::materials::material_specification( - specfem::element::medium_tag::elastic, - specfem::element::property_tag::isotropic, index_elastic_isotropic); - - index_elastic_isotropic++; - } - } else { - throw std::runtime_error("Material type not supported"); - } - } - - assert(l_elastic_isotropic.size() + l_acoustic_isotropic.size() == numat); - - elastic_isotropic = specfem::mesh::materials::material( - l_elastic_isotropic.size(), l_elastic_isotropic); - - acoustic_isotropic = specfem::mesh::materials::material( - l_acoustic_isotropic.size(), l_acoustic_isotropic); - - return index_mapping; -} - -} // namespace - -// specfem::mesh::material_ind::material_ind(const int nspec, const int ngnod) { -// this->region_CPML = -// specfem::kokkos::HostView1d("specfem::mesh::region_CPML", nspec); -// this->kmato = -// specfem::kokkos::HostView1d("specfem::mesh::region_CPML", nspec); - -// for (int ispec = 0; ispec < nspec; ispec++) { -// this->kmato(ispec) = -1; -// } -// return; -// } - -specfem::mesh::materials::materials( - std::ifstream &stream, const int numat, const int nspec, - const specfem::kokkos::HostView2d knods, const specfem::MPI::MPI *mpi) - : n_materials(numat), - material_index_mapping("specfem::mesh::material_index_mapping", nspec) { - - // Read material properties - auto index_mapping = read_materials(stream, numat, this->elastic_isotropic, - this->acoustic_isotropic, mpi); - - // Read material indices - read_material_indices(stream, nspec, numat, index_mapping, - this->material_index_mapping, knods, mpi); - - return; -} - std::variant< specfem::material::material, diff --git a/src/mesh/mesh.cpp b/src/mesh/mesh.cpp index a8a0344a..6c29ddf6 100644 --- a/src/mesh/mesh.cpp +++ b/src/mesh/mesh.cpp @@ -3,7 +3,7 @@ #include "enumerations/specfem_enums.hpp" #include "kokkos_abstractions.h" #include "material/material.hpp" -#include "mesh/IO/fortran/read_mesh_database.hpp" +#include "IO/mesh/fortran/read_mesh_database.hpp" #include "specfem_mpi/interface.hpp" #include "specfem_setup.hpp" #include @@ -12,185 +12,6 @@ #include #include -specfem::mesh::mesh::mesh(const std::string filename, - const specfem::MPI::MPI *mpi) { - - std::ifstream stream; - stream.open(filename); - - if (!stream.is_open()) { - throw std::runtime_error("Could not open database file"); - } - - try { - auto [nspec, npgeo, nproc] = - specfem::mesh::IO::fortran::read_mesh_database_header(stream, mpi); - this->nspec = nspec; - this->npgeo = npgeo; - this->nproc = nproc; - } catch (std::runtime_error &e) { - throw; - } - - try { - this->control_nodes.coord = specfem::mesh::IO::fortran::read_coorg_elements( - stream, this->npgeo, mpi); - } catch (std::runtime_error &e) { - throw; - } - - try { - this->parameters = specfem::mesh::properties(stream, mpi); - } catch (std::runtime_error &e) { - throw; - } - - this->control_nodes.ngnod = this->parameters.ngnod; - this->control_nodes.nspec = this->nspec; - this->control_nodes.knods = specfem::kokkos::HostView2d( - "specfem::mesh::knods", this->parameters.ngnod, this->nspec); - - int nspec_all = mpi->reduce(this->parameters.nspec, specfem::MPI::sum); - int nelem_acforcing_all = - mpi->reduce(this->parameters.nelem_acforcing, specfem::MPI::sum); - int nelem_acoustic_surface_all = - mpi->reduce(this->parameters.nelem_acoustic_surface, specfem::MPI::sum); - - try { - auto [n_sls, attenuation_f0_reference, read_velocities_at_f0] = - specfem::mesh::IO::fortran::read_mesh_database_attenuation(stream, mpi); - } catch (std::runtime_error &e) { - throw; - } - - try { - this->materials = - specfem::mesh::materials(stream, this->parameters.numat, this->nspec, - this->control_nodes.knods, mpi); - } catch (std::runtime_error &e) { - throw; - } - - // try { - // materials = specfem::mesh::IO::fortran::read_material_properties( - // stream, this->parameters.numat, mpi); - // } catch (std::runtime_error &e) { - // throw; - // } - - // try { - // this->material_ind = specfem::mesh::material_ind( - // stream, this->parameters.ngnod, this->nspec, this->parameters.numat, - // this->control_nodes.knods, mpi); - // } catch (std::runtime_error &e) { - // throw; - // } - - // try { - // this->interface = specfem::mesh::interfaces::interface(stream, mpi); - // } catch (std::runtime_error &e) { - // throw; - // } - - int ninterfaces; - int max_interface_size; - - specfem::IO::fortran_read_line(stream, &ninterfaces, &max_interface_size); - - try { - this->boundaries = specfem::mesh::boundaries( - stream, this->parameters.nspec, this->parameters.nelemabs, - this->parameters.nelem_acforcing, - this->parameters.nelem_acoustic_surface, this->control_nodes.knods, - mpi); - } catch (std::runtime_error &e) { - throw; - } - - // try { - // this->boundaries.absorbing_boundary = specfem::mesh::absorbing_boundary( - // stream, this->parameters.nelemabs, this->parameters.nspec, mpi); - // } catch (std::runtime_error &e) { - // throw; - // } - - // try { - // this->boundaries.forcing_boundary = specfem::mesh::forcing_boundary( - // stream, this->parameters.nelem_acforcing, this->parameters.nspec, - // mpi); - // } catch (std::runtime_error &e) { - // throw; - // } - - // try { - // this->boundaries.acoustic_free_surface = - // specfem::mesh::acoustic_free_surface( - // stream, this->parameters.nelem_acoustic_surface, - // this->control_nodes.knods, mpi); - // } catch (std::runtime_error &e) { - // throw; - // } - - try { - this->coupled_interfaces = specfem::mesh::coupled_interfaces( - stream, this->parameters.num_fluid_solid_edges, - this->parameters.num_fluid_poro_edges, - this->parameters.num_solid_poro_edges, mpi); - } catch (std::runtime_error &e) { - throw; - } - - try { - this->tangential_nodes = specfem::mesh::elements::tangential_elements( - stream, this->parameters.nnodes_tangential_curve); - } catch (std::runtime_error &e) { - throw; - } - - try { - this->axial_nodes = specfem::mesh::elements::axial_elements( - stream, this->parameters.nelem_on_the_axis, this->nspec, mpi); - } catch (std::runtime_error &e) { - throw; - } - - // Check if database file was read completely - if (stream.get() && !stream.eof()) { - throw std::runtime_error("The Database file wasn't fully read. Is there " - "anything written after axial elements?"); - } - - stream.close(); - - // Print material properties - - mpi->cout("Material systems:\n" - "------------------------------"); - - mpi->cout("Number of material systems = " + - std::to_string(this->materials.n_materials) + "\n\n"); - - const auto l_elastic_isotropic = - this->materials.elastic_isotropic.material_properties; - const auto l_acoustic_isotropic = - this->materials.acoustic_isotropic.material_properties; - - for (const auto material : l_elastic_isotropic) { - mpi->cout(material.print()); - } - - for (const auto material : l_acoustic_isotropic) { - mpi->cout(material.print()); - } - - assert(l_elastic_isotropic.size() + l_acoustic_isotropic.size() == - this->materials.n_materials); - - this->tags = specfem::mesh::tags(this->materials, this->boundaries); - - return; -} - std::string specfem::mesh::mesh::print() const { int n_elastic; diff --git a/src/specfem2d.cpp b/src/specfem2d.cpp index c3ef04e6..e19ec5df 100644 --- a/src/specfem2d.cpp +++ b/src/specfem2d.cpp @@ -9,6 +9,12 @@ #include "source/interface.hpp" #include "specfem_mpi/interface.hpp" #include "IO/mesh/read_mesh.hpp" +#include "IO/mesh/fortran/read_material_properties.hpp" +#include "IO/mesh/fortran/read_interfaces.hpp" +#include "IO/mesh/fortran/read_boundaries.hpp" +#include "IO/mesh/fortran/read_elements.hpp" +#include "IO/mesh/fortran/read_mesh_database.hpp" +#include "IO/mesh/fortran/read_properties.hpp" #include "specfem_setup.hpp" #include "timescheme/timescheme.hpp" #include "yaml-cpp/yaml.h" @@ -98,7 +104,7 @@ void execute(const std::string ¶meter_file, const std::string &default_file, // Read mesh and materials // -------------------------------------------------------------- const auto quadrature = setup.instantiate_quadrature(); - const specfem::mesh::mesh specfem::IO::read_mesh(database_filename, mpi); + const specfem::mesh::mesh mesh = specfem::IO::read_mesh(database_filename, mpi); // -------------------------------------------------------------- // -------------------------------------------------------------- diff --git a/tests/unit-tests/mesh/mesh_tests.cpp b/tests/unit-tests/mesh/mesh_tests.cpp index 833074d2..225c09b0 100644 --- a/tests/unit-tests/mesh/mesh_tests.cpp +++ b/tests/unit-tests/mesh/mesh_tests.cpp @@ -1,6 +1,7 @@ #include "../Kokkos_Environment.hpp" #include "../MPI_environment.hpp" #include "mesh/mesh.hpp" +#include "IO/mesh/read_mesh.hpp" #include "yaml-cpp/yaml.h" #include #include @@ -96,7 +97,7 @@ TEST(MESH_TESTS, fortran_binary_reader) { for (auto test : tests) { std::cout << "Executing test: " << test.description << std::endl; try { - specfem::mesh::mesh mesh( + specfem::mesh::mesh mesh = specfem::IO::read_mesh( test.databases.filenames[test.configuration.processors - 1], mpi); std::cout << " - Test passed\n" << std::endl; } catch (std::runtime_error &e) { From 7dab67c5f474cb7b4ef1f21741489876f06d3a4d Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Tue, 19 Nov 2024 11:41:16 -0500 Subject: [PATCH 21/53] Fixed some compilation errors and found some new ones --- CMakeLists.txt | 25 ------------------------- include/IO/mesh/read_mesh.hpp | 20 ++++++++++++++++++++ include/policies/range.hpp | 4 +--- tests/unit-tests/mesh/mesh_tests.cpp | 2 +- 4 files changed, 22 insertions(+), 29 deletions(-) create mode 100644 include/IO/mesh/read_mesh.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e4aecae..9d2b1f40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -508,31 +508,6 @@ target_link_libraries( Boost::program_options ) -add_executable( - homo2d - examples/homogeneous-medium-flat-topography/homo2d.cpp -) - -target_link_libraries( - homo2d - specfem_mpi - Kokkos::kokkos - mesh - quadrature - compute - source_class - parameter_reader - receiver_class - writer - reader - domain - coupled_interface - kernels - solver - Boost::program_options - ${HDF5_LIBRARIES} -) - # Include tests if (BUILD_TESTS) message("-- Including tests.") diff --git a/include/IO/mesh/read_mesh.hpp b/include/IO/mesh/read_mesh.hpp new file mode 100644 index 00000000..e786bca1 --- /dev/null +++ b/include/IO/mesh/read_mesh.hpp @@ -0,0 +1,20 @@ +#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 + */ +specfem::mesh::mesh read_mesh(const std::string filename, + const specfem::MPI::MPI *mpi); + +} // namespace IO +} // namespace specfem diff --git a/include/policies/range.hpp b/include/policies/range.hpp index 0aaf6676..2cbaa0b7 100644 --- a/include/policies/range.hpp +++ b/include/policies/range.hpp @@ -6,9 +6,7 @@ namespace specfem { namespace iterator { - namespace impl { - /** * @brief Index type for the range iterator. * @@ -21,7 +19,7 @@ template struct range_index_type; * */ template <> struct range_index_type { - specfem::point::assembly_index index; ///< Assembly index + specfem::point::assembly_index index; ///< Assembly index KOKKOS_INLINE_FUNCTION range_index_type(const specfem::point::assembly_index index) diff --git a/tests/unit-tests/mesh/mesh_tests.cpp b/tests/unit-tests/mesh/mesh_tests.cpp index d6524ac5..584f34dc 100644 --- a/tests/unit-tests/mesh/mesh_tests.cpp +++ b/tests/unit-tests/mesh/mesh_tests.cpp @@ -100,7 +100,7 @@ TEST(MESH_TESTS, fortran_binary_reader) { << "-------------------------------------------------------\n\n" << std::endl; try { - specfem::mesh::mesh mesh( + specfem::IO::read_mesh( Test.databases.filenames[Test.configuration.processors - 1], mpi); std::cout << "--------------------------------------------------\n" << "\033[0;32m[PASSED]\033[0m Test name: " << Test.name << "\n" From a5d6d95a5be7e3ddecbc39899f613ef6d0ef0fa7 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Tue, 19 Nov 2024 14:11:58 -0500 Subject: [PATCH 22/53] Updated all the tests to adjust for the new way of reading --- CMakeLists.txt | 5 +++++ .../mesh/fortran/read_material_properties.cpp | 18 +++++++++--------- src/IO/mesh/read_mesh.cpp | 3 ++- .../algorithms/interpolate_function.cpp | 3 ++- tests/unit-tests/algorithms/locate.cpp | 3 ++- tests/unit-tests/assembly/test_fixture.hpp | 3 ++- .../acoustic/compute_properties_tests.cpp | 4 +++- .../coupled_interfaces_tests.cpp | 4 +++- .../elastic/compute_properties_tests.cpp | 4 +++- .../unit-tests/compute/index/compute_tests.cpp | 4 +++- .../compute_partial_derivatives_tests.cpp | 5 +++-- .../Newmark/acoustic/newmark_tests.cpp | 3 ++- .../Newmark/elastic/newmark_tests.cpp | 3 ++- .../Newmark/newmark_tests.cpp | 3 ++- .../domain/acoustic/rmass_inverse_tests.cpp | 3 ++- .../domain/elastic/rmass_inverse_tests.cpp | 3 ++- .../unit-tests/domain/rmass_inverse_tests.cpp | 3 ++- .../seismogram/acoustic/seismogram_tests.cpp | 3 ++- .../seismogram/elastic/seismogram_tests.cpp | 3 ++- .../source/source_location_tests.cpp | 4 +++- 20 files changed, 56 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d2b1f40..b7e05c99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,6 +137,11 @@ else() ) endif() +target_link_libraries( + IO + mesh +) + add_library( point src/point/coordinates.cpp diff --git a/src/IO/mesh/fortran/read_material_properties.cpp b/src/IO/mesh/fortran/read_material_properties.cpp index de48904c..18e5c9b9 100644 --- a/src/IO/mesh/fortran/read_material_properties.cpp +++ b/src/IO/mesh/fortran/read_material_properties.cpp @@ -1,12 +1,13 @@ #include "IO/mesh/fortran/read_material_properties.hpp" #include "IO/fortranio/interface.hpp" -#include "mesh/materials/materials.hpp" +// #include "mesh/materials/materials.hpp" +#include "mesh/materials/materials.tpp" #include "specfem_mpi/interface.hpp" #include "utilities/interface.hpp" #include #include -namespace { +// namespace { constexpr auto elastic = specfem::element::medium_tag::elastic; constexpr auto isotropic = specfem::element::property_tag::isotropic; constexpr auto acoustic = specfem::element::medium_tag::acoustic; @@ -172,7 +173,7 @@ void read_material_indices( return; } -} // namespace +// } // namespace specfem::mesh::materials specfem::IO::mesh::fortran::read_material_properties( std::ifstream &stream, const int numat, const int nspec, @@ -180,16 +181,15 @@ specfem::mesh::materials specfem::IO::mesh::fortran::read_material_properties( const specfem::MPI::MPI *mpi) { // Create materials instances - specfem::mesh::materials materials(nspec, numat); + specfem::mesh::materials material(nspec, numat); // Read material properties - auto index_mapping = - read_materials(stream, numat, materials.elastic_isotropic, - materials.acoustic_isotropic, mpi); + auto index_mapping = read_materials(stream, numat, material.elastic_isotropic, + material.acoustic_isotropic, mpi); // Read material indices read_material_indices(stream, nspec, numat, index_mapping, - materials.material_index_mapping, knods, mpi); + material.material_index_mapping, knods, mpi); - return materials; + return material; } diff --git a/src/IO/mesh/read_mesh.cpp b/src/IO/mesh/read_mesh.cpp index f25c3a22..6b90426e 100644 --- a/src/IO/mesh/read_mesh.cpp +++ b/src/IO/mesh/read_mesh.cpp @@ -10,6 +10,7 @@ #include "kokkos_abstractions.h" #include "material/material.hpp" #include "mesh/mesh.hpp" +#include "mesh/tags/tags.hpp" #include "specfem_mpi/interface.hpp" #include "specfem_setup.hpp" #include @@ -200,7 +201,7 @@ specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, assert(l_elastic_isotropic.size() + l_acoustic_isotropic.size() == materials.n_materials); - auto tags = specfem::mesh::tags(materials, boundaries); + specfem::mesh::tags tags(materials, boundaries); return specfem::mesh::mesh(npgeo, nspec, nproc, control_nodes, parameters, coupled_interfaces, boundaries, tags, diff --git a/tests/unit-tests/algorithms/interpolate_function.cpp b/tests/unit-tests/algorithms/interpolate_function.cpp index 1dc05c3b..fd31d00a 100644 --- a/tests/unit-tests/algorithms/interpolate_function.cpp +++ b/tests/unit-tests/algorithms/interpolate_function.cpp @@ -1,3 +1,4 @@ +#include "IO/mesh/read_mesh.hpp" #include "Kokkos_Environment.hpp" #include "MPI_environment.hpp" #include "algorithms/interpolate.hpp" @@ -20,7 +21,7 @@ TEST(ALGORITHMS, interpolate_function) { // Read Mesh database specfem::MPI::MPI *mpi = MPIEnvironment::get_mpi(); - specfem::mesh::mesh mesh(database_file, mpi); + specfem::mesh::mesh mesh = specfem::IO::read_mesh(database_file, mpi); constexpr int N = 5; diff --git a/tests/unit-tests/algorithms/locate.cpp b/tests/unit-tests/algorithms/locate.cpp index 07d68d59..c1b6eebd 100644 --- a/tests/unit-tests/algorithms/locate.cpp +++ b/tests/unit-tests/algorithms/locate.cpp @@ -1,3 +1,4 @@ +#include "IO/mesh/read_mesh.hpp" #include "Kokkos_Environment.hpp" #include "MPI_environment.hpp" #include "algorithms/locate_point.hpp" @@ -13,7 +14,7 @@ TEST(ALGORITHMS, locate_point) { // Read Mesh database specfem::MPI::MPI *mpi = MPIEnvironment::get_mpi(); - specfem::mesh::mesh mesh(database_file, mpi); + specfem::mesh::mesh mesh = specfem::IO::read_mesh(database_file, mpi); // Quadratures specfem::quadrature::gll::gll gll(0.0, 0.0, 5); diff --git a/tests/unit-tests/assembly/test_fixture.hpp b/tests/unit-tests/assembly/test_fixture.hpp index 0fac266a..75d0e59a 100644 --- a/tests/unit-tests/assembly/test_fixture.hpp +++ b/tests/unit-tests/assembly/test_fixture.hpp @@ -1,6 +1,7 @@ #pragma once #include "../MPI_environment.hpp" +#include "IO/mesh/read_mesh.hpp" #include "compute/assembly/assembly.hpp" #include "enumerations/specfem_enums.hpp" #include "mesh/mesh.hpp" @@ -145,7 +146,7 @@ class ASSEMBLY : public ::testing::Test { for (auto &Test : Tests) { const auto [database_file, sources_file, stations_file] = Test.get_databases(); - specfem::mesh::mesh mesh(database_file, mpi); + specfem::mesh::mesh mesh = specfem::IO::read_mesh(database_file, mpi); const auto [sources, t0] = specfem::sources::read_sources( sources_file, 0, 0, 0, specfem::simulation::type::forward); diff --git a/tests/unit-tests/compute/acoustic/compute_properties_tests.cpp b/tests/unit-tests/compute/acoustic/compute_properties_tests.cpp index 2d0003c7..b462c901 100644 --- a/tests/unit-tests/compute/acoustic/compute_properties_tests.cpp +++ b/tests/unit-tests/compute/acoustic/compute_properties_tests.cpp @@ -1,6 +1,7 @@ #include "../../Kokkos_Environment.hpp" #include "../../MPI_environment.hpp" #include "../../utilities/include/interface.hpp" +#include "IO/mesh/read_mesh.hpp" #include "compute/interface.hpp" #include "material/interface.hpp" #include "mesh/mesh.hpp" @@ -121,7 +122,8 @@ TEST(COMPUTE_TESTS, compute_acoustic_properties) { specfem::quadrature::gll::gll gll(0.0, 0.0, 5); specfem::quadrature::quadratures quadratures(gll); - specfem::mesh::mesh mesh(test_config.database_filename, mpi); + specfem::mesh::mesh mesh = + specfem::IO::read_mesh(test_config.database_filename, mpi); const int nspec = mesh.nspec; const int ngllz = gll.get_N(); 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 54b784c8..f982a75e 100644 --- a/tests/unit-tests/compute/coupled_interfaces/coupled_interfaces_tests.cpp +++ b/tests/unit-tests/compute/coupled_interfaces/coupled_interfaces_tests.cpp @@ -1,6 +1,7 @@ #include "../../Kokkos_Environment.hpp" #include "../../MPI_environment.hpp" #include "../../utilities/include/interface.hpp" +#include "IO/mesh/read_mesh.hpp" #include "compute/interface.hpp" #include "edge/interface.hpp" #include "material/interface.hpp" @@ -177,7 +178,8 @@ TEST(COMPUTE_TESTS, coupled_interfaces_tests) { std::cout << "Executing test: " << Test.name << std::endl; // Read mesh generated MESHFEM - specfem::mesh::mesh mesh(Test.databases.mesh.database_filename, mpi); + specfem::mesh::mesh mesh = + specfem::IO::read_mesh(Test.databases.mesh.database_filename, mpi); // Generate compute structs to be used by the solver specfem::compute::mesh assembly(mesh.control_nodes, quadratures); diff --git a/tests/unit-tests/compute/elastic/compute_properties_tests.cpp b/tests/unit-tests/compute/elastic/compute_properties_tests.cpp index 5b6626d0..ac7b9a30 100644 --- a/tests/unit-tests/compute/elastic/compute_properties_tests.cpp +++ b/tests/unit-tests/compute/elastic/compute_properties_tests.cpp @@ -1,6 +1,7 @@ #include "../../Kokkos_Environment.hpp" #include "../../MPI_environment.hpp" #include "../../utilities/include/interface.hpp" +#include "IO/mesh/read_mesh.hpp" #include "compute/interface.hpp" #include "mesh/mesh.hpp" #include "quadrature/interface.hpp" @@ -75,7 +76,8 @@ TEST(COMPUTE_TESTS, compute_elastic_properties) { specfem::quadrature::gll::gll gll(0.0, 0.0, 5); specfem::quadrature::quadratures quadratures(gll); - specfem::mesh::mesh mesh(test_config.database_filename, mpi); + specfem::mesh::mesh mesh = + specfem::IO::read_mesh(test_config.database_filename, mpi); std::cout << mesh.print() << std::endl; diff --git a/tests/unit-tests/compute/index/compute_tests.cpp b/tests/unit-tests/compute/index/compute_tests.cpp index 860763b6..0b0ff4a3 100644 --- a/tests/unit-tests/compute/index/compute_tests.cpp +++ b/tests/unit-tests/compute/index/compute_tests.cpp @@ -1,6 +1,7 @@ #include "../../Kokkos_Environment.hpp" #include "../../MPI_environment.hpp" #include "../../utilities/include/interface.hpp" +#include "IO/mesh/read_mesh.hpp" #include "compute/interface.hpp" #include "mesh/mesh.hpp" #include "quadrature/interface.hpp" @@ -80,7 +81,8 @@ TEST(COMPUTE_TESTS, compute_ibool) { specfem::quadrature::quadratures quadratures(gll); // Read mesh generated MESHFEM - specfem::mesh::mesh mesh(test_config.database_filename, mpi); + specfem::mesh::mesh mesh = + specfem::IO::read_mesh(test_config.database_filename, mpi); // Setup compute structs specfem::compute::mesh assembly(mesh.tags, mesh.control_nodes, 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 2928e05c..c116e513 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,8 +1,8 @@ #include "../../Kokkos_Environment.hpp" #include "../../MPI_environment.hpp" #include "../../utilities/include/interface.hpp" +#include "IO/mesh/read_mesh.hpp" #include "compute/interface.hpp" -#include "mesh/mesh.hpp" #include "quadrature/interface.hpp" #include "yaml-cpp/yaml.h" #include @@ -74,7 +74,8 @@ TEST(COMPUTE_TESTS, compute_partial_derivatives) { specfem::quadrature::gll::gll gll(0.0, 0.0, 5); specfem::quadrature::quadratures quadratures(gll); - specfem::mesh::mesh mesh(test_config.database_filename, mpi); + specfem::mesh::mesh mesh = + specfem::IO::read_mesh(test_config.database_filename, mpi); specfem::compute::mesh compute_mesh(mesh.tags, mesh.control_nodes, quadratures); 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 9bcb2384..96c1fded 100644 --- a/tests/unit-tests/displacement_tests/Newmark/acoustic/newmark_tests.cpp +++ b/tests/unit-tests/displacement_tests/Newmark/acoustic/newmark_tests.cpp @@ -1,6 +1,7 @@ #include "../../../Kokkos_Environment.hpp" #include "../../../MPI_environment.hpp" #include "../../../utilities/include/compare_array.h" +#include "IO/mesh/read_mesh.hpp" #include "compute/interface.hpp" #include "constants.hpp" #include "domain/interface.hpp" @@ -62,7 +63,7 @@ TEST(DISPLACEMENT_TESTS, newmark_scheme_tests) { // Read mesh generated MESHFEM std::vector materials; - specfem::mesh::mesh mesh(database_file, materials, mpi); + specfem::mesh::mesh mesh = specfem::IO::read_mesh(database_file, mpi); // Read sources // if start time is not explicitly specified then t0 is determined using 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 0753c5ae..86cacc7c 100644 --- a/tests/unit-tests/displacement_tests/Newmark/elastic/newmark_tests.cpp +++ b/tests/unit-tests/displacement_tests/Newmark/elastic/newmark_tests.cpp @@ -1,6 +1,7 @@ #include "../../../Kokkos_Environment.hpp" #include "../../../MPI_environment.hpp" #include "../../../utilities/include/compare_array.h" +#include "IO/mesh/read_mesh.hpp" #include "compute/interface.hpp" #include "constants.hpp" #include "domain/interface.hpp" @@ -62,7 +63,7 @@ TEST(DISPLACEMENT_TESTS, newmark_scheme_tests) { // Read mesh generated MESHFEM std::vector materials; - specfem::mesh::mesh mesh(database_file, materials, mpi); + specfem::mesh::mesh mesh = specfem::IO::read_mesh(database_file, mpi); // Read sources // if start time is not explicitly specified then t0 is determined using diff --git a/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp b/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp index 92e1958f..97d0defd 100644 --- a/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp +++ b/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp @@ -1,6 +1,7 @@ #include "../../Kokkos_Environment.hpp" #include "../../MPI_environment.hpp" #include "../../utilities/include/interface.hpp" +#include "IO/mesh/read_mesh.hpp" #include "compute/interface.hpp" #include "constants.hpp" #include "domain/domain.hpp" @@ -174,7 +175,7 @@ TEST(DISPLACEMENT_TESTS, newmark_scheme_tests) { const auto quadratures = setup.instantiate_quadrature(); // Read mesh generated MESHFEM - specfem::mesh::mesh mesh(database_file, mpi); + specfem::mesh::mesh mesh = specfem::IO::read_mesh(database_file, mpi); const type_real dt = setup.get_dt(); const int nsteps = setup.get_nsteps(); diff --git a/tests/unit-tests/domain/acoustic/rmass_inverse_tests.cpp b/tests/unit-tests/domain/acoustic/rmass_inverse_tests.cpp index 1a069803..0b6daabc 100644 --- a/tests/unit-tests/domain/acoustic/rmass_inverse_tests.cpp +++ b/tests/unit-tests/domain/acoustic/rmass_inverse_tests.cpp @@ -1,6 +1,7 @@ #include "../../Kokkos_Environment.hpp" #include "../../MPI_environment.hpp" #include "../../utilities/include/compare_array.h" +#include "IO/mesh/read_mesh.hpp" #include "compute/interface.hpp" #include "constants.hpp" #include "domain/interface.hpp" @@ -59,7 +60,7 @@ TEST(DOMAIN_TESTS, rmass_inverse_elastic_test) { // Read mesh generated MESHFEM std::vector materials; - specfem::mesh::mesh mesh(database_file, materials, mpi); + specfem::mesh::mesh mesh = specfem::IO::read_mesh(database_file, mpi); // Read sources // if start time is not explicitly specified then t0 is determined using diff --git a/tests/unit-tests/domain/elastic/rmass_inverse_tests.cpp b/tests/unit-tests/domain/elastic/rmass_inverse_tests.cpp index 60f3eeb1..7e02459e 100644 --- a/tests/unit-tests/domain/elastic/rmass_inverse_tests.cpp +++ b/tests/unit-tests/domain/elastic/rmass_inverse_tests.cpp @@ -1,6 +1,7 @@ #include "../../Kokkos_Environment.hpp" #include "../../MPI_environment.hpp" #include "../../utilities/include/compare_array.h" +#include "IO/mesh/read_mesh.hpp" #include "compute/interface.hpp" #include "constants.hpp" #include "domain/interface.hpp" @@ -59,7 +60,7 @@ TEST(DOMAIN_TESTS, rmass_inverse_elastic_test) { // Read mesh generated MESHFEM std::vector materials; - specfem::mesh::mesh mesh(database_file, materials, mpi); + specfem::mesh::mesh mesh = specfem::IO::read_mesh(database_file, mpi); // Read sources // if start time is not explicitly specified then t0 is determined using diff --git a/tests/unit-tests/domain/rmass_inverse_tests.cpp b/tests/unit-tests/domain/rmass_inverse_tests.cpp index 35e1e698..d903aca0 100644 --- a/tests/unit-tests/domain/rmass_inverse_tests.cpp +++ b/tests/unit-tests/domain/rmass_inverse_tests.cpp @@ -1,6 +1,7 @@ #include "../Kokkos_Environment.hpp" #include "../MPI_environment.hpp" #include "../utilities/include/interface.hpp" +#include "IO/mesh/read_mesh.hpp" #include "compute/interface.hpp" #include "constants.hpp" #include "domain/domain.hpp" @@ -116,7 +117,7 @@ TEST(DOMAIN_TESTS, rmass_inverse) { std::cout << "Reading mesh file: " << database_file << std::endl; // Read mesh generated MESHFEM - specfem::mesh::mesh mesh(database_file, mpi); + specfem::mesh::mesh mesh = specfem::IO::read_mesh(database_file, mpi); std::cout << "Setting up sources and receivers" << std::endl; diff --git a/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp b/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp index f4d66364..6cd5fafa 100644 --- a/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp +++ b/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp @@ -2,6 +2,7 @@ #include "../../MPI_environment.hpp" // #include "../../utilities/include/compare_array.h" #include "IO/fortranio/interface.hpp" +#include "IO/mesh/read_mesh.hpp" #include "compute/interface.hpp" #include "constants.hpp" #include "domain/domain.hpp" @@ -90,7 +91,7 @@ TEST(SEISMOGRAM_TESTS, acoustic_seismograms_test) { const auto quadratures = setup.instantiate_quadrature(); // Read mesh generated MESHFEM - specfem::mesh::mesh mesh(database_file, mpi); + specfem::mesh::mesh mesh = specfem::IO::read_mesh(database_file, mpi); std::vector > sources(0); diff --git a/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp b/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp index 5b4fe756..afe5f20c 100644 --- a/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp +++ b/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp @@ -2,6 +2,7 @@ #include "../../MPI_environment.hpp" // #include "../../utilities/include/compare_array.h" #include "IO/fortranio/interface.hpp" +#include "IO/mesh/read_mesh.hpp" #include "compute/interface.hpp" #include "constants.hpp" #include "domain/domain.hpp" @@ -90,7 +91,7 @@ TEST(SEISMOGRAM_TESTS, elastic_seismograms_test) { const auto quadratures = setup.instantiate_quadrature(); // Read mesh generated MESHFEM - specfem::mesh::mesh mesh(database_file, mpi); + specfem::mesh::mesh mesh = specfem::IO::read_mesh(database_file, mpi); std::vector > sources(0); diff --git a/tests/unit-tests/source/source_location_tests.cpp b/tests/unit-tests/source/source_location_tests.cpp index a3a680bb..7b03955b 100644 --- a/tests/unit-tests/source/source_location_tests.cpp +++ b/tests/unit-tests/source/source_location_tests.cpp @@ -1,5 +1,6 @@ #include "../Kokkos_Environment.hpp" #include "../MPI_environment.hpp" +#include "IO/mesh/read_mesh.hpp" #include "compute/interface.hpp" #include "material/interface.hpp" #include "mesh/mesh.hpp" @@ -161,7 +162,8 @@ TEST(SOURCE_LOCATION_TESTS, compute_source_locations) { // Read mesh for binary database for the test std::vector > materials; - specfem::mesh::mesh mesh(test_config.database_file, materials, mpi); + specfem::mesh::mesh mesh = + specfem::IO::read_mesh(test_config.database_file, mpi); // read sources file auto [sources, t0] = From be8e7b5b1510da077792818c2ee0bb600f8d1b18 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Tue, 19 Nov 2024 15:29:57 -0500 Subject: [PATCH 23/53] Small fixes --- .../mesh/fortran/read_material_properties.cpp | 13 +++++----- .../coupled_interfaces/coupled_interfaces.cpp | 24 +++++++++---------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/IO/mesh/fortran/read_material_properties.cpp b/src/IO/mesh/fortran/read_material_properties.cpp index 18e5c9b9..208ec537 100644 --- a/src/IO/mesh/fortran/read_material_properties.cpp +++ b/src/IO/mesh/fortran/read_material_properties.cpp @@ -7,7 +7,7 @@ #include #include -// namespace { +namespace { constexpr auto elastic = specfem::element::medium_tag::elastic; constexpr auto isotropic = specfem::element::property_tag::isotropic; constexpr auto acoustic = specfem::element::medium_tag::acoustic; @@ -173,7 +173,7 @@ void read_material_indices( return; } -// } // namespace +} // namespace specfem::mesh::materials specfem::IO::mesh::fortran::read_material_properties( std::ifstream &stream, const int numat, const int nspec, @@ -184,12 +184,13 @@ specfem::mesh::materials specfem::IO::mesh::fortran::read_material_properties( specfem::mesh::materials material(nspec, numat); // Read material properties - auto index_mapping = read_materials(stream, numat, material.elastic_isotropic, - material.acoustic_isotropic, mpi); + auto index_mapping = + ::read_materials(stream, numat, material.elastic_isotropic, + material.acoustic_isotropic, mpi); // Read material indices - read_material_indices(stream, nspec, numat, index_mapping, - material.material_index_mapping, knods, mpi); + ::read_material_indices(stream, nspec, numat, index_mapping, + material.material_index_mapping, knods, mpi); return material; } diff --git a/src/mesh/coupled_interfaces/coupled_interfaces.cpp b/src/mesh/coupled_interfaces/coupled_interfaces.cpp index dfe30ea5..865ef05d 100644 --- a/src/mesh/coupled_interfaces/coupled_interfaces.cpp +++ b/src/mesh/coupled_interfaces/coupled_interfaces.cpp @@ -2,18 +2,18 @@ #include "mesh/coupled_interfaces/interface_container.hpp" #include "mesh/coupled_interfaces/interface_container.tpp" -specfem::mesh::coupled_interfaces coupled_interfaces( - specfem::mesh::interface_container - elastic_acoustic, - specfem::mesh::interface_container< - specfem::element::medium_tag::acoustic, - specfem::element::medium_tag::poroelastic> - acoustic_poroelastic, - specfem::mesh::interface_container< - specfem::element::medium_tag::elastic, - specfem::element::medium_tag::poroelastic> - elastic_poroelastic) {} +// specfem::mesh::coupled_interfaces::coupled_interfaces( +// specfem::mesh::interface_container +// elastic_acoustic, +// specfem::mesh::interface_container< +// specfem::element::medium_tag::acoustic, +// specfem::element::medium_tag::poroelastic> +// acoustic_poroelastic, +// specfem::mesh::interface_container< +// specfem::element::medium_tag::elastic, +// specfem::element::medium_tag::poroelastic> +// elastic_poroelastic) {} template From 305c46bc1bda2f3c2d928008ea13a433154d99bf Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Wed, 20 Nov 2024 09:49:58 -0500 Subject: [PATCH 24/53] Changed everything to populate an empty meshobject... --- src/IO/mesh/read_mesh.cpp | 86 ++++++++++++++-------------- tests/unit-tests/mesh/mesh_tests.cpp | 55 ++++++++++++++++++ 2 files changed, 99 insertions(+), 42 deletions(-) diff --git a/src/IO/mesh/read_mesh.cpp b/src/IO/mesh/read_mesh.cpp index 6b90426e..83ad647f 100644 --- a/src/IO/mesh/read_mesh.cpp +++ b/src/IO/mesh/read_mesh.cpp @@ -17,59 +17,62 @@ #include #include #include +#include #include specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, const specfem::MPI::MPI *mpi) { + // Declaring empty mesh objects + specfem::mesh::mesh mesh; + + // Open the database file std::ifstream stream; stream.open(filename); - int nspec, npgeo, nproc; - - specfem::mesh::control_nodes control_nodes; - specfem::mesh::properties parameters; - specfem::mesh::materials materials; - specfem::mesh::boundaries boundaries; - specfem::mesh::elements::axial_elements axial_nodes; - specfem::mesh::elements::tangential_elements tangential_nodes; - specfem::mesh::coupled_interfaces coupled_interfaces; if (!stream.is_open()) { throw std::runtime_error("Could not open database file"); } + int nspec, npgeo, nproc; try { - auto [nspec, npgeo, nproc] = + std::tie(nspec, npgeo, nproc) = specfem::IO::mesh::fortran::read_mesh_database_header(stream, mpi); + mesh.nspec = nspec; + mesh.npgeo = npgeo; + mesh.nproc = nproc; } catch (std::runtime_error &e) { throw; } + std::cout << "nspec = " << mesh.nspec << std::endl; + std::cout << "npgeo = " << mesh.npgeo << std::endl; + std::cout << "nproc = " << mesh.nproc << std::endl; + // Mesh class to be populated from the database file. try { - - control_nodes.coord = + mesh.control_nodes.coord = specfem::IO::mesh::fortran::read_coorg_elements(stream, npgeo, mpi); } catch (std::runtime_error &e) { throw; } try { - auto parameters = specfem::IO::mesh::fortran::read_properties(stream, mpi); + mesh.parameters = specfem::IO::mesh::fortran::read_properties(stream, mpi); } catch (std::runtime_error &e) { throw; } - control_nodes.ngnod = parameters.ngnod; - control_nodes.nspec = nspec; - control_nodes.knods = specfem::kokkos::HostView2d( - "specfem::mesh::knods", parameters.ngnod, nspec); + mesh.control_nodes.ngnod = mesh.parameters.ngnod; + mesh.control_nodes.nspec = mesh.nspec; + mesh.control_nodes.knods = specfem::kokkos::HostView2d( + "specfem::mesh::knods", mesh.parameters.ngnod, mesh.nspec); - int nspec_all = mpi->reduce(parameters.nspec, specfem::MPI::sum); + int nspec_all = mpi->reduce(mesh.parameters.nspec, specfem::MPI::sum); int nelem_acforcing_all = - mpi->reduce(parameters.nelem_acforcing, specfem::MPI::sum); + mpi->reduce(mesh.parameters.nelem_acforcing, specfem::MPI::sum); int nelem_acoustic_surface_all = - mpi->reduce(parameters.nelem_acoustic_surface, specfem::MPI::sum); + mpi->reduce(mesh.parameters.nelem_acoustic_surface, specfem::MPI::sum); try { auto [n_sls, attenuation_f0_reference, read_velocities_at_f0] = @@ -79,8 +82,9 @@ specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, } try { - auto materials = specfem::IO::mesh::fortran::read_material_properties( - stream, nspec, parameters.numat, control_nodes.knods, mpi); + mesh.materials = specfem::IO::mesh::fortran::read_material_properties( + stream, mesh.nspec, mesh.parameters.numat, mesh.control_nodes.knods, + mpi); } catch (std::runtime_error &e) { throw; } @@ -112,10 +116,10 @@ specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, specfem::IO::fortran_read_line(stream, &ninterfaces, &max_interface_size); try { - auto boundaries = specfem::IO::mesh::fortran::read_boundaries( - stream, parameters.nspec, parameters.nelemabs, - parameters.nelem_acoustic_surface, parameters.nelem_acforcing, - control_nodes.knods, mpi); + mesh.boundaries = specfem::IO::mesh::fortran::read_boundaries( + stream, mesh.parameters.nspec, mesh.parameters.nelemabs, + mesh.parameters.nelem_acoustic_surface, mesh.parameters.nelem_acforcing, + mesh.control_nodes.knods, mpi); } catch (std::runtime_error &e) { throw; } @@ -145,26 +149,26 @@ specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, // } try { - auto coupled_interfaces = + mesh.coupled_interfaces = specfem::IO::mesh::fortran::read_coupled_interfaces( - stream, parameters.num_fluid_solid_edges, - parameters.num_fluid_poro_edges, parameters.num_solid_poro_edges, - mpi); + stream, mesh.parameters.num_fluid_solid_edges, + mesh.parameters.num_fluid_poro_edges, + mesh.parameters.num_solid_poro_edges, mpi); } catch (std::runtime_error &e) { throw; } try { - auto tangential_nodes = + mesh.tangential_nodes = specfem::IO::mesh::fortran::read_tangential_elements( - stream, parameters.nnodes_tangential_curve); + stream, mesh.parameters.nnodes_tangential_curve); } catch (std::runtime_error &e) { throw; } try { - auto axial_nodes = specfem::IO::mesh::fortran::read_axial_elements( - stream, parameters.nelem_on_the_axis, nspec, mpi); + mesh.axial_nodes = specfem::IO::mesh::fortran::read_axial_elements( + stream, mesh.parameters.nelem_on_the_axis, mesh.nspec, mpi); } catch (std::runtime_error &e) { throw; } @@ -183,12 +187,12 @@ specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, "------------------------------"); mpi->cout("Number of material systems = " + - std::to_string(materials.n_materials) + "\n\n"); + std::to_string(mesh.materials.n_materials) + "\n\n"); const auto l_elastic_isotropic = - materials.elastic_isotropic.material_properties; + mesh.materials.elastic_isotropic.material_properties; const auto l_acoustic_isotropic = - materials.acoustic_isotropic.material_properties; + mesh.materials.acoustic_isotropic.material_properties; for (const auto material : l_elastic_isotropic) { mpi->cout(material.print()); @@ -199,11 +203,9 @@ specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, } assert(l_elastic_isotropic.size() + l_acoustic_isotropic.size() == - materials.n_materials); + mesh.materials.n_materials); - specfem::mesh::tags tags(materials, boundaries); + specfem::mesh::tags tags(mesh.materials, mesh.boundaries); - return specfem::mesh::mesh(npgeo, nspec, nproc, control_nodes, parameters, - coupled_interfaces, boundaries, tags, - tangential_nodes, axial_nodes, materials); + return mesh; } diff --git a/tests/unit-tests/mesh/mesh_tests.cpp b/tests/unit-tests/mesh/mesh_tests.cpp index 584f34dc..cfa68335 100644 --- a/tests/unit-tests/mesh/mesh_tests.cpp +++ b/tests/unit-tests/mesh/mesh_tests.cpp @@ -1,5 +1,6 @@ #include "../Kokkos_Environment.hpp" #include "../MPI_environment.hpp" +#include "IO/mesh/fortran/read_mesh_database.hpp" #include "IO/mesh/read_mesh.hpp" #include "mesh/mesh.hpp" #include "yaml-cpp/yaml.h" @@ -79,6 +80,60 @@ void parse_test_config(const YAML::Node &yaml, // --------------------------------------------------------------------------- +/** + * + * Check if we can read fortran binary files correctly. TEST one just reading + * the header + * + * This test should be run on single and multiple nodes + * + */ +TEST(MESH_TESTS, fortran_binary_reader_header) { + + specfem::MPI::MPI *mpi = MPIEnvironment::get_mpi(); + std::string config_filename = + "../../../tests/unit-tests/mesh/test_config.yaml"; + std::vector Tests; + parse_test_config(YAML::LoadFile(config_filename), Tests); + int nspec, npgeo, nproc; + + for (auto Test : Tests) { + std::cout << "-------------------------------------------------------\n" + << "\033[0;32m[RUNNING]\033[0m Test: " << Test.name << "\n" + << "-------------------------------------------------------\n\n" + << std::endl; + try { + + std::ifstream stream; + stream.open(Test.databases.filenames[Test.configuration.processors - 1]); + + auto [nspec, npgeo, nproc] = + specfem::IO::mesh::fortran::read_mesh_database_header(stream, mpi); + stream.close(); + std::cout << "nspec = " << nspec << std::endl; + std::cout << "npgeo = " << npgeo << std::endl; + std::cout << "nproc = " << nproc << std::endl; + + std::cout << "--------------------------------------------------\n" + << "\033[0;32m[PASSED]\033[0m Test name: " << Test.name << "\n" + << "--------------------------------------------------\n\n" + << std::endl; + } catch (std::runtime_error &e) { + std::cout << " - Error: " << e.what() << std::endl; + FAIL() << "--------------------------------------------------\n" + << "\033[0;31m[FAILED]\033[0m Test failed\n" + << " - Test name: " << Test.name << "\n" + << " - Error: " << e.what() << "\n" + << "--------------------------------------------------\n\n" + << std::endl; + } + } + SUCCEED(); + return; +} + +// --------------------------------------------------------------------------- + /** * * Check if we can read fortran binary files correctly. From 72a8f2b1909105f855cc851cd678154463e62c3d Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Wed, 20 Nov 2024 11:42:11 -0500 Subject: [PATCH 25/53] Fixed tag assigment and a swap of input argumentsin the read_material_properties call --- src/IO/mesh/fortran/read_material_properties.cpp | 10 +++++----- src/IO/mesh/read_mesh.cpp | 12 ++++-------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/IO/mesh/fortran/read_material_properties.cpp b/src/IO/mesh/fortran/read_material_properties.cpp index 208ec537..175e398f 100644 --- a/src/IO/mesh/fortran/read_material_properties.cpp +++ b/src/IO/mesh/fortran/read_material_properties.cpp @@ -181,16 +181,16 @@ specfem::mesh::materials specfem::IO::mesh::fortran::read_material_properties( const specfem::MPI::MPI *mpi) { // Create materials instances - specfem::mesh::materials material(nspec, numat); + specfem::mesh::materials materials(nspec, numat); // Read material properties auto index_mapping = - ::read_materials(stream, numat, material.elastic_isotropic, - material.acoustic_isotropic, mpi); + ::read_materials(stream, numat, materials.elastic_isotropic, + materials.acoustic_isotropic, mpi); // Read material indices ::read_material_indices(stream, nspec, numat, index_mapping, - material.material_index_mapping, knods, mpi); + materials.material_index_mapping, knods, mpi); - return material; + return materials; } diff --git a/src/IO/mesh/read_mesh.cpp b/src/IO/mesh/read_mesh.cpp index 83ad647f..64be6559 100644 --- a/src/IO/mesh/read_mesh.cpp +++ b/src/IO/mesh/read_mesh.cpp @@ -45,14 +45,10 @@ specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, throw; } - std::cout << "nspec = " << mesh.nspec << std::endl; - std::cout << "npgeo = " << mesh.npgeo << std::endl; - std::cout << "nproc = " << mesh.nproc << std::endl; - // Mesh class to be populated from the database file. try { - mesh.control_nodes.coord = - specfem::IO::mesh::fortran::read_coorg_elements(stream, npgeo, mpi); + mesh.control_nodes.coord = specfem::IO::mesh::fortran::read_coorg_elements( + stream, mesh.npgeo, mpi); } catch (std::runtime_error &e) { throw; } @@ -83,7 +79,7 @@ specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, try { mesh.materials = specfem::IO::mesh::fortran::read_material_properties( - stream, mesh.nspec, mesh.parameters.numat, mesh.control_nodes.knods, + stream, mesh.parameters.numat, mesh.nspec, mesh.control_nodes.knods, mpi); } catch (std::runtime_error &e) { throw; @@ -205,7 +201,7 @@ specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, assert(l_elastic_isotropic.size() + l_acoustic_isotropic.size() == mesh.materials.n_materials); - specfem::mesh::tags tags(mesh.materials, mesh.boundaries); + mesh.tags = specfem::mesh::tags(mesh.materials, mesh.boundaries); return mesh; } From e44210b4c4e584ffe350b9f2514382a775352e80 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Wed, 20 Nov 2024 12:55:47 -0500 Subject: [PATCH 26/53] Added IO/Libraries to docs. --- docs/api/IO/Libraries/index.rst | 1 + docs/api/IO/Libraries/mesh/index.rst | 32 +++++++++++++++++++ docs/api/index.rst | 1 + .../tutorials/tutorial1/Chapter1/index.rst | 4 +-- include/IO/mesh/fortran/read_interfaces.hpp | 9 ++++++ .../IO/mesh/fortran/read_mesh_database.hpp | 3 +- include/IO/mesh/fortran/read_properties.hpp | 2 +- include/IO/mesh/read_mesh.hpp | 1 + 8 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 docs/api/IO/Libraries/mesh/index.rst diff --git a/docs/api/IO/Libraries/index.rst b/docs/api/IO/Libraries/index.rst index 4ec1b5a3..887b2f8f 100644 --- a/docs/api/IO/Libraries/index.rst +++ b/docs/api/IO/Libraries/index.rst @@ -39,5 +39,6 @@ The snippet below shows how to use these modules to write and read a Kokkos::Vie .. toctree:: :maxdepth: 1 + mesh/index ASCII/index HDF5/index diff --git a/docs/api/IO/Libraries/mesh/index.rst b/docs/api/IO/Libraries/mesh/index.rst new file mode 100644 index 00000000..dad9196d --- /dev/null +++ b/docs/api/IO/Libraries/mesh/index.rst @@ -0,0 +1,32 @@ +.. _mesh_reader: + +Mesh Reader +=========== + +.. doxygenfunction:: specfem::IO::read_mesh + + +The above function reads the fortran binary mesh database and the following +functions are called in the order of appearance in the code: + + +.. doxygenfunction:: specfem::IO::mesh::fortran::read_mesh_database_header + +.. doxygenfunction:: specfem::IO::mesh::fortran::read_coorg_elements + +.. doxygenfunction:: specfem::IO::mesh::fortran::read_properties + +.. doxygenfunction:: specfem::IO::mesh::fortran::read_mesh_database_attenuation + +.. doxygenfunction:: specfem::IO::mesh::fortran::read_material_properties + +.. doxygenfunction:: specfem::IO::mesh::fortran::read_boundaries + +.. doxygenfunction:: specfem::IO::mesh::fortran::read_coupled_interfaces + +.. doxygenfunction:: specfem::IO::mesh::fortran::read_tangential_elements + +.. doxygenfunction:: specfem::IO::mesh::fortran::read_axial_elements + +.. doxygenclass:: specfem::mesh::tags + :members: diff --git a/docs/api/index.rst b/docs/api/index.rst index 3704a2fb..b31fdad6 100644 --- a/docs/api/index.rst +++ b/docs/api/index.rst @@ -16,6 +16,7 @@ API documentation datatypes/index assembly/index policies/index + IO/index operators/index compute_kernels/index coupling_physics/coupled_interface diff --git a/docs/developer_documentation/tutorials/tutorial1/Chapter1/index.rst b/docs/developer_documentation/tutorials/tutorial1/Chapter1/index.rst index 4ed9ec50..e3236b6e 100644 --- a/docs/developer_documentation/tutorials/tutorial1/Chapter1/index.rst +++ b/docs/developer_documentation/tutorials/tutorial1/Chapter1/index.rst @@ -2,7 +2,7 @@ .. _Chapter1: Chapter 1: Generating the mesh, sources and receivers -==================================================== +===================================================== Before we start writing the solver, we need to generate an hexahedral mesh, and define our sources and receivers. To do this we will use the Fortran package ``MESHFEM2D``. @@ -11,7 +11,7 @@ Before we start writing the solver, we need to generate an hexahedral mesh, and Since ``MESHFEM2D`` is a dependency for SPECFEM++, it is should already be installed as part of the SPECFEM++ installation. Defining the MESHFEM2D Parameter File --------------------------------------- +------------------------------------- Let us generate a Hex mesh for 2D elastic domain using the following parameter file. You will also need a topography file to define the surface topography of the mesh, see :ref:`Topgraphy File ` diff --git a/include/IO/mesh/fortran/read_interfaces.hpp b/include/IO/mesh/fortran/read_interfaces.hpp index e1319481..68214f47 100644 --- a/include/IO/mesh/fortran/read_interfaces.hpp +++ b/include/IO/mesh/fortran/read_interfaces.hpp @@ -15,6 +15,15 @@ specfem::mesh::interface_container read_interfaces(const int num_interfaces, std::ifstream &stream, const specfem::MPI::MPI *mpi); +/* @brief Read the coupled interfaces from the database file + * + * @param stream input file stream + * @param num_interfaces_elastic_acoustic + * @param num_interfaces_acoustic_poroelastic + * @param num_interfaces_elastic_poroelastic + * @param mpi + * @return specfem::mesh::coupled_interfaces + */ specfem::mesh::coupled_interfaces read_coupled_interfaces( std::ifstream &stream, const int num_interfaces_elastic_acoustic, const int num_interfaces_acoustic_poroelastic, diff --git a/include/IO/mesh/fortran/read_mesh_database.hpp b/include/IO/mesh/fortran/read_mesh_database.hpp index c0e2abea..cd2046d6 100644 --- a/include/IO/mesh/fortran/read_mesh_database.hpp +++ b/include/IO/mesh/fortran/read_mesh_database.hpp @@ -32,8 +32,7 @@ read_mesh_database_header(std::ifstream &stream, const specfem::MPI::MPI *mpi); * section * @param npgeo Total number of control nodes in simulation box * @param mpi Pointer to MPI object - * @return specfem::kokkos::HostView2d coorg values as read from - * fortran binary database file + * @return std::tuple nspec, npgeo, nproc values read from */ specfem::kokkos::HostView2d read_coorg_elements(std::ifstream &stream, const int npgeo, diff --git a/include/IO/mesh/fortran/read_properties.hpp b/include/IO/mesh/fortran/read_properties.hpp index de59539f..b5995d8b 100644 --- a/include/IO/mesh/fortran/read_properties.hpp +++ b/include/IO/mesh/fortran/read_properties.hpp @@ -14,7 +14,7 @@ namespace fortran { * * @param stream Input stream * @param mpi MPI object - * @return specfem::mesh::properties + * @return specfem::mesh::properties Property object */ specfem::mesh::properties read_properties(std::ifstream &stream, const specfem::MPI::MPI *mpi); diff --git a/include/IO/mesh/read_mesh.hpp b/include/IO/mesh/read_mesh.hpp index e786bca1..f5ede37d 100644 --- a/include/IO/mesh/read_mesh.hpp +++ b/include/IO/mesh/read_mesh.hpp @@ -12,6 +12,7 @@ namespace IO { * * @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); From a2b2da2cbc6921705ff6e25fea254dfc56327fdb Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Wed, 20 Nov 2024 16:32:17 -0500 Subject: [PATCH 27/53] Forgot to do some edits --- docs/api/IO/Libraries/mesh/index.rst | 5 +++-- docs/api/IO/index.rst | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/api/IO/Libraries/mesh/index.rst b/docs/api/IO/Libraries/mesh/index.rst index dad9196d..f7c350ea 100644 --- a/docs/api/IO/Libraries/mesh/index.rst +++ b/docs/api/IO/Libraries/mesh/index.rst @@ -28,5 +28,6 @@ functions are called in the order of appearance in the code: .. doxygenfunction:: specfem::IO::mesh::fortran::read_axial_elements -.. doxygenclass:: specfem::mesh::tags - :members: +Finally, we add tags to the :cpp:struct:`specfem::mesh::mesh` using the +:cpp:struct:`specfem::mesh::tags` struct. The description of which can be found +here: :ref:`mesh_tags`. diff --git a/docs/api/IO/index.rst b/docs/api/IO/index.rst index 65a8267b..b084713e 100644 --- a/docs/api/IO/index.rst +++ b/docs/api/IO/index.rst @@ -6,6 +6,6 @@ Input/Output modules :maxdepth: 2 fortran_io - Library/index + Libraries/index writer/index reader/index From e43e93d6fe990dcff97137b8211c128d76ded52d Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Thu, 21 Nov 2024 15:00:49 -0500 Subject: [PATCH 28/53] Changed location of read_sources file --- include/{source => IO/sources}/read_sources.hpp | 0 src/{source => IO/sources}/read_sources.cpp | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename include/{source => IO/sources}/read_sources.hpp (100%) rename src/{source => IO/sources}/read_sources.cpp (100%) diff --git a/include/source/read_sources.hpp b/include/IO/sources/read_sources.hpp similarity index 100% rename from include/source/read_sources.hpp rename to include/IO/sources/read_sources.hpp diff --git a/src/source/read_sources.cpp b/src/IO/sources/read_sources.cpp similarity index 100% rename from src/source/read_sources.cpp rename to src/IO/sources/read_sources.cpp From 837e4996fa19f2987480b36719ae924f203e08cc Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Thu, 21 Nov 2024 15:10:51 -0500 Subject: [PATCH 29/53] This commit updates most references to specfem::sources::read_sources to become specfem::IO::read_sources. I also removes some unnecessary includes in the main binary for read_mesh that were omitted in the previous pull request. --- include/IO/sources/read_sources.hpp | 6 +++--- src/IO/sources/read_sources.cpp | 7 ++++--- src/specfem2d.cpp | 9 ++------- tests/unit-tests/assembly/test_fixture.hpp | 2 +- .../Newmark/acoustic/newmark_tests.cpp | 2 +- .../displacement_tests/Newmark/elastic/newmark_tests.cpp | 2 +- .../displacement_tests/Newmark/newmark_tests.cpp | 2 +- tests/unit-tests/domain/acoustic/rmass_inverse_tests.cpp | 2 +- tests/unit-tests/domain/elastic/rmass_inverse_tests.cpp | 2 +- tests/unit-tests/source/source_location_tests.cpp | 2 +- 10 files changed, 16 insertions(+), 20 deletions(-) diff --git a/include/IO/sources/read_sources.hpp b/include/IO/sources/read_sources.hpp index 28779577..727093b5 100644 --- a/include/IO/sources/read_sources.hpp +++ b/include/IO/sources/read_sources.hpp @@ -2,11 +2,11 @@ #define _READ_SOURCES_HPP #include "enumerations/simulation.hpp" -#include "source.hpp" +#include "sources/source.hpp" #include namespace specfem { -namespace sources { +namespace IO { /** * @brief Read sources file written in .yml format * @@ -23,7 +23,7 @@ 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 sources +} // namespace IO } // namespace specfem #endif diff --git a/src/IO/sources/read_sources.cpp b/src/IO/sources/read_sources.cpp index 93ba9f3f..7c95e612 100644 --- a/src/IO/sources/read_sources.cpp +++ b/src/IO/sources/read_sources.cpp @@ -1,3 +1,4 @@ +#include "IO/sources/read_sources.hpp" #include "source/interface.hpp" #include "specfem_setup.hpp" #include "utilities/interface.hpp" @@ -9,9 +10,9 @@ #include std::tuple >, type_real> -specfem::sources::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) { +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()); diff --git a/src/specfem2d.cpp b/src/specfem2d.cpp index a2845ed9..7af1dbd1 100644 --- a/src/specfem2d.cpp +++ b/src/specfem2d.cpp @@ -1,13 +1,8 @@ #include "compute/interface.hpp" // #include "coupled_interface/interface.hpp" // #include "domain/interface.hpp" -#include "IO/mesh/fortran/read_boundaries.hpp" -#include "IO/mesh/fortran/read_elements.hpp" -#include "IO/mesh/fortran/read_interfaces.hpp" -#include "IO/mesh/fortran/read_material_properties.hpp" -#include "IO/mesh/fortran/read_mesh_database.hpp" -#include "IO/mesh/fortran/read_properties.hpp" #include "IO/mesh/read_mesh.hpp" +#include "IO/sources/read_mesh.hpp" #include "kokkos_abstractions.h" #include "mesh/mesh.hpp" #include "parameter_parser/interface.hpp" @@ -113,7 +108,7 @@ void execute(const std::string ¶meter_file, const std::string &default_file, // -------------------------------------------------------------- const int nsteps = setup.get_nsteps(); const specfem::simulation::type simulation_type = setup.get_simulation_type(); - auto [sources, t0] = specfem::sources::read_sources( + auto [sources, t0] = specfem::IO::read_sources( source_filename, nsteps, setup.get_t0(), setup.get_dt(), simulation_type); setup.update_t0(t0); // Update t0 in case it was changed diff --git a/tests/unit-tests/assembly/test_fixture.hpp b/tests/unit-tests/assembly/test_fixture.hpp index 75d0e59a..00f0a4dd 100644 --- a/tests/unit-tests/assembly/test_fixture.hpp +++ b/tests/unit-tests/assembly/test_fixture.hpp @@ -148,7 +148,7 @@ class ASSEMBLY : public ::testing::Test { Test.get_databases(); specfem::mesh::mesh mesh = specfem::IO::read_mesh(database_file, mpi); - const auto [sources, t0] = specfem::sources::read_sources( + const auto [sources, t0] = specfem::IO::read_sources( sources_file, 0, 0, 0, specfem::simulation::type::forward); const auto receivers = 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 96c1fded..4c81c233 100644 --- a/tests/unit-tests/displacement_tests/Newmark/acoustic/newmark_tests.cpp +++ b/tests/unit-tests/displacement_tests/Newmark/acoustic/newmark_tests.cpp @@ -69,7 +69,7 @@ TEST(DISPLACEMENT_TESTS, newmark_scheme_tests) { // if start time is not explicitly specified then t0 is determined using // source frequencies and time shift auto [sources, t0] = - specfem::sources::read_sources(sources_file, setup.get_dt(), mpi); + specfem::IO::read_sources(sources_file, setup.get_dt(), mpi); // Generate compute structs to be used by the solver specfem::compute::compute compute(mesh.coorg, mesh.material_ind.knods, gllx, 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 86cacc7c..9b492f96 100644 --- a/tests/unit-tests/displacement_tests/Newmark/elastic/newmark_tests.cpp +++ b/tests/unit-tests/displacement_tests/Newmark/elastic/newmark_tests.cpp @@ -69,7 +69,7 @@ TEST(DISPLACEMENT_TESTS, newmark_scheme_tests) { // if start time is not explicitly specified then t0 is determined using // source frequencies and time shift auto [sources, t0] = - specfem::sources::read_sources(sources_file, setup.get_dt(), mpi); + specfem::IO::read_sources(sources_file, setup.get_dt(), mpi); // Generate compute structs to be used by the solver specfem::compute::compute compute(mesh.coorg, mesh.material_ind.knods, gllx, diff --git a/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp b/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp index 97d0defd..46945d1c 100644 --- a/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp +++ b/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp @@ -182,7 +182,7 @@ TEST(DISPLACEMENT_TESTS, newmark_scheme_tests) { // Read sources // if start time is not explicitly specified then t0 is determined using // source frequencies and time shift - auto [sources, t0] = specfem::sources::read_sources( + auto [sources, t0] = specfem::IO::read_sources( sources_file, nsteps, setup.get_t0(), dt, setup.get_simulation_type()); for (auto &source : sources) { diff --git a/tests/unit-tests/domain/acoustic/rmass_inverse_tests.cpp b/tests/unit-tests/domain/acoustic/rmass_inverse_tests.cpp index 0b6daabc..ee6d9938 100644 --- a/tests/unit-tests/domain/acoustic/rmass_inverse_tests.cpp +++ b/tests/unit-tests/domain/acoustic/rmass_inverse_tests.cpp @@ -65,7 +65,7 @@ TEST(DOMAIN_TESTS, rmass_inverse_elastic_test) { // Read sources // if start time is not explicitly specified then t0 is determined using // source frequencies and time shift - auto [sources, t0] = specfem::sources::read_sources(sources_file, 1e-5, mpi); + auto [sources, t0] = specfem::IO::read_sources(sources_file, 1e-5, mpi); // Generate compute structs to be used by the solver specfem::compute::compute compute(mesh.coorg, mesh.material_ind.knods, gllx, diff --git a/tests/unit-tests/domain/elastic/rmass_inverse_tests.cpp b/tests/unit-tests/domain/elastic/rmass_inverse_tests.cpp index 7e02459e..5d78af93 100644 --- a/tests/unit-tests/domain/elastic/rmass_inverse_tests.cpp +++ b/tests/unit-tests/domain/elastic/rmass_inverse_tests.cpp @@ -65,7 +65,7 @@ TEST(DOMAIN_TESTS, rmass_inverse_elastic_test) { // Read sources // if start time is not explicitly specified then t0 is determined using // source frequencies and time shift - auto [sources, t0] = specfem::sources::read_sources(sources_file, 1e-5, mpi); + auto [sources, t0] = specfem::IO::read_sources(sources_file, 1e-5, mpi); // Generate compute structs to be used by the solver specfem::compute::compute compute(mesh.coorg, mesh.material_ind.knods, gllx, diff --git a/tests/unit-tests/source/source_location_tests.cpp b/tests/unit-tests/source/source_location_tests.cpp index 7b03955b..0f58abab 100644 --- a/tests/unit-tests/source/source_location_tests.cpp +++ b/tests/unit-tests/source/source_location_tests.cpp @@ -167,7 +167,7 @@ TEST(SOURCE_LOCATION_TESTS, compute_source_locations) { // read sources file auto [sources, t0] = - specfem::sources::read_sources(test_config.sources_file, 1.0, mpi); + specfem::IO::read_sources(test_config.sources_file, 1.0, mpi); // setup compute struct for future use specfem::compute::compute compute(mesh.coorg, mesh.material_ind.knods, gllx, From 7a122378d553569fd431c87d749aee170f8f4aaf Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Fri, 22 Nov 2024 16:17:00 -0500 Subject: [PATCH 30/53] Moves read_sources, adds read_seismogram module to cmakelist, updates relevant unit tests. --- CMakeLists.txt | 25 +++++++++++++++---- include/IO/sources/read_sources.hpp | 2 +- include/enumerations/simulation.hpp | 1 + include/reader/seismogram.hpp | 1 + include/source/interface.hpp | 1 - src/specfem2d.cpp | 2 +- tests/unit-tests/CMakeLists.txt | 6 +++++ tests/unit-tests/assembly/test_fixture.hpp | 1 + .../Newmark/newmark_tests.cpp | 1 + 9 files changed, 32 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7e05c99..9b087371 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,7 +107,7 @@ add_library( IO src/IO/fortranio/fortran_io.cpp src/IO/HDF5/native_type.cpp - src/IO/ASCII/native_type.cpp + # src/IO/ASCII/native_type.cpp src/IO/mesh/read_mesh.cpp src/IO/mesh/fortran/read_boundaries.cpp src/IO/mesh/fortran/read_elements.cpp @@ -115,6 +115,8 @@ add_library( src/IO/mesh/fortran/read_mesh_database.cpp src/IO/mesh/fortran/read_interfaces.cpp src/IO/mesh/fortran/read_properties.cpp + src/IO/sources/read_sources.cpp + # src/IO/receivers/read_receivers.cpp ) if (NOT HDF5_CXX_BUILD) @@ -142,6 +144,11 @@ target_link_libraries( mesh ) +target_link_libraries( + IO + source_class +) + add_library( point src/point/coordinates.cpp @@ -210,7 +217,6 @@ target_link_libraries( Kokkos::kokkos specfem_mpi # material_class - IO yaml-cpp ) @@ -238,16 +244,26 @@ target_link_libraries( # specfem_mpi # ) +add_library( + read_seismogram + src/reader/seismogram.cpp +) + +target_link_libraries( + read_seismogram + Kokkos::kokkos + ) + add_library( reader src/reader/wavefield.cpp - src/reader/seismogram.cpp ) target_link_libraries( reader compute IO + read_seismogram ) add_library( @@ -271,7 +287,7 @@ add_library( target_link_libraries( source_time_function - reader + read_seismogram Kokkos::kokkos point ) @@ -283,7 +299,6 @@ add_library( src/source/moment_tensor_source.cpp src/source/adjoint_source.cpp src/source/external.cpp - src/source/read_sources.cpp ) target_link_libraries( diff --git a/include/IO/sources/read_sources.hpp b/include/IO/sources/read_sources.hpp index 727093b5..a6e2ebe9 100644 --- a/include/IO/sources/read_sources.hpp +++ b/include/IO/sources/read_sources.hpp @@ -2,7 +2,7 @@ #define _READ_SOURCES_HPP #include "enumerations/simulation.hpp" -#include "sources/source.hpp" +#include "source/interface.hpp" #include namespace specfem { diff --git a/include/enumerations/simulation.hpp b/include/enumerations/simulation.hpp index 04c043a7..c5909432 100644 --- a/include/enumerations/simulation.hpp +++ b/include/enumerations/simulation.hpp @@ -1,4 +1,5 @@ #pragma once +#include namespace specfem { namespace simulation { diff --git a/include/reader/seismogram.hpp b/include/reader/seismogram.hpp index 5bef6f11..b4267588 100644 --- a/include/reader/seismogram.hpp +++ b/include/reader/seismogram.hpp @@ -15,6 +15,7 @@ namespace reader { class seismogram : public reader { public: + seismogram(){}; seismogram(const char *filename, const specfem::enums::seismogram::format type, specfem::kokkos::HostView2d source_time_function) diff --git a/include/source/interface.hpp b/include/source/interface.hpp index 61ac13cd..2e260510 100644 --- a/include/source/interface.hpp +++ b/include/source/interface.hpp @@ -5,7 +5,6 @@ #include "external.hpp" #include "force_source.hpp" #include "moment_tensor_source.hpp" -#include "read_sources.hpp" #include "source.hpp" #endif diff --git a/src/specfem2d.cpp b/src/specfem2d.cpp index 7af1dbd1..b9b5fbed 100644 --- a/src/specfem2d.cpp +++ b/src/specfem2d.cpp @@ -2,7 +2,7 @@ // #include "coupled_interface/interface.hpp" // #include "domain/interface.hpp" #include "IO/mesh/read_mesh.hpp" -#include "IO/sources/read_mesh.hpp" +#include "IO/sources/read_sources.hpp" #include "kokkos_abstractions.h" #include "mesh/mesh.hpp" #include "parameter_parser/interface.hpp" diff --git a/tests/unit-tests/CMakeLists.txt b/tests/unit-tests/CMakeLists.txt index 90842351..303ae94b 100644 --- a/tests/unit-tests/CMakeLists.txt +++ b/tests/unit-tests/CMakeLists.txt @@ -101,6 +101,7 @@ target_link_libraries( mpi_environment kokkos_environment yaml-cpp + IO # material_class -lpthread -lm ) @@ -175,6 +176,7 @@ target_link_libraries( kokkos_environment yaml-cpp compare_arrays + IO Boost::filesystem # material_class -lpthread -lm @@ -192,6 +194,7 @@ target_link_libraries( compute quadrature mpi_environment + IO kokkos_environment yaml-cpp Boost::filesystem @@ -213,6 +216,7 @@ target_link_libraries( kokkos_environment algorithms point + IO Boost::filesystem ) @@ -229,6 +233,7 @@ target_link_libraries( mpi_environment kokkos_environment algorithms + IO Boost::filesystem point ) @@ -288,6 +293,7 @@ target_link_libraries( point algorithms domain + IO coupled_interface -lpthread -lm ) diff --git a/tests/unit-tests/assembly/test_fixture.hpp b/tests/unit-tests/assembly/test_fixture.hpp index 00f0a4dd..dcc61402 100644 --- a/tests/unit-tests/assembly/test_fixture.hpp +++ b/tests/unit-tests/assembly/test_fixture.hpp @@ -2,6 +2,7 @@ #include "../MPI_environment.hpp" #include "IO/mesh/read_mesh.hpp" +#include "IO/sources/read_sources.hpp" #include "compute/assembly/assembly.hpp" #include "enumerations/specfem_enums.hpp" #include "mesh/mesh.hpp" diff --git a/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp b/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp index 46945d1c..65018ede 100644 --- a/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp +++ b/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp @@ -2,6 +2,7 @@ #include "../../MPI_environment.hpp" #include "../../utilities/include/interface.hpp" #include "IO/mesh/read_mesh.hpp" +#include "IO/sources/read_sources.hpp" #include "compute/interface.hpp" #include "constants.hpp" #include "domain/domain.hpp" From 397a82f81c24d5f0b37a0acc6353679cba262d76 Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Sun, 24 Nov 2024 10:26:56 -0500 Subject: [PATCH 31/53] Pressure seismograms | Need to check correctness --- include/enumerations/wavefield.hpp | 2 +- .../acoustic_isotropic2d.hpp | 79 +++ include/medium/compute_wavefield.hpp | 40 ++ .../elastic_isotropic2d.hpp | 89 +++ include/medium/medium.hpp | 1 + src/compute/assembly/compute_wavefield.cpp | 55 +- src/compute/assembly/helper.hpp | 531 +++++++++++------- src/plotter/plot_wavefield.cpp | 20 +- 8 files changed, 565 insertions(+), 252 deletions(-) create mode 100644 include/medium/compute_wavefield.hpp diff --git a/include/enumerations/wavefield.hpp b/include/enumerations/wavefield.hpp index 41ede765..2690f1f3 100644 --- a/include/enumerations/wavefield.hpp +++ b/include/enumerations/wavefield.hpp @@ -10,7 +10,7 @@ namespace wavefield { */ enum class type { forward, adjoint, backward, buffer }; -enum class component { displacement, velocity, acceleration }; +enum class component { displacement, velocity, acceleration, pressure }; template diff --git a/include/medium/acoustic_isotropic2d/acoustic_isotropic2d.hpp b/include/medium/acoustic_isotropic2d/acoustic_isotropic2d.hpp index adf43988..348c1738 100644 --- a/include/medium/acoustic_isotropic2d/acoustic_isotropic2d.hpp +++ b/include/medium/acoustic_isotropic2d/acoustic_isotropic2d.hpp @@ -1,5 +1,6 @@ #pragma once +#include "algorithms/gradient.hpp" #include "enumerations/dimension.hpp" #include "enumerations/medium.hpp" #include "point/field_derivatives.hpp" @@ -32,5 +33,83 @@ impl_compute_stress( return { T }; } +template = 0> +KOKKOS_FUNCTION void +impl_compute_wavefield(const MemberType &team, const IteratorType &iterator, + const specfem::compute::assembly &assembly, + const QuadratureType &quadrature, + const ChunkFieldType &field, + const specfem::wavefield::component wavefield_component, + WavefieldViewType wavefield) { + + using FieldDerivativesType = + specfem::point::field_derivatives; + + using PointPropertyType = specfem::point::properties< + specfem::dimension::type::dim2, specfem::element::medium_tag::acoustic, + specfem::element::property_tag::isotropic, false>; + + const auto &properties = assembly.properties; + + const auto &active_field = [&]() { + if (wavefield_component == specfem::wavefield::component::displacement) { + return field.displacement; + } else if (wavefield_component == specfem::wavefield::component::velocity) { + return field.velocity; + } else if (wavefield_component == + specfem::wavefield::component::acceleration) { + return field.acceleration; + } else if (wavefield_component == specfem::wavefield::component::pressure) { + return field.acceleration; + } else { + Kokkos::abort("component not supported"); + } + }(); + + if (wavefield_component == specfem::wavefield::component::pressure) { + Kokkos::parallel_for(Kokkos::TeamThreadRange(team, iterator.chunk_size()), + [&](const int &i) { + const auto iterator_index = iterator(i); + const auto index = iterator_index.index; + wavefield(index.ispec, index.iz, index.ix, 0) = + -1.0 * active_field(iterator_index.ielement, + index.iz, index.ix, 0); + }); + + return; + } + + specfem::algorithms::gradient( + team, iterator, assembly.partial_derivatives, quadrature.hprime_gll, + active_field, + [&](const typename IteratorType::index_type &iterator_index, + const FieldDerivativesType::ViewType &du) { + const auto &index = iterator_index.index; + PointPropertyType point_property; + + specfem::compute::load_on_device(index, properties, point_property); + + FieldDerivativesType point_field_derivatives(du); + + const auto point_stress = + impl_compute_stress(point_property, point_field_derivatives); + + wavefield(index.ispec, index.iz, index.ix, 0) = point_stress.T(0, 0); + wavefield(index.ispec, index.iz, index.ix, 1) = point_stress.T(1, 0); + }); + + return; +} + } // namespace medium } // namespace specfem diff --git a/include/medium/compute_wavefield.hpp b/include/medium/compute_wavefield.hpp new file mode 100644 index 00000000..a19f7e57 --- /dev/null +++ b/include/medium/compute_wavefield.hpp @@ -0,0 +1,40 @@ +#pragma once + +#include "acoustic_isotropic2d/acoustic_isotropic2d.hpp" +#include "elastic_isotropic2d/elastic_isotropic2d.hpp" + +namespace specfem { +namespace medium { + +template +KOKKOS_INLINE_FUNCTION void +compute_wavefield(const MemberType &team, const IteratorType &iterator, + const specfem::compute::assembly &assembly, + const QuadratureType &quadrature, const ChunkFieldType &field, + const specfem::wavefield::component &wavefield_component, + WavefieldViewType wavefield_on_entire_grid) { + + static_assert(ChunkFieldType::isChunkFieldType, + "field is not a chunk field type"); + static_assert( + ChunkFieldType::store_displacement && ChunkFieldType::store_velocity && + ChunkFieldType::store_acceleration, + "field type needs to store displacement, velocity and acceleration"); + static_assert(QuadratureType::store_hprime_gll, + "quadrature type needs to store GLL points"); + static_assert(WavefieldViewType::rank() == 4, + "wavefield_on_entire_grid needs to be a 4D view"); + + static_assert(ChunkFieldType::medium_tag == MediumTag, + "field type needs to have the same medium tag as the function"); + + impl_compute_wavefield( + team, iterator, assembly, quadrature, field, wavefield_component, + wavefield_on_entire_grid); +} + +} // namespace medium +} // namespace specfem diff --git a/include/medium/elastic_isotropic2d/elastic_isotropic2d.hpp b/include/medium/elastic_isotropic2d/elastic_isotropic2d.hpp index ba560aca..bc6d4b07 100644 --- a/include/medium/elastic_isotropic2d/elastic_isotropic2d.hpp +++ b/include/medium/elastic_isotropic2d/elastic_isotropic2d.hpp @@ -2,6 +2,7 @@ #include "enumerations/dimension.hpp" #include "enumerations/medium.hpp" +#include "enumerations/wavefield.hpp" #include "point/field_derivatives.hpp" #include "point/properties.hpp" #include "point/stress.hpp" @@ -48,5 +49,93 @@ impl_compute_stress( return { T }; } +template = 0> +KOKKOS_FUNCTION void +impl_compute_wavefield(const MemberType &team, const IteratorType &iterator, + const specfem::compute::assembly &assembly, + const QuadratureType &quadrature, + const ChunkFieldType &field, + const specfem::wavefield::component wavefield_component, + WavefieldViewType wavefield) { + + using FieldDerivativesType = + specfem::point::field_derivatives; + + using PointPropertyType = specfem::point::properties< + specfem::dimension::type::dim2, specfem::element::medium_tag::elastic, + specfem::element::property_tag::isotropic, false>; + + const auto &properties = assembly.properties; + + const auto &active_field = [&]() { + if (wavefield_component == specfem::wavefield::component::displacement) { + return field.displacement; + } else if (wavefield_component == specfem::wavefield::component::velocity) { + return field.velocity; + } else if (wavefield_component == + specfem::wavefield::component::acceleration) { + return field.acceleration; + } else if (wavefield_component == specfem::wavefield::component::pressure) { + return field.acceleration; + } else { + Kokkos::abort("component not supported"); + } + }(); + + if (wavefield_component == specfem::wavefield::component::pressure) { + + specfem::algorithms::gradient( + team, iterator, assembly.partial_derivatives, quadrature.hprime_gll, + active_field, + [&](const typename IteratorType::index_type &iterator_index, + const FieldDerivativesType::ViewType &du) { + const auto &index = iterator_index.index; + PointPropertyType point_property; + + specfem::compute::load_on_device(index, properties, point_property); + + // P_SV case + // sigma_xx + const auto sigma_xx = point_property.lambdaplus2mu * du(0, 0) + + point_property.lambda * du(1, 1); + + // sigma_zz + const auto sigma_zz = point_property.lambdaplus2mu * du(1, 1) + + point_property.lambda * du(0, 0); + + // sigma_yy + const auto sigma_yy = + point_property.lambdaplus2mu * (du(0, 0) + du(1, 1)); + + wavefield(index.ispec, index.iz, index.ix, 0) = + -1.0 * (sigma_xx + sigma_zz + sigma_yy) / 3.0; + }); + + return; + } + + Kokkos::parallel_for( + Kokkos::TeamThreadRange(team, iterator.chunk_size()), [&](const int &i) { + const auto iterator_index = iterator(i); + const auto &index = iterator_index.index; + wavefield(index.ispec, index.iz, index.ix, 0) = + active_field(iterator_index.ielement, index.iz, index.ix, 0); + wavefield(index.ispec, index.iz, index.ix, 1) = + active_field(iterator_index.ielement, index.iz, index.ix, 1); + }); + + return; +} + } // namespace medium } // namespace specfem diff --git a/include/medium/medium.hpp b/include/medium/medium.hpp index 9e6f6ee7..69bfd338 100644 --- a/include/medium/medium.hpp +++ b/include/medium/medium.hpp @@ -1,3 +1,4 @@ #pragma once #include "compute_stress.hpp" +#include "compute_wavefield.hpp" diff --git a/src/compute/assembly/compute_wavefield.cpp b/src/compute/assembly/compute_wavefield.cpp index 5bc26711..0b348c07 100644 --- a/src/compute/assembly/compute_wavefield.cpp +++ b/src/compute/assembly/compute_wavefield.cpp @@ -5,9 +5,9 @@ namespace { template + specfem::element::property_tag PropertyTag> void get_wavefield_on_entire_grid( + const specfem::wavefield::component component, const specfem::compute::assembly &assembly, Kokkos::View @@ -17,13 +17,13 @@ void get_wavefield_on_entire_grid( const int ngllz = assembly.mesh.ngllz; if (ngllx == 5 && ngllz == 5) { - impl::helper helper( - assembly, wavefield_on_entire_grid); - helper(); + impl::helper helper(assembly, + wavefield_on_entire_grid); + helper(component); } else if (ngllx == 8 && ngllz == 8) { - impl::helper helper( - assembly, wavefield_on_entire_grid); - helper(); + impl::helper helper(assembly, + wavefield_on_entire_grid); + helper(component); } else { throw std::runtime_error("Number of quadrature points not supported"); } @@ -45,6 +45,8 @@ specfem::compute::assembly::generate_wavefield_on_entire_grid( return 2; } else if (component == specfem::wavefield::component::acceleration) { return 2; + } else if (component == specfem::wavefield::component::pressure) { + return 1; } else { throw std::runtime_error("Wavefield component not supported"); } @@ -69,36 +71,13 @@ specfem::compute::assembly::generate_wavefield_on_entire_grid( const auto h_wavefield_on_entire_grid = Kokkos::create_mirror_view(wavefield_on_entire_grid); - if (component == specfem::wavefield::component::displacement) { - get_wavefield_on_entire_grid( - *this, wavefield_on_entire_grid); - get_wavefield_on_entire_grid( - *this, wavefield_on_entire_grid); - } else if (component == specfem::wavefield::component::velocity) { - get_wavefield_on_entire_grid( - *this, wavefield_on_entire_grid); - get_wavefield_on_entire_grid( - *this, wavefield_on_entire_grid); - } else if (component == specfem::wavefield::component::acceleration) { - get_wavefield_on_entire_grid( - *this, wavefield_on_entire_grid); - get_wavefield_on_entire_grid( - *this, wavefield_on_entire_grid); - } else { - throw std::runtime_error("Wavefield component not supported"); - } + get_wavefield_on_entire_grid( + component, *this, wavefield_on_entire_grid); + + get_wavefield_on_entire_grid( + component, *this, wavefield_on_entire_grid); Kokkos::deep_copy(h_wavefield_on_entire_grid, wavefield_on_entire_grid); diff --git a/src/compute/assembly/helper.hpp b/src/compute/assembly/helper.hpp index af29ec44..630e1602 100644 --- a/src/compute/assembly/helper.hpp +++ b/src/compute/assembly/helper.hpp @@ -15,164 +15,15 @@ #include namespace impl { -template -class field_type_parameters; - -template -class field_type_parameters { -public: - constexpr static auto medium_tag = MediumTag; - constexpr static auto store_displacement = true; - constexpr static auto store_velocity = false; - constexpr static auto store_acceleration = false; - constexpr static auto store_mass_matrix = false; - constexpr static auto num_components = 2; -}; - -template -class field_type_parameters { -public: - constexpr static auto medium_tag = MediumTag; - constexpr static auto store_displacement = false; - constexpr static auto store_velocity = true; - constexpr static auto store_acceleration = false; - constexpr static auto store_mass_matrix = false; - constexpr static auto num_components = 2; -}; - -template -class field_type_parameters { -public: - constexpr static auto medium_tag = MediumTag; - constexpr static auto store_displacement = false; - constexpr static auto store_velocity = false; - constexpr static auto store_acceleration = true; - constexpr static auto store_mass_matrix = false; - constexpr static auto num_components = 2; -}; template -class helper; - -template -class helper { + specfem::element::property_tag PropertyTag, int NGLL> +class helper { public: - constexpr static auto medium_tag = specfem::element::medium_tag::elastic; + constexpr static auto medium_tag = MediumTag; constexpr static auto property_tag = PropertyTag; - constexpr static auto component = Component; constexpr static auto ngll = NGLL; - using field_parameters = field_type_parameters; - helper(specfem::compute::assembly assembly, - Kokkos::View - wavefield_on_entire_grid) - : assembly(assembly), wavefield_on_entire_grid(wavefield_on_entire_grid) { - if (assembly.mesh.ngllz != ngll || assembly.mesh.ngllx != ngll) { - throw std::runtime_error("Number of quadrature points not supported"); - } - return; - } - - void operator()() const { - const auto buffer = assembly.fields.buffer; - - const int nspec = assembly.mesh.nspec; - const int ngllz = assembly.mesh.ngllz; - const int ngllx = assembly.mesh.ngllx; - - const auto elements = - assembly.properties.get_elements_on_device(medium_tag, property_tag); - - const int nelements = elements.extent(0); - - if (nelements == 0) { - return; - } - - using PointFieldType = - specfem::point::field; - - using simd = specfem::datatype::simd; - constexpr int simd_size = simd::size(); - using ParallelConfig = specfem::parallel_config::default_chunk_config< - specfem::dimension::type::dim2, simd, Kokkos::DefaultExecutionSpace>; - - using ChunkPolicyType = specfem::policy::element_chunk; - - ChunkPolicyType chunk_policy(elements, ngllz, ngllx); - - Kokkos::parallel_for( - "specfem::domain::impl::kernels::elements::compute_mass_matrix", - static_cast( - chunk_policy), - KOKKOS_CLASS_LAMBDA(const typename ChunkPolicyType::member_type &team) { - for (int tile = 0; tile < ChunkPolicyType::tile_size * simd_size; - tile += ChunkPolicyType::chunk_size * simd_size) { - const int starting_element_index = - team.league_rank() * ChunkPolicyType::tile_size * simd_size + - tile; - - if (starting_element_index >= nelements) { - break; - } - - const auto iterator = - chunk_policy.league_iterator(starting_element_index); - - Kokkos::parallel_for( - Kokkos::TeamThreadRange(team, iterator.chunk_size()), - [&](const int i) { - const auto iterator_index = iterator(i); - const auto index = iterator_index.index; - - PointFieldType field; - - specfem::compute::load_on_device(index, buffer, field); - - for (int icomponent = 0; - icomponent < field_parameters::num_components; - icomponent++) { - wavefield_on_entire_grid(index.ispec, index.iz, index.ix, - icomponent) = field(icomponent); - } - }); - } - }); - - return; - } - -private: - const specfem::compute::assembly assembly; - Kokkos::View - wavefield_on_entire_grid; -}; - -template -class helper { -public: - constexpr static auto medium_tag = specfem::element::medium_tag::acoustic; - constexpr static auto property_tag = PropertyTag; - constexpr static auto component = Component; - constexpr static auto ngll = NGLL; - using field_parameters = - field_type_parameters; helper(specfem::compute::assembly assembly, Kokkos::View @@ -183,7 +34,7 @@ class helper; - constexpr int simd_size = simd::size(); using ParallelConfig = specfem::parallel_config::default_chunk_config< - specfem::dimension::type::dim2, simd, Kokkos::DefaultExecutionSpace>; + specfem::dimension::type::dim2, + specfem::datatype::simd, + Kokkos::DefaultExecutionSpace>; using ChunkElementFieldType = specfem::chunk_element::field< ParallelConfig::chunk_size, ngll, specfem::dimension::type::dim2, medium_tag, specfem::kokkos::DevScratchSpace, - Kokkos::MemoryTraits, - field_parameters::store_displacement, field_parameters::store_velocity, - field_parameters::store_acceleration, - field_parameters::store_mass_matrix, false>; + Kokkos::MemoryTraits, true, true, true, false, + false>; using QuadratureType = specfem::element::quadrature< ngll, specfem::dimension::type::dim2, specfem::kokkos::DevScratchSpace, @@ -229,10 +77,11 @@ class helper= nelements) { break; @@ -256,46 +104,9 @@ class helper( + team, iterator, assembly, quadrature, field, wavefield_type, + wavefield_on_entire_grid); } }); @@ -308,4 +119,310 @@ class helper wavefield_on_entire_grid; }; + } // namespace impl + +// namespace impl { +// template +// class field_type_parameters; + +// template +// class field_type_parameters { +// public: +// constexpr static auto medium_tag = MediumTag; +// constexpr static auto store_displacement = true; +// constexpr static auto store_velocity = false; +// constexpr static auto store_acceleration = false; +// constexpr static auto store_mass_matrix = false; +// constexpr static auto num_components = 2; +// }; + +// template +// class field_type_parameters { +// public: +// constexpr static auto medium_tag = MediumTag; +// constexpr static auto store_displacement = false; +// constexpr static auto store_velocity = true; +// constexpr static auto store_acceleration = false; +// constexpr static auto store_mass_matrix = false; +// constexpr static auto num_components = 2; +// }; + +// template +// class field_type_parameters { +// public: +// constexpr static auto medium_tag = MediumTag; +// constexpr static auto store_displacement = false; +// constexpr static auto store_velocity = false; +// constexpr static auto store_acceleration = true; +// constexpr static auto store_mass_matrix = false; +// constexpr static auto num_components = 2; +// }; + +// template +// class helper; + +// template +// class helper { +// public: +// constexpr static auto medium_tag = specfem::element::medium_tag::elastic; +// constexpr static auto property_tag = PropertyTag; +// constexpr static auto component = Component; +// constexpr static auto ngll = NGLL; +// using field_parameters = field_type_parameters; +// helper(specfem::compute::assembly assembly, +// Kokkos::View +// wavefield_on_entire_grid) +// : assembly(assembly), +// wavefield_on_entire_grid(wavefield_on_entire_grid) { +// if (assembly.mesh.ngllz != ngll || assembly.mesh.ngllx != ngll) { +// throw std::runtime_error("Number of quadrature points not supported"); +// } +// return; +// } + +// void operator()() const { +// const auto buffer = assembly.fields.buffer; + +// const int nspec = assembly.mesh.nspec; +// const int ngllz = assembly.mesh.ngllz; +// const int ngllx = assembly.mesh.ngllx; + +// const auto elements = +// assembly.properties.get_elements_on_device(medium_tag, property_tag); + +// const int nelements = elements.extent(0); + +// if (nelements == 0) { +// return; +// } + +// using PointFieldType = +// specfem::point::field; + +// using simd = specfem::datatype::simd; +// constexpr int simd_size = simd::size(); + +// using ParallelConfig = specfem::parallel_config::default_chunk_config< +// specfem::dimension::type::dim2, simd, Kokkos::DefaultExecutionSpace>; + +// using ChunkPolicyType = specfem::policy::element_chunk; + +// ChunkPolicyType chunk_policy(elements, ngllz, ngllx); + +// Kokkos::parallel_for( +// "specfem::domain::impl::kernels::elements::compute_mass_matrix", +// static_cast( +// chunk_policy), +// KOKKOS_CLASS_LAMBDA(const typename ChunkPolicyType::member_type +// &team) { +// for (int tile = 0; tile < ChunkPolicyType::tile_size * simd_size; +// tile += ChunkPolicyType::chunk_size * simd_size) { +// const int starting_element_index = +// team.league_rank() * ChunkPolicyType::tile_size * simd_size + +// tile; + +// if (starting_element_index >= nelements) { +// break; +// } + +// const auto iterator = +// chunk_policy.league_iterator(starting_element_index); + +// Kokkos::parallel_for( +// Kokkos::TeamThreadRange(team, iterator.chunk_size()), +// [&](const int i) { +// const auto iterator_index = iterator(i); +// const auto index = iterator_index.index; + +// PointFieldType field; + +// specfem::compute::load_on_device(index, buffer, field); + +// for (int icomponent = 0; +// icomponent < field_parameters::num_components; +// icomponent++) { +// wavefield_on_entire_grid(index.ispec, index.iz, index.ix, +// icomponent) = field(icomponent); +// } +// }); +// } +// }); + +// return; +// } + +// private: +// const specfem::compute::assembly assembly; +// Kokkos::View +// wavefield_on_entire_grid; +// }; + +// template +// class helper { +// public: +// constexpr static auto medium_tag = specfem::element::medium_tag::acoustic; +// constexpr static auto property_tag = PropertyTag; +// constexpr static auto component = Component; +// constexpr static auto ngll = NGLL; +// using field_parameters = +// field_type_parameters; +// helper(specfem::compute::assembly assembly, +// Kokkos::View +// wavefield_on_entire_grid) +// : assembly(assembly), +// wavefield_on_entire_grid(wavefield_on_entire_grid) { +// if (assembly.mesh.ngllz != ngll || assembly.mesh.ngllx != ngll) { +// throw std::runtime_error("Number of quadrature points not supported"); +// } +// } + +// void operator()() const { +// const auto buffer = assembly.fields.buffer; + +// const int nspec = assembly.mesh.nspec; +// const int ngllz = assembly.mesh.ngllz; +// const int ngllx = assembly.mesh.ngllx; + +// const auto elements = +// assembly.properties.get_elements_on_device(medium_tag, property_tag); +// const int nelements = elements.extent(0); + +// if (nelements == 0) { +// return; +// } + +// constexpr auto num_components = field_parameters::num_components; + +// using simd = specfem::datatype::simd; +// constexpr int simd_size = simd::size(); +// using ParallelConfig = specfem::parallel_config::default_chunk_config< +// specfem::dimension::type::dim2, simd, Kokkos::DefaultExecutionSpace>; + +// using ChunkElementFieldType = specfem::chunk_element::field< +// ParallelConfig::chunk_size, ngll, specfem::dimension::type::dim2, +// medium_tag, specfem::kokkos::DevScratchSpace, +// Kokkos::MemoryTraits, +// field_parameters::store_displacement, +// field_parameters::store_velocity, +// field_parameters::store_acceleration, +// field_parameters::store_mass_matrix, false>; + +// using QuadratureType = specfem::element::quadrature< +// ngll, specfem::dimension::type::dim2, +// specfem::kokkos::DevScratchSpace, +// Kokkos::MemoryTraits, true, false>; + +// using PointPropertyType = +// specfem::point::properties; + +// using PointFieldDerivativesType = +// specfem::point::field_derivatives; + +// using ChunkPolicyType = specfem::policy::element_chunk; + +// int scratch_size = +// ChunkElementFieldType::shmem_size() + QuadratureType::shmem_size(); +// ChunkPolicyType chunk_policy(elements, ngllz, ngllx); + +// Kokkos::parallel_for( +// "compute_wavefield", +// chunk_policy.set_scratch_size(0, Kokkos::PerTeam(scratch_size)), +// KOKKOS_CLASS_LAMBDA(const typename ChunkPolicyType::member_type +// &team) { +// QuadratureType quadrature(team); +// ChunkElementFieldType field(team); + +// specfem::compute::load_on_device(team, assembly.mesh.quadratures, +// quadrature); + +// for (int tile = 0; tile < ChunkPolicyType::tile_size * simd_size; +// tile += ChunkPolicyType::chunk_size * simd_size) { +// const int starting_element_index = +// team.league_rank() * ChunkPolicyType::tile_size * simd_size + +// tile; + +// if (starting_element_index >= nelements) { +// break; +// } + +// const auto iterator = +// chunk_policy.league_iterator(starting_element_index); +// specfem::compute::load_on_device(team, iterator, buffer, field); +// team.team_barrier(); + +// const auto &active_field = [&]() { +// if constexpr (Component == +// specfem::wavefield::component::displacement) { +// return field.displacement; +// } else if constexpr (Component == +// specfem::wavefield::component::velocity) { +// return field.velocity; +// } else if constexpr (Component == +// specfem::wavefield::component:: +// acceleration) { +// return field.acceleration; +// } else { +// static_assert("component not supported"); +// } +// }(); + +// specfem::algorithms::gradient( +// team, iterator, assembly.partial_derivatives, +// quadrature.hprime_gll, active_field, +// [&](const typename ChunkPolicyType::iterator_type::index_type +// &iterator_index, +// const typename PointFieldDerivativesType::ViewType &du) { +// PointPropertyType point_property; + +// specfem::compute::load_on_device(iterator_index.index, +// assembly.properties, +// point_property); + +// PointFieldDerivativesType field_derivatives(du); + +// auto stress = specfem::medium::compute_stress( +// point_property, field_derivatives); + +// for (int icomponent = 0; icomponent < num_components; +// icomponent++) { +// wavefield_on_entire_grid( +// iterator_index.index.ispec, iterator_index.index.iz, +// iterator_index.index.ix, icomponent) = +// stress.T(icomponent, 0); +// } +// }); +// } +// }); + +// return; +// } + +// private: +// const specfem::compute::assembly assembly; +// Kokkos::View +// wavefield_on_entire_grid; +// }; +// } // namespace impl diff --git a/src/plotter/plot_wavefield.cpp b/src/plotter/plot_wavefield.cpp index 581fbe4b..dafd5c0a 100644 --- a/src/plotter/plot_wavefield.cpp +++ b/src/plotter/plot_wavefield.cpp @@ -130,6 +130,8 @@ vtkSmartPointer get_wavefield_on_vtk_grid( return specfem::wavefield::component::velocity; } else if (display_component == specfem::display::wavefield::acceleration) { return specfem::wavefield::component::acceleration; + } else if (display_component == specfem::display::wavefield::pressure) { + return specfem::wavefield::component::pressure; } else { throw std::runtime_error("Unsupported component"); } @@ -173,11 +175,17 @@ vtkSmartPointer get_wavefield_on_vtk_grid( points->InsertNextPoint(coordinates(0, icell, z_index[i], x_index[i]), coordinates(1, icell, z_index[i], x_index[i]), 0.0); - scalars->InsertNextValue( - std::sqrt((wavefield(icell, z_index[i], x_index[i], 0) * - wavefield(icell, z_index[i], x_index[i], 0)) + - (wavefield(icell, z_index[i], x_index[i], 1) * - wavefield(icell, z_index[i], x_index[i], 1)))); + if (component == specfem::wavefield::component::pressure) { + scalars->InsertNextValue( + std::sqrt(wavefield(icell, z_index[i], x_index[i], 0) * + wavefield(icell, z_index[i], x_index[i], 0))); + } else { + scalars->InsertNextValue( + std::sqrt((wavefield(icell, z_index[i], x_index[i], 0) * + wavefield(icell, z_index[i], x_index[i], 0)) + + (wavefield(icell, z_index[i], x_index[i], 1) * + wavefield(icell, z_index[i], x_index[i], 1)))); + } } auto quad = vtkSmartPointer::New(); for (int i = 0; i < cell_points; ++i) { @@ -264,7 +272,7 @@ void specfem::plotter::plot_wavefield::plot() { // Create a renderer auto renderer = vtkSmartPointer::New(); renderer->AddActor(material_actor); - renderer->AddActor(outlineActor); + // renderer->AddActor(outlineActor); renderer->AddActor(actor); renderer->SetBackground(colors->GetColor3d("White").GetData()); renderer->ResetCamera(); From 9bb6c3f96709395355655b8ca6c9eabcbf2aebe3 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Mon, 25 Nov 2024 10:40:08 -0500 Subject: [PATCH 32/53] Updated the Documentation of the IO part of the IO --- docs/api/IO/Libraries/index.rst | 1 + docs/api/IO/index.rst | 14 +++++++++++++- docs/api/sources/index.rst | 5 ----- .../tutorials/tutorial1/Chapter11/index.rst | 2 +- .../tutorials/tutorial1/Chapter2/index.rst | 2 +- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/docs/api/IO/Libraries/index.rst b/docs/api/IO/Libraries/index.rst index 887b2f8f..78332661 100644 --- a/docs/api/IO/Libraries/index.rst +++ b/docs/api/IO/Libraries/index.rst @@ -39,6 +39,7 @@ The snippet below shows how to use these modules to write and read a Kokkos::Vie .. toctree:: :maxdepth: 1 + sources/index mesh/index ASCII/index HDF5/index diff --git a/docs/api/IO/index.rst b/docs/api/IO/index.rst index b084713e..c9f5d592 100644 --- a/docs/api/IO/index.rst +++ b/docs/api/IO/index.rst @@ -2,10 +2,22 @@ Input/Output modules ==================== +There are three high-level functions that are essential for the SPECFEM++ +codebase: :cpp:function:`specfem::IO::mesh::read_mesh`, +:cpp:function:`specfem::IO::sources::read_sources`, and +:cpp:function:`specfem::IO::receivers::read_receivers`. These functions are +used to read the mesh, sources and receivers from disk. The undelying +implementations are not expose to the user. Currently supporte +formats for the reading of the mesh is binary, and for sources and receivers it +is yaml. + +The slightly-lower level functions to read and write data to and from disk are +exposed through the following abstractions. + .. toctree:: :maxdepth: 2 - fortran_io Libraries/index + fortran_io writer/index reader/index diff --git a/docs/api/sources/index.rst b/docs/api/sources/index.rst index f6937bc9..460b2da0 100644 --- a/docs/api/sources/index.rst +++ b/docs/api/sources/index.rst @@ -19,8 +19,3 @@ Types of sources force_source moment_tensor_source - -Auxiliary functions -------------------- - -.. doxygenfunction:: specfem::sources::read_sources diff --git a/docs/developer_documentation/tutorials/tutorial1/Chapter11/index.rst b/docs/developer_documentation/tutorials/tutorial1/Chapter11/index.rst index b3a4a5e8..b9823d04 100644 --- a/docs/developer_documentation/tutorials/tutorial1/Chapter11/index.rst +++ b/docs/developer_documentation/tutorials/tutorial1/Chapter11/index.rst @@ -29,7 +29,7 @@ Finally, we have all the components that we need to put together to create a com specfem::mesh::mesh mesh("OUTPUT_FILES/database.bin", mpi); // Read the sources - const auto sources = specfem::sources::read_sources( + const auto sources = specfem::IO::sources::read_sources( "OUTPUT_FILES/sources.yaml", simulation_params.nsteps, simulation_params.t0, diff --git a/docs/developer_documentation/tutorials/tutorial1/Chapter2/index.rst b/docs/developer_documentation/tutorials/tutorial1/Chapter2/index.rst index 125bea71..5c6857ca 100644 --- a/docs/developer_documentation/tutorials/tutorial1/Chapter2/index.rst +++ b/docs/developer_documentation/tutorials/tutorial1/Chapter2/index.rst @@ -61,7 +61,7 @@ Next we will read the sources and receivers generated in :ref:`Chapter1 Date: Mon, 25 Nov 2024 11:28:40 -0500 Subject: [PATCH 33/53] Fixed pressure seismograms | Added tests --- include/enumerations/wavefield.hpp | 9 ++ .../acoustic_isotropic2d.hpp | 30 ++-- include/medium/compute_wavefield.hpp | 43 +++++- .../elastic_isotropic2d.hpp | 32 ++--- .../compute_wavefield/compute_wavefield.cpp | 13 +- .../compute_wavefield/generate_data.hpp | 54 +------- .../compute_wavefield/test_helper.hpp | 130 +++++++++++++++++- 7 files changed, 221 insertions(+), 90 deletions(-) diff --git a/include/enumerations/wavefield.hpp b/include/enumerations/wavefield.hpp index 2690f1f3..186ba500 100644 --- a/include/enumerations/wavefield.hpp +++ b/include/enumerations/wavefield.hpp @@ -43,5 +43,14 @@ class wavefield +class wavefield { +public: + static constexpr auto dimension = specfem::dimension::type::dim2; + static constexpr auto component = specfem::wavefield::component::pressure; + static constexpr int num_components = 1; +}; + } // namespace wavefield } // namespace specfem diff --git a/include/medium/acoustic_isotropic2d/acoustic_isotropic2d.hpp b/include/medium/acoustic_isotropic2d/acoustic_isotropic2d.hpp index 348c1738..30f6b733 100644 --- a/include/medium/acoustic_isotropic2d/acoustic_isotropic2d.hpp +++ b/include/medium/acoustic_isotropic2d/acoustic_isotropic2d.hpp @@ -33,22 +33,20 @@ impl_compute_stress( return { T }; } -template = 0> -KOKKOS_FUNCTION void -impl_compute_wavefield(const MemberType &team, const IteratorType &iterator, - const specfem::compute::assembly &assembly, - const QuadratureType &quadrature, - const ChunkFieldType &field, - const specfem::wavefield::component wavefield_component, - WavefieldViewType wavefield) { +template +KOKKOS_FUNCTION void impl_compute_wavefield( + const std::integral_constant, + const std::integral_constant, + const std::integral_constant, + const MemberType &team, const IteratorType &iterator, + const specfem::compute::assembly &assembly, + const QuadratureType &quadrature, const ChunkFieldType &field, + const specfem::wavefield::component wavefield_component, + WavefieldViewType wavefield) { using FieldDerivativesType = specfem::point::field_derivatives( - team, iterator, assembly, quadrature, field, wavefield_component, - wavefield_on_entire_grid); + using dimension_dispatch = + std::integral_constant; + using medium_dispatch = + std::integral_constant; + using property_dispatch = + std::integral_constant; + + impl_compute_wavefield(dimension_dispatch(), medium_dispatch(), + property_dispatch(), team, iterator, assembly, + quadrature, field, wavefield_component, + wavefield_on_entire_grid); } } // namespace medium diff --git a/include/medium/elastic_isotropic2d/elastic_isotropic2d.hpp b/include/medium/elastic_isotropic2d/elastic_isotropic2d.hpp index bc6d4b07..69257fb7 100644 --- a/include/medium/elastic_isotropic2d/elastic_isotropic2d.hpp +++ b/include/medium/elastic_isotropic2d/elastic_isotropic2d.hpp @@ -49,22 +49,20 @@ impl_compute_stress( return { T }; } -template = 0> -KOKKOS_FUNCTION void -impl_compute_wavefield(const MemberType &team, const IteratorType &iterator, - const specfem::compute::assembly &assembly, - const QuadratureType &quadrature, - const ChunkFieldType &field, - const specfem::wavefield::component wavefield_component, - WavefieldViewType wavefield) { +template +KOKKOS_FUNCTION void impl_compute_wavefield( + const std::integral_constant, + const std::integral_constant, + const std::integral_constant, + const MemberType &team, const IteratorType &iterator, + const specfem::compute::assembly &assembly, + const QuadratureType &quadrature, const ChunkFieldType &field, + const specfem::wavefield::component wavefield_component, + WavefieldViewType wavefield) { using FieldDerivativesType = specfem::point::field_derivatives(assembly); } catch (std::exception &e) { std::ostringstream message; - message << "Error in computing displacement wavefield: \n\t" << e.what(); + message << "Error in computing velocity wavefield: \n\t" << e.what(); throw std::runtime_error(message.str()); } @@ -79,7 +79,16 @@ void test_compute_wavefield(specfem::compute::assembly &assembly) { specfem::wavefield::type::forward>(assembly); } catch (std::exception &e) { std::ostringstream message; - message << "Error in computing displacement wavefield: \n\t" << e.what(); + message << "Error in computing acceleration wavefield: \n\t" << e.what(); + throw std::runtime_error(message.str()); + } + + try { + test_compute_wavefield(assembly); + } catch (std::exception &e) { + std::ostringstream message; + message << "Error in computing pressure wavefield: \n\t" << e.what(); throw std::runtime_error(message.str()); } } diff --git a/tests/unit-tests/assembly/compute_wavefield/generate_data.hpp b/tests/unit-tests/assembly/compute_wavefield/generate_data.hpp index 3f6967a2..893109d3 100644 --- a/tests/unit-tests/assembly/compute_wavefield/generate_data.hpp +++ b/tests/unit-tests/assembly/compute_wavefield/generate_data.hpp @@ -8,48 +8,6 @@ #include "point/coordinates.hpp" #include "point/field.hpp" -namespace impl { -template -class field_type_parameters; - -template -class field_type_parameters { -public: - constexpr static auto medium_tag = MediumTag; - constexpr static auto store_displacement = true; - constexpr static auto store_velocity = false; - constexpr static auto store_acceleration = false; - constexpr static auto store_mass_matrix = false; - constexpr static auto num_components = 2; -}; - -template -class field_type_parameters { -public: - constexpr static auto medium_tag = MediumTag; - constexpr static auto store_displacement = false; - constexpr static auto store_velocity = true; - constexpr static auto store_acceleration = false; - constexpr static auto store_mass_matrix = false; - constexpr static auto num_components = 2; -}; - -template -class field_type_parameters { -public: - constexpr static auto medium_tag = MediumTag; - constexpr static auto store_displacement = false; - constexpr static auto store_velocity = false; - constexpr static auto store_acceleration = true; - constexpr static auto store_mass_matrix = false; - constexpr static auto num_components = 2; -}; -} // namespace impl - template @@ -63,18 +21,14 @@ void generate_data(specfem::compute::assembly &assembly, const auto elements = assembly.properties.get_elements_on_host(medium, property); - using field_parameters = impl::field_type_parameters; constexpr int num_components = specfem::element::attributes::components(); using PointFieldType = - specfem::point::field; + specfem::point::field; using IndexType = specfem::point::index; @@ -94,7 +48,9 @@ void generate_data(specfem::compute::assembly &assembly, PointFieldType point_field; for (int ic = 0; ic < num_components; ic++) { - point_field(ic) = 1.0; + point_field.displacement(ic) = 1.0; + point_field.velocity(ic) = 1.0; + point_field.acceleration(ic) = 1.0; } specfem::compute::store_on_host(index, point_field, field); diff --git a/tests/unit-tests/assembly/compute_wavefield/test_helper.hpp b/tests/unit-tests/assembly/compute_wavefield/test_helper.hpp index d1af6d9e..7a174737 100644 --- a/tests/unit-tests/assembly/compute_wavefield/test_helper.hpp +++ b/tests/unit-tests/assembly/compute_wavefield/test_helper.hpp @@ -53,7 +53,71 @@ class test_helper 1.0e-4) { std::ostringstream message; - message << "Error in wavefield computation: \n" + message << "Error in elastic wavefield computation: \n" + << " ispec = " << ispec << "\n" + << " iz = " << iz << "\n" + << " ix = " << ix << "\n" + << " component = " << ic << "\n" + << " computed = " << computed << "\n" + << " expected = " << expected; + throw std::runtime_error(message.str()); + } + } + } + } + } + +private: + const int ispec; + const Kokkos::View + &wavefield; + specfem::compute::assembly &assembly; +}; + +template <> +class test_helper { +public: + test_helper(const int ispec, + const Kokkos::View &wavefield, + specfem::compute::assembly &assembly) + : ispec(ispec), wavefield(wavefield), assembly(assembly) {} + + void test() { + + constexpr static int num_components = specfem::wavefield::wavefield< + specfem::dimension::type::dim2, + specfem::wavefield::component::pressure>::num_components; + + const int ngllz = assembly.mesh.ngllz; + const int ngllx = assembly.mesh.ngllx; + + using PointProperties = specfem::point::properties< + specfem::dimension::type::dim2, specfem::element::medium_tag::elastic, + specfem::element::property_tag::isotropic, false>; + + for (int iz = 0; iz < ngllz; iz++) { + for (int ix = 0; ix < ngllx; ix++) { + + const specfem::point::index + index(ispec, iz, ix); + + PointProperties point_properties; + specfem::compute::load_on_host(index, assembly.properties, + point_properties); + + for (int ic = 0; ic < num_components; ic++) { + const auto computed = + wavefield(ispec, iz, ix, ic) / + ((point_properties.lambdaplus2mu + point_properties.lambda) / + 2.0); + const auto expected = 0.0; + + if (std::abs(computed - expected) > 1.0e-4) { + std::ostringstream message; + message << "Error in elastic wavefield computation: \n" << " ispec = " << ispec << "\n" << " iz = " << iz << "\n" << " ix = " << ix << "\n" @@ -115,7 +179,69 @@ class test_helper 1.0e-4) { std::ostringstream message; - message << "Error in wavefield computation: \n" + message << "Error in acoustic wavefield computation: \n" + << " ispec = " << ispec << "\n" + << " iz = " << iz << "\n" + << " ix = " << ix << "\n" + << " component = " << ic << "\n" + << " computed = " << computed << "\n" + << " expected = " << expected; + throw std::runtime_error(message.str()); + } + } + } + } + } + +private: + const int ispec; + const Kokkos::View + &wavefield; + specfem::compute::assembly &assembly; +}; + +template <> +class test_helper { + +public: + test_helper(const int ispec, + const Kokkos::View &wavefield, + specfem::compute::assembly &assembly) + : ispec(ispec), wavefield(wavefield), assembly(assembly) {} + + void test() { + + constexpr static int num_components = specfem::wavefield::wavefield< + specfem::dimension::type::dim2, + specfem::wavefield::component::pressure>::num_components; + + const int ngllz = assembly.mesh.ngllz; + const int ngllx = assembly.mesh.ngllx; + + using PointProperties = specfem::point::properties< + specfem::dimension::type::dim2, specfem::element::medium_tag::acoustic, + specfem::element::property_tag::isotropic, false>; + + for (int iz = 0; iz < ngllz; iz++) { + for (int ix = 0; ix < ngllx; ix++) { + + const specfem::point::index + index(ispec, iz, ix); + + PointProperties point_properties; + specfem::compute::load_on_host(index, assembly.properties, + point_properties); + + for (int ic = 0; ic < num_components; ic++) { + const auto computed = wavefield(ispec, iz, ix, ic); + const auto expected = -1.0; + + if (std::abs(computed - expected) > 1.0e-4) { + std::ostringstream message; + message << "Error in acoustic wavefield computation: \n" << " ispec = " << ispec << "\n" << " iz = " << iz << "\n" << " ix = " << ix << "\n" From 0d86efa6c19770a495c276c0bba8e147a772faa5 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Mon, 25 Nov 2024 11:42:45 -0500 Subject: [PATCH 34/53] Fixed the cflags in the CMAKE for params_reader to allow for safe compilation with clang. --- .github/pull_request_template.md | 16 +++++------ include/IO/ASCII/impl/datasetbase.hpp | 8 +++--- include/parameter_parser/setup.hpp | 4 +-- meshfem2d/CMakeLists.txt | 38 +++++++++++++++++++++++++++ src/parameter_parser/setup.cpp | 2 +- src/specfem2d.cpp | 16 +++++------ 6 files changed, 61 insertions(+), 23 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index ae59fe3e..da5ef804 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,6 +1,6 @@ # Description -Please describe the changes/features in this pull request. +Please describe the changes/features in this pull request. # Issue Number @@ -8,11 +8,11 @@ If there is an issue created for these changes, link it here # Checklist -Please make sure to check developer documentation on specfem docs. +Please make sure to check developer documentation on specfem docs. -[] I ran the code through pre-commit to check style -[] My code passes all the integration tests -[] I have added sufficient unittests to test my changes -[] I have added/updated documentation for the changes I am proposing -[] I have updated CMakeLists to ensure my code builds -[] My code builds across all platforms +- [ ] I ran the code through pre-commit to check style +- [ ] My code passes all the integration tests +- [ ] I have added sufficient unittests to test my changes +- [ ] I have added/updated documentation for the changes I am proposing +- [ ] I have updated CMakeLists to ensure my code builds +- [ ] My code builds across all platforms diff --git a/include/IO/ASCII/impl/datasetbase.hpp b/include/IO/ASCII/impl/datasetbase.hpp index 9026bc73..d3101d43 100644 --- a/include/IO/ASCII/impl/datasetbase.hpp +++ b/include/IO/ASCII/impl/datasetbase.hpp @@ -36,7 +36,7 @@ template <> class DatasetBase { boost::filesystem::remove(metadata_path); } - std::ofstream metadata(metadata_path); + std::ofstream metadata(metadata_path.string()); if (!metadata.is_open()) { std::ostringstream oss; oss << "ERROR : Could not open file " << metadata_path; @@ -55,7 +55,7 @@ template <> class DatasetBase { template void write(const value_type *data) const { - std::ofstream file(file_path); + std::ofstream file(file_path.string()); if (!file.is_open()) { std::ostringstream oss; oss << "ERROR : Could not open file " << file_path; @@ -97,7 +97,7 @@ template <> class DatasetBase { oss << "ERROR : Metadata file " << metadata_path << " does not exist"; throw std::runtime_error(oss.str()); } - std::ifstream metadata(metadata_path); + std::ifstream metadata(metadata_path.string()); if (!metadata.is_open()) { std::ostringstream oss; oss << "ERROR : Could not open file " << metadata_path; @@ -143,7 +143,7 @@ template <> class DatasetBase { } template void read(value_type *data) const { - std::ifstream file(file_path); + std::ifstream file(file_path.string()); if (!file.is_open()) { std::ostringstream oss; oss << "ERROR : Could not open file " << file_path; diff --git a/include/parameter_parser/setup.hpp b/include/parameter_parser/setup.hpp index 678ee67f..1814e73b 100644 --- a/include/parameter_parser/setup.hpp +++ b/include/parameter_parser/setup.hpp @@ -74,8 +74,8 @@ class setup { /** * @brief Log the header and description of the simulation */ - std::string print_header( - const std::chrono::time_point now); + std::string + print_header(const std::chrono::time_point now); /** * @brief Get delta time value diff --git a/meshfem2d/CMakeLists.txt b/meshfem2d/CMakeLists.txt index 92c14deb..7cbff08c 100644 --- a/meshfem2d/CMakeLists.txt +++ b/meshfem2d/CMakeLists.txt @@ -11,8 +11,46 @@ unset(WITH_SCOTCH) enable_language(Fortran) enable_language(C) +# Set the C compiler set(FCFLAGS_f90 -g -O2 -fbacktrace) +# Check if CFLAGS is defined +if (DEFINED ENV{CFLAGS}) + set(CFLAGS "$ENV{CFLAGS}") +endif() + +message("-- CFLAGS: ${CFLAGS}") + +# Check if MacOS +if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(MACOSX TRUE) + message("-- macOS detected") +endif() + +# Check if Clang +if (CMAKE_C_COMPILER_ID MATCHES "Clang") + set(CLANG TRUE) + message("-- Detected usage of clang on macOS") +endif() + +# Fix for macos and clang include files... sometimes I hate mac. +if (MACOSX AND CLANG) + message("-- Fixing include files for macOS and Clang") + set (FCFLAGS_f90 "${FCFLAGS_f90}") + # In the future, we can use the following line to add the flags to the compiler + # add_compile_options($<$:-isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk>) + # set (CFLAGS "${CFLAGS}) + # Right now we can use the following line to add the flags to the compiler + if (DEFINED CFLAGS) + set(CFLAGS "$ENV{CFLAGS} -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk") + else() + set(CFLAGS "-isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk") + endif() +endif() + +message("-- CFLAGS: ${CFLAGS}") + + ## ========= MACROS ========= # define macro wrapper on custom command macro(build_fortran_command module_name dependecies) diff --git a/src/parameter_parser/setup.cpp b/src/parameter_parser/setup.cpp index 46db13dc..5c5fa9ab 100644 --- a/src/parameter_parser/setup.cpp +++ b/src/parameter_parser/setup.cpp @@ -212,7 +212,7 @@ specfem::runtime_configuration::setup::setup(const std::string ¶meter_file, } std::string specfem::runtime_configuration::setup::print_header( - const std::chrono::time_point now) { + const std::chrono::time_point now) { std::ostringstream message; diff --git a/src/specfem2d.cpp b/src/specfem2d.cpp index 7834715d..fbafb110 100644 --- a/src/specfem2d.cpp +++ b/src/specfem2d.cpp @@ -21,14 +21,14 @@ #include // Specfem2d driver -std::string print_end_message( - std::chrono::time_point start_time, - std::chrono::duration solver_time) { +std::string +print_end_message(std::chrono::time_point start_time, + std::chrono::duration solver_time) { std::ostringstream message; // current date/time based on current system - const auto now = std::chrono::high_resolution_clock::now(); + const auto now = std::chrono::system_clock::now(); - std::time_t c_now = std::chrono::high_resolution_clock::to_time_t(now); + std::time_t c_now = std::chrono::system_clock::to_time_t(now); std::chrono::duration diff = now - start_time; @@ -87,7 +87,7 @@ void execute(const std::string ¶meter_file, const std::string &default_file, // -------------------------------------------------------------- // Read parameter file // -------------------------------------------------------------- - auto start_time = std::chrono::high_resolution_clock::now(); + auto start_time = std::chrono::system_clock::now(); specfem::runtime_configuration::setup setup(parameter_file, default_file); const auto [database_filename, source_filename] = setup.get_databases(); mpi->cout(setup.print_header(start_time)); @@ -190,9 +190,9 @@ void execute(const std::string ¶meter_file, const std::string &default_file, mpi->cout("Executing time loop:"); mpi->cout("-------------------------------"); - const auto solver_start_time = std::chrono::high_resolution_clock::now(); + const auto solver_start_time = std::chrono::system_clock::now(); solver->run(); - const auto solver_end_time = std::chrono::high_resolution_clock::now(); + const auto solver_end_time = std::chrono::system_clock::now(); std::chrono::duration solver_time = solver_end_time - solver_start_time; From e9f583bb2f80d54ff86b676154ec48aa256fdceb Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Mon, 25 Nov 2024 11:48:47 -0500 Subject: [PATCH 35/53] Added compiler line to the docs "apple clang" --- docs/getting_started/index.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/getting_started/index.rst b/docs/getting_started/index.rst index 522facdb..137f806f 100644 --- a/docs/getting_started/index.rst +++ b/docs/getting_started/index.rst @@ -51,6 +51,11 @@ The following table lists the versions of compilers that are supported by SPECFE * Not Tested * 8.0.0, latest + * * Apple Clang + * 16.0.0 (MacOS Sequoia) + * Not Tested + * 8.0.0, latest + * * NVC++ * Not Tested * Not Tested From 3a3a4f02333de95f1323640316933d825bf9d4be Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Mon, 25 Nov 2024 14:24:06 -0500 Subject: [PATCH 36/53] Added display section to docs --- .../simulation_setup.rst | 123 ++++++++++++++++++ 1 file changed, 123 insertions(+) diff --git a/docs/parameter_documentation/simulation_setup.rst b/docs/parameter_documentation/simulation_setup.rst index 6fee2389..40c99ffe 100644 --- a/docs/parameter_documentation/simulation_setup.rst +++ b/docs/parameter_documentation/simulation_setup.rst @@ -241,6 +241,60 @@ Parameter definitions **documentation** : Output folder for the wavefield +**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display`` [optional] +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +**default value** : None + +**possible values** : [YAML Node] + +**documentation** : Plot the wavefield during the forward simulation + +**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.format`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +**default value** : None + +**possible values** : [PNG, JPG, on_screen] + +**documentation** : Output format for resulting plots + +**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.directory`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +**default value** : None + +**possible values** : [string] + +**documentation** : Output folder for the plots (not applicable for on_screen) + +**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.component`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +**default value** : None + +**possible values** : [displacement, velocity, acceleration, pressure] + +**documentation** : Component of the wavefield to be plotted + +**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.wavefield_type`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +**default value** : None + +**possible values** : [forward] + +**documentation** : Type of wavefield to be plotted + +**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.time_interval`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +**default value** : None + +**possible values** : [int] + +**documentation** : Time step interval for plotting the wavefield + .. admonition:: Example for defining a forward simulation node .. code:: yaml @@ -256,6 +310,14 @@ Parameter definitions format: HDF5 directory: /path/to/output/folder + display: + format: PNG + directory: /path/to/output/folder + component: displacement + wavefield_type: forward + time_interval: 10 + + .. Note:: Atlease one writer node should be defined in the forward simulation node. @@ -368,6 +430,60 @@ Parameter definitions **documentation** : Output folder for the kernels +**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display`` [optional] +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +**default value** : None + +**possible values** : [YAML Node] + +**documentation** : Plot the wavefield during the forward simulation + +**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.format`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +**default value** : None + +**possible values** : [PNG, JPG, on_screen] + +**documentation** : Output format for resulting plots + +**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.directory`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +**default value** : None + +**possible values** : [string] + +**documentation** : Output folder for the plots (not applicable for on_screen) + +**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.component`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +**default value** : None + +**possible values** : [displacement, velocity, acceleration, pressure] + +**documentation** : Component of the wavefield to be plotted + +**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.wavefield_type`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +**default value** : None + +**possible values** : [adjoint, backward] + +**documentation** : Type of wavefield to be plotted + +**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.time_interval`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +**default value** : None + +**possible values** : [int] + +**documentation** : Time step interval for plotting the wavefield + .. admonition:: Example for defining a combined simulation node .. code:: yaml @@ -385,6 +501,13 @@ Parameter definitions format: HDF5 directory: /path/to/output/folder + display: + format: PNG + directory: /path/to/output/folder + component: displacement + wavefield_type: adjoint + time_interval: 10 + .. Note:: Exactly one of forward or combined simulation nodes should be defined. From 009784a768fb0c1d3973f7568e7564103d587c78 Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Mon, 25 Nov 2024 15:15:37 -0500 Subject: [PATCH 37/53] Fixed indentation issues --- docs/parameter_documentation/simulation_setup.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/parameter_documentation/simulation_setup.rst b/docs/parameter_documentation/simulation_setup.rst index 40c99ffe..cc3aa8b7 100644 --- a/docs/parameter_documentation/simulation_setup.rst +++ b/docs/parameter_documentation/simulation_setup.rst @@ -242,7 +242,7 @@ Parameter definitions **documentation** : Output folder for the wavefield **Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display`` [optional] -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +******************************************************************************************* **default value** : None From 0cddbd02adba8b8d2d0b2caac0e0e47bded605f9 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Mon, 25 Nov 2024 15:39:59 -0500 Subject: [PATCH 38/53] Updated wrapping in getting_started.md in the docs and moved read receivers c/hpp --- docs/getting_started/index.rst | 29 +++++++++++++++----- include/receiver/read_receiver.hpp | 26 ------------------ src/receiver/read_receiver.cpp | 44 ------------------------------ 3 files changed, 22 insertions(+), 77 deletions(-) delete mode 100644 include/receiver/read_receiver.hpp delete mode 100644 src/receiver/read_receiver.cpp diff --git a/docs/getting_started/index.rst b/docs/getting_started/index.rst index 522facdb..da835d82 100644 --- a/docs/getting_started/index.rst +++ b/docs/getting_started/index.rst @@ -71,7 +71,9 @@ Dependencies .. note:: - If any of the following dependencies are not found in your ``PATH``, the build process will download and install them automatically. This will increase the build time and does require an active internet connection. + If any of the following dependencies are not found in your ``PATH``, + the build process will download and install them automatically. This will + increase the build time and does require an active internet connection. * Kokkos: required * Boost: required @@ -94,7 +96,9 @@ Get the latest version of the package: Build recipes ------------- -SPECFEM++ inherits several architecure specific cmake configuration keywords from `Kokkos `_. Below are the recommended build recipes for different architectures: +SPECFEM++ inherits several architecure specific cmake configuration keywords +from `Kokkos `_. +Below are the recommended build recipes for different architectures: * CPU Serial version @@ -122,12 +126,18 @@ SPECFEM++ inherits several architecure specific cmake configuration keywords fro .. note:: - Specify the architecture flag ``-D Kokkos_ARCH_`` based on the GPU architecture you are using. For example, for NVIDIA Ampere architecture, use ``-D Kokkos_ARCH_AMPERE80=ON``. See `Kokkos documentation `_ for more information. + Specify the architecture flag ``-D Kokkos_ARCH_`` based on + the GPU architecture you are using. For example, for NVIDIA Ampere + architecture, use ``-D Kokkos_ARCH_AMPERE80=ON``. See + `Kokkos documentation `_ + for more information. Adding SPECFEM to PATH ---------------------- -Finally, once compiled you could run SPECFEM++ from inside the build directory, by running the executible ``./specfem2d``. However, we recommend you add SPECFEM++ build directory to your ``PATH`` using +Finally, once compiled you could run SPECFEM++ from inside the build directory, +by running the executible ``./specfem2d``. However, we recommend you add +SPECFEM++ build directory to your ``PATH`` using .. code-block:: bash @@ -136,11 +146,15 @@ Finally, once compiled you could run SPECFEM++ from inside the build directory, Running the solver ------------------ -Lets run a simple example to test the installation. We will use the ``example\homogeneous-medium-flat-topography`` directory in the SPECFEM++ repository. The example directory contains a mesh of a homogeneous half-space with a single source and neumann boundary conditions. +Lets run a simple example to test the installation. We will use the +``example\homogeneous-medium-flat-topography`` directory in the SPECFEM++ +repository. The example directory contains a mesh of a homogeneous half-space +with a single source and neumann boundary conditions. .. note:: - A detailed description of the example can be found within :ref:`this cookbook ` + A detailed description of the example can be found within + :ref:`this cookbook ` .. code-block:: bash @@ -155,4 +169,5 @@ This will generate the mesh files. Next, we will run the solver using mkdir -p OUTPUT_FILES/results specfem2d -p specfem_config.yaml -This will run the solver and generate synthetic seismograms at the receiver locations specified in ``STATIONS`` file. +This will run the solver and generate synthetic seismograms at the receiver +locations specified in ``STATIONS`` file. diff --git a/include/receiver/read_receiver.hpp b/include/receiver/read_receiver.hpp deleted file mode 100644 index f939a99e..00000000 --- a/include/receiver/read_receiver.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef _READ_RECEIVER_HPP -#define _READ_RECEIVER_HPP - -#include "receiver.hpp" -#include "specfem_setup.hpp" -#include - -namespace specfem { -namespace receivers { -/** - * @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 receivers -} // namespace specfem - -#endif diff --git a/src/receiver/read_receiver.cpp b/src/receiver/read_receiver.cpp deleted file mode 100644 index 3b140957..00000000 --- a/src/receiver/read_receiver.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "receiver/interface.hpp" -#include "specfem_setup.hpp" -#include "utilities/interface.hpp" -#include "yaml-cpp/yaml.h" -#include -#include -#include -#include - -std::vector > -specfem::receivers::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; -} From 2c991e6197a5ffbf181aab7c329da4c24a50ad7b Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Mon, 25 Nov 2024 15:51:50 -0500 Subject: [PATCH 39/53] Fixed all files with reference to read receivers --- docs/api/IO/Libraries/sources/index.rst | 4 ++ include/IO/receivers/read_receiver.hpp | 26 +++++++++++ src/IO/receivers/read_receiver.cpp | 44 +++++++++++++++++++ src/specfem2d.cpp | 9 +--- tests/unit-tests/assembly/test_fixture.hpp | 4 +- .../Newmark/newmark_tests.cpp | 4 +- .../seismogram/acoustic/seismogram_tests.cpp | 3 +- .../seismogram/elastic/seismogram_tests.cpp | 3 +- 8 files changed, 84 insertions(+), 13 deletions(-) create mode 100644 docs/api/IO/Libraries/sources/index.rst create mode 100644 include/IO/receivers/read_receiver.hpp create mode 100644 src/IO/receivers/read_receiver.cpp diff --git a/docs/api/IO/Libraries/sources/index.rst b/docs/api/IO/Libraries/sources/index.rst new file mode 100644 index 00000000..162f970f --- /dev/null +++ b/docs/api/IO/Libraries/sources/index.rst @@ -0,0 +1,4 @@ +Source Reader +------------- + +.. doxygenfunction:: specfem::IO::sources::read_sources diff --git a/include/IO/receivers/read_receiver.hpp b/include/IO/receivers/read_receiver.hpp new file mode 100644 index 00000000..d9ab1cdb --- /dev/null +++ b/include/IO/receivers/read_receiver.hpp @@ -0,0 +1,26 @@ +#ifndef _READ_RECEIVER_HPP +#define _READ_RECEIVER_HPP + +#include "receiver.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/src/IO/receivers/read_receiver.cpp b/src/IO/receivers/read_receiver.cpp new file mode 100644 index 00000000..c4230475 --- /dev/null +++ b/src/IO/receivers/read_receiver.cpp @@ -0,0 +1,44 @@ +#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/specfem2d.cpp b/src/specfem2d.cpp index a2845ed9..362fcae8 100644 --- a/src/specfem2d.cpp +++ b/src/specfem2d.cpp @@ -1,13 +1,8 @@ #include "compute/interface.hpp" // #include "coupled_interface/interface.hpp" // #include "domain/interface.hpp" -#include "IO/mesh/fortran/read_boundaries.hpp" -#include "IO/mesh/fortran/read_elements.hpp" -#include "IO/mesh/fortran/read_interfaces.hpp" -#include "IO/mesh/fortran/read_material_properties.hpp" -#include "IO/mesh/fortran/read_mesh_database.hpp" -#include "IO/mesh/fortran/read_properties.hpp" #include "IO/mesh/read_mesh.hpp" +#include "IO/receivers/read_receivers.hpp" #include "kokkos_abstractions.h" #include "mesh/mesh.hpp" #include "parameter_parser/interface.hpp" @@ -119,7 +114,7 @@ void execute(const std::string ¶meter_file, const std::string &default_file, const auto stations_filename = setup.get_stations_file(); const auto angle = setup.get_receiver_angle(); - auto receivers = specfem::receivers::read_receivers(stations_filename, angle); + auto receivers = specfem::IO::read_receivers(stations_filename, angle); mpi->cout("Source Information:"); mpi->cout("-------------------------------"); diff --git a/tests/unit-tests/assembly/test_fixture.hpp b/tests/unit-tests/assembly/test_fixture.hpp index 75d0e59a..e0a87e00 100644 --- a/tests/unit-tests/assembly/test_fixture.hpp +++ b/tests/unit-tests/assembly/test_fixture.hpp @@ -2,6 +2,7 @@ #include "../MPI_environment.hpp" #include "IO/mesh/read_mesh.hpp" +#include "IO/receivers/read_receivers.hpp" #include "compute/assembly/assembly.hpp" #include "enumerations/specfem_enums.hpp" #include "mesh/mesh.hpp" @@ -151,8 +152,7 @@ class ASSEMBLY : public ::testing::Test { const auto [sources, t0] = specfem::sources::read_sources( sources_file, 0, 0, 0, specfem::simulation::type::forward); - const auto receivers = - specfem::receivers::read_receivers(stations_file, 0); + const auto receivers = specfem::IO::read_receivers(stations_file, 0); std::vector seismogram_types = { specfem::enums::seismogram::type::displacement diff --git a/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp b/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp index 97d0defd..367326c0 100644 --- a/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp +++ b/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp @@ -2,6 +2,7 @@ #include "../../MPI_environment.hpp" #include "../../utilities/include/interface.hpp" #include "IO/mesh/read_mesh.hpp" +#include "IO/receivers/read_receivers.hpp" #include "compute/interface.hpp" #include "constants.hpp" #include "domain/domain.hpp" @@ -197,8 +198,7 @@ TEST(DISPLACEMENT_TESTS, newmark_scheme_tests) { const auto stations_filename = setup.get_stations_file(); const auto angle = setup.get_receiver_angle(); - auto receivers = - specfem::receivers::read_receivers(stations_filename, angle); + auto receivers = specfem::IO::read_receivers(stations_filename, angle); std::cout << " Receiver information\n"; std::cout << "------------------------------" << std::endl; diff --git a/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp b/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp index 6cd5fafa..d2646944 100644 --- a/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp +++ b/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp @@ -3,6 +3,7 @@ // #include "../../utilities/include/compare_array.h" #include "IO/fortranio/interface.hpp" #include "IO/mesh/read_mesh.hpp" +#include "IO/receivers/read_receiver.hpp" #include "compute/interface.hpp" #include "constants.hpp" #include "domain/domain.hpp" @@ -97,7 +98,7 @@ TEST(SEISMOGRAM_TESTS, acoustic_seismograms_test) { const auto angle = setup.get_receiver_angle(); const auto stations_filename = setup.get_stations_file(); - auto receivers = specfem::receivers::read_receivers(stations_filename, angle); + auto receivers = specfem::IO::read_receivers(stations_filename, angle); const auto stypes = setup.get_seismogram_types(); specfem::compute::assembly assembly(mesh, quadratures, sources, receivers, diff --git a/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp b/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp index afe5f20c..915b5bd5 100644 --- a/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp +++ b/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp @@ -3,6 +3,7 @@ // #include "../../utilities/include/compare_array.h" #include "IO/fortranio/interface.hpp" #include "IO/mesh/read_mesh.hpp" +#include "IO/receivers/read_receiver.hpp" #include "compute/interface.hpp" #include "constants.hpp" #include "domain/domain.hpp" @@ -97,7 +98,7 @@ TEST(SEISMOGRAM_TESTS, elastic_seismograms_test) { const auto angle = setup.get_receiver_angle(); const auto stations_filename = setup.get_stations_file(); - auto receivers = specfem::receivers::read_receivers(stations_filename, angle); + auto receivers = specfem::IO::read_receivers(stations_filename, angle); const auto stypes = setup.get_seismogram_types(); specfem::compute::assembly assembly(mesh, quadratures, sources, receivers, From cf139600d7c8cc6ae12452c6ad30cf617cabccfe Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Mon, 25 Nov 2024 16:21:08 -0500 Subject: [PATCH 40/53] This commit finalizes the moving of the receiver reading to the IO module --- CMakeLists.txt | 8 ++++++-- .../receivers/{read_receiver.hpp => read_receivers.hpp} | 2 +- include/receiver/interface.hpp | 1 - .../receivers/{read_receiver.cpp => read_receivers.cpp} | 1 + tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp | 2 +- tests/unit-tests/seismogram/elastic/seismogram_tests.cpp | 2 +- 6 files changed, 10 insertions(+), 6 deletions(-) rename include/IO/receivers/{read_receiver.hpp => read_receivers.hpp} (95%) rename src/IO/receivers/{read_receiver.cpp => read_receivers.cpp} (97%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b087371..2c8a1b37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,7 +116,7 @@ add_library( src/IO/mesh/fortran/read_interfaces.cpp src/IO/mesh/fortran/read_properties.cpp src/IO/sources/read_sources.cpp - # src/IO/receivers/read_receivers.cpp + src/IO/receivers/read_receivers.cpp ) if (NOT HDF5_CXX_BUILD) @@ -149,6 +149,11 @@ target_link_libraries( source_class ) +target_link_libraries( + IO + receiver_class +) + add_library( point src/point/coordinates.cpp @@ -317,7 +322,6 @@ target_link_libraries( add_library( receiver_class src/receiver/receiver.cpp - src/receiver/read_receiver.cpp ) target_link_libraries( diff --git a/include/IO/receivers/read_receiver.hpp b/include/IO/receivers/read_receivers.hpp similarity index 95% rename from include/IO/receivers/read_receiver.hpp rename to include/IO/receivers/read_receivers.hpp index d9ab1cdb..7e7cf7e9 100644 --- a/include/IO/receivers/read_receiver.hpp +++ b/include/IO/receivers/read_receivers.hpp @@ -1,7 +1,7 @@ #ifndef _READ_RECEIVER_HPP #define _READ_RECEIVER_HPP -#include "receiver.hpp" +#include "receiver/interface.hpp" #include "specfem_setup.hpp" #include diff --git a/include/receiver/interface.hpp b/include/receiver/interface.hpp index 7c846f8e..7df8c490 100644 --- a/include/receiver/interface.hpp +++ b/include/receiver/interface.hpp @@ -1,7 +1,6 @@ #ifndef _RECEIVER_INTERFACE_HPP #define _RECEIVER_INTERFACE_HPP -#include "read_receiver.hpp" #include "receiver.hpp" #endif diff --git a/src/IO/receivers/read_receiver.cpp b/src/IO/receivers/read_receivers.cpp similarity index 97% rename from src/IO/receivers/read_receiver.cpp rename to src/IO/receivers/read_receivers.cpp index c4230475..48995f8b 100644 --- a/src/IO/receivers/read_receiver.cpp +++ b/src/IO/receivers/read_receivers.cpp @@ -1,3 +1,4 @@ +#include "IO/receivers/read_receivers.hpp" #include "receiver/interface.hpp" #include "specfem_setup.hpp" #include "utilities/interface.hpp" diff --git a/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp b/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp index d2646944..c3a7d309 100644 --- a/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp +++ b/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp @@ -3,7 +3,7 @@ // #include "../../utilities/include/compare_array.h" #include "IO/fortranio/interface.hpp" #include "IO/mesh/read_mesh.hpp" -#include "IO/receivers/read_receiver.hpp" +#include "IO/receivers/read_receivers.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 915b5bd5..2b349836 100644 --- a/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp +++ b/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp @@ -3,7 +3,7 @@ // #include "../../utilities/include/compare_array.h" #include "IO/fortranio/interface.hpp" #include "IO/mesh/read_mesh.hpp" -#include "IO/receivers/read_receiver.hpp" +#include "IO/receivers/read_receivers.hpp" #include "compute/interface.hpp" #include "constants.hpp" #include "domain/domain.hpp" From 3a00f3c0f21caec4b9ed82b42ec9e249a3b0ad55 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Mon, 25 Nov 2024 16:30:20 -0500 Subject: [PATCH 41/53] Updated the docs --- docs/api/IO/Libraries/mesh/index.rst | 8 +++----- docs/api/IO/Libraries/sources/index.rst | 4 ---- docs/api/IO/index.rst | 17 ++++++++++++++--- 3 files changed, 17 insertions(+), 12 deletions(-) delete mode 100644 docs/api/IO/Libraries/sources/index.rst diff --git a/docs/api/IO/Libraries/mesh/index.rst b/docs/api/IO/Libraries/mesh/index.rst index f7c350ea..7962b3c0 100644 --- a/docs/api/IO/Libraries/mesh/index.rst +++ b/docs/api/IO/Libraries/mesh/index.rst @@ -3,12 +3,10 @@ Mesh Reader =========== -.. doxygenfunction:: specfem::IO::read_mesh - - -The above function reads the fortran binary mesh database and the following -functions are called in the order of appearance in the code: +The below functions are helper functions for the Fortran binary mesh database +reader. The functions are called in :cpp:function:`specfem::IO::read_mesh` +in sequential order and faciliate the reading of the mesh database. .. doxygenfunction:: specfem::IO::mesh::fortran::read_mesh_database_header diff --git a/docs/api/IO/Libraries/sources/index.rst b/docs/api/IO/Libraries/sources/index.rst deleted file mode 100644 index 162f970f..00000000 --- a/docs/api/IO/Libraries/sources/index.rst +++ /dev/null @@ -1,4 +0,0 @@ -Source Reader -------------- - -.. doxygenfunction:: specfem::IO::sources::read_sources diff --git a/docs/api/IO/index.rst b/docs/api/IO/index.rst index c9f5d592..88c21298 100644 --- a/docs/api/IO/index.rst +++ b/docs/api/IO/index.rst @@ -3,9 +3,9 @@ Input/Output modules ==================== There are three high-level functions that are essential for the SPECFEM++ -codebase: :cpp:function:`specfem::IO::mesh::read_mesh`, -:cpp:function:`specfem::IO::sources::read_sources`, and -:cpp:function:`specfem::IO::receivers::read_receivers`. These functions are +codebase: :cpp:function:`specfem::IO::read_mesh`, +:cpp:function:`specfem::IO::read_sources`, and +:cpp:function:`specfem::IO::read_receivers`. These functions are used to read the mesh, sources and receivers from disk. The undelying implementations are not expose to the user. Currently supporte formats for the reading of the mesh is binary, and for sources and receivers it @@ -21,3 +21,14 @@ exposed through the following abstractions. fortran_io writer/index reader/index + + +Read Mesh, Sources and Receivers +-------------------------------- + + +.. doxygenfunction:: specfem::IO::read_mesh + +.. doxygenfunction:: specfem::IO::read_sources + +.. doxygenfunction:: specfem::IO::read_receivers From 4ef66533263120e9b1ff51ed7385bfb6cb9008ee Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Mon, 25 Nov 2024 16:47:57 -0500 Subject: [PATCH 42/53] Added documentation for medium namespace --- docs/api/index.rst | 1 + docs/api/medium/index.rst | 9 +++++++++ include/medium/compute_stress.hpp | 7 +++++++ include/medium/compute_wavefield.hpp | 13 +++++++++---- 4 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 docs/api/medium/index.rst diff --git a/docs/api/index.rst b/docs/api/index.rst index 3704a2fb..426698ba 100644 --- a/docs/api/index.rst +++ b/docs/api/index.rst @@ -17,6 +17,7 @@ API documentation assembly/index policies/index operators/index + medium/index compute_kernels/index coupling_physics/coupled_interface timescheme/index diff --git a/docs/api/medium/index.rst b/docs/api/medium/index.rst new file mode 100644 index 00000000..c90872a8 --- /dev/null +++ b/docs/api/medium/index.rst @@ -0,0 +1,9 @@ +.. _medium:: + +Medium modules +============== + +Functions within medium modules define the physics related to a particular medium. + +.. doxygengroup:: MediumPhysics + :content-only: diff --git a/include/medium/compute_stress.hpp b/include/medium/compute_stress.hpp index df3fa5a6..f0b62183 100644 --- a/include/medium/compute_stress.hpp +++ b/include/medium/compute_stress.hpp @@ -2,13 +2,20 @@ #include "acoustic_isotropic2d/acoustic_isotropic2d.hpp" #include "elastic_isotropic2d/elastic_isotropic2d.hpp" +#include namespace specfem { namespace medium { +/** + * @defgroup MediumPhysics + */ + /** * @brief Compute the stress tensor at a quadrature point * + * @ingroup MediumPhysics + * * @tparam PointPropertiesType Material properties at the quadrature point * specfem::point::properties * @tparam PointFieldDerivativesType Field derivatives at the quadrature point diff --git a/include/medium/compute_wavefield.hpp b/include/medium/compute_wavefield.hpp index f9d8b219..7027d68d 100644 --- a/include/medium/compute_wavefield.hpp +++ b/include/medium/compute_wavefield.hpp @@ -2,9 +2,11 @@ #include "acoustic_isotropic2d/acoustic_isotropic2d.hpp" #include "elastic_isotropic2d/elastic_isotropic2d.hpp" +#include namespace specfem { namespace medium { + /** * @brief Compute the values of wavefield of a given component within a spectral * element. @@ -14,15 +16,18 @@ namespace medium { * component is pressure, the function computes the pressure values from the * displacement field values. * + * + * @ingroup MediumPhysics + * * @tparam MediumTag The medium tag of the element * @tparam PropertyTag The property tag of the element * @tparam MemberType The kokkos team policy member type - * @tparam IteratorType The iterator type @ref specfem::iterator::chunk + * @tparam IteratorType The iterator type specfem::iterator::chunk * @tparam ChunkFieldType Chunk field type that stores the intrinsic field - * values + * values specfem::chunk_element::field * @tparam QuadratureType The quadrature type that stores the lagrange - * polynomial values - * @tparam WavefieldViewType The wavefield view type (output) + * polynomial values specfem::element::quadrature + * @tparam WavefieldViewType 4 dimensional Kokkos view (output) * @param team The kokkos team policy member * @param iterator The iterator to iterate over all the GLL points * @param assembly SPECFEM++ assembly object From 2c3aff531c2225757e8e7c87e6958615c1fbcdf0 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Mon, 25 Nov 2024 16:51:50 -0500 Subject: [PATCH 43/53] Just added more documentation and updated read_mesh"s doxygen blurb --- docs/api/IO/Libraries/mesh/index.rst | 2 +- docs/api/IO/index.rst | 20 +++++++++++++------- include/IO/mesh/read_mesh.hpp | 4 +++- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/docs/api/IO/Libraries/mesh/index.rst b/docs/api/IO/Libraries/mesh/index.rst index 7962b3c0..5af0199c 100644 --- a/docs/api/IO/Libraries/mesh/index.rst +++ b/docs/api/IO/Libraries/mesh/index.rst @@ -5,7 +5,7 @@ Mesh Reader The below functions are helper functions for the Fortran binary mesh database -reader. The functions are called in :cpp:function:`specfem::IO::read_mesh` +reader. The functions are called in :cpp:func:`specfem::IO::read_mesh` in sequential order and faciliate the reading of the mesh database. .. doxygenfunction:: specfem::IO::mesh::fortran::read_mesh_database_header diff --git a/docs/api/IO/index.rst b/docs/api/IO/index.rst index 88c21298..8f4332a1 100644 --- a/docs/api/IO/index.rst +++ b/docs/api/IO/index.rst @@ -3,16 +3,22 @@ Input/Output modules ==================== There are three high-level functions that are essential for the SPECFEM++ -codebase: :cpp:function:`specfem::IO::read_mesh`, -:cpp:function:`specfem::IO::read_sources`, and -:cpp:function:`specfem::IO::read_receivers`. These functions are -used to read the mesh, sources and receivers from disk. The undelying -implementations are not expose to the user. Currently supporte +codebase: :cpp:func:`specfem::IO::read_mesh`, +:cpp:func:`specfem::IO::read_sources`, and +:cpp:func:`specfem::IO::read_receivers`. These functions are +used to read the mesh, sources and receivers from disk. The underlying +implementations are not exposed to the user. Currently supported formats for the reading of the mesh is binary, and for sources and receivers it is yaml. -The slightly-lower level functions to read and write data to and from disk are -exposed through the following abstractions. +In addition to these basic read functions, there are also the two +reader and writer classes, :cpp:class:`specfem::reader::wavefield` and +:cpp:class:`specfem::writer::wavefield`, which support both HDF5 and ASCII I/O. +And, to write seismograms, we can use :cpp:class:`specfem::writer::seismogram`. +Seismogram I/O is only supported in ASCII format thus far. + +The slightly-lower level functionality to read and write data to and from disk +are exposed through the following modules: .. toctree:: :maxdepth: 2 diff --git a/include/IO/mesh/read_mesh.hpp b/include/IO/mesh/read_mesh.hpp index f5ede37d..7e05bfe3 100644 --- a/include/IO/mesh/read_mesh.hpp +++ b/include/IO/mesh/read_mesh.hpp @@ -8,11 +8,13 @@ namespace specfem { namespace IO { -/* @brief Construct a mesh object from a Fortran binary database file +/** + * @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); From 97c028b6e618ce809a3a075d6be904fc4804e553 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Mon, 25 Nov 2024 17:04:57 -0500 Subject: [PATCH 44/53] Conflict in the cmakelists/txt --- CMakeLists.txt | 38 ++++++++------------------------------ 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c8a1b37..538ecf86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,7 +107,7 @@ add_library( IO src/IO/fortranio/fortran_io.cpp src/IO/HDF5/native_type.cpp - # src/IO/ASCII/native_type.cpp + src/IO/ASCII/native_type.cpp src/IO/mesh/read_mesh.cpp src/IO/mesh/fortran/read_boundaries.cpp src/IO/mesh/fortran/read_elements.cpp @@ -139,21 +139,6 @@ else() ) endif() -target_link_libraries( - IO - mesh -) - -target_link_libraries( - IO - source_class -) - -target_link_libraries( - IO - receiver_class -) - add_library( point src/point/coordinates.cpp @@ -204,11 +189,13 @@ endif(MPI_PARALLEL) add_library( mesh + src/mesh/IO/fortran/read_mesh_database.cpp src/mesh/boundaries/forcing_boundaries.cpp src/mesh/boundaries/absorbing_boundaries.cpp src/mesh/boundaries/acoustic_free_surface.cpp src/mesh/elements/tangential_elements.cpp src/mesh/elements/axial_elements.cpp + src/mesh/properties/properties.cpp src/mesh/mpi_interfaces/mpi_interfaces.cpp src/mesh/materials/materials.cpp src/mesh/coupled_interfaces/interface_container.cpp @@ -222,6 +209,7 @@ target_link_libraries( Kokkos::kokkos specfem_mpi # material_class + IO yaml-cpp ) @@ -249,26 +237,16 @@ target_link_libraries( # specfem_mpi # ) -add_library( - read_seismogram - src/reader/seismogram.cpp -) - -target_link_libraries( - read_seismogram - Kokkos::kokkos - ) - add_library( reader src/reader/wavefield.cpp + src/reader/seismogram.cpp ) target_link_libraries( reader compute IO - read_seismogram ) add_library( @@ -292,7 +270,7 @@ add_library( target_link_libraries( source_time_function - read_seismogram + reader Kokkos::kokkos point ) @@ -304,6 +282,7 @@ add_library( src/source/moment_tensor_source.cpp src/source/adjoint_source.cpp src/source/external.cpp + src/source/read_sources.cpp ) target_link_libraries( @@ -322,6 +301,7 @@ target_link_libraries( add_library( receiver_class src/receiver/receiver.cpp + src/receiver/read_receiver.cpp ) target_link_libraries( @@ -511,8 +491,6 @@ add_executable( src/specfem2d.cpp ) - - target_link_libraries( specfem2d specfem_mpi From fbe117870714b23bb387366fb93849c9928e0822 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Mon, 25 Nov 2024 17:12:04 -0500 Subject: [PATCH 45/53] Fixed cmakelists --- CMakeLists.txt | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 538ecf86..2c8a1b37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,7 +107,7 @@ add_library( IO src/IO/fortranio/fortran_io.cpp src/IO/HDF5/native_type.cpp - src/IO/ASCII/native_type.cpp + # src/IO/ASCII/native_type.cpp src/IO/mesh/read_mesh.cpp src/IO/mesh/fortran/read_boundaries.cpp src/IO/mesh/fortran/read_elements.cpp @@ -139,6 +139,21 @@ else() ) endif() +target_link_libraries( + IO + mesh +) + +target_link_libraries( + IO + source_class +) + +target_link_libraries( + IO + receiver_class +) + add_library( point src/point/coordinates.cpp @@ -189,13 +204,11 @@ endif(MPI_PARALLEL) add_library( mesh - src/mesh/IO/fortran/read_mesh_database.cpp src/mesh/boundaries/forcing_boundaries.cpp src/mesh/boundaries/absorbing_boundaries.cpp src/mesh/boundaries/acoustic_free_surface.cpp src/mesh/elements/tangential_elements.cpp src/mesh/elements/axial_elements.cpp - src/mesh/properties/properties.cpp src/mesh/mpi_interfaces/mpi_interfaces.cpp src/mesh/materials/materials.cpp src/mesh/coupled_interfaces/interface_container.cpp @@ -209,7 +222,6 @@ target_link_libraries( Kokkos::kokkos specfem_mpi # material_class - IO yaml-cpp ) @@ -237,16 +249,26 @@ target_link_libraries( # specfem_mpi # ) +add_library( + read_seismogram + src/reader/seismogram.cpp +) + +target_link_libraries( + read_seismogram + Kokkos::kokkos + ) + add_library( reader src/reader/wavefield.cpp - src/reader/seismogram.cpp ) target_link_libraries( reader compute IO + read_seismogram ) add_library( @@ -270,7 +292,7 @@ add_library( target_link_libraries( source_time_function - reader + read_seismogram Kokkos::kokkos point ) @@ -282,7 +304,6 @@ add_library( src/source/moment_tensor_source.cpp src/source/adjoint_source.cpp src/source/external.cpp - src/source/read_sources.cpp ) target_link_libraries( @@ -301,7 +322,6 @@ target_link_libraries( add_library( receiver_class src/receiver/receiver.cpp - src/receiver/read_receiver.cpp ) target_link_libraries( @@ -491,6 +511,8 @@ add_executable( src/specfem2d.cpp ) + + target_link_libraries( specfem2d specfem_mpi From b7414aed37e910899d22dc937688a7e1e462ebbe Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Tue, 26 Nov 2024 11:00:29 -0500 Subject: [PATCH 46/53] Updated wavefield enums --- docs/api/enumerations/wavefield/index.rst | 5 ++ .../simulation_setup.rst | 52 ++++++------ include/compute/assembly/assembly.hpp | 4 +- include/compute/fields/fields.hpp | 25 ++++-- include/compute/fields/simulation_field.hpp | 9 +- include/compute/fields/simulation_field.tpp | 2 +- include/compute/sources/sources.hpp | 2 +- .../coupled_interface/coupled_interface.hpp | 2 +- .../coupled_interface/coupled_interface.tpp | 4 +- include/domain/domain.hpp | 2 +- include/domain/domain.tpp | 4 +- include/domain/impl/elements/kernel.hpp | 34 ++++---- include/domain/impl/elements/kernel.tpp | 10 +-- include/domain/impl/kernels.hpp | 2 +- include/domain/impl/kernels.tpp | 14 +-- include/domain/impl/receivers/kernel.hpp | 2 +- include/domain/impl/receivers/kernel.tpp | 4 +- include/domain/impl/sources/kernel.hpp | 2 +- include/domain/impl/sources/kernel.tpp | 6 +- include/enumerations/wavefield.hpp | 85 ++++++++++++++----- .../impl/frechet_element.hpp | 6 +- include/kernels/impl/domain_kernels.hpp | 2 +- include/kernels/impl/interface_kernels.hpp | 6 +- include/kernels/impl/kernels.hpp | 2 +- include/kernels/kernels.hpp | 2 +- .../acoustic_isotropic2d.hpp | 13 ++- include/medium/compute_wavefield.hpp | 2 +- .../elastic_isotropic2d.hpp | 13 ++- include/parameter_parser/solver/solver.tpp | 6 +- include/plotter/plot_wavefield.hpp | 9 +- include/reader/wavefield.hpp | 3 +- include/solver/time_marching.hpp | 24 ++++-- include/source/adjoint_source.hpp | 4 +- include/source/external.hpp | 6 +- include/source/force_source.hpp | 11 +-- include/source/moment_tensor_source.hpp | 15 ++-- include/source/source.hpp | 2 +- include/timescheme/newmark.hpp | 11 ++- include/timescheme/newmark.tpp | 16 ++-- include/writer/plot_wavefield.hpp | 13 +-- include/writer/wavefield.hpp | 3 +- src/compute/assembly/compute_wavefield.cpp | 20 ++--- src/compute/assembly/helper.hpp | 22 ++--- src/compute/fields/fields.cpp | 16 ++-- src/coupled_interface/coupled_interface.cpp | 24 +++--- src/domain/domain.cpp | 60 +++++++------ src/domain/impl/elements/kernel.cpp | 6 +- src/domain/impl/kernels.cpp | 60 +++++++------ src/kernels/kernels.cpp | 15 ++-- src/parameter_parser/setup.cpp | 10 +-- .../writer/plot_wavefield.cpp | 24 +++--- src/plotter/plot_wavefield.cpp | 13 +-- src/source/read_sources.cpp | 8 +- .../compute_wavefield/compute_wavefield.cpp | 26 +++--- .../compute_wavefield/generate_data.hpp | 9 +- .../compute_wavefield/test_helper.hpp | 18 ++-- .../unit-tests/domain/rmass_inverse_tests.cpp | 7 +- .../seismogram/acoustic/seismogram_tests.cpp | 4 +- .../seismogram/elastic/seismogram_tests.cpp | 4 +- 59 files changed, 449 insertions(+), 336 deletions(-) diff --git a/docs/api/enumerations/wavefield/index.rst b/docs/api/enumerations/wavefield/index.rst index acdff670..a0aee6fb 100644 --- a/docs/api/enumerations/wavefield/index.rst +++ b/docs/api/enumerations/wavefield/index.rst @@ -4,4 +4,9 @@ Wavefield definitions --------------------- +.. doxygenenum:: specfem::wavefield::simulation_field + .. doxygenenum:: specfem::wavefield::type + +.. doxygenclass:: specfem::wavefield::wavefield + :members: diff --git a/docs/parameter_documentation/simulation_setup.rst b/docs/parameter_documentation/simulation_setup.rst index cc3aa8b7..66eb0516 100644 --- a/docs/parameter_documentation/simulation_setup.rst +++ b/docs/parameter_documentation/simulation_setup.rst @@ -250,25 +250,25 @@ Parameter definitions **documentation** : Plot the wavefield during the forward simulation -**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.format`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.format`` [optional] +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -**default value** : None +**default value** : PNG **possible values** : [PNG, JPG, on_screen] **documentation** : Output format for resulting plots -**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.directory`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.directory`` [optional] +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -**default value** : None +**default value** : Current working directory **possible values** : [string] **documentation** : Output folder for the plots (not applicable for on_screen) -**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.component`` +**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.field`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ **default value** : None @@ -277,8 +277,8 @@ Parameter definitions **documentation** : Component of the wavefield to be plotted -**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.wavefield_type`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.simulation-field`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ **default value** : None @@ -286,7 +286,7 @@ Parameter definitions **documentation** : Type of wavefield to be plotted -**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.time_interval`` +**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.time-interval`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ **default value** : None @@ -313,9 +313,9 @@ Parameter definitions display: format: PNG directory: /path/to/output/folder - component: displacement - wavefield_type: forward - time_interval: 10 + field: displacement + simulation-field: forward + time-interval: 10 .. Note:: @@ -439,25 +439,25 @@ Parameter definitions **documentation** : Plot the wavefield during the forward simulation -**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.format`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.format`` [optional] +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -**default value** : None +**default value** : PNG **possible values** : [PNG, JPG, on_screen] **documentation** : Output format for resulting plots -**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.directory`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.directory`` [optional] +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -**default value** : None +**default value** : Current working directory **possible values** : [string] **documentation** : Output folder for the plots (not applicable for on_screen) -**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.component`` +**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.field`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ **default value** : None @@ -466,8 +466,8 @@ Parameter definitions **documentation** : Component of the wavefield to be plotted -**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.wavefield_type`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.simulation-field`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ **default value** : None @@ -475,7 +475,7 @@ Parameter definitions **documentation** : Type of wavefield to be plotted -**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.time_interval`` +**Parameter Name** : ``simulation-setup.simulation-mode.forward.writer.display.time-interval`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ **default value** : None @@ -504,9 +504,9 @@ Parameter definitions display: format: PNG directory: /path/to/output/folder - component: displacement - wavefield_type: adjoint - time_interval: 10 + field: displacement + simulation-field: adjoint + time-interval: 10 .. Note:: diff --git a/include/compute/assembly/assembly.hpp b/include/compute/assembly/assembly.hpp index c5bf089c..b5cfe6d2 100644 --- a/include/compute/assembly/assembly.hpp +++ b/include/compute/assembly/assembly.hpp @@ -88,8 +88,8 @@ struct assembly { */ Kokkos::View generate_wavefield_on_entire_grid( - const specfem::wavefield::type wavefield, - const specfem::wavefield::component component); + const specfem::wavefield::simulation_field wavefield, + const specfem::wavefield::type component); }; } // namespace compute diff --git a/include/compute/fields/fields.hpp b/include/compute/fields/fields.hpp index 2d3b3c7e..467f1f7a 100644 --- a/include/compute/fields/fields.hpp +++ b/include/compute/fields/fields.hpp @@ -44,16 +44,19 @@ struct fields { * @tparam fieldtype Field type * @return specfem::compute::simulation_field Simulation field */ - template + template KOKKOS_INLINE_FUNCTION specfem::compute::simulation_field get_simulation_field() const { - if constexpr (fieldtype == specfem::wavefield::type::forward) { + if constexpr (fieldtype == specfem::wavefield::simulation_field::forward) { return forward; - } else if constexpr (fieldtype == specfem::wavefield::type::adjoint) { + } else if constexpr (fieldtype == + specfem::wavefield::simulation_field::adjoint) { return adjoint; - } else if constexpr (fieldtype == specfem::wavefield::type::backward) { + } else if constexpr (fieldtype == + specfem::wavefield::simulation_field::backward) { return backward; - } else if constexpr (fieldtype == specfem::wavefield::type::buffer) { + } else if constexpr (fieldtype == + specfem::wavefield::simulation_field::buffer) { return buffer; } else { static_assert("field type not supported"); @@ -82,14 +85,18 @@ struct fields { backward.copy_to_host(); } - specfem::compute::simulation_field + specfem::compute::simulation_field< + specfem::wavefield::simulation_field::buffer> buffer; ///< Buffer field. Generally used for temporary storage for ///< adjoint fields read from disk - specfem::compute::simulation_field + specfem::compute::simulation_field< + specfem::wavefield::simulation_field::forward> forward; ///< Forward field - specfem::compute::simulation_field + specfem::compute::simulation_field< + specfem::wavefield::simulation_field::adjoint> adjoint; ///< Adjoint field - specfem::compute::simulation_field + specfem::compute::simulation_field< + specfem::wavefield::simulation_field::backward> backward; ///< Backward field }; diff --git a/include/compute/fields/simulation_field.hpp b/include/compute/fields/simulation_field.hpp index 29ca1b6c..24086470 100644 --- a/include/compute/fields/simulation_field.hpp +++ b/include/compute/fields/simulation_field.hpp @@ -20,7 +20,8 @@ namespace compute { * * @tparam WavefieldType Wavefield type. */ -template struct simulation_field { +template +struct simulation_field { private: using ViewType = Kokkos::View struct simulation_field { * @tparam DestinationWavefieldType Destination wavefield type * @param rhs Simulation field to copy from */ - template + template void operator=(const simulation_field &rhs) { this->nglob = rhs.nglob; this->assembly_index_mapping = rhs.assembly_index_mapping; @@ -119,8 +120,8 @@ template struct simulation_field { } }; -template +template void deep_copy(simulation_field &dst, const simulation_field &src) { dst.nglob = src.nglob; diff --git a/include/compute/fields/simulation_field.tpp b/include/compute/fields/simulation_field.tpp index 8fa29cf5..09f1504b 100644 --- a/include/compute/fields/simulation_field.tpp +++ b/include/compute/fields/simulation_field.tpp @@ -28,7 +28,7 @@ template int compute_nglob(const ViewType index_mapping) { } } // namespace -template +template specfem::compute::simulation_field::simulation_field( const specfem::compute::mesh &mesh, const specfem::compute::properties &properties) { diff --git a/include/compute/sources/sources.hpp b/include/compute/sources/sources.hpp index 66997dc9..e4772f92 100644 --- a/include/compute/sources/sources.hpp +++ b/include/compute/sources/sources.hpp @@ -69,7 +69,7 @@ struct sources { specfem::kokkos::HostView1d source_medium_mapping; ///< Medium type for every spectral element where ///< source is located - specfem::kokkos::HostView1d + specfem::kokkos::HostView1d source_wavefield_mapping; ///< Wavefield type on which any source acts specfem::compute::source_medium diff --git a/include/coupled_interface/coupled_interface.hpp b/include/coupled_interface/coupled_interface.hpp index a5aae464..1ba515ff 100644 --- a/include/coupled_interface/coupled_interface.hpp +++ b/include/coupled_interface/coupled_interface.hpp @@ -53,7 +53,7 @@ class coupled_interface diff --git a/include/coupled_interface/coupled_interface.tpp b/include/coupled_interface/coupled_interface.tpp index af6b4036..eb3e0832 100644 --- a/include/coupled_interface/coupled_interface.tpp +++ b/include/coupled_interface/coupled_interface.tpp @@ -5,7 +5,7 @@ #include "policies/edge.hpp" #include -template @@ -24,7 +24,7 @@ specfem::coupled_interface::coupled_interfacefield = field; } -template diff --git a/include/domain/domain.hpp b/include/domain/domain.hpp index 48909fe8..70eadcc6 100644 --- a/include/domain/domain.hpp +++ b/include/domain/domain.hpp @@ -19,7 +19,7 @@ namespace domain { * @tparam qp_type Type of quadrature points i.e. static or dynamic (will be * deprecated soon) */ -template class domain : public specfem::domain::impl::kernels::kernels< diff --git a/include/domain/domain.tpp b/include/domain/domain.tpp index 986593fb..da7c45b6 100644 --- a/include/domain/domain.tpp +++ b/include/domain/domain.tpp @@ -5,7 +5,7 @@ #include "policies/range.hpp" #include -template void specfem::domain::domain void specfem::domain::domain; }; -template -class element_kernel - : public element_kernel_base { private: /// Datatypes used in the kernels using datatypes = - KernelDatatypes; using simd = typename datatypes::simd; using ChunkPolicyType = typename datatypes::ChunkPolicyType; @@ -290,7 +290,7 @@ class element_kernel h_element_kernel_index_mapping) - : field(assembly.fields - .get_simulation_field()), - element_kernel_base()), + element_kernel_base( assembly, h_element_kernel_index_mapping) {} void compute_mass_matrix(const type_real dt) const { - element_kernel_base::compute_mass_matrix(dt, field); } @@ -323,7 +323,9 @@ class element_kernel field; + specfem::compute::simulation_field< + specfem::wavefield::simulation_field::backward> + field; }; } // namespace kernels diff --git a/include/domain/impl/elements/kernel.tpp b/include/domain/impl/elements/kernel.tpp index 681434b6..e7f58d16 100644 --- a/include/domain/impl/elements/kernel.tpp +++ b/include/domain/impl/elements/kernel.tpp @@ -13,7 +13,7 @@ #include "specfem_setup.hpp" #include -template void specfem::domain::impl::kernels::element_kernel< - specfem::wavefield::type::backward, DimensionType, MediumType, PropertyTag, + specfem::wavefield::simulation_field::backward, DimensionType, MediumType, PropertyTag, specfem::element::boundary_tag::stacey, NGLL>::compute_stiffness_interaction(const int istep) const { diff --git a/include/domain/impl/kernels.hpp b/include/domain/impl/kernels.hpp index 919c38c0..47cd08b1 100644 --- a/include/domain/impl/kernels.hpp +++ b/include/domain/impl/kernels.hpp @@ -11,7 +11,7 @@ namespace domain { namespace impl { namespace kernels { -template class kernels { diff --git a/include/domain/impl/kernels.tpp b/include/domain/impl/kernels.tpp index 1050869a..e07257e6 100644 --- a/include/domain/impl/kernels.tpp +++ b/include/domain/impl/kernels.tpp @@ -73,8 +73,8 @@ void allocate_elements( } } - if constexpr (wavefield_type == specfem::wavefield::type::forward || - wavefield_type == specfem::wavefield::type::adjoint) { + if constexpr (wavefield_type == specfem::wavefield::simulation_field::forward || + wavefield_type == specfem::wavefield::simulation_field::adjoint) { std::cout << " - Element type: \n" << " - dimension : " << dimension::to_string() @@ -93,7 +93,7 @@ void allocate_elements( elements = { assembly, h_ispec_domain }; } -template @@ -138,7 +138,7 @@ void allocate_isotropic_sources( return; } -template @@ -189,7 +189,7 @@ void allocate_isotropic_receivers( } } // namespace -template specfem::domain::impl::kernels:: @@ -209,8 +209,8 @@ specfem::domain::impl::kernels:: assembly.boundaries.boundary_tags(ispec)); } - if constexpr (WavefieldType == specfem::wavefield::type::forward || - WavefieldType == specfem::wavefield::type::adjoint) { + if constexpr (WavefieldType == specfem::wavefield::simulation_field::forward || + WavefieldType == specfem::wavefield::simulation_field::adjoint) { std::cout << " Element Statistics \n" << "------------------------------\n" << "- Types of elements in " << specfem::element::to_string(medium) diff --git a/include/domain/impl/receivers/kernel.hpp b/include/domain/impl/receivers/kernel.hpp index 36e5cd18..0f352dda 100644 --- a/include/domain/impl/receivers/kernel.hpp +++ b/include/domain/impl/receivers/kernel.hpp @@ -13,7 +13,7 @@ namespace domain { namespace impl { namespace kernels { -template diff --git a/include/domain/impl/receivers/kernel.tpp b/include/domain/impl/receivers/kernel.tpp index 2a083a3a..e1f02cad 100644 --- a/include/domain/impl/receivers/kernel.tpp +++ b/include/domain/impl/receivers/kernel.tpp @@ -10,7 +10,7 @@ #include "quadrature/interface.hpp" #include "specfem_setup.hpp" -template @@ -63,7 +63,7 @@ specfem::domain::impl::kernels::receiver_kernel< return; } -template diff --git a/include/domain/impl/sources/kernel.hpp b/include/domain/impl/sources/kernel.hpp index 46de4b92..3ed11aa2 100644 --- a/include/domain/impl/sources/kernel.hpp +++ b/include/domain/impl/sources/kernel.hpp @@ -13,7 +13,7 @@ namespace domain { namespace impl { namespace kernels { -template diff --git a/include/domain/impl/sources/kernel.tpp b/include/domain/impl/sources/kernel.tpp index 002b3b2a..4f7adfa6 100644 --- a/include/domain/impl/sources/kernel.tpp +++ b/include/domain/impl/sources/kernel.tpp @@ -10,7 +10,7 @@ #include "specfem_setup.hpp" #include -template @@ -53,7 +53,7 @@ specfem::domain::impl::kernels::source_kernel< return; } -template @@ -98,7 +98,7 @@ void specfem::domain::impl::kernels::source_kernel< // For acoustic medium, forward simulation, divide by kappa const auto stf = [&, timestep]() { if constexpr ((WavefieldType == - specfem::wavefield::type::forward) && + specfem::wavefield::simulation_field::forward) && (MediumTag == specfem::element::medium_tag::acoustic)) { const auto point_properties = [&]() diff --git a/include/enumerations/wavefield.hpp b/include/enumerations/wavefield.hpp index 186ba500..e0ec9dc5 100644 --- a/include/enumerations/wavefield.hpp +++ b/include/enumerations/wavefield.hpp @@ -5,51 +5,96 @@ namespace specfem { namespace wavefield { /** - * @brief Wavefield type enumeration + * @brief Wavefield tag within the simulation * */ -enum class type { forward, adjoint, backward, buffer }; +enum class simulation_field { forward, adjoint, backward, buffer }; -enum class component { displacement, velocity, acceleration, pressure }; +/** + * @brief Type of wavefield component + * + */ +enum class type { displacement, velocity, acceleration, pressure }; +/** + * @brief Defines compile time constants for wavefield components + * + * @tparam DimensionType Dimension of the wavefield + * @tparam Component Type of the wavefield component + */ template + specfem::wavefield::type Component> class wavefield; +// clang-format off +/** + * @fn static constexpr specfem::dimension::type specfem::wavefield::wavefield::dimension() + * @brief Returns the dimension type of the wavefield + * + * @return constexpr specfem::dimension::type Dimension type of the wavefield + * @memberof specfem::wavefield::wavefield + */ + +/** + * @fn static constexpr specfem::wavefield::type specfem::wavefield::wavefield::component() + * + * @brief Returns the component type of the wavefield + * + * @return constexpr specfem::wavefield::type Component type of the wavefield + * @memberof specfem::wavefield::wavefield + */ + +/** + * @fn static constexpr int specfem::wavefield::wavefield::num_components() + * @brief Returns the number of components of the wavefield + * + * @return constexpr int Number of components of the wavefield + * @memberof specfem::wavefield::wavefield + */ +// clang-format on + template <> class wavefield { + specfem::wavefield::type::displacement> { public: - static constexpr auto dimension = specfem::dimension::type::dim2; - static constexpr auto component = specfem::wavefield::component::displacement; - static constexpr int num_components = 2; + static constexpr auto dimension() { return specfem::dimension::type::dim2; } + static constexpr auto component() { + return specfem::wavefield::type::displacement; + } + static constexpr int num_components() { return 2; } }; template <> class wavefield { + specfem::wavefield::type::velocity> { public: - static constexpr auto dimension = specfem::dimension::type::dim2; - static constexpr auto component = specfem::wavefield::component::velocity; - static constexpr int num_components = 2; + static constexpr auto dimension() { return specfem::dimension::type::dim2; } + static constexpr auto component() { + return specfem::wavefield::type::velocity; + } + static constexpr int num_components() { return 2; } }; template <> class wavefield { + specfem::wavefield::type::acceleration> { public: - static constexpr auto dimension = specfem::dimension::type::dim2; - static constexpr auto component = specfem::wavefield::component::acceleration; - static constexpr int num_components = 2; + static constexpr auto dimension() { return specfem::dimension::type::dim2; } + static constexpr auto component() { + return specfem::wavefield::type::acceleration; + } + static constexpr int num_components() { return 2; } }; template <> class wavefield { + specfem::wavefield::type::pressure> { public: - static constexpr auto dimension = specfem::dimension::type::dim2; - static constexpr auto component = specfem::wavefield::component::pressure; - static constexpr int num_components = 1; + static constexpr auto dimension() { return specfem::dimension::type::dim2; } + static constexpr auto component() { + return specfem::wavefield::type::pressure; + } + static constexpr int num_components() { return 1; } }; } // namespace wavefield diff --git a/include/frechet_derivatives/impl/frechet_element.hpp b/include/frechet_derivatives/impl/frechet_element.hpp index 9619f9a1..e9472dcf 100644 --- a/include/frechet_derivatives/impl/frechet_element.hpp +++ b/include/frechet_derivatives/impl/frechet_element.hpp @@ -105,9 +105,11 @@ class frechet_elements { ///< this kernel specfem::kokkos::HostMirror1d h_element_index; ///< Host mirror of ///< element_index - specfem::compute::simulation_field + specfem::compute::simulation_field< + specfem::wavefield::simulation_field::adjoint> adjoint_field; ///< Adjoint field - specfem::compute::simulation_field + specfem::compute::simulation_field< + specfem::wavefield::simulation_field::backward> backward_field; ///< Backward field specfem::compute::kernels kernels; ///< Misfit kernels specfem::compute::quadrature quadrature; ///< Integration quadrature diff --git a/include/kernels/impl/domain_kernels.hpp b/include/kernels/impl/domain_kernels.hpp index 6c92253e..5a4cdb51 100644 --- a/include/kernels/impl/domain_kernels.hpp +++ b/include/kernels/impl/domain_kernels.hpp @@ -10,7 +10,7 @@ namespace specfem { namespace kernels { namespace impl { -template class domain_kernels { public: diff --git a/include/kernels/impl/interface_kernels.hpp b/include/kernels/impl/interface_kernels.hpp index 8e125ce6..2d34c076 100644 --- a/include/kernels/impl/interface_kernels.hpp +++ b/include/kernels/impl/interface_kernels.hpp @@ -10,12 +10,12 @@ namespace specfem { namespace kernels { namespace impl { -template class interface_kernels; -template class interface_kernels { @@ -34,7 +34,7 @@ class interface_kernels class interface_kernels { diff --git a/include/kernels/impl/kernels.hpp b/include/kernels/impl/kernels.hpp index b1aa87e1..a2ade16c 100644 --- a/include/kernels/impl/kernels.hpp +++ b/include/kernels/impl/kernels.hpp @@ -12,7 +12,7 @@ namespace specfem { namespace kernels { namespace impl { -template class kernels diff --git a/include/kernels/kernels.hpp b/include/kernels/kernels.hpp index b8367a5b..b2cbaf35 100644 --- a/include/kernels/kernels.hpp +++ b/include/kernels/kernels.hpp @@ -8,7 +8,7 @@ namespace specfem { namespace kernels { -template class kernels : public impl::domain_kernels { diff --git a/include/medium/acoustic_isotropic2d/acoustic_isotropic2d.hpp b/include/medium/acoustic_isotropic2d/acoustic_isotropic2d.hpp index 30f6b733..f93fd6df 100644 --- a/include/medium/acoustic_isotropic2d/acoustic_isotropic2d.hpp +++ b/include/medium/acoustic_isotropic2d/acoustic_isotropic2d.hpp @@ -45,7 +45,7 @@ KOKKOS_FUNCTION void impl_compute_wavefield( const MemberType &team, const IteratorType &iterator, const specfem::compute::assembly &assembly, const QuadratureType &quadrature, const ChunkFieldType &field, - const specfem::wavefield::component wavefield_component, + const specfem::wavefield::type wavefield_component, WavefieldViewType wavefield) { using FieldDerivativesType = @@ -60,21 +60,20 @@ KOKKOS_FUNCTION void impl_compute_wavefield( const auto &properties = assembly.properties; const auto &active_field = [&]() { - if (wavefield_component == specfem::wavefield::component::displacement) { + if (wavefield_component == specfem::wavefield::type::displacement) { return field.displacement; - } else if (wavefield_component == specfem::wavefield::component::velocity) { + } else if (wavefield_component == specfem::wavefield::type::velocity) { return field.velocity; - } else if (wavefield_component == - specfem::wavefield::component::acceleration) { + } else if (wavefield_component == specfem::wavefield::type::acceleration) { return field.acceleration; - } else if (wavefield_component == specfem::wavefield::component::pressure) { + } else if (wavefield_component == specfem::wavefield::type::pressure) { return field.acceleration; } else { Kokkos::abort("component not supported"); } }(); - if (wavefield_component == specfem::wavefield::component::pressure) { + if (wavefield_component == specfem::wavefield::type::pressure) { Kokkos::parallel_for(Kokkos::TeamThreadRange(team, iterator.chunk_size()), [&](const int &i) { const auto iterator_index = iterator(i); diff --git a/include/medium/compute_wavefield.hpp b/include/medium/compute_wavefield.hpp index 7027d68d..236c213c 100644 --- a/include/medium/compute_wavefield.hpp +++ b/include/medium/compute_wavefield.hpp @@ -45,7 +45,7 @@ KOKKOS_INLINE_FUNCTION void compute_wavefield(const MemberType &team, const IteratorType &iterator, const specfem::compute::assembly &assembly, const QuadratureType &quadrature, const ChunkFieldType &field, - const specfem::wavefield::component &wavefield_component, + const specfem::wavefield::type &wavefield_component, WavefieldViewType wavefield_on_entire_grid) { static_assert(ChunkFieldType::isChunkFieldType, diff --git a/include/medium/elastic_isotropic2d/elastic_isotropic2d.hpp b/include/medium/elastic_isotropic2d/elastic_isotropic2d.hpp index 69257fb7..48b5a951 100644 --- a/include/medium/elastic_isotropic2d/elastic_isotropic2d.hpp +++ b/include/medium/elastic_isotropic2d/elastic_isotropic2d.hpp @@ -61,7 +61,7 @@ KOKKOS_FUNCTION void impl_compute_wavefield( const MemberType &team, const IteratorType &iterator, const specfem::compute::assembly &assembly, const QuadratureType &quadrature, const ChunkFieldType &field, - const specfem::wavefield::component wavefield_component, + const specfem::wavefield::type wavefield_component, WavefieldViewType wavefield) { using FieldDerivativesType = @@ -76,21 +76,20 @@ KOKKOS_FUNCTION void impl_compute_wavefield( const auto &properties = assembly.properties; const auto &active_field = [&]() { - if (wavefield_component == specfem::wavefield::component::displacement) { + if (wavefield_component == specfem::wavefield::type::displacement) { return field.displacement; - } else if (wavefield_component == specfem::wavefield::component::velocity) { + } else if (wavefield_component == specfem::wavefield::type::velocity) { return field.velocity; - } else if (wavefield_component == - specfem::wavefield::component::acceleration) { + } else if (wavefield_component == specfem::wavefield::type::acceleration) { return field.acceleration; - } else if (wavefield_component == specfem::wavefield::component::pressure) { + } else if (wavefield_component == specfem::wavefield::type::pressure) { return field.displacement; } else { Kokkos::abort("component not supported"); } }(); - if (wavefield_component == specfem::wavefield::component::pressure) { + if (wavefield_component == specfem::wavefield::type::pressure) { specfem::algorithms::gradient( team, iterator, assembly.partial_derivatives, quadrature.hprime_gll, diff --git a/include/parameter_parser/solver/solver.tpp b/include/parameter_parser/solver/solver.tpp index 3852301e..ce04cd2c 100644 --- a/include/parameter_parser/solver/solver.tpp +++ b/include/parameter_parser/solver/solver.tpp @@ -18,7 +18,7 @@ specfem::runtime_configuration::solver::solver::instantiate(const type_real dt, if (this->simulation_type == "forward") { std::cout << "Instantiating Kernels \n"; std::cout << "-------------------------------\n"; - const auto kernels = specfem::kernels::kernels( dt, assembly, quadrature); return std::make_shared< @@ -28,10 +28,10 @@ specfem::runtime_configuration::solver::solver::instantiate(const type_real dt, } else if (this->simulation_type == "combined") { std::cout << "Instantiating Kernels \n"; std::cout << "-------------------------------\n"; - const auto adjoint_kernels = specfem::kernels::kernels(dt, assembly, quadrature); - const auto backward_kernels = specfem::kernels::kernels(dt, assembly, quadrature); return std::make_shared< diff --git a/include/plotter/plot_wavefield.hpp b/include/plotter/plot_wavefield.hpp index df242ab3..2aaa9c1b 100644 --- a/include/plotter/plot_wavefield.hpp +++ b/include/plotter/plot_wavefield.hpp @@ -30,7 +30,7 @@ class plot_wavefield : public plotter { plot_wavefield(const specfem::compute::assembly &assembly, const specfem::display::format &output_format, const specfem::display::wavefield &component, - const specfem::wavefield::type &wavefield, + const specfem::wavefield::simulation_field &wavefield, const int &time_interval, const boost::filesystem::path &output_folder) : plotter(time_interval), output_format(output_format), @@ -55,9 +55,10 @@ class plot_wavefield : public plotter { private: const specfem::display::format output_format; ///< Output format of the plot const specfem::display::wavefield component; ///< Component of the wavefield - const specfem::wavefield::type wavefield; ///< Type of wavefield to plot - const boost::filesystem::path output_folder; ///< Path to output folder - specfem::compute::assembly assembly; ///< Assembly object + const specfem::wavefield::simulation_field wavefield; ///< Type of wavefield + ///< to plot + const boost::filesystem::path output_folder; ///< Path to output folder + specfem::compute::assembly assembly; ///< Assembly object }; } // namespace plotter } // namespace specfem diff --git a/include/reader/wavefield.hpp b/include/reader/wavefield.hpp index aff1ce6a..5edae080 100644 --- a/include/reader/wavefield.hpp +++ b/include/reader/wavefield.hpp @@ -30,7 +30,8 @@ template class wavefield : public reader { private: std::string output_folder; ///< Path to output folder - specfem::compute::simulation_field + specfem::compute::simulation_field< + specfem::wavefield::simulation_field::buffer> buffer; ///< Buffer wavefield to store the data specfem::compute::boundary_values boundary_values; ///< Boundary values used ///< for backward diff --git a/include/solver/time_marching.hpp b/include/solver/time_marching.hpp index 83d11608..3bf681b7 100644 --- a/include/solver/time_marching.hpp +++ b/include/solver/time_marching.hpp @@ -45,8 +45,9 @@ class time_marching * @param time_scheme Time scheme */ time_marching( - const specfem::kernels::kernels &kernels, + const specfem::kernels::kernels< + specfem::wavefield::simulation_field::forward, DimensionType, qp_type> + &kernels, const std::shared_ptr time_scheme, const std::vector > &plotters) : kernels(kernels), time_scheme(time_scheme), plotters(plotters) {} @@ -59,7 +60,8 @@ class time_marching void run() override; private: - specfem::kernels::kernels kernels; ///< Computational kernels std::shared_ptr time_scheme; ///< Time @@ -92,10 +94,12 @@ class time_marching */ time_marching( const specfem::compute::assembly &assembly, - const specfem::kernels::kernels &adjoint_kernels, - const specfem::kernels::kernels &backward_kernels, + const specfem::kernels::kernels< + specfem::wavefield::simulation_field::adjoint, DimensionType, qp_type> + &adjoint_kernels, + const specfem::kernels::kernels< + specfem::wavefield::simulation_field::backward, DimensionType, + qp_type> &backward_kernels, const std::shared_ptr time_scheme, const std::vector > &plotters) : assembly(assembly), adjoint_kernels(adjoint_kernels), @@ -111,10 +115,12 @@ class time_marching private: constexpr static int NGLL = qp_type::NGLL; - specfem::kernels::kernels adjoint_kernels; ///< Adjoint computational kernels - specfem::kernels::kernels backward_kernels; ///< Backward computational kernels specfem::kernels::frechet_kernels diff --git a/include/source/adjoint_source.hpp b/include/source/adjoint_source.hpp index 148bad00..627457f8 100644 --- a/include/source/adjoint_source.hpp +++ b/include/source/adjoint_source.hpp @@ -24,8 +24,8 @@ class adjoint_source : public source { const specfem::compute::properties &properties, specfem::kokkos::HostView3d source_array) override; - specfem::wavefield::type get_wavefield_type() const override { - return specfem::wavefield::type::adjoint; + specfem::wavefield::simulation_field get_wavefield_type() const override { + return specfem::wavefield::simulation_field::adjoint; } std::string print() const override; diff --git a/include/source/external.hpp b/include/source/external.hpp index ad848c74..7e63e03c 100644 --- a/include/source/external.hpp +++ b/include/source/external.hpp @@ -15,7 +15,7 @@ class external : public source { external(){}; external(YAML::Node &Node, const int nsteps, const type_real dt, - const specfem::wavefield::type wavefield_type) + const specfem::wavefield::simulation_field wavefield_type) : wavefield_type(wavefield_type), specfem::sources::source(Node, nsteps, dt){}; @@ -25,14 +25,14 @@ class external : public source { const specfem::compute::properties &properties, specfem::kokkos::HostView3d source_array) override; - specfem::wavefield::type get_wavefield_type() const override { + specfem::wavefield::simulation_field get_wavefield_type() const override { return wavefield_type; } std::string print() const override; private: - specfem::wavefield::type wavefield_type; + specfem::wavefield::simulation_field wavefield_type; }; } // namespace sources } // namespace specfem diff --git a/include/source/force_source.hpp b/include/source/force_source.hpp index 628190b2..87491bc3 100644 --- a/include/source/force_source.hpp +++ b/include/source/force_source.hpp @@ -37,7 +37,7 @@ class force : public source { * frequecy of Dirac source. */ force(YAML::Node &Node, const int nsteps, const type_real dt, - const specfem::wavefield::type wavefield_type) + const specfem::wavefield::simulation_field wavefield_type) : angle([](YAML::Node &Node) -> type_real { if (Node["angle"]) { return Node["angle"].as(); @@ -59,14 +59,15 @@ class force : public source { const specfem::compute::properties &properties, specfem::kokkos::HostView3d source_array) override; - specfem::wavefield::type get_wavefield_type() const override { + specfem::wavefield::simulation_field get_wavefield_type() const override { return wavefield_type; } private: - type_real angle; ///< Angle of force source - specfem::wavefield::type wavefield_type; ///< Type of wavefield on which the - ///< source acts + type_real angle; ///< Angle of force source + specfem::wavefield::simulation_field wavefield_type; ///< Type of wavefield on + ///< which the source + ///< acts }; } // namespace sources } // namespace specfem diff --git a/include/source/moment_tensor_source.hpp b/include/source/moment_tensor_source.hpp index a502865f..194695fd 100644 --- a/include/source/moment_tensor_source.hpp +++ b/include/source/moment_tensor_source.hpp @@ -37,7 +37,7 @@ class moment_tensor : public source { * written in .yml format */ moment_tensor(YAML::Node &Node, const int nsteps, const type_real dt, - const specfem::wavefield::type wavefield_type) + const specfem::wavefield::simulation_field wavefield_type) : Mxx(Node["Mxx"].as()), Mzz(Node["Mzz"].as()), Mxz(Node["Mxz"].as()), wavefield_type(wavefield_type), specfem::sources::source(Node, nsteps, @@ -54,16 +54,17 @@ class moment_tensor : public source { const specfem::compute::properties &properties, specfem::kokkos::HostView3d source_array) override; - specfem::wavefield::type get_wavefield_type() const override { + specfem::wavefield::simulation_field get_wavefield_type() const override { return wavefield_type; } private: - type_real Mxx; ///< Mxx for the source - type_real Mxz; ///< Mxz for the source - type_real Mzz; ///< Mzz for the source - specfem::wavefield::type wavefield_type; ///< Type of wavefield on which the - ///< source acts + type_real Mxx; ///< Mxx for the source + type_real Mxz; ///< Mxz for the source + type_real Mzz; ///< Mzz for the source + specfem::wavefield::simulation_field wavefield_type; ///< Type of wavefield on + ///< which the source + ///< acts }; } // namespace sources } // namespace specfem diff --git a/include/source/source.hpp b/include/source/source.hpp index 0514cdb5..412c596a 100644 --- a/include/source/source.hpp +++ b/include/source/source.hpp @@ -81,7 +81,7 @@ class source { t0, dt, nsteps, source_time_function); } - virtual specfem::wavefield::type get_wavefield_type() const = 0; + virtual specfem::wavefield::simulation_field get_wavefield_type() const = 0; protected: type_real x; ///< x-coordinate of source diff --git a/include/timescheme/newmark.hpp b/include/timescheme/newmark.hpp index b2446d84..d3a79b8b 100644 --- a/include/timescheme/newmark.hpp +++ b/include/timescheme/newmark.hpp @@ -24,7 +24,7 @@ class newmark : public time_scheme { public: constexpr static auto simulation_type = - specfem::wavefield::type::forward; ///< Wavefield tag + specfem::wavefield::simulation_field::forward; ///< Wavefield tag /** * @name Constructors @@ -113,7 +113,8 @@ class newmark : public time_scheme { type_real deltat; ///< Time increment type_real deltatover2; type_real deltasquareover2; - specfem::compute::simulation_field + specfem::compute::simulation_field< + specfem::wavefield::simulation_field::forward> field; ///< forward wavefield }; @@ -215,9 +216,11 @@ class newmark : public time_scheme { type_real deltat; ///< Time increment type_real deltatover2; type_real deltasquareover2; - specfem::compute::simulation_field + specfem::compute::simulation_field< + specfem::wavefield::simulation_field::adjoint> adjoint_field; ///< adjoint wavefield - specfem::compute::simulation_field + specfem::compute::simulation_field< + specfem::wavefield::simulation_field::backward> backward_field; ///< backward wavefield }; diff --git a/include/timescheme/newmark.tpp b/include/timescheme/newmark.tpp index ff1dcbc6..13dd2e0b 100644 --- a/include/timescheme/newmark.tpp +++ b/include/timescheme/newmark.tpp @@ -7,7 +7,7 @@ namespace { template + specfem::wavefield::simulation_field WavefieldType> void corrector_phase_impl( const specfem::compute::simulation_field &field, const type_real deltatover2) { @@ -70,7 +70,7 @@ void corrector_phase_impl( } template + specfem::wavefield::simulation_field WavefieldType> void predictor_phase_impl( const specfem::compute::simulation_field &field, const type_real deltat, const type_real deltatover2, @@ -197,7 +197,7 @@ void predictor_phase_impl( void specfem::time_scheme::newmark:: apply_corrector_phase_forward(const specfem::element::medium_tag tag) { - constexpr auto wavefield = specfem::wavefield::type::forward; + constexpr auto wavefield = specfem::wavefield::simulation_field::forward; constexpr auto elastic = specfem::element::medium_tag::elastic; constexpr auto acoustic = specfem::element::medium_tag::acoustic; @@ -215,7 +215,7 @@ void specfem::time_scheme::newmark:: void specfem::time_scheme::newmark:: apply_predictor_phase_forward(const specfem::element::medium_tag tag) { - constexpr auto wavefield = specfem::wavefield::type::forward; + constexpr auto wavefield = specfem::wavefield::simulation_field::forward; constexpr auto elastic = specfem::element::medium_tag::elastic; constexpr auto acoustic = specfem::element::medium_tag::acoustic; @@ -233,7 +233,7 @@ void specfem::time_scheme::newmark:: void specfem::time_scheme::newmark:: apply_corrector_phase_forward(const specfem::element::medium_tag tag) { - constexpr auto wavefield = specfem::wavefield::type::adjoint; + constexpr auto wavefield = specfem::wavefield::simulation_field::adjoint; constexpr auto elastic = specfem::element::medium_tag::elastic; constexpr auto acoustic = specfem::element::medium_tag::acoustic; @@ -250,7 +250,7 @@ void specfem::time_scheme::newmark:: void specfem::time_scheme::newmark:: apply_corrector_phase_backward(const specfem::element::medium_tag tag) { - constexpr auto wavefield = specfem::wavefield::type::backward; + constexpr auto wavefield = specfem::wavefield::simulation_field::backward; constexpr auto elastic = specfem::element::medium_tag::elastic; constexpr auto acoustic = specfem::element::medium_tag::acoustic; @@ -270,7 +270,7 @@ void specfem::time_scheme::newmark:: void specfem::time_scheme::newmark:: apply_predictor_phase_forward(const specfem::element::medium_tag tag) { - constexpr auto wavefield = specfem::wavefield::type::adjoint; + constexpr auto wavefield = specfem::wavefield::simulation_field::adjoint; constexpr auto elastic = specfem::element::medium_tag::elastic; constexpr auto acoustic = specfem::element::medium_tag::acoustic; @@ -288,7 +288,7 @@ void specfem::time_scheme::newmark:: void specfem::time_scheme::newmark:: apply_predictor_phase_backward(const specfem::element::medium_tag tag) { - constexpr auto wavefield = specfem::wavefield::type::backward; + constexpr auto wavefield = specfem::wavefield::simulation_field::backward; constexpr auto elastic = specfem::element::medium_tag::elastic; constexpr auto acoustic = specfem::element::medium_tag::acoustic; diff --git a/include/writer/plot_wavefield.hpp b/include/writer/plot_wavefield.hpp index 6051dd65..7324df9a 100644 --- a/include/writer/plot_wavefield.hpp +++ b/include/writer/plot_wavefield.hpp @@ -30,7 +30,7 @@ class plot_wavefield : public writer { plot_wavefield(const specfem::compute::assembly &assembly, const specfem::display::format &output_format, const specfem::display::wavefield &component, - const specfem::wavefield::type &wavefield, + const specfem::wavefield::simulation_field &wavefield, const int &time_interval, const boost::filesystem::path &output_folder) : output_format(output_format), component(component), @@ -70,11 +70,12 @@ class plot_wavefield : public writer { private: const specfem::display::format output_format; ///< Output format of the plot const specfem::display::wavefield component; ///< Component of the wavefield - const specfem::wavefield::type wavefield; ///< Type of wavefield to plot - const boost::filesystem::path output_folder; ///< Path to output folder - const int time_interval; ///< Time interval between plots - int m_istep = 0; ///< Current timestep - specfem::compute::assembly assembly; ///< Assembly object + const specfem::wavefield::simulation_field wavefield; ///< Type of wavefield + ///< to plot + const boost::filesystem::path output_folder; ///< Path to output folder + const int time_interval; ///< Time interval between plots + int m_istep = 0; ///< Current timestep + specfem::compute::assembly assembly; ///< Assembly object }; } // namespace writer } // namespace specfem diff --git a/include/writer/wavefield.hpp b/include/writer/wavefield.hpp index edaf7241..27a39bc5 100644 --- a/include/writer/wavefield.hpp +++ b/include/writer/wavefield.hpp @@ -40,7 +40,8 @@ template class wavefield : public writer { private: std::string output_folder; ///< Path to output folder - specfem::compute::simulation_field + specfem::compute::simulation_field< + specfem::wavefield::simulation_field::forward> forward; ///< Forward wavefield specfem::compute::boundary_values boundary_values; ///< Boundary values used ///< for backward diff --git a/src/compute/assembly/compute_wavefield.cpp b/src/compute/assembly/compute_wavefield.cpp index 0b348c07..4a63908c 100644 --- a/src/compute/assembly/compute_wavefield.cpp +++ b/src/compute/assembly/compute_wavefield.cpp @@ -7,7 +7,7 @@ namespace { template void get_wavefield_on_entire_grid( - const specfem::wavefield::component component, + const specfem::wavefield::type component, const specfem::compute::assembly &assembly, Kokkos::View @@ -35,17 +35,17 @@ void get_wavefield_on_entire_grid( Kokkos::View specfem::compute::assembly::generate_wavefield_on_entire_grid( - const specfem::wavefield::type wavefield, - const specfem::wavefield::component component) { + const specfem::wavefield::simulation_field wavefield, + const specfem::wavefield::type component) { const int ncomponents = [&]() -> int { - if (component == specfem::wavefield::component::displacement) { + if (component == specfem::wavefield::type::displacement) { return 2; - } else if (component == specfem::wavefield::component::velocity) { + } else if (component == specfem::wavefield::type::velocity) { return 2; - } else if (component == specfem::wavefield::component::acceleration) { + } else if (component == specfem::wavefield::type::acceleration) { return 2; - } else if (component == specfem::wavefield::component::pressure) { + } else if (component == specfem::wavefield::type::pressure) { return 1; } else { throw std::runtime_error("Wavefield component not supported"); @@ -53,11 +53,11 @@ specfem::compute::assembly::generate_wavefield_on_entire_grid( }(); // Copy the required wavefield into the buffer - if (wavefield == specfem::wavefield::type::forward) { + if (wavefield == specfem::wavefield::simulation_field::forward) { specfem::compute::deep_copy(this->fields.buffer, this->fields.forward); - } else if (wavefield == specfem::wavefield::type::adjoint) { + } else if (wavefield == specfem::wavefield::simulation_field::adjoint) { specfem::compute::deep_copy(this->fields.buffer, this->fields.adjoint); - } else if (wavefield == specfem::wavefield::type::backward) { + } else if (wavefield == specfem::wavefield::simulation_field::backward) { specfem::compute::deep_copy(this->fields.buffer, this->fields.backward); } else { throw std::runtime_error("Wavefield type not supported"); diff --git a/src/compute/assembly/helper.hpp b/src/compute/assembly/helper.hpp index 630e1602..0ed72c33 100644 --- a/src/compute/assembly/helper.hpp +++ b/src/compute/assembly/helper.hpp @@ -34,7 +34,7 @@ class helper { } } - void operator()(const specfem::wavefield::component wavefield_type) { + void operator()(const specfem::wavefield::type wavefield_type) { const auto buffer = assembly.fields.buffer; const int nspec = assembly.mesh.nspec; @@ -124,12 +124,12 @@ class helper { // namespace impl { // template +// specfem::wavefield::type Component> // class field_type_parameters; // template // class field_type_parameters { +// specfem::wavefield::type::displacement> { // public: // constexpr static auto medium_tag = MediumTag; // constexpr static auto store_displacement = true; @@ -141,7 +141,7 @@ class helper { // template // class field_type_parameters { +// specfem::wavefield::type::velocity> { // public: // constexpr static auto medium_tag = MediumTag; // constexpr static auto store_displacement = false; @@ -153,7 +153,7 @@ class helper { // template // class field_type_parameters { +// specfem::wavefield::type::acceleration> { // public: // constexpr static auto medium_tag = MediumTag; // constexpr static auto store_displacement = false; @@ -165,11 +165,11 @@ class helper { // template +// specfem::wavefield::type Component, int NGLL> // class helper; // template +// specfem::wavefield::type Component, int NGLL> // class helper { // public: @@ -273,7 +273,7 @@ class helper { // }; // template +// specfem::wavefield::type Component, int NGLL> // class helper { // public: @@ -374,13 +374,13 @@ class helper { // const auto &active_field = [&]() { // if constexpr (Component == -// specfem::wavefield::component::displacement) { +// specfem::wavefield::type::displacement) { // return field.displacement; // } else if constexpr (Component == -// specfem::wavefield::component::velocity) { +// specfem::wavefield::type::velocity) { // return field.velocity; // } else if constexpr (Component == -// specfem::wavefield::component:: +// specfem::wavefield::type:: // acceleration) { // return field.acceleration; // } else { diff --git a/src/compute/fields/fields.cpp b/src/compute/fields/fields.cpp index c38d627c..5ecd406d 100644 --- a/src/compute/fields/fields.cpp +++ b/src/compute/fields/fields.cpp @@ -7,23 +7,23 @@ // Explcitly instantiate the template class template class specfem::compute::simulation_field< - specfem::wavefield::type::forward>; + specfem::wavefield::simulation_field::forward>; template class specfem::compute::simulation_field< - specfem::wavefield::type::adjoint>; + specfem::wavefield::simulation_field::adjoint>; template class specfem::compute::simulation_field< - specfem::wavefield::type::backward>; + specfem::wavefield::simulation_field::backward>; template class specfem::compute::simulation_field< - specfem::wavefield::type::buffer>; + specfem::wavefield::simulation_field::buffer>; specfem::compute::fields::fields(const specfem::compute::mesh &mesh, const specfem::compute::properties &properties, const specfem::simulation::type simulation) : // Initialize the forward field only if the simulation type is forward forward([&]() -> specfem::compute::simulation_field< - specfem::wavefield::type::forward> { + specfem::wavefield::simulation_field::forward> { if (simulation == specfem::simulation::type::forward) { return { mesh, properties }; } else if (simulation == specfem::simulation::type::combined) { @@ -34,7 +34,7 @@ specfem::compute::fields::fields(const specfem::compute::mesh &mesh, }()), // Initiaze the adjoint field only if the simulation type is adjoint adjoint([&]() -> specfem::compute::simulation_field< - specfem::wavefield::type::adjoint> { + specfem::wavefield::simulation_field::adjoint> { if (simulation == specfem::simulation::type::forward) { return {}; } else if (simulation == specfem::simulation::type::combined) { @@ -45,7 +45,7 @@ specfem::compute::fields::fields(const specfem::compute::mesh &mesh, }()), // Initialize the backward field only if the simulation type is adjoint backward([&]() -> specfem::compute::simulation_field< - specfem::wavefield::type::backward> { + specfem::wavefield::simulation_field::backward> { if (simulation == specfem::simulation::type::forward) { return {}; } else if (simulation == specfem::simulation::type::combined) { @@ -56,7 +56,7 @@ specfem::compute::fields::fields(const specfem::compute::mesh &mesh, }()), // Initialize the buffer field only if the simulation type is adjoint buffer([&]() -> specfem::compute::simulation_field< - specfem::wavefield::type::buffer> { + specfem::wavefield::simulation_field::buffer> { if (simulation == specfem::simulation::type::forward) { return { mesh, properties }; } else if (simulation == specfem::simulation::type::combined) { diff --git a/src/coupled_interface/coupled_interface.cpp b/src/coupled_interface/coupled_interface.cpp index 31a57fe1..e0952e9d 100644 --- a/src/coupled_interface/coupled_interface.cpp +++ b/src/coupled_interface/coupled_interface.cpp @@ -4,31 +4,31 @@ #include "enumerations/medium.hpp" template class specfem::coupled_interface::coupled_interface< - specfem::wavefield::type::forward, specfem::dimension::type::dim2, - specfem::element::medium_tag::elastic, + specfem::wavefield::simulation_field::forward, + specfem::dimension::type::dim2, specfem::element::medium_tag::elastic, specfem::element::medium_tag::acoustic>; template class specfem::coupled_interface::coupled_interface< - specfem::wavefield::type::forward, specfem::dimension::type::dim2, - specfem::element::medium_tag::acoustic, + specfem::wavefield::simulation_field::forward, + specfem::dimension::type::dim2, specfem::element::medium_tag::acoustic, specfem::element::medium_tag::elastic>; template class specfem::coupled_interface::coupled_interface< - specfem::wavefield::type::backward, specfem::dimension::type::dim2, - specfem::element::medium_tag::elastic, + specfem::wavefield::simulation_field::backward, + specfem::dimension::type::dim2, specfem::element::medium_tag::elastic, specfem::element::medium_tag::acoustic>; template class specfem::coupled_interface::coupled_interface< - specfem::wavefield::type::backward, specfem::dimension::type::dim2, - specfem::element::medium_tag::acoustic, + specfem::wavefield::simulation_field::backward, + specfem::dimension::type::dim2, specfem::element::medium_tag::acoustic, specfem::element::medium_tag::elastic>; template class specfem::coupled_interface::coupled_interface< - specfem::wavefield::type::adjoint, specfem::dimension::type::dim2, - specfem::element::medium_tag::elastic, + specfem::wavefield::simulation_field::adjoint, + specfem::dimension::type::dim2, specfem::element::medium_tag::elastic, specfem::element::medium_tag::acoustic>; template class specfem::coupled_interface::coupled_interface< - specfem::wavefield::type::adjoint, specfem::dimension::type::dim2, - specfem::element::medium_tag::acoustic, + specfem::wavefield::simulation_field::adjoint, + specfem::dimension::type::dim2, specfem::element::medium_tag::acoustic, specfem::element::medium_tag::elastic>; diff --git a/src/domain/domain.cpp b/src/domain/domain.cpp index d27cdb5c..d8076f02 100644 --- a/src/domain/domain.cpp +++ b/src/domain/domain.cpp @@ -12,49 +12,61 @@ using static_8 = } // namespace template class specfem::domain::domain< - specfem::wavefield::type::forward, specfem::dimension::type::dim2, - specfem::element::medium_tag::elastic, static_5>; + specfem::wavefield::simulation_field::forward, + specfem::dimension::type::dim2, specfem::element::medium_tag::elastic, + static_5>; template class specfem::domain::domain< - specfem::wavefield::type::adjoint, specfem::dimension::type::dim2, - specfem::element::medium_tag::elastic, static_5>; + specfem::wavefield::simulation_field::adjoint, + specfem::dimension::type::dim2, specfem::element::medium_tag::elastic, + static_5>; template class specfem::domain::domain< - specfem::wavefield::type::backward, specfem::dimension::type::dim2, - specfem::element::medium_tag::elastic, static_5>; + specfem::wavefield::simulation_field::backward, + specfem::dimension::type::dim2, specfem::element::medium_tag::elastic, + static_5>; template class specfem::domain::domain< - specfem::wavefield::type::forward, specfem::dimension::type::dim2, - specfem::element::medium_tag::acoustic, static_5>; + specfem::wavefield::simulation_field::forward, + specfem::dimension::type::dim2, specfem::element::medium_tag::acoustic, + static_5>; template class specfem::domain::domain< - specfem::wavefield::type::adjoint, specfem::dimension::type::dim2, - specfem::element::medium_tag::acoustic, static_5>; + specfem::wavefield::simulation_field::adjoint, + specfem::dimension::type::dim2, specfem::element::medium_tag::acoustic, + static_5>; template class specfem::domain::domain< - specfem::wavefield::type::backward, specfem::dimension::type::dim2, - specfem::element::medium_tag::acoustic, static_5>; + specfem::wavefield::simulation_field::backward, + specfem::dimension::type::dim2, specfem::element::medium_tag::acoustic, + static_5>; template class specfem::domain::domain< - specfem::wavefield::type::forward, specfem::dimension::type::dim2, - specfem::element::medium_tag::elastic, static_8>; + specfem::wavefield::simulation_field::forward, + specfem::dimension::type::dim2, specfem::element::medium_tag::elastic, + static_8>; template class specfem::domain::domain< - specfem::wavefield::type::adjoint, specfem::dimension::type::dim2, - specfem::element::medium_tag::elastic, static_8>; + specfem::wavefield::simulation_field::adjoint, + specfem::dimension::type::dim2, specfem::element::medium_tag::elastic, + static_8>; template class specfem::domain::domain< - specfem::wavefield::type::backward, specfem::dimension::type::dim2, - specfem::element::medium_tag::elastic, static_8>; + specfem::wavefield::simulation_field::backward, + specfem::dimension::type::dim2, specfem::element::medium_tag::elastic, + static_8>; template class specfem::domain::domain< - specfem::wavefield::type::forward, specfem::dimension::type::dim2, - specfem::element::medium_tag::acoustic, static_8>; + specfem::wavefield::simulation_field::forward, + specfem::dimension::type::dim2, specfem::element::medium_tag::acoustic, + static_8>; template class specfem::domain::domain< - specfem::wavefield::type::adjoint, specfem::dimension::type::dim2, - specfem::element::medium_tag::acoustic, static_8>; + specfem::wavefield::simulation_field::adjoint, + specfem::dimension::type::dim2, specfem::element::medium_tag::acoustic, + static_8>; template class specfem::domain::domain< - specfem::wavefield::type::backward, specfem::dimension::type::dim2, - specfem::element::medium_tag::acoustic, static_8>; + specfem::wavefield::simulation_field::backward, + specfem::dimension::type::dim2, specfem::element::medium_tag::acoustic, + static_8>; diff --git a/src/domain/impl/elements/kernel.cpp b/src/domain/impl/elements/kernel.cpp index 6e1ab90a..bfe2d824 100644 --- a/src/domain/impl/elements/kernel.cpp +++ b/src/domain/impl/elements/kernel.cpp @@ -1,9 +1,9 @@ #include "domain/impl/elements/kernel.hpp" #include "domain/impl/elements/kernel.tpp" -constexpr static auto forward = specfem::wavefield::type::forward; -constexpr static auto adjoint = specfem::wavefield::type::adjoint; -constexpr static auto backward = specfem::wavefield::type::backward; +constexpr static auto forward = specfem::wavefield::simulation_field::forward; +constexpr static auto adjoint = specfem::wavefield::simulation_field::adjoint; +constexpr static auto backward = specfem::wavefield::simulation_field::backward; constexpr static auto dim2 = specfem::dimension::type::dim2; diff --git a/src/domain/impl/kernels.cpp b/src/domain/impl/kernels.cpp index 8cbce89b..28692e58 100644 --- a/src/domain/impl/kernels.cpp +++ b/src/domain/impl/kernels.cpp @@ -13,49 +13,61 @@ using static_8 = // Explicit template instantiation template class specfem::domain::impl::kernels::kernels< - specfem::wavefield::type::forward, specfem::dimension::type::dim2, - specfem::element::medium_tag::elastic, static_5>; + specfem::wavefield::simulation_field::forward, + specfem::dimension::type::dim2, specfem::element::medium_tag::elastic, + static_5>; template class specfem::domain::impl::kernels::kernels< - specfem::wavefield::type::adjoint, specfem::dimension::type::dim2, - specfem::element::medium_tag::elastic, static_5>; + specfem::wavefield::simulation_field::adjoint, + specfem::dimension::type::dim2, specfem::element::medium_tag::elastic, + static_5>; template class specfem::domain::impl::kernels::kernels< - specfem::wavefield::type::backward, specfem::dimension::type::dim2, - specfem::element::medium_tag::elastic, static_5>; + specfem::wavefield::simulation_field::backward, + specfem::dimension::type::dim2, specfem::element::medium_tag::elastic, + static_5>; template class specfem::domain::impl::kernels::kernels< - specfem::wavefield::type::forward, specfem::dimension::type::dim2, - specfem::element::medium_tag::acoustic, static_5>; + specfem::wavefield::simulation_field::forward, + specfem::dimension::type::dim2, specfem::element::medium_tag::acoustic, + static_5>; template class specfem::domain::impl::kernels::kernels< - specfem::wavefield::type::adjoint, specfem::dimension::type::dim2, - specfem::element::medium_tag::acoustic, static_5>; + specfem::wavefield::simulation_field::adjoint, + specfem::dimension::type::dim2, specfem::element::medium_tag::acoustic, + static_5>; template class specfem::domain::impl::kernels::kernels< - specfem::wavefield::type::backward, specfem::dimension::type::dim2, - specfem::element::medium_tag::acoustic, static_5>; + specfem::wavefield::simulation_field::backward, + specfem::dimension::type::dim2, specfem::element::medium_tag::acoustic, + static_5>; template class specfem::domain::impl::kernels::kernels< - specfem::wavefield::type::forward, specfem::dimension::type::dim2, - specfem::element::medium_tag::elastic, static_8>; + specfem::wavefield::simulation_field::forward, + specfem::dimension::type::dim2, specfem::element::medium_tag::elastic, + static_8>; template class specfem::domain::impl::kernels::kernels< - specfem::wavefield::type::adjoint, specfem::dimension::type::dim2, - specfem::element::medium_tag::elastic, static_8>; + specfem::wavefield::simulation_field::adjoint, + specfem::dimension::type::dim2, specfem::element::medium_tag::elastic, + static_8>; template class specfem::domain::impl::kernels::kernels< - specfem::wavefield::type::backward, specfem::dimension::type::dim2, - specfem::element::medium_tag::elastic, static_8>; + specfem::wavefield::simulation_field::backward, + specfem::dimension::type::dim2, specfem::element::medium_tag::elastic, + static_8>; template class specfem::domain::impl::kernels::kernels< - specfem::wavefield::type::forward, specfem::dimension::type::dim2, - specfem::element::medium_tag::acoustic, static_8>; + specfem::wavefield::simulation_field::forward, + specfem::dimension::type::dim2, specfem::element::medium_tag::acoustic, + static_8>; template class specfem::domain::impl::kernels::kernels< - specfem::wavefield::type::adjoint, specfem::dimension::type::dim2, - specfem::element::medium_tag::acoustic, static_8>; + specfem::wavefield::simulation_field::adjoint, + specfem::dimension::type::dim2, specfem::element::medium_tag::acoustic, + static_8>; template class specfem::domain::impl::kernels::kernels< - specfem::wavefield::type::backward, specfem::dimension::type::dim2, - specfem::element::medium_tag::acoustic, static_8>; + specfem::wavefield::simulation_field::backward, + specfem::dimension::type::dim2, specfem::element::medium_tag::acoustic, + static_8>; diff --git a/src/kernels/kernels.cpp b/src/kernels/kernels.cpp index 3f0f8e20..55fe1c46 100644 --- a/src/kernels/kernels.cpp +++ b/src/kernels/kernels.cpp @@ -2,25 +2,28 @@ // Explicit template instantiation template class specfem::kernels::kernels< - specfem::wavefield::type::forward, specfem::dimension::type::dim2, + specfem::wavefield::simulation_field::forward, + specfem::dimension::type::dim2, specfem::enums::element::quadrature::static_quadrature_points<5> >; template class specfem::kernels::kernels< - specfem::wavefield::type::adjoint, specfem::dimension::type::dim2, + specfem::wavefield::simulation_field::adjoint, + specfem::dimension::type::dim2, specfem::enums::element::quadrature::static_quadrature_points<5> >; template class specfem::kernels::kernels< - specfem::wavefield::type::backward, specfem::dimension::type::dim2, + specfem::wavefield::simulation_field::backward, + specfem::dimension::type::dim2, specfem::enums::element::quadrature::static_quadrature_points<5> >; -// template class kernels>; -// template class kernels>; -// template class kernels>; diff --git a/src/parameter_parser/setup.cpp b/src/parameter_parser/setup.cpp index 5dd563d1..8c35ac47 100644 --- a/src/parameter_parser/setup.cpp +++ b/src/parameter_parser/setup.cpp @@ -121,11 +121,11 @@ specfem::runtime_configuration::setup::setup(const std::string ¶meter_file, } if (const YAML::Node &n_plotter = n_writer["display"]) { - if (n_plotter["wavefield_type"] && - n_plotter["wavefield_type"].as() != "forward") { + if ((n_plotter["simulation-field"] && + n_plotter["simulation-field"].as() != "forward")) { std::ostringstream message; message << "Error: Plotting a " - << n_plotter["wavefield_type"].as() + << n_plotter["simulation-field"].as() << " wavefield in forward simulation mode. \n"; throw std::runtime_error(message.str()); } @@ -206,8 +206,8 @@ specfem::runtime_configuration::setup::setup(const std::string ¶meter_file, } if (const YAML::Node &n_plotter = n_writer["display"]) { - if (n_plotter["wavefield_type"] && - n_plotter["wavefield_type"].as() == "forward") { + if (n_plotter["simulation-field"] && + n_plotter["simulation-field"].as() == "forward") { std::ostringstream message; message << "Error: Plotting a forward wavefield in combined " << "simulation mode. \n"; diff --git a/src/parameter_parser/writer/plot_wavefield.cpp b/src/parameter_parser/writer/plot_wavefield.cpp index 796d9f24..6b03cbe7 100644 --- a/src/parameter_parser/writer/plot_wavefield.cpp +++ b/src/parameter_parser/writer/plot_wavefield.cpp @@ -14,6 +14,10 @@ specfem::runtime_configuration::plot_wavefield::plot_wavefield( } }(); + if (output_format == "on_screen") { + throw std::runtime_error("On screen plotting not supported"); + } + const std::string output_folder = [&]() -> std::string { if (Node["directory"]) { return Node["directory"].as(); @@ -30,26 +34,26 @@ specfem::runtime_configuration::plot_wavefield::plot_wavefield( } const std::string component = [&]() -> std::string { - if (Node["component"]) { - return Node["component"].as(); + if (Node["field"]) { + return Node["field"].as(); } else { throw std::runtime_error( - "Wavefield component not specified in the display section"); + "Plotting wavefield not specified in the display section"); } }(); const std::string wavefield_type = [&]() -> std::string { - if (Node["wavefield_type"]) { - return Node["wavefield_type"].as(); + if (Node["simulation-field"]) { + return Node["simulation-field"].as(); } else { throw std::runtime_error( - "Wavefield type not specified in the display section"); + "Simulation field type not specified in the display section"); } }(); const int time_interval = [&]() -> int { - if (Node["time_interval"]) { - return Node["time_interval"].as(); + if (Node["time-interval"]) { + return Node["time-interval"].as(); } else { throw std::runtime_error( "Time interval not specified in the display section"); @@ -95,9 +99,9 @@ specfem::runtime_configuration::plot_wavefield::instantiate_wavefield_plotter( const auto wavefield = [&]() { if (this->wavefield_type == "forward") { - return specfem::wavefield::type::forward; + return specfem::wavefield::simulation_field::forward; } else if (this->wavefield_type == "adjoint") { - return specfem::wavefield::type::adjoint; + return specfem::wavefield::simulation_field::adjoint; } else { throw std::runtime_error("Unknown wavefield type in the display section"); } diff --git a/src/plotter/plot_wavefield.cpp b/src/plotter/plot_wavefield.cpp index dafd5c0a..d7122188 100644 --- a/src/plotter/plot_wavefield.cpp +++ b/src/plotter/plot_wavefield.cpp @@ -120,18 +120,19 @@ map_materials_with_color(const specfem::compute::assembly &assembly) { } vtkSmartPointer get_wavefield_on_vtk_grid( - specfem::compute::assembly &assembly, const specfem::wavefield::type type, + specfem::compute::assembly &assembly, + const specfem::wavefield::simulation_field type, const specfem::display::wavefield &display_component) { const auto component = [&display_component]() { if (display_component == specfem::display::wavefield::displacement) { - return specfem::wavefield::component::displacement; + return specfem::wavefield::type::displacement; } else if (display_component == specfem::display::wavefield::velocity) { - return specfem::wavefield::component::velocity; + return specfem::wavefield::type::velocity; } else if (display_component == specfem::display::wavefield::acceleration) { - return specfem::wavefield::component::acceleration; + return specfem::wavefield::type::acceleration; } else if (display_component == specfem::display::wavefield::pressure) { - return specfem::wavefield::component::pressure; + return specfem::wavefield::type::pressure; } else { throw std::runtime_error("Unsupported component"); } @@ -175,7 +176,7 @@ vtkSmartPointer get_wavefield_on_vtk_grid( points->InsertNextPoint(coordinates(0, icell, z_index[i], x_index[i]), coordinates(1, icell, z_index[i], x_index[i]), 0.0); - if (component == specfem::wavefield::component::pressure) { + if (component == specfem::wavefield::type::pressure) { scalars->InsertNextValue( std::sqrt(wavefield(icell, z_index[i], x_index[i], 0) * wavefield(icell, z_index[i], x_index[i], 0))); diff --git a/src/source/read_sources.cpp b/src/source/read_sources.cpp index 93ba9f3f..0c8a390f 100644 --- a/src/source/read_sources.cpp +++ b/src/source/read_sources.cpp @@ -16,13 +16,13 @@ specfem::sources::read_sources( 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/compute_wavefield/compute_wavefield.cpp b/tests/unit-tests/assembly/compute_wavefield/compute_wavefield.cpp index be31fc38..cb3593ec 100644 --- a/tests/unit-tests/assembly/compute_wavefield/compute_wavefield.cpp +++ b/tests/unit-tests/assembly/compute_wavefield/compute_wavefield.cpp @@ -11,7 +11,7 @@ #include #include -template +template void test_element_wavefield( const int ispec, const Kokkos::View @@ -40,8 +40,8 @@ void test_element_wavefield( } } -template +template void test_compute_wavefield(specfem::compute::assembly &assembly) { const auto ispecs = generate_data(assembly); @@ -57,8 +57,9 @@ void test_compute_wavefield(specfem::compute::assembly &assembly) { void test_compute_wavefield(specfem::compute::assembly &assembly) { try { - test_compute_wavefield(assembly); + test_compute_wavefield( + assembly); } catch (std::exception &e) { std::ostringstream message; message << "Error in computing displacement wavefield: \n\t" << e.what(); @@ -66,8 +67,9 @@ void test_compute_wavefield(specfem::compute::assembly &assembly) { } try { - test_compute_wavefield(assembly); + test_compute_wavefield( + assembly); } catch (std::exception &e) { std::ostringstream message; message << "Error in computing velocity wavefield: \n\t" << e.what(); @@ -75,8 +77,9 @@ void test_compute_wavefield(specfem::compute::assembly &assembly) { } try { - test_compute_wavefield(assembly); + test_compute_wavefield( + assembly); } catch (std::exception &e) { std::ostringstream message; message << "Error in computing acceleration wavefield: \n\t" << e.what(); @@ -84,8 +87,9 @@ void test_compute_wavefield(specfem::compute::assembly &assembly) { } try { - test_compute_wavefield(assembly); + test_compute_wavefield( + assembly); } catch (std::exception &e) { std::ostringstream message; message << "Error in computing pressure wavefield: \n\t" << e.what(); diff --git a/tests/unit-tests/assembly/compute_wavefield/generate_data.hpp b/tests/unit-tests/assembly/compute_wavefield/generate_data.hpp index 893109d3..ad302b7f 100644 --- a/tests/unit-tests/assembly/compute_wavefield/generate_data.hpp +++ b/tests/unit-tests/assembly/compute_wavefield/generate_data.hpp @@ -8,8 +8,9 @@ #include "point/coordinates.hpp" #include "point/field.hpp" -template void generate_data(specfem::compute::assembly &assembly, std::vector &ispecs) { @@ -60,8 +61,8 @@ void generate_data(specfem::compute::assembly &assembly, field.copy_to_device(); } -template +template std::vector generate_data(specfem::compute::assembly &assembly) { std::vector ispecs; diff --git a/tests/unit-tests/assembly/compute_wavefield/test_helper.hpp b/tests/unit-tests/assembly/compute_wavefield/test_helper.hpp index 7a174737..52d45d06 100644 --- a/tests/unit-tests/assembly/compute_wavefield/test_helper.hpp +++ b/tests/unit-tests/assembly/compute_wavefield/test_helper.hpp @@ -19,12 +19,12 @@ #include "point/coordinates.hpp" #include "point/field.hpp" -template class test_helper; -template +template class test_helper { @@ -39,7 +39,7 @@ class test_helper::num_components; + component>::num_components(); const int ngllz = assembly.mesh.ngllz; const int ngllx = assembly.mesh.ngllx; @@ -75,7 +75,7 @@ class test_helper -class test_helper { public: @@ -89,7 +89,7 @@ class test_helper::num_components; + specfem::wavefield::type::pressure>::num_components(); const int ngllz = assembly.mesh.ngllz; const int ngllx = assembly.mesh.ngllx; @@ -138,7 +138,7 @@ class test_helper +template class test_helper { @@ -153,7 +153,7 @@ class test_helper::num_components; + component>::num_components(); const int ngllz = assembly.mesh.ngllz; const int ngllx = assembly.mesh.ngllx; @@ -201,7 +201,7 @@ class test_helper -class test_helper { @@ -216,7 +216,7 @@ class test_helper::num_components; + specfem::wavefield::type::pressure>::num_components(); const int ngllz = assembly.mesh.ngllz; const int ngllx = assembly.mesh.ngllx; diff --git a/tests/unit-tests/domain/rmass_inverse_tests.cpp b/tests/unit-tests/domain/rmass_inverse_tests.cpp index 35e1e698..c0a590b4 100644 --- a/tests/unit-tests/domain/rmass_inverse_tests.cpp +++ b/tests/unit-tests/domain/rmass_inverse_tests.cpp @@ -137,13 +137,14 @@ TEST(DOMAIN_TESTS, rmass_inverse) { const type_real dt = setup.get_dt(); specfem::domain::domain< - specfem::wavefield::type::forward, specfem::dimension::type::dim2, - specfem::element::medium_tag::elastic, + specfem::wavefield::simulation_field::forward, + specfem::dimension::type::dim2, specfem::element::medium_tag::elastic, specfem::enums::element::quadrature::static_quadrature_points<5> > elastic_domain_static(dt, assembly, qp5); specfem::domain::domain< - specfem::wavefield::type::forward, specfem::dimension::type::dim2, + specfem::wavefield::simulation_field::forward, + specfem::dimension::type::dim2, specfem::element::medium_tag::acoustic, specfem::enums::element::quadrature::static_quadrature_points<5> > acoustic_domain_static(dt, assembly, qp5); diff --git a/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp b/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp index f4d66364..7d723edf 100644 --- a/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp +++ b/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp @@ -119,8 +119,8 @@ TEST(SEISMOGRAM_TESTS, acoustic_seismograms_test) { specfem::enums::element::quadrature::static_quadrature_points<5> qp5; specfem::domain::domain< - specfem::wavefield::type::forward, specfem::dimension::type::dim2, - specfem::element::medium_tag::acoustic, + specfem::wavefield::simulation_field::forward, + specfem::dimension::type::dim2, specfem::element::medium_tag::acoustic, specfem::enums::element::quadrature::static_quadrature_points<5> > acoustic_domain_static(setup.get_dt(), assembly, qp5); diff --git a/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp b/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp index 5b4fe756..12304c61 100644 --- a/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp +++ b/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp @@ -119,8 +119,8 @@ TEST(SEISMOGRAM_TESTS, elastic_seismograms_test) { specfem::enums::element::quadrature::static_quadrature_points<5> qp5; specfem::domain::domain< - specfem::wavefield::type::forward, specfem::dimension::type::dim2, - specfem::element::medium_tag::elastic, + specfem::wavefield::simulation_field::forward, + specfem::dimension::type::dim2, specfem::element::medium_tag::elastic, specfem::enums::element::quadrature::static_quadrature_points<5> > elastic_domain_static(setup.get_dt(), assembly, qp5); From b33013a5836a51338b6d8cec859ab6a8e69e805f Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Tue, 26 Nov 2024 11:12:37 -0500 Subject: [PATCH 47/53] Rogue mesh::interfaces -- MPI interface module not used. Was trying to link something that is not used, or done. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c8a1b37..ede111b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -209,7 +209,7 @@ add_library( src/mesh/boundaries/acoustic_free_surface.cpp src/mesh/elements/tangential_elements.cpp src/mesh/elements/axial_elements.cpp - src/mesh/mpi_interfaces/mpi_interfaces.cpp + # src/mesh/mpi_interfaces/mpi_interfaces.cpp src/mesh/materials/materials.cpp src/mesh/coupled_interfaces/interface_container.cpp src/mesh/coupled_interfaces/coupled_interfaces.cpp From 1b6123638504f14817390ee1f8b3085fd0b5a3ac Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Tue, 26 Nov 2024 11:33:16 -0500 Subject: [PATCH 48/53] Fixed doxygen docs for compute_wavefield --- .gitignore | 1 + docs/output.txt | 2163 -------------------------- include/medium/compute_wavefield.hpp | 5 +- 3 files changed, 5 insertions(+), 2164 deletions(-) delete mode 100644 docs/output.txt diff --git a/.gitignore b/.gitignore index ad703ba3..c28ec6b4 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ firebase*.yml *.out debug.sh output.log +output.txt results/ timing.sh examples/*/*_config.yaml diff --git a/docs/output.txt b/docs/output.txt deleted file mode 100644 index a373dc1b..00000000 --- a/docs/output.txt +++ /dev/null @@ -1,2163 +0,0 @@ -warning: ignoring unsupported tag `CREATE_SUBDIRS_LEVEL =' at line 92, file Doxyfile.in -warning: ignoring unsupported tag `JAVADOC_BANNER =' at line 221, file Doxyfile.in -warning: ignoring unsupported tag `PYTHON_DOCSTRING =' at line 249, file Doxyfile.in -warning: ignoring unsupported tag `OPTIMIZE_OUTPUT_SLICE =' at line 325, file Doxyfile.in -warning: ignoring unsupported tag `NUM_PROC_THREADS =' at line 491, file Doxyfile.in -warning: ignoring unsupported tag `EXTRACT_PRIV_VIRTUAL =' at line 517, file Doxyfile.in -warning: ignoring unsupported tag `RESOLVE_UNNAMED_PARAMS =' at line 561, file Doxyfile.in -warning: ignoring unsupported tag `SHOW_HEADERFILE =' at line 634, file Doxyfile.in -warning: ignoring unsupported tag `WARN_IF_INCOMPLETE_DOC =' at line 852, file Doxyfile.in -warning: ignoring unsupported tag `WARN_LINE_FORMAT =' at line 892, file Doxyfile.in -warning: ignoring unsupported tag `DOCSET_FEEDURL =' at line 1406, file Doxyfile.in -warning: ignoring unsupported tag `FULL_SIDEBAR =' at line 1617, file Doxyfile.in -warning: ignoring unsupported tag `OBFUSCATE_EMAILS =' at line 1648, file Doxyfile.in -warning: ignoring unsupported tag `HTML_FORMULA_FORMAT =' at line 1659, file Doxyfile.in -warning: ignoring unsupported tag `FORMULA_MACROFILE =' at line 1685, file Doxyfile.in -warning: ignoring unsupported tag `MATHJAX_VERSION =' at line 1707, file Doxyfile.in -warning: ignoring unsupported tag `LATEX_MAKEINDEX_CMD =' at line 1896, file Doxyfile.in -warning: ignoring unsupported tag `LATEX_EMOJI_DIRECTORY =' at line 2031, file Doxyfile.in -warning: ignoring unsupported tag `XML_NS_MEMB_FILE_SCOPE =' at line 2165, file Doxyfile.in -warning: ignoring unsupported tag `DOT_UML_DETAILS =' at line 2480, file Doxyfile.in -warning: ignoring unsupported tag `DOT_WRAP_THRESHOLD =' at line 2489, file Doxyfile.in -warning: ignoring unsupported tag `DIR_GRAPH_MAX_DEPTH =' at line 2562, file Doxyfile.in -/scratch/gpfs/rk9481/specfem2d_kokkos/include/compute/compute_receivers.hpp:102: warning: The following parameters of specfem::compute::receivers::receivers(const std::vector< specfem::receivers::receiver * > &receivers, const std::vector< specfem::enums::seismogram::type > &stypes, const specfem::quadrature::quadrature *quadx, const specfem::quadrature::quadrature *quadz, const type_real xmax, const type_real xmin, const type_real zmax, const type_real zmin, const int max_sig_step, specfem::MPI::MPI *mpi) are not documented: - parameter 'xmax' - parameter 'xmin' - parameter 'zmax' - parameter 'zmin' - parameter 'max_sig_step' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/compute/compute_sources.hpp:56: warning: The following parameters of specfem::compute::sources::sources(const std::vector< specfem::sources::source * > &sources, const specfem::quadrature::quadrature *quadx, const specfem::quadrature::quadrature *quadz, const type_real xmax, const type_real xmin, const type_real zmax, const type_real zmin, specfem::MPI::MPI *mpi) are not documented: - parameter 'xmax' - parameter 'xmin' - parameter 'zmax' - parameter 'zmin' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/domain.hpp:143: warning: argument 'seismogram_types' of command @param is not found in the argument list of specfem::domain::domain< medium, qp_type >::compute_seismogram(const int isig_step) -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:51: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:51: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:75: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, quadrature_points >::compute_gradient(const int &ispec, const int &xz, const ScratchViewType< type_real, 1 > s_hprime_xx, const ScratchViewType< type_real, 1 > s_hprime_zz, const ScratchViewType< type_real, medium::components > field_chi, type_real *dchidxl, type_real *dchidzl) const=0 are not documented: - parameter 'ispec' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:51: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:51: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:51: warning: Found unknown command `\sum_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:51: warning: Found unknown command `\Omega_e' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:51: warning: Found unknown command `\sum_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:51: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:51: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:52: warning: Found unknown command `\omega_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:52: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:52: warning: Found unknown command `\omega_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:52: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:52: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:52: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:61: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, quadrature_points >::compute_mass_matrix_component(const int &ispec, const int &xz, type_real *mass_matrix) const=0 are not documented: - parameter 'ispec' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:83: warning: argument 'dchipdzl' of command @param is not found in the argument list of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, quadrature_points >::compute_stress(const int &ispec, const int &xz, const type_real *dchidxl, const type_real *dchidzl, type_real *stress_integrand_xi, type_real *stress_integrand_gamma) const=0 -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:104: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, quadrature_points >::compute_stress(const int &ispec, const int &xz, const type_real *dchidxl, const type_real *dchidzl, type_real *stress_integrand_xi, type_real *stress_integrand_gamma) const=0 are not documented: - parameter 'ispec' - parameter 'dchidzl' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:115: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:115: warning: Found unknown command `\gamma' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:115: warning: Found unknown command `\rho' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:115: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:115: warning: Found unknown command `\gamma' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:115: warning: Found unknown command `\partial_x' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:115: warning: Found unknown command `\chi' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:115: warning: Found unknown command `\partial_x' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:116: warning: Found unknown command `\xi' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:116: warning: Found unknown command `\partial_z' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:116: warning: Found unknown command `\chi' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:116: warning: Found unknown command `\partial_z' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:116: warning: Found unknown command `\xi' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:109: warning: argument 'field_dot_dot' of command @param is not found in the argument list of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, quadrature_points >::update_acceleration(const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium::components > stress_integrand_xi, const ScratchViewType< type_real, medium::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const=0 -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:127: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, quadrature_points >::update_acceleration(const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium::components > stress_integrand_xi, const ScratchViewType< type_real, medium::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const=0 are not documented: - parameter 'acceleration' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:80: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:80: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:69: warning: argument 'ispec' of command @param is not found in the argument list of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::element(const specfem::compute::partial_derivatives partial_derivatives, const specfem::compute::properties properties) -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:140: warning: argument 'field_dot_dot' of command @param is not found in the argument list of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::compute_acceleration(const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium_type::components > stress_integrand_xi, const ScratchViewType< type_real, medium_type::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:161: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::compute_acceleration(const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium_type::components > stress_integrand_xi, const ScratchViewType< type_real, medium_type::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const are not documented: - parameter 'acceleration' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:106: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::compute_gradient(const int &ispec, const int &xz, const ScratchViewType< type_real, 1 > s_hprime_xx, const ScratchViewType< type_real, 1 > s_hprime_zz, const ScratchViewType< type_real, medium_type::components > field_chi, type_real *dchidxl, type_real *dchidzl) const are not documented: - parameter 'ispec' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:80: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:80: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:80: warning: Found unknown command `\sum_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:80: warning: Found unknown command `\Omega_e' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:80: warning: Found unknown command `\sum_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:80: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:80: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:81: warning: Found unknown command `\omega_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:81: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:81: warning: Found unknown command `\omega_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:81: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:81: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:81: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:90: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::compute_mass_matrix_component(const int &ispec, const int &xz, type_real *mass_matrix) const are not documented: - parameter 'ispec' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:114: warning: argument 'dchipdzl' of command @param is not found in the argument list of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::compute_stress(const int &ispec, const int &xz, const type_real *dchidxl, const type_real *dchidzl, type_real *stress_integrand_xi, type_real *stress_integrand_gamma) const -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:135: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::compute_stress(const int &ispec, const int &xz, const type_real *dchidxl, const type_real *dchidzl, type_real *stress_integrand_xi, type_real *stress_integrand_gamma) const are not documented: - parameter 'ispec' - parameter 'dchidzl' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:53: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:53: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:80: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, qp_type >::compute_gradient(const int &ispec, const int &xz, const ScratchViewType< type_real, 1 > s_hprime_xx, const ScratchViewType< type_real, 1 > s_hprime_zz, const ScratchViewType< type_real, medium_type::components > u, type_real *dudxl, type_real *dudzl) const=0 are not documented: - parameter 'ispec' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:53: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:53: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:53: warning: Found unknown command `\sum_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:53: warning: Found unknown command `\Omega_e' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:53: warning: Found unknown command `\sum_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:53: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:53: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:54: warning: Found unknown command `\omega_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:54: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:54: warning: Found unknown command `\omega_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:54: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:54: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:54: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:63: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, qp_type >::compute_mass_matrix_component(const int &ispec, const int &xz, type_real *mass_matrix) const=0 are not documented: - parameter 'ispec' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:104: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, qp_type >::compute_stress(const int &ispec, const int &xz, const type_real *dudxl, const type_real *dudzl, type_real *stress_integrand_xi, type_real *stress_integrand_gamma) const=0 are not documented: - parameter 'ispec' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:109: warning: argument 'stress_integrand_1' of command @param is not found in the argument list of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, qp_type >::update_acceleration(const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium_type::components > stress_integrand_xi, const ScratchViewType< type_real, medium_type::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const=0 -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:109: warning: argument 'stress_integrand_2' of command @param is not found in the argument list of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, qp_type >::update_acceleration(const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium_type::components > stress_integrand_xi, const ScratchViewType< type_real, medium_type::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const=0 -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:109: warning: argument 'field_dot_dot' of command @param is not found in the argument list of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, qp_type >::update_acceleration(const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium_type::components > stress_integrand_xi, const ScratchViewType< type_real, medium_type::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const=0 -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:127: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, qp_type >::update_acceleration(const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium_type::components > stress_integrand_xi, const ScratchViewType< type_real, medium_type::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const=0 are not documented: - parameter 'stress_integrand_xi' - parameter 'stress_integrand_gamma' - parameter 'acceleration' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:84: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:84: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:145: warning: argument 'field_dot_dot' of command @param is not found in the argument list of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::compute_acceleration(const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium_type::components > stress_integrand_xi, const ScratchViewType< type_real, medium_type::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:163: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::compute_acceleration(const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium_type::components > stress_integrand_xi, const ScratchViewType< type_real, medium_type::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const are not documented: - parameter 'acceleration' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:84: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:84: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:84: warning: Found unknown command `\sum_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:84: warning: Found unknown command `\Omega_e' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:84: warning: Found unknown command `\sum_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:84: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:84: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:85: warning: Found unknown command `\omega_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:85: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:85: warning: Found unknown command `\omega_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:85: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:85: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:85: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/receivers/elastic/elastic2d_isotropic.hpp:85: warning: argument 'siesmogram_type' of command @param is not found in the argument list of specfem::domain::impl::receivers::receiver< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::get_field(const int &ireceiver, const int &iseis, const int &ispec, const specfem::enums::seismogram::type &seismogram_type, const int &xz, const int &isig_step, const ScratchViewType< type_real, medium_type::components > field, const ScratchViewType< type_real, medium_type::components > field_dot, const ScratchViewType< type_real, medium_type::components > field_dot_dot, const ScratchViewType< type_real, 1 > s_hprime_xx, const ScratchViewType< type_real, 1 > s_hprime_zz) const -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/receivers/elastic/elastic2d_isotropic.hpp:85: warning: argument 'hprime_xx' of command @param is not found in the argument list of specfem::domain::impl::receivers::receiver< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::get_field(const int &ireceiver, const int &iseis, const int &ispec, const specfem::enums::seismogram::type &seismogram_type, const int &xz, const int &isig_step, const ScratchViewType< type_real, medium_type::components > field, const ScratchViewType< type_real, medium_type::components > field_dot, const ScratchViewType< type_real, medium_type::components > field_dot_dot, const ScratchViewType< type_real, 1 > s_hprime_xx, const ScratchViewType< type_real, 1 > s_hprime_zz) const -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/receivers/elastic/elastic2d_isotropic.hpp:85: warning: argument 'hprime_zz' of command @param is not found in the argument list of specfem::domain::impl::receivers::receiver< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::get_field(const int &ireceiver, const int &iseis, const int &ispec, const specfem::enums::seismogram::type &seismogram_type, const int &xz, const int &isig_step, const ScratchViewType< type_real, medium_type::components > field, const ScratchViewType< type_real, medium_type::components > field_dot, const ScratchViewType< type_real, medium_type::components > field_dot_dot, const ScratchViewType< type_real, 1 > s_hprime_xx, const ScratchViewType< type_real, 1 > s_hprime_zz) const -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/receivers/elastic/elastic2d_isotropic.hpp:101: warning: The following parameters of specfem::domain::impl::receivers::receiver< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::get_field(const int &ireceiver, const int &iseis, const int &ispec, const specfem::enums::seismogram::type &seismogram_type, const int &xz, const int &isig_step, const ScratchViewType< type_real, medium_type::components > field, const ScratchViewType< type_real, medium_type::components > field_dot, const ScratchViewType< type_real, medium_type::components > field_dot_dot, const ScratchViewType< type_real, 1 > s_hprime_xx, const ScratchViewType< type_real, 1 > s_hprime_zz) const are not documented: - parameter 'seismogram_type' - parameter 's_hprime_xx' - parameter 's_hprime_zz' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/sources/elastic/elastic2d_isotropic.hpp:70: warning: The following parameters of specfem::domain::impl::sources::source< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::source(const specfem::compute::properties &properties, specfem::kokkos::DeviceView4d< type_real > source_array) are not documented: - parameter 'properties' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/jacobian/jacobian.hpp:220: warning: argument 'teamMember' of command @param is not found in the argument list of specfem::jacobian::compute_inverted_derivatives(const specfem::kokkos::HostView2d< type_real > s_coorg, const int ngnod, const type_real xi, const type_real gamma) -/scratch/gpfs/rk9481/specfem2d_kokkos/include/jacobian/jacobian.hpp:159: warning: The following parameters of specfem::jacobian::compute_jacobian(const specfem::kokkos::HostTeam::member_type &teamMember, const specfem::kokkos::HostScratchView2d< type_real > s_coorg, const int ngnod, const type_real xi, const type_real gamma) are not documented: - parameter 'teamMember' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/jacobian/jacobian.hpp:174: warning: The following parameters of specfem::jacobian::compute_jacobian(const specfem::kokkos::HostTeam::member_type &teamMember, const specfem::kokkos::HostScratchView2d< type_real > s_coorg, const int ngnod, const specfem::kokkos::HostView2d< type_real > dershape2D) are not documented: - parameter 'teamMember' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/jacobian/jacobian.hpp:65: warning: argument 'coorg' of command @param is not found in the argument list of specfem::jacobian::compute_locations(const specfem::kokkos::HostView2d< type_real > s_coorg, const int ngnod, const specfem::kokkos::HostView1d< type_real > shape2D) -/scratch/gpfs/rk9481/specfem2d_kokkos/include/jacobian/jacobian.hpp:74: warning: The following parameters of specfem::jacobian::compute_locations(const specfem::kokkos::HostView2d< type_real > s_coorg, const int ngnod, const specfem::kokkos::HostView1d< type_real > shape2D) are not documented: - parameter 's_coorg' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/jacobian/jacobian.hpp:119: warning: argument 'teamMember' of command @param is not found in the argument list of specfem::jacobian::compute_partial_derivatives(const specfem::kokkos::HostView2d< type_real > s_coorg, const int ngnod, const type_real xi, const type_real gamma) -/scratch/gpfs/rk9481/specfem2d_kokkos/include/kokkos_abstractions.h:574: warning: Unsupported xml/html tag found -/scratch/gpfs/rk9481/specfem2d_kokkos/include/kokkos_abstractions.h:574: warning: Unsupported xml/html tag found -/scratch/gpfs/rk9481/specfem2d_kokkos/include/mesh/mesh.hpp:82: warning: The following parameters of specfem::mesh::mesh::mesh(const std::string filename, std::vector< specfem::material::material * > &materials, const specfem::MPI::MPI *mpi) are not documented: - parameter 'materials' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/specfem_mpi/specfem_mpi.hpp:212: warning: The following parameters of specfem::MPI::MPI::bcast(int &val, int root) const are not documented: - parameter 'root' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/specfem_mpi/specfem_mpi.hpp:218: warning: The following parameters of specfem::MPI::MPI::bcast(float &val, int root) const are not documented: - parameter 'root' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/specfem_mpi/specfem_mpi.hpp:224: warning: The following parameters of specfem::MPI::MPI::bcast(double &val, int root) const are not documented: - parameter 'root' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/quadrature/quadrature.hpp:23: warning: argument 'alpha' of command @param is not found in the argument list of specfem::quadrature::quadrature::get_xi() const -/scratch/gpfs/rk9481/specfem2d_kokkos/include/quadrature/quadrature.hpp:23: warning: argument 'beta' of command @param is not found in the argument list of specfem::quadrature::quadrature::get_xi() const -/scratch/gpfs/rk9481/specfem2d_kokkos/include/parameter_parser/seismogram.hpp:48: warning: The following parameters of specfem::runtime_configuration::seismogram::instantiate_seismogram_writer(std::vector< specfem::receivers::receiver * > &receivers, specfem::compute::receivers *compute_receivers, const type_real dt, const type_real t0, const int nsteps_between_samples) const are not documented: - parameter 'nsteps_between_samples' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/solver/time_marching.hpp:33: warning: The following parameters of specfem::solver::time_marching::time_marching(specfem::domain::domain< specfem::enums::element::medium::acoustic, qp_type > &acoustic_domain, specfem::domain::domain< specfem::enums::element::medium::elastic, qp_type > &elastic_domain, specfem::coupled_interface::coupled_interface< specfem::domain::domain< specfem::enums::element::medium::acoustic, qp_type >, specfem::domain::domain< specfem::enums::element::medium::elastic, qp_type > > &acoustic_elastic_interface, specfem::coupled_interface::coupled_interface< specfem::domain::domain< specfem::enums::element::medium::elastic, qp_type >, specfem::domain::domain< specfem::enums::element::medium::acoustic, qp_type > > &elastic_acoustic_interface, specfem::TimeScheme::TimeScheme *it) are not documented: - parameter 'acoustic_elastic_interface' - parameter 'elastic_acoustic_interface' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/source/force_source.hpp:25: warning: argument 'force_source' of command @param is not found in the argument list of specfem::sources::force::force(YAML::Node &Node, const type_real dt) -/scratch/gpfs/rk9481/specfem2d_kokkos/include/source/force_source.hpp:31: warning: The following parameters of specfem::sources::force::force(YAML::Node &Node, const type_real dt) are not documented: - parameter 'Node' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/source/moment_tensor_source.hpp:26: warning: argument 'moment_tensor' of command @param is not found in the argument list of specfem::sources::moment_tensor::moment_tensor(YAML::Node &Node, const type_real dt) -/scratch/gpfs/rk9481/specfem2d_kokkos/include/source/moment_tensor_source.hpp:31: warning: The following parameters of specfem::sources::moment_tensor::moment_tensor(YAML::Node &Node, const type_real dt) are not documented: - parameter 'Node' - parameter 'dt' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/timescheme/newmark.hpp:25: warning: The following parameters of specfem::TimeScheme::Newmark::Newmark(const int nstep, const type_real t0, const type_real dt, const int nstep_between_samples) are not documented: - parameter 'nstep_between_samples' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/timescheme/newmark.hpp:74: warning: argument 'domain_class' of command @param is not found in the argument list of specfem::TimeScheme::Newmark::apply_corrector_phase(specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot_dot) -/scratch/gpfs/rk9481/specfem2d_kokkos/include/timescheme/newmark.hpp:78: warning: The following parameters of specfem::TimeScheme::Newmark::apply_corrector_phase(specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot_dot) are not documented: - parameter 'field' - parameter 'field_dot' - parameter 'field_dot_dot' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/timescheme/newmark.hpp:64: warning: argument 'domain_class' of command @param is not found in the argument list of specfem::TimeScheme::Newmark::apply_predictor_phase(specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot_dot) -/scratch/gpfs/rk9481/specfem2d_kokkos/include/timescheme/newmark.hpp:68: warning: The following parameters of specfem::TimeScheme::Newmark::apply_predictor_phase(specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot_dot) are not documented: - parameter 'field' - parameter 'field_dot' - parameter 'field_dot_dot' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/timescheme/timescheme.hpp:63: warning: argument 'domain_class' of command @param is not found in the argument list of specfem::TimeScheme::TimeScheme::apply_corrector_phase(specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot_dot) -/scratch/gpfs/rk9481/specfem2d_kokkos/include/timescheme/timescheme.hpp:67: warning: The following parameters of specfem::TimeScheme::TimeScheme::apply_corrector_phase(specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot_dot) are not documented: - parameter 'field' - parameter 'field_dot' - parameter 'field_dot_dot' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/timescheme/timescheme.hpp:53: warning: argument 'domain_class' of command @param is not found in the argument list of specfem::TimeScheme::TimeScheme::apply_predictor_phase(specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot_dot) -/scratch/gpfs/rk9481/specfem2d_kokkos/include/timescheme/timescheme.hpp:57: warning: The following parameters of specfem::TimeScheme::TimeScheme::apply_predictor_phase(specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot_dot) are not documented: - parameter 'field' - parameter 'field_dot' - parameter 'field_dot_dot' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/domain.hpp:143: warning: argument 'seismogram_types' of command @param is not found in the argument list of specfem::domain::domain< medium, qp_type >::compute_seismogram(const int isig_step) -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:51: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:51: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:51: warning: Found unknown command `\sum_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:51: warning: Found unknown command `\Omega_e' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:51: warning: Found unknown command `\sum_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:51: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:51: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:52: warning: Found unknown command `\omega_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:52: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:52: warning: Found unknown command `\omega_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:52: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:52: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:52: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:61: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, quadrature_points >::compute_mass_matrix_component(const int &ispec, const int &xz, type_real *mass_matrix) const=0 are not documented: - parameter 'ispec' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:75: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, quadrature_points >::compute_gradient(const int &ispec, const int &xz, const ScratchViewType< type_real, 1 > s_hprime_xx, const ScratchViewType< type_real, 1 > s_hprime_zz, const ScratchViewType< type_real, medium::components > field_chi, type_real *dchidxl, type_real *dchidzl) const=0 are not documented: - parameter 'ispec' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:83: warning: argument 'dchipdzl' of command @param is not found in the argument list of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, quadrature_points >::compute_stress(const int &ispec, const int &xz, const type_real *dchidxl, const type_real *dchidzl, type_real *stress_integrand_xi, type_real *stress_integrand_gamma) const=0 -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:104: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, quadrature_points >::compute_stress(const int &ispec, const int &xz, const type_real *dchidxl, const type_real *dchidzl, type_real *stress_integrand_xi, type_real *stress_integrand_gamma) const=0 are not documented: - parameter 'ispec' - parameter 'dchidzl' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:115: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:115: warning: Found unknown command `\gamma' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:115: warning: Found unknown command `\rho' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:115: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:115: warning: Found unknown command `\gamma' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:115: warning: Found unknown command `\partial_x' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:115: warning: Found unknown command `\chi' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:115: warning: Found unknown command `\partial_x' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:116: warning: Found unknown command `\xi' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:116: warning: Found unknown command `\partial_z' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:116: warning: Found unknown command `\chi' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:116: warning: Found unknown command `\partial_z' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:116: warning: Found unknown command `\xi' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:109: warning: argument 'field_dot_dot' of command @param is not found in the argument list of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, quadrature_points >::update_acceleration(const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium::components > stress_integrand_xi, const ScratchViewType< type_real, medium::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const=0 -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d.hpp:127: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, quadrature_points >::update_acceleration(const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium::components > stress_integrand_xi, const ScratchViewType< type_real, medium::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const=0 are not documented: - parameter 'acceleration' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:69: warning: argument 'ispec' of command @param is not found in the argument list of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::element(const specfem::compute::partial_derivatives partial_derivatives, const specfem::compute::properties properties) -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:80: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:80: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:80: warning: Found unknown command `\sum_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:80: warning: Found unknown command `\Omega_e' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:80: warning: Found unknown command `\sum_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:80: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:80: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:81: warning: Found unknown command `\omega_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:81: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:81: warning: Found unknown command `\omega_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:81: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:81: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:81: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:90: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::compute_mass_matrix_component(const int &ispec, const int &xz, type_real *mass_matrix) const are not documented: - parameter 'ispec' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:106: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::compute_gradient(const int &ispec, const int &xz, const ScratchViewType< type_real, 1 > s_hprime_xx, const ScratchViewType< type_real, 1 > s_hprime_zz, const ScratchViewType< type_real, medium_type::components > field_chi, type_real *dchidxl, type_real *dchidzl) const are not documented: - parameter 'ispec' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:114: warning: argument 'dchipdzl' of command @param is not found in the argument list of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::compute_stress(const int &ispec, const int &xz, const type_real *dchidxl, const type_real *dchidzl, type_real *stress_integrand_xi, type_real *stress_integrand_gamma) const -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:135: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::compute_stress(const int &ispec, const int &xz, const type_real *dchidxl, const type_real *dchidzl, type_real *stress_integrand_xi, type_real *stress_integrand_gamma) const are not documented: - parameter 'ispec' - parameter 'dchidzl' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:140: warning: argument 'field_dot_dot' of command @param is not found in the argument list of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::compute_acceleration(const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium_type::components > stress_integrand_xi, const ScratchViewType< type_real, medium_type::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/acoustic/acoustic2d_isotropic.hpp:161: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::acoustic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::compute_acceleration(const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium_type::components > stress_integrand_xi, const ScratchViewType< type_real, medium_type::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const are not documented: - parameter 'acceleration' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:53: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:53: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:53: warning: Found unknown command `\sum_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:53: warning: Found unknown command `\Omega_e' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:53: warning: Found unknown command `\sum_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:53: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:53: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:54: warning: Found unknown command `\omega_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:54: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:54: warning: Found unknown command `\omega_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:54: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:54: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:54: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:63: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, qp_type >::compute_mass_matrix_component(const int &ispec, const int &xz, type_real *mass_matrix) const=0 are not documented: - parameter 'ispec' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:80: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, qp_type >::compute_gradient(const int &ispec, const int &xz, const ScratchViewType< type_real, 1 > s_hprime_xx, const ScratchViewType< type_real, 1 > s_hprime_zz, const ScratchViewType< type_real, medium_type::components > u, type_real *dudxl, type_real *dudzl) const=0 are not documented: - parameter 'ispec' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:104: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, qp_type >::compute_stress(const int &ispec, const int &xz, const type_real *dudxl, const type_real *dudzl, type_real *stress_integrand_xi, type_real *stress_integrand_gamma) const=0 are not documented: - parameter 'ispec' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:109: warning: argument 'stress_integrand_1' of command @param is not found in the argument list of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, qp_type >::update_acceleration(const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium_type::components > stress_integrand_xi, const ScratchViewType< type_real, medium_type::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const=0 -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:109: warning: argument 'stress_integrand_2' of command @param is not found in the argument list of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, qp_type >::update_acceleration(const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium_type::components > stress_integrand_xi, const ScratchViewType< type_real, medium_type::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const=0 -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:109: warning: argument 'field_dot_dot' of command @param is not found in the argument list of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, qp_type >::update_acceleration(const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium_type::components > stress_integrand_xi, const ScratchViewType< type_real, medium_type::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const=0 -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d.hpp:127: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, qp_type >::update_acceleration(const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium_type::components > stress_integrand_xi, const ScratchViewType< type_real, medium_type::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const=0 are not documented: - parameter 'stress_integrand_xi' - parameter 'stress_integrand_gamma' - parameter 'acceleration' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:84: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:84: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:84: warning: Found unknown command `\sum_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:84: warning: Found unknown command `\Omega_e' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:84: warning: Found unknown command `\sum_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:84: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:84: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:85: warning: Found unknown command `\omega_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:85: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:85: warning: Found unknown command `\omega_' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:85: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:85: warning: Found unknown command `\alpha' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:85: warning: Found unknown command `\beta' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:145: warning: argument 'field_dot_dot' of command @param is not found in the argument list of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::compute_acceleration(const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium_type::components > stress_integrand_xi, const ScratchViewType< type_real, medium_type::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/elements/elastic/elastic2d_isotropic.hpp:163: warning: The following parameters of specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::compute_acceleration(const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium_type::components > stress_integrand_xi, const ScratchViewType< type_real, medium_type::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const are not documented: - parameter 'acceleration' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/source/force_source.hpp:25: warning: argument 'force_source' of command @param is not found in the argument list of specfem::sources::force::force(YAML::Node &Node, const type_real dt) -/scratch/gpfs/rk9481/specfem2d_kokkos/include/source/force_source.hpp:31: warning: The following parameters of specfem::sources::force::force(YAML::Node &Node, const type_real dt) are not documented: - parameter 'Node' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/mesh/mesh.hpp:82: warning: The following parameters of specfem::mesh::mesh::mesh(const std::string filename, std::vector< specfem::material::material * > &materials, const specfem::MPI::MPI *mpi) are not documented: - parameter 'materials' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/source/moment_tensor_source.hpp:26: warning: argument 'moment_tensor' of command @param is not found in the argument list of specfem::sources::moment_tensor::moment_tensor(YAML::Node &Node, const type_real dt) -/scratch/gpfs/rk9481/specfem2d_kokkos/include/source/moment_tensor_source.hpp:31: warning: The following parameters of specfem::sources::moment_tensor::moment_tensor(YAML::Node &Node, const type_real dt) are not documented: - parameter 'Node' - parameter 'dt' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/specfem_mpi/specfem_mpi.hpp:212: warning: The following parameters of specfem::MPI::MPI::bcast(int &val, int root) const are not documented: - parameter 'root' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/specfem_mpi/specfem_mpi.hpp:218: warning: The following parameters of specfem::MPI::MPI::bcast(float &val, int root) const are not documented: - parameter 'root' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/specfem_mpi/specfem_mpi.hpp:224: warning: The following parameters of specfem::MPI::MPI::bcast(double &val, int root) const are not documented: - parameter 'root' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/timescheme/newmark.hpp:25: warning: The following parameters of specfem::TimeScheme::Newmark::Newmark(const int nstep, const type_real t0, const type_real dt, const int nstep_between_samples) are not documented: - parameter 'nstep_between_samples' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/timescheme/newmark.hpp:64: warning: argument 'domain_class' of command @param is not found in the argument list of specfem::TimeScheme::Newmark::apply_predictor_phase(specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot_dot) -/scratch/gpfs/rk9481/specfem2d_kokkos/include/timescheme/newmark.hpp:68: warning: The following parameters of specfem::TimeScheme::Newmark::apply_predictor_phase(specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot_dot) are not documented: - parameter 'field' - parameter 'field_dot' - parameter 'field_dot_dot' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/timescheme/newmark.hpp:74: warning: argument 'domain_class' of command @param is not found in the argument list of specfem::TimeScheme::Newmark::apply_corrector_phase(specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot_dot) -/scratch/gpfs/rk9481/specfem2d_kokkos/include/timescheme/newmark.hpp:78: warning: The following parameters of specfem::TimeScheme::Newmark::apply_corrector_phase(specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot_dot) are not documented: - parameter 'field' - parameter 'field_dot' - parameter 'field_dot_dot' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/quadrature/quadrature.hpp:23: warning: argument 'alpha' of command @param is not found in the argument list of specfem::quadrature::quadrature::get_xi() const -/scratch/gpfs/rk9481/specfem2d_kokkos/include/quadrature/quadrature.hpp:23: warning: argument 'beta' of command @param is not found in the argument list of specfem::quadrature::quadrature::get_xi() const -/scratch/gpfs/rk9481/specfem2d_kokkos/include/receiver/receiver.hpp:133: warning: Found unknown command `\xi' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/receiver/receiver.hpp:134: warning: Found unknown command `\gamma' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/receivers/elastic/elastic2d_isotropic.hpp:85: warning: argument 'siesmogram_type' of command @param is not found in the argument list of specfem::domain::impl::receivers::receiver< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::get_field(const int &ireceiver, const int &iseis, const int &ispec, const specfem::enums::seismogram::type &seismogram_type, const int &xz, const int &isig_step, const ScratchViewType< type_real, medium_type::components > field, const ScratchViewType< type_real, medium_type::components > field_dot, const ScratchViewType< type_real, medium_type::components > field_dot_dot, const ScratchViewType< type_real, 1 > s_hprime_xx, const ScratchViewType< type_real, 1 > s_hprime_zz) const -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/receivers/elastic/elastic2d_isotropic.hpp:85: warning: argument 'hprime_xx' of command @param is not found in the argument list of specfem::domain::impl::receivers::receiver< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::get_field(const int &ireceiver, const int &iseis, const int &ispec, const specfem::enums::seismogram::type &seismogram_type, const int &xz, const int &isig_step, const ScratchViewType< type_real, medium_type::components > field, const ScratchViewType< type_real, medium_type::components > field_dot, const ScratchViewType< type_real, medium_type::components > field_dot_dot, const ScratchViewType< type_real, 1 > s_hprime_xx, const ScratchViewType< type_real, 1 > s_hprime_zz) const -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/receivers/elastic/elastic2d_isotropic.hpp:85: warning: argument 'hprime_zz' of command @param is not found in the argument list of specfem::domain::impl::receivers::receiver< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::get_field(const int &ireceiver, const int &iseis, const int &ispec, const specfem::enums::seismogram::type &seismogram_type, const int &xz, const int &isig_step, const ScratchViewType< type_real, medium_type::components > field, const ScratchViewType< type_real, medium_type::components > field_dot, const ScratchViewType< type_real, medium_type::components > field_dot_dot, const ScratchViewType< type_real, 1 > s_hprime_xx, const ScratchViewType< type_real, 1 > s_hprime_zz) const -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/receivers/elastic/elastic2d_isotropic.hpp:101: warning: The following parameters of specfem::domain::impl::receivers::receiver< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::get_field(const int &ireceiver, const int &iseis, const int &ispec, const specfem::enums::seismogram::type &seismogram_type, const int &xz, const int &isig_step, const ScratchViewType< type_real, medium_type::components > field, const ScratchViewType< type_real, medium_type::components > field_dot, const ScratchViewType< type_real, medium_type::components > field_dot_dot, const ScratchViewType< type_real, 1 > s_hprime_xx, const ScratchViewType< type_real, 1 > s_hprime_zz) const are not documented: - parameter 'seismogram_type' - parameter 's_hprime_xx' - parameter 's_hprime_zz' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/compute/compute_receivers.hpp:102: warning: The following parameters of specfem::compute::receivers::receivers(const std::vector< specfem::receivers::receiver * > &receivers, const std::vector< specfem::enums::seismogram::type > &stypes, const specfem::quadrature::quadrature *quadx, const specfem::quadrature::quadrature *quadz, const type_real xmax, const type_real xmin, const type_real zmax, const type_real zmin, const int max_sig_step, specfem::MPI::MPI *mpi) are not documented: - parameter 'xmax' - parameter 'xmin' - parameter 'zmax' - parameter 'zmin' - parameter 'max_sig_step' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/parameter_parser/seismogram.hpp:48: warning: The following parameters of specfem::runtime_configuration::seismogram::instantiate_seismogram_writer(std::vector< specfem::receivers::receiver * > &receivers, specfem::compute::receivers *compute_receivers, const type_real dt, const type_real t0, const int nsteps_between_samples) const are not documented: - parameter 'nsteps_between_samples' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/domain/impl/sources/elastic/elastic2d_isotropic.hpp:70: warning: The following parameters of specfem::domain::impl::sources::source< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >::source(const specfem::compute::properties &properties, specfem::kokkos::DeviceView4d< type_real > source_array) are not documented: - parameter 'properties' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/compute/compute_sources.hpp:56: warning: The following parameters of specfem::compute::sources::sources(const std::vector< specfem::sources::source * > &sources, const specfem::quadrature::quadrature *quadx, const specfem::quadrature::quadrature *quadz, const type_real xmax, const type_real xmin, const type_real zmax, const type_real zmin, specfem::MPI::MPI *mpi) are not documented: - parameter 'xmax' - parameter 'xmin' - parameter 'zmax' - parameter 'zmin' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/kokkos_abstractions.h:574: warning: Unsupported xml/html tag found -/scratch/gpfs/rk9481/specfem2d_kokkos/include/kokkos_abstractions.h:574: warning: Unsupported xml/html tag found -/scratch/gpfs/rk9481/specfem2d_kokkos/include/solver/time_marching.hpp:33: warning: The following parameters of specfem::solver::time_marching::time_marching(specfem::domain::domain< specfem::enums::element::medium::acoustic, qp_type > &acoustic_domain, specfem::domain::domain< specfem::enums::element::medium::elastic, qp_type > &elastic_domain, specfem::coupled_interface::coupled_interface< specfem::domain::domain< specfem::enums::element::medium::acoustic, qp_type >, specfem::domain::domain< specfem::enums::element::medium::elastic, qp_type > > &acoustic_elastic_interface, specfem::coupled_interface::coupled_interface< specfem::domain::domain< specfem::enums::element::medium::elastic, qp_type >, specfem::domain::domain< specfem::enums::element::medium::acoustic, qp_type > > &elastic_acoustic_interface, specfem::TimeScheme::TimeScheme *it) are not documented: - parameter 'acoustic_elastic_interface' - parameter 'elastic_acoustic_interface' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/timescheme/timescheme.hpp:53: warning: argument 'domain_class' of command @param is not found in the argument list of specfem::TimeScheme::TimeScheme::apply_predictor_phase(specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot_dot) -/scratch/gpfs/rk9481/specfem2d_kokkos/include/timescheme/timescheme.hpp:57: warning: The following parameters of specfem::TimeScheme::TimeScheme::apply_predictor_phase(specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot_dot) are not documented: - parameter 'field' - parameter 'field_dot' - parameter 'field_dot_dot' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/timescheme/timescheme.hpp:63: warning: argument 'domain_class' of command @param is not found in the argument list of specfem::TimeScheme::TimeScheme::apply_corrector_phase(specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot_dot) -/scratch/gpfs/rk9481/specfem2d_kokkos/include/timescheme/timescheme.hpp:67: warning: The following parameters of specfem::TimeScheme::TimeScheme::apply_corrector_phase(specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot_dot) are not documented: - parameter 'field' - parameter 'field_dot' - parameter 'field_dot_dot' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/enumerations/specfem_enums.hpp:19: warning: Internal inconsistency: member x does not belong to any container! -/scratch/gpfs/rk9481/specfem2d_kokkos/include/enumerations/specfem_enums.hpp:19: warning: Internal inconsistency: member x does not belong to any container! -/scratch/gpfs/rk9481/specfem2d_kokkos/include/enumerations/specfem_enums.hpp:20: warning: Internal inconsistency: member y does not belong to any container! -/scratch/gpfs/rk9481/specfem2d_kokkos/include/enumerations/specfem_enums.hpp:20: warning: Internal inconsistency: member y does not belong to any container! -/scratch/gpfs/rk9481/specfem2d_kokkos/include/enumerations/specfem_enums.hpp:22: warning: Internal inconsistency: member z does not belong to any container! -/scratch/gpfs/rk9481/specfem2d_kokkos/include/enumerations/specfem_enums.hpp:22: warning: Internal inconsistency: member z does not belong to any container! -/scratch/gpfs/rk9481/specfem2d_kokkos/include/enumerations/specfem_enums.hpp:30: warning: Internal inconsistency: member displacement does not belong to any container! -/scratch/gpfs/rk9481/specfem2d_kokkos/include/enumerations/specfem_enums.hpp:30: warning: Internal inconsistency: member displacement does not belong to any container! -/scratch/gpfs/rk9481/specfem2d_kokkos/include/enumerations/specfem_enums.hpp:31: warning: Internal inconsistency: member velocity does not belong to any container! -/scratch/gpfs/rk9481/specfem2d_kokkos/include/enumerations/specfem_enums.hpp:31: warning: Internal inconsistency: member velocity does not belong to any container! -/scratch/gpfs/rk9481/specfem2d_kokkos/include/enumerations/specfem_enums.hpp:33: warning: Internal inconsistency: member acceleration does not belong to any container! -/scratch/gpfs/rk9481/specfem2d_kokkos/include/enumerations/specfem_enums.hpp:33: warning: Internal inconsistency: member acceleration does not belong to any container! -/scratch/gpfs/rk9481/specfem2d_kokkos/include/jacobian/jacobian.hpp:65: warning: argument 'coorg' of command @param is not found in the argument list of specfem::jacobian::compute_locations(const specfem::kokkos::HostView2d< type_real > s_coorg, const int ngnod, const specfem::kokkos::HostView1d< type_real > shape2D) -/scratch/gpfs/rk9481/specfem2d_kokkos/include/jacobian/jacobian.hpp:74: warning: The following parameters of specfem::jacobian::compute_locations(const specfem::kokkos::HostView2d< type_real > s_coorg, const int ngnod, const specfem::kokkos::HostView1d< type_real > shape2D) are not documented: - parameter 's_coorg' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/jacobian/jacobian.hpp:119: warning: argument 'teamMember' of command @param is not found in the argument list of specfem::jacobian::compute_partial_derivatives(const specfem::kokkos::HostView2d< type_real > s_coorg, const int ngnod, const type_real xi, const type_real gamma) -/scratch/gpfs/rk9481/specfem2d_kokkos/include/jacobian/jacobian.hpp:159: warning: The following parameters of specfem::jacobian::compute_jacobian(const specfem::kokkos::HostTeam::member_type &teamMember, const specfem::kokkos::HostScratchView2d< type_real > s_coorg, const int ngnod, const type_real xi, const type_real gamma) are not documented: - parameter 'teamMember' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/jacobian/jacobian.hpp:174: warning: The following parameters of specfem::jacobian::compute_jacobian(const specfem::kokkos::HostTeam::member_type &teamMember, const specfem::kokkos::HostScratchView2d< type_real > s_coorg, const int ngnod, const specfem::kokkos::HostView2d< type_real > dershape2D) are not documented: - parameter 'teamMember' -/scratch/gpfs/rk9481/specfem2d_kokkos/include/jacobian/jacobian.hpp:220: warning: argument 'teamMember' of command @param is not found in the argument list of specfem::jacobian::compute_inverted_derivatives(const specfem::kokkos::HostView2d< type_real > s_coorg, const int ngnod, const type_real xi, const type_real gamma) -/scratch/gpfs/rk9481/specfem2d_kokkos/include/source/read_sources.hpp:20: warning: The following parameters of specfem::sources::read_sources(const std::string sources_file, const type_real dt, const specfem::MPI::MPI *mpi) are not documented: - parameter 'dt' -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/IO/fortran_io.rst:1: WARNING: malformed hyperlink target. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/IO/mesh/boundaries/index.rst:7: WARNING: toctree contains reference to nonexisting document 'api/IO/mesh/boundaries/forcing_boundaries' -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/IO/mesh/elements/index.rst:1: WARNING: malformed hyperlink target. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/IO/mesh/index.rst:1: ERROR: Unknown directive type "mesh_io". - -.. mesh_io:: -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/IO/mesh/index.rst:18: WARNING: toctree contains reference to nonexisting document 'api/IO/mesh/coupling/index' -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/compute/compute.rst:1: WARNING: malformed hyperlink target. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/compute/compute_coupled_interfaces.rst:1: WARNING: malformed hyperlink target. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/compute/compute_partial_derivatives.rst:1: WARNING: malformed hyperlink target. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/compute/compute_properties.rst:1: WARNING: malformed hyperlink target. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/compute/compute_receivers.rst:1: WARNING: malformed hyperlink target. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/compute/compute_sources.rst:1: WARNING: malformed hyperlink target. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/compute/index.rst:1: WARNING: malformed hyperlink target. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/compute/index.rst:8: ERROR: Error in "toctree" directive: -invalid option block. - -.. toctree:: - :maxdepth: 1 - compute - compute_partial_derivatives - compute_properties - compute_sources - compute_receivers - compute_coupled_interfaces -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/coupling_physics/coupled_interface.rst:44: WARNING: Duplicate C++ declaration, also defined at api/coupling_physics/coupled_interface:8. -Declaration is '.. cpp:class:: template specfem::coupled_interface::coupled_interface'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/coupling_physics/coupled_interface.rst:3: CRITICAL: Duplicate ID: "classspecfem_1_1coupled__interface_1_1coupled__interface". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/coupling_physics/coupled_interface.rst:3: WARNING: Duplicate explicit target name: "classspecfem_1_1coupled__interface_1_1coupled__interface". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/coupling_physics/coupled_interface.rst:51: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 16] - KOKKOS_FUNCTION int npoints (const specfem::enums::coupling::edge::type &edge, const int ngllx, const int ngllz) - ----------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: int [error at 19] - KOKKOS_FUNCTION int npoints (const specfem::enums::coupling::edge::type &edge, const int ngllx, const int ngllz) - -------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: int [error at 19] - KOKKOS_FUNCTION int npoints (const specfem::enums::coupling::edge::type &edge, const int ngllx, const int ngllz) - -------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/coupling_physics/coupled_interface.rst:51: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 16] - KOKKOS_FUNCTION void self_iterator (const int &ipoint, const specfem::enums::coupling::edge::type &edge, const int ngllx, const int ngllz, int &i, int &j) - ----------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 20] - KOKKOS_FUNCTION void self_iterator (const int &ipoint, const specfem::enums::coupling::edge::type &edge, const int ngllx, const int ngllz, int &i, int &j) - --------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 20] - KOKKOS_FUNCTION void self_iterator (const int &ipoint, const specfem::enums::coupling::edge::type &edge, const int ngllx, const int ngllz, int &i, int &j) - --------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/coupling_physics/coupled_interface.rst:51: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 16] - KOKKOS_FUNCTION void coupled_iterator (const int &ipoint, const specfem::enums::coupling::edge::type &edge, const int ngllx, const int ngllz, int &i, int &j) - ----------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 20] - KOKKOS_FUNCTION void coupled_iterator (const int &ipoint, const specfem::enums::coupling::edge::type &edge, const int ngllx, const int ngllz, int &i, int &j) - --------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 20] - KOKKOS_FUNCTION void coupled_iterator (const int &ipoint, const specfem::enums::coupling::edge::type &edge, const int ngllx, const int ngllz, int &i, int &j) - --------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/coupling_physics/edge/edge.rst:8: WARNING: duplicate label definition, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/coupling_physics/coupled_interface.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/coupling_physics/edge/edge.rst:13: WARNING: duplicate label interface, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/coupling_physics/coupled_interface.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/coupling_physics/edge/edge.rst:21: WARNING: duplicate label parameters, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/coupling_physics/coupled_interface.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/coupling_physics/edge/elastic_acoustic/acoustic_elastic_edge.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 16] - KOKKOS_FUNCTION void compute_coupling (const int &iedge, const int &ipoint) const - ----------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 20] - KOKKOS_FUNCTION void compute_coupling (const int &iedge, const int &ipoint) const - --------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 20] - KOKKOS_FUNCTION void compute_coupling (const int &iedge, const int &ipoint) const - --------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/coupling_physics/edge/elastic_acoustic/acoustic_elastic_edge.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 23] - inline KOKKOS_FUNCTION void get_edges (const int &iedge, specfem::enums::coupling::edge::type &self_edge_type, specfem::enums::coupling::edge::type &coupled_edge_type) const - -----------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 27] - inline KOKKOS_FUNCTION void get_edges (const int &iedge, specfem::enums::coupling::edge::type &self_edge_type, specfem::enums::coupling::edge::type &coupled_edge_type) const - ---------------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 27] - inline KOKKOS_FUNCTION void get_edges (const int &iedge, specfem::enums::coupling::edge::type &self_edge_type, specfem::enums::coupling::edge::type &coupled_edge_type) const - ---------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/coupling_physics/edge/elastic_acoustic/elastic_acoustic_edge.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 16] - KOKKOS_FUNCTION void compute_coupling (const int &iedge, const int &ipoint) const - ----------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 20] - KOKKOS_FUNCTION void compute_coupling (const int &iedge, const int &ipoint) const - --------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 20] - KOKKOS_FUNCTION void compute_coupling (const int &iedge, const int &ipoint) const - --------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/coupling_physics/edge/elastic_acoustic/elastic_acoustic_edge.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 23] - inline KOKKOS_FUNCTION void get_edges (const int &iedge, specfem::enums::coupling::edge::type &self_edge_type, specfem::enums::coupling::edge::type &coupled_edge_type) const - -----------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 27] - inline KOKKOS_FUNCTION void get_edges (const int &iedge, specfem::enums::coupling::edge::type &self_edge_type, specfem::enums::coupling::edge::type &coupled_edge_type) const - ---------------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 27] - inline KOKKOS_FUNCTION void get_edges (const int &iedge, specfem::enums::coupling::edge::type &self_edge_type, specfem::enums::coupling::edge::type &coupled_edge_type) const - ---------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/domain.rst:1: WARNING: malformed hyperlink target. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/domain.rst:22: WARNING: malformed hyperlink target. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/domain.rst:26: WARNING: malformed hyperlink target. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/domain.rst:30: WARNING: malformed hyperlink target. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/domain.rst:50: WARNING: Duplicate C++ declaration, also defined at api/domain/domain:9. -Declaration is '.. cpp:class:: template specfem::domain::domain'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/domain.rst:4: CRITICAL: Duplicate ID: "classspecfem_1_1domain_1_1domain". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/domain.rst:4: WARNING: Duplicate explicit target name: "classspecfem_1_1domain_1_1domain". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/domain.rst:7: WARNING: duplicate label definition, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/coupling_physics/edge/edge.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/domain.rst:12: WARNING: duplicate label interface, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/coupling_physics/edge/edge.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/domain.rst:20: WARNING: duplicate label parameters, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/coupling_physics/edge/edge.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements.rst:1: WARNING: malformed hyperlink target. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements.rst:9: WARNING: duplicate label definition, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/domain.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements.rst:14: WARNING: duplicate label interface, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/domain.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements.rst:22: WARNING: duplicate label parameters, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/domain.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements.rst:82: WARNING: duplicate label template specializations, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/coupling_physics/edge/edge.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_acoustic_static_quadrature_points_isotropic.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 23] - KOKKOS_INLINE_FUNCTION void compute_mass_matrix_component (const int &ispec, const int &xz, type_real *mass_matrix) const - -----------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 27] - KOKKOS_INLINE_FUNCTION void compute_mass_matrix_component (const int &ispec, const int &xz, type_real *mass_matrix) const - ---------------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 27] - KOKKOS_INLINE_FUNCTION void compute_mass_matrix_component (const int &ispec, const int &xz, type_real *mass_matrix) const - ---------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_acoustic_static_quadrature_points_isotropic.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 23] - KOKKOS_INLINE_FUNCTION void compute_gradient (const int &ispec, const int &xz, const ScratchViewType< type_real, 1 > s_hprime_xx, const ScratchViewType< type_real, 1 > s_hprime_zz, const ScratchViewType< type_real, medium_type::components > u, type_real *dudxl, type_real *dudzl) const - -----------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 27] - KOKKOS_INLINE_FUNCTION void compute_gradient (const int &ispec, const int &xz, const ScratchViewType< type_real, 1 > s_hprime_xx, const ScratchViewType< type_real, 1 > s_hprime_zz, const ScratchViewType< type_real, medium_type::components > u, type_real *dudxl, type_real *dudzl) const - ---------------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 27] - KOKKOS_INLINE_FUNCTION void compute_gradient (const int &ispec, const int &xz, const ScratchViewType< type_real, 1 > s_hprime_xx, const ScratchViewType< type_real, 1 > s_hprime_zz, const ScratchViewType< type_real, medium_type::components > u, type_real *dudxl, type_real *dudzl) const - ---------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_acoustic_static_quadrature_points_isotropic.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 23] - KOKKOS_INLINE_FUNCTION void compute_stress (const int &ispec, const int &xz, const type_real *dudxl, const type_real *dudzl, type_real *stress_integrand_xi, type_real *stress_integrand_gamma) const - -----------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 27] - KOKKOS_INLINE_FUNCTION void compute_stress (const int &ispec, const int &xz, const type_real *dudxl, const type_real *dudzl, type_real *stress_integrand_xi, type_real *stress_integrand_gamma) const - ---------------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 27] - KOKKOS_INLINE_FUNCTION void compute_stress (const int &ispec, const int &xz, const type_real *dudxl, const type_real *dudzl, type_real *stress_integrand_xi, type_real *stress_integrand_gamma) const - ---------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_acoustic_static_quadrature_points_isotropic.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 23] - KOKKOS_INLINE_FUNCTION void compute_acceleration (const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium_type::components > stress_integrand_xi, const ScratchViewType< type_real, medium_type::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const - -----------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 27] - KOKKOS_INLINE_FUNCTION void compute_acceleration (const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium_type::components > stress_integrand_xi, const ScratchViewType< type_real, medium_type::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const - ---------------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 27] - KOKKOS_INLINE_FUNCTION void compute_acceleration (const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium_type::components > stress_integrand_xi, const ScratchViewType< type_real, medium_type::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const - ---------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_elastic_static_quadrature_points_isotropic.rst:2: WARNING: Duplicate C++ declaration, also defined at api/domain/element/elements_dim2_acoustic_static_quadrature_points_isotropic:2. -Declaration is '.. cpp:class:: template specfem::domain::impl::elements::element< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_elastic_static_quadrature_points_isotropic.rst:2: WARNING: Duplicate C++ declaration, also defined at api/domain/element/elements_dim2_acoustic_static_quadrature_points_isotropic:2. -Declaration is '.. cpp:type:: dimension = specfem::enums::element::dimension::dim2'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_elastic_static_quadrature_points_isotropic.rst:2: WARNING: Duplicate C++ declaration, also defined at api/domain/element/elements_dim2_acoustic_static_quadrature_points_isotropic:2. -Declaration is '.. cpp:type:: medium_type = specfem::enums::element::medium::elastic'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_elastic_static_quadrature_points_isotropic.rst:2: WARNING: Duplicate C++ declaration, also defined at api/domain/element/elements_dim2_acoustic_static_quadrature_points_isotropic:2. -Declaration is '.. cpp:type:: quadrature_points_type = specfem::enums::element::quadrature::static_quadrature_points< NGLL >'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_elastic_static_quadrature_points_isotropic.rst:2: WARNING: Duplicate C++ declaration, also defined at api/domain/element/elements_dim2_acoustic_static_quadrature_points_isotropic:2. -Declaration is '.. cpp:type:: template ScratchViewType = typename quadrature_points_type::template ScratchViewType< T, N >'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_elastic_static_quadrature_points_isotropic.rst:2: WARNING: Duplicate C++ declaration, also defined at api/domain/element/elements_dim2_acoustic_static_quadrature_points_isotropic:2. -Declaration is '.. cpp:member:: specfem::kokkos::DeviceView3d< type_real > xix'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_elastic_static_quadrature_points_isotropic.rst:2: WARNING: Duplicate C++ declaration, also defined at api/domain/element/elements_dim2_acoustic_static_quadrature_points_isotropic:2. -Declaration is '.. cpp:member:: specfem::kokkos::DeviceView3d< type_real > xiz'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_elastic_static_quadrature_points_isotropic.rst:2: WARNING: Duplicate C++ declaration, also defined at api/domain/element/elements_dim2_acoustic_static_quadrature_points_isotropic:2. -Declaration is '.. cpp:member:: specfem::kokkos::DeviceView3d< type_real > gammax'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_elastic_static_quadrature_points_isotropic.rst:2: WARNING: Duplicate C++ declaration, also defined at api/domain/element/elements_dim2_acoustic_static_quadrature_points_isotropic:2. -Declaration is '.. cpp:member:: specfem::kokkos::DeviceView3d< type_real > gammaz'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_elastic_static_quadrature_points_isotropic.rst:2: WARNING: Duplicate C++ declaration, also defined at api/domain/element/elements_dim2_acoustic_static_quadrature_points_isotropic:2. -Declaration is '.. cpp:member:: specfem::kokkos::DeviceView3d< type_real > jacobian'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_elastic_static_quadrature_points_isotropic.rst:2: WARNING: Duplicate C++ declaration, also defined at api/domain/element/elements_dim2_acoustic_static_quadrature_points_isotropic:2. -Declaration is '.. cpp:member:: specfem::kokkos::DeviceView3d< type_real > lambdaplus2mu'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_elastic_static_quadrature_points_isotropic.rst:2: WARNING: Duplicate C++ declaration, also defined at api/domain/element/elements_dim2_acoustic_static_quadrature_points_isotropic:2. -Declaration is '.. cpp:member:: specfem::kokkos::DeviceView3d< type_real > mu'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_elastic_static_quadrature_points_isotropic.rst:2: WARNING: Duplicate C++ declaration, also defined at api/domain/element/elements_dim2_acoustic_static_quadrature_points_isotropic:2. -Declaration is '.. cpp:member:: specfem::kokkos::DeviceView3d< type_real > rho'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_elastic_static_quadrature_points_isotropic.rst:2: WARNING: Duplicate C++ declaration, also defined at api/domain/element/elements_dim2_acoustic_static_quadrature_points_isotropic:2. -Declaration is '.. cpp:function:: KOKKOS_FUNCTION element ()=default'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_elastic_static_quadrature_points_isotropic.rst:2: WARNING: Duplicate C++ declaration, also defined at api/domain/element/elements_dim2_acoustic_static_quadrature_points_isotropic:2. -Declaration is '.. cpp:function:: KOKKOS_FUNCTION element (const specfem::compute::partial_derivatives partial_derivatives, const specfem::compute::properties properties)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_elastic_static_quadrature_points_isotropic.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 23] - KOKKOS_INLINE_FUNCTION void compute_mass_matrix_component (const int &ispec, const int &xz, type_real *mass_matrix) const - -----------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 27] - KOKKOS_INLINE_FUNCTION void compute_mass_matrix_component (const int &ispec, const int &xz, type_real *mass_matrix) const - ---------------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 27] - KOKKOS_INLINE_FUNCTION void compute_mass_matrix_component (const int &ispec, const int &xz, type_real *mass_matrix) const - ---------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_elastic_static_quadrature_points_isotropic.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 23] - KOKKOS_INLINE_FUNCTION void compute_gradient (const int &ispec, const int &xz, const ScratchViewType< type_real, 1 > s_hprime_xx, const ScratchViewType< type_real, 1 > s_hprime_zz, const ScratchViewType< type_real, medium_type::components > u, type_real *dudxl, type_real *dudzl) const - -----------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 27] - KOKKOS_INLINE_FUNCTION void compute_gradient (const int &ispec, const int &xz, const ScratchViewType< type_real, 1 > s_hprime_xx, const ScratchViewType< type_real, 1 > s_hprime_zz, const ScratchViewType< type_real, medium_type::components > u, type_real *dudxl, type_real *dudzl) const - ---------------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 27] - KOKKOS_INLINE_FUNCTION void compute_gradient (const int &ispec, const int &xz, const ScratchViewType< type_real, 1 > s_hprime_xx, const ScratchViewType< type_real, 1 > s_hprime_zz, const ScratchViewType< type_real, medium_type::components > u, type_real *dudxl, type_real *dudzl) const - ---------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_elastic_static_quadrature_points_isotropic.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 23] - KOKKOS_INLINE_FUNCTION void compute_stress (const int &ispec, const int &xz, const type_real *dudxl, const type_real *dudzl, type_real *stress_integrand_xi, type_real *stress_integrand_gamma) const - -----------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 27] - KOKKOS_INLINE_FUNCTION void compute_stress (const int &ispec, const int &xz, const type_real *dudxl, const type_real *dudzl, type_real *stress_integrand_xi, type_real *stress_integrand_gamma) const - ---------------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 27] - KOKKOS_INLINE_FUNCTION void compute_stress (const int &ispec, const int &xz, const type_real *dudxl, const type_real *dudzl, type_real *stress_integrand_xi, type_real *stress_integrand_gamma) const - ---------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_elastic_static_quadrature_points_isotropic.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 23] - KOKKOS_INLINE_FUNCTION void compute_acceleration (const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium_type::components > stress_integrand_xi, const ScratchViewType< type_real, medium_type::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const - -----------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 27] - KOKKOS_INLINE_FUNCTION void compute_acceleration (const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium_type::components > stress_integrand_xi, const ScratchViewType< type_real, medium_type::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const - ---------------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 27] - KOKKOS_INLINE_FUNCTION void compute_acceleration (const int &xz, const type_real &wxglll, const type_real &wzglll, const ScratchViewType< type_real, medium_type::components > stress_integrand_xi, const ScratchViewType< type_real, medium_type::components > stress_integrand_gamma, const ScratchViewType< type_real, 1 > s_hprimewgll_xx, const ScratchViewType< type_real, 1 > s_hprimewgll_zz, type_real *acceleration) const - ---------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/index.rst:1: WARNING: malformed hyperlink target. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/receivers/receivers.rst:1: ERROR: Unknown directive type "elemental_receivers_api_doc". - -.. elemental_receivers_api_doc:: -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/receivers/receivers.rst:9: WARNING: duplicate label definition, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/receivers/receivers.rst:14: WARNING: duplicate label interface, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/receivers/receivers.rst:22: WARNING: duplicate label parameters, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/receivers/receivers.rst:81: WARNING: duplicate label template specializations, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/receivers/receivers_dim2_acoustic_static_quadrature_points_isotropic.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 16] - KOKKOS_FUNCTION void get_field (const int &ireceiver, const int &iseis, const int &ispec, const specfem::enums::seismogram::type &siesmogram_type, const int &xz, const int &isig_step, const ScratchViewType< type_real, medium_type::components > field, const ScratchViewType< type_real, medium_type::components > field_dot, const ScratchViewType< type_real, medium_type::components > field_dot_dot, const ScratchViewType< type_real, 1 > hprime_xx, const ScratchViewType< type_real, 1 > hprime_zz) const - ----------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 20] - KOKKOS_FUNCTION void get_field (const int &ireceiver, const int &iseis, const int &ispec, const specfem::enums::seismogram::type &siesmogram_type, const int &xz, const int &isig_step, const ScratchViewType< type_real, medium_type::components > field, const ScratchViewType< type_real, medium_type::components > field_dot, const ScratchViewType< type_real, medium_type::components > field_dot_dot, const ScratchViewType< type_real, 1 > hprime_xx, const ScratchViewType< type_real, 1 > hprime_zz) const - --------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 20] - KOKKOS_FUNCTION void get_field (const int &ireceiver, const int &iseis, const int &ispec, const specfem::enums::seismogram::type &siesmogram_type, const int &xz, const int &isig_step, const ScratchViewType< type_real, medium_type::components > field, const ScratchViewType< type_real, medium_type::components > field_dot, const ScratchViewType< type_real, medium_type::components > field_dot_dot, const ScratchViewType< type_real, 1 > hprime_xx, const ScratchViewType< type_real, 1 > hprime_zz) const - --------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/receivers/receivers_dim2_acoustic_static_quadrature_points_isotropic.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 16] - KOKKOS_FUNCTION void compute_seismogram_components (const int &ireceiver, const int &iseis, const specfem::enums::seismogram::type &seismogram_type, const int &xz, const int &isig_step, dimension::array_type< type_real > &l_seismogram_components) const - ----------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 20] - KOKKOS_FUNCTION void compute_seismogram_components (const int &ireceiver, const int &iseis, const specfem::enums::seismogram::type &seismogram_type, const int &xz, const int &isig_step, dimension::array_type< type_real > &l_seismogram_components) const - --------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 20] - KOKKOS_FUNCTION void compute_seismogram_components (const int &ireceiver, const int &iseis, const specfem::enums::seismogram::type &seismogram_type, const int &xz, const int &isig_step, dimension::array_type< type_real > &l_seismogram_components) const - --------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/receivers/receivers_dim2_acoustic_static_quadrature_points_isotropic.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 16] - KOKKOS_FUNCTION void compute_seismogram (const int &ireceiver, const dimension::array_type< type_real > &seismogram_components, specfem::kokkos::DeviceView1d< type_real > receiver_seismogram) const - ----------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 20] - KOKKOS_FUNCTION void compute_seismogram (const int &ireceiver, const dimension::array_type< type_real > &seismogram_components, specfem::kokkos::DeviceView1d< type_real > receiver_seismogram) const - --------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 20] - KOKKOS_FUNCTION void compute_seismogram (const int &ireceiver, const dimension::array_type< type_real > &seismogram_components, specfem::kokkos::DeviceView1d< type_real > receiver_seismogram) const - --------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/receivers/receivers_dim2_elastic_static_quadrature_points_isotropic.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 16] - KOKKOS_FUNCTION void get_field (const int &ireceiver, const int &iseis, const int &ispec, const specfem::enums::seismogram::type &seismogram_type, const int &xz, const int &isig_step, const ScratchViewType< type_real, medium_type::components > field, const ScratchViewType< type_real, medium_type::components > field_dot, const ScratchViewType< type_real, medium_type::components > field_dot_dot, const ScratchViewType< type_real, 1 > s_hprime_xx, const ScratchViewType< type_real, 1 > s_hprime_zz) const - ----------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 20] - KOKKOS_FUNCTION void get_field (const int &ireceiver, const int &iseis, const int &ispec, const specfem::enums::seismogram::type &seismogram_type, const int &xz, const int &isig_step, const ScratchViewType< type_real, medium_type::components > field, const ScratchViewType< type_real, medium_type::components > field_dot, const ScratchViewType< type_real, medium_type::components > field_dot_dot, const ScratchViewType< type_real, 1 > s_hprime_xx, const ScratchViewType< type_real, 1 > s_hprime_zz) const - --------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 20] - KOKKOS_FUNCTION void get_field (const int &ireceiver, const int &iseis, const int &ispec, const specfem::enums::seismogram::type &seismogram_type, const int &xz, const int &isig_step, const ScratchViewType< type_real, medium_type::components > field, const ScratchViewType< type_real, medium_type::components > field_dot, const ScratchViewType< type_real, medium_type::components > field_dot_dot, const ScratchViewType< type_real, 1 > s_hprime_xx, const ScratchViewType< type_real, 1 > s_hprime_zz) const - --------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/receivers/receivers_dim2_elastic_static_quadrature_points_isotropic.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 16] - KOKKOS_FUNCTION void compute_seismogram_components (const int &ireceiver, const int &iseis, const specfem::enums::seismogram::type &seismogram_type, const int &xz, const int &isig_step, dimension::array_type< type_real > &l_seismogram_components) const - ----------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 20] - KOKKOS_FUNCTION void compute_seismogram_components (const int &ireceiver, const int &iseis, const specfem::enums::seismogram::type &seismogram_type, const int &xz, const int &isig_step, dimension::array_type< type_real > &l_seismogram_components) const - --------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 20] - KOKKOS_FUNCTION void compute_seismogram_components (const int &ireceiver, const int &iseis, const specfem::enums::seismogram::type &seismogram_type, const int &xz, const int &isig_step, dimension::array_type< type_real > &l_seismogram_components) const - --------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/receivers/receivers_dim2_elastic_static_quadrature_points_isotropic.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 16] - KOKKOS_FUNCTION void compute_seismogram (const int &ireceiver, const dimension::array_type< type_real > &seismogram_components, specfem::kokkos::DeviceView1d< type_real > receiver_seismogram) const - ----------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 20] - KOKKOS_FUNCTION void compute_seismogram (const int &ireceiver, const dimension::array_type< type_real > &seismogram_components, specfem::kokkos::DeviceView1d< type_real > receiver_seismogram) const - --------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 20] - KOKKOS_FUNCTION void compute_seismogram (const int &ireceiver, const dimension::array_type< type_real > &seismogram_components, specfem::kokkos::DeviceView1d< type_real > receiver_seismogram) const - --------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/sources/sources.rst:9: WARNING: duplicate label definition, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/receivers/receivers.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/sources/sources.rst:14: WARNING: duplicate label interface, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/receivers/receivers.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/sources/sources.rst:22: WARNING: duplicate label parameters, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/receivers/receivers.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/sources/sources.rst:81: WARNING: duplicate label template specializations, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/receivers/receivers.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/sources/sources_dim2_acoustic_static_quadrature_points_isotrpoic.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 23] - KOKKOS_INLINE_FUNCTION void compute_interaction (const int &isource, const int &ispec, const int &xz, const type_real &stf_value, type_real *acceleration) const - -----------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 27] - KOKKOS_INLINE_FUNCTION void compute_interaction (const int &isource, const int &ispec, const int &xz, const type_real &stf_value, type_real *acceleration) const - ---------------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 27] - KOKKOS_INLINE_FUNCTION void compute_interaction (const int &isource, const int &ispec, const int &xz, const type_real &stf_value, type_real *acceleration) const - ---------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/sources/sources_dim2_elastic_static_quadrature_points_isotropic.rst:2: WARNING: doxygenclass: Cannot find class "specfem::domain::impl::sources::elemental_sources_api_documentation< specfem::enums::element::dimension::dim2, specfem::enums::element::medium::elastic, specfem::enums::element::quadrature::static_quadrature_points< NGLL >, specfem::enums::element::property::isotropic >" in doxygen xml output for project "SPECFEM KOKKOS IMPLEMENTATION" from directory: _build/xml -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/enumerations/element/acoustic.rst:2: WARNING: doxygenclass: Cannot find class "specfem::enums::element::medium::acosutic" in doxygen xml output for project "SPECFEM KOKKOS IMPLEMENTATION" from directory: _build/xml -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/enumerations/element/dim2.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 30] - inline KOKKOS_INLINE_FUNCTION T & operator[] (const int &i) - ------------------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected '::' in pointer to member (function). [error at 32] - inline KOKKOS_INLINE_FUNCTION T & operator[] (const int &i) - --------------------------------^ - If declarator-id: - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 32] - inline KOKKOS_INLINE_FUNCTION T & operator[] (const int &i) - --------------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/enumerations/element/dim2.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 30] - inline KOKKOS_INLINE_FUNCTION const T & operator[] (const int &i) const - ------------------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected '::' in pointer to member (function). [error at 38] - inline KOKKOS_INLINE_FUNCTION const T & operator[] (const int &i) const - --------------------------------------^ - If declarator-id: - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 38] - inline KOKKOS_INLINE_FUNCTION const T & operator[] (const int &i) const - --------------------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/enumerations/element/dim2.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 30] - inline KOKKOS_INLINE_FUNCTION array_type< T > & operator+= (const array_type< T > &rhs) - ------------------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected '::' in pointer to member (function). [error at 46] - inline KOKKOS_INLINE_FUNCTION array_type< T > & operator+= (const array_type< T > &rhs) - ----------------------------------------------^ - If declarator-id: - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 46] - inline KOKKOS_INLINE_FUNCTION array_type< T > & operator+= (const array_type< T > &rhs) - ----------------------------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/enumerations/element/dim2.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 30] - inline KOKKOS_INLINE_FUNCTION void init () - ------------------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 34] - inline KOKKOS_INLINE_FUNCTION void init () - ----------------------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 34] - inline KOKKOS_INLINE_FUNCTION void init () - ----------------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/enumerations/element/dim3.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 30] - inline KOKKOS_INLINE_FUNCTION T & operator[] (const int &i) - ------------------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected '::' in pointer to member (function). [error at 32] - inline KOKKOS_INLINE_FUNCTION T & operator[] (const int &i) - --------------------------------^ - If declarator-id: - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 32] - inline KOKKOS_INLINE_FUNCTION T & operator[] (const int &i) - --------------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/enumerations/element/dim3.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 30] - inline KOKKOS_INLINE_FUNCTION const T & operator[] (const int &i) const - ------------------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected '::' in pointer to member (function). [error at 38] - inline KOKKOS_INLINE_FUNCTION const T & operator[] (const int &i) const - --------------------------------------^ - If declarator-id: - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 38] - inline KOKKOS_INLINE_FUNCTION const T & operator[] (const int &i) const - --------------------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/enumerations/element/dim3.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 30] - inline KOKKOS_INLINE_FUNCTION array_type< T > & operator+= (const array_type< T > &rhs) - ------------------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected '::' in pointer to member (function). [error at 46] - inline KOKKOS_INLINE_FUNCTION array_type< T > & operator+= (const array_type< T > &rhs) - ----------------------------------------------^ - If declarator-id: - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 46] - inline KOKKOS_INLINE_FUNCTION array_type< T > & operator+= (const array_type< T > &rhs) - ----------------------------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/enumerations/element/dim3.rst:2: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 30] - inline KOKKOS_INLINE_FUNCTION void init () - ------------------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 34] - inline KOKKOS_INLINE_FUNCTION void init () - ----------------------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 34] - inline KOKKOS_INLINE_FUNCTION void init () - ----------------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/enumerations/element/static_quadrature_points.rst:2: WARNING: doxygenclass: Cannot find class "specfem::enums::element::quadrature::static_quadrature_points< NGLL >" in doxygen xml output for project "SPECFEM KOKKOS IMPLEMENTATION" from directory: _build/xml -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/enumerations/index.rst:1: WARNING: malformed hyperlink target. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/enumerations/seismogram/seismogram_enumeration.rst:7: WARNING: doxygenenum: Cannot find enum "specfem::enum::seismogram::type" in doxygen xml output for project "SPECFEM KOKKOS IMPLEMENTATION" from directory: _build/xml -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/index.rst:6: WARNING: toctree contains reference to nonexisting document 'api/namespace/index' -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/jacobian.rst:1: WARNING: malformed hyperlink target. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/jacobian.rst:13: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/jacobian.rst:13: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: jacobian'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/jacobian.rst:4: CRITICAL: Duplicate ID: "namespacespecfem_1_1jacobian". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/jacobian.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem_1_1jacobian". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/jacobian.rst:4: CRITICAL: Duplicate ID: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/jacobian.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/kokkos_abstractions.rst:10: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 30] - inline KOKKOS_INLINE_FUNCTION void init (value_type &update) const - ------------------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 34] - inline KOKKOS_INLINE_FUNCTION void init (value_type &update) const - ----------------------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 34] - inline KOKKOS_INLINE_FUNCTION void init (value_type &update) const - ----------------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/kokkos_abstractions.rst:10: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 30] - inline KOKKOS_INLINE_FUNCTION void join (value_type &update, const value_type &source) const - ------------------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 34] - inline KOKKOS_INLINE_FUNCTION void join (value_type &update, const value_type &source) const - ----------------------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 34] - inline KOKKOS_INLINE_FUNCTION void join (value_type &update, const value_type &source) const - ----------------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/kokkos_abstractions.rst:10: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 30] - inline KOKKOS_INLINE_FUNCTION value_type & reference () const - ------------------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected '::' in pointer to member (function). [error at 41] - inline KOKKOS_INLINE_FUNCTION value_type & reference () const - -----------------------------------------^ - If declarator-id: - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 41] - inline KOKKOS_INLINE_FUNCTION value_type & reference () const - -----------------------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/kokkos_abstractions.rst:10: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 30] - inline KOKKOS_INLINE_FUNCTION result_view_type view () const - ------------------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected '::' in pointer to member (function). [error at 47] - inline KOKKOS_INLINE_FUNCTION result_view_type view () const - -----------------------------------------------^ - If declarator-id: - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 47] - inline KOKKOS_INLINE_FUNCTION result_view_type view () const - -----------------------------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/kokkos_abstractions.rst:10: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 30] - inline KOKKOS_INLINE_FUNCTION bool references_scalar () const - ------------------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 34] - inline KOKKOS_INLINE_FUNCTION bool references_scalar () const - ----------------------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: bool [error at 34] - inline KOKKOS_INLINE_FUNCTION bool references_scalar () const - ----------------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material.rst:11: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material.rst:14: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material.rst:14: WARNING: Duplicate C++ declaration, also defined at api/material:11. -Declaration is '.. cpp:type:: material'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material.rst:4: CRITICAL: Duplicate ID: "namespacespecfem_1_1material". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem_1_1material". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material.rst:4: CRITICAL: Duplicate ID: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/elastic_material.rst:7: WARNING: Duplicate C++ declaration, also defined at api/material:14. -Declaration is '.. cpp:class:: specfem::material::elastic_material : public specfem::material::material'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/elastic_material.rst:7: WARNING: Duplicate C++ declaration, also defined at api/material:14. -Declaration is '.. cpp:member:: type_real density'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/elastic_material.rst:7: WARNING: Duplicate C++ declaration, also defined at api/material:14. -Declaration is '.. cpp:member:: type_real cs'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/elastic_material.rst:7: WARNING: Duplicate C++ declaration, also defined at api/material:14. -Declaration is '.. cpp:member:: type_real cp'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/elastic_material.rst:7: WARNING: Duplicate C++ declaration, also defined at api/material:14. -Declaration is '.. cpp:member:: type_real Qkappa'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/elastic_material.rst:7: WARNING: Duplicate C++ declaration, also defined at api/material:14. -Declaration is '.. cpp:member:: type_real Qmu'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/elastic_material.rst:7: WARNING: Duplicate C++ declaration, also defined at api/material:14. -Declaration is '.. cpp:member:: type_real compaction_grad'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/elastic_material.rst:7: WARNING: Duplicate C++ declaration, also defined at api/material:14. -Declaration is '.. cpp:member:: type_real lambdaplus2mu'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/elastic_material.rst:7: WARNING: Duplicate C++ declaration, also defined at api/material:14. -Declaration is '.. cpp:member:: type_real mu'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/elastic_material.rst:7: WARNING: Duplicate C++ declaration, also defined at api/material:14. -Declaration is '.. cpp:member:: type_real lambda'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/elastic_material.rst:7: WARNING: Duplicate C++ declaration, also defined at api/material:14. -Declaration is '.. cpp:member:: type_real kappa'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/elastic_material.rst:7: WARNING: Duplicate C++ declaration, also defined at api/material:14. -Declaration is '.. cpp:member:: type_real young'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/elastic_material.rst:7: WARNING: Duplicate C++ declaration, also defined at api/material:14. -Declaration is '.. cpp:member:: type_real poisson'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/elastic_material.rst:7: WARNING: Duplicate C++ declaration, also defined at api/material:14. -Declaration is '.. cpp:member:: specfem::enums::element::type ispec_type =specfem::enums::element::elastic'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/elastic_material.rst:7: WARNING: Duplicate C++ declaration, also defined at api/material:14. -Declaration is '.. cpp:function:: elastic_material ()'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/elastic_material.rst:7: WARNING: Duplicate C++ declaration, also defined at api/material:14. -Declaration is '.. cpp:function:: elastic_material (const type_real &density, const type_real &cs, const type_real &cp, const type_real &Qkappa, const type_real &Qmu, const type_real &compaction_grad)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/elastic_material.rst:7: WARNING: Duplicate C++ declaration, also defined at api/material:14. -Declaration is '.. cpp:function:: virtual utilities::return_holder get_properties () override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/elastic_material.rst:7: WARNING: Duplicate C++ declaration, also defined at api/material:14. -Declaration is '.. cpp:function:: inline virtual specfem::enums::element::type get_ispec_type () override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/elastic_material.rst:7: WARNING: Duplicate C++ declaration, also defined at api/material:14. -Declaration is '.. cpp:function:: virtual std::string print () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/elastic_material.rst:7: WARNING: Duplicate C++ declaration, also defined at api/material:14. -Declaration is '.. cpp:function:: friend std::ostream & operator<< (std::ostream &out, const elastic_material &h)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/index.rst:9: WARNING: Duplicate C++ declaration, also defined at api/material:11. -Declaration is '.. cpp:class:: specfem::material::material'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/index.rst:9: WARNING: Duplicate C++ declaration, also defined at api/material:11. -Declaration is '.. cpp:function:: inline material ()'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/index.rst:9: WARNING: Duplicate C++ declaration, also defined at api/material:11. -Declaration is '.. cpp:function:: inline virtual utilities::return_holder get_properties ()'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/index.rst:9: WARNING: Duplicate C++ declaration, also defined at api/material:11. -Declaration is '.. cpp:function:: inline virtual specfem::enums::element::type get_ispec_type ()'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/index.rst:9: WARNING: Duplicate C++ declaration, also defined at api/material:11. -Declaration is '.. cpp:function:: inline virtual std::string print () const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material/index.rst:15: WARNING: Title underline too short. - -Types of Materials Implemented ------------------------------ -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/namespaces/index.rst:8: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/namespaces/index.rst:11: WARNING: Duplicate C++ declaration, also defined at api/kokkos_abstractions:10. -Declaration is '.. cpp:type:: specfem::kokkos'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/namespaces/index.rst:26: WARNING: doxygennamespace: Cannot find namespace "specfem::mesh::io" in doxygen xml output for project "SPECFEM KOKKOS IMPLEMENTATION" from directory: _build/xml -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/namespaces/index.rst:29: WARNING: doxygennamespace: Cannot find namespace "specfem::mesh::io::fortran" in doxygen xml output for project "SPECFEM KOKKOS IMPLEMENTATION" from directory: _build/xml -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/namespaces/index.rst:50: WARNING: doxygennamespace: Cannot find namespace "specfem::coupled_interfaces" in doxygen xml output for project "SPECFEM KOKKOS IMPLEMENTATION" from directory: _build/xml -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/namespaces/index.rst:53: WARNING: doxygennamespace: Cannot find namespace "specfem::coupled_interfaces::impl" in doxygen xml output for project "SPECFEM KOKKOS IMPLEMENTATION" from directory: _build/xml -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/namespaces/index.rst:56: WARNING: doxygennamespace: Cannot find namespace "specfem::coupled_interfaces::impl::edge" in doxygen xml output for project "SPECFEM KOKKOS IMPLEMENTATION" from directory: _build/xml -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/namespaces/index.rst:65: WARNING: doxygennamespace: Cannot find namespace "specfem::materials" in doxygen xml output for project "SPECFEM KOKKOS IMPLEMENTATION" from directory: _build/xml -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:11: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:11: WARNING: Duplicate C++ declaration, also defined at api/namespaces/index:80. -Declaration is '.. cpp:type:: runtime_configuration'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:14: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:14: WARNING: Duplicate C++ declaration, also defined at api/namespaces/index:80. -Declaration is '.. cpp:type:: runtime_configuration'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:14: WARNING: Duplicate C++ declaration, also defined at api/parameter:11. -Declaration is '.. cpp:type:: solver'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: CRITICAL: Duplicate ID: "namespacespecfem_1_1runtime__configuration_1_1solver". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem_1_1runtime__configuration_1_1solver". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: CRITICAL: Duplicate ID: "namespacespecfem_1_1runtime__configuration". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem_1_1runtime__configuration". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: CRITICAL: Duplicate ID: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:17: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:17: WARNING: Duplicate C++ declaration, also defined at api/namespaces/index:80. -Declaration is '.. cpp:type:: runtime_configuration'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: CRITICAL: Duplicate ID: "namespacespecfem_1_1runtime__configuration". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem_1_1runtime__configuration". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: CRITICAL: Duplicate ID: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:20: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:20: WARNING: Duplicate C++ declaration, also defined at api/namespaces/index:80. -Declaration is '.. cpp:type:: runtime_configuration'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: CRITICAL: Duplicate ID: "namespacespecfem_1_1runtime__configuration". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem_1_1runtime__configuration". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: CRITICAL: Duplicate ID: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:23: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:23: WARNING: Duplicate C++ declaration, also defined at api/namespaces/index:80. -Declaration is '.. cpp:type:: runtime_configuration'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: CRITICAL: Duplicate ID: "namespacespecfem_1_1runtime__configuration". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem_1_1runtime__configuration". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: CRITICAL: Duplicate ID: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:26: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:26: WARNING: Duplicate C++ declaration, also defined at api/namespaces/index:80. -Declaration is '.. cpp:type:: runtime_configuration'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: CRITICAL: Duplicate ID: "namespacespecfem_1_1runtime__configuration". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem_1_1runtime__configuration". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: CRITICAL: Duplicate ID: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:29: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:29: WARNING: Duplicate C++ declaration, also defined at api/namespaces/index:80. -Declaration is '.. cpp:type:: runtime_configuration'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: CRITICAL: Duplicate ID: "namespacespecfem_1_1runtime__configuration". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem_1_1runtime__configuration". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: CRITICAL: Duplicate ID: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:32: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:32: WARNING: Duplicate C++ declaration, also defined at api/namespaces/index:80. -Declaration is '.. cpp:type:: runtime_configuration'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: CRITICAL: Duplicate ID: "namespacespecfem_1_1runtime__configuration". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem_1_1runtime__configuration". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: CRITICAL: Duplicate ID: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:35: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:35: WARNING: Duplicate C++ declaration, also defined at api/namespaces/index:80. -Declaration is '.. cpp:type:: runtime_configuration'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: CRITICAL: Duplicate ID: "namespacespecfem_1_1runtime__configuration". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem_1_1runtime__configuration". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: CRITICAL: Duplicate ID: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:11: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:11: WARNING: Duplicate C++ declaration, also defined at api/namespaces/index:59. -Declaration is '.. cpp:type:: quadrature'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:14: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:14: WARNING: Duplicate C++ declaration, also defined at api/namespaces/index:59. -Declaration is '.. cpp:type:: quadrature'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:14: WARNING: Duplicate C++ declaration, also defined at api/namespaces/index:62. -Declaration is '.. cpp:type:: gll'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:4: CRITICAL: Duplicate ID: "namespacespecfem_1_1quadrature". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem_1_1quadrature". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:4: CRITICAL: Duplicate ID: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:20: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:20: WARNING: Duplicate C++ declaration, also defined at api/namespaces/index:59. -Declaration is '.. cpp:type:: quadrature'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:20: WARNING: Duplicate C++ declaration, also defined at api/namespaces/index:62. -Declaration is '.. cpp:type:: gll'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:4: CRITICAL: Duplicate ID: "namespacespecfem_1_1quadrature_1_1gll". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem_1_1quadrature_1_1gll". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:4: CRITICAL: Duplicate ID: "namespacespecfem_1_1quadrature". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem_1_1quadrature". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:4: CRITICAL: Duplicate ID: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:23: WARNING: doxygenfile: Cannot find file "quadrature/gll/gll_utils.pp -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:29: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:29: WARNING: Duplicate C++ declaration, also defined at api/namespaces/index:59. -Declaration is '.. cpp:type:: quadrature'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:29: WARNING: Duplicate C++ declaration, also defined at api/namespaces/index:62. -Declaration is '.. cpp:type:: gll'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:4: CRITICAL: Duplicate ID: "namespacespecfem_1_1quadrature_1_1gll". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem_1_1quadrature_1_1gll". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:4: CRITICAL: Duplicate ID: "namespacespecfem_1_1quadrature". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem_1_1quadrature". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:4: CRITICAL: Duplicate ID: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/gll.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:14. -Declaration is '.. cpp:class:: specfem::quadrature::gll::gll : public specfem::quadrature::quadrature'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/gll.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:14. -Declaration is '.. cpp:member:: type_real alpha'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/gll.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:14. -Declaration is '.. cpp:member:: type_real beta'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/gll.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:14. -Declaration is '.. cpp:member:: int N'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/gll.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:14. -Declaration is '.. cpp:member:: specfem::kokkos::DeviceView1d< type_real > xi'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/gll.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:14. -Declaration is '.. cpp:member:: specfem::kokkos::HostMirror1d< type_real > h_xi'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/gll.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:14. -Declaration is '.. cpp:member:: specfem::kokkos::DeviceView1d< type_real > w'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/gll.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:14. -Declaration is '.. cpp:member:: specfem::kokkos::HostView1d< type_real > h_w'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/gll.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:14. -Declaration is '.. cpp:member:: specfem::kokkos::DeviceView2d< type_real > hprime'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/gll.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:14. -Declaration is '.. cpp:member:: specfem::kokkos::HostView2d< type_real > h_hprime'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/gll.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:14. -Declaration is '.. cpp:function:: gll ()'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/gll.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:14. -Declaration is '.. cpp:function:: gll (const type_real alpha, const type_real beta)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/gll.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:14. -Declaration is '.. cpp:function:: gll (const type_real alpha, const type_real beta, const int N)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/gll.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:14. -Declaration is '.. cpp:function:: void set_derivation_matrices ()'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/gll.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:14. -Declaration is '.. cpp:function:: inline specfem::kokkos::DeviceView1d< type_real > get_xi () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/gll.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:14. -Declaration is '.. cpp:function:: inline specfem::kokkos::DeviceView1d< type_real > get_w () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/gll.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:14. -Declaration is '.. cpp:function:: inline specfem::kokkos::DeviceView2d< type_real > get_hprime () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/gll.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:14. -Declaration is '.. cpp:function:: inline specfem::kokkos::HostMirror1d< type_real > get_hxi () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/gll.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:14. -Declaration is '.. cpp:function:: inline specfem::kokkos::HostMirror1d< type_real > get_hw () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/gll.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:14. -Declaration is '.. cpp:function:: inline specfem::kokkos::HostMirror2d< type_real > get_hhprime () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/gll.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:14. -Declaration is '.. cpp:function:: inline int get_N () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/gll.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:14. -Declaration is '.. cpp:function:: void print (std::ostream &out) const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/gll.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:14. -Declaration is '.. cpp:function:: void set_allocations ()'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/gll.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:14. -Declaration is '.. cpp:function:: void sync_views ()'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:11. -Declaration is '.. cpp:class:: specfem::quadrature::quadrature'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:11. -Declaration is '.. cpp:member:: type_real alpha'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:11. -Declaration is '.. cpp:member:: type_real beta'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:11. -Declaration is '.. cpp:member:: int N'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:11. -Declaration is '.. cpp:member:: specfem::kokkos::DeviceView1d< type_real > xi'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:11. -Declaration is '.. cpp:member:: specfem::kokkos::HostMirror1d< type_real > h_xi'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:11. -Declaration is '.. cpp:member:: specfem::kokkos::DeviceView1d< type_real > w'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:11. -Declaration is '.. cpp:member:: specfem::kokkos::HostView1d< type_real > h_w'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:11. -Declaration is '.. cpp:member:: specfem::kokkos::DeviceView2d< type_real > hprime'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:11. -Declaration is '.. cpp:member:: specfem::kokkos::HostView2d< type_real > h_hprime'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:11. -Declaration is '.. cpp:function:: inline quadrature ()'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:11. -Declaration is '.. cpp:function:: inline virtual specfem::kokkos::DeviceView1d< type_real > get_xi () const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:11. -Declaration is '.. cpp:function:: inline virtual specfem::kokkos::DeviceView1d< type_real > get_w () const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:11. -Declaration is '.. cpp:function:: inline virtual specfem::kokkos::DeviceView2d< type_real > get_hprime () const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:11. -Declaration is '.. cpp:function:: inline virtual specfem::kokkos::HostMirror1d< type_real > get_hxi () const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:11. -Declaration is '.. cpp:function:: inline virtual specfem::kokkos::HostMirror1d< type_real > get_hw () const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:11. -Declaration is '.. cpp:function:: inline virtual specfem::kokkos::HostMirror2d< type_real > get_hhprime () const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:11. -Declaration is '.. cpp:function:: inline virtual int get_N () const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/quadrature:11. -Declaration is '.. cpp:function:: virtual void print (std::ostream &out) const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/database_configuration.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:17. -Declaration is '.. cpp:class:: specfem::runtime_configuration::database_configuration'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/database_configuration.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:17. -Declaration is '.. cpp:member:: std::string fortran_database'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/database_configuration.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:17. -Declaration is '.. cpp:member:: std::string source_database'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/database_configuration.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:17. -Declaration is '.. cpp:function:: inline database_configuration (std::string fortran_database, std::string source_database)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/database_configuration.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:17. -Declaration is '.. cpp:function:: database_configuration (const YAML::Node &Node)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/database_configuration.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:17. -Declaration is '.. cpp:function:: inline std::tuple< std::string, std::string > get_databases () const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/header.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:20. -Declaration is '.. cpp:class:: specfem::runtime_configuration::header'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/header.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:20. -Declaration is '.. cpp:member:: std::string title'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/header.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:20. -Declaration is '.. cpp:member:: std::string description'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/header.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:20. -Declaration is '.. cpp:function:: inline header (std::string title, std::string description)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/header.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:20. -Declaration is '.. cpp:function:: header (const YAML::Node &Node)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/header.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:20. -Declaration is '.. cpp:function:: inline std::string get_title ()'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/header.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:20. -Declaration is '.. cpp:function:: inline std::string get_description ()'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/header.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:20. -Declaration is '.. cpp:function:: friend std::ostream & operator<< (std::ostream &out, header &header)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/quadrature.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:23. -Declaration is '.. cpp:class:: specfem::runtime_configuration::quadrature'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/quadrature.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:23. -Declaration is '.. cpp:member:: type_real alpha'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/quadrature.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:23. -Declaration is '.. cpp:member:: type_real beta'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/quadrature.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:23. -Declaration is '.. cpp:member:: int ngllx'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/quadrature.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:23. -Declaration is '.. cpp:member:: int ngllz'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/quadrature.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:23. -Declaration is '.. cpp:function:: inline quadrature (type_real alpha, type_real beta, int ngllx, int ngllz)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/quadrature.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:23. -Declaration is '.. cpp:function:: quadrature (const YAML::Node &Node)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/quadrature.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:23. -Declaration is '.. cpp:function:: quadrature (const std::string quadrature)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/quadrature.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:23. -Declaration is '.. cpp:function:: std::tuple< specfem::quadrature::quadrature *, specfem::quadrature::quadrature * > instantiate ()'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/quadrature.rst:3: WARNING: duplicate label quadrature, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/receivers.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:29. -Declaration is '.. cpp:class:: specfem::runtime_configuration::receivers'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/receivers.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:29. -Declaration is '.. cpp:member:: std::string stations_file'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/receivers.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:29. -Declaration is '.. cpp:member:: type_real angle'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/receivers.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:29. -Declaration is '.. cpp:member:: int nstep_between_samples'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/receivers.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:29. -Declaration is '.. cpp:member:: std::vector< specfem::enums::seismogram::type > stypes'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/receivers.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:29. -Declaration is '.. cpp:function:: inline receivers (const std::string stations_file, const int angle, const int nstep_between_samples)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/receivers.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:29. -Declaration is '.. cpp:function:: receivers (const YAML::Node &Node)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/receivers.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:29. -Declaration is '.. cpp:function:: inline std::string get_stations_file () const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/receivers.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:29. -Declaration is '.. cpp:function:: inline type_real get_angle () const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/receivers.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:29. -Declaration is '.. cpp:function:: inline int get_nstep_between_samples () const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/receivers.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:29. -Declaration is '.. cpp:function:: inline std::vector< specfem::enums::seismogram::type > get_seismogram_types () const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/run_setup.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:26. -Declaration is '.. cpp:class:: specfem::runtime_configuration::run_setup'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/run_setup.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:26. -Declaration is '.. cpp:member:: int nproc'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/run_setup.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:26. -Declaration is '.. cpp:member:: int nruns'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/run_setup.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:26. -Declaration is '.. cpp:function:: inline run_setup (int nproc, int nruns)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/run_setup.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:26. -Declaration is '.. cpp:function:: run_setup (const YAML::Node &Node)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/seismogram.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:32. -Declaration is '.. cpp:class:: specfem::runtime_configuration::seismogram'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/seismogram.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:32. -Declaration is '.. cpp:member:: std::string seismogram_format'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/seismogram.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:32. -Declaration is '.. cpp:member:: std::string output_folder'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/seismogram.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:32. -Declaration is '.. cpp:function:: inline seismogram (const std::string seismogram_format, const std::string output_folder)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/seismogram.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:32. -Declaration is '.. cpp:function:: seismogram (const YAML::Node &Node)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/seismogram.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:32. -Declaration is '.. cpp:function:: specfem::writer::writer * instantiate_seismogram_writer (std::vector< specfem::receivers::receiver *> &receivers, specfem::compute::receivers *compute_receivers, const type_real dt, const type_real t0, const int nsteps_between_samples) const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/setup.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:35. -Declaration is '.. cpp:class:: specfem::runtime_configuration::setup'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/setup.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:35. -Declaration is '.. cpp:member:: std::unique_ptr< specfem::runtime_configuration::header > header'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/setup.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:35. -Declaration is '.. cpp:member:: std::unique_ptr< specfem::runtime_configuration::solver::solver > solver'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/setup.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:35. -Declaration is '.. cpp:member:: std::unique_ptr< specfem::runtime_configuration::run_setup > run_setup'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/setup.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:35. -Declaration is '.. cpp:member:: std::unique_ptr< specfem::runtime_configuration::quadrature > quadrature'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/setup.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:35. -Declaration is '.. cpp:member:: std::unique_ptr< specfem::runtime_configuration::receivers > receivers'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/setup.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:35. -Declaration is '.. cpp:member:: std::unique_ptr< specfem::runtime_configuration::seismogram > seismogram'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/setup.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:35. -Declaration is '.. cpp:member:: std::unique_ptr< specfem::runtime_configuration::database_configuration > databases'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/setup.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:35. -Declaration is '.. cpp:function:: setup (const std::string ¶meter_file, const std::string &default_file)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/setup.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:35. -Declaration is '.. cpp:function:: inline std::tuple< specfem::quadrature::quadrature *, specfem::quadrature::quadrature * > instantiate_quadrature ()'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/setup.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:35. -Declaration is '.. cpp:function:: inline specfem::TimeScheme::TimeScheme * instantiate_solver ()'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/setup.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:35. -Declaration is '.. cpp:function:: inline void update_t0 (type_real t0)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/setup.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:35. -Declaration is '.. cpp:function:: std::string print_header (std::chrono::time_point< std::chrono::high_resolution_clock > now)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/setup.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:35. -Declaration is '.. cpp:function:: inline type_real get_dt () const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/setup.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:35. -Declaration is '.. cpp:function:: inline std::tuple< std::string, std::string > get_databases () const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/setup.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:35. -Declaration is '.. cpp:function:: inline std::string get_stations_file () const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/setup.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:35. -Declaration is '.. cpp:function:: inline type_real get_receiver_angle () const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/setup.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:35. -Declaration is '.. cpp:function:: inline std::vector< specfem::enums::seismogram::type > get_seismogram_types () const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/setup.rst:7: WARNING: Duplicate C++ declaration, also defined at api/parameter:35. -Declaration is '.. cpp:function:: inline specfem::writer::writer * instantiate_seismogram_writer (std::vector< specfem::receivers::receiver *> &receivers, specfem::compute::receivers *compute_receivers) const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/solver/index.rst:7: WARNING: doxygenclass: Cannot find class "specfem::runtime_configuration::solver:solver" in doxygen xml output for project "SPECFEM KOKKOS IMPLEMENTATION" from directory: _build/xml -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/solver/time_marching.rst:5: WARNING: Duplicate C++ declaration, also defined at api/parameter:14. -Declaration is '.. cpp:class:: specfem::runtime_configuration::solver::time_marching : public specfem::runtime_configuration::solver::solver'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/solver/time_marching.rst:5: WARNING: Duplicate C++ declaration, also defined at api/parameter:14. -Declaration is '.. cpp:member:: int nstep'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/solver/time_marching.rst:5: WARNING: Duplicate C++ declaration, also defined at api/parameter:14. -Declaration is '.. cpp:member:: type_real dt'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/solver/time_marching.rst:5: WARNING: Duplicate C++ declaration, also defined at api/parameter:14. -Declaration is '.. cpp:member:: type_real t0'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/solver/time_marching.rst:5: WARNING: Duplicate C++ declaration, also defined at api/parameter:14. -Declaration is '.. cpp:member:: std::string timescheme'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/solver/time_marching.rst:5: WARNING: Duplicate C++ declaration, also defined at api/parameter:14. -Declaration is '.. cpp:function:: inline time_marching (std::string timescheme, type_real dt, type_real nstep)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/solver/time_marching.rst:5: WARNING: Duplicate C++ declaration, also defined at api/parameter:14. -Declaration is '.. cpp:function:: time_marching (const YAML::Node &Node)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/solver/time_marching.rst:5: WARNING: Duplicate C++ declaration, also defined at api/parameter:14. -Declaration is '.. cpp:function:: inline virtual void update_t0 (type_real t0) override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/solver/time_marching.rst:5: WARNING: Duplicate C++ declaration, also defined at api/parameter:14. -Declaration is '.. cpp:function:: virtual specfem::TimeScheme::TimeScheme * instantiate (const int nstep_between_samples) override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/solver/time_marching.rst:5: WARNING: Duplicate C++ declaration, also defined at api/parameter:14. -Declaration is '.. cpp:function:: inline virtual type_real get_dt () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/solver/time_marching.rst:5: WARNING: Duplicate C++ declaration, also defined at api/parameter:14. -Declaration is '.. cpp:function:: inline virtual type_real get_t0 () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/solver.rst:6: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/solver.rst:9: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/solver.rst:9: WARNING: Duplicate C++ declaration, also defined at api/solver:6. -Declaration is '.. cpp:type:: solver'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/solver.rst:4: CRITICAL: Duplicate ID: "namespacespecfem_1_1solver". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/solver.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem_1_1solver". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/solver.rst:4: CRITICAL: Duplicate ID: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/solver.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/solver/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/solver:6. -Declaration is '.. cpp:class:: specfem::solver::solver'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/solver/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/solver:6. -Declaration is '.. cpp:function:: virtual void run ()=0'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/solver/index.rst:3: WARNING: duplicate label solver api, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/solver/index.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/solver/index.rst:13: WARNING: duplicate label types of solvers, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/solver/index.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/solver/time_marching.rst:7: WARNING: Duplicate C++ declaration, also defined at api/solver:9. -Declaration is '.. cpp:class:: template specfem::solver::time_marching : public specfem::solver::solver'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/solver/time_marching.rst:7: WARNING: Duplicate C++ declaration, also defined at api/solver:9. -Declaration is '.. cpp:member:: specfem::domain::domain< specfem::enums::element::medium::acoustic, qp_type > acoustic_domain'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/solver/time_marching.rst:7: WARNING: Duplicate C++ declaration, also defined at api/solver:9. -Declaration is '.. cpp:member:: specfem::domain::domain< specfem::enums::element::medium::elastic, qp_type > elastic_domain'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/solver/time_marching.rst:7: WARNING: Duplicate C++ declaration, also defined at api/solver:9. -Declaration is '.. cpp:member:: specfem::coupled_interface::coupled_interface< specfem::domain::domain< specfem::enums::element::medium::acoustic, qp_type >, specfem::domain::domain< specfem::enums::element::medium::elastic, qp_type > > acoustic_elastic_interface'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/solver/time_marching.rst:7: WARNING: Duplicate C++ declaration, also defined at api/solver:9. -Declaration is '.. cpp:member:: specfem::coupled_interface::coupled_interface< specfem::domain::domain< specfem::enums::element::medium::elastic, qp_type >, specfem::domain::domain< specfem::enums::element::medium::acoustic, qp_type > > elastic_acoustic_interface'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/solver/time_marching.rst:7: WARNING: Duplicate C++ declaration, also defined at api/solver:9. -Declaration is '.. cpp:member:: specfem::TimeScheme::TimeScheme * it'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/solver/time_marching.rst:7: WARNING: Duplicate C++ declaration, also defined at api/solver:9. -Declaration is '.. cpp:function:: inline time_marching (specfem::domain::domain< specfem::enums::element::medium::acoustic, qp_type > &acoustic_domain, specfem::domain::domain< specfem::enums::element::medium::elastic, qp_type > &elastic_domain, specfem::coupled_interface::coupled_interface< specfem::domain::domain< specfem::enums::element::medium::acoustic, qp_type >, specfem::domain::domain< specfem::enums::element::medium::elastic, qp_type > > &acoustic_elastic_interface, specfem::coupled_interface::coupled_interface< specfem::domain::domain< specfem::enums::element::medium::elastic, qp_type >, specfem::domain::domain< specfem::enums::element::medium::acoustic, qp_type > > &elastic_acoustic_interface, specfem::TimeScheme::TimeScheme *it)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/solver/time_marching.rst:7: WARNING: Duplicate C++ declaration, also defined at api/solver:9. -Declaration is '.. cpp:function:: virtual void run () override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/solver/time_marching.rst:3: WARNING: duplicate label time marching solver, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/solver/time_marching.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources/force_source.rst:7: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 34] - virtual KOKKOS_IMPL_HOST_FUNCTION type_real get_t0 () const override - ----------------------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected '::' in pointer to member (function). [error at 44] - virtual KOKKOS_IMPL_HOST_FUNCTION type_real get_t0 () const override - --------------------------------------------^ - If declarator-id: - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 44] - virtual KOKKOS_IMPL_HOST_FUNCTION type_real get_t0 () const override - --------------------------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources/index.rst:7: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 41] - inline virtual KOKKOS_IMPL_HOST_FUNCTION type_real get_t0 () const - -----------------------------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected '::' in pointer to member (function). [error at 51] - inline virtual KOKKOS_IMPL_HOST_FUNCTION type_real get_t0 () const - ---------------------------------------------------^ - If declarator-id: - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 51] - inline virtual KOKKOS_IMPL_HOST_FUNCTION type_real get_t0 () const - ---------------------------------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources/index.rst:22: WARNING: duplicate label auxiliary functions, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/receivers/index.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources/moment_tensor_source.rst:7: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 34] - virtual KOKKOS_IMPL_HOST_FUNCTION type_real get_t0 () const override - ----------------------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected '::' in pointer to member (function). [error at 44] - virtual KOKKOS_IMPL_HOST_FUNCTION type_real get_t0 () const override - --------------------------------------------^ - If declarator-id: - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 44] - virtual KOKKOS_IMPL_HOST_FUNCTION type_real get_t0 () const override - --------------------------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:11: WARNING: doxygenfile: Found multiple matches for file "source.hpp -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/namespaces/index:68. -Declaration is '.. cpp:type:: sources'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:class:: force : public specfem::sources::source'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:member:: type_real xi'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:member:: type_real gamma'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:member:: type_real x'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:member:: type_real z'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:member:: type_real angle'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:member:: int ispec'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:member:: int islice'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:member:: specfem::enums::element::type el_type'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:member:: specfem::forcing_function::stf * forcing_function =NULL'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:function:: force (YAML::Node &Node, const type_real dt)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:function:: virtual void locate (const specfem::kokkos::HostView2d< type_real > coord, const specfem::kokkos::HostMirror3d< int > h_ibool, const specfem::kokkos::HostMirror1d< type_real > xigll, const specfem::kokkos::HostMirror1d< type_real > zigll, const int nproc, const specfem::kokkos::HostView2d< type_real > coorg, const specfem::kokkos::HostView2d< int > knods, const int npgeo, const specfem::kokkos::HostMirror1d< specfem::enums::element::type > ispec_type, const specfem::MPI::MPI *mpi) override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:function:: virtual void compute_source_array (const specfem::quadrature::quadrature *quadx, const specfem::quadrature::quadrature *quadz, specfem::kokkos::HostView3d< type_real > source_array) override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:function:: virtual void check_locations (const type_real xmin, const type_real xmax, const type_real zmin, const type_real zmax, const specfem::MPI::MPI *mpi) override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:function:: inline virtual int get_islice () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:function:: inline virtual int get_ispec () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:function:: inline virtual type_real get_x () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:function:: inline virtual type_real get_z () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:function:: inline virtual type_real get_xi () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:function:: inline virtual type_real get_gamma () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:function:: inline ~force ()'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 34] - virtual KOKKOS_IMPL_HOST_FUNCTION type_real get_t0 () const override - ----------------------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected '::' in pointer to member (function). [error at 44] - virtual KOKKOS_IMPL_HOST_FUNCTION type_real get_t0 () const override - --------------------------------------------^ - If declarator-id: - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 44] - virtual KOKKOS_IMPL_HOST_FUNCTION type_real get_t0 () const override - --------------------------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:function:: virtual void update_tshift (type_real tshift) override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:function:: virtual void print (std::ostream &out) const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:function:: virtual std::string print () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:14: WARNING: Duplicate C++ declaration, also defined at api/sources/force_source:7. -Declaration is '.. cpp:function:: inline virtual specfem::forcing_function::stf * get_stf () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/namespaces/index:68. -Declaration is '.. cpp:type:: sources'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:class:: moment_tensor : public specfem::sources::source'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:member:: type_real xi'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:member:: type_real gamma'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:member:: type_real x'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:member:: type_real z'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:member:: type_real Mxx'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:member:: type_real Mxz'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:member:: type_real Mzz'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:member:: int ispec'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:member:: int islice'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:member:: specfem::kokkos::HostView2d< type_real > s_coorg'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:member:: specfem::forcing_function::stf * forcing_function =NULL'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:member:: specfem::enums::element::type el_type'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:function:: moment_tensor (YAML::Node &Node, const type_real dt)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:function:: virtual void locate (const specfem::kokkos::HostView2d< type_real > coord, const specfem::kokkos::HostMirror3d< int > h_ibool, const specfem::kokkos::HostMirror1d< type_real > xigll, const specfem::kokkos::HostMirror1d< type_real > zigll, const int nproc, const specfem::kokkos::HostView2d< type_real > coorg, const specfem::kokkos::HostView2d< int > knods, const int npgeo, const specfem::kokkos::HostMirror1d< specfem::enums::element::type > ispec_type, const specfem::MPI::MPI *mpi) override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:function:: virtual void compute_source_array (const specfem::quadrature::quadrature *quadx, const specfem::quadrature::quadrature *quadz, specfem::kokkos::HostView3d< type_real > source_array) override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:function:: inline virtual int get_islice () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:function:: inline virtual int get_ispec () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:function:: inline virtual type_real get_x () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:function:: inline virtual type_real get_z () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:function:: inline virtual type_real get_xi () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:function:: inline virtual type_real get_gamma () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 34] - virtual KOKKOS_IMPL_HOST_FUNCTION type_real get_t0 () const override - ----------------------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected '::' in pointer to member (function). [error at 44] - virtual KOKKOS_IMPL_HOST_FUNCTION type_real get_t0 () const override - --------------------------------------------^ - If declarator-id: - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 44] - virtual KOKKOS_IMPL_HOST_FUNCTION type_real get_t0 () const override - --------------------------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:function:: virtual void update_tshift (type_real tshift) override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:function:: virtual void print (std::ostream &out) const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:function:: virtual std::string print () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:function:: inline virtual specfem::forcing_function::stf * get_stf () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:function:: virtual void check_locations (const type_real xmin, const type_real xmax, const type_real zmin, const type_real zmax, const specfem::MPI::MPI *mpi) override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:17: WARNING: Duplicate C++ declaration, also defined at api/sources/moment_tensor_source:7. -Declaration is '.. cpp:function:: inline ~moment_tensor ()'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:4: CRITICAL: Duplicate ID: "namespacespecfem_1_1sources". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem_1_1sources". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:4: CRITICAL: Duplicate ID: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:23: ERROR: Error in "doxygenfile" directive: -unknown option: "projet". - -.. doxygenfile:: receiver.hpp - :projet: SPECFEM KOKKOS IMPLEMENTATION -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:29: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:29: WARNING: Duplicate C++ declaration, also defined at api/namespaces/index:68. -Declaration is '.. cpp:type:: sources'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:29: WARNING: Duplicate C++ declaration, also defined at api/sources/index:24. -Declaration is '.. cpp:function:: std::tuple< std::vector< specfem::sources::source * >, type_real > read_sources (const std::string sources_file, const type_real dt, const specfem::MPI::MPI *mpi)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:4: CRITICAL: Duplicate ID: "namespacespecfem_1_1sources". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem_1_1sources". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:4: CRITICAL: Duplicate ID: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:32: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:32: WARNING: Duplicate C++ declaration, also defined at api/namespaces/index:71. -Declaration is '.. cpp:type:: receivers'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:32: WARNING: Duplicate C++ declaration, also defined at api/receivers/index:15. -Declaration is '.. cpp:function:: std::vector< specfem::receivers::receiver * > read_receivers (const std::string stations_file, const type_real angle)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:4: CRITICAL: Duplicate ID: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:38: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:38: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 31] - inline virtual KOKKOS_FUNCTION type_real compute (type_real t) - -------------------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected '::' in pointer to member (function). [error at 41] - inline virtual KOKKOS_FUNCTION type_real compute (type_real t) - -----------------------------------------^ - If declarator-id: - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 41] - inline virtual KOKKOS_FUNCTION type_real compute (type_real t) - -----------------------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:38: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 31] - inline virtual KOKKOS_FUNCTION void update_tshift (type_real tshift) - -------------------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 35] - inline virtual KOKKOS_FUNCTION void update_tshift (type_real tshift) - -----------------------------------^ - If declarator-id: - Invalid C++ declaration: Expected identifier in nested name, got keyword: void [error at 35] - inline virtual KOKKOS_FUNCTION void update_tshift (type_real tshift) - -----------------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:38: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 31] - inline virtual KOKKOS_FUNCTION type_real get_t0 () const - -------------------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected '::' in pointer to member (function). [error at 41] - inline virtual KOKKOS_FUNCTION type_real get_t0 () const - -----------------------------------------^ - If declarator-id: - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 41] - inline virtual KOKKOS_FUNCTION type_real get_t0 () const - -----------------------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:38: WARNING: Error when parsing function declaration. -If the function has no return type: - Error in declarator or parameters-and-qualifiers - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 23] - inline KOKKOS_FUNCTION type_real compute (const type_real t) - -----------------------^ -If the function has a return type: - Error in declarator or parameters-and-qualifiers - If pointer to member declarator: - Invalid C++ declaration: Expected '::' in pointer to member (function). [error at 33] - inline KOKKOS_FUNCTION type_real compute (const type_real t) - ---------------------------------^ - If declarator-id: - Invalid C++ declaration: Expecting "(" in parameters-and-qualifiers. [error at 33] - inline KOKKOS_FUNCTION type_real compute (const type_real t) - ---------------------------------^ - -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:4: CRITICAL: Duplicate ID: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/specfem_enums.rst:8: WARNING: doxygenfile: Cannot find file "include/specfem_enums.hpp -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/specfem_enums.rst:4: WARNING: duplicate label enumerations, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/enumerations/index.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/specfem_mpi.rst:1: WARNING: malformed hyperlink target. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/specfem_mpi.rst:8: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme.rst:8: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme.rst:8: WARNING: Duplicate C++ declaration, also defined at api/namespaces/index:74. -Declaration is '.. cpp:type:: TimeScheme'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme.rst:11: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme.rst:11: WARNING: Duplicate C++ declaration, also defined at api/namespaces/index:74. -Declaration is '.. cpp:type:: TimeScheme'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme.rst:4: CRITICAL: Duplicate ID: "namespacespecfem_1_1_time_scheme". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem_1_1_time_scheme". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme.rst:4: CRITICAL: Duplicate ID: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/timescheme:8. -Declaration is '.. cpp:class:: specfem::TimeScheme::TimeScheme'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/timescheme:8. -Declaration is '.. cpp:function:: inline virtual bool status () const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/timescheme:8. -Declaration is '.. cpp:function:: inline virtual void increment_time ()'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/timescheme:8. -Declaration is '.. cpp:function:: inline virtual type_real get_time () const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/timescheme:8. -Declaration is '.. cpp:function:: inline virtual int get_timestep () const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/timescheme:8. -Declaration is '.. cpp:function:: inline virtual void reset_time ()'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/timescheme:8. -Declaration is '.. cpp:function:: inline virtual int get_max_timestep ()'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/timescheme:8. -Declaration is '.. cpp:function:: inline virtual void apply_predictor_phase (specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot_dot)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/timescheme:8. -Declaration is '.. cpp:function:: inline virtual void apply_corrector_phase (specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot_dot)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/timescheme:8. -Declaration is '.. cpp:function:: virtual void print (std::ostream &out) const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/timescheme:8. -Declaration is '.. cpp:function:: inline virtual bool compute_seismogram () const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/timescheme:8. -Declaration is '.. cpp:function:: inline virtual int get_seismogram_step () const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/timescheme:8. -Declaration is '.. cpp:function:: inline virtual int get_max_seismogram_step () const'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/timescheme:8. -Declaration is '.. cpp:function:: inline virtual void increment_seismogram_step ()'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/index.rst:7: WARNING: Duplicate C++ declaration, also defined at api/timescheme:8. -Declaration is '.. cpp:function:: friend std::ostream & operator<< (std::ostream &out, TimeScheme &ts)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/newmark.rst:5: WARNING: Duplicate C++ declaration, also defined at api/timescheme:11. -Declaration is '.. cpp:class:: specfem::TimeScheme::Newmark : public specfem::TimeScheme::TimeScheme'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/newmark.rst:5: WARNING: Duplicate C++ declaration, also defined at api/timescheme:11. -Declaration is '.. cpp:member:: type_real current_time'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/newmark.rst:5: WARNING: Duplicate C++ declaration, also defined at api/timescheme:11. -Declaration is '.. cpp:member:: int istep = 0'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/newmark.rst:5: WARNING: Duplicate C++ declaration, also defined at api/timescheme:11. -Declaration is '.. cpp:member:: type_real deltat'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/newmark.rst:5: WARNING: Duplicate C++ declaration, also defined at api/timescheme:11. -Declaration is '.. cpp:member:: type_real deltatover2'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/newmark.rst:5: WARNING: Duplicate C++ declaration, also defined at api/timescheme:11. -Declaration is '.. cpp:member:: type_real deltatsquareover2'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/newmark.rst:5: WARNING: Duplicate C++ declaration, also defined at api/timescheme:11. -Declaration is '.. cpp:member:: int nstep'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/newmark.rst:5: WARNING: Duplicate C++ declaration, also defined at api/timescheme:11. -Declaration is '.. cpp:member:: type_real t0'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/newmark.rst:5: WARNING: Duplicate C++ declaration, also defined at api/timescheme:11. -Declaration is '.. cpp:member:: int nstep_between_samples'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/newmark.rst:5: WARNING: Duplicate C++ declaration, also defined at api/timescheme:11. -Declaration is '.. cpp:member:: int isig_step = 0'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/newmark.rst:5: WARNING: Duplicate C++ declaration, also defined at api/timescheme:11. -Declaration is '.. cpp:function:: Newmark (const int nstep, const type_real t0, const type_real dt, const int nstep_between_samples)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/newmark.rst:5: WARNING: Duplicate C++ declaration, also defined at api/timescheme:11. -Declaration is '.. cpp:function:: inline virtual bool status () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/newmark.rst:5: WARNING: Duplicate C++ declaration, also defined at api/timescheme:11. -Declaration is '.. cpp:function:: virtual void increment_time () override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/newmark.rst:5: WARNING: Duplicate C++ declaration, also defined at api/timescheme:11. -Declaration is '.. cpp:function:: inline virtual type_real get_time () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/newmark.rst:5: WARNING: Duplicate C++ declaration, also defined at api/timescheme:11. -Declaration is '.. cpp:function:: inline virtual int get_timestep () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/newmark.rst:5: WARNING: Duplicate C++ declaration, also defined at api/timescheme:11. -Declaration is '.. cpp:function:: virtual void reset_time () override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/newmark.rst:5: WARNING: Duplicate C++ declaration, also defined at api/timescheme:11. -Declaration is '.. cpp:function:: inline virtual int get_max_timestep () override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/newmark.rst:5: WARNING: Duplicate C++ declaration, also defined at api/timescheme:11. -Declaration is '.. cpp:function:: virtual void apply_predictor_phase (specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot_dot) override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/newmark.rst:5: WARNING: Duplicate C++ declaration, also defined at api/timescheme:11. -Declaration is '.. cpp:function:: virtual void apply_corrector_phase (specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot, specfem::kokkos::DeviceView2d< type_real, Kokkos::LayoutLeft > field_dot_dot) override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/newmark.rst:5: WARNING: Duplicate C++ declaration, also defined at api/timescheme:11. -Declaration is '.. cpp:function:: inline virtual bool compute_seismogram () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/newmark.rst:5: WARNING: Duplicate C++ declaration, also defined at api/timescheme:11. -Declaration is '.. cpp:function:: inline virtual int get_seismogram_step () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/newmark.rst:5: WARNING: Duplicate C++ declaration, also defined at api/timescheme:11. -Declaration is '.. cpp:function:: inline virtual int get_max_seismogram_step () const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/newmark.rst:5: WARNING: Duplicate C++ declaration, also defined at api/timescheme:11. -Declaration is '.. cpp:function:: inline virtual void increment_seismogram_step () override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme/newmark.rst:5: WARNING: Duplicate C++ declaration, also defined at api/timescheme:11. -Declaration is '.. cpp:function:: virtual void print (std::ostream &out) const override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/writer.rst:1: ERROR: Unknown directive type "writer". - -.. writer:: -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/writer.rst:8: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/writer.rst:8: WARNING: Duplicate C++ declaration, also defined at api/namespaces/index:77. -Declaration is '.. cpp:type:: writer'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/writer.rst:8: WARNING: Duplicate C++ declaration, also defined at api/IO/writer/index:7. -Declaration is '.. cpp:class:: writer'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/writer.rst:8: WARNING: Duplicate C++ declaration, also defined at api/IO/writer/index:7. -Declaration is '.. cpp:function:: inline virtual void write ()'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/writer.rst:11: WARNING: Duplicate C++ declaration, also defined at api/jacobian:8. -Declaration is '.. cpp:type:: specfem'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/writer.rst:11: WARNING: Duplicate C++ declaration, also defined at api/namespaces/index:77. -Declaration is '.. cpp:type:: writer'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/writer.rst:11: WARNING: Duplicate C++ declaration, also defined at api/IO/writer/seismogram_writer:7. -Declaration is '.. cpp:class:: seismogram : public specfem::writer::writer'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/writer.rst:11: WARNING: Duplicate C++ declaration, also defined at api/IO/writer/seismogram_writer:7. -Declaration is '.. cpp:member:: specfem::enums::seismogram::format type'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/writer.rst:11: WARNING: Duplicate C++ declaration, also defined at api/IO/writer/seismogram_writer:7. -Declaration is '.. cpp:member:: std::string output_folder'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/writer.rst:11: WARNING: Duplicate C++ declaration, also defined at api/IO/writer/seismogram_writer:7. -Declaration is '.. cpp:member:: specfem::compute::receivers * compute_receivers'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/writer.rst:11: WARNING: Duplicate C++ declaration, also defined at api/IO/writer/seismogram_writer:7. -Declaration is '.. cpp:member:: std::vector< specfem::receivers::receiver * > receivers'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/writer.rst:11: WARNING: Duplicate C++ declaration, also defined at api/IO/writer/seismogram_writer:7. -Declaration is '.. cpp:member:: type_real dt'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/writer.rst:11: WARNING: Duplicate C++ declaration, also defined at api/IO/writer/seismogram_writer:7. -Declaration is '.. cpp:member:: type_real t0'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/writer.rst:11: WARNING: Duplicate C++ declaration, also defined at api/IO/writer/seismogram_writer:7. -Declaration is '.. cpp:member:: int nstep_between_samples'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/writer.rst:11: WARNING: Duplicate C++ declaration, also defined at api/IO/writer/seismogram_writer:7. -Declaration is '.. cpp:function:: inline seismogram (std ::vector< specfem::receivers::receiver *> &receivers, specfem::compute::receivers *compute_receivers, const specfem::enums::seismogram::format type, const std::string output_folder, const type_real dt, const type_real t0, const int nstep_between_samples)'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/writer.rst:11: WARNING: Duplicate C++ declaration, also defined at api/IO/writer/seismogram_writer:7. -Declaration is '.. cpp:function:: virtual void write () override'. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/writer.rst:4: CRITICAL: Duplicate ID: "namespacespecfem_1_1writer". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/writer.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem_1_1writer". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/writer.rst:4: CRITICAL: Duplicate ID: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/writer.rst:4: WARNING: Duplicate explicit target name: "namespacespecfem". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/cookbooks/example_01.rst:545: ERROR: Error in "code" directive: -unknown option: "linenos". - -.. code:: yaml - :linenos: - :caption: single_source.yaml - - number-of-sources: 1 - sources: - - force: - x : 2500.0 - z : 2500.0 - source_surf: false - angle : 0.0 - vx : 0.0 - vz : 0.0 - Dirac: - factor: 1.0 - tshift: 0.0 -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/cookbooks/example_01.rst:562: ERROR: Error in "code" directive: -unknown option: "linenos". - -.. code:: yaml - :linenos: - :caption: two_sources.yaml - - number-of-sources: 2 - sources: - - force: - x : 2500.0 - z : 2500.0 - source_surf: false - angle : 0.0 - vx : 0.0 - vz : 0.0 - Dirac: - factor: 1.0 - tshift: 0.0 - - force: - x : 2500.0 - z : 500.0 - source_surf: false - angle : 0.0 - vx : 0.0 - vz : 0.0 - Dirac: - factor: 1.0 - tshift: 0.0 -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/cookbooks/index.rst:4: WARNING: duplicate label cookbooks, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/cookbooks/index.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/developer_documentation/SPECFEM_architecture/domain.rst:1: ERROR: Unknown directive type "domain_coupled_interface_dev_guide". - -.. domain_coupled_interface_dev_guide:: -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/developer_documentation/SPECFEM_architecture/domain.rst:4: WARNING: Title underline too short. - -Domain and Coupled Interface Developer Guide -=========================================== -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/developer_documentation/SPECFEM_architecture/domain.rst:71: ERROR: Unknown interpreted text role "cite". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/developer_documentation/SPECFEM_architecture/domain.rst:161: WARNING: Mismatch: both interpreted text role prefix and reference suffix. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/developer_documentation/SPECFEM_architecture/domain.rst:421: ERROR: Unknown interpreted text role "cite". -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/developer_documentation/SPECFEM_architecture/quadrature.rst:10: ERROR: Unexpected indentation. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/developer_documentation/SPECFEM_architecture/quadrature.rst:10: WARNING: Inline interpreted text or phrase reference start-string without end-string. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/developer_documentation/SPECFEM_architecture/quadrature.rst:11: WARNING: Inline interpreted text or phrase reference start-string without end-string. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/developer_documentation/SPECFEM_architecture/quadrature.rst:11: WARNING: Inline interpreted text or phrase reference start-string without end-string. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/developer_documentation/SPECFEM_architecture/quadrature.rst:13: WARNING: Block quote ends without a blank line; unexpected unindent. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/developer_documentation/git_workflow.rst:11: WARNING: Bullet list ends without a blank line; unexpected unindent. -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/developer_documentation/index.rst:4: WARNING: duplicate label developer documentation, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/developer_documentation/index.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/developer_documentation/tests.rst:4: WARNING: duplicate label tests, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/developer_documentation/tests.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/parameter_documentation/databases.rst:10: WARNING: Title underline too short. - -**Parameter name** : ``databases`` -------------------------------- -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/parameter_documentation/header.rst:2: WARNING: duplicate label header, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/header.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/parameter_documentation/header.rst:7: WARNING: duplicate label parameter definitions, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/parameter_documentation/databases.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/parameter_documentation/run_setup.rst:2: WARNING: duplicate label runtime setup, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/run_setup.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/parameter_documentation/run_setup.rst:7: WARNING: duplicate label parameter definitions, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/parameter_documentation/header.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/parameter_documentation/seismogram_setup.rst:8: WARNING: duplicate label parameter definitions, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/parameter_documentation/run_setup.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/parameter_documentation/simulation_setup.rst:2: WARNING: duplicate label simulation setup, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/parameter_documentation/simulation_setup.rst:7: WARNING: duplicate label parameter definitions, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/parameter_documentation/seismogram_setup.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/source_description/index.rst:75: WARNING: Title underline too short. - -**Parameter Name** : ``sources..source_surf`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/source_description/index.rst:75: WARNING: Title underline too short. - -**Parameter Name** : ``sources..source_surf`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/source_description/index.rst:111: WARNING: Title underline too short. - -**Parameter Name** : ``sources.moment_tensor.Mxx`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/source_description/index.rst:111: WARNING: Title underline too short. - -**Parameter Name** : ``sources.moment_tensor.Mxx`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/source_description/index.rst:120: WARNING: Title underline too short. - -**Parameter Name** : ``sources.moment_tensor.Mxz`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/source_description/index.rst:120: WARNING: Title underline too short. - -**Parameter Name** : ``sources.moment_tensor.Mxz`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/source_description/index.rst:129: WARNING: Title underline too short. - -**Parameter Name** : ``sources.moment_tensor.Mzz`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/source_description/index.rst:129: WARNING: Title underline too short. - -**Parameter Name** : ``sources.moment_tensor.Mzz`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/source_description/index.rst:138: WARNING: Title underline too short. - -**Parameter Name** : ``sources..Dirac`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/source_description/index.rst:138: WARNING: Title underline too short. - -**Parameter Name** : ``sources..Dirac`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/source_description/index.rst:30: WARNING: duplicate label **parameter name** : ``sources``, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/source_description/index.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/source_description/index.rst:156: WARNING: duplicate label **parameter name** : ``sources..dirac.factor``, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/source_description/index.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/user_documentation/introduction.rst:2: WARNING: duplicate label introduction, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/index.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/user_documentation/introduction.rst:7: WARNING: duplicate label code feature matrix, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/index.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/user_documentation/running_the_solver.rst:2: WARNING: duplicate label running the solver, other instance in /scratch/gpfs/rk9481/specfem2d_kokkos/docs/cookbooks/example_01.rst -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/IO/mesh/boundaries/acoustic_forcing.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/compute/compute.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/compute/compute_coupled_interfaces.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/compute/compute_partial_derivatives.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/compute/compute_properties.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/compute/compute_receivers.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/compute/compute_sources.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/coupling_physics/edge/elastic_acoustic/acoustic_elastic_edge.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/coupling_physics/edge/elastic_acoustic/elastic_acoustic_edge.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_acoustic_static_quadrature_points_isotropic.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/element/elements_dim2_elastic_static_quadrature_points_isotropic.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/receivers/receivers_dim2_acoustic_static_quadrature_points_isotropic.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/receivers/receivers_dim2_elastic_static_quadrature_points_isotropic.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/sources/sources_dim2_acoustic_static_quadrature_points_isotrpoic.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/domain/sources/sources_dim2_elastic_static_quadrature_points_isotropic.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/enumerations/element/acoustic.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/enumerations/element/dim2.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/enumerations/element/dim3.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/enumerations/element/elastic.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/enumerations/element/isotropic.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/enumerations/element/static_quadrature_points.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/jacobian.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/kokkos_abstractions.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/material.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/namespaces/index.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/parameter.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/quadrature.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/setup_parameters/setup.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/solver.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/sources_recievers.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/specfem_enums.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/specfem_mpi.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/timescheme.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/api/writer.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/developer_documentation/SPECFEM_architecture/architecture.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/developer_documentation/SPECFEM_architecture/compute.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/developer_documentation/SPECFEM_architecture/domain.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/developer_documentation/SPECFEM_architecture/mesh.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/developer_documentation/SPECFEM_architecture/quadrature.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/developer_documentation/cmake_primer.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/developer_documentation/doxygen_primer.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/developer_documentation/kokkos_primer.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/user_documentation/introduction.rst: WARNING: document isn't included in any toctree -/scratch/gpfs/rk9481/specfem2d_kokkos/docs/developer_documentation/SPECFEM_architecture/domain.rst:427: WARNING: undefined label: parallelism diff --git a/include/medium/compute_wavefield.hpp b/include/medium/compute_wavefield.hpp index 236c213c..d70616a3 100644 --- a/include/medium/compute_wavefield.hpp +++ b/include/medium/compute_wavefield.hpp @@ -11,6 +11,7 @@ namespace medium { * @brief Compute the values of wavefield of a given component within a spectral * element. * + * * This function computes the wavefield values given the intrinsic field values * within that element. For example, for elastic medium when the wavefield * component is pressure, the function computes the pressure values from the @@ -41,7 +42,7 @@ template -KOKKOS_INLINE_FUNCTION void +KOKKOS_INLINE_FUNCTION auto compute_wavefield(const MemberType &team, const IteratorType &iterator, const specfem::compute::assembly &assembly, const QuadratureType &quadrature, const ChunkFieldType &field, @@ -74,6 +75,8 @@ compute_wavefield(const MemberType &team, const IteratorType &iterator, property_dispatch(), team, iterator, assembly, quadrature, field, wavefield_component, wavefield_on_entire_grid); + + return; } } // namespace medium From 09059c0370c70f2dc04ae935844765d05bf6922d Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Tue, 26 Nov 2024 12:21:19 -0500 Subject: [PATCH 49/53] Updated Jenkins artifact folder --- .jenkins/gnu_compiler_checks.gvy | 8 ++++---- .jenkins/intel_compiler_checks.gvy | 8 ++++---- .jenkins/nvidia_compiler_checks.gvy | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.jenkins/gnu_compiler_checks.gvy b/.jenkins/gnu_compiler_checks.gvy index 68c0d911..29a7d3c4 100644 --- a/.jenkins/gnu_compiler_checks.gvy +++ b/.jenkins/gnu_compiler_checks.gvy @@ -68,8 +68,8 @@ pipeline{ sh """ module load boost/1.73.0 module load ${GNU_COMPILER_MODULE} - cmake3 -S . -B build_cpu_${GNU_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.GIT_COMMIT} -DCMAKE_BUILD_TYPE=Release ${CMAKE_HOST_FLAGS} ${SIMD_FLAGS} -DBUILD_TESTS=ON - cmake3 --build build_cpu_${GNU_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.GIT_COMMIT} + cmake3 -S . -B build_cpu_${GNU_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.BUILD_TAG} -DCMAKE_BUILD_TYPE=Release ${CMAKE_HOST_FLAGS} ${SIMD_FLAGS} -DBUILD_TESTS=ON + cmake3 --build build_cpu_${GNU_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.BUILD_TAG} """ echo ' Build completed ' } @@ -80,7 +80,7 @@ pipeline{ sh """ module load boost/1.73.0 module load ${GNU_COMPILER_MODULE} - cd build_cpu_${GNU_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.GIT_COMMIT}/tests/unit-tests + cd build_cpu_${GNU_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.BUILD_TAG}/tests/unit-tests srun -N 1 -t 00:20:00 ${HOST_RUN_FLAGS} --constraint=skylake bash -c 'export OMP_PROC_BIND=spread; export OMP_THREADS=places; ctest --verbose;' """ echo ' Testing completed ' @@ -90,7 +90,7 @@ pipeline{ post { always { echo ' Cleaning ' - sh "rm -rf build_cpu_${GNU_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.GIT_COMMIT}" + sh "rm -rf build_cpu_${GNU_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.BUILD_TAG}" } } } diff --git a/.jenkins/intel_compiler_checks.gvy b/.jenkins/intel_compiler_checks.gvy index f3fa66cd..a3244452 100644 --- a/.jenkins/intel_compiler_checks.gvy +++ b/.jenkins/intel_compiler_checks.gvy @@ -69,8 +69,8 @@ pipeline{ module load ${INTEL_MODULE} export CC=icx export CXX=icpx - cmake3 -S . -B build_cpu_${INTEL_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.GIT_COMMIT} -DCMAKE_BUILD_TYPE=Release ${CMAKE_HOST_FLAGS} ${SIMD_FLAGS} -D BUILD_TESTS=ON - cmake3 --build build_cpu_${INTEL_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.GIT_COMMIT} + cmake3 -S . -B build_cpu_${INTEL_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.BUILD_TAG} -DCMAKE_BUILD_TYPE=Release ${CMAKE_HOST_FLAGS} ${SIMD_FLAGS} -D BUILD_TESTS=ON + cmake3 --build build_cpu_${INTEL_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.BUILD_TAG} """ echo ' Build completed ' } @@ -81,7 +81,7 @@ pipeline{ sh """ module load boost/1.73.0 module load ${INTEL_MODULE} - cd build_cpu_${INTEL_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.GIT_COMMIT}/tests/unit-tests + cd build_cpu_${INTEL_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.BUILD_TAG}/tests/unit-tests srun -N 1 -t 00:20:00 ${HOST_RUN_FLAGS} --constraint=skylake bash -c 'export OMP_PROC_BIND=spread; export OMP_THREADS=places; ctest --verbose;' """ echo ' Testing completed ' @@ -91,7 +91,7 @@ pipeline{ post { always { echo ' Cleaning ' - sh "rm -rf build_cpu_${INTEL_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.GIT_COMMIT}" + sh "rm -rf build_cpu_${INTEL_COMPILER_NAME}_${CMAKE_HOST_NAME}_${SIMD_NAME}_${env.BUILD_TAG}" } } } diff --git a/.jenkins/nvidia_compiler_checks.gvy b/.jenkins/nvidia_compiler_checks.gvy index fff1db9e..423c78bb 100644 --- a/.jenkins/nvidia_compiler_checks.gvy +++ b/.jenkins/nvidia_compiler_checks.gvy @@ -83,8 +83,8 @@ pipeline{ sh """ module load boost/1.73.0 module load ${CUDA_MODULE} - cmake3 -S . -B build_cuda_${CUDA_COMPILER_NAME}_${CMAKE_HOST_NAME}_${CMAKE_DEVICE_NAME}_${SIMD_NAME}_${env.GIT_COMMIT} -DCMAKE_BUILD_TYPE=Release ${CMAKE_HOST_FLAGS} ${CMAKE_DEVICE_FLAGS} ${SIMD_FLAGS} -D BUILD_TESTS=ON - cmake3 --build build_cuda_${CUDA_COMPILER_NAME}_${CMAKE_HOST_NAME}_${CMAKE_DEVICE_NAME}_${SIMD_NAME}_${env.GIT_COMMIT} + cmake3 -S . -B build_cuda_${CUDA_COMPILER_NAME}_${CMAKE_HOST_NAME}_${CMAKE_DEVICE_NAME}_${SIMD_NAME}_${env.BUILD_TAG} -DCMAKE_BUILD_TYPE=Release ${CMAKE_HOST_FLAGS} ${CMAKE_DEVICE_FLAGS} ${SIMD_FLAGS} -D BUILD_TESTS=ON + cmake3 --build build_cuda_${CUDA_COMPILER_NAME}_${CMAKE_HOST_NAME}_${CMAKE_DEVICE_NAME}_${SIMD_NAME}_${env.BUILD_TAG} """ echo ' Build completed ' } @@ -95,7 +95,7 @@ pipeline{ sh """ module load boost/1.73.0 module load ${CUDA_MODULE} - cd build_cuda_${CUDA_COMPILER_NAME}_${CMAKE_HOST_NAME}_${CMAKE_DEVICE_NAME}_${SIMD_NAME}_${env.GIT_COMMIT}/tests/unit-tests + cd build_cuda_${CUDA_COMPILER_NAME}_${CMAKE_HOST_NAME}_${CMAKE_DEVICE_NAME}_${SIMD_NAME}_${env.BUILD_TAG}/tests/unit-tests srun -N 1 -t 00:20:00 ${HOST_RUN_FLAGS} ${DEVICE_RUN_FLAGS} bash -c 'export OMP_PROC_BIND=spread; export OMP_THREADS=places; ctest --verbose;' """ echo ' Testing completed ' @@ -105,7 +105,7 @@ pipeline{ post { always { echo ' Cleaning ' - sh "rm -rf build_cuda_${CUDA_COMPILER_NAME}_${CMAKE_HOST_NAME}_${CMAKE_DEVICE_NAME}_${SIMD_NAME}_${env.GIT_COMMIT}" + sh "rm -rf build_cuda_${CUDA_COMPILER_NAME}_${CMAKE_HOST_NAME}_${CMAKE_DEVICE_NAME}_${SIMD_NAME}_${env.BUILD_TAG}" } } } From 573a4c39baf0b02cf4ec2e1b5ffa69d098d209ee Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Tue, 26 Nov 2024 19:47:23 -0500 Subject: [PATCH 50/53] Added impl folder --- include/IO/mesh/{ => impl}/fortran/read_boundaries.hpp | 0 include/IO/mesh/{ => impl}/fortran/read_elements.hpp | 0 include/IO/mesh/{ => impl}/fortran/read_interfaces.hpp | 0 include/IO/mesh/{ => impl}/fortran/read_material_properties.hpp | 0 include/IO/mesh/{ => impl}/fortran/read_mesh_database.hpp | 0 include/IO/mesh/{ => impl}/fortran/read_properties.hpp | 0 src/IO/mesh/{ => impl}/fortran/read_boundaries.cpp | 0 src/IO/mesh/{ => impl}/fortran/read_elements.cpp | 0 src/IO/mesh/{ => impl}/fortran/read_interfaces.cpp | 0 src/IO/mesh/{ => impl}/fortran/read_material_properties.cpp | 0 src/IO/mesh/{ => impl}/fortran/read_mesh_database.cpp | 0 src/IO/mesh/{ => impl}/fortran/read_properties.cpp | 0 12 files changed, 0 insertions(+), 0 deletions(-) rename include/IO/mesh/{ => impl}/fortran/read_boundaries.hpp (100%) rename include/IO/mesh/{ => impl}/fortran/read_elements.hpp (100%) rename include/IO/mesh/{ => impl}/fortran/read_interfaces.hpp (100%) rename include/IO/mesh/{ => impl}/fortran/read_material_properties.hpp (100%) rename include/IO/mesh/{ => impl}/fortran/read_mesh_database.hpp (100%) rename include/IO/mesh/{ => impl}/fortran/read_properties.hpp (100%) rename src/IO/mesh/{ => impl}/fortran/read_boundaries.cpp (100%) rename src/IO/mesh/{ => impl}/fortran/read_elements.cpp (100%) rename src/IO/mesh/{ => impl}/fortran/read_interfaces.cpp (100%) rename src/IO/mesh/{ => impl}/fortran/read_material_properties.cpp (100%) rename src/IO/mesh/{ => impl}/fortran/read_mesh_database.cpp (100%) rename src/IO/mesh/{ => impl}/fortran/read_properties.cpp (100%) diff --git a/include/IO/mesh/fortran/read_boundaries.hpp b/include/IO/mesh/impl/fortran/read_boundaries.hpp similarity index 100% rename from include/IO/mesh/fortran/read_boundaries.hpp rename to include/IO/mesh/impl/fortran/read_boundaries.hpp diff --git a/include/IO/mesh/fortran/read_elements.hpp b/include/IO/mesh/impl/fortran/read_elements.hpp similarity index 100% rename from include/IO/mesh/fortran/read_elements.hpp rename to include/IO/mesh/impl/fortran/read_elements.hpp diff --git a/include/IO/mesh/fortran/read_interfaces.hpp b/include/IO/mesh/impl/fortran/read_interfaces.hpp similarity index 100% rename from include/IO/mesh/fortran/read_interfaces.hpp rename to include/IO/mesh/impl/fortran/read_interfaces.hpp diff --git a/include/IO/mesh/fortran/read_material_properties.hpp b/include/IO/mesh/impl/fortran/read_material_properties.hpp similarity index 100% rename from include/IO/mesh/fortran/read_material_properties.hpp rename to include/IO/mesh/impl/fortran/read_material_properties.hpp diff --git a/include/IO/mesh/fortran/read_mesh_database.hpp b/include/IO/mesh/impl/fortran/read_mesh_database.hpp similarity index 100% rename from include/IO/mesh/fortran/read_mesh_database.hpp rename to include/IO/mesh/impl/fortran/read_mesh_database.hpp diff --git a/include/IO/mesh/fortran/read_properties.hpp b/include/IO/mesh/impl/fortran/read_properties.hpp similarity index 100% rename from include/IO/mesh/fortran/read_properties.hpp rename to include/IO/mesh/impl/fortran/read_properties.hpp diff --git a/src/IO/mesh/fortran/read_boundaries.cpp b/src/IO/mesh/impl/fortran/read_boundaries.cpp similarity index 100% rename from src/IO/mesh/fortran/read_boundaries.cpp rename to src/IO/mesh/impl/fortran/read_boundaries.cpp diff --git a/src/IO/mesh/fortran/read_elements.cpp b/src/IO/mesh/impl/fortran/read_elements.cpp similarity index 100% rename from src/IO/mesh/fortran/read_elements.cpp rename to src/IO/mesh/impl/fortran/read_elements.cpp diff --git a/src/IO/mesh/fortran/read_interfaces.cpp b/src/IO/mesh/impl/fortran/read_interfaces.cpp similarity index 100% rename from src/IO/mesh/fortran/read_interfaces.cpp rename to src/IO/mesh/impl/fortran/read_interfaces.cpp diff --git a/src/IO/mesh/fortran/read_material_properties.cpp b/src/IO/mesh/impl/fortran/read_material_properties.cpp similarity index 100% rename from src/IO/mesh/fortran/read_material_properties.cpp rename to src/IO/mesh/impl/fortran/read_material_properties.cpp diff --git a/src/IO/mesh/fortran/read_mesh_database.cpp b/src/IO/mesh/impl/fortran/read_mesh_database.cpp similarity index 100% rename from src/IO/mesh/fortran/read_mesh_database.cpp rename to src/IO/mesh/impl/fortran/read_mesh_database.cpp diff --git a/src/IO/mesh/fortran/read_properties.cpp b/src/IO/mesh/impl/fortran/read_properties.cpp similarity index 100% rename from src/IO/mesh/fortran/read_properties.cpp rename to src/IO/mesh/impl/fortran/read_properties.cpp From c0f04a61b212efb4a2bf456dc584093918476f93 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Tue, 26 Nov 2024 20:01:16 -0500 Subject: [PATCH 51/53] Fixed all references to move to impl space --- CMakeLists.txt | 12 +++---- .../IO/mesh/impl/fortran/read_boundaries.hpp | 2 ++ .../IO/mesh/impl/fortran/read_elements.hpp | 2 ++ .../IO/mesh/impl/fortran/read_interfaces.hpp | 2 ++ .../impl/fortran/read_material_properties.hpp | 2 ++ .../mesh/impl/fortran/read_mesh_database.hpp | 2 ++ .../IO/mesh/impl/fortran/read_properties.hpp | 2 ++ src/IO/mesh/impl/fortran/read_boundaries.cpp | 10 +++--- src/IO/mesh/impl/fortran/read_elements.cpp | 11 +++--- src/IO/mesh/impl/fortran/read_interfaces.cpp | 22 ++++++------ .../impl/fortran/read_material_properties.cpp | 5 +-- .../mesh/impl/fortran/read_mesh_database.cpp | 12 +++---- src/IO/mesh/impl/fortran/read_properties.cpp | 7 ++-- src/IO/mesh/read_mesh.cpp | 36 ++++++++++--------- src/mesh/mesh.cpp | 2 -- tests/unit-tests/mesh/mesh_tests.cpp | 5 +-- 16 files changed, 75 insertions(+), 59 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ede111b7..d795c74b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,12 +109,12 @@ add_library( src/IO/HDF5/native_type.cpp # src/IO/ASCII/native_type.cpp src/IO/mesh/read_mesh.cpp - src/IO/mesh/fortran/read_boundaries.cpp - src/IO/mesh/fortran/read_elements.cpp - src/IO/mesh/fortran/read_material_properties.cpp - src/IO/mesh/fortran/read_mesh_database.cpp - src/IO/mesh/fortran/read_interfaces.cpp - src/IO/mesh/fortran/read_properties.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 ) diff --git a/include/IO/mesh/impl/fortran/read_boundaries.hpp b/include/IO/mesh/impl/fortran/read_boundaries.hpp index e422d713..37747dee 100644 --- a/include/IO/mesh/impl/fortran/read_boundaries.hpp +++ b/include/IO/mesh/impl/fortran/read_boundaries.hpp @@ -11,6 +11,7 @@ namespace specfem { namespace IO { namespace mesh { +namespace impl { namespace fortran { // /** @@ -70,6 +71,7 @@ read_boundaries(std::ifstream &stream, const int nspec, const int n_absorbing, const specfem::MPI::MPI *mpi); } // namespace fortran +} // namespace impl } // namespace mesh } // namespace IO } // namespace specfem diff --git a/include/IO/mesh/impl/fortran/read_elements.hpp b/include/IO/mesh/impl/fortran/read_elements.hpp index 4af0d796..69c492b4 100644 --- a/include/IO/mesh/impl/fortran/read_elements.hpp +++ b/include/IO/mesh/impl/fortran/read_elements.hpp @@ -7,6 +7,7 @@ namespace specfem { namespace IO { namespace mesh { +namespace impl { namespace fortran { /** @@ -36,6 +37,7 @@ read_axial_elements(std::ifstream &stream, const int nelem_on_the_axis, const int nspec, const specfem::MPI::MPI *mpi); } // namespace fortran +} // namespace impl } // namespace mesh } // namespace IO } // namespace specfem diff --git a/include/IO/mesh/impl/fortran/read_interfaces.hpp b/include/IO/mesh/impl/fortran/read_interfaces.hpp index 68214f47..77826d3e 100644 --- a/include/IO/mesh/impl/fortran/read_interfaces.hpp +++ b/include/IO/mesh/impl/fortran/read_interfaces.hpp @@ -7,6 +7,7 @@ namespace specfem { namespace IO { namespace mesh { +namespace impl { namespace fortran { template knods, const specfem::MPI::MPI *mpi); } // namespace fortran +} // namespace impl } // namespace mesh } // namespace IO } // namespace specfem diff --git a/include/IO/mesh/impl/fortran/read_mesh_database.hpp b/include/IO/mesh/impl/fortran/read_mesh_database.hpp index cd2046d6..6322e2ba 100644 --- a/include/IO/mesh/impl/fortran/read_mesh_database.hpp +++ b/include/IO/mesh/impl/fortran/read_mesh_database.hpp @@ -10,6 +10,7 @@ namespace specfem { namespace IO { namespace mesh { +namespace impl { namespace fortran { /** @@ -46,6 +47,7 @@ std::tuple read_mesh_database_attenuation(std::ifstream &stream, const specfem::MPI::MPI *mpi); } // namespace fortran +} // namespace impl } // namespace mesh } // namespace IO } // namespace specfem diff --git a/include/IO/mesh/impl/fortran/read_properties.hpp b/include/IO/mesh/impl/fortran/read_properties.hpp index b5995d8b..57f413fe 100644 --- a/include/IO/mesh/impl/fortran/read_properties.hpp +++ b/include/IO/mesh/impl/fortran/read_properties.hpp @@ -7,6 +7,7 @@ namespace specfem { namespace IO { namespace mesh { +namespace impl { namespace fortran { /* @@ -20,6 +21,7 @@ specfem::mesh::properties read_properties(std::ifstream &stream, const specfem::MPI::MPI *mpi); } // namespace fortran +} // namespace impl } // namespace mesh } // namespace IO } // namespace specfem diff --git a/src/IO/mesh/impl/fortran/read_boundaries.cpp b/src/IO/mesh/impl/fortran/read_boundaries.cpp index d19b5a1b..7d66911e 100644 --- a/src/IO/mesh/impl/fortran/read_boundaries.cpp +++ b/src/IO/mesh/impl/fortran/read_boundaries.cpp @@ -1,4 +1,4 @@ -#include "IO/mesh/fortran/read_boundaries.hpp" +#include "IO/mesh/impl/fortran/read_boundaries.hpp" #include "IO/fortranio/interface.hpp" #include "mesh/boundaries/boundaries.hpp" #include "specfem_mpi/interface.hpp" @@ -49,11 +49,13 @@ find_corners(const specfem::kokkos::HostView1d ispec_edge, } specfem::kokkos::HostView1d ispec_corners( - "specfem:IO::mesh::fortran::read_boundaries::find_corners::ispec_corners", + "specfem:IO::mesh::impl::fortran::read_boundaries::find_corners::ispec_" + "corners", ncorner); specfem::kokkos::HostView1d type_corners( - "specfem:IO::mesh::fortran::read_boundaries::find_corners::type_corners", + "specfem:IO::mesh::impl::fortran::read_boundaries::find_corners::type_" + "corners", ncorner); int icorner = 0; @@ -349,7 +351,7 @@ read_forcing_boundaries(std::ifstream &stream, const int nelement_acforcing, return forcing_boundary; } -specfem::mesh::boundaries specfem::IO::mesh::fortran::read_boundaries( +specfem::mesh::boundaries specfem::IO::mesh::impl::fortran::read_boundaries( std::ifstream &stream, const int nspec, const int n_absorbing, const int n_acoustic_surface, const int n_acforcing, const Kokkos::View knods, diff --git a/src/IO/mesh/impl/fortran/read_elements.cpp b/src/IO/mesh/impl/fortran/read_elements.cpp index 2c6f98ba..53788e7f 100644 --- a/src/IO/mesh/impl/fortran/read_elements.cpp +++ b/src/IO/mesh/impl/fortran/read_elements.cpp @@ -1,14 +1,13 @@ -#include "IO/mesh/fortran/read_elements.hpp" +#include "IO/mesh/impl/fortran/read_elements.hpp" #include "IO/fortranio/interface.hpp" #include "mesh/elements/axial_elements.hpp" #include "mesh/elements/tangential_elements.hpp" #include "specfem_mpi/interface.hpp" specfem::mesh::elements::axial_elements -specfem::IO::mesh::fortran::read_axial_elements(std::ifstream &stream, - const int nelem_on_the_axis, - const int nspec, - const specfem::MPI::MPI *mpi) { +specfem::IO::mesh::impl::fortran::read_axial_elements( + std::ifstream &stream, const int nelem_on_the_axis, const int nspec, + const specfem::MPI::MPI *mpi) { int ispec; @@ -26,7 +25,7 @@ specfem::IO::mesh::fortran::read_axial_elements(std::ifstream &stream, } specfem::mesh::elements::tangential_elements -specfem::IO::mesh::fortran::read_tangential_elements( +specfem::IO::mesh::impl::fortran::read_tangential_elements( std::ifstream &stream, const int nnodes_tangential_curve) { type_real xread, yread; diff --git a/src/IO/mesh/impl/fortran/read_interfaces.cpp b/src/IO/mesh/impl/fortran/read_interfaces.cpp index 94de5416..9b9d9676 100644 --- a/src/IO/mesh/impl/fortran/read_interfaces.cpp +++ b/src/IO/mesh/impl/fortran/read_interfaces.cpp @@ -1,4 +1,4 @@ -#include "IO/mesh/fortran/read_interfaces.hpp" +#include "IO/mesh/impl/fortran/read_interfaces.hpp" #include "IO/fortranio/interface.hpp" #include "mesh/coupled_interfaces/coupled_interfaces.hpp" #include "mesh/coupled_interfaces/interface_container.hpp" @@ -7,9 +7,9 @@ template specfem::mesh::interface_container -specfem::IO::mesh::fortran::read_interfaces(const int num_interfaces, - std::ifstream &stream, - const specfem::MPI::MPI *mpi) { +specfem::IO::mesh::impl::fortran::read_interfaces( + const int num_interfaces, std::ifstream &stream, + const specfem::MPI::MPI *mpi) { specfem::mesh::interface_container interface( num_interfaces); @@ -33,7 +33,7 @@ specfem::IO::mesh::fortran::read_interfaces(const int num_interfaces, template specfem::mesh::interface_container< specfem::element::medium_tag::elastic, specfem::element::medium_tag::acoustic> -specfem::IO::mesh::fortran::read_interfaces< +specfem::IO::mesh::impl::fortran::read_interfaces< specfem::element::medium_tag::elastic, specfem::element::medium_tag::acoustic>(const int num_interfaces, std::ifstream &stream, @@ -43,7 +43,7 @@ specfem::IO::mesh::fortran::read_interfaces< template specfem::mesh::interface_container< specfem::element::medium_tag::acoustic, specfem::element::medium_tag::poroelastic> -specfem::IO::mesh::fortran::read_interfaces< +specfem::IO::mesh::impl::fortran::read_interfaces< specfem::element::medium_tag::acoustic, specfem::element::medium_tag::poroelastic>(const int num_interfaces, std::ifstream &stream, @@ -53,30 +53,30 @@ specfem::IO::mesh::fortran::read_interfaces< template specfem::mesh::interface_container< specfem::element::medium_tag::elastic, specfem::element::medium_tag::poroelastic> -specfem::IO::mesh::fortran::read_interfaces< +specfem::IO::mesh::impl::fortran::read_interfaces< specfem::element::medium_tag::elastic, specfem::element::medium_tag::poroelastic>(const int num_interfaces, std::ifstream &stream, const specfem::MPI::MPI *mpi); specfem::mesh::coupled_interfaces -specfem::IO::mesh::fortran::read_coupled_interfaces( +specfem::IO::mesh::impl::fortran::read_coupled_interfaces( std::ifstream &stream, const int num_interfaces_elastic_acoustic, const int num_interfaces_acoustic_poroelastic, const int num_interfaces_elastic_poroelastic, const specfem::MPI::MPI *mpi) { - auto elastic_acoustic = specfem::IO::mesh::fortran::read_interfaces< + auto elastic_acoustic = specfem::IO::mesh::impl::fortran::read_interfaces< specfem::element::medium_tag::elastic, specfem::element::medium_tag::acoustic>(num_interfaces_elastic_acoustic, stream, mpi); - auto acoustic_poroelastic = specfem::IO::mesh::fortran::read_interfaces< + auto acoustic_poroelastic = specfem::IO::mesh::impl::fortran::read_interfaces< specfem::element::medium_tag::acoustic, specfem::element::medium_tag::poroelastic>( num_interfaces_acoustic_poroelastic, stream, mpi); - auto elastic_poroelastic = specfem::IO::mesh::fortran::read_interfaces< + auto elastic_poroelastic = specfem::IO::mesh::impl::fortran::read_interfaces< specfem::element::medium_tag::elastic, specfem::element::medium_tag::poroelastic>( num_interfaces_elastic_poroelastic, stream, mpi); diff --git a/src/IO/mesh/impl/fortran/read_material_properties.cpp b/src/IO/mesh/impl/fortran/read_material_properties.cpp index 175e398f..68dc8877 100644 --- a/src/IO/mesh/impl/fortran/read_material_properties.cpp +++ b/src/IO/mesh/impl/fortran/read_material_properties.cpp @@ -1,4 +1,4 @@ -#include "IO/mesh/fortran/read_material_properties.hpp" +#include "IO/mesh/impl/fortran/read_material_properties.hpp" #include "IO/fortranio/interface.hpp" // #include "mesh/materials/materials.hpp" #include "mesh/materials/materials.tpp" @@ -175,7 +175,8 @@ void read_material_indices( } // namespace -specfem::mesh::materials specfem::IO::mesh::fortran::read_material_properties( +specfem::mesh::materials +specfem::IO::mesh::impl::fortran::read_material_properties( std::ifstream &stream, const int numat, const int nspec, const specfem::kokkos::HostView2d knods, const specfem::MPI::MPI *mpi) { diff --git a/src/IO/mesh/impl/fortran/read_mesh_database.cpp b/src/IO/mesh/impl/fortran/read_mesh_database.cpp index 8da06f7c..4c8c1b0c 100644 --- a/src/IO/mesh/impl/fortran/read_mesh_database.cpp +++ b/src/IO/mesh/impl/fortran/read_mesh_database.cpp @@ -1,4 +1,4 @@ -#include "IO/mesh/fortran/read_mesh_database.hpp" +#include "IO/mesh/impl/fortran/read_mesh_database.hpp" #include "IO/fortranio/interface.hpp" #include "kokkos_abstractions.h" // #include "mesh/IO/fortran/read_material_properties.hpp" @@ -9,7 +9,8 @@ #include #include -std::tuple specfem::IO::mesh::fortran::read_mesh_database_header( +std::tuple +specfem::IO::mesh::impl::fortran::read_mesh_database_header( std::ifstream &stream, const specfem::MPI::MPI *mpi) { // This subroutine reads header values of the database which are skipped std::string dummy_s; @@ -144,9 +145,8 @@ std::tuple specfem::IO::mesh::fortran::read_mesh_database_header( } specfem::kokkos::HostView2d -specfem::IO::mesh::fortran::read_coorg_elements(std::ifstream &stream, - const int npgeo, - const specfem::MPI::MPI *mpi) { +specfem::IO::mesh::impl::fortran::read_coorg_elements( + std::ifstream &stream, const int npgeo, const specfem::MPI::MPI *mpi) { int ipoin = 0; @@ -169,7 +169,7 @@ specfem::IO::mesh::fortran::read_coorg_elements(std::ifstream &stream, } std::tuple -specfem::IO::mesh::fortran::read_mesh_database_attenuation( +specfem::IO::mesh::impl::fortran::read_mesh_database_attenuation( std::ifstream &stream, const specfem::MPI::MPI *mpi) { int n_sls; diff --git a/src/IO/mesh/impl/fortran/read_properties.cpp b/src/IO/mesh/impl/fortran/read_properties.cpp index f9a2b496..70c51339 100644 --- a/src/IO/mesh/impl/fortran/read_properties.cpp +++ b/src/IO/mesh/impl/fortran/read_properties.cpp @@ -1,10 +1,9 @@ -#include "IO/mesh/fortran/read_properties.hpp" +#include "IO/mesh/impl/fortran/read_properties.hpp" #include "IO/fortranio/interface.hpp" #include "mesh/properties/properties.hpp" -specfem::mesh::properties -specfem::IO::mesh::fortran::read_properties(std::ifstream &stream, - const specfem::MPI::MPI *mpi) { +specfem::mesh::properties specfem::IO::mesh::impl::fortran::read_properties( + std::ifstream &stream, const specfem::MPI::MPI *mpi) { // --------------------------------------------------------------------- // reading mesh properties diff --git a/src/IO/mesh/read_mesh.cpp b/src/IO/mesh/read_mesh.cpp index 64be6559..d9c0322f 100644 --- a/src/IO/mesh/read_mesh.cpp +++ b/src/IO/mesh/read_mesh.cpp @@ -1,11 +1,11 @@ #include "IO/mesh/read_mesh.hpp" #include "IO/fortranio/interface.hpp" -#include "IO/mesh/fortran/read_boundaries.hpp" -#include "IO/mesh/fortran/read_elements.hpp" -#include "IO/mesh/fortran/read_interfaces.hpp" -#include "IO/mesh/fortran/read_material_properties.hpp" -#include "IO/mesh/fortran/read_mesh_database.hpp" -#include "IO/mesh/fortran/read_properties.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 "enumerations/specfem_enums.hpp" #include "kokkos_abstractions.h" #include "material/material.hpp" @@ -37,7 +37,8 @@ specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, try { std::tie(nspec, npgeo, nproc) = - specfem::IO::mesh::fortran::read_mesh_database_header(stream, mpi); + specfem::IO::mesh::impl::fortran::read_mesh_database_header(stream, + mpi); mesh.nspec = nspec; mesh.npgeo = npgeo; mesh.nproc = nproc; @@ -47,14 +48,16 @@ specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, // Mesh class to be populated from the database file. try { - mesh.control_nodes.coord = specfem::IO::mesh::fortran::read_coorg_elements( - stream, mesh.npgeo, mpi); + mesh.control_nodes.coord = + specfem::IO::mesh::impl::fortran::read_coorg_elements(stream, + mesh.npgeo, mpi); } catch (std::runtime_error &e) { throw; } try { - mesh.parameters = specfem::IO::mesh::fortran::read_properties(stream, mpi); + mesh.parameters = + specfem::IO::mesh::impl::fortran::read_properties(stream, mpi); } catch (std::runtime_error &e) { throw; } @@ -72,13 +75,14 @@ specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, try { auto [n_sls, attenuation_f0_reference, read_velocities_at_f0] = - specfem::IO::mesh::fortran::read_mesh_database_attenuation(stream, mpi); + specfem::IO::mesh::impl::fortran::read_mesh_database_attenuation(stream, + mpi); } catch (std::runtime_error &e) { throw; } try { - mesh.materials = specfem::IO::mesh::fortran::read_material_properties( + mesh.materials = specfem::IO::mesh::impl::fortran::read_material_properties( stream, mesh.parameters.numat, mesh.nspec, mesh.control_nodes.knods, mpi); } catch (std::runtime_error &e) { @@ -112,7 +116,7 @@ specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, specfem::IO::fortran_read_line(stream, &ninterfaces, &max_interface_size); try { - mesh.boundaries = specfem::IO::mesh::fortran::read_boundaries( + mesh.boundaries = specfem::IO::mesh::impl::fortran::read_boundaries( stream, mesh.parameters.nspec, mesh.parameters.nelemabs, mesh.parameters.nelem_acoustic_surface, mesh.parameters.nelem_acforcing, mesh.control_nodes.knods, mpi); @@ -146,7 +150,7 @@ specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, try { mesh.coupled_interfaces = - specfem::IO::mesh::fortran::read_coupled_interfaces( + specfem::IO::mesh::impl::fortran::read_coupled_interfaces( stream, mesh.parameters.num_fluid_solid_edges, mesh.parameters.num_fluid_poro_edges, mesh.parameters.num_solid_poro_edges, mpi); @@ -156,14 +160,14 @@ specfem::mesh::mesh specfem::IO::read_mesh(const std::string filename, try { mesh.tangential_nodes = - specfem::IO::mesh::fortran::read_tangential_elements( + specfem::IO::mesh::impl::fortran::read_tangential_elements( stream, mesh.parameters.nnodes_tangential_curve); } catch (std::runtime_error &e) { throw; } try { - mesh.axial_nodes = specfem::IO::mesh::fortran::read_axial_elements( + mesh.axial_nodes = specfem::IO::mesh::impl::fortran::read_axial_elements( stream, mesh.parameters.nelem_on_the_axis, mesh.nspec, mpi); } catch (std::runtime_error &e) { throw; diff --git a/src/mesh/mesh.cpp b/src/mesh/mesh.cpp index 5db2316d..c3466044 100644 --- a/src/mesh/mesh.cpp +++ b/src/mesh/mesh.cpp @@ -1,6 +1,4 @@ #include "mesh/mesh.hpp" -#include "IO/fortranio/interface.hpp" -#include "IO/mesh/fortran/read_mesh_database.hpp" #include "enumerations/specfem_enums.hpp" #include "kokkos_abstractions.h" #include "material/material.hpp" diff --git a/tests/unit-tests/mesh/mesh_tests.cpp b/tests/unit-tests/mesh/mesh_tests.cpp index cfa68335..662d2e57 100644 --- a/tests/unit-tests/mesh/mesh_tests.cpp +++ b/tests/unit-tests/mesh/mesh_tests.cpp @@ -1,6 +1,6 @@ #include "../Kokkos_Environment.hpp" #include "../MPI_environment.hpp" -#include "IO/mesh/fortran/read_mesh_database.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" @@ -108,7 +108,8 @@ TEST(MESH_TESTS, fortran_binary_reader_header) { stream.open(Test.databases.filenames[Test.configuration.processors - 1]); auto [nspec, npgeo, nproc] = - specfem::IO::mesh::fortran::read_mesh_database_header(stream, mpi); + specfem::IO::mesh::impl::fortran::read_mesh_database_header(stream, + mpi); stream.close(); std::cout << "nspec = " << nspec << std::endl; std::cout << "npgeo = " << npgeo << std::endl; From b28660fafee0e111fdc41994f73b6b5a35671e55 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Tue, 26 Nov 2024 20:58:29 -0500 Subject: [PATCH 52/53] Updated the docs to adjust the impl loocation --- docs/api/IO/Libraries/mesh/index.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/api/IO/Libraries/mesh/index.rst b/docs/api/IO/Libraries/mesh/index.rst index 5af0199c..8b798162 100644 --- a/docs/api/IO/Libraries/mesh/index.rst +++ b/docs/api/IO/Libraries/mesh/index.rst @@ -8,23 +8,23 @@ The below functions are helper functions for the Fortran binary mesh database reader. The functions are called in :cpp:func:`specfem::IO::read_mesh` in sequential order and faciliate the reading of the mesh database. -.. doxygenfunction:: specfem::IO::mesh::fortran::read_mesh_database_header +.. doxygenfunction:: specfem::IO::mesh::impl::fortran::read_mesh_database_header -.. doxygenfunction:: specfem::IO::mesh::fortran::read_coorg_elements +.. doxygenfunction:: specfem::IO::mesh::impl::fortran::read_coorg_elements -.. doxygenfunction:: specfem::IO::mesh::fortran::read_properties +.. doxygenfunction:: specfem::IO::mesh::impl::fortran::read_properties -.. doxygenfunction:: specfem::IO::mesh::fortran::read_mesh_database_attenuation +.. doxygenfunction:: specfem::IO::mesh::impl::fortran::read_mesh_database_attenuation -.. doxygenfunction:: specfem::IO::mesh::fortran::read_material_properties +.. doxygenfunction:: specfem::IO::mesh::impl::fortran::read_material_properties -.. doxygenfunction:: specfem::IO::mesh::fortran::read_boundaries +.. doxygenfunction:: specfem::IO::mesh::impl::fortran::read_boundaries -.. doxygenfunction:: specfem::IO::mesh::fortran::read_coupled_interfaces +.. doxygenfunction:: specfem::IO::mesh::impl::fortran::read_coupled_interfaces -.. doxygenfunction:: specfem::IO::mesh::fortran::read_tangential_elements +.. doxygenfunction:: specfem::IO::mesh::impl::fortran::read_tangential_elements -.. doxygenfunction:: specfem::IO::mesh::fortran::read_axial_elements +.. doxygenfunction:: specfem::IO::mesh::impl::fortran::read_axial_elements Finally, we add tags to the :cpp:struct:`specfem::mesh::mesh` using the :cpp:struct:`specfem::mesh::tags` struct. The description of which can be found From 8af4bf93eb224e826017cbe6d778619e3639532e Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Wed, 27 Nov 2024 10:23:38 -0500 Subject: [PATCH 53/53] Fixed merge issues with IO restructure --- tests/unit-tests/assembly/test_fixture/test_fixture.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/unit-tests/assembly/test_fixture/test_fixture.cpp b/tests/unit-tests/assembly/test_fixture/test_fixture.cpp index d331e9e2..be66c194 100644 --- a/tests/unit-tests/assembly/test_fixture/test_fixture.cpp +++ b/tests/unit-tests/assembly/test_fixture/test_fixture.cpp @@ -1,4 +1,7 @@ #include "test_fixture.hpp" +#include "IO/mesh/read_mesh.hpp" +#include "IO/receivers/read_receivers.hpp" +#include "IO/sources/read_sources.hpp" #include "test_fixture.tpp" // ------------------------------------------------------------------------ @@ -31,12 +34,12 @@ ASSEMBLY::ASSEMBLY() { for (auto &Test : Tests) { const auto [database_file, sources_file, stations_file] = Test.get_databases(); - specfem::mesh::mesh mesh(database_file, mpi); + specfem::mesh::mesh mesh = specfem::IO::read_mesh(database_file, mpi); - const auto [sources, t0] = specfem::sources::read_sources( + const auto [sources, t0] = specfem::IO::read_sources( sources_file, 0, 0, 0, specfem::simulation::type::forward); - const auto receivers = specfem::receivers::read_receivers(stations_file, 0); + const auto receivers = specfem::IO::read_receivers(stations_file, 0); std::vector seismogram_types = { specfem::enums::seismogram::type::displacement