diff --git a/src/Evolution/Systems/Cce/Callbacks/DumpBondiSachsOnWorldtube.hpp b/src/Evolution/Systems/Cce/Callbacks/DumpBondiSachsOnWorldtube.hpp index 274defea4be1..37ab0f06aaf1 100644 --- a/src/Evolution/Systems/Cce/Callbacks/DumpBondiSachsOnWorldtube.hpp +++ b/src/Evolution/Systems/Cce/Callbacks/DumpBondiSachsOnWorldtube.hpp @@ -24,13 +24,13 @@ #include "IO/Observer/Actions/GetLockPointer.hpp" #include "IO/Observer/ObserverComponent.hpp" #include "IO/Observer/ReductionActions.hpp" +#include "NumericalAlgorithms/SphericalHarmonics/AngularOrdering.hpp" #include "NumericalAlgorithms/SpinWeightedSphericalHarmonics/SwshCoefficients.hpp" #include "NumericalAlgorithms/SpinWeightedSphericalHarmonics/SwshCollocation.hpp" #include "Parallel/GlobalCache.hpp" #include "Parallel/Invoke.hpp" #include "ParallelAlgorithms/Interpolation/InterpolationTargetDetail.hpp" #include "ParallelAlgorithms/Interpolation/Protocols/PostInterpolationCallback.hpp" -#include "ParallelAlgorithms/Interpolation/Targets/AngularOrdering.hpp" #include "ParallelAlgorithms/Interpolation/Targets/Sphere.hpp" #include "PointwiseFunctions/GeneralRelativity/Tags.hpp" #include "Utilities/ConstantExpressions.hpp" @@ -133,7 +133,7 @@ struct DumpBondiSachsOnWorldtube Parallel::get>(cache); const auto& filename_prefix = Parallel::get(cache); - if (sphere.angular_ordering != intrp::AngularOrdering::Cce) { + if (sphere.angular_ordering != ylm::AngularOrdering::Cce) { ERROR( "To use the DumpBondiSachsOnWorldtube post interpolation callback, " "the angular ordering of the Spheres must be Cce, not " diff --git a/src/Executables/CMakeLists.txt b/src/Executables/CMakeLists.txt index c9595dfc0839..d7cfdbdfd98c 100644 --- a/src/Executables/CMakeLists.txt +++ b/src/Executables/CMakeLists.txt @@ -10,3 +10,4 @@ add_subdirectory(ExportCoordinates) add_subdirectory(ParallelInfo) add_subdirectory(ReduceCceWorldtube) add_subdirectory(TimeStepperSummary) +add_subdirectory(WriteCceWorldtubeCoordsToFile) diff --git a/src/Executables/WriteCceWorldtubeCoordsToFile/CMakeLists.txt b/src/Executables/WriteCceWorldtubeCoordsToFile/CMakeLists.txt new file mode 100644 index 000000000000..33c49662dcc2 --- /dev/null +++ b/src/Executables/WriteCceWorldtubeCoordsToFile/CMakeLists.txt @@ -0,0 +1,24 @@ +# Distributed under the MIT License. +# See LICENSE.txt for details. + +set(EXECUTABLE WriteCceWorldtubeCoordsToFile) + +add_spectre_executable( + ${EXECUTABLE} + EXCLUDE_FROM_ALL + WriteCceWorldtubeCoordsToFile.cpp + ) + +target_link_libraries( + ${EXECUTABLE} + PRIVATE + Boost::boost + Boost::program_options + Printf + SphericalHarmonics + SphericalHarmonicsIO + ) + +if(BUILD_TESTING) + add_dependencies(test-executables ${EXECUTABLE}) +endif() diff --git a/src/Executables/WriteCceWorldtubeCoordsToFile/WriteCceWorldtubeCoordsToFile.cpp b/src/Executables/WriteCceWorldtubeCoordsToFile/WriteCceWorldtubeCoordsToFile.cpp new file mode 100644 index 000000000000..3cd327f3193f --- /dev/null +++ b/src/Executables/WriteCceWorldtubeCoordsToFile/WriteCceWorldtubeCoordsToFile.cpp @@ -0,0 +1,79 @@ +// Distributed under the MIT License. +// See LICENSE.txt for details. + +#include +#include +#include +#include +#include +#include + +#include "NumericalAlgorithms/SphericalHarmonics/AngularOrdering.hpp" +#include "NumericalAlgorithms/SphericalHarmonics/IO/StrahlkorperCoordsToTextFile.hpp" +#include "Parallel/Printf/Printf.hpp" + +// Charm looks for this function but since we build without a main function or +// main module we just have it be empty +extern "C" void CkRegisterMainModule(void) {} + +/* + * This executable is used for writing the collocation points of a CCE + * Strahlkorper to a text file. This is useful for other NR codes so they can + * write data to certain points and we do the necessary transformations. + */ +int main(int argc, char** argv) { + boost::program_options::options_description desc( + "Program for writing the collocation points (coordinates) of a worldtube " + "sphere that SpECTRE CCE is able to read and interpret to a " + "file.\nDetails about the output file:\n" + " * There are no header or comment lines\n" + " * Each point is written to a new line of the output file\n" + " * The delimiter for the x, y, z components of each point is a space\n" + " * The points are written in scientific notation\n" + " * The sphere is centered on the origin (0, 0, 0)"); + desc.add_options()("help,h", "show this help message")( + "radius,r", boost::program_options::value()->required(), + "Radius of the worltube.")( + "lmax,L", boost::program_options::value()->required(), + "The spherical harmonic L of the surface. The surface will have (L + 1) " + "* (2L + 1) total points")( + "output_file,o", boost::program_options::value()->required(), + "Output filename for the points. No extension will be added.")( + "force,f", boost::program_options::bool_switch(), + "Overwrite the output file if it already exists"); + + boost::program_options::variables_map vars; + + boost::program_options::store( + boost::program_options::command_line_parser(argc, argv) + .options(desc) + .run(), + vars); + + if (vars.contains("help")) { + Parallel::printf("%s\n", desc); + return 0; + } + + for (const auto& option : {"radius", "lmax", "output_file"}) { + if (not vars.contains(option)) { + Parallel::printf("Missing option: %s\n\n%s", option, desc); + return 1; + } + } + + const double radius = vars["radius"].as(); + const size_t l_max = vars["lmax"].as(); + const std::array center{0.0, 0.0, 0.0}; + const std::string output_file = vars["output_file"].as(); + const bool overwrite = vars["force"].as(); + + try { + ylm::write_strahlkorper_coords_to_text_file( + radius, l_max, center, output_file, ylm::AngularOrdering::Cce, + overwrite); + } catch (const std::exception& exception) { + Parallel::printf("%s\n", exception.what()); + return 1; + } +} diff --git a/src/ParallelAlgorithms/Interpolation/Targets/AngularOrdering.cpp b/src/NumericalAlgorithms/SphericalHarmonics/AngularOrdering.cpp similarity index 73% rename from src/ParallelAlgorithms/Interpolation/Targets/AngularOrdering.cpp rename to src/NumericalAlgorithms/SphericalHarmonics/AngularOrdering.cpp index 43bdcd99000b..d2830855487e 100644 --- a/src/ParallelAlgorithms/Interpolation/Targets/AngularOrdering.cpp +++ b/src/NumericalAlgorithms/SphericalHarmonics/AngularOrdering.cpp @@ -1,7 +1,7 @@ // Distributed under the MIT License. // See LICENSE.txt for details. -#include "ParallelAlgorithms/Interpolation/Targets/AngularOrdering.hpp" +#include "NumericalAlgorithms/SphericalHarmonics/AngularOrdering.hpp" #include @@ -9,7 +9,7 @@ #include "Options/ParseOptions.hpp" #include "Utilities/ErrorHandling/Error.hpp" -namespace intrp { +namespace ylm { std::ostream& operator<<(std::ostream& os, const AngularOrdering ordering) { switch (ordering) { case AngularOrdering::Strahlkorper: @@ -20,17 +20,17 @@ std::ostream& operator<<(std::ostream& os, const AngularOrdering ordering) { ERROR("Unknown AngularOrdering type"); } } -} // namespace intrp +} // namespace ylm template <> -intrp::AngularOrdering -Options::create_from_yaml::create( +ylm::AngularOrdering +Options::create_from_yaml::create( const Options::Option& options) { const auto ordering = options.parse_as(); if (ordering == "Strahlkorper") { - return intrp::AngularOrdering::Strahlkorper; + return ylm::AngularOrdering::Strahlkorper; } else if (ordering == "Cce") { - return intrp::AngularOrdering::Cce; + return ylm::AngularOrdering::Cce; } PARSE_ERROR(options.context(), "AngularOrdering must be 'Strahlkorper' or 'Cce'"); diff --git a/src/ParallelAlgorithms/Interpolation/Targets/AngularOrdering.hpp b/src/NumericalAlgorithms/SphericalHarmonics/AngularOrdering.hpp similarity index 75% rename from src/ParallelAlgorithms/Interpolation/Targets/AngularOrdering.hpp rename to src/NumericalAlgorithms/SphericalHarmonics/AngularOrdering.hpp index 4aec3f245137..280a463c7362 100644 --- a/src/ParallelAlgorithms/Interpolation/Targets/AngularOrdering.hpp +++ b/src/NumericalAlgorithms/SphericalHarmonics/AngularOrdering.hpp @@ -13,7 +13,7 @@ struct create_from_yaml; } // namespace Options /// \endcond -namespace intrp { +namespace ylm { /*! * \brief Label for the ordering of spherical harmonic points on a sphere * @@ -23,17 +23,17 @@ namespace intrp { */ enum class AngularOrdering { Strahlkorper, Cce }; std::ostream& operator<<(std::ostream& os, AngularOrdering ordering); -} // namespace intrp +} // namespace ylm template <> -struct Options::create_from_yaml { +struct Options::create_from_yaml { template - static intrp::AngularOrdering create(const Options::Option& options) { + static ylm::AngularOrdering create(const Options::Option& options) { return create(options); } }; template <> -intrp::AngularOrdering -Options::create_from_yaml::create( +ylm::AngularOrdering +Options::create_from_yaml::create( const Options::Option& options); diff --git a/src/NumericalAlgorithms/SphericalHarmonics/CMakeLists.txt b/src/NumericalAlgorithms/SphericalHarmonics/CMakeLists.txt index 57092c1acc19..4e7aa07b5fe0 100644 --- a/src/NumericalAlgorithms/SphericalHarmonics/CMakeLists.txt +++ b/src/NumericalAlgorithms/SphericalHarmonics/CMakeLists.txt @@ -8,6 +8,7 @@ add_spectre_library(${LIBRARY}) spectre_target_sources( ${LIBRARY} PRIVATE + AngularOrdering.cpp ChangeCenterOfStrahlkorper.cpp RealSphericalHarmonics.cpp SpherepackIterator.cpp @@ -23,6 +24,7 @@ spectre_target_headers( ${LIBRARY} INCLUDE_DIRECTORY ${CMAKE_SOURCE_DIR}/src HEADERS + AngularOrdering.hpp ChangeCenterOfStrahlkorper.hpp RealSphericalHarmonics.hpp SpherepackIterator.hpp diff --git a/src/NumericalAlgorithms/SphericalHarmonics/IO/CMakeLists.txt b/src/NumericalAlgorithms/SphericalHarmonics/IO/CMakeLists.txt index 1626a8bbe941..cb0eb63d5a30 100644 --- a/src/NumericalAlgorithms/SphericalHarmonics/IO/CMakeLists.txt +++ b/src/NumericalAlgorithms/SphericalHarmonics/IO/CMakeLists.txt @@ -10,6 +10,7 @@ spectre_target_sources( PRIVATE FillYlmLegendAndData.cpp ReadSurfaceYlm.cpp + StrahlkorperCoordsToTextFile.cpp ) spectre_target_headers( @@ -18,6 +19,7 @@ spectre_target_headers( HEADERS FillYlmLegendAndData.hpp ReadSurfaceYlm.hpp + StrahlkorperCoordsToTextFile.hpp ) target_link_libraries( diff --git a/src/NumericalAlgorithms/SphericalHarmonics/IO/StrahlkorperCoordsToTextFile.cpp b/src/NumericalAlgorithms/SphericalHarmonics/IO/StrahlkorperCoordsToTextFile.cpp new file mode 100644 index 000000000000..13e92f7d772d --- /dev/null +++ b/src/NumericalAlgorithms/SphericalHarmonics/IO/StrahlkorperCoordsToTextFile.cpp @@ -0,0 +1,95 @@ +// Distributed under the MIT License. +// See LICENSE.txt for details. + +#include "NumericalAlgorithms/SphericalHarmonics/IO/StrahlkorperCoordsToTextFile.hpp" + +#include +#include +#include +#include +#include + +#include "DataStructures/DataVector.hpp" +#include "DataStructures/Tensor/Tensor.hpp" +#include "DataStructures/Transpose.hpp" +#include "NumericalAlgorithms/SphericalHarmonics/AngularOrdering.hpp" +#include "NumericalAlgorithms/SphericalHarmonics/Strahlkorper.hpp" +#include "NumericalAlgorithms/SphericalHarmonics/StrahlkorperFunctions.hpp" +#include "Utilities/ErrorHandling/Error.hpp" +#include "Utilities/FileSystem.hpp" +#include "Utilities/GenerateInstantiations.hpp" + +namespace Frame { +struct Inertial; +struct Distorted; +struct Grid; +} // namespace Frame + +namespace ylm { +template +void write_strahlkorper_coords_to_text_file( + const Strahlkorper& strahlkorper, + const std::string& output_file_name, const AngularOrdering ordering, + const bool overwrite_file) { + if (not overwrite_file and + file_system::check_if_file_exists(output_file_name)) { + ERROR_NO_TRACE("The output file " << output_file_name + << " already exists."); + } + + tnsr::I cartesian_coords = + ylm::cartesian_coords(strahlkorper); + + // Cce expects coordinates in a different order than a typical Strahlkorper + if (ordering == AngularOrdering::Cce) { + const auto physical_extents = + strahlkorper.ylm_spherepack().physical_extents(); + auto transposed_coords = + tnsr::I(get<0>(cartesian_coords).size()); + for (size_t i = 0; i < 3; ++i) { + transpose(make_not_null(&transposed_coords.get(i)), + cartesian_coords.get(i), physical_extents[0], + physical_extents[1]); + } + + cartesian_coords = std::move(transposed_coords); + } + + std::ofstream output_file(output_file_name); + output_file << std::fixed + << std::setprecision(std::numeric_limits::digits10 + 4) + << std::scientific; + + const size_t num_points = get<0>(cartesian_coords).size(); + for (size_t i = 0; i < num_points; i++) { + output_file << get<0>(cartesian_coords)[i] << " " + << get<1>(cartesian_coords)[i] << " " + << get<2>(cartesian_coords)[i] << std::endl; + } +} + +void write_strahlkorper_coords_to_text_file(const double radius, + const size_t l_max, + const std::array& center, + const std::string& output_file_name, + const AngularOrdering ordering, + const bool overwrite_file) { + const Strahlkorper strahlkorper{l_max, radius, center}; + write_strahlkorper_coords_to_text_file(strahlkorper, output_file_name, + ordering, overwrite_file); +} + +#define FRAME(data) BOOST_PP_TUPLE_ELEM(0, data) + +#define INSTANTIATE(_, data) \ + template void write_strahlkorper_coords_to_text_file( \ + const Strahlkorper& strahlkorper, \ + const std::string& output_file_name, const AngularOrdering ordering, \ + const bool overwrite_file); + +GENERATE_INSTANTIATIONS(INSTANTIATE, + (Frame::Grid, Frame::Distorted, Frame::Inertial)) + +#undef INSTANTIATE +#undef FRAME +} // namespace ylm diff --git a/src/NumericalAlgorithms/SphericalHarmonics/IO/StrahlkorperCoordsToTextFile.hpp b/src/NumericalAlgorithms/SphericalHarmonics/IO/StrahlkorperCoordsToTextFile.hpp new file mode 100644 index 000000000000..e91b40b48508 --- /dev/null +++ b/src/NumericalAlgorithms/SphericalHarmonics/IO/StrahlkorperCoordsToTextFile.hpp @@ -0,0 +1,49 @@ +// Distributed under the MIT License. +// See LICENSE.txt for details. + +#pragma once + +#include +#include +#include + +#include "NumericalAlgorithms/SphericalHarmonics/AngularOrdering.hpp" +#include "NumericalAlgorithms/SphericalHarmonics/Strahlkorper.hpp" + +namespace ylm { +/// @{ +/*! + * \brief Writes the collocation points of a `ylm::Strahlkorper` to an output + * text file. + * + * \details The ordering of the points can be either the typical + * `ylm::Spherepack` ordering or CCE ordering that works with libsharp. Also, an + * error will occur if the output file already exists, but the output file can + * be overwritten with the \p overwrite_file option. + * + * The second overload will construct a spherical `ylm::Strahlkorper` with the + * given \p radius, \p l_max, and \p center. + * + * The output file format will be as follows with no comment or header lines, + * a space as the delimiter, and decimals written in scientific notation: + * + * ``` + * x0 y0 z0 + * x1 y1 z1 + * x2 y2 z2 + * ... + * ``` + */ +template +void write_strahlkorper_coords_to_text_file( + const Strahlkorper& strahlkorper, + const std::string& output_file_name, AngularOrdering ordering, + bool overwrite_file = false); + +void write_strahlkorper_coords_to_text_file(double radius, size_t l_max, + const std::array& center, + const std::string& output_file_name, + AngularOrdering ordering, + bool overwrite_file = false); +/// @} +} // namespace ylm diff --git a/src/NumericalAlgorithms/SphericalHarmonics/Python/Strahlkorper.cpp b/src/NumericalAlgorithms/SphericalHarmonics/Python/Strahlkorper.cpp index 165340e0e315..7f2812c52ca6 100644 --- a/src/NumericalAlgorithms/SphericalHarmonics/Python/Strahlkorper.cpp +++ b/src/NumericalAlgorithms/SphericalHarmonics/Python/Strahlkorper.cpp @@ -12,8 +12,10 @@ #include "DataStructures/DataVector.hpp" #include "DataStructures/ModalVector.hpp" #include "DataStructures/Tensor/Tensor.hpp" +#include "NumericalAlgorithms/SphericalHarmonics/AngularOrdering.hpp" #include "NumericalAlgorithms/SphericalHarmonics/IO/FillYlmLegendAndData.hpp" #include "NumericalAlgorithms/SphericalHarmonics/IO/ReadSurfaceYlm.hpp" +#include "NumericalAlgorithms/SphericalHarmonics/IO/StrahlkorperCoordsToTextFile.hpp" #include "NumericalAlgorithms/SphericalHarmonics/Strahlkorper.hpp" namespace py = pybind11; @@ -79,5 +81,20 @@ void bind_strahlkorper(pybind11::module& m) { // NOLINT &ylm::read_surface_ylm_single_time, py::arg("file_name"), py::arg("surface_subfile_name"), py::arg("time"), py::arg("relative_epsilon"), py::arg("check_frame")); + py::enum_(m, "AngularOrdering") + .value("Strahlkorper", ylm::AngularOrdering::Strahlkorper) + .value("Cce", ylm::AngularOrdering::Cce); + m.def( + "write_sphere_of_points_to_text_file", + [](const double radius, const size_t l_max, + const std::array& center, + const std::string& output_file_name, + const ylm::AngularOrdering ordering, const bool overwrite_file) { + ylm::write_strahlkorper_coords_to_text_file( + radius, l_max, center, output_file_name, ordering, overwrite_file); + }, + py::arg("radius"), py::arg("l_max"), py::arg("center"), + py::arg("output_file_name"), py::arg("ordering"), + py::arg("overwrite_file") = false); } } // namespace ylm::py_bindings diff --git a/src/ParallelAlgorithms/Interpolation/Targets/CMakeLists.txt b/src/ParallelAlgorithms/Interpolation/Targets/CMakeLists.txt index 2614650d1bb4..246c4f381a3c 100644 --- a/src/ParallelAlgorithms/Interpolation/Targets/CMakeLists.txt +++ b/src/ParallelAlgorithms/Interpolation/Targets/CMakeLists.txt @@ -4,7 +4,6 @@ spectre_target_sources( ${LIBRARY} PRIVATE - AngularOrdering.cpp KerrHorizon.cpp LineSegment.cpp SpecifiedPoints.cpp @@ -16,7 +15,6 @@ spectre_target_headers( ${LIBRARY} INCLUDE_DIRECTORY ${CMAKE_SOURCE_DIR}/src HEADERS - AngularOrdering.hpp KerrHorizon.hpp LineSegment.hpp SpecifiedPoints.hpp diff --git a/src/ParallelAlgorithms/Interpolation/Targets/KerrHorizon.cpp b/src/ParallelAlgorithms/Interpolation/Targets/KerrHorizon.cpp index 88a66fc44602..87128d4656e1 100644 --- a/src/ParallelAlgorithms/Interpolation/Targets/KerrHorizon.cpp +++ b/src/ParallelAlgorithms/Interpolation/Targets/KerrHorizon.cpp @@ -12,7 +12,7 @@ namespace intrp::OptionHolders { KerrHorizon::KerrHorizon(size_t l_max_in, std::array center_in, double mass_in, std::array dimensionless_spin_in, - const intrp::AngularOrdering angular_ordering_in, + const ylm::AngularOrdering angular_ordering_in, const Options::Context& context) : l_max(l_max_in), center(center_in), diff --git a/src/ParallelAlgorithms/Interpolation/Targets/KerrHorizon.hpp b/src/ParallelAlgorithms/Interpolation/Targets/KerrHorizon.hpp index 56af9cf263f9..a4a5cf2bbf87 100644 --- a/src/ParallelAlgorithms/Interpolation/Targets/KerrHorizon.hpp +++ b/src/ParallelAlgorithms/Interpolation/Targets/KerrHorizon.hpp @@ -10,6 +10,7 @@ #include "DataStructures/DataBox/Tag.hpp" #include "DataStructures/Tensor/TypeAliases.hpp" #include "DataStructures/Transpose.hpp" +#include "NumericalAlgorithms/SphericalHarmonics/AngularOrdering.hpp" #include "NumericalAlgorithms/SphericalHarmonics/Spherepack.hpp" #include "NumericalAlgorithms/SphericalHarmonics/Strahlkorper.hpp" #include "NumericalAlgorithms/SphericalHarmonics/Tags.hpp" @@ -18,7 +19,6 @@ #include "ParallelAlgorithms/Initialization/MutateAssign.hpp" #include "ParallelAlgorithms/Interpolation/Protocols/ComputeTargetPoints.hpp" #include "ParallelAlgorithms/Interpolation/Tags.hpp" -#include "ParallelAlgorithms/Interpolation/Targets/AngularOrdering.hpp" #include "PointwiseFunctions/AnalyticSolutions/GeneralRelativity/KerrHorizon.hpp" #include "Utilities/PrettyType.hpp" #include "Utilities/ProtocolHelpers.hpp" @@ -73,7 +73,7 @@ struct KerrHorizon { "Dimensionless spin of black hole"}; }; struct AngularOrdering { - using type = intrp::AngularOrdering; + using type = ylm::AngularOrdering; static constexpr Options::String help = { "Chooses theta,phi ordering in 2d array"}; }; @@ -85,7 +85,7 @@ struct KerrHorizon { KerrHorizon(size_t l_max_in, std::array center_in, double mass_in, std::array dimensionless_spin_in, - intrp::AngularOrdering angular_ordering_in, + ylm::AngularOrdering angular_ordering_in, const Options::Context& context = {}); KerrHorizon() = default; @@ -102,7 +102,7 @@ struct KerrHorizon { std::array center{}; double mass{}; std::array dimensionless_spin{}; - intrp::AngularOrdering angular_ordering; + ylm::AngularOrdering angular_ordering; }; bool operator==(const KerrHorizon& lhs, const KerrHorizon& rhs); @@ -193,7 +193,7 @@ struct KerrHorizon : tt::ConformsTo { const tmpl::type_& /*meta*/) { const auto& kerr_horizon = db::get>(box); - if (kerr_horizon.angular_ordering == intrp::AngularOrdering::Strahlkorper) { + if (kerr_horizon.angular_ordering == ylm::AngularOrdering::Strahlkorper) { return db::get>(box); } else { const auto& strahlkorper = db::get>(box); diff --git a/src/ParallelAlgorithms/Interpolation/Targets/Sphere.cpp b/src/ParallelAlgorithms/Interpolation/Targets/Sphere.cpp index f5e9fc720f55..aa8da8901de9 100644 --- a/src/ParallelAlgorithms/Interpolation/Targets/Sphere.cpp +++ b/src/ParallelAlgorithms/Interpolation/Targets/Sphere.cpp @@ -49,7 +49,7 @@ struct SphereVisitor { Sphere::Sphere(const size_t l_max_in, const std::array center_in, const typename Radius::type& radius_in, - const intrp::AngularOrdering angular_ordering_in, + const ylm::AngularOrdering angular_ordering_in, const Options::Context& context) : l_max(l_max_in), center(center_in), diff --git a/src/ParallelAlgorithms/Interpolation/Targets/Sphere.hpp b/src/ParallelAlgorithms/Interpolation/Targets/Sphere.hpp index 61dc21774e20..2d1ce488a30a 100644 --- a/src/ParallelAlgorithms/Interpolation/Targets/Sphere.hpp +++ b/src/ParallelAlgorithms/Interpolation/Targets/Sphere.hpp @@ -13,6 +13,7 @@ #include "DataStructures/DataBox/DataBox.hpp" #include "DataStructures/Transpose.hpp" +#include "NumericalAlgorithms/SphericalHarmonics/AngularOrdering.hpp" #include "NumericalAlgorithms/SphericalHarmonics/Strahlkorper.hpp" #include "NumericalAlgorithms/SphericalHarmonics/Tags.hpp" #include "Options/String.hpp" @@ -20,7 +21,6 @@ #include "ParallelAlgorithms/Initialization/MutateAssign.hpp" #include "ParallelAlgorithms/Interpolation/Protocols/ComputeTargetPoints.hpp" #include "ParallelAlgorithms/Interpolation/Tags.hpp" -#include "ParallelAlgorithms/Interpolation/Targets/AngularOrdering.hpp" #include "Utilities/Algorithm.hpp" #include "Utilities/ErrorHandling/Assert.hpp" #include "Utilities/PrettyType.hpp" @@ -70,7 +70,7 @@ struct Sphere { static constexpr Options::String help = {"Radius of the sphere(s)"}; }; struct AngularOrdering { - using type = intrp::AngularOrdering; + using type = ylm::AngularOrdering; static constexpr Options::String help = { "Chooses theta,phi ordering in 2d array"}; }; @@ -79,7 +79,7 @@ struct Sphere { "An arbitrary number of spherical surface."}; Sphere(const size_t l_max_in, const std::array center_in, const typename Radius::type& radius_in, - intrp::AngularOrdering angular_ordering_in, + ylm::AngularOrdering angular_ordering_in, const Options::Context& context = {}); Sphere() = default; @@ -90,7 +90,7 @@ struct Sphere { size_t l_max{0}; std::array center{std::numeric_limits::signaling_NaN()}; std::set radii; - intrp::AngularOrdering angular_ordering; + ylm::AngularOrdering angular_ordering; }; bool operator==(const Sphere& lhs, const Sphere& rhs); @@ -180,7 +180,7 @@ struct Sphere : tt::ConformsTo { // If the angular ordering is Strahlkorper then we don't have to do // anything to the coords because they are already in the right order - if (sphere.angular_ordering == intrp::AngularOrdering::Cce) { + if (sphere.angular_ordering == ylm::AngularOrdering::Cce) { const auto physical_extents = strahlkorper.ylm_spherepack().physical_extents(); auto transposed_coords = diff --git a/tests/Unit/Evolution/Systems/Cce/Test_DumpBondiSachsOnWorldtube.cpp b/tests/Unit/Evolution/Systems/Cce/Test_DumpBondiSachsOnWorldtube.cpp index bc8cbe9988cf..ac71fb3189e2 100644 --- a/tests/Unit/Evolution/Systems/Cce/Test_DumpBondiSachsOnWorldtube.cpp +++ b/tests/Unit/Evolution/Systems/Cce/Test_DumpBondiSachsOnWorldtube.cpp @@ -136,7 +136,7 @@ void test(const std::string& filename_prefix, num_points_single_sphere); // Options for Sphere - const intrp::AngularOrdering angular_ordering = intrp::AngularOrdering::Cce; + const ylm::AngularOrdering angular_ordering = ylm::AngularOrdering::Cce; const std::array center = {{0.05, 0.06, 0.07}}; intrp::OptionHolders::Sphere sphere_opts(l_max, center, radii, angular_ordering); @@ -157,8 +157,8 @@ void test(const std::string& filename_prefix, // Check the error CHECK_THROWS_WITH( ([&box, &radii, ¢er, &filename_prefix]() { - const intrp::AngularOrdering local_angular_ordering = - intrp::AngularOrdering::Strahlkorper; + const ylm::AngularOrdering local_angular_ordering = + ylm::AngularOrdering::Strahlkorper; intrp::OptionHolders::Sphere local_sphere_opts(l_max, center, radii, local_angular_ordering); Parallel::GlobalCache local_cache{ diff --git a/tests/Unit/Helpers/ParallelAlgorithms/Interpolation/InterpolateOnElementTestHelpers.hpp b/tests/Unit/Helpers/ParallelAlgorithms/Interpolation/InterpolateOnElementTestHelpers.hpp index 40c2dd3cfaaa..a6e5575d5b24 100644 --- a/tests/Unit/Helpers/ParallelAlgorithms/Interpolation/InterpolateOnElementTestHelpers.hpp +++ b/tests/Unit/Helpers/ParallelAlgorithms/Interpolation/InterpolateOnElementTestHelpers.hpp @@ -349,7 +349,7 @@ void test_interpolate_on_element( tuples::get>(init_tuple) = intrp::OptionHolders::Sphere{ell, std::array{x_center, 0.0, 0.0}, std::vector{1.0, 2.5}, - intrp::AngularOrdering::Cce}; + ylm::AngularOrdering::Cce}; } // Emplace target component. diff --git a/tests/Unit/NumericalAlgorithms/Interpolation/Test_SendGhWorldtubeData.cpp b/tests/Unit/NumericalAlgorithms/Interpolation/Test_SendGhWorldtubeData.cpp index 66a6bdba7b5e..172b292d8334 100644 --- a/tests/Unit/NumericalAlgorithms/Interpolation/Test_SendGhWorldtubeData.cpp +++ b/tests/Unit/NumericalAlgorithms/Interpolation/Test_SendGhWorldtubeData.cpp @@ -134,7 +134,7 @@ void test_callback_function(const gsl::not_null gen) { tmpl::list<::gr::Tags::SpacetimeMetric, gh::Tags::Phi, gh::Tags::Pi>; using target = typename test_metavariables::Target; - const intrp::AngularOrdering angular_ordering = intrp::AngularOrdering::Cce; + const ylm::AngularOrdering angular_ordering = ylm::AngularOrdering::Cce; const double radius = 3.6; const std::array center = {{0.05, 0.06, 0.07}}; // Options for Sphere diff --git a/tests/Unit/NumericalAlgorithms/SphericalHarmonics/CMakeLists.txt b/tests/Unit/NumericalAlgorithms/SphericalHarmonics/CMakeLists.txt index e71c9522abfc..e105ddfe3737 100644 --- a/tests/Unit/NumericalAlgorithms/SphericalHarmonics/CMakeLists.txt +++ b/tests/Unit/NumericalAlgorithms/SphericalHarmonics/CMakeLists.txt @@ -4,6 +4,7 @@ set(LIBRARY "Test_SphericalHarmonics") set(LIBRARY_SOURCES + Test_AngularOrdering.cpp Test_ChangeCenterOfStrahlkorper.cpp Test_RealSphericalHarmonics.cpp Test_Spherepack.cpp diff --git a/tests/Unit/NumericalAlgorithms/SphericalHarmonics/IO/CMakeLists.txt b/tests/Unit/NumericalAlgorithms/SphericalHarmonics/IO/CMakeLists.txt index f6fefd3e0eda..4ff6910e9e33 100644 --- a/tests/Unit/NumericalAlgorithms/SphericalHarmonics/IO/CMakeLists.txt +++ b/tests/Unit/NumericalAlgorithms/SphericalHarmonics/IO/CMakeLists.txt @@ -6,6 +6,7 @@ set(LIBRARY "Test_SphericalHarmonicsIO") set(LIBRARY_SOURCES Test_FillYlmLegendAndData.cpp Test_ReadSurfaceYlm.cpp + Test_StrahlkorperCoordsToTextFile.cpp ) add_test_library(${LIBRARY} "${LIBRARY_SOURCES}") diff --git a/tests/Unit/NumericalAlgorithms/SphericalHarmonics/IO/Test_StrahlkorperCoordsToTextFile.cpp b/tests/Unit/NumericalAlgorithms/SphericalHarmonics/IO/Test_StrahlkorperCoordsToTextFile.cpp new file mode 100644 index 000000000000..fa99d96dfc8c --- /dev/null +++ b/tests/Unit/NumericalAlgorithms/SphericalHarmonics/IO/Test_StrahlkorperCoordsToTextFile.cpp @@ -0,0 +1,124 @@ +// Distributed under the MIT License. +// See LICENSE.txt for details. + +#include "Framework/TestingFramework.hpp" + +#include +#include +#include +#include +#include + +#include "DataStructures/DataVector.hpp" +#include "DataStructures/Tensor/Tensor.hpp" +#include "DataStructures/Transpose.hpp" +#include "NumericalAlgorithms/SphericalHarmonics/AngularOrdering.hpp" +#include "NumericalAlgorithms/SphericalHarmonics/IO/StrahlkorperCoordsToTextFile.hpp" +#include "NumericalAlgorithms/SphericalHarmonics/Strahlkorper.hpp" +#include "NumericalAlgorithms/SphericalHarmonics/StrahlkorperFunctions.hpp" +#include "Utilities/FileSystem.hpp" + +namespace { +std::array read_text_file(const std::string& filename) { + std::array, 3> vector_result{}; + std::ifstream file(filename); + if (not file.is_open()) { + ERROR("Unable to open text file " << filename); + } + std::string line{}; + double value = 0.0; + + while (std::getline(file, line)) { + std::stringstream ss(line); + for (size_t i = 0; i < 3; i++) { + ss >> value; + gsl::at(vector_result, i).push_back(value); + } + } + + const size_t num_points = vector_result[0].size(); + + std::array result{ + DataVector{num_points}, DataVector{num_points}, DataVector{num_points}}; + + for (size_t i = 0; i < 3; i++) { + for (size_t j = 0; j < num_points; j++) { + gsl::at(result, i)[j] = gsl::at(vector_result, i)[j]; + } + } + + return result; +} + +void test(const ylm::AngularOrdering ordering) { + const std::string filename{"StrahlkorperCoords.txt"}; + const double radius = 1.5; + const size_t l_max = 16; + const std::array center{-0.1, -0.2, -0.3}; + const ylm::Strahlkorper strahlkorper{l_max, radius, center}; + + tnsr::I expected_points = + ylm::cartesian_coords(strahlkorper); + if (ordering == ylm::AngularOrdering::Cce) { + const auto physical_extents = + strahlkorper.ylm_spherepack().physical_extents(); + auto transpose_expected_points = + tnsr::I(get<0>(expected_points).size()); + for (size_t i = 0; i < 3; ++i) { + transpose(make_not_null(&transpose_expected_points.get(i)), + expected_points.get(i), physical_extents[0], + physical_extents[1]); + } + + expected_points = std::move(transpose_expected_points); + } + + if (file_system::check_if_file_exists(filename)) { + file_system::rm(filename, true); + } + + { + ylm::write_strahlkorper_coords_to_text_file(strahlkorper, filename, + ordering); + + std::array points_from_file = read_text_file(filename); + + for (size_t i = 0; i < 3; i++) { + CHECK(expected_points.get(i) == gsl::at(points_from_file, i)); + } + + CHECK_THROWS_WITH((ylm::write_strahlkorper_coords_to_text_file( + strahlkorper, filename, ordering)), + Catch::Matchers::ContainsSubstring( + "The output file " + filename + " already exists")); + + ylm::write_strahlkorper_coords_to_text_file(strahlkorper, filename, + ordering, true); + + for (size_t i = 0; i < 3; i++) { + CHECK(expected_points.get(i) == gsl::at(points_from_file, i)); + } + } + + { + ylm::write_strahlkorper_coords_to_text_file(radius, l_max, center, filename, + ordering, true); + + const std::array points_from_file = read_text_file(filename); + + for (size_t i = 0; i < 3; i++) { + CHECK(expected_points.get(i) == gsl::at(points_from_file, i)); + } + } + + if (file_system::check_if_file_exists(filename)) { + file_system::rm(filename, true); + } +} +} // namespace + +SPECTRE_TEST_CASE("Unit.SphericalHarmonics.StrahlkorperCoordsToTextFile", + "[NumericalAlgorithms][Unit]") { + test(ylm::AngularOrdering::Strahlkorper); + test(ylm::AngularOrdering::Cce); +} diff --git a/tests/Unit/NumericalAlgorithms/SphericalHarmonics/Python/Test_Strahlkorper.py b/tests/Unit/NumericalAlgorithms/SphericalHarmonics/Python/Test_Strahlkorper.py index 80550ae1ea80..700fe1c85204 100644 --- a/tests/Unit/NumericalAlgorithms/SphericalHarmonics/Python/Test_Strahlkorper.py +++ b/tests/Unit/NumericalAlgorithms/SphericalHarmonics/Python/Test_Strahlkorper.py @@ -11,10 +11,12 @@ import spectre.Informer as spectre_informer import spectre.IO.H5 as spectre_h5 from spectre.SphericalHarmonics import ( + AngularOrdering, Strahlkorper, cartesian_coords, read_surface_ylm, read_surface_ylm_single_time, + write_sphere_of_points_to_text_file, ylm_legend_and_data, ) @@ -26,6 +28,9 @@ def setUp(self): "NumericalAlgorithms/Strahlkorper/Python", ) self.filename = os.path.join(self.test_dir, "Strahlkorper.h5") + self.text_filename = os.path.join( + self.test_dir, "PyStrahlkorperCoords.txt" + ) shutil.rmtree(self.test_dir, ignore_errors=True) os.makedirs(self.test_dir, exist_ok=True) @@ -80,6 +85,44 @@ def test_strahlkorper(self): strahlkorper, ) + l_max = 4 + print("hello") + # First write with wrong l_max + write_sphere_of_points_to_text_file( + radius=1.2, + l_max=l_max - 1, + center=[-0.1, -0.2, -0.3], + output_file_name=self.text_filename, + ordering=AngularOrdering.Cce, + ) + # Test that if overwrite_file = False (the default) an exception is + # raised + self.assertRaises( + RuntimeError, + write_sphere_of_points_to_text_file, + radius=1.2, + l_max=l_max - 1, + center=[-0.1, -0.2, -0.3], + output_file_name=self.text_filename, + ordering=AngularOrdering.Cce, + ) + # Finally write the correct l_max so we can check that overwrite_file + # works + write_sphere_of_points_to_text_file( + radius=1.2, + l_max=l_max, + center=[-0.1, -0.2, -0.3], + output_file_name=self.text_filename, + ordering=AngularOrdering.Cce, + overwrite_file=True, + ) + + with open(self.text_filename, "r") as text_file: + # Physical size of ylm::Spherepack + num_points = (l_max + 1) * (2 * l_max + 1) + all_lines = text_file.readlines() + self.assertEqual(num_points, len(all_lines)) + if __name__ == "__main__": unittest.main(verbosity=2) diff --git a/tests/Unit/ParallelAlgorithms/Interpolation/Test_AngularOrdering.cpp b/tests/Unit/NumericalAlgorithms/SphericalHarmonics/Test_AngularOrdering.cpp similarity index 71% rename from tests/Unit/ParallelAlgorithms/Interpolation/Test_AngularOrdering.cpp rename to tests/Unit/NumericalAlgorithms/SphericalHarmonics/Test_AngularOrdering.cpp index b4a0c0fef157..bc70313f0718 100644 --- a/tests/Unit/ParallelAlgorithms/Interpolation/Test_AngularOrdering.cpp +++ b/tests/Unit/NumericalAlgorithms/SphericalHarmonics/Test_AngularOrdering.cpp @@ -6,12 +6,12 @@ #include #include "Framework/TestCreation.hpp" -#include "ParallelAlgorithms/Interpolation/Targets/AngularOrdering.hpp" +#include "NumericalAlgorithms/SphericalHarmonics/AngularOrdering.hpp" #include "Utilities/GetOutput.hpp" -namespace intrp { -SPECTRE_TEST_CASE( - "Unit.NumericalAlgorithms.InterpolationTarget.AngularOrdering", "[Unit]") { +namespace ylm { +SPECTRE_TEST_CASE("Unit.NumericalAlgorithms.SphericalHarmonics.AngularOrdering", + "[Unit]") { CHECK(get_output(AngularOrdering::Cce) == "Cce"); CHECK(get_output(AngularOrdering::Strahlkorper) == "Strahlkorper"); CHECK(TestHelpers::test_creation("Cce") == @@ -19,4 +19,4 @@ SPECTRE_TEST_CASE( CHECK(TestHelpers::test_creation("Strahlkorper") == AngularOrdering::Strahlkorper); } -} // namespace intrp +} // namespace ylm diff --git a/tests/Unit/ParallelAlgorithms/Interpolation/CMakeLists.txt b/tests/Unit/ParallelAlgorithms/Interpolation/CMakeLists.txt index df1c6f47d88a..c52bf76a5c49 100644 --- a/tests/Unit/ParallelAlgorithms/Interpolation/CMakeLists.txt +++ b/tests/Unit/ParallelAlgorithms/Interpolation/CMakeLists.txt @@ -5,7 +5,6 @@ set(LIBRARY "Test_ParallelInterpolation") set(LIBRARY_SOURCES Test_AddTemporalIdsToInterpolationTarget.cpp - Test_AngularOrdering.cpp Test_CleanUpInterpolator.cpp Test_ComputeDestVars.cpp Test_ElementReceiveInterpPoints.cpp diff --git a/tests/Unit/ParallelAlgorithms/Interpolation/Test_InterpolationTargetKerrHorizon.cpp b/tests/Unit/ParallelAlgorithms/Interpolation/Test_InterpolationTargetKerrHorizon.cpp index 789e0751437b..155021493f34 100644 --- a/tests/Unit/ParallelAlgorithms/Interpolation/Test_InterpolationTargetKerrHorizon.cpp +++ b/tests/Unit/ParallelAlgorithms/Interpolation/Test_InterpolationTargetKerrHorizon.cpp @@ -18,9 +18,9 @@ #include "Framework/TestCreation.hpp" #include "Helpers/DataStructures/DataBox/TestHelpers.hpp" #include "Helpers/ParallelAlgorithms/Interpolation/InterpolationTargetTestHelpers.hpp" +#include "NumericalAlgorithms/SphericalHarmonics/AngularOrdering.hpp" #include "Parallel/Phase.hpp" #include "ParallelAlgorithms/Interpolation/Protocols/InterpolationTargetTag.hpp" -#include "ParallelAlgorithms/Interpolation/Targets/AngularOrdering.hpp" #include "ParallelAlgorithms/Interpolation/Targets/KerrHorizon.hpp" #include "PointwiseFunctions/GeneralRelativity/Tags.hpp" #include "Time/Tags/TimeStepId.hpp" @@ -57,7 +57,7 @@ struct KerrHorizonTargetTag template void test_interpolation_target_kerr_horizon( - const intrp::AngularOrdering angular_ordering) { + const ylm::AngularOrdering angular_ordering) { // Constants used in this test. // We use l_max=18 to get enough points that the surface is // represented to roundoff error; for smaller l_max we would need to @@ -125,7 +125,7 @@ void test_interpolation_target_kerr_horizon( const double two_pi_over_n_phi = 2.0 * M_PI / n_phi; tnsr::I points(n_theta * n_phi); size_t s = 0; - if (angular_ordering == intrp::AngularOrdering::Strahlkorper) { + if (angular_ordering == ylm::AngularOrdering::Strahlkorper) { for (size_t i_phi = 0; i_phi < n_phi; ++i_phi) { const double phi = two_pi_over_n_phi * i_phi; for (size_t i_theta = 0; i_theta < n_theta; ++i_theta) { @@ -166,14 +166,14 @@ SPECTRE_TEST_CASE("Unit.NumericalAlgorithms.InterpolationTarget.KerrHorizon", "[Unit]") { domain::creators::register_derived_with_charm(); test_interpolation_target_kerr_horizon< - InterpTargetTestHelpers::ValidPoints::All>(intrp::AngularOrdering::Cce); + InterpTargetTestHelpers::ValidPoints::All>(ylm::AngularOrdering::Cce); test_interpolation_target_kerr_horizon< InterpTargetTestHelpers::ValidPoints::All>( - intrp::AngularOrdering::Strahlkorper); + ylm::AngularOrdering::Strahlkorper); test_interpolation_target_kerr_horizon< InterpTargetTestHelpers::ValidPoints::Some>( - intrp::AngularOrdering::Strahlkorper); + ylm::AngularOrdering::Strahlkorper); test_interpolation_target_kerr_horizon< InterpTargetTestHelpers::ValidPoints::None>( - intrp::AngularOrdering::Strahlkorper); + ylm::AngularOrdering::Strahlkorper); } diff --git a/tests/Unit/ParallelAlgorithms/Interpolation/Test_InterpolationTargetSphere.cpp b/tests/Unit/ParallelAlgorithms/Interpolation/Test_InterpolationTargetSphere.cpp index ff8c2c4c32ad..a8d44d775016 100644 --- a/tests/Unit/ParallelAlgorithms/Interpolation/Test_InterpolationTargetSphere.cpp +++ b/tests/Unit/ParallelAlgorithms/Interpolation/Test_InterpolationTargetSphere.cpp @@ -23,9 +23,9 @@ #include "Framework/TestHelpers.hpp" #include "Helpers/DataStructures/DataBox/TestHelpers.hpp" #include "Helpers/ParallelAlgorithms/Interpolation/InterpolationTargetTestHelpers.hpp" +#include "NumericalAlgorithms/SphericalHarmonics/AngularOrdering.hpp" #include "Parallel/Phase.hpp" #include "ParallelAlgorithms/Interpolation/Protocols/InterpolationTargetTag.hpp" -#include "ParallelAlgorithms/Interpolation/Targets/AngularOrdering.hpp" #include "ParallelAlgorithms/Interpolation/Targets/Sphere.hpp" #include "PointwiseFunctions/GeneralRelativity/Tags.hpp" #include "Time/Tags/TimeStepId.hpp" @@ -60,7 +60,7 @@ struct SphereTag : tt::ConformsTo { template void test_interpolation_target_sphere( const gsl::not_null generator, const size_t number_of_spheres, - const intrp::AngularOrdering angular_ordering) { + const ylm::AngularOrdering angular_ordering) { // Keep bounds a bit inside than inner and outer radius of shell below so the // offset-sphere is still within the domain std::uniform_real_distribution dist{1.2, 4.5}; @@ -147,7 +147,7 @@ void test_interpolation_target_sphere( }(); const double two_pi_over_n_phi = 2.0 * M_PI / n_phi; - if (angular_ordering == intrp::AngularOrdering::Strahlkorper) { + if (angular_ordering == ylm::AngularOrdering::Strahlkorper) { for (size_t i_phi = 0; i_phi < n_phi; ++i_phi) { const double phi = two_pi_over_n_phi * i_phi; for (size_t i_theta = 0; i_theta < n_theta; ++i_theta) { @@ -222,12 +222,12 @@ SPECTRE_TEST_CASE("Unit.NumericalAlgorithms.InterpolationTarget.Sphere", MAKE_GENERATOR(gen); for (size_t num_spheres : {1_st, 2_st, 3_st}) { test_interpolation_target_sphere( - make_not_null(&gen), num_spheres, intrp::AngularOrdering::Cce); + make_not_null(&gen), num_spheres, ylm::AngularOrdering::Cce); test_interpolation_target_sphere( - make_not_null(&gen), num_spheres, intrp::AngularOrdering::Strahlkorper); + make_not_null(&gen), num_spheres, ylm::AngularOrdering::Strahlkorper); test_interpolation_target_sphere< InterpTargetTestHelpers::ValidPoints::None>( - make_not_null(&gen), num_spheres, intrp::AngularOrdering::Strahlkorper); + make_not_null(&gen), num_spheres, ylm::AngularOrdering::Strahlkorper); // ValidPoints::Some is not tested as the radii of the // interpolation targets are set randomly so it is difficult to // arrange that only a subset of the target points are diff --git a/tests/Unit/ParallelAlgorithms/Interpolation/Test_ObserveTimeSeriesAndSurfaceData.cpp b/tests/Unit/ParallelAlgorithms/Interpolation/Test_ObserveTimeSeriesAndSurfaceData.cpp index 8909a4e5483a..0fad73061e8c 100644 --- a/tests/Unit/ParallelAlgorithms/Interpolation/Test_ObserveTimeSeriesAndSurfaceData.cpp +++ b/tests/Unit/ParallelAlgorithms/Interpolation/Test_ObserveTimeSeriesAndSurfaceData.cpp @@ -45,6 +45,7 @@ #include "NumericalAlgorithms/Spectral/Mesh.hpp" #include "NumericalAlgorithms/Spectral/Quadrature.hpp" #include "NumericalAlgorithms/Spectral/Spectral.hpp" +#include "NumericalAlgorithms/SphericalHarmonics/AngularOrdering.hpp" #include "NumericalAlgorithms/SphericalHarmonics/IO/FillYlmLegendAndData.hpp" #include "NumericalAlgorithms/SphericalHarmonics/Spherepack.hpp" #include "NumericalAlgorithms/SphericalHarmonics/SpherepackIterator.hpp" @@ -65,7 +66,6 @@ #include "ParallelAlgorithms/Interpolation/Callbacks/ObserveTimeSeriesOnSurface.hpp" #include "ParallelAlgorithms/Interpolation/Protocols/InterpolationTargetTag.hpp" #include "ParallelAlgorithms/Interpolation/Protocols/PostInterpolationCallback.hpp" -#include "ParallelAlgorithms/Interpolation/Targets/AngularOrdering.hpp" #include "ParallelAlgorithms/Interpolation/Targets/KerrHorizon.hpp" #include "PointwiseFunctions/AnalyticSolutions/GeneralRelativity/Minkowski.hpp" #include "PointwiseFunctions/GeneralRelativity/Surfaces/Tags.hpp" @@ -585,22 +585,22 @@ void run_test() { // Options for all InterpolationTargets. intrp::OptionHolders::KerrHorizon kerr_horizon_opts_A( 10, {{0.0, 0.0, 0.0}}, 1.0, {{0.0, 0.0, 0.0}}, - intrp::AngularOrdering::Strahlkorper); + ylm::AngularOrdering::Strahlkorper); intrp::OptionHolders::KerrHorizon kerr_horizon_opts_B( 10, {{0.0, 0.0, 0.0}}, 2.0, {{0.0, 0.0, 0.0}}, - intrp::AngularOrdering::Strahlkorper); + ylm::AngularOrdering::Strahlkorper); intrp::OptionHolders::KerrHorizon kerr_horizon_opts_C( 10, {{0.0, 0.0, 0.0}}, 1.5, {{0.0, 0.0, 0.0}}, - intrp::AngularOrdering::Strahlkorper); + ylm::AngularOrdering::Strahlkorper); intrp::OptionHolders::KerrHorizon kerr_horizon_opts_D( 10, {{0.01, 0.02, 0.03}}, 1.4, {{0.0, 0.0, 0.0}}, - intrp::AngularOrdering::Strahlkorper); + ylm::AngularOrdering::Strahlkorper); // Surface for testing Ylm coefficients are written correctly. Using a // non-zero spin because with zero spin, Y_{00} is the only term with a // non-zero coefficient intrp::OptionHolders::KerrHorizon kerr_horizon_opts_E( 3, {{0.04, 0.05, 0.06}}, 1.1, {{1.0, 0.0, 0.0}}, - intrp::AngularOrdering::Strahlkorper); + ylm::AngularOrdering::Strahlkorper); const auto domain_creator = make_sphere(); tuples::TaggedTuple< observers::Tags::ReductionFileName, observers::Tags::SurfaceFileName, diff --git a/tests/Unit/ParallelAlgorithms/Interpolation/Test_ParallelInterpolator.cpp b/tests/Unit/ParallelAlgorithms/Interpolation/Test_ParallelInterpolator.cpp index 76529ed47e2f..b0558954a59a 100644 --- a/tests/Unit/ParallelAlgorithms/Interpolation/Test_ParallelInterpolator.cpp +++ b/tests/Unit/ParallelAlgorithms/Interpolation/Test_ParallelInterpolator.cpp @@ -32,6 +32,7 @@ #include "NumericalAlgorithms/Spectral/LogicalCoordinates.hpp" #include "NumericalAlgorithms/Spectral/Mesh.hpp" #include "NumericalAlgorithms/Spectral/Quadrature.hpp" +#include "NumericalAlgorithms/SphericalHarmonics/AngularOrdering.hpp" #include "Parallel/ParallelComponentHelpers.hpp" #include "Parallel/Phase.hpp" #include "Parallel/PhaseDependentActionList.hpp" @@ -47,7 +48,6 @@ #include "ParallelAlgorithms/Interpolation/Protocols/ComputeVarsToInterpolate.hpp" #include "ParallelAlgorithms/Interpolation/Protocols/InterpolationTargetTag.hpp" #include "ParallelAlgorithms/Interpolation/Protocols/PostInterpolationCallback.hpp" -#include "ParallelAlgorithms/Interpolation/Targets/AngularOrdering.hpp" #include "ParallelAlgorithms/Interpolation/Targets/KerrHorizon.hpp" #include "ParallelAlgorithms/Interpolation/Targets/LineSegment.hpp" #include "Time/Slab.hpp" @@ -310,7 +310,7 @@ SPECTRE_TEST_CASE("Unit.NumericalAlgorithms.Interpolator.Integration", {{1.1, 1.1, 1.1}}, {{2.5, 2.5, 2.5}}, 17); intrp::OptionHolders::KerrHorizon kerr_horizon_opts_C( 10, {{0.0, 0.0, 0.0}}, 1.0, {{0.0, 0.0, 0.0}}, - intrp::AngularOrdering::Strahlkorper); + ylm::AngularOrdering::Strahlkorper); const auto domain_creator = domain::creators::Sphere( 0.9, 4.9, domain::creators::Sphere::Excision{}, 1_st, 5_st, false); tuples::TaggedTuple<