From 1dd3963dabea42d332f5c7e94a6a631ef376a9da Mon Sep 17 00:00:00 2001 From: Emily Bourne Date: Tue, 10 Dec 2024 12:08:45 +0100 Subject: [PATCH] Remove template argument added in !779 Remove template argument added in !779. Following !785 this argument is no longer necessary See merge request gysela-developpers/gyselalibxx!800 -------------------------------------------- --- .../geometryRTheta/diocotron/diocotron.cpp | 4 +--- .../vortex_merger/vortex_merger.cpp | 4 +--- .../advection/advection_domain.hpp | 22 ++++++++++--------- .../advection_2d_rp/advection_all_tests.cpp | 6 ++--- .../advection_selected_test.cpp | 20 +++++------------ .../advection_field_gtest.cpp | 4 +--- 6 files changed, 23 insertions(+), 37 deletions(-) diff --git a/simulations/geometryRTheta/diocotron/diocotron.cpp b/simulations/geometryRTheta/diocotron/diocotron.cpp index a9221f1b..1e56387b 100644 --- a/simulations/geometryRTheta/diocotron/diocotron.cpp +++ b/simulations/geometryRTheta/diocotron/diocotron.cpp @@ -52,7 +52,6 @@ using PoissonSolver = PolarSplineFEMPoissonLikeSolver< using DiscreteMappingBuilder = DiscreteToCartesianBuilder; using LogicalToPhysicalMapping = CircularToCartesian; -using PhysicalToLogicalMapping = CartesianToCircular; namespace fs = std::filesystem; @@ -116,7 +115,6 @@ int main(int argc, char** argv) ddc::PeriodicExtrapolationRule()); const LogicalToPhysicalMapping to_physical_mapping; - const PhysicalToLogicalMapping to_logical_mapping; DiscreteMappingBuilder const discrete_mapping_builder( Kokkos::DefaultHostExecutionSpace(), to_physical_mapping, @@ -166,7 +164,7 @@ int main(int argc, char** argv) PreallocatableSplineInterpolatorRTheta interpolator(builder, spline_evaluator); - AdvectionPhysicalDomain advection_domain(to_physical_mapping, to_logical_mapping); + AdvectionPhysicalDomain advection_domain(to_physical_mapping); SplineFootFinder find_feet( time_stepper, diff --git a/simulations/geometryRTheta/vortex_merger/vortex_merger.cpp b/simulations/geometryRTheta/vortex_merger/vortex_merger.cpp index 19e32b0f..c5493231 100644 --- a/simulations/geometryRTheta/vortex_merger/vortex_merger.cpp +++ b/simulations/geometryRTheta/vortex_merger/vortex_merger.cpp @@ -52,7 +52,6 @@ using PoissonSolver = PolarSplineFEMPoissonLikeSolver< using DiscreteMappingBuilder = DiscreteToCartesianBuilder; using LogicalToPhysicalMapping = CircularToCartesian; -using PhysicalToLogicalMapping = CartesianToCircular; } // end namespace @@ -111,7 +110,6 @@ int main(int argc, char** argv) ddc::PeriodicExtrapolationRule()); const LogicalToPhysicalMapping to_physical_mapping; - const PhysicalToLogicalMapping to_logical_mapping; DiscreteMappingBuilder const discrete_mapping_builder( Kokkos::DefaultHostExecutionSpace(), to_physical_mapping, @@ -141,7 +139,7 @@ int main(int argc, char** argv) PreallocatableSplineInterpolatorRTheta interpolator(builder, spline_evaluator); - AdvectionPhysicalDomain advection_domain(to_physical_mapping, to_logical_mapping); + AdvectionPhysicalDomain advection_domain(to_physical_mapping); SplineFootFinder find_feet( time_stepper, diff --git a/src/geometryRTheta/advection/advection_domain.hpp b/src/geometryRTheta/advection/advection_domain.hpp index 2f46202f..140f31a8 100644 --- a/src/geometryRTheta/advection/advection_domain.hpp +++ b/src/geometryRTheta/advection/advection_domain.hpp @@ -62,9 +62,11 @@ class AdvectionDomain * * */ -template +template class AdvectionPhysicalDomain : public AdvectionDomain { + static_assert(is_analytical_mapping_v); + public: /** * @brief The first dimension in the advection domain. @@ -80,8 +82,11 @@ class AdvectionPhysicalDomain : public AdvectionDomain using CoordXY_adv = Coord; private: - LogicalToPhysicalMapping const& m_to_cartesian_mapping; - PhysicalToLogicalMapping const& m_to_curvilinear_mapping; + using PhysicalToLogicalMapping = inverse_mapping_t; + +private: + LogicalToPhysicalMapping m_to_cartesian_mapping; + PhysicalToLogicalMapping m_to_curvilinear_mapping; public: /** @@ -89,15 +94,12 @@ class AdvectionPhysicalDomain : public AdvectionDomain * * @param[in] to_physical_mapping * The mapping from the logical domain to the physical domain. - * @param[in] to_logical_mapping - * The mapping from the physical domain to the logical domain. */ - AdvectionPhysicalDomain( - LogicalToPhysicalMapping const& to_physical_mapping, - PhysicalToLogicalMapping const& to_logical_mapping) + AdvectionPhysicalDomain(LogicalToPhysicalMapping const& to_physical_mapping) : m_to_cartesian_mapping(to_physical_mapping) - , m_to_curvilinear_mapping(to_logical_mapping) {}; - ~AdvectionPhysicalDomain() {}; + , m_to_curvilinear_mapping(to_physical_mapping.get_inverse_mapping()) + { + } /** * @brief Advect the characteristic feet. diff --git a/tests/geometryRTheta/advection_2d_rp/advection_all_tests.cpp b/tests/geometryRTheta/advection_2d_rp/advection_all_tests.cpp index 93976bd0..f3164d51 100644 --- a/tests/geometryRTheta/advection_2d_rp/advection_all_tests.cpp +++ b/tests/geometryRTheta/advection_2d_rp/advection_all_tests.cpp @@ -331,10 +331,8 @@ int main(int argc, char** argv) spline_evaluator_extrapol); DiscreteToCartesian const discrete_czarny_map = discrete_czarny_map_builder(); - AdvectionPhysicalDomain const - physical_circular_mapping(from_circ_map, to_circ_map); - AdvectionPhysicalDomain const - physical_czarny_mapping(from_czarny_map, to_czarny_map); + AdvectionPhysicalDomain const physical_circular_mapping(from_circ_map); + AdvectionPhysicalDomain const physical_czarny_mapping(from_czarny_map); AdvectionPseudoCartesianDomain const pseudo_cartesian_czarny_mapping( from_czarny_map); diff --git a/tests/geometryRTheta/advection_2d_rp/advection_selected_test.cpp b/tests/geometryRTheta/advection_2d_rp/advection_selected_test.cpp index d9c12a84..bae31dab 100644 --- a/tests/geometryRTheta/advection_2d_rp/advection_selected_test.cpp +++ b/tests/geometryRTheta/advection_2d_rp/advection_selected_test.cpp @@ -42,19 +42,11 @@ namespace fs = std::filesystem; namespace { #if defined(CIRCULAR_MAPPING_PHYSICAL) -using X_adv = typename AdvectionPhysicalDomain< - CircularToCartesian, - CartesianToCircular>::X_adv; -using Y_adv = typename AdvectionPhysicalDomain< - CircularToCartesian, - CartesianToCircular>::Y_adv; +using X_adv = typename AdvectionPhysicalDomain>::X_adv; +using Y_adv = typename AdvectionPhysicalDomain>::Y_adv; #elif defined(CZARNY_MAPPING_PHYSICAL) -using X_adv = typename AdvectionPhysicalDomain< - CzarnyToCartesian, - CartesianToCzarny>::X_adv; -using Y_adv = typename AdvectionPhysicalDomain< - CzarnyToCartesian, - CartesianToCzarny>::Y_adv; +using X_adv = typename AdvectionPhysicalDomain>::X_adv; +using Y_adv = typename AdvectionPhysicalDomain>::Y_adv; #elif defined(CZARNY_MAPPING_PSEUDO_CARTESIAN) using X_adv = typename AdvectionPseudoCartesianDomain>::X_adv; @@ -175,7 +167,7 @@ int main(int argc, char** argv) CircularToCartesian analytical_mapping; CircularToCartesian to_physical_mapping; CartesianToCircular to_logical_mapping; - AdvectionPhysicalDomain advection_domain(analytical_mapping, to_logical_mapping); + AdvectionPhysicalDomain advection_domain(analytical_mapping); std::string const mapping_name = "CIRCULAR"; std::string const adv_domain_name = "PHYSICAL"; key += "circular_physical"; @@ -188,7 +180,7 @@ int main(int argc, char** argv) CzarnyToCartesian analytical_mapping(czarny_e, czarny_epsilon); CzarnyToCartesian to_physical_mapping(czarny_e, czarny_epsilon); CartesianToCzarny to_logical_mapping(czarny_e, czarny_epsilon); - AdvectionPhysicalDomain advection_domain(analytical_mapping, to_logical_mapping); + AdvectionPhysicalDomain advection_domain(analytical_mapping); std::string const mapping_name = "CZARNY"; std::string const adv_domain_name = "PHYSICAL"; key += "czarny_physical"; diff --git a/tests/geometryRTheta/advection_field_rp/advection_field_gtest.cpp b/tests/geometryRTheta/advection_field_rp/advection_field_gtest.cpp index fd649c9c..13dda707 100644 --- a/tests/geometryRTheta/advection_field_rp/advection_field_gtest.cpp +++ b/tests/geometryRTheta/advection_field_rp/advection_field_gtest.cpp @@ -45,7 +45,6 @@ namespace { using DiscreteMappingBuilder = DiscreteToCartesianBuilder; using LogicalToPhysicalMapping = CircularToCartesian; -using PhysicalToLogicalMapping = CartesianToCircular; namespace fs = std::filesystem; @@ -116,7 +115,6 @@ TEST(AdvectionFieldRThetaComputation, TestAdvectionFieldFinder) // --- Define the to_physical_mapping. ------------------------------------------------------------------------ const LogicalToPhysicalMapping to_physical_mapping; - const PhysicalToLogicalMapping to_logical_mapping; DiscreteMappingBuilder const discrete_mapping_builder( Kokkos::DefaultHostExecutionSpace(), to_physical_mapping, @@ -137,7 +135,7 @@ TEST(AdvectionFieldRThetaComputation, TestAdvectionFieldFinder) PreallocatableSplineInterpolatorRTheta interpolator(builder, spline_evaluator); - AdvectionPhysicalDomain advection_idx_range(to_physical_mapping, to_logical_mapping); + AdvectionPhysicalDomain advection_idx_range(to_physical_mapping); RK3>, host_t>,