diff --git a/simulations/geometryRTheta/diocotron/diocotron.cpp b/simulations/geometryRTheta/diocotron/diocotron.cpp index 5377980ac..1025b5365 100644 --- a/simulations/geometryRTheta/diocotron/diocotron.cpp +++ b/simulations/geometryRTheta/diocotron/diocotron.cpp @@ -28,8 +28,8 @@ #include "paraconfpp.hpp" #include "params.yaml.hpp" #include "pdi_out.yml.hpp" -#include "poisson_rhs_function.hpp" -#include "polarpoissonsolver.hpp" +#include "poisson_like_rhs_function.hpp" +#include "polarpoissonlikesolver.hpp" #include "quadrature.hpp" #include "rk3.hpp" #include "rk4.hpp" @@ -42,7 +42,7 @@ namespace { -using PoissonSolver = PolarSplineFEMPoissonSolver; +using PoissonSolver = PolarSplineFEMPoissonLikeSolver; using DiscreteMapping = DiscreteToCartesian; using Mapping = CircularToCartesian; @@ -126,11 +126,11 @@ int main(int argc, char** argv) ddc::init_discrete_space(r_knots); ddc::init_discrete_space(p_knots); - ddc::init_discrete_space(SplineInterpPointsR::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsP::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsR::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsP::get_sampling()); - IDomainR const interpolation_domain_R(SplineInterpPointsR::get_domain()); - IDomainP const interpolation_domain_P(SplineInterpPointsP::get_domain()); + IDomainR const interpolation_domain_R(SplineInterpPointsR::get_domain()); + IDomainP const interpolation_domain_P(SplineInterpPointsP::get_domain()); IDomainRP const grid(interpolation_domain_R, interpolation_domain_P); FieldRP coords(grid); @@ -310,7 +310,7 @@ int main(int argc, char** argv) DFieldRP phi_eq(grid); Spline2D rho_coef_eq(dom_bsplinesRP); builder(rho_coef_eq.span_view(), rho_eq.span_cview()); - PoissonRHSFunction poisson_rhs_eq(rho_coef_eq, spline_evaluator); + PoissonLikeRHSFunction poisson_rhs_eq(rho_coef_eq, spline_evaluator); poisson_solver(poisson_rhs_eq, coords.span_cview(), phi_eq.span_view()); diff --git a/simulations/geometryRTheta/vortex_merger/vortex_merger.cpp b/simulations/geometryRTheta/vortex_merger/vortex_merger.cpp index af68495eb..6e3adebe5 100644 --- a/simulations/geometryRTheta/vortex_merger/vortex_merger.cpp +++ b/simulations/geometryRTheta/vortex_merger/vortex_merger.cpp @@ -28,8 +28,8 @@ #include "paraconfpp.hpp" #include "params.yaml.hpp" #include "pdi_out.yml.hpp" -#include "poisson_rhs_function.hpp" -#include "polarpoissonsolver.hpp" +#include "poisson_like_rhs_function.hpp" +#include "polarpoissonlikesolver.hpp" #include "quadrature.hpp" #include "rk3.hpp" #include "rk4.hpp" @@ -43,7 +43,7 @@ namespace { -using PoissonSolver = PolarSplineFEMPoissonSolver; +using PoissonSolver = PolarSplineFEMPoissonLikeSolver; using DiscreteMapping = DiscreteToCartesian; using CircularMapping = CircularToCartesian; @@ -121,11 +121,11 @@ int main(int argc, char** argv) ddc::init_discrete_space(r_knots); ddc::init_discrete_space(p_knots); - ddc::init_discrete_space(SplineInterpPointsR::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsP::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsR::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsP::get_sampling()); - IDomainR const interpolation_domain_R(SplineInterpPointsR::get_domain()); - IDomainP const interpolation_domain_P(SplineInterpPointsP::get_domain()); + IDomainR const interpolation_domain_R(SplineInterpPointsR::get_domain()); + IDomainP const interpolation_domain_P(SplineInterpPointsP::get_domain()); IDomainRP const grid(interpolation_domain_R, interpolation_domain_P); FieldRP coords(grid); @@ -275,7 +275,7 @@ int main(int argc, char** argv) DFieldRP phi_eq(grid); Spline2D rho_coef_eq(dom_bsplinesRP); builder(rho_coef_eq.span_view(), rho_eq.span_cview()); - PoissonRHSFunction poisson_rhs_eq(rho_coef_eq.span_view(), spline_evaluator); + PoissonLikeRHSFunction poisson_rhs_eq(rho_coef_eq.span_view(), spline_evaluator); poisson_solver(poisson_rhs_eq, coords.span_cview(), phi_eq.span_view()); diff --git a/simulations/geometryXVx/bump_on_tail/bumpontail_fem_uniform.cpp b/simulations/geometryXVx/bump_on_tail/bumpontail_fem_uniform.cpp index 7a516e447..122a405bc 100644 --- a/simulations/geometryXVx/bump_on_tail/bumpontail_fem_uniform.cpp +++ b/simulations/geometryXVx/bump_on_tail/bumpontail_fem_uniform.cpp @@ -88,10 +88,10 @@ int main(int argc, char** argv) ddc::init_discrete_space(vx_min, vx_max, vx_ncells); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); - IDomainX interpolation_domain_x(SplineInterpPointsX::get_domain()); - IDomainVx interpolation_domain_vx(SplineInterpPointsVx::get_domain()); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); + IDomainX interpolation_domain_x(SplineInterpPointsX::get_domain()); + IDomainVx interpolation_domain_vx(SplineInterpPointsVx::get_domain()); IDomainXVx meshXVx(interpolation_domain_x, interpolation_domain_vx); IVectSp const nb_kinspecies(PCpp_len(conf_voicexx, ".SpeciesInfo")); diff --git a/simulations/geometryXVx/bump_on_tail/bumpontail_fft.cpp b/simulations/geometryXVx/bump_on_tail/bumpontail_fft.cpp index 890be4867..5985e49da 100644 --- a/simulations/geometryXVx/bump_on_tail/bumpontail_fft.cpp +++ b/simulations/geometryXVx/bump_on_tail/bumpontail_fft.cpp @@ -84,10 +84,10 @@ int main(int argc, char** argv) ddc::init_discrete_space(vx_min, vx_max, vx_ncells); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); - IDomainX interpolation_domain_x(SplineInterpPointsX::get_domain()); - IDomainVx interpolation_domain_vx(SplineInterpPointsVx::get_domain()); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); + IDomainX interpolation_domain_x(SplineInterpPointsX::get_domain()); + IDomainVx interpolation_domain_vx(SplineInterpPointsVx::get_domain()); IDomainXVx meshXVx(interpolation_domain_x, interpolation_domain_vx); IVectSp const nb_kinspecies(PCpp_len(conf_voicexx, ".SpeciesInfo")); @@ -209,7 +209,8 @@ int main(int argc, char** argv) SplitVlasovSolver const vlasov(advection_x, advection_vx); - ddc::init_discrete_space(ddc::init_fourier_space(ddc::select(meshSpXVx))); + ddc::init_discrete_space( + ddc::init_fourier_space(ddc::select(meshSpXVx))); host_t const quadrature_coeffs_host = neumann_spline_quadrature_coefficients(gridvx, builder_vx_poisson); diff --git a/simulations/geometryXVx/landau/landau_fem_uniform.cpp b/simulations/geometryXVx/landau/landau_fem_uniform.cpp index 2938b9a52..040dc0361 100644 --- a/simulations/geometryXVx/landau/landau_fem_uniform.cpp +++ b/simulations/geometryXVx/landau/landau_fem_uniform.cpp @@ -87,10 +87,10 @@ int main(int argc, char** argv) ddc::init_discrete_space(vx_min, vx_max, vx_ncells); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); - IDomainX interpolation_domain_x(SplineInterpPointsX::get_domain()); - IDomainVx interpolation_domain_vx(SplineInterpPointsVx::get_domain()); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); + IDomainX interpolation_domain_x(SplineInterpPointsX::get_domain()); + IDomainVx interpolation_domain_vx(SplineInterpPointsVx::get_domain()); IDomainXVx meshXVx(interpolation_domain_x, interpolation_domain_vx); IVectSp const nb_kinspecies(PCpp_len(conf_voicexx, ".SpeciesInfo")); diff --git a/simulations/geometryXVx/landau/landau_fft.cpp b/simulations/geometryXVx/landau/landau_fft.cpp index 1c77a1ec4..c9c7ac000 100644 --- a/simulations/geometryXVx/landau/landau_fft.cpp +++ b/simulations/geometryXVx/landau/landau_fft.cpp @@ -84,10 +84,10 @@ int main(int argc, char** argv) ddc::init_discrete_space(vx_min, vx_max, vx_ncells); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); - IDomainX interpolation_domain_x(SplineInterpPointsX::get_domain()); - IDomainVx interpolation_domain_vx(SplineInterpPointsVx::get_domain()); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); + IDomainX interpolation_domain_x(SplineInterpPointsX::get_domain()); + IDomainVx interpolation_domain_vx(SplineInterpPointsVx::get_domain()); IDomainXVx meshXVx(interpolation_domain_x, interpolation_domain_vx); IVectSp const nb_kinspecies(PCpp_len(conf_voicexx, ".SpeciesInfo")); @@ -209,7 +209,8 @@ int main(int argc, char** argv) SplitVlasovSolver const vlasov(advection_x, advection_vx); - ddc::init_discrete_space(ddc::init_fourier_space(ddc::select(meshSpXVx))); + ddc::init_discrete_space( + ddc::init_fourier_space(ddc::select(meshSpXVx))); host_t const quadrature_coeffs_host = neumann_spline_quadrature_coefficients(gridvx, builder_vx_poisson); diff --git a/simulations/geometryXVx/sheath/sheath.cpp b/simulations/geometryXVx/sheath/sheath.cpp index d38a6d658..f3b3feb5e 100644 --- a/simulations/geometryXVx/sheath/sheath.cpp +++ b/simulations/geometryXVx/sheath/sheath.cpp @@ -100,10 +100,10 @@ int main(int argc, char** argv) ddc::init_discrete_space(vx_min, vx_max, vx_ncells); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); - IDomainX interpolation_domain_x(SplineInterpPointsX::get_domain()); - IDomainVx interpolation_domain_vx(SplineInterpPointsVx::get_domain()); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); + IDomainX interpolation_domain_x(SplineInterpPointsX::get_domain()); + IDomainVx interpolation_domain_vx(SplineInterpPointsVx::get_domain()); IDomainXVx meshXVx(interpolation_domain_x, interpolation_domain_vx); IVectSp const nb_kinspecies(PCpp_len(conf_voicexx, ".SpeciesInfo")); @@ -309,7 +309,8 @@ int main(int argc, char** argv) quadrature_coeffs_host.span_view()); ChargeDensityCalculator rhs(quadrature_coeffs); #ifdef PERIODIC_RDIMX - ddc::init_discrete_space(ddc::init_fourier_space(ddc::select(meshSpXVx))); + ddc::init_discrete_space( + ddc::init_fourier_space(ddc::select(meshSpXVx))); FftPoissonSolver const poisson(rhs); #else FemNonPeriodicPoissonSolver const poisson(builder_x_poisson, spline_x_evaluator_poisson, rhs); diff --git a/simulations/geometryXYVxVy/landau/landau4d_fft.cpp b/simulations/geometryXYVxVy/landau/landau4d_fft.cpp index 3f67da3d3..cda56d9a9 100644 --- a/simulations/geometryXYVxVy/landau/landau4d_fft.cpp +++ b/simulations/geometryXYVxVy/landau/landau4d_fft.cpp @@ -82,18 +82,18 @@ int main(int argc, char** argv) ddc::init_discrete_space(y_min, y_max, y_ncells); ddc::init_discrete_space(vx_min, vx_max, vx_ncells); ddc::init_discrete_space(vy_min, vy_max, vy_ncells); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsY::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsVy::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsY::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsVy::get_sampling()); IVectSp const nb_kinspecies(PCpp_len(conf_voicexx, ".SpeciesInfo")); IDomainSp const dom_kinsp(IndexSp(0), nb_kinspecies); - IDomainX interpolation_domain_x(SplineInterpPointsX::get_domain()); - IDomainY interpolation_domain_y(SplineInterpPointsY::get_domain()); - IDomainVx interpolation_domain_vx(SplineInterpPointsVx::get_domain()); - IDomainVy interpolation_domain_vy(SplineInterpPointsVy::get_domain()); + IDomainX interpolation_domain_x(SplineInterpPointsX::get_domain()); + IDomainY interpolation_domain_y(SplineInterpPointsY::get_domain()); + IDomainVx interpolation_domain_vx(SplineInterpPointsVx::get_domain()); + IDomainVy interpolation_domain_vy(SplineInterpPointsVy::get_domain()); IDomainVxVy interpolation_domain_vxvy(interpolation_domain_vx, interpolation_domain_vy); IDomainXYVxVy meshXYVxVy( @@ -210,9 +210,9 @@ int main(int argc, char** argv) SplitVlasovSolver const vlasov(advection_x, advection_y, advection_vx, advection_vy); ddc::init_discrete_space( - ddc::init_fourier_space(ddc::select(meshSpXYVxVy))); + ddc::init_fourier_space(ddc::select(meshSpXYVxVy))); ddc::init_discrete_space( - ddc::init_fourier_space(ddc::select(meshSpXYVxVy))); + ddc::init_fourier_space(ddc::select(meshSpXYVxVy))); host_t const quadrature_coeffs_host = neumann_spline_quadrature_coefficients( interpolation_domain_vxvy, diff --git a/src/advection/bsl_advection_vx.hpp b/src/advection/bsl_advection_vx.hpp index 474b07bdb..f26112674 100644 --- a/src/advection/bsl_advection_vx.hpp +++ b/src/advection/bsl_advection_vx.hpp @@ -16,11 +16,10 @@ template class BslAdvectionVelocity : public IAdvectionVelocity { - using DDimSp = typename Geometry::DDimSp; using FdistribuDDom = typename Geometry::FdistribuDDom; using SpatialDDom = typename Geometry::SpatialDDom; using DElemV = ddc::DiscreteElement; - using DElemSp = ddc::DiscreteElement; + using DElemSp = ddc::DiscreteElement; using CDimV = typename DDimV::continuous_dimension_type; private: @@ -61,7 +60,7 @@ class BslAdvectionVelocity : public IAdvectionVelocity Kokkos::Profiling::pushRegion("BslAdvectionVelocity"); FdistribuDDom const dom = allfdistribu.domain(); ddc::DiscreteDomain const v_dom = ddc::select(dom); - ddc::DiscreteDomain const sp_dom = ddc::select(dom); + ddc::DiscreteDomain const sp_dom = ddc::select(dom); // pre-allocate some memory to prevent allocation later in loop ddc::Chunk feet_coords_alloc( diff --git a/src/advection/bsl_advection_x.hpp b/src/advection/bsl_advection_x.hpp index 3fc416eaa..410f8e9ae 100644 --- a/src/advection/bsl_advection_x.hpp +++ b/src/advection/bsl_advection_x.hpp @@ -15,13 +15,12 @@ template class BslAdvectionSpatial : public IAdvectionSpatial { - using DDimSp = typename Geometry::DDimSp; using DDimV = typename Geometry::template velocity_dim_for; using DDom = typename Geometry::FdistribuDDom; using DElemX = ddc::DiscreteElement; using DElemV = ddc::DiscreteElement; - using DElemSp = ddc::DiscreteElement; - using DElemSpV = ddc::DiscreteElement; + using DElemSp = ddc::DiscreteElement; + using DElemSpV = ddc::DiscreteElement; using CDimX = typename DDimX::continuous_dimension_type; using CDimV = typename DDimV::continuous_dimension_type; @@ -62,7 +61,7 @@ class BslAdvectionSpatial : public IAdvectionSpatial DDom const dom = allfdistribu.domain(); ddc::DiscreteDomain const x_dom = ddc::select(dom); ddc::DiscreteDomain const v_dom = ddc::select(dom); - ddc::DiscreteDomain const sp_dom = ddc::select(dom); + ddc::DiscreteDomain const sp_dom = ddc::select(dom); // pre-allocate some memory to prevent allocation later in loop ddc::Chunk feet_coords_alloc( @@ -72,7 +71,7 @@ class BslAdvectionSpatial : public IAdvectionSpatial std::unique_ptr const interpolator_x_ptr = m_interpolator_x.preallocate(); InterpolatorType const& interpolator_x = *interpolator_x_ptr; - auto c_dom = ddc::remove_dims_of(dom, ddc::DiscreteDomain(sp_dom, x_dom)); + auto c_dom = ddc::remove_dims_of(dom, ddc::DiscreteDomain(sp_dom, x_dom)); using DElemC = typename decltype(c_dom)::discrete_element_type; for (DElemSp const isp : sp_dom) { diff --git a/src/geometry5D/geometry/geometry.hpp b/src/geometry5D/geometry/geometry.hpp index 150f1aca8..ce47257b6 100644 --- a/src/geometry5D/geometry/geometry.hpp +++ b/src/geometry5D/geometry/geometry.hpp @@ -10,7 +10,7 @@ * */ -using Species = SpeciesInformation; +using Species = IDimSp; using IdxSp = ddc::DiscreteElement; using DVecSp = ddc::DiscreteVector; using DDomSp = ddc::DiscreteDomain; @@ -93,11 +93,21 @@ using CoordVpar = ddc::Coordinate; using CoordMu = ddc::Coordinate; using CoordV2D = ddc::Coordinate; -using GridTor1 = ddc::NonUniformPointSampling; -using GridTor2 = ddc::NonUniformPointSampling; -using GridTor3 = ddc::NonUniformPointSampling; -using GridVpar = ddc::NonUniformPointSampling; -using GridMu = ddc::NonUniformPointSampling; +struct GridTor1 : ddc::NonUniformPointSampling +{ +}; +struct GridTor2 : ddc::NonUniformPointSampling +{ +}; +struct GridTor3 : ddc::NonUniformPointSampling +{ +}; +struct GridVpar : ddc::NonUniformPointSampling +{ +}; +struct GridMu : ddc::NonUniformPointSampling +{ +}; using IdxTor1 = ddc::DiscreteElement; using IdxTor2 = ddc::DiscreteElement; diff --git a/src/geometryRTheta/README.md b/src/geometryRTheta/README.md index 73e2e25be..db59c8c29 100644 --- a/src/geometryRTheta/README.md +++ b/src/geometryRTheta/README.md @@ -12,7 +12,7 @@ The `geometryRTheta` folder contains all the code describing methods which are s - [interpolation](./interpolation/README.md) - Code describing interpolation methods on 2D polar domain. -- [poisson](./poisson/README.md) - Code describing the polar Poisson solver. +- [poisson](./poisson/README.md) - Code describing the polar Quasi-Neutrality solver. - [time\_solver](./time_solver/README.md) - The methods to solve in time the equations system. diff --git a/src/geometryRTheta/advection_field/README.md b/src/geometryRTheta/advection_field/README.md index 4d681d923..49cc8f8c4 100644 --- a/src/geometryRTheta/advection_field/README.md +++ b/src/geometryRTheta/advection_field/README.md @@ -20,12 +20,12 @@ E = - \nabla \phi, \\ with $`\rho`$ the density, $`\phi`$ the electrostatic potential and $`E`$ the electrical field. -The AdvectionFieldFinder computes the advection field $`A`$ from the electrical field $`\phi`$ returned by the PolarSplineFEMPoissonSolver. +The AdvectionFieldFinder computes the advection field $`A`$ from the electrical field $`\phi`$ returned by the PolarSplineFEMPoissonLikeSolver. It has two types of `operator()`: * one returning the advection field along the axis of the physical domain: $`A = (A_x, A_y)`$ * and the another returning the advection field along the axis of the logical domain: $`A = (A_r, A_\theta)`$. -The PolarSplineFEMPoissonSolver can return the solution $`\phi`$ of the Poisson equation under two forms: +The PolarSplineFEMPoissonLikeSolver can return the solution $`\phi`$ of the PDE under two forms: * a Chunk of values of the solution on the mesh points of the grid; * a PolarSpline representation of the solution. @@ -255,4 +255,4 @@ method of characteristics and spline finite elements", https://doi.org/10.1016/j # Contents -* advection\_field\_rp.hpp : containing AdvectionFieldFinder with the advection field computation for the guiding center simulation. \ No newline at end of file +* advection\_field\_rp.hpp : containing AdvectionFieldFinder with the advection field computation for the guiding center simulation. diff --git a/src/geometryRTheta/advection_field/advection_field_rp.hpp b/src/geometryRTheta/advection_field/advection_field_rp.hpp index d0201f806..d0a16382c 100644 --- a/src/geometryRTheta/advection_field/advection_field_rp.hpp +++ b/src/geometryRTheta/advection_field/advection_field_rp.hpp @@ -11,21 +11,21 @@ #include #include -#include "ipoissonsolver.hpp" -#include "poisson_rhs_function.hpp" -#include "polarpoissonsolver.hpp" +#include "iqnsolver.hpp" +#include "poisson_like_rhs_function.hpp" +#include "polarpoissonlikesolver.hpp" /** - * @brief Solve the Poisson equation and return the electric + * @brief Solve the Poisson-like equation and return the electric * field for the coupled Vlasov equation. * * The Vlasov-Poisson equations are given by * * - (1) @f$ \partial_t \rho - E_y \partial_x \rho + E_x \partial_y\rho = 0 @f$, * - * - (2) @f$ - \Delta \phi = \rho @f$, + * - (2) @f$ - L \phi = - \nabla \cdot (\alpha \nabla \phi) + \beta \phi = \rho @f$, * * - (3) and @f$ E = -\nabla \phi @f$. * @@ -82,7 +82,7 @@ * @tparam Mapping A Curvilinear2DToCartesian class. * * - * @see PolarSplineFEMPoissonSolver + * @see PolarSplineFEMPoissonLikeSolver * */ template @@ -136,7 +136,7 @@ class AdvectionFieldFinder * @brief Compute the advection field from a Chunk of @f$\phi@f$ values. * * @param[in] electrostatic_potential - * The values of the solution @f$\phi@f$ of the Poisson equation (2). + * The values of the solution @f$\phi@f$ of the Poisson-like equation (2). * @param[out] advection_field_xy * The advection field on the physical axis. */ @@ -162,7 +162,7 @@ class AdvectionFieldFinder * The B-splines basis used is the cross-product of two 1D B-splines basis. * * @param[in] electrostatic_potential_coef - * The spline representation of the solution @f$\phi@f$ of the Poisson equation (2). + * The spline representation of the solution @f$\phi@f$ of the Poisson-like equation (2). * @param[out] advection_field_xy * The advection field on the physical axis. */ @@ -178,11 +178,11 @@ class AdvectionFieldFinder /** - * @brief Compute the advection field from the Poisson equation solution. + * @brief Compute the advection field from the Poisson-like equation solution. * The B-splines basis used is the polar B-splines (PolarSpline). * * @param[in] electrostatic_potential_coef - * The polar spline representation of the solution @f$\phi@f$ of the Poisson equation (2). + * The polar spline representation of the solution @f$\phi@f$ of the Poisson-like equation (2). * @param[out] advection_field_xy * The advection field on the physical axis. */ @@ -204,7 +204,7 @@ class AdvectionFieldFinder * @param[in] evaluator * The spline evaluator used to evaluated electrostatic_potential_coef. * @param[in] electrostatic_potential_coef - * The spline representation of the solution @f$\phi@f$ of the Poisson equation (2). + * The spline representation of the solution @f$\phi@f$ of the Poisson-like equation (2). * @param[out] advection_field_xy * The advection field on the physical axis. */ @@ -353,7 +353,7 @@ class AdvectionFieldFinder * @brief Compute the advection field from a Chunk of @f$\phi@f$ values. * * @param[in] electrostatic_potential - * The values of the solution @f$\phi@f$ of the Poisson equation (2). + * The values of the solution @f$\phi@f$ of the Poisson-like equation (2). * @param[out] advection_field_rp * The advection field on the logical axis. * @param[out] advection_field_xy_center @@ -384,7 +384,7 @@ class AdvectionFieldFinder * The B-splines basis used is the cross-product of two 1D B-splines basis. * * @param[in] electrostatic_potential_coef - * The spline representation of the solution @f$\phi@f$ of the Poisson equation (2). + * The spline representation of the solution @f$\phi@f$ of the Poisson-like equation (2). * @param[out] advection_field_rp * The advection field on the logical axis. * @param[out] advection_field_xy_center @@ -404,11 +404,11 @@ class AdvectionFieldFinder /** - * @brief Compute the advection field from the Poisson equation. + * @brief Compute the advection field from the Poisson-like equation. * The B-splines basis used is the polar B-splines (PolarSpline). * * @param[in] electrostatic_potential_coef - * The polar spline representation of the solution @f$\phi@f$ of the Poisson equation (2). + * The polar spline representation of the solution @f$\phi@f$ of the Poisson-like equation (2). * @param[out] advection_field_rp * The advection field on the logical axis. * @param[out] advection_field_xy_center @@ -435,7 +435,7 @@ class AdvectionFieldFinder * @param[in] evaluator * The spline evaluator used to evaluated electrostatic_potential_coef. * @param[in] electrostatic_potential_coef - * The spline representation of the solution @f$\phi@f$ of the Poisson equation (2). + * The spline representation of the solution @f$\phi@f$ of the Poisson-like equation (2). * @param[out] advection_field_rp * The advection field on the logical axis on a domain without O-point. * @param[out] advection_field_xy_center diff --git a/src/geometryRTheta/geometry/geometry.hpp b/src/geometryRTheta/geometry/geometry.hpp index f0b001e44..7512e5388 100644 --- a/src/geometryRTheta/geometry/geometry.hpp +++ b/src/geometryRTheta/geometry/geometry.hpp @@ -54,15 +54,23 @@ int constexpr BSDegreeP = 3; bool constexpr BsplineOnUniformCellsR = false; bool constexpr BsplineOnUniformCellsP = false; -using BSplinesR = std::conditional_t< - BsplineOnUniformCellsR, - ddc::UniformBSplines, - ddc::NonUniformBSplines>; -using BSplinesP = std::conditional_t< - BsplineOnUniformCellsP, - ddc::UniformBSplines, - ddc::NonUniformBSplines>; -using PolarBSplinesRP = PolarBSplines; +struct BSplinesR + : std::conditional_t< + BsplineOnUniformCellsR, + ddc::UniformBSplines, + ddc::NonUniformBSplines> +{ +}; +struct BSplinesP + : std::conditional_t< + BsplineOnUniformCellsP, + ddc::UniformBSplines, + ddc::NonUniformBSplines> +{ +}; +struct PolarBSplinesRP : PolarBSplines +{ +}; auto constexpr SplineRBoundary = ddc::BoundCond::GREVILLE; auto constexpr SplinePBoundary = ddc::BoundCond::PERIODIC; @@ -78,14 +86,20 @@ bool constexpr UniformMeshP = ddc::is_spline_interpolation_mesh_uniform( SplinePBoundary, BSDegreeP); -using IDimR = std::conditional_t< - UniformMeshR, - ddc::UniformPointSampling, - ddc::NonUniformPointSampling>; -using IDimP = std::conditional_t< - UniformMeshP, - ddc::UniformPointSampling, - ddc::NonUniformPointSampling>; +struct IDimR + : std::conditional_t< + UniformMeshR, + ddc::UniformPointSampling, + ddc::NonUniformPointSampling> +{ +}; +struct IDimP + : std::conditional_t< + UniformMeshP, + ddc::UniformPointSampling, + ddc::NonUniformPointSampling> +{ +}; using SplineInterpPointsR = ddc::GrevilleInterpolationPoints; @@ -276,14 +290,20 @@ int constexpr BSDegreeVp = 3; bool constexpr BsplineOnUniformCellsVr = false; bool constexpr BsplineOnUniformCellsVp = false; -using BSplinesVr = std::conditional_t< - BsplineOnUniformCellsVr, - ddc::UniformBSplines, - ddc::NonUniformBSplines>; -using BSplinesVp = std::conditional_t< - BsplineOnUniformCellsVp, - ddc::UniformBSplines, - ddc::NonUniformBSplines>; +struct BSplinesVr + : std::conditional_t< + BsplineOnUniformCellsVr, + ddc::UniformBSplines, + ddc::NonUniformBSplines> +{ +}; +struct BSplinesVp + : std::conditional_t< + BsplineOnUniformCellsVp, + ddc::UniformBSplines, + ddc::NonUniformBSplines> +{ +}; using PolarBSplinesVrVp = PolarBSplines; @@ -304,14 +324,20 @@ bool constexpr UniformMeshVp = ddc::is_spline_interpolation_mesh_uniform( SplineVpBoundary, BSDegreeVp); -using IDimVr = std::conditional_t< - UniformMeshVr, - ddc::UniformPointSampling, - ddc::NonUniformPointSampling>; -using IDimVp = std::conditional_t< - UniformMeshVp, - ddc::UniformPointSampling, - ddc::NonUniformPointSampling>; +struct IDimVr + : std::conditional_t< + UniformMeshVr, + ddc::UniformPointSampling, + ddc::NonUniformPointSampling> +{ +}; +struct IDimVp + : std::conditional_t< + UniformMeshVp, + ddc::UniformPointSampling, + ddc::NonUniformPointSampling> +{ +}; using SplineInterpPointsVr @@ -524,14 +550,20 @@ int constexpr BSDegreeVx = 3; bool constexpr BsplineOnUniformCellsX = false; bool constexpr BsplineOnUniformCellsVx = false; -using BSplinesX = std::conditional_t< - BsplineOnUniformCellsX, - ddc::UniformBSplines, - ddc::NonUniformBSplines>; -using BSplinesVx = std::conditional_t< - BsplineOnUniformCellsVx, - ddc::UniformBSplines, - ddc::NonUniformBSplines>; +struct BSplinesX + : std::conditional_t< + BsplineOnUniformCellsX, + ddc::UniformBSplines, + ddc::NonUniformBSplines> +{ +}; +struct BSplinesVx + : std::conditional_t< + BsplineOnUniformCellsVx, + ddc::UniformBSplines, + ddc::NonUniformBSplines> +{ +}; auto constexpr SplineXBoundary = RDimX::PERIODIC ? ddc::BoundCond::PERIODIC : ddc::BoundCond::GREVILLE; @@ -549,14 +581,20 @@ bool constexpr UniformMeshVx = ddc::is_spline_interpolation_mesh_uniform( SplineVxBoundary, BSDegreeVx); -using IDimX = std::conditional_t< - UniformMeshX, - ddc::UniformPointSampling, - ddc::NonUniformPointSampling>; -using IDimVx = std::conditional_t< - UniformMeshVx, - ddc::UniformPointSampling, - ddc::NonUniformPointSampling>; +struct IDimX + : std::conditional_t< + UniformMeshX, + ddc::UniformPointSampling, + ddc::NonUniformPointSampling> +{ +}; +struct IDimVx + : std::conditional_t< + UniformMeshVx, + ddc::UniformPointSampling, + ddc::NonUniformPointSampling> +{ +}; using SplineInterpPointsX = ddc::GrevilleInterpolationPoints; @@ -565,10 +603,6 @@ using SplineInterpPointsVx -// Species dimension -using IDimSp = SpeciesInformation; - - using IndexX = ddc::DiscreteElement; using IndexVx = ddc::DiscreteElement; using IndexXVx = ddc::DiscreteElement; diff --git a/src/geometryRTheta/initialization/diocotron_initialization_equilibrium.hpp b/src/geometryRTheta/initialization/diocotron_initialization_equilibrium.hpp index b20259de9..f44a40dfd 100644 --- a/src/geometryRTheta/initialization/diocotron_initialization_equilibrium.hpp +++ b/src/geometryRTheta/initialization/diocotron_initialization_equilibrium.hpp @@ -12,8 +12,8 @@ * * The equations of the diocotron simulation are the Vlasov-Poisson equations * - * - @f$ \partial_t \rho - E_y \partial_x \rho + E_x \partial_y \rho = 0 @f$, - * - @f$ \Delta \phi = \rho @f$, + * - @f$ \partial_t \rho - E_y \partial_x \rho + E_x \partial_y \rho = 0 @f$, + * - @f$ L \phi = - \nabla \cdot (\alpha \nabla \phi) + \beta \phi = \rho @f$, * - @f$ E = -\nabla \phi @f$. * * The DiocotronDensitySolution provides an initial perturbed solution @f$ \rho_0 @f$ for diff --git a/src/geometryRTheta/initialization/vortex_merger_equilibrium.hpp b/src/geometryRTheta/initialization/vortex_merger_equilibrium.hpp index 88baa7728..fae5fa2de 100644 --- a/src/geometryRTheta/initialization/vortex_merger_equilibrium.hpp +++ b/src/geometryRTheta/initialization/vortex_merger_equilibrium.hpp @@ -6,8 +6,8 @@ #include -#include "poisson_rhs_function.hpp" -#include "polarpoissonsolver.hpp" +#include "poisson_like_rhs_function.hpp" +#include "polarpoissonlikesolver.hpp" #include "utils_tools.hpp" @@ -26,7 +26,7 @@ class VortexMergerEquilibria IDomainRP const& m_grid; SplineRPBuilder const& m_builder; SplineRPEvaluatorNullBound const& m_evaluator; - PolarSplineFEMPoissonSolver const& m_poisson_solver; + PolarSplineFEMPoissonLikeSolver const& m_poisson_solver; public: /** @@ -39,19 +39,19 @@ class VortexMergerEquilibria * The domain where the equilibrium is defined. * @param[in] builder * A spline builder to get the spline representation - * of the RHS of the Poisson equation. + * of the RHS of the PDE. * @param[in] evaluator * The evaluator of B-splines for the RHS of the - * Poisson equation. + * PDE. * @param[in] poisson_solver - * The Poisson solver which computes the electrical potential. + * The PDE solver which computes the electrical potential. */ VortexMergerEquilibria( Mapping const& mapping, IDomainRP const& grid, SplineRPBuilder const& builder, SplineRPEvaluatorNullBound const& evaluator, - PolarSplineFEMPoissonSolver const& poisson_solver) + PolarSplineFEMPoissonLikeSolver const& poisson_solver) : m_mapping(mapping) , m_grid(grid) , m_builder(builder) @@ -124,9 +124,9 @@ class VortexMergerEquilibria }); - // STEP 2: compute phi_star^i with Poisson solver + // STEP 2: compute phi_star^i with PDE solver m_builder(rho_coef.span_view(), rho_eq.span_cview()); - PoissonRHSFunction poisson_rhs(rho_coef, m_evaluator); + PoissonLikeRHSFunction poisson_rhs(rho_coef, m_evaluator); m_poisson_solver(poisson_rhs, coords.span_cview(), phi_star.span_view()); // STEP 3: compute c^i diff --git a/src/geometryRTheta/poisson/README.md b/src/geometryRTheta/poisson/README.md index af08e1524..7302aa1c9 100644 --- a/src/geometryRTheta/poisson/README.md +++ b/src/geometryRTheta/poisson/README.md @@ -1,7 +1,7 @@ # Polar Poisson solver -## The Poisson equation +## The Poisson-like equation (For more details, see Emily Bourne's thesis "Non-Uniform Numerical Schemes for the Modelling of Turbulence in the 5D GYSELA Code". December 2022.) @@ -15,7 +15,7 @@ L\phi = - \nabla \cdot (\alpha \nabla \phi) + \beta \phi = \rho with the boundary condition $\phi = 0$, on $\partial \Omega$. -To solve this equation, the PolarSplineFEMPoissonSolver uses a finite element method on the B-splines. +To solve this equation, the PolarSplineFEMPoissonLikeSolver uses a finite element method on the B-splines. ### B-splines FEM @@ -41,7 +41,7 @@ The B-splines with the treatment of the O-point, are called PolarBSplines and ar #### Weak formulation -The Poisson equation is solved by solving its weak form: +The Poisson-like equation is solved by solving its weak form: ```math \int_{\Omega} \lbrack \beta(r) \phi(r,\theta) \hat{B}_l(r,\theta) + \alpha(r) \nabla \phi(r,\theta) \cdot \nabla \hat{B}_l(r,\theta) \rbrack |det(J_{\mathcal{F}}(r,\theta))| dr d\theta = \int_{\Omega} \rho(r,\theta) \hat{B}_l(r,\theta) |det(J_{\mathcal{F}}(r,\theta))| dr d\theta @@ -74,7 +74,7 @@ So we compute the solution B-splines coefficients $`\{\phi_l\}_l`$ by solving th The test are implemented in the `tests/geometryRTheta/polar_poisson/` folder ([polar\_poisson](./../../../tests/geometryRTheta/polar_poisson/README.md)). -The PolarSplineFEMPoissonSolver is tested on a circular mapping (CircularToCartesian) and on a Czarny mapping (CzarnyToCartesian) with +The PolarSplineFEMPoissonLikeSolver is tested on a circular mapping (CircularToCartesian) and on a Czarny mapping (CzarnyToCartesian) with (the test cases are given in Emily Bourne's thesis [1]) * the Poisson coefficients: @@ -98,6 +98,6 @@ method of characteristics and spline finite elements", https://doi.org/10.1016/j ## Contents - * ipoissonsolver.hpp : Define a base class for the Poisson solvers: IPoissonSolver. - * polarpoissonsolver.hpp : Define a Poisson solver using FEM on B-splines: PolarSplineFEMPoissonSolver. - * poisson\_rhs\_function.hpp : Define a rhs object (PoissonRHSFunction) for the Poisson equation (mainly used for vlasovpoissonsolver.hpp): PoissonRHSFunction. + * iqnsolver.hpp : Define a base class for the Quasi-Neutrality solvers: IQNSolver. + * polarpoissonlikesolver.hpp : Define a Poisson-like solver using FEM on B-splines: PolarSplineFEMPoissonLikeSolver. + * poisson\_rhs\_function.hpp : Define a rhs object (PoissonLikeRHSFunction) for the Poisson-like equation (mainly used for vlasovpoissonsolver.hpp): PoissonLikeRHSFunction. diff --git a/src/geometryRTheta/poisson/ipoissonsolver.hpp b/src/geometryRTheta/poisson/iqnsolver.hpp similarity index 66% rename from src/geometryRTheta/poisson/ipoissonsolver.hpp rename to src/geometryRTheta/poisson/iqnsolver.hpp index 44d6367e4..edeb88f57 100644 --- a/src/geometryRTheta/poisson/ipoissonsolver.hpp +++ b/src/geometryRTheta/poisson/iqnsolver.hpp @@ -7,23 +7,23 @@ #include /** - * @brief Base class for Poisson solver. + * @brief Base class for a Quasi-Neutrality solver. */ -class IPoissonSolver +class IQNSolver { public: - virtual ~IPoissonSolver() = default; + virtual ~IQNSolver() = default; /** * @brief Compute the electrical potential and - * the electric field from the Poisson equation. + * the electric field from the Quasi-Neutrality equation. * * @param[out] electrostatic_potential - * The solution of the Poisson equation. + * The solution of the Quasi-Neutrality equation. * @param[out] electric_field * The electric field @f$E = -\nabla \phi@f$. * @param[in] allfdistribu - * The rhs of the Poisson equation. + * The rhs of the Quasi-Neutrality equation. */ virtual void operator()( DSpanRP electrostatic_potential, diff --git a/src/geometryRTheta/poisson/poisson_rhs_function.hpp b/src/geometryRTheta/poisson/poisson_like_rhs_function.hpp similarity index 88% rename from src/geometryRTheta/poisson/poisson_rhs_function.hpp rename to src/geometryRTheta/poisson/poisson_like_rhs_function.hpp index eedc6a7c3..decf726a6 100644 --- a/src/geometryRTheta/poisson/poisson_rhs_function.hpp +++ b/src/geometryRTheta/poisson/poisson_like_rhs_function.hpp @@ -12,7 +12,7 @@ * @tparam RadialExtrapolationRule The extrapolation rule applied at the outer radial bound. */ template -class PoissonRHSFunction +class PoissonLikeRHSFunction { public: /// The type of the 2D Spline Evaluator used by this class @@ -36,20 +36,20 @@ class PoissonRHSFunction public: /** - * @brief Instantiate a PoissonRHSFunction. + * @brief Instantiate a PoissonLikeRHSFunction. * * @param[in] coefs * The bsplines coefficients of the right-hand side function. * @param[in] evaluator * Evaluator on bsplines. */ - PoissonRHSFunction(Spline2DView coefs, evaluator_type const& evaluator) + PoissonLikeRHSFunction(Spline2DView coefs, evaluator_type const& evaluator) : m_coefs(coefs) , m_evaluator(evaluator) { } - ~PoissonRHSFunction() {}; + ~PoissonLikeRHSFunction() {}; /** * @brief Get the value of the function at a given coordinate. diff --git a/src/geometryRTheta/poisson/polarpoissonsolver.hpp b/src/geometryRTheta/poisson/polarpoissonlikesolver.hpp similarity index 95% rename from src/geometryRTheta/poisson/polarpoissonsolver.hpp rename to src/geometryRTheta/poisson/polarpoissonlikesolver.hpp index 94e7737c2..88ffc6a14 100644 --- a/src/geometryRTheta/poisson/polarpoissonsolver.hpp +++ b/src/geometryRTheta/poisson/polarpoissonlikesolver.hpp @@ -14,9 +14,9 @@ #include "geometry.hpp" /** -* @brief Define a polar Poisson solver. +* @brief Define a polar PDE solver for a Poisson-like equation. * - * Solve the following Poisson equation + * Solve the following Partial Differential Equation * * (1) @f$ L\phi = - \nabla \cdot (\alpha \nabla \phi) + \beta \phi = \rho @f$, in @f$ \Omega@f$, * @@ -32,7 +32,7 @@ * in the 5D GYSELA Code". December 2022.) * */ -class PolarSplineFEMPoissonSolver +class PolarSplineFEMPoissonLikeSolver { public: struct RBasisSubset @@ -60,23 +60,33 @@ class PolarSplineFEMPoissonSolver using tag = T; }; -private: +public: /** * @brief Tag the first dimension for the quadrature. */ - using QDimR = InternalTagGenerator; + struct QDimR : InternalTagGenerator + { + }; /** * @brief Tag the second dimension for the quadrature. */ - using QDimP = InternalTagGenerator; + struct QDimP : InternalTagGenerator + { + }; /** * @brief Tag the first dimension for the quadrature mesh. */ - using QDimRMesh = ddc::NonUniformPointSampling; + struct QDimRMesh : ddc::NonUniformPointSampling + { + }; /** * @brief Tag the second dimension for the quadrature mesh. */ - using QDimPMesh = ddc::NonUniformPointSampling; + struct QDimPMesh : ddc::NonUniformPointSampling + { + }; + +private: /** * @brief Tag the quadrature domain in the first dimension. */ @@ -202,7 +212,7 @@ class PolarSplineFEMPoissonSolver public: /** - * @brief Instantiate a polar Poisson solver using FEM with B-splines. + * @brief Instantiate a polar Poisson-like solver using FEM with B-splines. * * The equation we are studying: * @@ -212,10 +222,10 @@ class PolarSplineFEMPoissonSolver * * @param[in] coeff_alpha * The spline representation of the @f$ \alpha @f$ function in the - * definition of the Poisson equation. + * definition of the Poisson-like equation. * @param[in] coeff_beta * The spline representation of the @f$ \beta @f$ function in the - * definition of the Poisson equation. + * definition of the Poisson-like equation. * @param[in] mapping * The mapping from the logical domain to the physical domain where * the equation is defined. @@ -223,7 +233,7 @@ class PolarSplineFEMPoissonSolver * @tparam Mapping A Curvilinear2DToCartesian class. */ template - PolarSplineFEMPoissonSolver( + PolarSplineFEMPoissonLikeSolver( Spline2DView coeff_alpha, Spline2DView coeff_beta, Mapping const& mapping) @@ -253,7 +263,7 @@ class PolarSplineFEMPoissonSolver , weights_r(quadrature_domain_r) , weights_p(quadrature_domain_p) , singular_basis_vals_and_derivs(ddc::DiscreteDomain( - PolarBSplinesRP::singular_domain(), + PolarBSplinesRP::singular_domain(), ddc::select(quadrature_domain_singular), ddc::select(quadrature_domain_singular))) , r_basis_vals_and_derivs(ddc::DiscreteDomain< @@ -336,7 +346,7 @@ class PolarSplineFEMPoissonSolver } }); - auto singular_domain = PolarBSplinesRP::singular_domain(); + auto singular_domain = PolarBSplinesRP::singular_domain(); // Find value and derivative of 2D bsplines covering the singular point ddc::for_each(quadrature_domain_singular, [&](QuadratureIndexRP const irp) { @@ -452,7 +462,7 @@ class PolarSplineFEMPoissonSolver non_singular_domain_near_centre, [&](IDimBSpline2D_Polar const idx_trial) { const IDimPolarBspl polar_idx_trial( - PolarBSplinesRP::get_polar_index(idx_trial)); + PolarBSplinesRP::get_polar_index(idx_trial)); const ddc::DiscreteElement r_idx_trial( ddc::select(idx_trial)); const ddc::DiscreteElement p_idx_trial( @@ -541,7 +551,7 @@ class PolarSplineFEMPoissonSolver ddc::for_each(remaining_p, [&](auto const p_idx_trial) { IDimBSpline2D_Polar idx_trial(ddc::DiscreteElement(r_idx_test), p_idx_trial); - IDimPolarBspl polar_idx_trial(PolarBSplinesRP::get_polar_index( + IDimPolarBspl polar_idx_trial(PolarBSplinesRP::get_polar_index( IDimBSpline2D_Polar(r_idx_test, pmod(p_idx_trial.uid())))); double element = get_matrix_stencil_element( idx_test, @@ -577,7 +587,7 @@ class PolarSplineFEMPoissonSolver ddc::for_each(trial_domain, [&](IDimBSpline2D_Polar const idx_trial) { const int r_idx_trial(ddc::select(idx_trial).uid()); const int p_idx_trial(ddc::select(idx_trial).uid()); - IDimPolarBspl polar_idx_trial(PolarBSplinesRP::get_polar_index( + IDimPolarBspl polar_idx_trial(PolarBSplinesRP::get_polar_index( IDimBSpline2D_Polar(r_idx_trial, pmod(p_idx_trial)))); double element = get_matrix_stencil_element( idx_test, @@ -604,14 +614,14 @@ class PolarSplineFEMPoissonSolver /** - * @brief Solve the Poisson equation. + * @brief Solve the Poisson-like equation. * * This operator returns the coefficients associated with the B-Splines * of the solution @f$\phi@f$. * * @param[in] rhs - * The rhs @f$ \rho@f$ of the Poisson equation. - * The type is templated but we can use the PoissonRHSFunction + * The rhs @f$ \rho@f$ of the Poisson-like equation. + * The type is templated but we can use the PoissonLikeRHSFunction * class. * @param[out] spline * The spline representation of the solution @f$\phi@f$. @@ -624,19 +634,22 @@ class PolarSplineFEMPoissonSolver - ddc::discrete_space().nbasis()); // Fill b - ddc::for_each(PolarBSplinesRP::singular_domain(), [&](IDimPolarBspl const idx) { - b(idx.uid()) = ddc::transform_reduce( - quadrature_domain_singular, - 0.0, - ddc::reducer::sum(), - [&](QuadratureIndexRP const quad_idx) { - QuadratureIndexR const ir = ddc::select(quad_idx); - QuadratureIndexP const ip = ddc::select(quad_idx); - CoordRP coord(get_coordinate(ir), get_coordinate(ip)); - return rhs(coord) * singular_basis_vals_and_derivs(idx, ir, ip).value - * int_volume(ir, ip); - }); - }); + ddc::for_each( + PolarBSplinesRP::singular_domain(), + [&](IDimPolarBspl const idx) { + b(idx.uid()) = ddc::transform_reduce( + quadrature_domain_singular, + 0.0, + ddc::reducer::sum(), + [&](QuadratureIndexRP const quad_idx) { + QuadratureIndexR const ir = ddc::select(quad_idx); + QuadratureIndexP const ip = ddc::select(quad_idx); + CoordRP coord(get_coordinate(ir), get_coordinate(ip)); + return rhs(coord) + * singular_basis_vals_and_derivs(idx, ir, ip).value + * int_volume(ir, ip); + }); + }); const std::size_t ncells_r = ddc::discrete_space().ncells(); ddc::for_each(fem_non_singular_domain, [&](IDimPolarBspl const idx) { const IDimBSpline2D_Polar idx_2d(PolarBSplinesRP::get_2d_index(idx)); @@ -700,9 +713,9 @@ class PolarSplineFEMPoissonSolver // Fill the spline - ddc::for_each(PolarBSplinesRP::singular_domain(), [&](IDimPolarBspl const idx) { - spline.singular_spline_coef(idx) = x(idx.uid()); - }); + ddc::for_each( + PolarBSplinesRP::singular_domain(), + [&](IDimPolarBspl const idx) { spline.singular_spline_coef(idx) = x(idx.uid()); }); ddc::for_each(fem_non_singular_domain, [&](IDimPolarBspl const idx) { const IDimBSpline2D_Polar idx_2d(PolarBSplinesRP::get_2d_index(idx)); spline.spline_coef(idx_2d) = x(idx.uid()); @@ -729,14 +742,14 @@ class PolarSplineFEMPoissonSolver /** - * @brief Solve the Poisson equation. + * @brief Solve the Poisson-like equation. * * This operator uses the other operator () and returns the values on * the grid of the solution @f$\phi@f$. * * @param[in] rhs - * The rhs @f$ \rho@f$ of the Poisson equation. - * The type is templated but we can use the PoissonRHSFunction + * The rhs @f$ \rho@f$ of the Poisson-like equation. + * The type is templated but we can use the PoissonLikeRHSFunction * class. * @param[in] coords_eval * A Chunk of coordinates where we want to compute the solution. @@ -748,7 +761,7 @@ class PolarSplineFEMPoissonSolver { BSDomainP_Polar polar_domain(ddc::discrete_space().full_domain()); SplinePolar - spline(PolarBSplinesRP::singular_domain(), + spline(PolarBSplinesRP::singular_domain(), BSDomainRP(radial_bsplines, polar_domain)); (*this)(rhs, spline); diff --git a/src/geometryRTheta/time_solver/README.md b/src/geometryRTheta/time_solver/README.md index f07ec3705..380a5e942 100644 --- a/src/geometryRTheta/time_solver/README.md +++ b/src/geometryRTheta/time_solver/README.md @@ -1,113 +1,113 @@ # Predictor-corrector methods -This folder contains different predictor-corrector methods: -- Predictor-corrector: BslPredCorrRP; -- Second order explicit predictor-corrector: BslExplicitPredCorrRP; -- Second order implicit predictor-corrector: BslImplicitPredCorrRP; +This folder contains different predictor-corrector methods: +- Predictor-corrector: BslPredCorrRP; +- Second order explicit predictor-corrector: BslExplicitPredCorrRP; +- Second order implicit predictor-corrector: BslImplicitPredCorrRP; -The second order explicit predictor-corrector and the second order implicit predictor-corrector are detailed in Edoardo Zoni's article [1]. +The second order explicit predictor-corrector and the second order implicit predictor-corrector are detailed in Edoardo Zoni's article [1]. The studied equations system is Vlasov-Poisson equations ```math L\phi = - \nabla \cdot (\alpha \nabla \phi) + \beta \phi = \rho, -\\ E = - \nabla \phi, -\\ (A_x, A_y) = (-E_y, E_x), +\\ E = - \nabla \phi, +\\ (A_x, A_y) = (-E_y, E_x), \\ \partial_t \rho + A_x \partial_x \rho + A_y \partial_y \rho = 0, \\ \rho(t = 0, r, \theta) = \rho_0(r,\theta). ``` -Let's write $`\{t^n\}_n \text{ the time discretization, and } f^n = f(t^n, \cdot, \cdot)`$. +Let's write $`\{t^n\}_n \text{ the time discretization, and } f^n = f(t^n, \cdot, \cdot)`$. + - ## Predictor-corrector -This method is a Runge-Kutta 2 method: for $n\geq 0$, +This method is a Runge-Kutta 2 method: for $n\geq 0$, + +Advect on a half time step: + + 1. From $\rho^n$, we compute $\phi^n$ with the Poisson-like equation (IQNSolver); -Advect on a half time step: + 2. From $\phi^n$, we compute $E^n$ by deriving (IQNSolver); - 1. From $\rho^n$, we compute $\phi^n$ with the Poisson equation (IPoissonSolver); - - 2. From $\phi^n$, we compute $E^n$ by deriving (IPoissonSolver); - 3. From $\rho^n \text{ and } A^n$, we compute $\rho^{n+1/2}$ by advecting (IAdvectionRP) on $\frac{dt}{2}$ with one of the selected time integration methods (ITimeStepper); - -Advect on a full time step: - 4. From $\rho^{n+1/2}$, we compute $\phi^{n+1/2}$ with the Poisson equation (IPoissonSolver); - - 5. From $\phi^{n+1/2}$, we compute $E^{n+1/2}$ by deriving (IPoissonSolver); - +Advect on a full time step: + + 4. From $\rho^{n+1/2}$, we compute $\phi^{n+1/2}$ with the Poisson-like equation (IQNSolver); + + 5. From $\phi^{n+1/2}$, we compute $E^{n+1/2}$ by deriving (IQNSolver); + 6. From $\rho^n \text{ and } A^{n+1/2}$, we compute $\rho^{n+1}$ by advecting (IAdvectionRP) on $dt$ with one of the selected time integration methods (ITimeStepper). ## Explicit predictor-corrector -This method is a second order explicit predictor-corrector: for $n\geq 0$, +This method is a second order explicit predictor-corrector: for $n\geq 0$, + +Prediction: + + 1. From $\rho^n$, we compute $\phi^n$ with the Poisson-like equation (IQNSolver); + + 2. From $\phi^n$, we compute $E^n$ by deriving (IQNSolver); -Prediction: + 3. From $\rho^n \text{ and } A^n$, we compute $\rho^P$ by advecting (IAdvectionRP) on $dt$; + - We write $X^P$ the characteristic feet such that $`\partial_t X^P = A^n(X^n)`$. - 1. From $\rho^n$, we compute $\phi^n$ with the Poisson equation (IPoissonSolver); - - 2. From $\phi^n$, we compute $E^n$ by deriving (IPoissonSolver); - - 3. From $\rho^n \text{ and } A^n$, we compute $\rho^P$ by advecting (IAdvectionRP) on $dt$; - - We write $X^P$ the characteristic feet such that $`\partial_t X^P = A^n(X^n)`$. +Correction: -Correction: + 4. From $\rho^{P}$, we compute $\phi^{P}$ with the Poisson-like equation (IQNSolver); + + 5. From $\phi^{P}$, we compute $E^{P}$ by deriving (IQNSolver); - 4. From $\rho^{P}$, we compute $\phi^{P}$ with the Poisson equation (IPoissonSolver); - - 5. From $\phi^{P}$, we compute $E^{P}$ by deriving (IPoissonSolver); - 6. From $\rho^n \text{ and } \frac{A^{P}(X^n) + A^n(X^P)}{2}$, we compute $\rho^{C} = \rho^{n+1}$ by advecting (IAdvectionRP) on $dt$. - + ## Implicit predictor-corrector -This method is a second order implicit predictor-corrector: for $n\geq 0$, +This method is a second order implicit predictor-corrector: for $n\geq 0$, + +Prediction: + + 1. From $\rho^n$, we compute $\phi^n$ with the Poisson-like equation (IQNSolver); -Prediction: + 2. From $\phi^n$, we compute $E^n$ by deriving (IQNSolver); - 1. From $\rho^n$, we compute $\phi^n$ with the Poisson equation (IPoissonSolver); - - 2. From $\phi^n$, we compute $E^n$ by deriving (IPoissonSolver); - - 3. From $\rho^n \text{ and } A^n$, we compute $\rho^P$ by advecting (IAdvectionRP) on $\frac{dt}{2}$; + 3. From $\rho^n \text{ and } A^n$, we compute $\rho^P$ by advecting (IAdvectionRP) on $\frac{dt}{2}$; - We write $X^P$ the characteristic feet such that it is the result of the implicit method: ```math \partial_t X^k = \frac{A^n(X^n) + A^n(X^{k-1})}{2}, \qquad X^k = X^n - \frac{dt}{2} \partial_t X^k. -``` +``` + +Correction: -Correction: + 4. From $\rho^{P}$, we compute $\phi^{P}$ with the Poisson-like equation (IQNSolver); + + 5. From $\phi^{P}$, we compute $E^{P}$ by deriving (IQNSolver); - 4. From $\rho^{P}$, we compute $\phi^{P}$ with the Poisson equation (IPoissonSolver); - - 5. From $\phi^{P}$, we compute $E^{P}$ by deriving (IPoissonSolver); - 6. From $\rho^n \text{ and } A^{P}$, we compute $\rho^{C} = \rho^{n+1}$ by advecting (IAdvectionRP) on $dt$. - We write $X^C$ the characteristic feet such that it is the result of the implicit method: ```math \partial_t X^k = \frac{A^P(X^n) + A^P(X^{k-1})}{2}, \qquad X^k = X^n - dt \partial_t X^k. -``` +``` -## References +## References -[1] Edoardo Zoni, Yaman Güçlü, "Solving hyperbolic-elliptic problems on singular mapped disk-like domains with the +[1] Edoardo Zoni, Yaman Güçlü, "Solving hyperbolic-elliptic problems on singular mapped disk-like domains with the method of characteristics and spline finite elements", https://doi.org/10.1016/j.jcp.2019.108889, Journal of Computational Physics, 2019. ## Contents - itimesolver.hpp: base class for the time solvers: ITimeSolverRP; - - bsl\_predcorr\_second\_order\_explicit.hpp: the second order explicit predictor-corrector (BslExplicitPredCorrRP); - - bsl\_predcorr\_second\_order\_implicit.hpp: the second order implicit predictor-corrector (BslImplicitPredCorrRP); - - bsl\_predcorr.hpp: the Runge-Kutta 2 method (BslPredCorrRP). + - bsl\_predcorr\_second\_order\_explicit.hpp: the second order explicit predictor-corrector (BslExplicitPredCorrRP); + - bsl\_predcorr\_second\_order\_implicit.hpp: the second order implicit predictor-corrector (BslImplicitPredCorrRP); + - bsl\_predcorr.hpp: the Runge-Kutta 2 method (BslPredCorrRP). diff --git a/src/geometryRTheta/time_solver/bsl_predcorr.hpp b/src/geometryRTheta/time_solver/bsl_predcorr.hpp index cbd509fa7..f922facc3 100644 --- a/src/geometryRTheta/time_solver/bsl_predcorr.hpp +++ b/src/geometryRTheta/time_solver/bsl_predcorr.hpp @@ -18,8 +18,8 @@ #include "geometry.hpp" #include "ifoot_finder.hpp" #include "itimesolver.hpp" -#include "poisson_rhs_function.hpp" -#include "polarpoissonsolver.hpp" +#include "poisson_like_rhs_function.hpp" +#include "polarpoissonlikesolver.hpp" #include "rk2.hpp" #include "spline_interpolator_2d_rp.hpp" @@ -39,12 +39,12 @@ * for @f$ n \geq 0 @f$, * * First, it advects on a half time step: - * - 1. From @f$\rho^n@f$, it computes @f$\phi^n@f$ with a PolarSplineFEMPoissonSolver; + * - 1. From @f$\rho^n@f$, it computes @f$\phi^n@f$ with a PolarSplineFEMPoissonLikeSolver; * - 2. From @f$\phi^n@f$, it computes @f$A^n@f$ with a AdvectionFieldFinder; * - 3. From @f$\rho^n@f$ and @f$A^n@f$, it computes @f$\rho^{n+1/2}@f$ with a BslAdvectionRP on @f$\frac{dt}{2}@f$; * * Secondly, it advects on a full time step: - * - 4. From @f$\rho^{n+1/2}@f$, it computes @f$\phi^{n+1/2}@f$ with a PolarSplineFEMPoissonSolver; + * - 4. From @f$\rho^{n+1/2}@f$, it computes @f$\phi^{n+1/2}@f$ with a PolarSplineFEMPoissonLikeSolver; * - 5. From @f$\phi^{n+1/2}@f$, it computes @f$A^{n+1/2}@f$ with a AdvectionFieldFinder; * - 6. From @f$\rho^n@f$ and @f$A^{n+1/2}@f$, it computes @f$\rho^{n+1}@f$ with a BslAdvectionRP on @f$dt@f$. * @@ -62,7 +62,7 @@ class BslPredCorrRP : public ITimeSolverRP BslAdvectionRP const& m_advection_solver; - PolarSplineFEMPoissonSolver const& m_poisson_solver; + PolarSplineFEMPoissonLikeSolver const& m_poisson_solver; SplineRPBuilder const& m_builder; SplineRPEvaluatorNullBound const& m_spline_evaluator; @@ -83,7 +83,7 @@ class BslPredCorrRP : public ITimeSolverRP * @param[in] rhs_evaluator * The evaluator of B-splines for the RHS. * @param[in] poisson_solver - * The Poisson solver which computes the electrical + * The PDE solver which computes the electrical * potential. */ BslPredCorrRP( @@ -91,7 +91,7 @@ class BslPredCorrRP : public ITimeSolverRP BslAdvectionRP const& advection_solver, SplineRPBuilder const& builder, SplineRPEvaluatorNullBound const& rhs_evaluator, - PolarSplineFEMPoissonSolver const& poisson_solver) + PolarSplineFEMPoissonLikeSolver const& poisson_solver) : m_mapping(mapping) , m_advection_solver(advection_solver) , m_poisson_solver(poisson_solver) @@ -122,7 +122,7 @@ class BslPredCorrRP : public ITimeSolverRP BSDomainP polar_domain(ddc::discrete_space().full_domain()); SplinePolar electrostatic_potential_coef( - PolarBSplinesRP::singular_domain(), + PolarBSplinesRP::singular_domain(), BSDomainRP(radial_bsplines, polar_domain)); ddc::NullExtrapolationRule extrapolation_rule; PolarSplineEvaluator polar_spline_evaluator( @@ -133,7 +133,7 @@ class BslPredCorrRP : public ITimeSolverRP Spline2D allfdistribu_coef(m_builder.spline_domain()); m_builder(allfdistribu_coef.span_view(), allfdistribu.span_cview()); - PoissonRHSFunction const + PoissonLikeRHSFunction const charge_density_coord(allfdistribu_coef.span_cview(), m_spline_evaluator); m_poisson_solver(charge_density_coord, coords, electrical_potential0); @@ -149,7 +149,7 @@ class BslPredCorrRP : public ITimeSolverRP // --- compute electrostatic potential: Spline2D allfdistribu_coef(m_builder.spline_domain()); m_builder(allfdistribu_coef.span_view(), allfdistribu.span_cview()); - PoissonRHSFunction const charge_density_coord( + PoissonLikeRHSFunction const charge_density_coord( allfdistribu_coef.span_cview(), m_spline_evaluator); m_poisson_solver(charge_density_coord, electrostatic_potential_coef); @@ -177,7 +177,7 @@ class BslPredCorrRP : public ITimeSolverRP DFieldRP electrical_potential(grid); Spline2D allfdistribu_coef(m_builder.spline_domain()); m_builder(allfdistribu_coef.span_view(), allfdistribu.span_cview()); - PoissonRHSFunction const + PoissonLikeRHSFunction const charge_density_coord(allfdistribu_coef.span_cview(), m_spline_evaluator); m_poisson_solver(charge_density_coord, coords, electrical_potential); diff --git a/src/geometryRTheta/time_solver/bsl_predcorr_second_order_explicit.hpp b/src/geometryRTheta/time_solver/bsl_predcorr_second_order_explicit.hpp index c68496764..da712866d 100644 --- a/src/geometryRTheta/time_solver/bsl_predcorr_second_order_explicit.hpp +++ b/src/geometryRTheta/time_solver/bsl_predcorr_second_order_explicit.hpp @@ -17,8 +17,8 @@ #include "euler.hpp" #include "geometry.hpp" #include "itimesolver.hpp" -#include "poisson_rhs_function.hpp" -#include "polarpoissonsolver.hpp" +#include "poisson_like_rhs_function.hpp" +#include "polarpoissonlikesolver.hpp" #include "spline_foot_finder.hpp" #include "spline_interpolator_2d_rp.hpp" @@ -41,14 +41,14 @@ * for @f$ n \geq 0 @f$, * * First, it predicts: - * - 1. From @f$\rho^n@f$, it computes @f$\phi^n@f$ with a PolarSplineFEMPoissonSolver; + * - 1. From @f$\rho^n@f$, it computes @f$\phi^n@f$ with a PolarSplineFEMPoissonLikeSolver; * - 2. From @f$\phi^n@f$, it computes @f$A^n@f$ with a AdvectionFieldFinder; * - 3. From @f$\rho^n@f$ and @f$A^n@f$, it computes @f$\rho^P@f$ with a BslAdvectionRP on @f$ dt @f$; * * We write @f$X^P@f$ the characteristic feet such that @f$\partial_t X^P = A^n(X^n)@f$. * * Secondly, it corrects: - * - 4. From @f$\rho^P@f$, it computes @f$\phi^P@f$ with a PolarSplineFEMPoissonSolver; + * - 4. From @f$\rho^P@f$, it computes @f$\phi^P@f$ with a PolarSplineFEMPoissonLikeSolver; * - 5. From @f$\phi^P@f$, it computes @f$A^P@f$ with a AdvectionFieldFinder; * - 6. From @f$\rho^n@f$ and @f$\frac{A^{P}(X^n) + A^n(X^P)}{2} @f$, it computes @f$\rho^{n+1}@f$ with a BslAdvectionRP on @f$ dt @f$. * @@ -77,7 +77,7 @@ class BslExplicitPredCorrRP : public ITimeSolverRP EulerMethod const m_euler; SplineFootFinder const m_find_feet; - PolarSplineFEMPoissonSolver const& m_poisson_solver; + PolarSplineFEMPoissonLikeSolver const& m_poisson_solver; SplineRPBuilder const& m_builder; SplineRPEvaluatorConstBound const& m_evaluator; @@ -104,7 +104,7 @@ class BslExplicitPredCorrRP : public ITimeSolverRP * @param[in] rhs_evaluator * The evaluator of B-splines for the RHS. * @param[in] poisson_solver - * The Poisson solver which computes the electrical + * The PDE solver which computes the electrical * potential. * @param[in] advection_evaluator * An evaluator of B-splines for the spline advection field. @@ -117,7 +117,7 @@ class BslExplicitPredCorrRP : public ITimeSolverRP IDomainRP const& grid, SplineRPBuilder const& builder, SplineRPEvaluatorNullBound const& rhs_evaluator, - PolarSplineFEMPoissonSolver const& poisson_solver, + PolarSplineFEMPoissonLikeSolver const& poisson_solver, SplineRPEvaluatorConstBound const& advection_evaluator) : m_mapping(mapping) , m_advection_solver(advection_solver) @@ -155,7 +155,7 @@ class BslExplicitPredCorrRP : public ITimeSolverRP DFieldRP electrical_potential(grid); SplinePolar electrostatic_potential_coef( - PolarBSplinesRP::singular_domain(), + PolarBSplinesRP::singular_domain(), BSDomainRP(radial_bsplines, polar_domain)); ddc::NullExtrapolationRule extrapolation_rule; @@ -179,7 +179,7 @@ class BslExplicitPredCorrRP : public ITimeSolverRP // STEP 1: From rho^n, we compute phi^n: Poisson equation Spline2D allfdistribu_coef(m_builder.spline_domain()); m_builder(allfdistribu_coef.span_view(), allfdistribu.span_cview()); - PoissonRHSFunction const + PoissonLikeRHSFunction const charge_density_coord_1(allfdistribu_coef.span_cview(), m_evaluator); m_poisson_solver(charge_density_coord_1, electrostatic_potential_coef); @@ -214,7 +214,7 @@ class BslExplicitPredCorrRP : public ITimeSolverRP // STEP 4: From rho^P, we compute phi^P: Poisson equation m_builder(allfdistribu_coef.span_view(), allfdistribu.span_cview()); - PoissonRHSFunction const + PoissonLikeRHSFunction const charge_density_coord_4(allfdistribu_coef.span_cview(), m_evaluator); m_poisson_solver(charge_density_coord_4, electrostatic_potential_coef); @@ -262,7 +262,8 @@ class BslExplicitPredCorrRP : public ITimeSolverRP // STEP 1: From rho^n, we compute phi^n: Poisson equation Spline2D allfdistribu_coef(m_builder.spline_domain()); m_builder(allfdistribu_coef.span_view(), allfdistribu.span_cview()); - PoissonRHSFunction const charge_density_coord(allfdistribu_coef.span_cview(), m_evaluator); + PoissonLikeRHSFunction const + charge_density_coord(allfdistribu_coef.span_cview(), m_evaluator); m_poisson_solver(charge_density_coord, coords, electrical_potential); ddc::PdiEvent("last_iteration") diff --git a/src/geometryRTheta/time_solver/bsl_predcorr_second_order_implicit.hpp b/src/geometryRTheta/time_solver/bsl_predcorr_second_order_implicit.hpp index 6392c6bc0..568d545e5 100644 --- a/src/geometryRTheta/time_solver/bsl_predcorr_second_order_implicit.hpp +++ b/src/geometryRTheta/time_solver/bsl_predcorr_second_order_implicit.hpp @@ -16,8 +16,8 @@ #include "bsl_advection_rp.hpp" #include "geometry.hpp" #include "itimesolver.hpp" -#include "poisson_rhs_function.hpp" -#include "polarpoissonsolver.hpp" +#include "poisson_like_rhs_function.hpp" +#include "polarpoissonlikesolver.hpp" #include "spline_foot_finder.hpp" #include "spline_interpolator_2d_rp.hpp" @@ -40,14 +40,14 @@ * for @f$ n \geq 0 @f$, * * First, it predicts: - * - 1. From @f$\rho^n@f$, it computes @f$\phi^n@f$ with a PolarSplineFEMPoissonSolver; + * - 1. From @f$\rho^n@f$, it computes @f$\phi^n@f$ with a PolarSplineFEMPoissonLikeSolver; * - 2. From @f$\phi^n@f$, it computes @f$A^n@f$ with a AdvectionFieldFinder; * - 3. From @f$\rho^n@f$ and @f$A^n@f$, it computes implicitly @f$\rho^P@f$ with a BslAdvectionRP on @f$ \frac{dt}{4} @f$: * - the characteristic feet @f$X^P@f$ is such that @f$X^P = X^k@f$ with @f$X^k@f$ the result of the implicit method: * - @f$ X^k = X^n - \frac{dt}{4} \partial_t X^k@f$. * * Secondly, it corrects: - * - 4. From @f$\rho^P@f$, it computes @f$\phi^P@f$ with a PolarSplineFEMPoissonSolver; + * - 4. From @f$\rho^P@f$, it computes @f$\phi^P@f$ with a PolarSplineFEMPoissonLikeSolver; * - 5. From @f$\phi^P@f$, it computes @f$A^P@f$ with a AdvectionFieldFinder; * - 6. From @f$\rho^n@f$ and @f$ A^{P} @f$, it computes @f$\rho^{n+1}@f$ with a BslAdvectionRP on @f$ \frac{dt}{2} @f$. * - the characteristic feet @f$X^C@f$ is such that @f$X^C = X^k@f$ with @f$X^k@f$ the result of the implicit method: @@ -77,7 +77,7 @@ class BslImplicitPredCorrRP : public ITimeSolverRP EulerMethod const m_euler; SplineFootFinder const m_foot_finder; - PolarSplineFEMPoissonSolver const& m_poisson_solver; + PolarSplineFEMPoissonLikeSolver const& m_poisson_solver; SplineRPBuilder const& m_builder; SplineRPEvaluatorConstBound const& m_evaluator; @@ -104,7 +104,7 @@ class BslImplicitPredCorrRP : public ITimeSolverRP * @param[in] rhs_evaluator * The evaluator of B-splines for the rhs. * @param[in] poisson_solver - * The Poisson solver which computes the electrical + * The PDE solver which computes the electrical * potential. * @param[in] advection_evaluator * An evaluator of B-splines for the spline advection field. @@ -117,7 +117,7 @@ class BslImplicitPredCorrRP : public ITimeSolverRP IDomainRP const& grid, SplineRPBuilder const& builder, SplineRPEvaluatorNullBound const& rhs_evaluator, - PolarSplineFEMPoissonSolver const& poisson_solver, + PolarSplineFEMPoissonLikeSolver const& poisson_solver, SplineRPEvaluatorConstBound const& advection_evaluator) : m_mapping(mapping) , m_advection_solver(advection_solver) @@ -155,7 +155,7 @@ class BslImplicitPredCorrRP : public ITimeSolverRP DFieldRP electrical_potential(grid); SplinePolar electrostatic_potential_coef( - PolarBSplinesRP::singular_domain(), + PolarBSplinesRP::singular_domain(), BSDomainRP(radial_bsplines, polar_domain)); ddc::NullExtrapolationRule extrapolation_rule; @@ -175,7 +175,7 @@ class BslImplicitPredCorrRP : public ITimeSolverRP // STEP 1: From rho^n, we compute phi^n: Poisson equation Spline2D allfdistribu_coef(m_builder.spline_domain()); m_builder(allfdistribu_coef.span_view(), allfdistribu.span_cview()); - PoissonRHSFunction const + PoissonLikeRHSFunction const charge_density_coord_1(allfdistribu_coef.span_cview(), m_evaluator); m_poisson_solver(charge_density_coord_1, electrostatic_potential_coef); @@ -260,7 +260,7 @@ class BslImplicitPredCorrRP : public ITimeSolverRP // STEP 4: From rho^P, we compute phi^P: Poisson equation m_builder(allfdistribu_coef.span_view(), allfdistribu.span_cview()); - PoissonRHSFunction const + PoissonLikeRHSFunction const charge_density_coord_4(allfdistribu_coef.span_cview(), m_evaluator); m_poisson_solver(charge_density_coord_4, electrostatic_potential_coef); @@ -312,7 +312,8 @@ class BslImplicitPredCorrRP : public ITimeSolverRP // STEP 1: From rho^n, we compute phi^n: Poisson equation Spline2D allfdistribu_coef(m_builder.spline_domain()); m_builder(allfdistribu_coef.span_view(), allfdistribu.span_cview()); - PoissonRHSFunction const charge_density_coord(allfdistribu_coef.span_cview(), m_evaluator); + PoissonLikeRHSFunction const + charge_density_coord(allfdistribu_coef.span_cview(), m_evaluator); m_poisson_solver(charge_density_coord, coords, electrical_potential); ddc::PdiEvent("last_iteration") diff --git a/src/geometryXVx/geometry/geometry.hpp b/src/geometryXVx/geometry/geometry.hpp index 689dce103..b41b9cadb 100644 --- a/src/geometryXVx/geometry/geometry.hpp +++ b/src/geometryXVx/geometry/geometry.hpp @@ -61,14 +61,20 @@ int constexpr BSDegreeVx = 3; bool constexpr BsplineOnUniformCellsX = true; bool constexpr BsplineOnUniformCellsVx = true; -using BSplinesX = std::conditional_t< - BsplineOnUniformCellsX, - ddc::UniformBSplines, - ddc::NonUniformBSplines>; -using BSplinesVx = std::conditional_t< - BsplineOnUniformCellsVx, - ddc::UniformBSplines, - ddc::NonUniformBSplines>; +struct BSplinesX + : std::conditional_t< + BsplineOnUniformCellsX, + ddc::UniformBSplines, + ddc::NonUniformBSplines> +{ +}; +struct BSplinesVx + : std::conditional_t< + BsplineOnUniformCellsVx, + ddc::UniformBSplines, + ddc::NonUniformBSplines> +{ +}; auto constexpr SplineXBoundary = RDimX::PERIODIC ? ddc::BoundCond::PERIODIC : ddc::BoundCond::GREVILLE; @@ -85,14 +91,20 @@ bool constexpr UniformMeshVx = ddc::is_spline_interpolation_mesh_uniform( SplineVxBoundary, BSDegreeVx); -using IDimX = std::conditional_t< - UniformMeshX, - ddc::UniformPointSampling, - ddc::NonUniformPointSampling>; -using IDimVx = std::conditional_t< - UniformMeshVx, - ddc::UniformPointSampling, - ddc::NonUniformPointSampling>; +struct IDimX + : std::conditional_t< + UniformMeshX, + ddc::UniformPointSampling, + ddc::NonUniformPointSampling> +{ +}; +struct IDimVx + : std::conditional_t< + UniformMeshVx, + ddc::UniformPointSampling, + ddc::NonUniformPointSampling> +{ +}; using SplineInterpPointsX = ddc::GrevilleInterpolationPoints; @@ -182,10 +194,9 @@ using SplineVxEvaluator_1d = ddc::SplineEvaluator< ddc::ConstantExtrapolationRule, IDimVx>; -// Species dimension -using IDimSp = SpeciesInformation; - -using IDimM = Moments; +struct IDimM : Moments +{ +}; using IndexM = ddc::DiscreteElement; @@ -413,7 +424,9 @@ using DViewSpXVx = ViewSpXVx; using RDimFx = ddc::Fourier; using CoordFx = ddc::Coordinate; -using IDimFx = ddc::PeriodicSampling; +struct IDimFx : ddc::PeriodicSampling +{ +}; using IndexFx = ddc::DiscreteElement; using IVectFx = ddc::DiscreteVector; using IDomainFx = ddc::DiscreteDomain; @@ -436,11 +449,6 @@ class GeometryXVx template using spatial_dim_for = std::conditional_t, IDimX, void>; - /** - * @brief An alias for species "discrete dimension" type. - */ - using DDimSp = IDimSp; - /** * @brief An alias for the spatial discrete domain type. */ diff --git a/src/geometryXVx/poisson/femnonperiodicpoissonsolver.cpp b/src/geometryXVx/poisson/femnonperiodicpoissonsolver.cpp index 4c9a2d9a9..2898916ca 100644 --- a/src/geometryXVx/poisson/femnonperiodicpoissonsolver.cpp +++ b/src/geometryXVx/poisson/femnonperiodicpoissonsolver.cpp @@ -15,15 +15,15 @@ namespace { NUBSplineXEvaluator_1d jit_build_nubsplinesx(SplineXEvaluator_1d const& spline_x_evaluator) { static_assert( - std::is_same_v< - typename SplineXEvaluator_1d::bsplines_type, - UBSplinesX> || std::is_same_v); - if constexpr (std::is_same_v) { - int const ncells = ddc::discrete_space().ncells(); + ddc::is_uniform_bsplines_v< + typename SplineXEvaluator_1d:: + bsplines_type> || ddc::is_non_uniform_bsplines_v); + if constexpr (ddc::is_uniform_bsplines_v) { + int const ncells = ddc::discrete_space().ncells(); std::vector knots(ncells + 1); for (int i(0); i < ncells + 1; ++i) { - knots[i] = CoordX(ddc::discrete_space().get_knot(i)); + knots[i] = CoordX(ddc::discrete_space().get_knot(i)); } ddc::init_discrete_space(knots); } diff --git a/src/geometryXVx/poisson/femnonperiodicpoissonsolver.hpp b/src/geometryXVx/poisson/femnonperiodicpoissonsolver.hpp index 26bc249df..6f007a7af 100644 --- a/src/geometryXVx/poisson/femnonperiodicpoissonsolver.hpp +++ b/src/geometryXVx/poisson/femnonperiodicpoissonsolver.hpp @@ -10,9 +10,12 @@ #include "ichargedensitycalculator.hpp" #include "ipoissonsolver.hpp" -using NUBSplinesX = ddc::NonUniformBSplines; +struct HiddenNUBSplinesX : ddc::NonUniformBSplines +{ +}; +using NUBSplinesX + = std::conditional_t, HiddenNUBSplinesX, BSplinesX>; using NUBSDomainX = ddc::DiscreteDomain; -using UBSplinesX = ddc::UniformBSplines; using NUBSplineXEvaluator_1d = ddc::SplineEvaluator< Kokkos::DefaultExecutionSpace, @@ -44,8 +47,11 @@ class FemNonPeriodicPoissonSolver : public IPoissonSolver { }; + struct QMeshX : ddc::NonUniformPointSampling + { + }; + private: - using QMeshX = ddc::NonUniformPointSampling; using DQFieldX = device_t>>; using DNUBSSpanX = device_t>; diff --git a/src/geometryXVx/poisson/femperiodicpoissonsolver.hpp b/src/geometryXVx/poisson/femperiodicpoissonsolver.hpp index 63ea0ff50..f7fb37b35 100644 --- a/src/geometryXVx/poisson/femperiodicpoissonsolver.hpp +++ b/src/geometryXVx/poisson/femperiodicpoissonsolver.hpp @@ -27,8 +27,11 @@ class FemPeriodicPoissonSolver : public IPoissonSolver { }; + struct QMeshX : ddc::NonUniformPointSampling + { + }; + private: - using QMeshX = ddc::NonUniformPointSampling; using DQFieldX = device_t>>; private: diff --git a/src/geometryXVx/poisson/fftpoissonsolver.cpp b/src/geometryXVx/poisson/fftpoissonsolver.cpp index 646d63a90..1441bb649 100644 --- a/src/geometryXVx/poisson/fftpoissonsolver.cpp +++ b/src/geometryXVx/poisson/fftpoissonsolver.cpp @@ -33,7 +33,7 @@ void FftPoissonSolver::operator()( m_compute_rho(rho, allfdistribu); // Build a mesh in the fourier space, for N points - IDomainFx const k_mesh = ddc::FourierMesh(x_dom, false); + IDomainFx const k_mesh = ddc::FourierMesh(x_dom, false); device_t, IDomainFx>> intermediate_chunk_alloc(k_mesh); ddc::ChunkSpan intermediate_chunk = intermediate_chunk_alloc.span_view(); // Compute FFT(rho) diff --git a/src/geometryXVx/rhs/collisions_intra.cpp b/src/geometryXVx/rhs/collisions_intra.cpp index f2a550c84..03b81b707 100644 --- a/src/geometryXVx/rhs/collisions_intra.cpp +++ b/src/geometryXVx/rhs/collisions_intra.cpp @@ -41,12 +41,11 @@ CollisionsIntra::CollisionsIntra(IDomainSpXVx const& mesh, double nustar0) int const ncells(ddc::select(mesh).size() - 1); if constexpr (uniform_edge_v) { double const step(ddc::step()); - ddc::init_discrete_space( - ddc::UniformPointSampling:: + ddc::init_discrete_space( + ghosted_vx_point_sampling:: init(ddc::Coordinate(vx0 - step), ddc::Coordinate(vxN + step), - ddc::DiscreteVector>( - ncells + 3))); + ddc::DiscreteVector(ncells + 3))); } else { int const npoints(ncells + 3); std::vector> breaks(npoints); @@ -55,17 +54,16 @@ CollisionsIntra::CollisionsIntra(IDomainSpXVx const& mesh, double nustar0) ddc::for_each(ddc::select(mesh), [&](IndexVx const ivx) { breaks[ghosted_from_index(ivx).uid()] = ghosted_from_coord(ddc::coordinate(ivx)); }); - ddc::init_discrete_space>(breaks); + ddc::init_discrete_space(breaks); } if constexpr (uniform_edge_v) { double const step(ddc::step()); - ddc::init_discrete_space( - ddc::UniformPointSampling:: + ddc::init_discrete_space( + ghosted_vx_staggered_point_sampling:: init(ddc::Coordinate(vx0 - step / 2), ddc::Coordinate(vxN + step / 2), - ddc::DiscreteVector>( - ncells + 2))); + ddc::DiscreteVector(ncells + 2))); } else { int const npoints(ncells + 2); std::vector> breaks(npoints); @@ -76,7 +74,7 @@ CollisionsIntra::CollisionsIntra(IDomainSpXVx const& mesh, double nustar0) breaks[ivx.uid() + 1] = CollisionsIntra::ghosted_staggered_from_coord( CoordVx((ddc::coordinate(ivx) + ddc::coordinate(ivx + 1)) / 2.)); }); - ddc::init_discrete_space>(breaks); + ddc::init_discrete_space(breaks); } m_nustar_profile = m_nustar_profile_alloc.span_view(); diff --git a/src/geometryXVx/rhs/collisions_intra.hpp b/src/geometryXVx/rhs/collisions_intra.hpp index 2d2ba1f90..6375ef58c 100644 --- a/src/geometryXVx/rhs/collisions_intra.hpp +++ b/src/geometryXVx/rhs/collisions_intra.hpp @@ -53,25 +53,30 @@ class CollisionsIntra : public IRightHandSide }; private: - static constexpr bool uniform_edge_v - = std::is_same_v>; + static constexpr bool uniform_edge_v = ddc::is_uniform_sampling_v; public: /** * A conditional type representing either a uniform or a non-uniform ghosted vx mesh. */ - using ghosted_vx_point_sampling = std::conditional_t< - uniform_edge_v, - ddc::UniformPointSampling, - ddc::NonUniformPointSampling>; + struct ghosted_vx_point_sampling + : std::conditional_t< + uniform_edge_v, + ddc::UniformPointSampling, + ddc::NonUniformPointSampling> + { + }; /** * A conditional type representing either a uniform or a non-uniform ghosted staggered vx mesh. */ - using ghosted_vx_staggered_point_sampling = std::conditional_t< - uniform_edge_v, - ddc::UniformPointSampling, - ddc::NonUniformPointSampling>; + struct ghosted_vx_staggered_point_sampling + : std::conditional_t< + uniform_edge_v, + ddc::UniformPointSampling, + ddc::NonUniformPointSampling> + { + }; /** * A type representing a mesh for species, space and ghosted vx mesh. diff --git a/src/geometryXYVxVy/geometry/geometry.hpp b/src/geometryXYVxVy/geometry/geometry.hpp index 9c3335638..9d98b8857 100644 --- a/src/geometryXYVxVy/geometry/geometry.hpp +++ b/src/geometryXYVxVy/geometry/geometry.hpp @@ -72,23 +72,35 @@ bool constexpr BsplineOnUniformCellsY = true; bool constexpr BsplineOnUniformCellsVx = true; bool constexpr BsplineOnUniformCellsVy = true; -using BSplinesX = std::conditional_t< - BsplineOnUniformCellsX, - ddc::UniformBSplines, - ddc::NonUniformBSplines>; -using BSplinesY = std::conditional_t< - BsplineOnUniformCellsY, - ddc::UniformBSplines, - ddc::NonUniformBSplines>; +struct BSplinesX + : std::conditional_t< + BsplineOnUniformCellsX, + ddc::UniformBSplines, + ddc::NonUniformBSplines> +{ +}; +struct BSplinesY + : std::conditional_t< + BsplineOnUniformCellsY, + ddc::UniformBSplines, + ddc::NonUniformBSplines> +{ +}; -using BSplinesVx = std::conditional_t< - BsplineOnUniformCellsVx, - ddc::UniformBSplines, - ddc::NonUniformBSplines>; -using BSplinesVy = std::conditional_t< - BsplineOnUniformCellsVy, - ddc::UniformBSplines, - ddc::NonUniformBSplines>; +struct BSplinesVx + : std::conditional_t< + BsplineOnUniformCellsVx, + ddc::UniformBSplines, + ddc::NonUniformBSplines> +{ +}; +struct BSplinesVy + : std::conditional_t< + BsplineOnUniformCellsVy, + ddc::UniformBSplines, + ddc::NonUniformBSplines> +{ +}; ddc::BoundCond constexpr SplineXBoundary = ddc::BoundCond::PERIODIC; ddc::BoundCond constexpr SplineYBoundary = ddc::BoundCond::PERIODIC; @@ -117,23 +129,34 @@ bool constexpr UniformMeshVy = is_spline_interpolation_mesh_uniform( BSDegreeVy); // IDim definition -using IDimSp = SpeciesInformation; -using IDimX = std::conditional_t< - UniformMeshX, - ddc::UniformPointSampling, - ddc::NonUniformPointSampling>; -using IDimY = std::conditional_t< - UniformMeshY, - ddc::UniformPointSampling, - ddc::NonUniformPointSampling>; -using IDimVx = std::conditional_t< - UniformMeshVx, - ddc::UniformPointSampling, - ddc::NonUniformPointSampling>; -using IDimVy = std::conditional_t< - UniformMeshVy, - ddc::UniformPointSampling, - ddc::NonUniformPointSampling>; +struct IDimX + : std::conditional_t< + UniformMeshX, + ddc::UniformPointSampling, + ddc::NonUniformPointSampling> +{ +}; +struct IDimY + : std::conditional_t< + UniformMeshY, + ddc::UniformPointSampling, + ddc::NonUniformPointSampling> +{ +}; +struct IDimVx + : std::conditional_t< + UniformMeshVx, + ddc::UniformPointSampling, + ddc::NonUniformPointSampling> +{ +}; +struct IDimVy + : std::conditional_t< + UniformMeshVy, + ddc::UniformPointSampling, + ddc::NonUniformPointSampling> +{ +}; // IDim initialisers using SplineInterpPointsX @@ -409,8 +432,12 @@ using RDimFx = ddc::Fourier; using RDimFy = ddc::Fourier; using CoordFx = ddc::Coordinate; using CoordFy = ddc::Coordinate; -using IDimFx = ddc::PeriodicSampling; -using IDimFy = ddc::PeriodicSampling; +struct IDimFx : ddc::PeriodicSampling +{ +}; +struct IDimFy : ddc::PeriodicSampling +{ +}; using IndexFx = ddc::DiscreteElement; using IndexFy = ddc::DiscreteElement; using IndexFxFy = ddc::DiscreteElement; @@ -443,11 +470,6 @@ class GeometryXYVxVy // template // using spatial_dim_for = std::conditional_t, IDimX, std::conditional_t, IDimY, void>>; - /** - * @brief An alias for species "discrete dimension" type. - */ - using DDimSp = IDimSp; - /** * @brief An alias for the spatial discrete domain type. */ diff --git a/src/geometryXYVxVy/poisson/fftpoissonsolver.cpp b/src/geometryXYVxVy/poisson/fftpoissonsolver.cpp index 2fe450f22..a3e017424 100644 --- a/src/geometryXYVxVy/poisson/fftpoissonsolver.cpp +++ b/src/geometryXYVxVy/poisson/fftpoissonsolver.cpp @@ -34,7 +34,7 @@ void FftPoissonSolver::operator()( m_compute_rho(rho, allfdistribu); // Build a mesh in the fourier space, for N points - IDomainFxFy const k_mesh = ddc::FourierMesh(xy_dom, false); + IDomainFxFy const k_mesh = ddc::FourierMesh(xy_dom, false); device_t, IDomainFxFy>> intermediate_chunk_alloc(k_mesh); ddc::ChunkSpan intermediate_chunk = intermediate_chunk_alloc.span_view(); diff --git a/src/speciesinfo/moments.hpp b/src/speciesinfo/moments.hpp index 420e7b645..eb43383f0 100644 --- a/src/speciesinfo/moments.hpp +++ b/src/speciesinfo/moments.hpp @@ -11,10 +11,10 @@ class Moments public: /// @brief Impl object storing attributes in `MemorySpace`. - template + template class Impl { - template + template friend class Impl; public: @@ -26,7 +26,7 @@ class Moments * @param[in] impl object from `OMemorySpace` that will be used to initialize this object on `MemorySpace` */ template - explicit Impl(Impl const& impl) + explicit Impl(Impl const& impl) { } diff --git a/src/speciesinfo/species_info.hpp b/src/speciesinfo/species_info.hpp index 11d8f9b9c..900e4ec83 100644 --- a/src/speciesinfo/species_info.hpp +++ b/src/speciesinfo/species_info.hpp @@ -11,23 +11,23 @@ class SpeciesInformation /// alias of the discrete dimension using discrete_dimension_type = SpeciesInformation; - /// alias of the discrete element of this discrete dimension - using discrete_element_type = ddc::DiscreteElement; - - /// alias of the discrete domain of this discrete dimension - using discrete_domain_type = ddc::DiscreteDomain; - - /// alias of the discrete vector of this discrete dimension - using discrete_vector_type = ddc::DiscreteVector; - public: /// @brief Impl object storing attributes in `MemorySpace`. - template + template class Impl { - template + template friend class Impl; + /// alias of the discrete element of this discrete dimension + using discrete_element_type = ddc::DiscreteElement; + + /// alias of the discrete domain of this discrete dimension + using discrete_domain_type = ddc::DiscreteDomain; + + /// alias of the discrete vector of this discrete dimension + using discrete_vector_type = ddc::DiscreteVector; + private: // charge of the particles (kinetic + adiabatic) ddc::Chunk> m_charge; @@ -54,7 +54,7 @@ class SpeciesInformation * @param[in] impl object from `OMemorySpace` that will be used to initialize this object on `MemorySpace` */ template - explicit Impl(Impl const& impl) + explicit Impl(Impl const& impl) : m_charge(impl.m_charge.domain()) , m_mass(impl.m_mass.domain()) , m_ielec(impl.m_ielec) @@ -129,26 +129,35 @@ class SpeciesInformation }; }; +template +inline constexpr bool is_species_information_v + = std::is_same_v; + +// Species dimension +struct IDimSp : SpeciesInformation +{ +}; + /// @return the discrete element representing the electron species -KOKKOS_INLINE_FUNCTION ddc::DiscreteElement ielec() +KOKKOS_INLINE_FUNCTION ddc::DiscreteElement ielec() { - return ddc::discrete_space().ielec(); + return ddc::discrete_space().ielec(); } /** * @param[in] isp a discrete element of either a kinetic or adiabatic species * @return the charge associated to the discrete element */ -KOKKOS_INLINE_FUNCTION int charge(ddc::DiscreteElement const isp) +KOKKOS_INLINE_FUNCTION int charge(ddc::DiscreteElement const isp) { - return ddc::discrete_space().charge(isp); + return ddc::discrete_space().charge(isp); } /** * @param[in] isp a discrete element of either a kinetic or adiabatic species * @return the mass associated to the discrete element */ -KOKKOS_INLINE_FUNCTION double mass(ddc::DiscreteElement const isp) +KOKKOS_INLINE_FUNCTION double mass(ddc::DiscreteElement const isp) { - return ddc::discrete_space().mass(isp); + return ddc::discrete_space().mass(isp); } diff --git a/src/utils/ddc_helper.hpp b/src/utils/ddc_helper.hpp index 7614e774a..62972ed87 100644 --- a/src/utils/ddc_helper.hpp +++ b/src/utils/ddc_helper.hpp @@ -33,11 +33,13 @@ total_interval_length(ddc::DiscreteDomain const& dom) * * @return The length of the domain. */ -template -constexpr std::enable_if_t total_interval_length( - ddc::DiscreteDomain> const& dom) +template +constexpr std::enable_if_t< + IDim::continuous_dimension_type::PERIODIC && ddc::is_uniform_sampling_v, + double> +total_interval_length(ddc::DiscreteDomain const& dom) { - return std::fabs(ddc::rlength(dom) + ddc::step>()); + return std::fabs(ddc::rlength(dom) + ddc::step()); } //TODO: this should be directly handled by ddc::Discretization really, @@ -49,11 +51,12 @@ constexpr std::enable_if_t total_interval_length( * * @return The length of the domain. */ -template -constexpr std::enable_if_t total_interval_length( - ddc::DiscreteDomain> const& dom) +template +constexpr std::enable_if_t< + IDim::continuous_dimension_type::PERIODIC && ddc::is_non_uniform_sampling_v, + double> +total_interval_length(ddc::DiscreteDomain const& dom) { - using IDim = ddc::NonUniformPointSampling; ddc::DiscreteDomain dom_periodic(dom.front(), dom.extents() + 1); return std::fabs(ddc::rlength(dom_periodic)); } diff --git a/tests/geometryRTheta/2d_spline_interpolator/2d_spline_interpolator.cpp b/tests/geometryRTheta/2d_spline_interpolator/2d_spline_interpolator.cpp index 8502684af..80c8ed46b 100644 --- a/tests/geometryRTheta/2d_spline_interpolator/2d_spline_interpolator.cpp +++ b/tests/geometryRTheta/2d_spline_interpolator/2d_spline_interpolator.cpp @@ -316,11 +316,11 @@ int main(int argc, char** argv) ddc::init_discrete_space(r_knots); ddc::init_discrete_space(p_knots); - ddc::init_discrete_space(SplineInterpPointsR::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsP::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsR::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsP::get_sampling()); - IDomainR interpolation_domain_R(SplineInterpPointsR::get_domain()); - IDomainP interpolation_domain_P(SplineInterpPointsP::get_domain()); + IDomainR interpolation_domain_R(SplineInterpPointsR::get_domain()); + IDomainP interpolation_domain_P(SplineInterpPointsP::get_domain()); IDomainRP grid(interpolation_domain_R, interpolation_domain_P); diff --git a/tests/geometryRTheta/advection_2d_rp/advection_all_tests.cpp b/tests/geometryRTheta/advection_2d_rp/advection_all_tests.cpp index 3faa9a147..263a148b7 100644 --- a/tests/geometryRTheta/advection_2d_rp/advection_all_tests.cpp +++ b/tests/geometryRTheta/advection_2d_rp/advection_all_tests.cpp @@ -280,11 +280,11 @@ int main(int argc, char** argv) ddc::init_discrete_space(r_knots); ddc::init_discrete_space(p_knots); - ddc::init_discrete_space(SplineInterpPointsR::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsP::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsR::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsP::get_sampling()); - IDomainR const interpolation_domain_R(SplineInterpPointsR::get_domain()); - IDomainP const interpolation_domain_P(SplineInterpPointsP::get_domain()); + IDomainR const interpolation_domain_R(SplineInterpPointsR::get_domain()); + IDomainP const interpolation_domain_P(SplineInterpPointsP::get_domain()); IDomainRP const grid(interpolation_domain_R, interpolation_domain_P); diff --git a/tests/geometryRTheta/advection_2d_rp/advection_selected_test.cpp b/tests/geometryRTheta/advection_2d_rp/advection_selected_test.cpp index b7a6c0c59..abe58b9da 100644 --- a/tests/geometryRTheta/advection_2d_rp/advection_selected_test.cpp +++ b/tests/geometryRTheta/advection_2d_rp/advection_selected_test.cpp @@ -151,11 +151,11 @@ int main(int argc, char** argv) ddc::init_discrete_space(r_knots); ddc::init_discrete_space(p_knots); - ddc::init_discrete_space(SplineInterpPointsR::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsP::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsR::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsP::get_sampling()); - IDomainR const interpolation_domain_R(SplineInterpPointsR::get_domain()); - IDomainP const interpolation_domain_P(SplineInterpPointsP::get_domain()); + IDomainR const interpolation_domain_R(SplineInterpPointsR::get_domain()); + IDomainP const interpolation_domain_P(SplineInterpPointsP::get_domain()); IDomainRP const grid(interpolation_domain_R, interpolation_domain_P); diff --git a/tests/geometryRTheta/advection_field_rp/advection_field_gtest.cpp b/tests/geometryRTheta/advection_field_rp/advection_field_gtest.cpp index ee3663e8b..12ea6fe0f 100644 --- a/tests/geometryRTheta/advection_field_rp/advection_field_gtest.cpp +++ b/tests/geometryRTheta/advection_field_rp/advection_field_gtest.cpp @@ -41,7 +41,7 @@ namespace { -using PoissonSolver = PolarSplineFEMPoissonSolver; +using PoissonSolver = PolarSplineFEMPoissonLikeSolver; using DiscreteMapping = DiscreteToCartesian; using Mapping = CircularToCartesian; @@ -99,11 +99,11 @@ TEST(AdvectionFieldRPComputation, TestAdvectionFieldFinder) ddc::init_discrete_space(r_knots); ddc::init_discrete_space(p_knots); - ddc::init_discrete_space(SplineInterpPointsR::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsP::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsR::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsP::get_sampling()); - IDomainR const interpolation_domain_R(SplineInterpPointsR::get_domain()); - IDomainP const interpolation_domain_P(SplineInterpPointsP::get_domain()); + IDomainR const interpolation_domain_R(SplineInterpPointsR::get_domain()); + IDomainP const interpolation_domain_P(SplineInterpPointsP::get_domain()); IDomainRP const grid(interpolation_domain_R, interpolation_domain_P); // Split the domain of the advection field along RP diff --git a/tests/geometryRTheta/polar_poisson/README.md b/tests/geometryRTheta/polar_poisson/README.md index 79ca371a8..e20ed86e4 100644 --- a/tests/geometryRTheta/polar_poisson/README.md +++ b/tests/geometryRTheta/polar_poisson/README.md @@ -7,7 +7,7 @@ The tests implemented in this folder test the 2D polar poisson solver implemente ## Polar Poisson solver -The PolarSplineFEMPoissonSolver is tested on a circular mapping (CircularToCartesian) and on a Czarny mapping (CzarnyToCartesian) with +The PolarSplineFEMPoissonLikeSolver is tested on a circular mapping (CircularToCartesian) and on a Czarny mapping (CzarnyToCartesian) with (the test cases are given in Emily Bourne's thesis [1]). The studied equation is @@ -43,7 +43,7 @@ for the same Poisson equation with the Cartesian solution. ## Contents - * polarpoissonfemsolver.cpp : it tests the PolarSplineFEMPoissonSolver. It solves the Poisson equation for a selected test case. + * polarpoissonfemsolver.cpp : it tests the PolarSplineFEMPoissonLikeSolver. It solves the Poisson equation for a selected test case. * test\_cases.hpp : it defines RHS (ManufacturedPoissonTest) and exact solutions (PoissonSolution) of the Poisson equation. * vlasovpoissonsolver.cpp : it tests the VlasovPoissonSolver. It solves the Poisson equation for a selected test case and computes the electric field in the physical domain. * poisson.yaml : the parameters of the tests. diff --git a/tests/geometryRTheta/polar_poisson/polarpoissonfemsolver.cpp b/tests/geometryRTheta/polar_poisson/polarpoissonfemsolver.cpp index 86274b852..380f2ff46 100644 --- a/tests/geometryRTheta/polar_poisson/polarpoissonfemsolver.cpp +++ b/tests/geometryRTheta/polar_poisson/polarpoissonfemsolver.cpp @@ -17,10 +17,10 @@ #include "geometry.hpp" #include "paraconfpp.hpp" #include "params.yaml.hpp" -#include "polarpoissonsolver.hpp" +#include "polarpoissonlikesolver.hpp" #include "test_cases.hpp" -using PoissonSolver = PolarSplineFEMPoissonSolver; +using PoissonSolver = PolarSplineFEMPoissonLikeSolver; #if defined(CIRCULAR_MAPPING) using Mapping = CircularToCartesian; @@ -90,11 +90,11 @@ int main(int argc, char** argv) ddc::init_discrete_space(p_knots); - ddc::init_discrete_space(SplineInterpPointsR::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsP::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsR::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsP::get_sampling()); - IDomainR interpolation_domain_R(SplineInterpPointsR::get_domain()); - IDomainP interpolation_domain_P(SplineInterpPointsP::get_domain()); + IDomainR interpolation_domain_R(SplineInterpPointsR::get_domain()); + IDomainP interpolation_domain_P(SplineInterpPointsP::get_domain()); IDomainRP grid(interpolation_domain_R, interpolation_domain_P); SplineRPBuilder const builder(grid); diff --git a/tests/geometryRTheta/polar_poisson/test_cases.hpp b/tests/geometryRTheta/polar_poisson/test_cases.hpp index 99fe91330..40f9d715a 100644 --- a/tests/geometryRTheta/polar_poisson/test_cases.hpp +++ b/tests/geometryRTheta/polar_poisson/test_cases.hpp @@ -13,7 +13,7 @@ /** * @brief Base class for the exact solutions of the Poisson equation. * - * @see PolarSplineFEMPoissonSolver + * @see PolarSplineFEMPoissonLikeSolver * @see VlasovPoissonSolver */ template diff --git a/tests/geometryRTheta/quadrature/tests_L1_and_L2_norms.cpp b/tests/geometryRTheta/quadrature/tests_L1_and_L2_norms.cpp index b1e1bb1ba..1d8f52ef5 100644 --- a/tests/geometryRTheta/quadrature/tests_L1_and_L2_norms.cpp +++ b/tests/geometryRTheta/quadrature/tests_L1_and_L2_norms.cpp @@ -223,11 +223,11 @@ TEST_P(SplineQuadrature, TestFunctions) ddc::init_discrete_space(r_knots); ddc::init_discrete_space(p_knots); - ddc::init_discrete_space(SplineInterpPointsR::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsP::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsR::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsP::get_sampling()); - IDomainR interpolation_domain_R(SplineInterpPointsR::get_domain()); - IDomainP interpolation_domain_P(SplineInterpPointsP::get_domain()); + IDomainR interpolation_domain_R(SplineInterpPointsR::get_domain()); + IDomainP interpolation_domain_P(SplineInterpPointsP::get_domain()); IDomainRP grid(interpolation_domain_R, interpolation_domain_P); SplineRPBuilder builder(grid); diff --git a/tests/geometryXVx/collisions_inter.cpp b/tests/geometryXVx/collisions_inter.cpp index 4b197e8b4..74da67db5 100644 --- a/tests/geometryXVx/collisions_inter.cpp +++ b/tests/geometryXVx/collisions_inter.cpp @@ -41,11 +41,11 @@ TEST(CollisionsInter, CollisionsInter) ddc::init_discrete_space(vx_min, vx_max, vx_size); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); - IDomainX interpolation_domain_x(SplineInterpPointsX::get_domain()); - IDomainVx interpolation_domain_vx(SplineInterpPointsVx::get_domain()); + IDomainX interpolation_domain_x(SplineInterpPointsX::get_domain()); + IDomainVx interpolation_domain_vx(SplineInterpPointsVx::get_domain()); SplineXBuilder_1d const builder_x(interpolation_domain_x); diff --git a/tests/geometryXVx/collisions_intra_gridvx.cpp b/tests/geometryXVx/collisions_intra_gridvx.cpp index 5cb94d5d8..a80c3d439 100644 --- a/tests/geometryXVx/collisions_intra_gridvx.cpp +++ b/tests/geometryXVx/collisions_intra_gridvx.cpp @@ -41,11 +41,11 @@ TEST(CollisionsIntraGridvx, CollisionsIntraGridvx) ddc::init_discrete_space(vx_min, vx_max, vx_size); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); - IDomainX interpolation_domain_x(SplineInterpPointsX::get_domain()); - IDomainVx interpolation_domain_vx(SplineInterpPointsVx::get_domain()); + IDomainX interpolation_domain_x(SplineInterpPointsX::get_domain()); + IDomainVx interpolation_domain_vx(SplineInterpPointsVx::get_domain()); SplineXBuilder_1d const builder_x(interpolation_domain_x); diff --git a/tests/geometryXVx/collisions_intra_maxwellian.cpp b/tests/geometryXVx/collisions_intra_maxwellian.cpp index 10d397b34..b2332043d 100644 --- a/tests/geometryXVx/collisions_intra_maxwellian.cpp +++ b/tests/geometryXVx/collisions_intra_maxwellian.cpp @@ -46,11 +46,11 @@ TEST(CollisionsIntraMaxwellian, CollisionsIntraMaxwellian) ddc::init_discrete_space(vx_min, vx_max, vx_size); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); - IDomainX interpolation_domain_x(SplineInterpPointsX::get_domain()); - IDomainVx interpolation_domain_vx(SplineInterpPointsVx::get_domain()); + IDomainX interpolation_domain_x(SplineInterpPointsX::get_domain()); + IDomainVx interpolation_domain_vx(SplineInterpPointsVx::get_domain()); SplineXBuilder_1d const builder_x(interpolation_domain_x); diff --git a/tests/geometryXVx/femnonperiodicpoissonsolver.cpp b/tests/geometryXVx/femnonperiodicpoissonsolver.cpp index 7128f186b..38456eba2 100644 --- a/tests/geometryXVx/femnonperiodicpoissonsolver.cpp +++ b/tests/geometryXVx/femnonperiodicpoissonsolver.cpp @@ -35,10 +35,10 @@ TEST(FemNonPeriodicPoissonSolver, Ordering) ddc::init_discrete_space(vx_min, vx_max, vx_size); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); - ddc::DiscreteDomain interpolation_domain_x(SplineInterpPointsX::get_domain()); - ddc::DiscreteDomain interpolation_domain_vx(SplineInterpPointsVx::get_domain()); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); + ddc::DiscreteDomain interpolation_domain_x(SplineInterpPointsX::get_domain()); + ddc::DiscreteDomain interpolation_domain_vx(SplineInterpPointsVx::get_domain()); SplineXBuilder_1d const builder_x(interpolation_domain_x); diff --git a/tests/geometryXVx/femperiodicpoissonsolver.cpp b/tests/geometryXVx/femperiodicpoissonsolver.cpp index 293aafb5e..e4a11d4d5 100644 --- a/tests/geometryXVx/femperiodicpoissonsolver.cpp +++ b/tests/geometryXVx/femperiodicpoissonsolver.cpp @@ -33,10 +33,10 @@ TEST(FemPeriodicPoissonSolver, CosineSource) // Creating mesh & supports ddc::init_discrete_space(x_min, x_max, x_size); ddc::init_discrete_space(vx_min, vx_max, vx_size); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); - ddc::DiscreteDomain interpolation_domain_x(SplineInterpPointsX::get_domain()); - ddc::DiscreteDomain interpolation_domain_vx(SplineInterpPointsVx::get_domain()); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); + ddc::DiscreteDomain interpolation_domain_x(SplineInterpPointsX::get_domain()); + ddc::DiscreteDomain interpolation_domain_vx(SplineInterpPointsVx::get_domain()); SplineXBuilder_1d const builder_x(interpolation_domain_x); SplineVxBuilder_1d const builder_vx(interpolation_domain_vx); diff --git a/tests/geometryXVx/fftpoissonsolver.cpp b/tests/geometryXVx/fftpoissonsolver.cpp index 989a3f0e6..b0526e68a 100644 --- a/tests/geometryXVx/fftpoissonsolver.cpp +++ b/tests/geometryXVx/fftpoissonsolver.cpp @@ -34,10 +34,10 @@ TEST(FftPoissonSolver, CosineSource) ddc::init_discrete_space(vx_min, vx_max, vx_size); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); - ddc::DiscreteDomain interpolation_domain_x(SplineInterpPointsX::get_domain()); - ddc::DiscreteDomain interpolation_domain_vx(SplineInterpPointsVx::get_domain()); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); + ddc::DiscreteDomain interpolation_domain_x(SplineInterpPointsX::get_domain()); + ddc::DiscreteDomain interpolation_domain_vx(SplineInterpPointsVx::get_domain()); SplineVxBuilder_1d const builder_vx(interpolation_domain_vx); @@ -47,7 +47,7 @@ TEST(FftPoissonSolver, CosineSource) IDomainSpXVx const mesh(gridsp, gridx, gridvx); - ddc::init_discrete_space(ddc::init_fourier_space(ddc::select(mesh))); + ddc::init_discrete_space(ddc::init_fourier_space(ddc::select(mesh))); // Creating operators @@ -123,10 +123,10 @@ TEST(FftPoissonSolver, CosineSourceParallel) ddc::init_discrete_space(vx_min, vx_max, vx_size); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); - ddc::DiscreteDomain interpolation_domain_x(SplineInterpPointsX::get_domain()); - ddc::DiscreteDomain interpolation_domain_vx(SplineInterpPointsVx::get_domain()); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); + ddc::DiscreteDomain interpolation_domain_x(SplineInterpPointsX::get_domain()); + ddc::DiscreteDomain interpolation_domain_vx(SplineInterpPointsVx::get_domain()); SplineVxBuilder_1d const builder_vx(interpolation_domain_vx); @@ -136,7 +136,7 @@ TEST(FftPoissonSolver, CosineSourceParallel) IDomainSpXVx const mesh(gridsp, gridx, gridvx); - ddc::init_discrete_space(ddc::init_fourier_space(ddc::select(mesh))); + ddc::init_discrete_space(ddc::init_fourier_space(ddc::select(mesh))); // Creating operators diff --git a/tests/geometryXVx/fluid_moments.cpp b/tests/geometryXVx/fluid_moments.cpp index 9939fb87d..800bd5418 100644 --- a/tests/geometryXVx/fluid_moments.cpp +++ b/tests/geometryXVx/fluid_moments.cpp @@ -37,11 +37,11 @@ TEST(Physics, FluidMoments) ddc::init_discrete_space(x_min, x_max, x_size); ddc::init_discrete_space(vx_min, vx_max, vx_size); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); - IDomainX interpolation_domain_x(SplineInterpPointsX::get_domain()); - IDomainVx interpolation_domain_vx(SplineInterpPointsVx::get_domain()); + IDomainX interpolation_domain_x(SplineInterpPointsX::get_domain()); + IDomainVx interpolation_domain_vx(SplineInterpPointsVx::get_domain()); SplineXBuilder_1d const builder_x(interpolation_domain_x); diff --git a/tests/geometryXVx/geometryMX/fluidspecies.cpp b/tests/geometryXVx/geometryMX/fluidspecies.cpp index c13ec72fa..38e382a2c 100644 --- a/tests/geometryXVx/geometryMX/fluidspecies.cpp +++ b/tests/geometryXVx/geometryMX/fluidspecies.cpp @@ -28,9 +28,9 @@ TEST(GeometryXM, KineticFluidSpecies) // Creating mesh & supports ddc::init_discrete_space(x_min, x_max, x_size); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - IDomainX meshX(SplineInterpPointsX::get_domain()); + IDomainX meshX(SplineInterpPointsX::get_domain()); SplineXBuilder_1d const builder_x(meshX); // Kinetic species domain initialization @@ -116,9 +116,9 @@ TEST(GeometryXM, KineticFluidAdiabaticSpecies) // Creating mesh & supports ddc::init_discrete_space(x_min, x_max, x_size); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - IDomainX meshX(SplineInterpPointsX::get_domain()); + IDomainX meshX(SplineInterpPointsX::get_domain()); SplineXBuilder_1d const builder_x(meshX); // Kinetic species domain initialization diff --git a/tests/geometryXVx/geometryMX/moments.cpp b/tests/geometryXVx/geometryMX/moments.cpp index bab8f8a7c..0264cf5b2 100644 --- a/tests/geometryXVx/geometryMX/moments.cpp +++ b/tests/geometryXVx/geometryMX/moments.cpp @@ -28,9 +28,9 @@ TEST(GeometryXM, MomentsInitialization) // Creating mesh & supports ddc::init_discrete_space(x_min, x_max, x_size); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - IDomainX meshX(SplineInterpPointsX::get_domain()); + IDomainX meshX(SplineInterpPointsX::get_domain()); SplineXBuilder_1d const builder_x(meshX); // Kinetic species domain initialization diff --git a/tests/geometryXVx/geometryMX/predcorr_hybrid.cpp b/tests/geometryXVx/geometryMX/predcorr_hybrid.cpp index 3b2811ebf..292818e3c 100644 --- a/tests/geometryXVx/geometryMX/predcorr_hybrid.cpp +++ b/tests/geometryXVx/geometryMX/predcorr_hybrid.cpp @@ -59,11 +59,11 @@ TEST(GeometryXM, PredCorrHybrid) ddc::init_discrete_space(vx_min, vx_max, vx_ncells); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); - IDomainX meshX(SplineInterpPointsX::get_domain()); - IDomainVx meshVx(SplineInterpPointsVx::get_domain()); + IDomainX meshX(SplineInterpPointsX::get_domain()); + IDomainVx meshVx(SplineInterpPointsVx::get_domain()); IDomainXVx meshXVx(meshX, meshVx); SplineXBuilder const builder_x(meshXVx); @@ -222,7 +222,8 @@ TEST(GeometryXM, PredCorrHybrid) ChargeDensityCalculator rhs(quadrature_coeffs); #ifdef PERIODIC_RDIMX IDomainSpXVx const meshSpXVx(dom_kinsp, meshXVx); - ddc::init_discrete_space(ddc::init_fourier_space(ddc::select(meshSpXVx))); + ddc::init_discrete_space( + ddc::init_fourier_space(ddc::select(meshSpXVx))); FftPoissonSolver const poisson(rhs); #else FemNonPeriodicPoissonSolver const poisson(builder_x_poisson, spline_x_evaluator_poisson, rhs); diff --git a/tests/geometryXVx/kineticsource.cpp b/tests/geometryXVx/kineticsource.cpp index d4a2a1e7c..87f014202 100644 --- a/tests/geometryXVx/kineticsource.cpp +++ b/tests/geometryXVx/kineticsource.cpp @@ -36,11 +36,11 @@ TEST(KineticSource, Moments) ddc::init_discrete_space(vx_min, vx_max, vx_size); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); - IDomainX interpolation_domain_x(SplineInterpPointsX::get_domain()); - IDomainVx interpolation_domain_vx(SplineInterpPointsVx::get_domain()); + IDomainX interpolation_domain_x(SplineInterpPointsX::get_domain()); + IDomainVx interpolation_domain_vx(SplineInterpPointsVx::get_domain()); SplineXBuilder_1d const builder_x(interpolation_domain_x); diff --git a/tests/geometryXVx/krooksource.cpp b/tests/geometryXVx/krooksource.cpp index a13b8abce..5aa3d452f 100644 --- a/tests/geometryXVx/krooksource.cpp +++ b/tests/geometryXVx/krooksource.cpp @@ -44,11 +44,11 @@ TEST(KrookSource, Adaptive) ddc::init_discrete_space(x_min, x_max, x_size); ddc::init_discrete_space(vx_min, vx_max, vx_size); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); - IDomainX gridx(SplineInterpPointsX::get_domain()); - IDomainVx gridvx(SplineInterpPointsVx::get_domain()); + IDomainX gridx(SplineInterpPointsX::get_domain()); + IDomainVx gridvx(SplineInterpPointsVx::get_domain()); SplineXBuilder_1d const builder_x(gridx); SplineVxBuilder_1d const builder_vx(gridvx); @@ -183,11 +183,11 @@ TEST(KrookSource, Constant) ddc::init_discrete_space(vx_min, vx_max, vx_size); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); - IDomainX gridx(SplineInterpPointsX::get_domain()); - IDomainVx gridvx(SplineInterpPointsVx::get_domain()); + IDomainX gridx(SplineInterpPointsX::get_domain()); + IDomainVx gridvx(SplineInterpPointsVx::get_domain()); SplineXBuilder_1d const builder_x(gridx); SplineVxBuilder_1d const builder_vx(gridvx); diff --git a/tests/geometryXVx/lagrange_test.cpp b/tests/geometryXVx/lagrange_test.cpp index 6834eba98..29e2bb964 100644 --- a/tests/geometryXVx/lagrange_test.cpp +++ b/tests/geometryXVx/lagrange_test.cpp @@ -14,8 +14,6 @@ struct RDimZ static bool constexpr PERIODIC = false; }; -template -struct CDimZ; using CoordZ = ddc::Coordinate; @@ -23,9 +21,13 @@ using CoordZ = ddc::Coordinate; template class LagrangeTest { - using IDimZ = ddc::NonUniformPointSampling>; +public: + struct IDimZ : ddc::NonUniformPointSampling + { + }; + +private: using IVectZ = ddc::DiscreteVector; - using CDim = typename IDimZ::continuous_dimension_type; using DElemZ = ddc::DiscreteElement; const IVectZ x_size; const CoordZ x_min; @@ -65,17 +67,17 @@ class LagrangeTest int cpt = 1; std::default_random_engine generator; std::uniform_real_distribution unif_distr(-1, 1); - ddc::Chunk, ddc::DiscreteDomain> Sample_host( + ddc::Chunk, ddc::DiscreteDomain> Sample_host( interpolation_domain_x); ddc::for_each(Sample_host.domain(), [&](DElemZ const ix) { if (cpt % int(0.1 * x_size) == 0) { - Sample_host(ix) = ddc::Coordinate( + Sample_host(ix) = ddc::Coordinate( ddc::coordinate(ix).value() + (cpt > 0.1 * x_size) * (cpt < 0.9 * x_size) * perturb * unif_distr(generator) / x_size); } else { - Sample_host(ix) = ddc::Coordinate(ddc::coordinate(ix).value()); + Sample_host(ix) = ddc::Coordinate(ddc::coordinate(ix).value()); } cpt++; }); diff --git a/tests/geometryXVx/masks.cpp b/tests/geometryXVx/masks.cpp index 4f92e621f..423f7b6e6 100644 --- a/tests/geometryXVx/masks.cpp +++ b/tests/geometryXVx/masks.cpp @@ -23,9 +23,9 @@ TEST(Masks, Ordering) // Creating mesh & supports ddc::init_discrete_space(x_min, x_max, x_size); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - IDomainX gridx(SplineInterpPointsX::get_domain()); + IDomainX gridx(SplineInterpPointsX::get_domain()); SplineXBuilder_1d const builder_x(gridx); diff --git a/tests/geometryXVx/neumann_quadrature_spline.cpp b/tests/geometryXVx/neumann_quadrature_spline.cpp index 0b8337e8d..911f54a29 100644 --- a/tests/geometryXVx/neumann_quadrature_spline.cpp +++ b/tests/geometryXVx/neumann_quadrature_spline.cpp @@ -18,8 +18,8 @@ TEST(NeumannSplineQuadratureTest, ExactForConstantFunc) // Creating mesh & supports ddc::init_discrete_space(vx_min, vx_max, vx_size); - ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); - ddc::DiscreteDomain interpolation_domain_vx(SplineInterpPointsVx::get_domain()); + ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); + ddc::DiscreteDomain interpolation_domain_vx(SplineInterpPointsVx::get_domain()); SplineVxBuilder_1d const builder_vx(interpolation_domain_vx); @@ -39,19 +39,29 @@ TEST(NeumannSplineQuadratureTest, ExactForConstantFunc) template -struct Y +struct ComputeErrorTraits { - static bool constexpr PERIODIC = false; + struct Y + { + static bool constexpr PERIODIC = false; + }; + struct BSplinesY : ddc::UniformBSplines + { + }; + using GrevillePointsY = ddc:: + KnotsAsInterpolationPoints; + struct IDimY : GrevillePointsY::interpolation_mesh_type + { + }; }; template double compute_error(int n_elems) { - using DimY = Y; - using BSplinesY = ddc::UniformBSplines; - using GrevillePointsY = ddc:: - KnotsAsInterpolationPoints; - using IDimY = typename GrevillePointsY::interpolation_mesh_type; + using DimY = typename ComputeErrorTraits::Y; + using BSplinesY = typename ComputeErrorTraits::BSplinesY; + using GrevillePointsY = typename ComputeErrorTraits::GrevillePointsY; + using IDimY = typename ComputeErrorTraits::IDimY; using SplineYBuilder = ddc::SplineBuilder< Kokkos::DefaultHostExecutionSpace, Kokkos::DefaultHostExecutionSpace::memory_space, @@ -64,13 +74,13 @@ double compute_error(int n_elems) using IDomainY = ddc::DiscreteDomain; using DFieldY = device_t>; - ddc::Coordinate> const y_min(-1.0); - ddc::Coordinate> const y_max(1.0); + ddc::Coordinate const y_min(-1.0); + ddc::Coordinate const y_max(1.0); ddc::init_discrete_space(y_min, y_max, n_elems); - ddc::init_discrete_space(GrevillePointsY::get_sampling()); - IDomainY const gridy(GrevillePointsY::get_domain()); + ddc::init_discrete_space(GrevillePointsY::template get_sampling()); + IDomainY const gridy(GrevillePointsY::template get_domain()); SplineYBuilder const builder_y(gridy); diff --git a/tests/geometryXVx/quadrature.cpp b/tests/geometryXVx/quadrature.cpp index cdab8c8ce..081e40649 100644 --- a/tests/geometryXVx/quadrature.cpp +++ b/tests/geometryXVx/quadrature.cpp @@ -15,7 +15,9 @@ struct RDimXPeriod static bool constexpr PERIODIC = true; }; -using IDimXPeriod = ddc::NonUniformPointSampling; +struct IDimXPeriod : ddc::NonUniformPointSampling +{ +}; using IDomXPeriod = ddc::DiscreteDomain; using CoordXPeriod = ddc::Coordinate; @@ -83,9 +85,15 @@ TEST(QuadratureTest, SimpsonExactForConstantFunc) } template -struct Y +struct ComputeErrorTraits { - static bool constexpr PERIODIC = false; + struct Y + { + static bool constexpr PERIODIC = false; + }; + struct IDimY : ddc::NonUniformPointSampling + { + }; }; @@ -94,8 +102,8 @@ enum Method { TRAPEZ, SIMPSON }; template double compute_error(int n_elems, Method meth) { - using DimY = Y; - using IDimY = ddc::NonUniformPointSampling; + using DimY = typename ComputeErrorTraits::Y; + using IDimY = typename ComputeErrorTraits::IDimY; using IDomainY = ddc::DiscreteDomain; using DFieldY = device_t>; diff --git a/tests/geometryXVx/quadrature_spline.cpp b/tests/geometryXVx/quadrature_spline.cpp index b6c5a26b4..d3506d678 100644 --- a/tests/geometryXVx/quadrature_spline.cpp +++ b/tests/geometryXVx/quadrature_spline.cpp @@ -15,13 +15,6 @@ TEST(SplineQuadratureTest, ExactForConstantFunc) CoordX const x_max(M_PI); IVectX const x_size(10); - // Creating mesh & supports - using BSplinesX = ddc::UniformBSplines; - auto constexpr SplineXBoundary - = RDimX::PERIODIC ? ddc::BoundCond::PERIODIC : ddc::BoundCond::GREVILLE; - using GrevillePointsX - = ddc::GrevilleInterpolationPoints; - using IDimX = typename GrevillePointsX::interpolation_mesh_type; using SplineXBuilder = ddc::SplineBuilder< Kokkos::DefaultHostExecutionSpace, Kokkos::DefaultHostExecutionSpace::memory_space, @@ -36,8 +29,8 @@ TEST(SplineQuadratureTest, ExactForConstantFunc) ddc::init_discrete_space(x_min, x_max, x_size); - ddc::init_discrete_space(GrevillePointsX::get_sampling()); - IDomainX interpolation_domain_x(GrevillePointsX::get_domain()); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + IDomainX interpolation_domain_x(SplineInterpPointsX::get_domain()); SplineXBuilder const builder_x(interpolation_domain_x); @@ -56,20 +49,32 @@ TEST(SplineQuadratureTest, ExactForConstantFunc) template -struct Y +struct ComputeErrorTraits { - static bool constexpr PERIODIC = false; + struct Y + { + static bool constexpr PERIODIC = false; + }; + struct BSplinesY : ddc::UniformBSplines + { + }; + using GrevillePointsY = ddc::GrevilleInterpolationPoints< + BSplinesY, + ddc::BoundCond::GREVILLE, + ddc::BoundCond::GREVILLE>; + struct IDimY : GrevillePointsY::interpolation_mesh_type + { + }; }; template double compute_error(int n_elems) { - using DimY = Y; - using BSplinesY = ddc::UniformBSplines; + using Y = typename ComputeErrorTraits::Y; + using BSplinesY = typename ComputeErrorTraits::BSplinesY; + using GrevillePointsY = typename ComputeErrorTraits::GrevillePointsY; + using IDimY = typename ComputeErrorTraits::IDimY; auto constexpr SplineYBoundary = ddc::BoundCond::GREVILLE; - using GrevillePointsY - = ddc::GrevilleInterpolationPoints; - using IDimY = typename GrevillePointsY::interpolation_mesh_type; using SplineYBuilder = ddc::SplineBuilder< Kokkos::DefaultHostExecutionSpace, Kokkos::DefaultHostExecutionSpace::memory_space, @@ -82,13 +87,13 @@ double compute_error(int n_elems) using IDomainY = ddc::DiscreteDomain; using DFieldY = device_t>; - ddc::Coordinate> const y_min(0.0); - ddc::Coordinate> const y_max(M_PI); + ddc::Coordinate const y_min(0.0); + ddc::Coordinate const y_max(M_PI); ddc::init_discrete_space(y_min, y_max, n_elems); - ddc::init_discrete_space(GrevillePointsY::get_sampling()); - IDomainY const gridy(GrevillePointsY::get_domain()); + ddc::init_discrete_space(GrevillePointsY::template get_sampling()); + IDomainY const gridy(GrevillePointsY::template get_domain()); SplineYBuilder const builder_y(gridy); diff --git a/tests/geometryXVx/spatialadvection.cpp b/tests/geometryXVx/spatialadvection.cpp index a601541ca..4b583b097 100644 --- a/tests/geometryXVx/spatialadvection.cpp +++ b/tests/geometryXVx/spatialadvection.cpp @@ -19,10 +19,10 @@ std::pair, ddc::DiscreteDomain> Init_domain_s { ddc::init_discrete_space(x_min, x_max, x_size); ddc::init_discrete_space(vx_min, vx_max, vx_size); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); - ddc::DiscreteDomain x_dom = SplineInterpPointsX::get_domain(); - ddc::DiscreteDomain vx_dom = SplineInterpPointsVx::get_domain(); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); + ddc::DiscreteDomain x_dom = SplineInterpPointsX::get_domain(); + ddc::DiscreteDomain vx_dom = SplineInterpPointsVx::get_domain(); return {x_dom, vx_dom}; } diff --git a/tests/geometryXVx/velocityadvection.cpp b/tests/geometryXVx/velocityadvection.cpp index f81bdecff..4bc46e5b8 100644 --- a/tests/geometryXVx/velocityadvection.cpp +++ b/tests/geometryXVx/velocityadvection.cpp @@ -19,10 +19,10 @@ std::pair, ddc::DiscreteDomain> Init_domain_v { ddc::init_discrete_space(x_min, x_max, x_size); ddc::init_discrete_space(vx_min, vx_max, vx_size); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); - ddc::DiscreteDomain x_dom = SplineInterpPointsX::get_domain(); - ddc::DiscreteDomain vx_dom = SplineInterpPointsVx::get_domain(); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); + ddc::DiscreteDomain x_dom = SplineInterpPointsX::get_domain(); + ddc::DiscreteDomain vx_dom = SplineInterpPointsVx::get_domain(); return {x_dom, vx_dom}; } diff --git a/tests/geometryXYVxVy/fft_poisson.cpp b/tests/geometryXYVxVy/fft_poisson.cpp index b4ba0cbd8..2d4c3d71e 100644 --- a/tests/geometryXYVxVy/fft_poisson.cpp +++ b/tests/geometryXYVxVy/fft_poisson.cpp @@ -39,11 +39,11 @@ static void TestFftPoissonSolverCosineSource() ddc::init_discrete_space(vx_min, vx_max, vx_size); ddc::init_discrete_space(vy_min, vy_max, vy_size); - ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsVy::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsVx::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsVy::get_sampling()); - ddc::init_discrete_space(IDimX::init(x_min, x_max, x_size + 1)); - ddc::init_discrete_space(IDimY::init(y_min, y_max, y_size + 1)); + ddc::init_discrete_space(IDimX::init(x_min, x_max, x_size + 1)); + ddc::init_discrete_space(IDimY::init(y_min, y_max, y_size + 1)); IDomainSp const gridsp = IDomainSp(my_iion, IVectSp(1)); @@ -52,8 +52,8 @@ static void TestFftPoissonSolverCosineSource() IDomainXY gridxy(gridx, gridy); - IDomainVx gridvx = SplineInterpPointsVx::get_domain(); - IDomainVy gridvy = SplineInterpPointsVy::get_domain(); + IDomainVx gridvx = SplineInterpPointsVx::get_domain(); + IDomainVy gridvy = SplineInterpPointsVy::get_domain(); IDomainVxVy gridvxvy(gridvx, gridvy); @@ -64,8 +64,8 @@ static void TestFftPoissonSolverCosineSource() IDomainSpXYVxVy const mesh(gridsp, meshxyvxvy); - ddc::init_discrete_space(ddc::init_fourier_space(gridx)); - ddc::init_discrete_space(ddc::init_fourier_space(gridy)); + ddc::init_discrete_space(ddc::init_fourier_space(gridx)); + ddc::init_discrete_space(ddc::init_fourier_space(gridy)); // Initialise infomation about species host_t> charges(dom_sp); diff --git a/tests/geometryXYVxVy/quadrature.cpp b/tests/geometryXYVxVy/quadrature.cpp index 9c44c05b0..6ba2a977c 100644 --- a/tests/geometryXYVxVy/quadrature.cpp +++ b/tests/geometryXYVxVy/quadrature.cpp @@ -21,11 +21,11 @@ TEST(QuadratureTest, ExactForConstantFunc) ddc::init_discrete_space(x_min, x_max, x_size); ddc::init_discrete_space(y_min, y_max, y_size); - ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsY::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsX::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsY::get_sampling()); - IDomainX const gridx(SplineInterpPointsX::get_domain()); - IDomainY const gridy(SplineInterpPointsY::get_domain()); + IDomainX const gridx(SplineInterpPointsX::get_domain()); + IDomainY const gridy(SplineInterpPointsY::get_domain()); IDomainXY const gridxy(gridx, gridy); @@ -41,24 +41,22 @@ TEST(QuadratureTest, ExactForConstantFunc) } template -struct X +struct ComputeErrorTraits { - static bool constexpr PERIODIC = false; -}; - -template -struct Y -{ - static bool constexpr PERIODIC = false; -}; - -template -double compute_error(int n_elems) -{ - using DimX = X; - using DimY = Y; - using BSplinesX = ddc::UniformBSplines; - using BSplinesY = ddc::UniformBSplines; + struct X + { + static bool constexpr PERIODIC = false; + }; + struct Y + { + static bool constexpr PERIODIC = false; + }; + struct BSplinesX : ddc::UniformBSplines + { + }; + struct BSplinesY : ddc::UniformBSplines + { + }; using GrevillePointsX = ddc::GrevilleInterpolationPoints< BSplinesX, ddc::BoundCond::GREVILLE, @@ -67,8 +65,25 @@ double compute_error(int n_elems) BSplinesY, ddc::BoundCond::GREVILLE, ddc::BoundCond::GREVILLE>; - using IDimX = typename GrevillePointsX::interpolation_mesh_type; - using IDimY = typename GrevillePointsY::interpolation_mesh_type; + struct IDimX : GrevillePointsX::interpolation_mesh_type + { + }; + struct IDimY : GrevillePointsY::interpolation_mesh_type + { + }; +}; + +template +double compute_error(int n_elems) +{ + using DimX = typename ComputeErrorTraits::X; + using DimY = typename ComputeErrorTraits::Y; + using BSplinesX = typename ComputeErrorTraits::BSplinesX; + using BSplinesY = typename ComputeErrorTraits::BSplinesY; + using GrevillePointsX = typename ComputeErrorTraits::GrevillePointsX; + using GrevillePointsY = typename ComputeErrorTraits::GrevillePointsY; + using IDimX = typename ComputeErrorTraits::IDimX; + using IDimY = typename ComputeErrorTraits::IDimY; using IDomainX = ddc::DiscreteDomain; using IDomainY = ddc::DiscreteDomain; using IDomainXY = ddc::DiscreteDomain; @@ -83,10 +98,10 @@ double compute_error(int n_elems) ddc::init_discrete_space(x_min, x_max, n_elems); ddc::init_discrete_space(y_min, y_max, n_elems); - ddc::init_discrete_space(GrevillePointsX::get_sampling()); - ddc::init_discrete_space(GrevillePointsY::get_sampling()); - IDomainX const gridx(GrevillePointsX::get_domain()); - IDomainY const gridy(GrevillePointsY::get_domain()); + ddc::init_discrete_space(GrevillePointsX::template get_sampling()); + ddc::init_discrete_space(GrevillePointsY::template get_sampling()); + IDomainX const gridx(GrevillePointsX::template get_domain()); + IDomainY const gridy(GrevillePointsY::template get_domain()); IDomainXY const gridxy(gridx, gridy); host_t const quadrature_coeffs = trapezoid_quadrature_coefficients(gridxy); diff --git a/tests/species_info.cpp b/tests/species_info.cpp index 150d98ee0..f17868db1 100644 --- a/tests/species_info.cpp +++ b/tests/species_info.cpp @@ -8,7 +8,7 @@ namespace { -using IDimSp = SpeciesInformation; + using IVectSp = ddc::DiscreteVector; using IndexSp = ddc::DiscreteElement; using IDomainSp = ddc::DiscreteDomain; diff --git a/tests/timestepper/crank_nicolson_1d.cpp b/tests/timestepper/crank_nicolson_1d.cpp index f3ba2ad61..e1ca931e7 100644 --- a/tests/timestepper/crank_nicolson_1d.cpp +++ b/tests/timestepper/crank_nicolson_1d.cpp @@ -18,10 +18,13 @@ struct RDimX bool PERIODIC = false; }; +struct IDimX : UniformPointSampling +{ +}; + TEST(CrankNicolsonFixture, CrankNicolsonOrder) { using CoordX = Coordinate; - using IDimX = UniformPointSampling; using IndexX = DiscreteElement; using IVectX = DiscreteVector; using IDomainX = DiscreteDomain; @@ -41,7 +44,7 @@ TEST(CrankNicolsonFixture, CrankNicolsonOrder) std::array error; std::array order; - init_discrete_space(IDimX::init(x_min, x_max, x_size)); + init_discrete_space(IDimX::init(x_min, x_max, x_size)); IDomainX dom(start, x_size); CrankNicolson crank_nicolson(dom); diff --git a/tests/timestepper/crank_nicolson_2d_mixed.cpp b/tests/timestepper/crank_nicolson_2d_mixed.cpp index 24a4ce89d..05c230804 100644 --- a/tests/timestepper/crank_nicolson_2d_mixed.cpp +++ b/tests/timestepper/crank_nicolson_2d_mixed.cpp @@ -28,13 +28,19 @@ struct RDimY bool PERIODIC = false; }; +struct IDimX : UniformPointSampling +{ +}; + +struct IDimY : UniformPointSampling +{ +}; + TEST(CrankNicolson2DFixtureMixedTypes, CrankNicolson2DOrderMixedTypes) { using CoordX = Coordinate; using CoordY = Coordinate; using CoordXY = Coordinate; - using IDimX = UniformPointSampling; - using IDimY = UniformPointSampling; using IndexX = DiscreteElement; using IndexY = DiscreteElement; using IVectX = DiscreteVector; @@ -72,9 +78,9 @@ TEST(CrankNicolson2DFixtureMixedTypes, CrankNicolson2DOrderMixedTypes) std::array error; std::array order; - init_discrete_space(IDimX::init(x_min, x_max, x_size)); + init_discrete_space(IDimX::init(x_min, x_max, x_size)); IDomainX dom_x(start_x, x_size); - init_discrete_space(IDimY::init(y_min, y_max, y_size)); + init_discrete_space(IDimY::init(y_min, y_max, y_size)); IDomainY dom_y(start_y, y_size); IDomainXY dom(dom_x, dom_y); diff --git a/tests/timestepper/euler_1d.cpp b/tests/timestepper/euler_1d.cpp index de2ff3a42..c6bd3f43c 100644 --- a/tests/timestepper/euler_1d.cpp +++ b/tests/timestepper/euler_1d.cpp @@ -18,10 +18,13 @@ struct RDimX bool PERIODIC = false; }; +struct IDimX : UniformPointSampling +{ +}; + TEST(EulerFixture, EulerOrder) { using CoordX = Coordinate; - using IDimX = UniformPointSampling; using IndexX = DiscreteElement; using IVectX = DiscreteVector; using IDomainX = DiscreteDomain; @@ -41,7 +44,7 @@ TEST(EulerFixture, EulerOrder) std::array error; std::array order; - init_discrete_space(IDimX::init(x_min, x_max, x_size)); + init_discrete_space(IDimX::init(x_min, x_max, x_size)); IDomainX dom(start, x_size); Euler euler(dom); diff --git a/tests/timestepper/euler_2d_mixed.cpp b/tests/timestepper/euler_2d_mixed.cpp index a4e981f05..5218a766d 100644 --- a/tests/timestepper/euler_2d_mixed.cpp +++ b/tests/timestepper/euler_2d_mixed.cpp @@ -28,13 +28,19 @@ struct RDimY bool PERIODIC = false; }; +struct IDimX : UniformPointSampling +{ +}; + +struct IDimY : UniformPointSampling +{ +}; + TEST(Euler2DFixtureMixedTypes, Euler2DOrderMixedTypes) { using CoordX = Coordinate; using CoordY = Coordinate; using CoordXY = Coordinate; - using IDimX = UniformPointSampling; - using IDimY = UniformPointSampling; using IndexX = DiscreteElement; using IndexY = DiscreteElement; using IVectX = DiscreteVector; @@ -72,9 +78,9 @@ TEST(Euler2DFixtureMixedTypes, Euler2DOrderMixedTypes) std::array error; std::array order; - init_discrete_space(IDimX::init(x_min, x_max, x_size)); + init_discrete_space(IDimX::init(x_min, x_max, x_size)); IDomainX dom_x(start_x, x_size); - init_discrete_space(IDimY::init(y_min, y_max, y_size)); + init_discrete_space(IDimY::init(y_min, y_max, y_size)); IDomainY dom_y(start_y, y_size); IDomainXY dom(dom_x, dom_y); diff --git a/tests/timestepper/runge_kutta_1d.cpp b/tests/timestepper/runge_kutta_1d.cpp index 002c4995a..94bc09ac4 100644 --- a/tests/timestepper/runge_kutta_1d.cpp +++ b/tests/timestepper/runge_kutta_1d.cpp @@ -30,7 +30,9 @@ class RungeKuttaFixture>> static bool constexpr PERIODIC = false; }; using CoordX = Coordinate; - using IDimX = UniformPointSampling; + struct IDimX : UniformPointSampling + { + }; using IndexX = DiscreteElement; using IVectX = DiscreteVector; using IDomainX = DiscreteDomain; @@ -72,7 +74,7 @@ TYPED_TEST(RungeKuttaFixture, RungeKuttaOrder) std::array error; std::array order; - init_discrete_space(IDimX::init(x_min, x_max, x_size)); + init_discrete_space(IDimX::init(x_min, x_max, x_size)); IDomainX dom(start, x_size); RungeKutta runge_kutta(dom); diff --git a/tests/timestepper/runge_kutta_2d.cpp b/tests/timestepper/runge_kutta_2d.cpp index d17ce024e..d45100ccc 100644 --- a/tests/timestepper/runge_kutta_2d.cpp +++ b/tests/timestepper/runge_kutta_2d.cpp @@ -39,8 +39,12 @@ class RungeKutta2DFixture> }; using CoordX = Coordinate; using CoordY = Coordinate; - using IDimX = UniformPointSampling; - using IDimY = UniformPointSampling; + struct IDimX : UniformPointSampling + { + }; + struct IDimY : UniformPointSampling + { + }; using IndexX = DiscreteElement; using IndexY = DiscreteElement; using IVectX = DiscreteVector; @@ -109,9 +113,9 @@ TYPED_TEST(RungeKutta2DFixture, RungeKutta2DOrder) std::array error; std::array order; - init_discrete_space(IDimX::init(x_min, x_max, x_size)); + init_discrete_space(IDimX::init(x_min, x_max, x_size)); IDomainX dom_x(start_x, x_size); - init_discrete_space(IDimY::init(y_min, y_max, y_size)); + init_discrete_space(IDimY::init(y_min, y_max, y_size)); IDomainY dom_y(start_y, y_size); IDomainXY dom(dom_x, dom_y); diff --git a/tests/timestepper/runge_kutta_2d_mixed.cpp b/tests/timestepper/runge_kutta_2d_mixed.cpp index 37a4c1553..16dbded9c 100644 --- a/tests/timestepper/runge_kutta_2d_mixed.cpp +++ b/tests/timestepper/runge_kutta_2d_mixed.cpp @@ -40,8 +40,12 @@ class RungeKutta2DFixtureMixedTypes; using CoordY = Coordinate; using CoordXY = Coordinate; - using IDimX = UniformPointSampling; - using IDimY = UniformPointSampling; + struct IDimX : UniformPointSampling + { + }; + struct IDimY : UniformPointSampling + { + }; using IndexX = DiscreteElement; using IndexY = DiscreteElement; using IVectX = DiscreteVector; @@ -115,9 +119,9 @@ TYPED_TEST(RungeKutta2DFixtureMixedTypes, RungeKutta2DOrderMixedTypes) std::array error; std::array order; - init_discrete_space(IDimX::init(x_min, x_max, x_size)); + init_discrete_space(IDimX::init(x_min, x_max, x_size)); IDomainX dom_x(start_x, x_size); - init_discrete_space(IDimY::init(y_min, y_max, y_size)); + init_discrete_space(IDimY::init(y_min, y_max, y_size)); IDomainY dom_y(start_y, y_size); IDomainXY dom(dom_x, dom_y); diff --git a/tests/utils/field.cpp b/tests/utils/field.cpp index 41deb8c43..4fbd77aff 100644 --- a/tests/utils/field.cpp +++ b/tests/utils/field.cpp @@ -29,7 +29,9 @@ using VectorField0D = VectorField; template using VectorFieldSpan0D = VectorFieldSpan; -struct DDimX; +struct DDimX +{ +}; using DElemX = ddc::DiscreteElement; using DVectX = ddc::DiscreteVector; using DDomX = ddc::DiscreteDomain; @@ -40,7 +42,9 @@ template using VectorFieldSpanX = VectorFieldSpan; -struct DDimY; +struct DDimY +{ +}; using DElemY = ddc::DiscreteElement; using DVectY = ddc::DiscreteVector; using DDomY = ddc::DiscreteDomain; @@ -51,7 +55,9 @@ template using VectorFieldSpanY = VectorFieldSpan; -struct DDimZ; +struct DDimZ +{ +}; using DElemZ = ddc::DiscreteElement; using DVectZ = ddc::DiscreteVector; using DDomZ = ddc::DiscreteDomain; diff --git a/tests/utils/test_ddcHelpers.cpp b/tests/utils/test_ddcHelpers.cpp index b9d2641f9..c3343608e 100644 --- a/tests/utils/test_ddcHelpers.cpp +++ b/tests/utils/test_ddcHelpers.cpp @@ -17,21 +17,28 @@ class Tag using Coord = Coordinate; +struct IDimUniform : UniformPointSampling +{ +}; + +struct IDimNonUniform : NonUniformPointSampling +{ +}; + } // namespace TEST(DDCHelper, UniformPeriodicRestriction) { - using IDim = UniformPointSampling; - using Index = DiscreteElement; - using IVect = DiscreteVector; - using IDomain = DiscreteDomain; + using Index = DiscreteElement; + using IVect = DiscreteVector; + using IDomain = DiscreteDomain; Coord x_min(-1.0); Coord x_max(1.0); IVect x_size(5); double x_len = x_max - x_min; - init_discrete_space(IDim::init(x_min, x_max, x_size + 1)); + init_discrete_space(IDimUniform::init(x_min, x_max, x_size + 1)); IDomain dom(Index(0), x_size); @@ -63,10 +70,9 @@ TEST(DDCHelper, UniformPeriodicRestriction) TEST(DDCHelper, NonUniformPeriodicRestriction) { - using IDim = NonUniformPointSampling; - using Index = DiscreteElement; - using IVect = DiscreteVector; - using IDomain = DiscreteDomain; + using Index = DiscreteElement; + using IVect = DiscreteVector; + using IDomain = DiscreteDomain; Coord x_min(-1.0); Coord x_max(1.0); @@ -79,7 +85,7 @@ TEST(DDCHelper, NonUniformPeriodicRestriction) } nu_points[5] = x_max; - init_discrete_space(nu_points); + init_discrete_space(nu_points); IDomain dom(Index(0), x_size); diff --git a/vendor/ddc/.github/workflows/tests.yml b/vendor/ddc/.github/workflows/tests.yml index 0acbaaf6a..cb6fd7ae3 100644 --- a/vendor/ddc/.github/workflows/tests.yml +++ b/vendor/ddc/.github/workflows/tests.yml @@ -135,7 +135,7 @@ jobs: 'hip') export CC=hipcc export CXX=hipcc - EXTRA_CMAKE_FLAGS="-DKokkos_ENABLE_HIP=ON -DKokkos_ARCH_VEGA90A=ON -DCMAKE_PREFIX_PATH=/opt/rocm" + EXTRA_CMAKE_FLAGS="-DKokkos_ENABLE_HIP=ON -DKokkos_ENABLE_ROCTHRUST=OFF -DKokkos_ARCH_VEGA90A=ON -DCMAKE_PREFIX_PATH=/opt/rocm" ;; 'cpu-clang') export CC=clang diff --git a/vendor/ddc/README.md b/vendor/ddc/README.md index 0ad192c11..6c2cf3eeb 100644 --- a/vendor/ddc/README.md +++ b/vendor/ddc/README.md @@ -28,7 +28,8 @@ If you want to know more, join un on [Slack](https://join.slack.com/t/ddc-lib/sh ## Getting the code and basic configuration ```bash -git clone --recurse-submodules -j8 https://github.com/CExA-project/ddc.git +git clone --recurse-submodules -j4 https://github.com/CExA-project/ddc.git cd ddc cmake -B build -D DDC_BUILD_KERNELS_FFT=OFF -D DDC_BUILD_KERNELS_SPLINES=OFF -D DDC_BUILD_PDI_WRAPPER=OFF +cmake --build build ``` diff --git a/vendor/ddc/benchmarks/deepcopy.cpp b/vendor/ddc/benchmarks/deepcopy.cpp index 3c32ecd8d..d4518e415 100644 --- a/vendor/ddc/benchmarks/deepcopy.cpp +++ b/vendor/ddc/benchmarks/deepcopy.cpp @@ -14,7 +14,9 @@ namespace { -struct DDimX; +struct DDimX +{ +}; using DElemX = ddc::DiscreteElement; using DVectX = ddc::DiscreteVector; using DDomX = ddc::DiscreteDomain; @@ -23,7 +25,9 @@ template using ChunkSpanX = ddc::ChunkSpan; -struct DDimY; +struct DDimY +{ +}; using DElemXY = ddc::DiscreteElement; diff --git a/vendor/ddc/benchmarks/splines.cpp b/vendor/ddc/benchmarks/splines.cpp index f9f5b8cab..0bcc24bb0 100644 --- a/vendor/ddc/benchmarks/splines.cpp +++ b/vendor/ddc/benchmarks/splines.cpp @@ -23,13 +23,19 @@ struct X static constexpr bool PERIODIC = true; }; -using BSplinesX = ddc::UniformBSplines; +struct BSplinesX : ddc::UniformBSplines +{ +}; using GrevillePoints = ddc:: GrevilleInterpolationPoints; -using DDimX = GrevillePoints::interpolation_mesh_type; +struct DDimX : GrevillePoints::interpolation_mesh_type +{ +}; struct Y; -using DDimY = ddc::UniformPointSampling; +struct DDimY : ddc::UniformPointSampling +{ +}; } // namespace @@ -78,17 +84,16 @@ static void characteristics_advection(benchmark::State& state) ddc::init_discrete_space(ddc::GrevilleInterpolationPoints< BSplinesX, ddc::BoundCond::PERIODIC, - ddc::BoundCond::PERIODIC>::get_sampling()); - ddc::DiscreteDomain y_domain - = ddc::init_discrete_space(DDimY:: - init(ddc::Coordinate(-1.), - ddc::Coordinate(1.), - ddc::DiscreteVector(state.range(1)))); + ddc::BoundCond::PERIODIC>::get_sampling()); + ddc::DiscreteDomain y_domain = ddc::init_discrete_space(DDimY::init( + ddc::Coordinate(-1.), + ddc::Coordinate(1.), + ddc::DiscreteVector(state.range(1)))); auto const x_domain = ddc::GrevilleInterpolationPoints< BSplinesX, ddc::BoundCond::PERIODIC, - ddc::BoundCond::PERIODIC>::get_domain(); + ddc::BoundCond::PERIODIC>::get_domain(); ddc::Chunk density_alloc( ddc::DiscreteDomain(x_domain, y_domain), ddc::DeviceAllocator()); @@ -170,7 +175,7 @@ static void characteristics_advection(benchmark::State& state) /// variables, which is always a bad idea. /// //////////////////////////////////////////////////// ddc::detail::g_discrete_space_dual.reset(); - ddc::detail::g_discrete_space_dual.reset(); + ddc::detail::g_discrete_space_dual>.reset(); ddc::detail::g_discrete_space_dual.reset(); ddc::detail::g_discrete_space_dual.reset(); //////////////////////////////////////////////////// diff --git a/vendor/ddc/docs/About.md b/vendor/ddc/docs/About.md index 3cac52731..373ef4160 100644 --- a/vendor/ddc/docs/About.md +++ b/vendor/ddc/docs/About.md @@ -1,11 +1,11 @@ +\mainpage About + -\mainpage About - %DDC is the discrete domain computation library, a C++-17 library that aims to offer to the C++/MPI world an equivalent to the [`xarray.DataArray`](https://xarray.pydata.org/en/stable/generated/xarray.DataArray.html)/[`dask.Array`](https://docs.dask.org/en/stable/array.html) diff --git a/vendor/ddc/examples/characteristics_advection.cpp b/vendor/ddc/examples/characteristics_advection.cpp index e9a45d1f5..98fd86d77 100644 --- a/vendor/ddc/examples/characteristics_advection.cpp +++ b/vendor/ddc/examples/characteristics_advection.cpp @@ -25,26 +25,34 @@ struct X //! [X-discretization] /// A uniform discretization of X -using BSplinesX = ddc::UniformBSplines; +struct BSplinesX : ddc::UniformBSplines +{ +}; using GrevillePoints = ddc::GrevilleInterpolationPoints< BSplinesX, ddc::BoundCond::PERIODIC, ddc::BoundCond::PERIODIC>; -using DDimX = GrevillePoints::interpolation_mesh_type; +struct DDimX : GrevillePoints::interpolation_mesh_type +{ +}; //! [X-discretization] //! [Y-space] // Our second continuous dimension struct Y; // Its uniform discretization -using DDimY = ddc::UniformPointSampling; +struct DDimY : ddc::UniformPointSampling +{ +}; //! [Y-space] //! [time-space] // Our simulated time dimension struct T; // Its uniform discretization -using DDimT = ddc::UniformPointSampling; +struct DDimT : ddc::UniformPointSampling +{ +}; //! [time-space] //! [display] @@ -125,19 +133,19 @@ int main(int argc, char** argv) ddc::GrevilleInterpolationPoints< BSplinesX, ddc::BoundCond::PERIODIC, - ddc::BoundCond::PERIODIC>::get_sampling()); + ddc::BoundCond::PERIODIC>::get_sampling()); auto const x_domain = ddc::GrevilleInterpolationPoints< BSplinesX, ddc::BoundCond::PERIODIC, - ddc::BoundCond::PERIODIC>::get_domain(); + ddc::BoundCond::PERIODIC>::get_domain(); //! [X-global-domain] // Initialization of the global domain in Y - auto const y_domain = ddc::init_discrete_space( - DDimY:: - init(ddc::Coordinate(y_start), - ddc::Coordinate(y_end), - ddc::DiscreteVector(nb_y_points))); + auto const y_domain + = ddc::init_discrete_space(DDimY::init( + ddc::Coordinate(y_start), + ddc::Coordinate(y_end), + ddc::DiscreteVector(nb_y_points))); //! [time-domains] @@ -148,11 +156,10 @@ int main(int argc, char** argv) // - the number of discrete time-points is equal to the number of // steps + 1 ddc::DiscreteDomain const time_domain - = ddc::init_discrete_space( - DDimT:: - init(ddc::Coordinate(start_time), - ddc::Coordinate(end_time), - nb_time_steps + 1)); + = ddc::init_discrete_space(DDimT::init( + ddc::Coordinate(start_time), + ddc::Coordinate(end_time), + nb_time_steps + 1)); //! [time-domains] //! [data allocation] diff --git a/vendor/ddc/examples/game_of_life.cpp b/vendor/ddc/examples/game_of_life.cpp index dc3e9492a..ec801a70e 100644 --- a/vendor/ddc/examples/game_of_life.cpp +++ b/vendor/ddc/examples/game_of_life.cpp @@ -10,8 +10,12 @@ using cell = bool; // Name of the axis -struct DDimX; -struct DDimY; +struct DDimX +{ +}; +struct DDimY +{ +}; static unsigned nt = 10; static unsigned length = 5; diff --git a/vendor/ddc/examples/heat_equation.cpp b/vendor/ddc/examples/heat_equation.cpp index 2b7867de5..4a24a4f54 100644 --- a/vendor/ddc/examples/heat_equation.cpp +++ b/vendor/ddc/examples/heat_equation.cpp @@ -19,21 +19,27 @@ struct X; //! [X-discretization] /// A uniform discretization of X -using DDimX = ddc::UniformPointSampling; +struct DDimX : ddc::UniformPointSampling +{ +}; //! [X-discretization] //! [Y-space] // Our second continuous dimension struct Y; // Its uniform discretization -using DDimY = ddc::UniformPointSampling; +struct DDimY : ddc::UniformPointSampling +{ +}; //! [Y-space] //! [time-space] // Our simulated time dimension struct T; // Its uniform discretization -using DDimT = ddc::UniformPointSampling; +struct DDimT : ddc::UniformPointSampling +{ +}; //! [time-space] @@ -130,7 +136,7 @@ int main(int argc, char** argv) // Initialization of the global domain in X with gwx ghost points on // each side auto const [x_domain, ghosted_x_domain, x_pre_ghost, x_post_ghost] - = ddc::init_discrete_space(DDimX::init_ghosted( + = ddc::init_discrete_space(DDimX::init_ghosted( ddc::Coordinate(x_start), ddc::Coordinate(x_end), ddc::DiscreteVector(nb_x_points), @@ -156,7 +162,7 @@ int main(int argc, char** argv) // Initialization of the global domain in Y with gwy ghost points on // each side auto const [y_domain, ghosted_y_domain, y_pre_ghost, y_post_ghost] - = ddc::init_discrete_space(DDimY::init_ghosted( + = ddc::init_discrete_space(DDimY::init_ghosted( ddc::Coordinate(y_start), ddc::Coordinate(y_end), ddc::DiscreteVector(nb_y_points), @@ -206,11 +212,10 @@ int main(int argc, char** argv) // steps + 1 // `init` takes required information to initialize the attributes of the dimension. ddc::DiscreteDomain const time_domain - = ddc::init_discrete_space( - DDimT:: - init(ddc::Coordinate(start_time), - ddc::Coordinate(end_time), - nb_time_steps + 1)); + = ddc::init_discrete_space(DDimT::init( + ddc::Coordinate(start_time), + ddc::Coordinate(end_time), + nb_time_steps + 1)); //! [time-domains] //! [data allocation] diff --git a/vendor/ddc/examples/heat_equation_spectral.cpp b/vendor/ddc/examples/heat_equation_spectral.cpp index e875581ba..e906656b6 100644 --- a/vendor/ddc/examples/heat_equation_spectral.cpp +++ b/vendor/ddc/examples/heat_equation_spectral.cpp @@ -21,21 +21,35 @@ struct X; //! [X-discretization] /// A uniform discretization of X -using DDimX = ddc::UniformPointSampling; +struct DDimX : ddc::UniformPointSampling +{ +}; //! [X-discretization] +struct DDimFx : ddc::PeriodicSampling> +{ +}; + //! [Y-space] // Our second continuous dimension struct Y; // Its uniform discretization -using DDimY = ddc::UniformPointSampling; +struct DDimY : ddc::UniformPointSampling +{ +}; + +struct DDimFy : ddc::PeriodicSampling> +{ +}; //! [Y-space] //! [time-space] // Our simulated time dimension struct T; // Its uniform discretization -using DDimT = ddc::UniformPointSampling; +struct DDimT : ddc::UniformPointSampling +{ +}; //! [time-space] //! [display] @@ -110,20 +124,20 @@ int main(int argc, char** argv) //! [X-global-domain] // Initialization of the global domain in X with gwx ghost points on // each side - auto const x_domain = ddc::init_discrete_space( - DDimX:: - init(ddc::Coordinate(x_start), - ddc::Coordinate(x_end), - ddc::DiscreteVector(nb_x_points))); + auto const x_domain + = ddc::init_discrete_space(DDimX::init( + ddc::Coordinate(x_start), + ddc::Coordinate(x_end), + ddc::DiscreteVector(nb_x_points))); //! [X-global-domain] // Initialization of the global domain in Y with gwy ghost points on // each side - auto const y_domain = ddc::init_discrete_space( - DDimY:: - init(ddc::Coordinate(y_start), - ddc::Coordinate(y_end), - ddc::DiscreteVector(nb_y_points))); + auto const y_domain + = ddc::init_discrete_space(DDimY::init( + ddc::Coordinate(y_start), + ddc::Coordinate(y_end), + ddc::DiscreteVector(nb_y_points))); //! [time-domains] // max(1/dx^2) @@ -158,12 +172,10 @@ int main(int argc, char** argv) // - the number of discrete time-points is equal to the number of // steps + 1 ddc::DiscreteDomain const time_domain - = ddc::init_discrete_space( - DDimT:: - init(ddc::Coordinate(start_time), - ddc::Coordinate(end_time), - nb_time_steps + 1)); - //! [time-domains] + = ddc::init_discrete_space(DDimT::init( + ddc::Coordinate(start_time), + ddc::Coordinate(end_time), + nb_time_steps + 1)); //! [data allocation] // Maps temperature into the full domain (including ghosts) twice: @@ -211,16 +223,12 @@ int main(int argc, char** argv) ddc::DiscreteElement last_output = time_domain.front(); //! [initial output] - ddc::init_discrete_space>>( - ddc::init_fourier_space( - ddc::DiscreteDomain(initial_temp.domain()))); - ddc::init_discrete_space>>( - ddc::init_fourier_space( - ddc::DiscreteDomain(initial_temp.domain()))); - ddc::DiscreteDomain< - ddc::PeriodicSampling>, - ddc::PeriodicSampling>> const k_mesh - = ddc::FourierMesh(initial_temp.domain(), false); + ddc::init_discrete_space(ddc::init_fourier_space( + ddc::DiscreteDomain(initial_temp.domain()))); + ddc::init_discrete_space(ddc::init_fourier_space( + ddc::DiscreteDomain(initial_temp.domain()))); + ddc::DiscreteDomain const k_mesh = ddc:: + FourierMesh(initial_temp.domain(), false); ddc::Chunk Ff_allocation = ddc:: Chunk("Ff_allocation", k_mesh, @@ -249,20 +257,12 @@ int main(int argc, char** argv) ddc::fft(Kokkos::DefaultExecutionSpace(), Ff, last_temp, {norm}); ddc::parallel_for_each( k_mesh, - KOKKOS_LAMBDA(ddc::DiscreteElement< - ddc::PeriodicSampling>, - ddc::PeriodicSampling< - ddc::Fourier>> const ikxky) { - ddc::DiscreteElement< - ddc::PeriodicSampling>> const - ikx - = ddc::select>>(ikxky); - ddc::DiscreteElement< - ddc::PeriodicSampling>> const - iky - = ddc::select>>(ikxky); + KOKKOS_LAMBDA(ddc::DiscreteElement const + ikxky) { + ddc::DiscreteElement const ikx + = ddc::select(ikxky); + ddc::DiscreteElement const iky + = ddc::select(ikxky); Ff(ikx, iky) = Ff(ikx, iky) * (1 diff --git a/vendor/ddc/include/ddc/ddc.hpp b/vendor/ddc/include/ddc/ddc.hpp index 8e549aacd..28b07c1b4 100644 --- a/vendor/ddc/include/ddc/ddc.hpp +++ b/vendor/ddc/include/ddc/ddc.hpp @@ -25,7 +25,6 @@ #include "ddc/discrete_vector.hpp" #include "ddc/non_uniform_point_sampling.hpp" #include "ddc/periodic_sampling.hpp" -#include "ddc/rectilinear_domain.hpp" #include "ddc/uniform_point_sampling.hpp" // Algorithms diff --git a/vendor/ddc/include/ddc/detail/dual_discretization.hpp b/vendor/ddc/include/ddc/detail/dual_discretization.hpp index ae8e091c8..3cb4c1eff 100644 --- a/vendor/ddc/include/ddc/detail/dual_discretization.hpp +++ b/vendor/ddc/include/ddc/detail/dual_discretization.hpp @@ -21,11 +21,11 @@ namespace ddc::detail { template class DualDiscretization { - using DDimImplHost = typename DDim::template Impl; + using DDimImplHost = typename DDim::template Impl; #if defined(__CUDACC__) - using DDimImplDevice = typename DDim::template Impl; + using DDimImplDevice = typename DDim::template Impl; #elif defined(__HIPCC__) - using DDimImplDevice = typename DDim::template Impl; + using DDimImplDevice = typename DDim::template Impl; #else using DDimImplDevice = DDimImplHost; #endif @@ -46,7 +46,7 @@ class DualDiscretization } template - KOKKOS_FUNCTION typename DDim::template Impl const& get() + KOKKOS_FUNCTION typename DDim::template Impl const& get() { if constexpr (std::is_same_v) { return m_host; diff --git a/vendor/ddc/include/ddc/discrete_domain.hpp b/vendor/ddc/include/ddc/discrete_domain.hpp index 0f927eb38..e00689e9d 100644 --- a/vendor/ddc/include/ddc/discrete_domain.hpp +++ b/vendor/ddc/include/ddc/discrete_domain.hpp @@ -255,7 +255,7 @@ class DiscreteDomain<> return 0; } - constexpr DiscreteDomain() = default; + KOKKOS_DEFAULTED_FUNCTION constexpr DiscreteDomain() = default; // Construct a DiscreteDomain from a reordered copy of `domain` template @@ -427,6 +427,20 @@ KOKKOS_FUNCTION constexpr auto remove_dims_of( return detail::convert_type_seq_to_discrete_domain(DDom_a); } +//! Remove the dimensions DDimsB from DDom_a +//! @param[in] DDom_a The discrete domain on which to remove dimensions +//! @return The discrete domain without DDimsB dimensions +template +KOKKOS_FUNCTION constexpr auto remove_dims_of(DDomA const& DDom_a) noexcept +{ + using TagSeqA = typename detail::ToTypeSeq::type; + using TagSeqB = detail::TypeSeq; + + using type_seq_r = type_seq_remove_t; + return detail::convert_type_seq_to_discrete_domain(DDom_a); +} + +namespace detail { // Checks if dimension of DDom_a is DDim1. If not, returns restriction to DDim2 of DDom_b. May not be usefull in its own, it helps for replace_dim_of template @@ -445,6 +459,8 @@ replace_dim_of_1d( } } +} // namespace detail + // Replace in DDom_a the dimension Dim1 by the dimension Dim2 of DDom_b template KOKKOS_FUNCTION constexpr auto replace_dim_of( @@ -458,7 +474,7 @@ KOKKOS_FUNCTION constexpr auto replace_dim_of( using type_seq_r = ddc::type_seq_replace_t; return ddc::detail::convert_type_seq_to_discrete_domain( - replace_dim_of_1d< + detail::replace_dim_of_1d< DDim1, DDim2, DDimsA, diff --git a/vendor/ddc/include/ddc/discrete_space.hpp b/vendor/ddc/include/ddc/discrete_space.hpp index f88d1f114..f0e0e9eb2 100644 --- a/vendor/ddc/include/ddc/discrete_space.hpp +++ b/vendor/ddc/include/ddc/discrete_space.hpp @@ -67,7 +67,7 @@ void hip_throw_on_error(T const err, const char* const func, const char* const f #endif template -using ddim_impl_t = typename DDim::template Impl; +using ddim_impl_t = typename DDim::template Impl; template class gpu_proxy @@ -150,6 +150,9 @@ auto extract_after(Tuple&& t, std::index_sequence) template void init_discrete_space(Args&&... args) { + static_assert( + !std::is_same_v, + "Discrete dimensions should inherit from the discretization, not use an alias"); if (detail::g_discrete_space_dual) { throw std::runtime_error("Discrete space function already initialized."); } @@ -175,10 +178,9 @@ void init_discrete_space(Args&&... args) * @param a - the discrete space to move at index 0 * - the arguments to pass through at index 1 */ -template +template Arg0 init_discrete_space(std::tuple&& a) { - using DDim = typename DDimImpl::discrete_dimension_type; init_discrete_space(std::move(std::get<0>(a))); return std::get<1>(a); } @@ -188,10 +190,9 @@ Arg0 init_discrete_space(std::tuple&& a) * @param a - the discrete space to move at index 0 * - the (2+) arguments to pass through in other indices */ -template +template std::tuple init_discrete_space(std::tuple&& a) { - using DDim = typename DDimImpl::discrete_dimension_type; init_discrete_space(std::move(std::get<0>(a))); return detail::extract_after(std::move(a), std::index_sequence_for()); } diff --git a/vendor/ddc/include/ddc/experimental/single_discretization.hpp b/vendor/ddc/include/ddc/experimental/single_discretization.hpp index 111050d86..783b5edc6 100644 --- a/vendor/ddc/include/ddc/experimental/single_discretization.hpp +++ b/vendor/ddc/include/ddc/experimental/single_discretization.hpp @@ -13,9 +13,11 @@ #include "ddc/discrete_element.hpp" #include "ddc/discrete_space.hpp" -namespace ddc { +namespace ddc::experimental { -namespace experimental { +struct SingleDiscretizationBase +{ +}; /** Experimental concept representing a discretization with a single point. * @@ -23,7 +25,7 @@ namespace experimental { * loose track of the real position. */ template -class SingleDiscretization +class SingleDiscretization : SingleDiscretizationBase { public: using continuous_dimension_type = CDim; @@ -33,16 +35,11 @@ class SingleDiscretization using discrete_dimension_type = SingleDiscretization; - using discrete_domain_type = DiscreteDomain; - - using discrete_element_type = DiscreteElement; - - using discrete_vector_type = DiscreteVector; - - template +public: + template class Impl { - template + template friend class Impl; private: @@ -52,19 +49,30 @@ class SingleDiscretization public: using discrete_dimension_type = SingleDiscretization; - constexpr Impl(continuous_element_type origin) noexcept : m_point(std::move(origin)) {} + using discrete_domain_type = DiscreteDomain; + + using discrete_element_type = DiscreteElement; + + using discrete_vector_type = DiscreteVector; + + Impl(continuous_element_type origin) noexcept : m_point(std::move(origin)) {} Impl(Impl const& other) = delete; - constexpr Impl(Impl&& other) = delete; + Impl(Impl&& other) = delete; - constexpr continuous_element_type origin() const noexcept + template + explicit Impl(Impl const& impl) : m_point(impl.m_point) + { + } + + KOKKOS_FUNCTION continuous_element_type origin() const noexcept { return m_point; } - constexpr continuous_element_type coordinate( - [[maybe_unused]] discrete_element_type icoord) const noexcept + KOKKOS_FUNCTION continuous_element_type + coordinate([[maybe_unused]] discrete_element_type icoord) const noexcept { assert(icoord == discrete_element_type(0)); return m_point; @@ -72,58 +80,55 @@ class SingleDiscretization }; }; -template -std::ostream& operator<<(std::ostream& out, SingleDiscretization const& dom) -{ - return out << "SingleDiscretization( at=" << dom.origin() << " )"; -} - -} // namespace experimental - -template -struct is_single_discretization : public std::false_type -{ -}; - -template -struct is_single_discretization> : public std::true_type +template +struct is_single_discretization : public std::is_base_of { }; template constexpr bool is_single_discretization_v = is_single_discretization::value; +template +std::ostream& operator<<(std::ostream& out, SingleDiscretization const& dom) +{ + return out << "SingleDiscretization( at=" << dom.origin() << " )"; +} /// @brief coordinate of the mesh template -std::enable_if_t, typename DDim::continuous_element_type> -origin() noexcept +KOKKOS_FUNCTION std:: + enable_if_t, typename DDim::continuous_element_type> + origin() noexcept { return discrete_space().origin(); } -template -ddc::Coordinate coordinate(DiscreteElement> const& c) +template , int> = 0> +KOKKOS_FUNCTION ddc::Coordinate coordinate( + DiscreteElement const& c) { - return discrete_space>().coordinate(c); + return discrete_space().coordinate(c); } -template -ddc::Coordinate rmin(DiscreteDomain> const& d) +template , int> = 0> +KOKKOS_FUNCTION ddc::Coordinate rmin( + DiscreteDomain const& d) { return coordinate(d.front()); } -template -ddc::Coordinate rmax(DiscreteDomain> const& d) +template , int> = 0> +KOKKOS_FUNCTION ddc::Coordinate rmax( + DiscreteDomain const& d) { return coordinate(d.back()); } -template -ddc::Coordinate rlength(DiscreteDomain> const& d) +template , int> = 0> +KOKKOS_FUNCTION ddc::Coordinate rlength( + DiscreteDomain const& d) { return rmax(d) - rmin(d); } -} // namespace ddc +} // namespace ddc::experimental diff --git a/vendor/ddc/include/ddc/kernels/fft.hpp b/vendor/ddc/include/ddc/kernels/fft.hpp index 0bab955c7..bb0531614 100644 --- a/vendor/ddc/include/ddc/kernels/fft.hpp +++ b/vendor/ddc/include/ddc/kernels/fft.hpp @@ -326,37 +326,44 @@ struct kwArgs_core }; // N,a,b from x_mesh -template -int N(ddc::DiscreteDomain...> x_mesh) +template +int N(ddc::DiscreteDomain x_mesh) { - return ddc::get>(x_mesh.extents()); + static_assert( + (is_uniform_sampling_v && ...), + "DDimX dimensions should derive from UniformPointSampling"); + return ddc::get(x_mesh.extents()); } -template -double a(ddc::DiscreteDomain...> x_mesh) +template +double a(ddc::DiscreteDomain x_mesh) { - return ((2 * N(x_mesh) - 1) - * coordinate(ddc::select>(x_mesh).front()) - - coordinate(ddc::select>(x_mesh).back())) - / 2 / (N(x_mesh) - 1); + static_assert( + (is_uniform_sampling_v && ...), + "DDimX dimensions should derive from UniformPointSampling"); + return ((2 * N(x_mesh) - 1) * coordinate(ddc::select(x_mesh).front()) + - coordinate(ddc::select(x_mesh).back())) + / 2 / (N(x_mesh) - 1); } -template -double b(ddc::DiscreteDomain...> x_mesh) +template +double b(ddc::DiscreteDomain x_mesh) { - return ((2 * N(x_mesh) - 1) - * coordinate(ddc::select>(x_mesh).back()) - - coordinate(ddc::select>(x_mesh).front())) - / 2 / (N(x_mesh) - 1); + static_assert( + (is_uniform_sampling_v && ...), + "DDimX dimensions should derive from UniformPointSampling"); + return ((2 * N(x_mesh) - 1) * coordinate(ddc::select(x_mesh).back()) + - coordinate(ddc::select(x_mesh).front())) + / 2 / (N(x_mesh) - 1); } // core -template +template void core( ExecSpace const& execSpace, Tout* out_data, Tin* in_data, - ddc::DiscreteDomain...> mesh, + ddc::DiscreteDomain mesh, const kwArgs_core& kwargs) { static_assert( @@ -368,16 +375,18 @@ void core( static_assert( Kokkos::SpaceAccessibility::accessible, "MemorySpace has to be accessible for ExecutionSpace."); + static_assert( + (is_uniform_sampling_v && ...), + "DDimX dimensions should derive from UniformPointSampling"); - std::array n - = {(int)ddc::get>(mesh.extents())...}; + std::array n = {(int)ddc::get(mesh.extents())...}; int idist = 1; int odist = 1; - for (std::size_t i = 0; i < sizeof...(X); i++) { - idist = transform_type_v == TransformType::C2R && i == sizeof...(X) - 1 + for (std::size_t i = 0; i < sizeof...(DDimX); i++) { + idist = transform_type_v == TransformType::C2R && i == sizeof...(DDimX) - 1 ? idist * (n[i] / 2 + 1) : idist * n[i]; - odist = transform_type_v == TransformType::R2C && i == sizeof...(X) - 1 + odist = transform_type_v == TransformType::R2C && i == sizeof...(DDimX) - 1 ? odist * (n[i] / 2 + 1) : odist * n[i]; } @@ -389,7 +398,7 @@ void core( _fftw_plan plan = _fftw_plan_many_dft( kwargs.direction == ddc::FFT_Direction::FORWARD ? FFTW_FORWARD : FFTW_BACKWARD, FFTW_ESTIMATE, - (int)sizeof...(X), + (int)sizeof...(DDimX), n.data(), 1, reinterpret_cast::type*>(in_data), @@ -421,7 +430,7 @@ void core( _fftw_plan plan = _fftw_plan_many_dft( kwargs.direction == ddc::FFT_Direction::FORWARD ? FFTW_FORWARD : FFTW_BACKWARD, FFTW_ESTIMATE, - (int)sizeof...(X), + (int)sizeof...(DDimX), n.data(), 1, reinterpret_cast::type*>(in_data), @@ -457,7 +466,7 @@ void core( cufftSetStream(unmanaged_plan, stream); cufft_rt = cufftPlanMany( &unmanaged_plan, // plan handle - sizeof...(X), + sizeof...(DDimX), n.data(), // Nx, Ny... NULL, 1, @@ -496,7 +505,7 @@ void core( hipfftSetStream(unmanaged_plan, stream); hipfft_rt = hipfftPlanMany( &unmanaged_plan, // plan handle - sizeof...(X), + sizeof...(DDimX), n.data(), // Nx, Ny... NULL, 1, @@ -526,40 +535,31 @@ void core( case ddc::FFT_Normalization::OFF: break; case ddc::FFT_Normalization::FORWARD: - norm_coef - = kwargs.direction == ddc::FFT_Direction::FORWARD - ? 1. / (ddc::get>(mesh.extents()) * ...) - : 1.; + norm_coef = kwargs.direction == ddc::FFT_Direction::FORWARD + ? 1. / (ddc::get(mesh.extents()) * ...) + : 1.; break; case ddc::FFT_Normalization::BACKWARD: - norm_coef - = kwargs.direction == ddc::FFT_Direction::BACKWARD - ? 1. / (ddc::get>(mesh.extents()) * ...) - : 1.; + norm_coef = kwargs.direction == ddc::FFT_Direction::BACKWARD + ? 1. / (ddc::get(mesh.extents()) * ...) + : 1.; break; case ddc::FFT_Normalization::ORTHO: - norm_coef = 1. - / Kokkos::sqrt( - (ddc::get>(mesh.extents()) * ...)); + norm_coef = 1. / Kokkos::sqrt((ddc::get(mesh.extents()) * ...)); break; case ddc::FFT_Normalization::FULL: - norm_coef - = kwargs.direction == ddc::FFT_Direction::FORWARD - ? (((coordinate( - ddc::select>(mesh).back()) - - coordinate( - ddc::select>(mesh).front())) - / (ddc::get>(mesh.extents()) - 1) - / Kokkos::sqrt(2 * Kokkos::numbers::pi)) - * ...) - : ((Kokkos::sqrt(2 * Kokkos::numbers::pi) - / (coordinate( - ddc::select>(mesh).back()) - - coordinate(ddc::select>(mesh) - .front())) - * (ddc::get>(mesh.extents()) - 1) - / ddc::get>(mesh.extents())) - * ...); + norm_coef = kwargs.direction == ddc::FFT_Direction::FORWARD + ? (((coordinate(ddc::select(mesh).back()) + - coordinate(ddc::select(mesh).front())) + / (ddc::get(mesh.extents()) - 1) + / Kokkos::sqrt(2 * Kokkos::numbers::pi)) + * ...) + : ((Kokkos::sqrt(2 * Kokkos::numbers::pi) + / (coordinate(ddc::select(mesh).back()) + - coordinate(ddc::select(mesh).front())) + * (ddc::get(mesh.extents()) - 1) + / ddc::get(mesh.extents())) + * ...); break; } @@ -568,13 +568,11 @@ void core( execSpace, 0, is_complex_v && transform_type_v != TransformType::C2C - ? (LastSelector( - ddc::get>(mesh.extents()) - / 2 - + 1, - ddc::get>(mesh.extents())) + ? (LastSelector( + ddc::get(mesh.extents()) / 2 + 1, + ddc::get(mesh.extents())) * ...) - : (ddc::get>(mesh.extents()) * ...)), + : (ddc::get(mesh.extents()) * ...)), KOKKOS_LAMBDA(const int& i) { out_data[i] = out_data[i] * norm_coef; }); } } @@ -582,37 +580,44 @@ void core( namespace ddc { -template -typename ddc::PeriodicSampling>::template Impl -init_fourier_space(ddc::DiscreteDomain> x_mesh) +template +typename DDimFx::template Impl init_fourier_space( + ddc::DiscreteDomain x_mesh) { - auto [impl, ddom] = ddc::PeriodicSampling>:: - init(ddc::Coordinate>(0), - ddc::Coordinate>( - 2 * (ddc::detail::fft::N(x_mesh) - 1) - / (ddc::detail::fft::b(x_mesh) - ddc::detail::fft::a(x_mesh)) - * Kokkos::numbers::pi), - ddc::DiscreteVector>>( - ddc::detail::fft::N(x_mesh)), - ddc::DiscreteVector>>( - ddc::detail::fft::N(x_mesh))); + static_assert( + is_uniform_sampling_v, + "DDimX dimensions should derive from UniformPointSampling"); + static_assert( + is_periodic_sampling_v, + "DDimFx dimensions should derive from PeriodicPointSampling"); + auto [impl, ddom] = DDimFx::template init( + ddc::Coordinate(0), + ddc::Coordinate( + 2 * (ddc::detail::fft::N(x_mesh) - 1) + / (ddc::detail::fft::b(x_mesh) - ddc::detail::fft::a(x_mesh)) + * Kokkos::numbers::pi), + ddc::DiscreteVector(ddc::detail::fft::N(x_mesh)), + ddc::DiscreteVector(ddc::detail::fft::N(x_mesh))); return std::move(impl); } // FourierMesh, first element corresponds to mode 0 -template -ddc::DiscreteDomain>...> FourierMesh( - ddc::DiscreteDomain...> x_mesh, - bool C2C) +template +ddc::DiscreteDomain FourierMesh(ddc::DiscreteDomain x_mesh, bool C2C) { - return ddc::DiscreteDomain>...>( - ddc::DiscreteDomain>>( - ddc::DiscreteElement>>(0), - ddc::DiscreteVector>>( - (C2C ? ddc::detail::fft::N(x_mesh) - : ddc::detail::fft::LastSelector( - ddc::detail::fft::N(x_mesh) / 2 + 1, - ddc::detail::fft::N(x_mesh)))))...); + static_assert( + (is_uniform_sampling_v && ...), + "DDimX dimensions should derive from UniformPointSampling"); + static_assert( + (is_periodic_sampling_v && ...), + "DDimFx dimensions should derive from PeriodicPointSampling"); + return ddc::DiscreteDomain(ddc::DiscreteDomain( + ddc::DiscreteElement(0), + ddc::DiscreteVector( + (C2C ? ddc::detail::fft::N(x_mesh) + : ddc::detail::fft::LastSelector( + ddc::detail::fft::N(x_mesh) / 2 + 1, + ddc::detail::fft::N(x_mesh)))))...); } struct kwArgs_fft @@ -624,23 +629,16 @@ struct kwArgs_fft template < typename Tin, typename Tout, - typename... X, + typename... DDimFx, + typename... DDimX, typename ExecSpace, typename MemorySpace, typename layout_in, typename layout_out> void fft( ExecSpace const& execSpace, - ddc::ChunkSpan< - Tout, - ddc::DiscreteDomain>...>, - layout_out, - MemorySpace> out, - ddc::ChunkSpan< - Tin, - ddc::DiscreteDomain...>, - layout_in, - MemorySpace> in, + ddc::ChunkSpan, layout_out, MemorySpace> out, + ddc::ChunkSpan, layout_in, MemorySpace> in, ddc::kwArgs_fft kwargs = {ddc::FFT_Normalization::OFF}) { static_assert( @@ -649,8 +647,14 @@ void fft( std::experimental:: layout_right> && std::is_same_v, "Layouts must be right-handed"); + static_assert( + (is_uniform_sampling_v && ...), + "DDimX dimensions should derive from UniformPointSampling"); + static_assert( + (is_periodic_sampling_v && ...), + "DDimFx dimensions should derive from PeriodicPointSampling"); - ddc::detail::fft::core( + ddc::detail::fft::core( execSpace, out.data_handle(), in.data_handle(), @@ -662,23 +666,16 @@ void fft( template < typename Tin, typename Tout, - typename... X, + typename... DDimX, + typename... DDimFx, typename ExecSpace, typename MemorySpace, typename layout_in, typename layout_out> void ifft( ExecSpace const& execSpace, - ddc::ChunkSpan< - Tout, - ddc::DiscreteDomain...>, - layout_out, - MemorySpace> out, - ddc::ChunkSpan< - Tin, - ddc::DiscreteDomain>...>, - layout_in, - MemorySpace> in, + ddc::ChunkSpan, layout_out, MemorySpace> out, + ddc::ChunkSpan, layout_in, MemorySpace> in, ddc::kwArgs_fft kwargs = {ddc::FFT_Normalization::OFF}) { static_assert( @@ -687,8 +684,14 @@ void ifft( std::experimental:: layout_right> && std::is_same_v, "Layouts must be right-handed"); + static_assert( + (is_uniform_sampling_v && ...), + "DDimX dimensions should derive from UniformPointSampling"); + static_assert( + (is_periodic_sampling_v && ...), + "DDimFx dimensions should derive from PeriodicPointSampling"); - ddc::detail::fft::core( + ddc::detail::fft::core( execSpace, out.data_handle(), in.data_handle(), diff --git a/vendor/ddc/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/vendor/ddc/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 8160de039..4a52c5d32 100644 --- a/vendor/ddc/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/vendor/ddc/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -14,47 +14,28 @@ #include "view.hpp" namespace ddc { + +template +struct NonUniformBsplinesKnots : NonUniformPointSampling +{ +}; + +struct NonUniformBSplinesBase +{ +}; + /// NonUniformPointSampling specialization of BSplines template -class NonUniformBSplines +class NonUniformBSplines : NonUniformBSplinesBase { static_assert(D > 0, "Parameter `D` must be positive"); -public: - // From nvcc: 'A type that is defined inside a class and has private or protected access cannot be used - // in the template argument type of a variable template instantiation' - template - struct InternalTagGenerator; - - /// An internal tag necessary to allocate an internal ddc::discrete_space function. - /// It must remain internal, for example it shall not be exposed when returning ddc::coordinates. Instead use `Tag` - using KnotDim = InternalTagGenerator; - - using mesh_type = ddc::NonUniformPointSampling; - - static KOKKOS_INLINE_FUNCTION ddc::Coordinate knot_from_coord( - ddc::Coordinate const& coord) - { - return ddc::Coordinate(ddc::get(coord)); - } - static KOKKOS_INLINE_FUNCTION ddc::Coordinate coord_from_knot( - ddc::Coordinate const& coord) - { - return ddc::Coordinate(ddc::get(coord)); - } - public: using tag_type = Tag; using discrete_dimension_type = NonUniformBSplines; - using discrete_element_type = ddc::DiscreteElement; - - using discrete_domain_type = ddc::DiscreteDomain; - - using discrete_vector_type = ddc::DiscreteVector; - public: static constexpr std::size_t rank() { @@ -81,13 +62,15 @@ class NonUniformBSplines return false; } - template + template class Impl { - template + template friend class Impl; private: + using mesh_type = NonUniformBsplinesKnots; + ddc::DiscreteDomain m_domain; int m_nknots; @@ -95,10 +78,16 @@ class NonUniformBSplines public: using discrete_dimension_type = NonUniformBSplines; + using discrete_domain_type = DiscreteDomain; + + using discrete_element_type = DiscreteElement; + + using discrete_vector_type = DiscreteVector; + Impl() = default; template - explicit Impl(Impl const& impl) + explicit Impl(Impl const& impl) : m_domain(impl.m_domain) , m_nknots(impl.m_nknots) { @@ -148,28 +137,26 @@ class NonUniformBSplines KOKKOS_INLINE_FUNCTION ddc::Coordinate get_knot(int knot_idx) const noexcept { - return coord_from_knot( - ddc::coordinate(ddc::DiscreteElement(knot_idx + degree()))); + return ddc::coordinate(ddc::DiscreteElement(knot_idx + degree())); } KOKKOS_INLINE_FUNCTION ddc::Coordinate get_first_support_knot( discrete_element_type const& ix) const { - return coord_from_knot(ddc::coordinate(ddc::DiscreteElement(ix.uid()))); + return ddc::coordinate(ddc::DiscreteElement(ix.uid())); } KOKKOS_INLINE_FUNCTION ddc::Coordinate get_last_support_knot( discrete_element_type const& ix) const { - return coord_from_knot( - ddc::coordinate(ddc::DiscreteElement(ix.uid() + degree() + 1))); + return ddc::coordinate(ddc::DiscreteElement(ix.uid() + degree() + 1)); } KOKKOS_INLINE_FUNCTION ddc::Coordinate get_support_knot_n( discrete_element_type const& ix, int n) const { - return coord_from_knot(ddc::coordinate(ddc::DiscreteElement(ix.uid() + n))); + return ddc::coordinate(ddc::DiscreteElement(ix.uid() + n)); } KOKKOS_INLINE_FUNCTION ddc::Coordinate rmin() const noexcept @@ -218,10 +205,18 @@ class NonUniformBSplines }; }; +template +struct is_non_uniform_bsplines : public std::is_base_of +{ +}; + +template +constexpr bool is_non_uniform_bsplines_v = is_non_uniform_bsplines::value; + template -template +template template -NonUniformBSplines::Impl::Impl( +NonUniformBSplines::Impl::Impl( RandomIt const break_begin, RandomIt const break_end) : m_domain( @@ -231,24 +226,23 @@ NonUniformBSplines::Impl::Impl( + 2 * degree())) // Create a mesh including the eventual periodic point , m_nknots((break_end - break_begin) + 2 * degree()) { - std::vector> knots((break_end - break_begin) + 2 * degree()); + std::vector> knots((break_end - break_begin) + 2 * degree()); // Fill the provided knots int ii = 0; for (RandomIt it = break_begin; it < break_end; ++it) { - knots[degree() + ii] = knot_from_coord(*it); + knots[degree() + ii] = *it; ++ii; } - ddc::Coordinate const rmin = knots[degree()]; - ddc::Coordinate const rmax = knots[(break_end - break_begin) + degree() - 1]; + ddc::Coordinate const rmin = knots[degree()]; + ddc::Coordinate const rmax = knots[(break_end - break_begin) + degree() - 1]; assert(rmin < rmax); // Fill out the extra knots if constexpr (is_periodic()) { double const period = rmax - rmin; for (std::size_t i = 1; i < degree() + 1; ++i) { - knots[degree() + -i] - = ddc::Coordinate(knots[degree() + ncells() - i] - period); - knots[degree() + ncells() + i] = ddc::Coordinate(knots[degree() + i] + period); + knots[degree() + -i] = knots[degree() + ncells() - i] - period; + knots[degree() + ncells() + i] = knots[degree() + i] + period; } } else // open { @@ -261,9 +255,9 @@ NonUniformBSplines::Impl::Impl( } template -template -KOKKOS_INLINE_FUNCTION ddc::DiscreteElement> NonUniformBSplines:: - Impl::eval_basis( +template +KOKKOS_INLINE_FUNCTION ddc::DiscreteElement NonUniformBSplines:: + Impl::eval_basis( std::array& values, ddc::Coordinate const& x) const { @@ -301,9 +295,9 @@ KOKKOS_INLINE_FUNCTION ddc::DiscreteElement> NonUnifo } template -template -KOKKOS_INLINE_FUNCTION ddc::DiscreteElement> NonUniformBSplines:: - Impl::eval_deriv( +template +KOKKOS_INLINE_FUNCTION ddc::DiscreteElement NonUniformBSplines:: + Impl::eval_deriv( std::array& derivs, ddc::Coordinate const& x) const { @@ -361,9 +355,9 @@ KOKKOS_INLINE_FUNCTION ddc::DiscreteElement> NonUnifo } template -template -KOKKOS_INLINE_FUNCTION ddc::DiscreteElement> NonUniformBSplines:: - Impl::eval_basis_and_n_derivs( +template +KOKKOS_INLINE_FUNCTION ddc::DiscreteElement NonUniformBSplines:: + Impl::eval_basis_and_n_derivs( ddc::DSpan2D const derivs, ddc::Coordinate const& x, std::size_t const n) const @@ -451,10 +445,7 @@ KOKKOS_INLINE_FUNCTION ddc::DiscreteElement> NonUnifo d += a(k, s2) * ndu(pk, r); } derivs(r, k) = d; - // swap s1 <-> s2; - auto tmp = s1; - s1 = s2; - s2 = tmp; + Kokkos::kokkos_swap(s1, s2); } } @@ -470,8 +461,8 @@ KOKKOS_INLINE_FUNCTION ddc::DiscreteElement> NonUnifo } template -template -KOKKOS_INLINE_FUNCTION int NonUniformBSplines::Impl::find_cell( +template +KOKKOS_INLINE_FUNCTION int NonUniformBSplines::Impl::find_cell( ddc::Coordinate const& x) const { if (x > rmax()) @@ -499,16 +490,11 @@ KOKKOS_INLINE_FUNCTION int NonUniformBSplines::Impl::find_c } template -template +template template -KOKKOS_INLINE_FUNCTION ddc:: - ChunkSpan>, Layout, MemorySpace2> - NonUniformBSplines::Impl::integrals( - ddc::ChunkSpan< - double, - ddc::DiscreteDomain>, - Layout, - MemorySpace2> int_vals) const +KOKKOS_INLINE_FUNCTION ddc::ChunkSpan, Layout, MemorySpace2> +NonUniformBSplines::Impl::integrals( + ddc::ChunkSpan, Layout, MemorySpace2> int_vals) const { if constexpr (is_periodic()) { assert(int_vals.size() == nbasis() || int_vals.size() == size()); diff --git a/vendor/ddc/include/ddc/kernels/splines/bsplines_uniform.hpp b/vendor/ddc/include/ddc/kernels/splines/bsplines_uniform.hpp index 1785c9dfc..2a0b7d1c7 100644 --- a/vendor/ddc/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/vendor/ddc/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -14,33 +14,20 @@ #include "view.hpp" namespace ddc { -template -class UniformBSplines -{ - static_assert(D > 0, "Parameter `D` must be positive"); -public: - // From nvcc: 'A type that is defined inside a class and has private or protected access cannot be used - // in the template argument type of a variable template instantiation' - template - struct InternalTagGenerator; - - /// An internal tag necessary to allocate an internal ddc::discrete_space function. - /// It must remain internal, for example it shall not be exposed when returning ddc::coordinates. Instead use `Tag` - using KnotDim = InternalTagGenerator; +template +struct UniformBsplinesKnots : UniformPointSampling +{ +}; - using mesh_type = ddc::UniformPointSampling; +struct UniformBSplinesBase +{ +}; - static KOKKOS_INLINE_FUNCTION ddc::Coordinate knot_from_coord( - ddc::Coordinate const& coord) - { - return ddc::Coordinate(ddc::get(coord)); - } - static KOKKOS_INLINE_FUNCTION ddc::Coordinate coord_from_knot( - ddc::Coordinate const& coord) - { - return ddc::Coordinate(ddc::get(coord)); - } +template +class UniformBSplines : UniformBSplinesBase +{ + static_assert(D > 0, "Parameter `D` must be positive"); public: using tag_type = Tag; @@ -48,12 +35,6 @@ class UniformBSplines using discrete_dimension_type = UniformBSplines; - using discrete_element_type = ddc::DiscreteElement; - - using discrete_domain_type = ddc::DiscreteDomain; - - using discrete_vector_type = ddc::DiscreteVector; - public: static constexpr std::size_t rank() { @@ -80,23 +61,31 @@ class UniformBSplines return true; } - template + template class Impl { - template + template friend class Impl; private: + using mesh_type = UniformBsplinesKnots; + // In the periodic case, it contains twice the periodic point!!! ddc::DiscreteDomain m_domain; public: using discrete_dimension_type = UniformBSplines; + using discrete_domain_type = DiscreteDomain; + + using discrete_element_type = DiscreteElement; + + using discrete_vector_type = DiscreteVector; + Impl() = default; template - explicit Impl(Impl const& impl) : m_domain(impl.m_domain) + explicit Impl(Impl const& impl) : m_domain(impl.m_domain) { } @@ -113,10 +102,9 @@ class UniformBSplines ncells + 1)) // Create a mesh including the eventual periodic point { assert(ncells > 0); - ddc::init_discrete_space(mesh_type:: - init(knot_from_coord(rmin), - knot_from_coord(rmax), - ddc::DiscreteVector(ncells + 1))); + ddc::init_discrete_space( + mesh_type::template init< + mesh_type>(rmin, rmax, ddc::DiscreteVector(ncells + 1))); } Impl(Impl const& x) = default; @@ -171,12 +159,12 @@ class UniformBSplines KOKKOS_INLINE_FUNCTION ddc::Coordinate rmin() const noexcept { - return coord_from_knot(ddc::coordinate(m_domain.front())); + return ddc::coordinate(m_domain.front()); } KOKKOS_INLINE_FUNCTION ddc::Coordinate rmax() const noexcept { - return coord_from_knot(ddc::coordinate(m_domain.back())); + return ddc::coordinate(m_domain.back()); } KOKKOS_INLINE_FUNCTION double length() const noexcept @@ -224,11 +212,19 @@ class UniformBSplines }; }; +template +struct is_uniform_bsplines : public std::is_base_of +{ +}; + +template +constexpr bool is_uniform_bsplines_v = is_uniform_bsplines::value; + template -template +template template -KOKKOS_INLINE_FUNCTION ddc::DiscreteElement> UniformBSplines:: - Impl::eval_basis( +KOKKOS_INLINE_FUNCTION ddc::DiscreteElement UniformBSplines::Impl:: + eval_basis( std::array& values, ddc::Coordinate const& x, [[maybe_unused]] std::size_t const deg) const @@ -260,10 +256,9 @@ KOKKOS_INLINE_FUNCTION ddc::DiscreteElement> UniformBSpl } template -template -KOKKOS_INLINE_FUNCTION ddc::DiscreteElement> UniformBSplines::Impl< - MemorySpace>::eval_deriv(std::array& derivs, ddc::Coordinate const& x) - const +template +KOKKOS_INLINE_FUNCTION ddc::DiscreteElement UniformBSplines::Impl:: + eval_deriv(std::array& derivs, ddc::Coordinate const& x) const { assert(derivs.size() == degree() + 1); @@ -304,9 +299,9 @@ KOKKOS_INLINE_FUNCTION ddc::DiscreteElement> UniformBSpl } template -template -KOKKOS_INLINE_FUNCTION ddc::DiscreteElement> UniformBSplines:: - Impl::eval_basis_and_n_derivs( +template +KOKKOS_INLINE_FUNCTION ddc::DiscreteElement UniformBSplines::Impl:: + eval_basis_and_n_derivs( ddc::DSpan2D const derivs, ddc::Coordinate const& x, std::size_t const n) const @@ -378,10 +373,7 @@ KOKKOS_INLINE_FUNCTION ddc::DiscreteElement> UniformBSpl d += a(k, s2) * ndu(pk, r); } derivs(r, k) = d; - // swap s1 <-> s2 - auto tmp = s1; - s1 = s2; - s2 = tmp; + Kokkos::kokkos_swap(s1, s2); } } @@ -401,8 +393,8 @@ KOKKOS_INLINE_FUNCTION ddc::DiscreteElement> UniformBSpl } template -template -KOKKOS_INLINE_FUNCTION void UniformBSplines::Impl::get_icell_and_offset( +template +KOKKOS_INLINE_FUNCTION void UniformBSplines::Impl::get_icell_and_offset( int& icell, double& offset, ddc::Coordinate const& x) const @@ -432,16 +424,11 @@ KOKKOS_INLINE_FUNCTION void UniformBSplines::Impl::get_icel } template -template +template template -KOKKOS_INLINE_FUNCTION ddc::ChunkSpan< - double, - ddc::DiscreteDomain>, - Layout, - MemorySpace2> -UniformBSplines::Impl::integrals( - ddc::ChunkSpan>, Layout, MemorySpace2> - int_vals) const +KOKKOS_INLINE_FUNCTION ddc::ChunkSpan, Layout, MemorySpace2> +UniformBSplines::Impl::integrals( + ddc::ChunkSpan, Layout, MemorySpace2> int_vals) const { if constexpr (is_periodic()) { assert(int_vals.size() == nbasis() || int_vals.size() == size()); diff --git a/vendor/ddc/include/ddc/kernels/splines/greville_interpolation_points.hpp b/vendor/ddc/include/ddc/kernels/splines/greville_interpolation_points.hpp index 576c36ae3..71443c6b9 100644 --- a/vendor/ddc/include/ddc/kernels/splines/greville_interpolation_points.hpp +++ b/vendor/ddc/include/ddc/kernels/splines/greville_interpolation_points.hpp @@ -13,6 +13,7 @@ #include "spline_boundary_conditions.hpp" namespace ddc { + /** * A class which provides helper functions to initialise the Greville points from a B-Spline definition. * @@ -25,11 +26,22 @@ class GrevilleInterpolationPoints { using tag_type = typename BSplines::tag_type; - template > + template + struct IntermediateUniformSampling + : UniformPointSampling + { + }; + + template + struct IntermediateNonUniformSampling + : NonUniformPointSampling + { + }; + + template > static auto uniform_greville_points() { - using Sampling = ddc::UniformPointSampling; - using SamplingImpl = typename Sampling::template Impl; + using SamplingImpl = typename Sampling::template Impl; double constexpr shift = (BSplines::degree() % 2 == 0) ? 0.5 : 0.0; double dx @@ -40,11 +52,10 @@ class GrevilleInterpolationPoints ddc::Coordinate(dx)); } - template > + template > static auto non_uniform_greville_points() { - using Sampling = ddc::NonUniformPointSampling; - using SamplingImpl = typename Sampling::template Impl; + using SamplingImpl = typename Sampling::template Impl; int n_greville_points = ddc::discrete_space().nbasis(); if constexpr (U::is_periodic()) { @@ -110,13 +121,14 @@ class GrevilleInterpolationPoints * @returns The mesh of uniform Greville points. */ template < + class Sampling, typename U = BSplines, std::enable_if_t< is_uniform_mesh_v, bool> = true> // U must be in condition for SFINAE static auto get_sampling() { - return uniform_greville_points(); + return uniform_greville_points(); } /** @@ -125,16 +137,17 @@ class GrevilleInterpolationPoints * @returns The mesh of non-uniform Greville points. */ template < + class Sampling, typename U = BSplines, std::enable_if_t< !is_uniform_mesh_v, bool> = true> // U must be in condition for SFINAE static auto get_sampling() { - using Sampling = ddc::NonUniformPointSampling; - using SamplingImpl = typename Sampling::template Impl; + using SamplingImpl = typename Sampling::template Impl; if constexpr (U::is_uniform()) { - auto points_wo_bcs = uniform_greville_points(); + using IntermediateSampling = IntermediateUniformSampling; + auto points_wo_bcs = uniform_greville_points(); int const n_break_points = ddc::discrete_space().ncells() + 1; int const npoints = ddc::discrete_space().nbasis() - N_BE_MIN - N_BE_MAX; std::vector points_with_bcs(npoints); @@ -152,16 +165,16 @@ class GrevilleInterpolationPoints points_with_bcs[i] /= BSplines::degree(); } } else { - points_with_bcs[0] = points_wo_bcs.coordinate( - ddc::DiscreteElement>(0)); + points_with_bcs[0] + = points_wo_bcs.coordinate(ddc::DiscreteElement(0)); } int const n_start = (BcXmin == ddc::BoundCond::GREVILLE) ? BSplines::degree() / 2 + 1 : 1; int const domain_size = n_break_points - 2; - ddc::DiscreteDomain> const - domain(ddc::DiscreteElement>(1), - ddc::DiscreteVector>(domain_size)); + ddc::DiscreteDomain const + domain(ddc::DiscreteElement(1), + ddc::DiscreteVector(domain_size)); // Copy central points ddc::for_each(domain, [&](auto ip) { @@ -183,26 +196,26 @@ class GrevilleInterpolationPoints points_with_bcs[npoints - 1 - i] /= BSplines::degree(); } } else { - points_with_bcs[npoints - 1] = points_wo_bcs.coordinate( - ddc::DiscreteElement>( + points_with_bcs[npoints - 1] + = points_wo_bcs.coordinate(ddc::DiscreteElement( ddc::discrete_space().ncells() - 1 + BSplines::degree() % 2)); } return SamplingImpl(points_with_bcs); } else { - auto points_wo_bcs = non_uniform_greville_points(); + using IntermediateSampling = IntermediateNonUniformSampling; if constexpr (N_BE_MIN == 0 && N_BE_MAX == 0) { - return points_wo_bcs; + return non_uniform_greville_points(); } else { + auto points_wo_bcs = non_uniform_greville_points(); // All points are Greville points. Extract unnecessary points near the boundary std::vector points_with_bcs(points_wo_bcs.size() - N_BE_MIN - N_BE_MAX); int constexpr n_start = N_BE_MIN; - using length = ddc::DiscreteVector>; + using length = ddc::DiscreteVector; - ddc::DiscreteDomain> const - domain(ddc::DiscreteElement>( - n_start), + ddc::DiscreteDomain const + domain(ddc::DiscreteElement(n_start), length(points_with_bcs.size())); points_with_bcs[0] = points_wo_bcs.coordinate(domain.front()); @@ -222,19 +235,23 @@ class GrevilleInterpolationPoints * * This is either NonUniformPointSampling or UniformPointSampling. */ - using interpolation_mesh_type = typename decltype(get_sampling())::discrete_dimension_type; + using interpolation_mesh_type = std::conditional_t< + is_uniform_mesh_v, + ddc::UniformPointSampling, + ddc::NonUniformPointSampling>; /** * Get the domain which gives us access to all of the Greville points. * * @returns The domain of the Greville points. */ - static ddc::DiscreteDomain get_domain() + template + static ddc::DiscreteDomain get_domain() { int const npoints = ddc::discrete_space().nbasis() - N_BE_MIN - N_BE_MAX; - return ddc::DiscreteDomain( - ddc::DiscreteElement(0), - ddc::DiscreteVector(npoints)); + return ddc::DiscreteDomain( + ddc::DiscreteElement(0), + ddc::DiscreteVector(npoints)); } }; } // namespace ddc diff --git a/vendor/ddc/include/ddc/kernels/splines/knots_as_interpolation_points.hpp b/vendor/ddc/include/ddc/kernels/splines/knots_as_interpolation_points.hpp index 72d403223..2d97b6cff 100644 --- a/vendor/ddc/include/ddc/kernels/splines/knots_as_interpolation_points.hpp +++ b/vendor/ddc/include/ddc/kernels/splines/knots_as_interpolation_points.hpp @@ -37,20 +37,17 @@ class KnotsAsInterpolationPoints * * @return sampling The DDC point sampling of the interpolation points. */ - template + template static auto get_sampling() { if constexpr (U::is_uniform()) { - using Sampling = ddc::UniformPointSampling; - return std::get<0>( - Sampling:: - init(ddc::discrete_space().rmin(), - ddc::discrete_space().rmax(), - ddc::DiscreteVector>( - ddc::discrete_space().ncells() + 1))); + return std::get<0>(Sampling:: + init(ddc::discrete_space().rmin(), + ddc::discrete_space().rmax(), + ddc::DiscreteVector( + ddc::discrete_space().ncells() + 1))); } else { - using Sampling = ddc::NonUniformPointSampling; - using SamplingImpl = typename Sampling::template Impl; + using SamplingImpl = typename Sampling::template Impl; std::vector knots(ddc::discrete_space().npoints()); for (int i(0); i < ddc::discrete_space().npoints(); ++i) { knots[i] = ddc::discrete_space().get_knot(i); @@ -60,19 +57,23 @@ class KnotsAsInterpolationPoints } /// The DDC type of the sampling for the interpolation points. - using interpolation_mesh_type = typename decltype(get_sampling())::discrete_dimension_type; + using interpolation_mesh_type = std::conditional_t< + is_uniform_bsplines_v, + ddc::UniformPointSampling, + ddc::NonUniformPointSampling>; /** * Get the domain which can be used to access the interpolation points in the sampling. * * @return domain The discrete domain which maps to the sampling of interpolation points. */ - static ddc::DiscreteDomain get_domain() + template + static ddc::DiscreteDomain get_domain() { int const npoints = ddc::discrete_space().ncells() + !BSplines::is_periodic(); - return ddc::DiscreteDomain( - ddc::DiscreteElement(0), - ddc::DiscreteVector(npoints)); + return ddc::DiscreteDomain( + ddc::DiscreteElement(0), + ddc::DiscreteVector(npoints)); } }; } // namespace ddc diff --git a/vendor/ddc/include/ddc/non_uniform_point_sampling.hpp b/vendor/ddc/include/ddc/non_uniform_point_sampling.hpp index ae4447e34..f69b5533e 100644 --- a/vendor/ddc/include/ddc/non_uniform_point_sampling.hpp +++ b/vendor/ddc/include/ddc/non_uniform_point_sampling.hpp @@ -20,9 +20,13 @@ namespace ddc { +struct NonUniformPointSamplingBase +{ +}; + /// `NonUniformPointSampling` models a non-uniform discretization of the `CDim` segment \f$[a, b]\f$. template -class NonUniformPointSampling +class NonUniformPointSampling : NonUniformPointSamplingBase { public: using continuous_dimension_type = CDim; @@ -32,23 +36,23 @@ class NonUniformPointSampling using discrete_dimension_type = NonUniformPointSampling; - using discrete_domain_type = DiscreteDomain; - - using discrete_element_type = DiscreteElement; - - using discrete_vector_type = DiscreteVector; - public: - template + template class Impl { - template + template friend class Impl; Kokkos::View m_points; public: - using discrete_dimension_type = NonUniformPointSampling; + using discrete_dimension_type = NonUniformPointSampling; + + using discrete_domain_type = DiscreteDomain; + + using discrete_element_type = DiscreteElement; + + using discrete_vector_type = DiscreteVector; Impl() = default; @@ -89,7 +93,7 @@ class NonUniformPointSampling } template - explicit Impl(Impl const& impl) + explicit Impl(Impl const& impl) : m_points(Kokkos::create_mirror_view_and_copy(MemorySpace(), impl.m_points)) { } @@ -114,13 +118,8 @@ class NonUniformPointSampling }; }; -template -struct is_non_uniform_sampling : public std::false_type -{ -}; - -template -struct is_non_uniform_sampling> : public std::true_type +template +struct is_non_uniform_sampling : public std::is_base_of { }; @@ -137,38 +136,44 @@ std::ostream& operator<<(std::ostream& out, DDimImpl const& mesh) return out << "NonUniformPointSampling(" << mesh.size() << ")"; } -template -KOKKOS_FUNCTION Coordinate coordinate(DiscreteElement> const& c) +template , int> = 0> +KOKKOS_FUNCTION Coordinate coordinate( + DiscreteElement const& c) { - return discrete_space>().coordinate(c); + return discrete_space().coordinate(c); } -template -KOKKOS_FUNCTION Coordinate distance_at_left(DiscreteElement> i) +template , int> = 0> +KOKKOS_FUNCTION Coordinate distance_at_left( + DiscreteElement i) { return coordinate(i) - coordinate(i - 1); } -template -KOKKOS_FUNCTION Coordinate distance_at_right(DiscreteElement> i) +template , int> = 0> +KOKKOS_FUNCTION Coordinate distance_at_right( + DiscreteElement i) { return coordinate(i + 1) - coordinate(i); } -template -KOKKOS_FUNCTION Coordinate rmin(DiscreteDomain> const& d) +template , int> = 0> +KOKKOS_FUNCTION Coordinate rmin( + DiscreteDomain const& d) { return coordinate(d.front()); } -template -KOKKOS_FUNCTION Coordinate rmax(DiscreteDomain> const& d) +template , int> = 0> +KOKKOS_FUNCTION Coordinate rmax( + DiscreteDomain const& d) { return coordinate(d.back()); } -template -KOKKOS_FUNCTION Coordinate rlength(DiscreteDomain> const& d) +template , int> = 0> +KOKKOS_FUNCTION Coordinate rlength( + DiscreteDomain const& d) { return rmax(d) - rmin(d); } diff --git a/vendor/ddc/include/ddc/periodic_sampling.hpp b/vendor/ddc/include/ddc/periodic_sampling.hpp index 07c610312..22a9eebba 100644 --- a/vendor/ddc/include/ddc/periodic_sampling.hpp +++ b/vendor/ddc/include/ddc/periodic_sampling.hpp @@ -22,10 +22,14 @@ namespace ddc { +struct PeriodicSamplingBase +{ +}; + /** PeriodicSampling models a periodic discretization of the provided continuous dimension */ template -class PeriodicSampling +class PeriodicSampling : PeriodicSamplingBase { public: using continuous_dimension_type = CDim; @@ -35,17 +39,11 @@ class PeriodicSampling using discrete_dimension_type = PeriodicSampling; - using discrete_element_type = DiscreteElement; - - using discrete_domain_type = DiscreteDomain; - - using discrete_vector_type = DiscreteVector; - public: - template + template class Impl { - template + template friend class Impl; private: @@ -58,12 +56,18 @@ class PeriodicSampling public: using discrete_dimension_type = PeriodicSampling; + using discrete_domain_type = DiscreteDomain; + + using discrete_element_type = DiscreteElement; + + using discrete_vector_type = DiscreteVector; + Impl() = default; Impl(Impl const&) = delete; template - explicit Impl(Impl const& impl) + explicit Impl(Impl const& impl) : m_origin(impl.m_origin) , m_step(impl.m_step) , m_n_period(impl.m_n_period) @@ -133,17 +137,19 @@ class PeriodicSampling * @param n number of points to map on the segment \f$[a, b]\f$ including a & b * @param n_period the number of steps in a period */ - static std::tuple, discrete_domain_type> init( - continuous_element_type a, - continuous_element_type b, - discrete_vector_type n, - discrete_vector_type n_period) + template + static std::tuple, DiscreteDomain> + init(Coordinate a, + Coordinate b, + DiscreteVector n, + DiscreteVector n_period) { assert(a < b); assert(n > 1); assert(n_period > 1); - Impl disc(a, continuous_element_type {(b - a) / (n - 1)}, n_period); - discrete_domain_type domain {disc.front(), n}; + typename DDim::template Impl + disc(a, Coordinate {(b - a) / (n - 1)}, n_period); + DiscreteDomain domain {disc.front(), n}; return std::make_tuple(std::move(disc), std::move(domain)); } @@ -157,26 +163,27 @@ class PeriodicSampling * @param n_ghosts_before number of additional "ghost" points before the segment * @param n_ghosts_after number of additional "ghost" points after the segment */ - static std::tuple< - Impl, - discrete_domain_type, - discrete_domain_type, - discrete_domain_type, - discrete_domain_type> + template + std::tuple< + Impl, + DiscreteDomain, + DiscreteDomain, + DiscreteDomain, + DiscreteDomain> init_ghosted( continuous_element_type a, continuous_element_type b, - discrete_vector_type n, - discrete_vector_type n_period, - discrete_vector_type n_ghosts_before, - discrete_vector_type n_ghosts_after) + DiscreteVector n, + DiscreteVector n_period, + DiscreteVector n_ghosts_before, + DiscreteVector n_ghosts_after) { - using discrete_domain_type = discrete_domain_type; + using discrete_domain_type = DiscreteDomain; assert(a < b); assert(n > 1); assert(n_period > 1); Real discretization_step {(b - a) / (n - 1)}; - Impl + Impl disc(a - n_ghosts_before.value() * discretization_step, discretization_step, n_period); @@ -205,37 +212,32 @@ class PeriodicSampling * @param n_period the number of steps in a period * @param n_ghosts number of additional "ghost" points before and after the segment */ - static std::tuple< - Impl, - discrete_domain_type, - discrete_domain_type, - discrete_domain_type, - discrete_domain_type> + template + std::tuple< + Impl, + DiscreteDomain, + DiscreteDomain, + DiscreteDomain, + DiscreteDomain> init_ghosted( continuous_element_type a, continuous_element_type b, - discrete_vector_type n, - discrete_vector_type n_period, - discrete_vector_type n_ghosts) + DiscreteVector n, + DiscreteVector n_period, + DiscreteVector n_ghosts) { return init_ghosted(a, b, n, n_period, n_ghosts, n_ghosts); } }; -template -struct is_periodic_sampling : public std::false_type -{ -}; - -template -struct is_periodic_sampling> : public std::true_type +template +struct is_periodic_sampling : public std::is_base_of { }; template constexpr bool is_periodic_sampling_v = is_periodic_sampling::value; - template < class DDimImpl, std::enable_if_t< @@ -248,16 +250,17 @@ std::ostream& operator<<(std::ostream& out, DDimImpl const& mesh) /// @brief Lower bound index of the mesh template -KOKKOS_FUNCTION std:: - enable_if_t, typename DDim::continuous_element_type> - origin() noexcept +KOKKOS_FUNCTION std::enable_if_t< + is_periodic_sampling_v, + Coordinate> +origin() noexcept { return discrete_space().origin(); } /// @brief Lower bound index of the mesh template -KOKKOS_FUNCTION std::enable_if_t, typename DDim::discrete_element_type> +KOKKOS_FUNCTION std::enable_if_t, DiscreteElement> front() noexcept { return discrete_space().front(); @@ -270,54 +273,46 @@ KOKKOS_FUNCTION std::enable_if_t, Real> step() noex return discrete_space().step(); } -template -KOKKOS_FUNCTION Coordinate coordinate(DiscreteElement> const& c) +template , int> = 0> +KOKKOS_FUNCTION Coordinate coordinate( + DiscreteElement const& c) { - return discrete_space>().coordinate(c); + return discrete_space().coordinate(c); } -template -KOKKOS_FUNCTION Coordinate distance_at_left(DiscreteElement>) +template , int> = 0> +KOKKOS_FUNCTION Coordinate distance_at_left( + DiscreteElement) { - return Coordinate(step>()); + return Coordinate(step()); } -template -KOKKOS_FUNCTION Coordinate distance_at_right(DiscreteElement>) +template , int> = 0> +KOKKOS_FUNCTION Coordinate distance_at_right( + DiscreteElement) { - return Coordinate(step>()); + return Coordinate(step()); } -template -KOKKOS_FUNCTION Coordinate rmin(DiscreteDomain> const& d) +template , int> = 0> +KOKKOS_FUNCTION Coordinate rmin( + DiscreteDomain const& d) { return coordinate(d.front()); } -template -KOKKOS_FUNCTION Coordinate rmax(DiscreteDomain> const& d) +template , int> = 0> +KOKKOS_FUNCTION Coordinate rmax( + DiscreteDomain const& d) { return coordinate(d.back()); } -template -KOKKOS_FUNCTION Coordinate rlength(DiscreteDomain> const& d) +template , int> = 0> +KOKKOS_FUNCTION Coordinate rlength( + DiscreteDomain const& d) { return rmax(d) - rmin(d); } -template -struct is_periodic_domain : std::false_type -{ -}; - -template -struct is_periodic_domain> - : std::conditional_t<(is_periodic_sampling_v && ...), std::true_type, std::false_type> -{ -}; - -template -constexpr bool is_periodic_domain_v = is_periodic_domain::value; - } // namespace ddc diff --git a/vendor/ddc/include/ddc/rectilinear_domain.hpp b/vendor/ddc/include/ddc/rectilinear_domain.hpp deleted file mode 100644 index 65abfd96d..000000000 --- a/vendor/ddc/include/ddc/rectilinear_domain.hpp +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) The DDC development team, see COPYRIGHT.md file -// -// SPDX-License-Identifier: MIT - -#pragma once - -#include - -#include "ddc/discrete_domain.hpp" -#include "ddc/non_uniform_point_sampling.hpp" -#include "ddc/uniform_point_sampling.hpp" - -namespace ddc { - -template -struct is_rectilinear_domain : std::false_type -{ -}; - -template -struct is_rectilinear_domain> - : std::conditional_t< - ((is_uniform_sampling_v || is_non_uniform_sampling_v)&&...), - std::true_type, - std::false_type> -{ -}; - -template -constexpr bool is_rectilinear_domain_v = is_rectilinear_domain::value; - -} // namespace ddc diff --git a/vendor/ddc/include/ddc/uniform_point_sampling.hpp b/vendor/ddc/include/ddc/uniform_point_sampling.hpp index b1cd9597b..16ca79f10 100644 --- a/vendor/ddc/include/ddc/uniform_point_sampling.hpp +++ b/vendor/ddc/include/ddc/uniform_point_sampling.hpp @@ -21,10 +21,14 @@ namespace ddc { +struct UniformPointSamplingBase +{ +}; + /** UniformPointSampling models a uniform discretization of the provided continuous dimension */ template -class UniformPointSampling +class UniformPointSampling : UniformPointSamplingBase { public: using continuous_dimension_type = CDim; @@ -34,17 +38,11 @@ class UniformPointSampling using discrete_dimension_type = UniformPointSampling; - using discrete_element_type = DiscreteElement; - - using discrete_domain_type = DiscreteDomain; - - using discrete_vector_type = DiscreteVector; - public: - template + template class Impl { - template + template friend class Impl; private: @@ -55,12 +53,18 @@ class UniformPointSampling public: using discrete_dimension_type = UniformPointSampling; + using discrete_domain_type = DiscreteDomain; + + using discrete_element_type = DiscreteElement; + + using discrete_vector_type = DiscreteVector; + Impl() = default; Impl(Impl const&) = delete; template - explicit Impl(Impl const& impl) + explicit Impl(Impl const& impl) : m_origin(impl.m_origin) , m_step(impl.m_step) { @@ -113,15 +117,15 @@ class UniformPointSampling * @param b coordinate of the last point of the domain * @param n number of points to map on the segment \f$[a, b]\f$ including a & b */ - static std::tuple, discrete_domain_type> init( - continuous_element_type a, - continuous_element_type b, - discrete_vector_type n) + template + static std::tuple, DiscreteDomain> + init(Coordinate a, Coordinate b, DiscreteVector n) { assert(a < b); assert(n > 1); - Impl disc(a, continuous_element_type {(b - a) / (n - 1)}); - discrete_domain_type domain {disc.front(), n}; + typename DDim::template Impl + disc(a, Coordinate {(b - a) / (n - 1)}); + DiscreteDomain domain {disc.front(), n}; return std::make_tuple(std::move(disc), std::move(domain)); } @@ -134,24 +138,25 @@ class UniformPointSampling * @param n_ghosts_before number of additional "ghost" points before the segment * @param n_ghosts_after number of additional "ghost" points after the segment */ + template static std::tuple< - Impl, - discrete_domain_type, - discrete_domain_type, - discrete_domain_type, - discrete_domain_type> + typename DDim::template Impl, + DiscreteDomain, + DiscreteDomain, + DiscreteDomain, + DiscreteDomain> init_ghosted( - continuous_element_type a, - continuous_element_type b, - discrete_vector_type n, - discrete_vector_type n_ghosts_before, - discrete_vector_type n_ghosts_after) + Coordinate a, + Coordinate b, + DiscreteVector n, + DiscreteVector n_ghosts_before, + DiscreteVector n_ghosts_after) { - using discrete_domain_type = discrete_domain_type; + using discrete_domain_type = DiscreteDomain; assert(a < b); assert(n > 1); Real discretization_step {(b - a) / (n - 1)}; - Impl + typename DDim::template Impl disc(a - n_ghosts_before.value() * discretization_step, discretization_step); discrete_domain_type ghosted_domain = discrete_domain_type(disc.front(), n + n_ghosts_before + n_ghosts_after); @@ -177,36 +182,31 @@ class UniformPointSampling * @param n the number of points to map the segment \f$[a, b]\f$ including a & b * @param n_ghosts number of additional "ghost" points before and after the segment */ + template static std::tuple< - Impl, - discrete_domain_type, - discrete_domain_type, - discrete_domain_type, - discrete_domain_type> + typename DDim::template Impl, + DiscreteDomain, + DiscreteDomain, + DiscreteDomain, + DiscreteDomain> init_ghosted( - continuous_element_type a, - continuous_element_type b, - discrete_vector_type n, - discrete_vector_type n_ghosts) + Coordinate a, + Coordinate b, + DiscreteVector n, + DiscreteVector n_ghosts) { return init_ghosted(a, b, n, n_ghosts, n_ghosts); } }; -template -struct is_uniform_sampling : public std::false_type -{ -}; - -template -struct is_uniform_sampling> : public std::true_type +template +struct is_uniform_sampling : public std::is_base_of { }; template constexpr bool is_uniform_sampling_v = is_uniform_sampling::value; - template < class DDimImpl, std::enable_if_t< @@ -218,24 +218,26 @@ std::ostream& operator<<(std::ostream& out, DDimImpl const& mesh) << " )"; } -template -KOKKOS_FUNCTION Coordinate coordinate(DiscreteElement> const& c) +template , int> = 0> +KOKKOS_FUNCTION constexpr Coordinate coordinate( + DiscreteElement const& c) { - return discrete_space>().coordinate(c); + return discrete_space().coordinate(c); } /// @brief Lower bound index of the mesh template -KOKKOS_FUNCTION std:: - enable_if_t, typename DDim::continuous_element_type> - origin() noexcept +KOKKOS_FUNCTION std::enable_if_t< + is_uniform_sampling_v, + Coordinate> +origin() noexcept { return discrete_space().origin(); } /// @brief Lower bound index of the mesh template -KOKKOS_FUNCTION std::enable_if_t, typename DDim::discrete_element_type> +KOKKOS_FUNCTION std::enable_if_t, DiscreteElement> front() noexcept { return discrete_space().front(); @@ -248,48 +250,39 @@ KOKKOS_FUNCTION std::enable_if_t, Real> step() noexc return discrete_space().step(); } -template -KOKKOS_FUNCTION Coordinate distance_at_left(DiscreteElement>) +template , int> = 0> +KOKKOS_FUNCTION Coordinate distance_at_left( + DiscreteElement) { - return Coordinate(step>()); + return Coordinate(step()); } -template -KOKKOS_FUNCTION Coordinate distance_at_right(DiscreteElement>) +template , int> = 0> +KOKKOS_FUNCTION Coordinate distance_at_right( + DiscreteElement) { - return Coordinate(step>()); + return Coordinate(step()); } -template -KOKKOS_FUNCTION Coordinate rmin(DiscreteDomain> const& d) +template , int> = 0> +KOKKOS_FUNCTION Coordinate rmin( + DiscreteDomain const& d) { return coordinate(d.front()); } -template -KOKKOS_FUNCTION Coordinate rmax(DiscreteDomain> const& d) +template , int> = 0> +KOKKOS_FUNCTION Coordinate rmax( + DiscreteDomain const& d) { return coordinate(d.back()); } -template -KOKKOS_FUNCTION Coordinate rlength(DiscreteDomain> const& d) +template , int> = 0> +KOKKOS_FUNCTION Coordinate rlength( + DiscreteDomain const& d) { return rmax(d) - rmin(d); } -template -struct is_uniform_domain : std::false_type -{ -}; - -template -struct is_uniform_domain> - : std::conditional_t<(is_uniform_sampling_v && ...), std::true_type, std::false_type> -{ -}; - -template -constexpr bool is_uniform_domain_v = is_uniform_domain::value; - } // namespace ddc diff --git a/vendor/ddc/tests/CMakeLists.txt b/vendor/ddc/tests/CMakeLists.txt index 332764aa7..e6367a58b 100644 --- a/vendor/ddc/tests/CMakeLists.txt +++ b/vendor/ddc/tests/CMakeLists.txt @@ -19,8 +19,6 @@ add_executable(ddc_tests type_seq.cpp uniform_point_sampling.cpp transform_reduce.cpp - rectilinear_domain.cpp - uniform_domain.cpp for_each.cpp parallel_fill.cpp discrete_element.cpp @@ -29,6 +27,7 @@ add_executable(ddc_tests parallel_for_each.cpp parallel_deepcopy.cpp parallel_transform_reduce.cpp + multiple_discrete_dimensions.cpp ) target_compile_features(ddc_tests PUBLIC cxx_std_17) target_link_libraries(ddc_tests diff --git a/vendor/ddc/tests/chunk.cpp b/vendor/ddc/tests/chunk.cpp index b9bc717c0..b3801c660 100644 --- a/vendor/ddc/tests/chunk.cpp +++ b/vendor/ddc/tests/chunk.cpp @@ -22,7 +22,9 @@ template using ChunkSpan0D = ddc::ChunkSpan; -struct DDimX; +struct DDimX +{ +}; using DElemX = ddc::DiscreteElement; using DVectX = ddc::DiscreteVector; using DDomX = ddc::DiscreteDomain; @@ -31,7 +33,9 @@ template using ChunkX = ddc::Chunk; -struct DDimY; +struct DDimY +{ +}; using DElemY = ddc::DiscreteElement; using DVectY = ddc::DiscreteVector; using DDomY = ddc::DiscreteDomain; @@ -40,7 +44,9 @@ template using ChunkY = ddc::Chunk; -struct DDimZ; +struct DDimZ +{ +}; using DElemZ = ddc::DiscreteElement; using DVectZ = ddc::DiscreteVector; using DDomZ = ddc::DiscreteDomain; diff --git a/vendor/ddc/tests/discrete_domain.cpp b/vendor/ddc/tests/discrete_domain.cpp index 5fc3ebb93..66b8b4dc1 100644 --- a/vendor/ddc/tests/discrete_domain.cpp +++ b/vendor/ddc/tests/discrete_domain.cpp @@ -8,19 +8,25 @@ namespace { -struct DDimX; +struct DDimX +{ +}; using DElemX = ddc::DiscreteElement; using DVectX = ddc::DiscreteVector; using DDomX = ddc::DiscreteDomain; -struct DDimY; +struct DDimY +{ +}; using DElemY = ddc::DiscreteElement; using DVectY = ddc::DiscreteVector; using DDomY = ddc::DiscreteDomain; -struct DDimZ; +struct DDimZ +{ +}; using DElemZ = ddc::DiscreteElement; using DVectZ = ddc::DiscreteVector; using DDomZ = ddc::DiscreteDomain; @@ -138,8 +144,10 @@ TEST(ProductMDomainTest, RangeFor) TEST(ProductMDomainTest, DiffEmpty) { DDomX const dom_x = DDomX(); - auto const subdomain = ddc::remove_dims_of(dom_x, dom_x); - EXPECT_EQ(subdomain, ddc::DiscreteDomain<>()); + auto const subdomain1 = ddc::remove_dims_of(dom_x, dom_x); + auto const subdomain2 = ddc::remove_dims_of(dom_x); + EXPECT_EQ(subdomain1, ddc::DiscreteDomain<>()); + EXPECT_EQ(subdomain2, ddc::DiscreteDomain<>()); } TEST(ProductMDomainTest, Diff) @@ -147,8 +155,10 @@ TEST(ProductMDomainTest, Diff) DDomX const dom_x = DDomX(); DDomXY const dom_x_y = DDomXY(); DDomZY const dom_z_y = DDomZY(); - auto const subdomain = ddc::remove_dims_of(dom_x_y, dom_z_y); - EXPECT_EQ(subdomain, dom_x); + auto const subdomain1 = ddc::remove_dims_of(dom_x_y, dom_z_y); + auto const subdomain2 = ddc::remove_dims_of(dom_x_y); + EXPECT_EQ(subdomain1, dom_x); + EXPECT_EQ(subdomain2, dom_x); } TEST(ProductMDomainTest, Replace) diff --git a/vendor/ddc/tests/discrete_element.cpp b/vendor/ddc/tests/discrete_element.cpp index dd0e78c0e..50effa17d 100644 --- a/vendor/ddc/tests/discrete_element.cpp +++ b/vendor/ddc/tests/discrete_element.cpp @@ -10,17 +10,23 @@ namespace { -struct DDimX; +struct DDimX +{ +}; using DElemX = ddc::DiscreteElement; using DVectX = ddc::DiscreteVector; -struct DDimY; +struct DDimY +{ +}; using DElemY = ddc::DiscreteElement; using DVectY = ddc::DiscreteVector; -struct DDimZ; +struct DDimZ +{ +}; using DElemZ = ddc::DiscreteElement; using DVectZ = ddc::DiscreteVector; diff --git a/vendor/ddc/tests/discrete_space.cpp b/vendor/ddc/tests/discrete_space.cpp index 89d65f751..1400b991a 100644 --- a/vendor/ddc/tests/discrete_space.cpp +++ b/vendor/ddc/tests/discrete_space.cpp @@ -9,16 +9,18 @@ namespace { struct DimX; -using DDimX = ddc::UniformPointSampling; +struct DDimX : ddc::UniformPointSampling +{ +}; } // namespace TEST(DiscreteSpace, IsDiscreteSpaceInitialized) { EXPECT_FALSE(ddc::is_discrete_space_initialized()); - ddc::init_discrete_space(DDimX:: - init(ddc::Coordinate(0), - ddc::Coordinate(1), - ddc::DiscreteVector(2))); + ddc::init_discrete_space(DDimX::template init( + ddc::Coordinate(0), + ddc::Coordinate(1), + ddc::DiscreteVector(2))); EXPECT_TRUE(ddc::is_discrete_space_initialized()); } diff --git a/vendor/ddc/tests/discrete_space/discrete_space.cpp b/vendor/ddc/tests/discrete_space/discrete_space.cpp index ee10aedc5..5b2fae44e 100644 --- a/vendor/ddc/tests/discrete_space/discrete_space.cpp +++ b/vendor/ddc/tests/discrete_space/discrete_space.cpp @@ -9,14 +9,16 @@ #include "discrete_space.hpp" struct DimX; -using DDimX = ddc::UniformPointSampling; +struct DDimX : ddc::UniformPointSampling +{ +}; void do_not_optimize_away_discrete_space_tests() {} TEST(DiscreteSpace, Initialization) { - ddc::init_discrete_space(DDimX:: - init(ddc::Coordinate(0), - ddc::Coordinate(1), - ddc::DiscreteVector(2))); + ddc::init_discrete_space(DDimX::init( + ddc::Coordinate(0), + ddc::Coordinate(1), + ddc::DiscreteVector(2))); } diff --git a/vendor/ddc/tests/discrete_vector.cpp b/vendor/ddc/tests/discrete_vector.cpp index c81e9496c..99e1137c8 100644 --- a/vendor/ddc/tests/discrete_vector.cpp +++ b/vendor/ddc/tests/discrete_vector.cpp @@ -10,15 +10,21 @@ namespace { -struct DDimX; +struct DDimX +{ +}; using DVectX = ddc::DiscreteVector; -struct DDimY; +struct DDimY +{ +}; using DVectY = ddc::DiscreteVector; -struct DDimZ; +struct DDimZ +{ +}; using DVectZ = ddc::DiscreteVector; diff --git a/vendor/ddc/tests/fft.cpp b/vendor/ddc/tests/fft.cpp index 2ca4de579..f2cfd4727 100644 --- a/vendor/ddc/tests/fft.cpp +++ b/vendor/ddc/tests/fft.cpp @@ -11,7 +11,9 @@ #include template -using DDim = ddc::UniformPointSampling; +struct DDim : ddc::UniformPointSampling +{ +}; template using DElem = ddc::DiscreteElement; @@ -23,7 +25,9 @@ template using DDom = ddc::DiscreteDomain; template -using DFDim = ddc::PeriodicSampling; +struct DFDim : ddc::PeriodicSampling +{ +}; // TODO: // - FFT multidim but according to a subset of dimensions @@ -37,15 +41,15 @@ static void test_fft() double const b = 10; std::size_t const Nx = 64; // Optimal value is (b-a)^2/(2*pi) - DDom...> const x_mesh( - ddc::init_discrete_space(DDim:: - init(ddc::Coordinate(a + (b - a) / Nx / 2), - ddc::Coordinate(b - (b - a) / Nx / 2), - DVect>(Nx)))...); - (ddc::init_discrete_space>>( - ddc::init_fourier_space(ddc::DiscreteDomain>(x_mesh))), + DDom...> const x_mesh(ddc::init_discrete_space>(DDim::template init>( + ddc::Coordinate(a + (b - a) / Nx / 2), + ddc::Coordinate(b - (b - a) / Nx / 2), + DVect>(Nx)))...); + (ddc::init_discrete_space>>( + ddc::init_fourier_space>>(ddc::DiscreteDomain>(x_mesh))), ...); - DDom>...> const k_mesh = ddc::FourierMesh(x_mesh, full_fft); + DDom>...> const k_mesh( + ddc::FourierMesh>...>(x_mesh, full_fft)); ddc::Chunk f_alloc(x_mesh, ddc::KokkosAllocator()); ddc::ChunkSpan const f = f_alloc.span_view(); @@ -127,13 +131,14 @@ static void test_fft_norm(ddc::FFT_Normalization const norm) bool const full_fft = ddc::detail::fft::is_complex_v && ddc::detail::fft::is_complex_v; - DDom> const x_mesh = ddc::init_discrete_space(DDim:: - init(ddc::Coordinate(-1. / 4), - ddc::Coordinate(1. / 4), - DVect>(2))); - ddc::init_discrete_space>>( - ddc::init_fourier_space(x_mesh)); - DDom>> const k_mesh = ddc::FourierMesh(x_mesh, full_fft); + DDom> const x_mesh(ddc::init_discrete_space>(DDim::template init>( + ddc::Coordinate(-1. / 4), + ddc::Coordinate(1. / 4), + DVect>(2)))); + ddc::init_discrete_space>>( + ddc::init_fourier_space>>(x_mesh)); + DDom>> const k_mesh + = ddc::FourierMesh>>(x_mesh, full_fft); ddc::Chunk f_alloc = ddc::Chunk(x_mesh, ddc::KokkosAllocator()); ddc::ChunkSpan const f = f_alloc.span_view(); diff --git a/vendor/ddc/tests/for_each.cpp b/vendor/ddc/tests/for_each.cpp index d7fe7bbe1..947337b0b 100644 --- a/vendor/ddc/tests/for_each.cpp +++ b/vendor/ddc/tests/for_each.cpp @@ -17,12 +17,16 @@ using DElem0D = ddc::DiscreteElement<>; using DVect0D = ddc::DiscreteVector<>; using DDom0D = ddc::DiscreteDomain<>; -struct DDimX; +struct DDimX +{ +}; using DElemX = ddc::DiscreteElement; using DVectX = ddc::DiscreteVector; using DDomX = ddc::DiscreteDomain; -struct DDimY; +struct DDimY +{ +}; using DElemY = ddc::DiscreteElement; using DVectY = ddc::DiscreteVector; using DDomY = ddc::DiscreteDomain; diff --git a/vendor/ddc/tests/multiple_discrete_dimensions.cpp b/vendor/ddc/tests/multiple_discrete_dimensions.cpp new file mode 100644 index 000000000..ce8ae44e5 --- /dev/null +++ b/vendor/ddc/tests/multiple_discrete_dimensions.cpp @@ -0,0 +1,75 @@ +// Copyright (C) The DDC development team, see COPYRIGHT.md file +// +// SPDX-License-Identifier: MIT + +#include + +#include + +#include + +namespace { + +class SingleValueDiscreteDimension +{ +public: + using discrete_dimension_type = SingleValueDiscreteDimension; + +public: + template + class Impl + { + template + friend class Impl; + + private: + int m_value; + + public: + using discrete_dimension_type = SingleValueDiscreteDimension; + + Impl() = default; + + Impl(Impl const&) = delete; + + template + explicit Impl(Impl const& impl) : m_value(impl.m_value) + { + } + + Impl(Impl&&) = default; + + /** @brief Construct a `Impl` from a point and a spacing step. + * + * @param origin the real coordinate of mesh coordinate 0 + * @param step the real distance between two points of mesh distance 1 + */ + explicit Impl(int value) : m_value(value) {} + + ~Impl() = default; + + /// @brief Convert a mesh index into a position in `CDim` + KOKKOS_FUNCTION int value() const noexcept + { + return m_value; + } + }; +}; + +struct SVDD1 : SingleValueDiscreteDimension +{ +}; + +struct SVDD2 : SingleValueDiscreteDimension +{ +}; + +} // namespace + +TEST(MultipleDiscreteDimensions, Value) +{ + ddc::init_discrete_space(239); + ddc::init_discrete_space(928); + EXPECT_EQ(ddc::discrete_space().value(), 239); + EXPECT_EQ(ddc::discrete_space().value(), 928); +} diff --git a/vendor/ddc/tests/non_uniform_point_sampling.cpp b/vendor/ddc/tests/non_uniform_point_sampling.cpp index 42bbce3d0..0801c037d 100644 --- a/vendor/ddc/tests/non_uniform_point_sampling.cpp +++ b/vendor/ddc/tests/non_uniform_point_sampling.cpp @@ -29,8 +29,13 @@ namespace { struct DimX; struct DimY; -using DDimX = ddc::NonUniformPointSampling; -using DDimY = ddc::NonUniformPointSampling; +struct DDimX : ddc::NonUniformPointSampling +{ +}; + +struct DDimY : ddc::NonUniformPointSampling +{ +}; static std::array const array_points_x VALUES_X; static std::vector const vector_points_x VALUES_X; @@ -50,35 +55,36 @@ static ddc::Coordinate constexpr point_rxy(0.3, 0.2); TEST(NonUniformPointSamplingTest, ListConstructor) { - DDimX::Impl const ddim_x(VALUES_X); + DDimX::Impl const ddim_x(VALUES_X); EXPECT_EQ(ddim_x.size(), 4); EXPECT_EQ(ddim_x.coordinate(point_ix), point_rx); } TEST(NonUniformPointSamplingTest, ArrayConstructor) { - DDimX::Impl const ddim_x(array_points_x); + DDimX::Impl const ddim_x(array_points_x); EXPECT_EQ(ddim_x.size(), array_points_x.size()); EXPECT_EQ(ddim_x.coordinate(point_ix), point_rx); } TEST(NonUniformPointSamplingTest, VectorConstructor) { - DDimX::Impl const ddim_x(vector_points_x); + DDimX::Impl const ddim_x(vector_points_x); EXPECT_EQ(ddim_x.size(), vector_points_x.size()); EXPECT_EQ(ddim_x.coordinate(point_ix), point_rx); } TEST(NonUniformPointSamplingTest, IteratorConstructor) { - DDimX::Impl const ddim_x(vector_points_x.begin(), vector_points_x.end()); + DDimX::Impl const + ddim_x(vector_points_x.begin(), vector_points_x.end()); EXPECT_EQ(ddim_x.size(), vector_points_x.size()); EXPECT_EQ(ddim_x.coordinate(point_ix), point_rx); } TEST(NonUniformPointSampling, Formatting) { - DDimX::Impl const ddim_x( + DDimX::Impl const ddim_x( {ddc::Coordinate(0.1), ddc::Coordinate(0.4)}); std::stringstream oss; oss << ddim_x; diff --git a/vendor/ddc/tests/parallel_deepcopy.cpp b/vendor/ddc/tests/parallel_deepcopy.cpp index 2f01a346b..f216fafd7 100644 --- a/vendor/ddc/tests/parallel_deepcopy.cpp +++ b/vendor/ddc/tests/parallel_deepcopy.cpp @@ -11,12 +11,16 @@ namespace { -struct DDimX; +struct DDimX +{ +}; using DElemX = ddc::DiscreteElement; using DVectX = ddc::DiscreteVector; using DDomX = ddc::DiscreteDomain; -struct DDimY; +struct DDimY +{ +}; using DElemY = ddc::DiscreteElement; using DVectY = ddc::DiscreteVector; using DDomY = ddc::DiscreteDomain; diff --git a/vendor/ddc/tests/parallel_fill.cpp b/vendor/ddc/tests/parallel_fill.cpp index 9f950aa53..af7be3fe7 100644 --- a/vendor/ddc/tests/parallel_fill.cpp +++ b/vendor/ddc/tests/parallel_fill.cpp @@ -11,12 +11,16 @@ namespace { -struct DDimX; +struct DDimX +{ +}; using DElemX = ddc::DiscreteElement; using DVectX = ddc::DiscreteVector; using DDomX = ddc::DiscreteDomain; -struct DDimY; +struct DDimY +{ +}; using DElemY = ddc::DiscreteElement; using DVectY = ddc::DiscreteVector; using DDomY = ddc::DiscreteDomain; diff --git a/vendor/ddc/tests/parallel_for_each.cpp b/vendor/ddc/tests/parallel_for_each.cpp index b1d248334..ddedd0341 100644 --- a/vendor/ddc/tests/parallel_for_each.cpp +++ b/vendor/ddc/tests/parallel_for_each.cpp @@ -17,12 +17,16 @@ using DElem0D = ddc::DiscreteElement<>; using DVect0D = ddc::DiscreteVector<>; using DDom0D = ddc::DiscreteDomain<>; -struct DDimX; +struct DDimX +{ +}; using DElemX = ddc::DiscreteElement; using DVectX = ddc::DiscreteVector; using DDomX = ddc::DiscreteDomain; -struct DDimY; +struct DDimY +{ +}; using DElemY = ddc::DiscreteElement; using DVectY = ddc::DiscreteVector; using DDomY = ddc::DiscreteDomain; diff --git a/vendor/ddc/tests/parallel_transform_reduce.cpp b/vendor/ddc/tests/parallel_transform_reduce.cpp index 35acee89e..fb9398d17 100644 --- a/vendor/ddc/tests/parallel_transform_reduce.cpp +++ b/vendor/ddc/tests/parallel_transform_reduce.cpp @@ -14,12 +14,16 @@ using DElem0D = ddc::DiscreteElement<>; using DVect0D = ddc::DiscreteVector<>; using DDom0D = ddc::DiscreteDomain<>; -struct DDimX; +struct DDimX +{ +}; using DElemX = ddc::DiscreteElement; using DVectX = ddc::DiscreteVector; using DDomX = ddc::DiscreteDomain; -struct DDimY; +struct DDimY +{ +}; using DElemY = ddc::DiscreteElement; using DVectY = ddc::DiscreteVector; using DDomY = ddc::DiscreteDomain; diff --git a/vendor/ddc/tests/rectilinear_domain.cpp b/vendor/ddc/tests/rectilinear_domain.cpp deleted file mode 100644 index cafd8f8d9..000000000 --- a/vendor/ddc/tests/rectilinear_domain.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (C) The DDC development team, see COPYRIGHT.md file -// -// SPDX-License-Identifier: MIT - -#include - -#include - -#include - -namespace { - -struct X; -struct Y; - -using DDimX = ddc::UniformPointSampling; -using DDimY = ddc::UniformPointSampling; -using NUDDimX = ddc::NonUniformPointSampling; -using NUDDimY = ddc::NonUniformPointSampling; - -using DDomNull = ddc::DiscreteDomain; -using DDomX = ddc::DiscreteDomain; -using NUDDomX = ddc::DiscreteDomain; -using DDomXY = ddc::DiscreteDomain; -using NUDDomXY = ddc::DiscreteDomain; -using DDomXNUDDomY = ddc::DiscreteDomain; - -} // namespace - -TEST(RectilinearDomainTest, NonDiscreteDomainSpecializationValue) -{ - EXPECT_FALSE(ddc::is_rectilinear_domain_v); - EXPECT_FALSE(ddc::is_rectilinear_domain_v); -} - -TEST(RectilinearDomainTest, DiscreteDomainSpecializationValue) -{ - EXPECT_FALSE(ddc::is_rectilinear_domain_v); - - EXPECT_TRUE(ddc::is_rectilinear_domain_v); - EXPECT_TRUE(ddc::is_rectilinear_domain_v); - EXPECT_TRUE(ddc::is_rectilinear_domain_v); - EXPECT_TRUE(ddc::is_rectilinear_domain_v); - EXPECT_TRUE(ddc::is_rectilinear_domain_v); -} diff --git a/vendor/ddc/tests/relocatable_device_code_initialization.hpp b/vendor/ddc/tests/relocatable_device_code_initialization.hpp index 84fe2fc55..d93a6d9ab 100644 --- a/vendor/ddc/tests/relocatable_device_code_initialization.hpp +++ b/vendor/ddc/tests/relocatable_device_code_initialization.hpp @@ -10,7 +10,9 @@ namespace rdc { struct DimX; -using DDimX = ddc::UniformPointSampling; +struct DDimX : ddc::UniformPointSampling +{ +}; using DElemX = ddc::DiscreteElement; using DVectX = ddc::DiscreteVector; using DDomX = ddc::DiscreteDomain; diff --git a/vendor/ddc/tests/single_discretization.cpp b/vendor/ddc/tests/single_discretization.cpp index becc3a42b..13642be27 100644 --- a/vendor/ddc/tests/single_discretization.cpp +++ b/vendor/ddc/tests/single_discretization.cpp @@ -8,15 +8,17 @@ #include -namespace { +namespace ddcexp = ddc::experimental; -using ddc::experimental::SingleDiscretization; +namespace { class DimX; using CoordX = ddc::Coordinate; -using DDimX = SingleDiscretization; +struct DDimX : ddcexp::SingleDiscretization +{ +}; using DElemX = ddc::DiscreteElement; @@ -24,14 +26,21 @@ using DElemX = ddc::DiscreteElement; TEST(SingleDiscretization, ClassSize) { - EXPECT_EQ(sizeof(DDimX::Impl), sizeof(double)); + EXPECT_EQ(sizeof(DDimX::Impl), sizeof(double)); } TEST(SingleDiscretization, Constructor) { CoordX const x(1.); - SingleDiscretization::Impl const ddim_x(x); + ddcexp::SingleDiscretization::Impl const ddim_x(x); EXPECT_EQ(ddim_x.coordinate(DElemX(0)), x); } + +TEST(SingleDiscretization, Coordinate) +{ + CoordX const x(1.); + ddc::init_discrete_space(x); + EXPECT_EQ(ddcexp::coordinate(DElemX(0)), x); +} diff --git a/vendor/ddc/tests/splines/batched_2d_spline_builder.cpp b/vendor/ddc/tests/splines/batched_2d_spline_builder.cpp index 0f5de6cc8..680257f04 100644 --- a/vendor/ddc/tests/splines/batched_2d_spline_builder.cpp +++ b/vendor/ddc/tests/splines/batched_2d_spline_builder.cpp @@ -87,24 +87,36 @@ using GrevillePoints = ddc::GrevilleInterpolationPoints; #if defined(BSPLINES_TYPE_UNIFORM) template -using BSplines = ddc::UniformBSplines; +struct BSplines : ddc::UniformBSplines +{ +}; // Gives discrete dimension. In the dimension of interest, it is deduced from the BSplines type. In the other dimensions, it has to be newly defined. In practice both types coincide in the test, but it may not be the case. +template +struct IDim_ + : std::conditional_t< + B, + typename GrevillePoints>::interpolation_mesh_type, + ddc::UniformPointSampling> +{ +}; + template -using IDim = std::conditional_t< - std::is_same_v || std::is_same_v, - typename GrevillePoints>::interpolation_mesh_type, - ddc::UniformPointSampling>; +using IDim = IDim_ || std::is_same_v>; #elif defined(BSPLINES_TYPE_NON_UNIFORM) template -using BSplines = ddc::NonUniformBSplines; +struct BSplines : ddc::NonUniformBSplines +{ +}; + +template +struct IDim_ : ddc::NonUniformPointSampling +{ +}; template -using IDim = std::conditional_t< - std::is_same_v || std::is_same_v, - typename GrevillePoints>::interpolation_mesh_type, - ddc::NonUniformPointSampling>; +using IDim = IDim_; #endif #if defined(BC_PERIODIC) @@ -171,10 +183,10 @@ struct DimsInitializer> void operator()(std::size_t const ncells) { #if defined(BSPLINES_TYPE_UNIFORM) - (ddc::init_discrete_space(IDimX:: - init(x0(), - xN(), - DVect(ncells))), + (ddc::init_discrete_space(IDimX::template init( + x0(), + xN(), + DVect(ncells))), ...); ddc::init_discrete_space>( x0(), @@ -193,11 +205,11 @@ struct DimsInitializer> breaks(ncells)); #endif ddc::init_discrete_space( - GrevillePoints< - BSplines>::get_sampling()); + GrevillePoints>:: + template get_sampling()); ddc::init_discrete_space( - GrevillePoints< - BSplines>::get_sampling()); + GrevillePoints>:: + template get_sampling()); } }; @@ -219,14 +231,14 @@ static void Batched2dSplineTest() // Create the values domain (mesh) #if defined(BC_HERMITE) - auto interpolation_domain1 - = ddc::DiscreteDomain>(GrevillePoints>::get_domain()); - auto interpolation_domain2 - = ddc::DiscreteDomain>(GrevillePoints>::get_domain()); + auto interpolation_domain1 = ddc::DiscreteDomain>( + GrevillePoints>::template get_domain>()); + auto interpolation_domain2 = ddc::DiscreteDomain>( + GrevillePoints>::template get_domain>()); #endif auto interpolation_domain = ddc::DiscreteDomain, IDim>( - GrevillePoints>::get_domain(), - GrevillePoints>::get_domain()); + GrevillePoints>::template get_domain>(), + GrevillePoints>::template get_domain>()); auto const dom_vals_tmp = ddc::DiscreteDomain...>( ddc::DiscreteDomain; #if defined(BSPLINES_TYPE_UNIFORM) template -using BSplines = ddc::UniformBSplines; +struct BSplines : ddc::UniformBSplines +{ +}; // Gives discrete dimension. In the dimension of interest, it is deduced from the BSplines type. In the other dimensions, it has to be newly defined. In practice both types coincide in the test, but it may not be the case. +template +struct IDim_ + : std::conditional_t< + B, + typename GrevillePoints>::interpolation_mesh_type, + ddc::UniformPointSampling> +{ +}; + template -using IDim = std::conditional_t< - std::is_same_v, - typename GrevillePoints>::interpolation_mesh_type, - ddc::UniformPointSampling>; +using IDim = IDim_>; #elif defined(BSPLINES_TYPE_NON_UNIFORM) template -using BSplines = ddc::NonUniformBSplines; +struct BSplines : ddc::NonUniformBSplines +{ +}; +template +struct IDim_ : ddc::NonUniformPointSampling +{ +}; template -using IDim = ddc::NonUniformPointSampling; +using IDim = IDim_; #endif template @@ -159,10 +173,10 @@ struct DimsInitializer> void operator()(std::size_t const ncells) { #if defined(BSPLINES_TYPE_UNIFORM) - (ddc::init_discrete_space(IDimX:: - init(x0(), - xN(), - DVect(ncells))), + (ddc::init_discrete_space(IDimX::template init( + x0(), + xN(), + DVect(ncells))), ...); ddc::init_discrete_space>( x0(), @@ -175,8 +189,8 @@ struct DimsInitializer> breaks(ncells)); #endif ddc::init_discrete_space( - GrevillePoints< - BSplines>::get_sampling()); + GrevillePoints>:: + template get_sampling()); } }; @@ -195,7 +209,7 @@ static void BatchedSplineTest() // Create the values domain (mesh) ddc::DiscreteDomain> interpolation_domain - = GrevillePoints>::get_domain(); + = GrevillePoints>::template get_domain>(); auto const dom_vals_tmp = ddc::DiscreteDomain...>( ddc::DiscreteDomain< IDim>(Index>(0), DVect>(ncells))...); diff --git a/vendor/ddc/tests/splines/bsplines.cpp b/vendor/ddc/tests/splines/bsplines.cpp index 91bcd88be..603af8933 100644 --- a/vendor/ddc/tests/splines/bsplines.cpp +++ b/vendor/ddc/tests/splines/bsplines.cpp @@ -25,6 +25,12 @@ struct BSplinesFixture + { + }; + struct NUBSplinesX : ddc::NonUniformBSplines + { + }; static constexpr std::size_t spline_degree = D; static constexpr std::size_t ncells = Nc; }; @@ -42,11 +48,12 @@ TYPED_TEST(BSplinesFixture, PartitionOfUnity_Uniform) { std::size_t constexpr degree = TestFixture::spline_degree; using DimX = typename TestFixture::DimX; + using BSplinesX = typename TestFixture::UBSplinesX; using CoordX = ddc::Coordinate; static constexpr CoordX xmin = CoordX(0.0); static constexpr CoordX xmax = CoordX(0.2); static constexpr std::size_t ncells = TestFixture::ncells; - ddc::init_discrete_space>(xmin, xmax, ncells); + ddc::init_discrete_space(xmin, xmax, ncells); std::array values; @@ -55,7 +62,7 @@ TYPED_TEST(BSplinesFixture, PartitionOfUnity_Uniform) for (std::size_t i(0); i < n_test_points; ++i) { CoordX test_point(xmin + dx * i); - ddc::discrete_space>().eval_basis(values, test_point); + ddc::discrete_space().eval_basis(values, test_point); double sum = 0.0; for (std::size_t j(0); j < degree + 1; ++j) { sum += values[j]; @@ -68,6 +75,7 @@ TYPED_TEST(BSplinesFixture, PartitionOfUnity_NonUniform) { std::size_t constexpr degree = TestFixture::spline_degree; using DimX = typename TestFixture::DimX; + using BSplinesX = typename TestFixture::NUBSplinesX; using CoordX = ddc::Coordinate; static constexpr CoordX xmin = CoordX(0.0); static constexpr CoordX xmax = CoordX(0.2); @@ -77,7 +85,7 @@ TYPED_TEST(BSplinesFixture, PartitionOfUnity_NonUniform) for (std::size_t i(0); i < ncells + 1; ++i) { breaks[i] = CoordX(xmin + i * dx); } - ddc::init_discrete_space>(breaks); + ddc::init_discrete_space(breaks); std::array values; @@ -86,7 +94,7 @@ TYPED_TEST(BSplinesFixture, PartitionOfUnity_NonUniform) for (std::size_t i(0); i < n_test_points; ++i) { CoordX test_point(xmin + dx * i); - ddc::discrete_space>().eval_basis(values, test_point); + ddc::discrete_space().eval_basis(values, test_point); double sum = 0.0; for (std::size_t j(0); j < degree + 1; ++j) { sum += values[j]; diff --git a/vendor/ddc/tests/splines/extrapolation_rule.cpp b/vendor/ddc/tests/splines/extrapolation_rule.cpp index 864b51f76..e89b41e00 100644 --- a/vendor/ddc/tests/splines/extrapolation_rule.cpp +++ b/vendor/ddc/tests/splines/extrapolation_rule.cpp @@ -69,24 +69,34 @@ using GrevillePoints = ddc:: #if defined(BSPLINES_TYPE_UNIFORM) template -using BSplines = ddc::UniformBSplines; +struct BSplines : ddc::UniformBSplines +{ +}; // Gives discrete dimension. In the dimension of interest, it is deduced from the BSplines type. In the other dimensions, it has to be newly defined. In practice both types coincide in the test, but it may not be the case. template -using IDim = std::conditional_t< - std::is_same_v || std::is_same_v, - typename GrevillePoints>::interpolation_mesh_type, - ddc::UniformPointSampling>; +struct IDim + : std::conditional_t< + std::is_same_v || std::is_same_v, + typename GrevillePoints>::interpolation_mesh_type, + ddc::UniformPointSampling> +{ +}; #elif defined(BSPLINES_TYPE_NON_UNIFORM) template -using BSplines = ddc::NonUniformBSplines; +struct BSplines : ddc::NonUniformBSplines +{ +}; template -using IDim = std::conditional_t< - std::is_same_v || std::is_same_v, - typename GrevillePoints>::interpolation_mesh_type, - ddc::NonUniformPointSampling>; +struct IDim + : std::conditional_t< + std::is_same_v || std::is_same_v, + typename GrevillePoints>::interpolation_mesh_type, + ddc::NonUniformPointSampling> +{ +}; #endif #if defined(BC_PERIODIC) @@ -153,10 +163,10 @@ struct DimsInitializer> void operator()(std::size_t const ncells) { #if defined(BSPLINES_TYPE_UNIFORM) - (ddc::init_discrete_space(IDimX:: - init(x0(), - xN(), - DVect(ncells))), + (ddc::init_discrete_space(IDimX::template init( + x0(), + xN(), + DVect(ncells))), ...); ddc::init_discrete_space>( x0(), @@ -175,11 +185,11 @@ struct DimsInitializer> breaks(ncells)); #endif ddc::init_discrete_space( - GrevillePoints< - BSplines>::get_sampling()); + GrevillePoints>:: + template get_sampling()); ddc::init_discrete_space( - GrevillePoints< - BSplines>::get_sampling()); + GrevillePoints>:: + template get_sampling()); } }; @@ -201,8 +211,8 @@ static void ExtrapolationRuleSplineTest() // Create the values domain (mesh) auto interpolation_domain = ddc::DiscreteDomain, IDim>( - GrevillePoints>::get_domain(), - GrevillePoints>::get_domain()); + GrevillePoints>::template get_domain>(), + GrevillePoints>::template get_domain>()); auto const dom_vals_tmp = ddc::DiscreteDomain...>( ddc::DiscreteDomain; +struct BSplinesX : ddc::UniformBSplines +{ +}; #elif defined(BSPLINES_TYPE_NON_UNIFORM) -using BSplinesX = ddc::NonUniformBSplines; +struct BSplinesX : ddc::NonUniformBSplines +{ +}; #endif using GrevillePoints = ddc::GrevilleInterpolationPoints; -using IDimX = GrevillePoints::interpolation_mesh_type; +struct IDimX : GrevillePoints::interpolation_mesh_type +{ +}; #if defined(EVALUATOR_COSINE) using evaluator_type = CosineEvaluator::Evaluator; @@ -95,8 +101,8 @@ TEST(NonPeriodicSplineBuilderTest, Identity) ddc::Chunk coef(dom_bsplines_x, ddc::KokkosAllocator()); // 3. Create the interpolation domain - ddc::init_discrete_space(GrevillePoints::get_sampling()); - ddc::DiscreteDomain interpolation_domain(GrevillePoints::get_domain()); + ddc::init_discrete_space(GrevillePoints::get_sampling()); + ddc::DiscreteDomain interpolation_domain(GrevillePoints::get_domain()); // 4. Create a SplineBuilder over BSplines using some boundary conditions ddc::SplineBuilder< diff --git a/vendor/ddc/tests/splines/periodic_spline_builder.cpp b/vendor/ddc/tests/splines/periodic_spline_builder.cpp index 409f15892..794b8f562 100644 --- a/vendor/ddc/tests/splines/periodic_spline_builder.cpp +++ b/vendor/ddc/tests/splines/periodic_spline_builder.cpp @@ -27,15 +27,21 @@ struct DimX static constexpr std::size_t s_degree_x = DEGREE_X; #if defined(BSPLINES_TYPE_UNIFORM) -using BSplinesX = ddc::UniformBSplines; +struct BSplinesX : ddc::UniformBSplines +{ +}; #elif defined(BSPLINES_TYPE_NON_UNIFORM) -using BSplinesX = ddc::NonUniformBSplines; +struct BSplinesX : ddc::NonUniformBSplines +{ +}; #endif using GrevillePoints = ddc:: GrevilleInterpolationPoints; -using IDimX = GrevillePoints::interpolation_mesh_type; +struct IDimX : GrevillePoints::interpolation_mesh_type +{ +}; using evaluator_type = CosineEvaluator::Evaluator; @@ -74,8 +80,8 @@ TEST(PeriodicSplineBuilderTest, Identity) ddc::Chunk coef(dom_bsplines_x, ddc::KokkosAllocator()); // 3. Create the interpolation domain - ddc::init_discrete_space(GrevillePoints::get_sampling()); - ddc::DiscreteDomain interpolation_domain(GrevillePoints::get_domain()); + ddc::init_discrete_space(GrevillePoints::get_sampling()); + ddc::DiscreteDomain interpolation_domain(GrevillePoints::get_domain()); // 4. Create a SplineBuilder over BSplines using some boundary conditions ddc::SplineBuilder< diff --git a/vendor/ddc/tests/splines/periodic_spline_builder_ordered_points.cpp b/vendor/ddc/tests/splines/periodic_spline_builder_ordered_points.cpp index 585fdff11..b69311f58 100644 --- a/vendor/ddc/tests/splines/periodic_spline_builder_ordered_points.cpp +++ b/vendor/ddc/tests/splines/periodic_spline_builder_ordered_points.cpp @@ -22,12 +22,16 @@ struct DimX static constexpr std::size_t s_degree_x = DEGREE_X; -using BSplinesX = ddc::NonUniformBSplines; +struct BSplinesX : ddc::NonUniformBSplines +{ +}; using GrevillePoints = ddc:: GrevilleInterpolationPoints; -using IDimX = GrevillePoints::interpolation_mesh_type; +struct IDimX : GrevillePoints::interpolation_mesh_type +{ +}; using IndexX = ddc::DiscreteElement; using DVectX = ddc::DiscreteVector; @@ -50,8 +54,8 @@ TEST(PeriodicSplineBuilderOrderTest, OrderedPoints) ddc::init_discrete_space(breaks); // 2. Create the interpolation domain - ddc::init_discrete_space(GrevillePoints::get_sampling()); - ddc::DiscreteDomain interpolation_domain(GrevillePoints::get_domain()); + ddc::init_discrete_space(GrevillePoints::get_sampling()); + ddc::DiscreteDomain interpolation_domain(GrevillePoints::get_domain()); double last(ddc::coordinate(interpolation_domain.front())); double current; diff --git a/vendor/ddc/tests/splines/periodicity_spline_builder.cpp b/vendor/ddc/tests/splines/periodicity_spline_builder.cpp index bed04565c..7a04c8431 100644 --- a/vendor/ddc/tests/splines/periodicity_spline_builder.cpp +++ b/vendor/ddc/tests/splines/periodicity_spline_builder.cpp @@ -32,18 +32,26 @@ using GrevillePoints = ddc:: #if defined(BSPLINES_TYPE_UNIFORM) template -using BSplines = ddc::UniformBSplines; +struct BSplines : ddc::UniformBSplines +{ +}; // Gives discrete dimension. In the dimension of interest, it is deduced from the BSplines type. In the other dimensions, it has to be newly defined. In practice both types coincide in the test, but it may not be the case. template -using IDim = typename GrevillePoints>::interpolation_mesh_type; +struct IDim : GrevillePoints>::interpolation_mesh_type +{ +}; #elif defined(BSPLINES_TYPE_NON_UNIFORM) template -using BSplines = ddc::NonUniformBSplines; +struct BSplines : ddc::NonUniformBSplines +{ +}; template -using IDim = typename GrevillePoints>::interpolation_mesh_type; +struct IDim : GrevillePoints>::interpolation_mesh_type +{ +}; #endif template @@ -104,8 +112,8 @@ struct DimsInitializer breaks(ncells)); #endif ddc::init_discrete_space( - GrevillePoints< - BSplines>::get_sampling()); + GrevillePoints>:: + template get_sampling()); } }; @@ -123,8 +131,8 @@ static void PeriodicitySplineBuilderTest() dims_initializer(ncells); // Create the values domain (mesh) - ddc::DiscreteDomain> const dom_vals - = ddc::DiscreteDomain>(GrevillePoints>::get_domain()); + ddc::DiscreteDomain> const dom_vals = ddc::DiscreteDomain>( + GrevillePoints>::template get_domain>()); // Create a SplineBuilder over BSplines and batched along other dimensions using some boundary conditions ddc::SplineBuilder< diff --git a/vendor/ddc/tests/transform_reduce.cpp b/vendor/ddc/tests/transform_reduce.cpp index 14f207920..dfb3b14ef 100644 --- a/vendor/ddc/tests/transform_reduce.cpp +++ b/vendor/ddc/tests/transform_reduce.cpp @@ -14,12 +14,16 @@ using DElem0D = ddc::DiscreteElement<>; using DVect0D = ddc::DiscreteVector<>; using DDom0D = ddc::DiscreteDomain<>; -struct DDimX; +struct DDimX +{ +}; using DElemX = ddc::DiscreteElement; using DVectX = ddc::DiscreteVector; using DDomX = ddc::DiscreteDomain; -struct DDimY; +struct DDimY +{ +}; using DElemY = ddc::DiscreteElement; using DVectY = ddc::DiscreteVector; using DDomY = ddc::DiscreteDomain; diff --git a/vendor/ddc/tests/uniform_domain.cpp b/vendor/ddc/tests/uniform_domain.cpp deleted file mode 100644 index 453565bdb..000000000 --- a/vendor/ddc/tests/uniform_domain.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (C) The DDC development team, see COPYRIGHT.md file -// -// SPDX-License-Identifier: MIT - -#include - -#include - -#include - -namespace { - -struct X; -struct Y; - -using DDimX = ddc::UniformPointSampling; -using DDimY = ddc::UniformPointSampling; -using NUDDimX = ddc::NonUniformPointSampling; -using NUDDimY = ddc::NonUniformPointSampling; - -using DDomNull = ddc::DiscreteDomain; -using DDomX = ddc::DiscreteDomain; -using NUDDomX = ddc::DiscreteDomain; -using DDomXY = ddc::DiscreteDomain; -using NUDDomXY = ddc::DiscreteDomain; -using DDomXNUDDomY = ddc::DiscreteDomain; - -} // namespace - -TEST(UniformDomainTest, NonDiscreteDomainSpecializationValue) -{ - EXPECT_FALSE(ddc::is_uniform_domain_v); - EXPECT_FALSE(ddc::is_uniform_domain_v); -} - -TEST(UniformDomainTest, DiscreteDomainSpecializationValue) -{ - EXPECT_FALSE(ddc::is_uniform_domain_v); - - EXPECT_TRUE(ddc::is_uniform_domain_v); - EXPECT_TRUE(ddc::is_uniform_domain_v); - - EXPECT_FALSE(ddc::is_uniform_domain_v); - EXPECT_FALSE(ddc::is_uniform_domain_v); - EXPECT_FALSE(ddc::is_uniform_domain_v); -} diff --git a/vendor/ddc/tests/uniform_point_sampling.cpp b/vendor/ddc/tests/uniform_point_sampling.cpp index f99e14a78..e3a8f6e96 100644 --- a/vendor/ddc/tests/uniform_point_sampling.cpp +++ b/vendor/ddc/tests/uniform_point_sampling.cpp @@ -15,8 +15,13 @@ namespace { struct DimX; struct DimY; -using DDimX = ddc::UniformPointSampling; -using DDimY = ddc::UniformPointSampling; +struct DDimX : ddc::UniformPointSampling +{ +}; + +struct DDimY : ddc::UniformPointSampling +{ +}; static ddc::Coordinate constexpr origin(-1.); static ddc::Real constexpr step = 0.5; @@ -27,7 +32,7 @@ static ddc::Coordinate constexpr point_rx(0.); TEST(UniformPointSamplingTest, Constructor) { - DDimX::Impl const ddim_x(origin, step); + DDimX::Impl const ddim_x(origin, step); EXPECT_EQ(ddim_x.origin(), origin); EXPECT_EQ(ddim_x.step(), step); EXPECT_EQ(ddim_x.coordinate(point_ix), point_rx); @@ -35,7 +40,7 @@ TEST(UniformPointSamplingTest, Constructor) TEST(UniformPointSampling, Formatting) { - DDimX::Impl const ddim_x(origin, step); + DDimX::Impl const ddim_x(origin, step); std::stringstream oss; oss << ddim_x; EXPECT_EQ(oss.str(), "UniformPointSampling( origin=(-1), step=0.5 )"); @@ -50,7 +55,7 @@ TEST(UniformPointSamplingTest, Coordinate) ddc::Coordinate const point_rxy(point_rx, point_ry); ddc::init_discrete_space(origin, step); - ddc::init_discrete_space(ddc::Coordinate(-10), 1); + ddc::init_discrete_space(ddc::Coordinate(-10.), 1.); EXPECT_EQ(ddc::coordinate(point_ix), point_rx); EXPECT_EQ(ddc::coordinate(point_iy), point_ry); EXPECT_EQ(ddc::coordinate(point_ixy), point_rxy); diff --git a/vendor/sll/include/sll/bernstein.hpp b/vendor/sll/include/sll/bernstein.hpp index 6fc865e56..862a2a5aa 100644 --- a/vendor/sll/include/sll/bernstein.hpp +++ b/vendor/sll/include/sll/bernstein.hpp @@ -15,13 +15,8 @@ template < class BernsteinPolynomialBasis { public: - using discrete_element_type = ddc::DiscreteElement; + using discrete_dimension_type = BernsteinPolynomialBasis; - using discrete_domain_type = ddc::DiscreteDomain; - - using discrete_vector_type = ddc::DiscreteVector; - -public: static constexpr std::size_t rank() { return 2; @@ -37,10 +32,10 @@ class BernsteinPolynomialBasis return (D + 1) * (D + 2) / 2; } - template + template class Impl { - template + template friend class Impl; private: @@ -50,6 +45,12 @@ class BernsteinPolynomialBasis public: using discrete_dimension_type = BernsteinPolynomialBasis; + using discrete_element_type = ddc::DiscreteElement; + + using discrete_domain_type = ddc::DiscreteDomain; + + using discrete_vector_type = ddc::DiscreteVector; + Impl(CartesianToBarycentricCoordinates< Tag1, Tag2, @@ -61,7 +62,8 @@ class BernsteinPolynomialBasis } template - explicit Impl(Impl const& impl) : m_coord_changer(impl.m_coord_changer) + explicit Impl(Impl const& impl) + : m_coord_changer(impl.m_coord_changer) { } @@ -76,7 +78,7 @@ class BernsteinPolynomialBasis Impl& operator=(Impl&& x) = default; void eval_basis( - ddc::ChunkSpan> values, + ddc::ChunkSpan> values, ddc::Coordinate const& x) const; }; }; @@ -88,10 +90,10 @@ template < class Corner2Tag, class Corner3Tag, std::size_t D> -template +template void BernsteinPolynomialBasis:: - Impl::eval_basis( - ddc::ChunkSpan> values, + Impl::eval_basis( + ddc::ChunkSpan> values, ddc::Coordinate const& x) const { const ddc::Coordinate bary_coords = m_coord_changer(x); @@ -100,7 +102,7 @@ void BernsteinPolynomialBasis const double l3 = ddc::get(bary_coords); assert(values.size() == nbasis()); - ddc::DiscreteElement idx(0); + ddc::DiscreteElement idx(0); for (std::size_t i(0); i < D + 1; ++i) { for (std::size_t j(0); j < D + 1 - i; ++j, ++idx) { const int k = D - i - j; diff --git a/vendor/sll/include/sll/mapping/refined_discrete_mapping_to_cartesian.hpp b/vendor/sll/include/sll/mapping/refined_discrete_mapping_to_cartesian.hpp index f994dc43c..d9e76ac2b 100644 --- a/vendor/sll/include/sll/mapping/refined_discrete_mapping_to_cartesian.hpp +++ b/vendor/sll/include/sll/mapping/refined_discrete_mapping_to_cartesian.hpp @@ -121,15 +121,21 @@ class RefinedDiscreteToCartesian static bool constexpr PERIODIC = false; }; -private: - using BSplineRRefined = std::conditional_t< - BSplineR_uniform, - ddc::UniformBSplines, - ddc::NonUniformBSplines>; - using BSplinePRefined = std::conditional_t< - BSplineP_uniform, - ddc::UniformBSplines, - ddc::NonUniformBSplines>; +public: + struct BSplineRRefined + : std::conditional_t< + BSplineR_uniform, + ddc::UniformBSplines, + ddc::NonUniformBSplines> + { + }; + struct BSplinePRefined + : std::conditional_t< + BSplineP_uniform, + ddc::UniformBSplines, + ddc::NonUniformBSplines> + { + }; static auto constexpr SplineRBoundaryRefined_min = SplineRPBuilder::builder_type1::s_bc_xmin; static auto constexpr SplineRBoundaryRefined_max = SplineRPBuilder::builder_type1::s_bc_xmax; @@ -143,14 +149,20 @@ class RefinedDiscreteToCartesian = ddc::is_uniform_sampling_v; - using IDimRRefined = std::conditional_t< - UniformMeshR, - ddc::UniformPointSampling, - ddc::NonUniformPointSampling>; - using IDimPRefined = std::conditional_t< - UniformMeshP, - ddc::UniformPointSampling, - ddc::NonUniformPointSampling>; + struct IDimRRefined + : std::conditional_t< + UniformMeshR, + ddc::UniformPointSampling, + ddc::NonUniformPointSampling> + { + }; + struct IDimPRefined + : std::conditional_t< + UniformMeshP, + ddc::UniformPointSampling, + ddc::NonUniformPointSampling> + { + }; using REvalBoundary = ddc::ConstantExtrapolationRule; @@ -627,11 +639,15 @@ class RefinedDiscreteToCartesian ddc::init_discrete_space(p_knots); } - ddc::init_discrete_space(SplineInterpPointsRRefined::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsPRefined::get_sampling()); + ddc::init_discrete_space( + SplineInterpPointsRRefined::template get_sampling()); + ddc::init_discrete_space( + SplineInterpPointsPRefined::template get_sampling()); - IDomainRRefined const interpolation_domain_R(SplineInterpPointsRRefined::get_domain()); - IDomainPRefined const interpolation_domain_P(SplineInterpPointsPRefined::get_domain()); + IDomainRRefined const interpolation_domain_R( + SplineInterpPointsRRefined::template get_domain()); + IDomainPRefined const interpolation_domain_P( + SplineInterpPointsPRefined::template get_domain()); IDomainRPRefined const refined_domain(interpolation_domain_R, interpolation_domain_P); // Operators on the refined grid diff --git a/vendor/sll/include/sll/polar_bsplines.hpp b/vendor/sll/include/sll/polar_bsplines.hpp index 20954d16c..f759d237c 100644 --- a/vendor/sll/include/sll/polar_bsplines.hpp +++ b/vendor/sll/include/sll/polar_bsplines.hpp @@ -70,15 +70,6 @@ class PolarBSplines */ using discrete_dimension_type = PolarBSplines; - /// The type of an index associated with a PolarBSpline. - using discrete_element_type = ddc::DiscreteElement; - - /// The type of a domain of PolarBSplines. - using discrete_domain_type = ddc::DiscreteDomain; - - /// The type of a vector associated with a PolarBSpline. - using discrete_vector_type = ddc::DiscreteVector; - /** * The type of a 2D index for the subset of the polar bsplines which can be expressed as a tensor * product of 1D bsplines. @@ -98,17 +89,6 @@ class PolarBSplines using tensor_product_discrete_vector_type = ddc::DiscreteVector; private: - /** - * The type of the domain for the linear combinations defining the bsplines which traverse the singular point. - * - * The bsplines which traverse the singular O-point are constructed from a linear combination of 2D - * bsplines. These 2D bsplines can be expressed as a tensor product of 1D bsplines. This type - * describes the domain on which the coefficients of these linear combinations are defined. There is - * an index for the polar bspline being constructed, and 2 indices for the 2D bspline. - */ - using singular_basis_linear_combination_domain_type - = ddc::DiscreteDomain; - using IndexR = ddc::DiscreteElement; using IndexP = ddc::DiscreteElement; using LengthR = ddc::DiscreteVector; @@ -133,11 +113,12 @@ class PolarBSplines * @returns The ddc::DiscreteDomain containing the indices of the b-splines which traverse * the singular point. */ - static constexpr discrete_domain_type singular_domain() + template + static constexpr ddc::DiscreteDomain singular_domain() { - return discrete_domain_type( - discrete_element_type {0}, - discrete_vector_type {n_singular_basis()}); + return ddc::DiscreteDomain( + ddc::DiscreteElement {0}, + ddc::DiscreteVector {n_singular_basis()}); } /** @@ -148,13 +129,15 @@ class PolarBSplines * * @returns The index of the basis spline in the PolarBSpline domain. */ - static discrete_element_type get_polar_index(tensor_product_discrete_element_type const& idx) + template + static ddc::DiscreteElement get_polar_index( + tensor_product_discrete_element_type const& idx) { int const r_idx = ddc::select(idx).uid(); int const p_idx = ddc::select(idx).uid(); assert(r_idx >= C + 1); int local_idx((r_idx - C - 1) * ddc::discrete_space().nbasis() + p_idx); - return discrete_element_type(n_singular_basis() + local_idx); + return ddc::DiscreteElement(n_singular_basis() + local_idx); } /** @@ -165,7 +148,8 @@ class PolarBSplines * * @returns The index of the equivalent 2D BSpline expressed as a 2D tensor product of 1D BSplines. */ - static tensor_product_discrete_element_type get_2d_index(discrete_element_type const& idx) + template + static tensor_product_discrete_element_type get_2d_index(ddc::DiscreteElement const& idx) { assert(idx.uid() >= n_singular_basis()); int const idx_2d = idx.uid() - n_singular_basis(); @@ -186,13 +170,24 @@ class PolarBSplines * * @tparam MemorySpace Indicates where the object is saved. This is either on the host or the device. */ - template + template class Impl { - template + template friend class Impl; private: + /** + * The type of the domain for the linear combinations defining the bsplines which traverse the singular point. + * + * The bsplines which traverse the singular O-point are constructed from a linear combination of 2D + * bsplines. These 2D bsplines can be expressed as a tensor product of 1D bsplines. This type + * describes the domain on which the coefficients of these linear combinations are defined. There is + * an index for the polar bspline being constructed, and 2 indices for the 2D bspline. + */ + using singular_basis_linear_combination_domain_type + = ddc::DiscreteDomain; + ddc::Chunk< double, singular_basis_linear_combination_domain_type, @@ -213,9 +208,30 @@ class PolarBSplines { }; + template + struct IntermediateBernsteinBasis + : BernsteinPolynomialBasis< + typename DiscreteMapping::cartesian_tag_x, + typename DiscreteMapping::cartesian_tag_y, + Corner1Tag, + Corner2Tag, + Corner3Tag, + C> + { + }; + /// The tag which should be used to create a Chunk whose contents are each associated with a PolarBSpline. using discrete_dimension_type = PolarBSplines; + /// The type of an index associated with a PolarBSpline. + using discrete_element_type = ddc::DiscreteElement; + + /// The type of a domain of PolarBSplines. + using discrete_domain_type = ddc::DiscreteDomain; + + /// The type of a vector associated with a PolarBSpline. + using discrete_vector_type = ddc::DiscreteVector; + /** * A constructor for the PolarBSplines. * @@ -266,13 +282,9 @@ class PolarBSplines Corner2Tag, Corner3Tag> barycentric_coordinate_converter(corner1, corner2, corner3); - using BernsteinBasis = BernsteinPolynomialBasis< - DimX, - DimY, - Corner1Tag, - Corner2Tag, - Corner3Tag, - C>; + + using BernsteinBasis = IntermediateBernsteinBasis; + ddc::init_discrete_space(barycentric_coordinate_converter); // The number of radial bases used to construct the bsplines traversing the singular point. @@ -296,7 +308,7 @@ class PolarBSplines m_singular_basis_elements = ddc::Chunk( singular_basis_linear_combination_domain_type( - singular_domain(), + singular_domain(), dom_bsplines_inner)); ddc::DiscreteDomain bernstein_domain( @@ -320,7 +332,7 @@ class PolarBSplines = bernstein_vals(k); } } - for (discrete_element_type k : singular_domain()) { + for (discrete_element_type k : singular_domain()) { for (IndexP const ip : poloidal_spline_domain.take_first(LengthP {BSplinesP::degree()})) { m_singular_basis_elements(k, ir, ip + np_in_singular) @@ -336,7 +348,7 @@ class PolarBSplines m_singular_basis_elements = ddc::Chunk( singular_basis_linear_combination_domain_type( - singular_domain(), + singular_domain(), empty_dom_bsplines)); } } @@ -347,7 +359,7 @@ class PolarBSplines * @param impl The PolarBSplines being copied. */ template - explicit Impl(Impl const& impl) + explicit Impl(Impl const& impl) : m_singular_basis_elements(impl.m_singular_basis_elements.domain()) { ddc::parallel_deepcopy( @@ -482,7 +494,7 @@ class PolarBSplines * * @param[out] int_vals The integrals of the basis splines. */ - void integrals(PolarSplineSpan int_vals) const; + void integrals(PolarSplineSpan int_vals) const; /** * Get the total number of basis functions. @@ -530,9 +542,9 @@ class PolarBSplines }; template -template +template ddc::DiscreteElement PolarBSplines:: - Impl::eval_basis( + Impl::eval_basis( DSpan1D singular_values, DSpan2D values, ddc::Coordinate p) const @@ -541,9 +553,9 @@ ddc::DiscreteElement PolarBSplines -template +template ddc::DiscreteElement PolarBSplines:: - Impl::eval_deriv_r( + Impl::eval_deriv_r( DSpan1D singular_derivs, DSpan2D derivs, ddc::Coordinate p) const @@ -552,9 +564,9 @@ ddc::DiscreteElement PolarBSplines -template +template ddc::DiscreteElement PolarBSplines:: - Impl::eval_deriv_p( + Impl::eval_deriv_p( DSpan1D singular_derivs, DSpan2D derivs, ddc::Coordinate p) const @@ -563,9 +575,9 @@ ddc::DiscreteElement PolarBSplines -template +template ddc::DiscreteElement PolarBSplines:: - Impl::eval_deriv_r_and_p( + Impl::eval_deriv_r_and_p( DSpan1D singular_derivs, DSpan2D derivs, ddc::Coordinate p) const @@ -574,10 +586,10 @@ ddc::DiscreteElement PolarBSplines -template +template template ddc::DiscreteElement PolarBSplines:: - Impl::eval( + Impl::eval( DSpan1D singular_values, DSpan2D values, ddc::Coordinate coord_eval, @@ -616,7 +628,7 @@ ddc::DiscreteElement PolarBSplines()) { singular_values(k.uid()) = 0.0; for (std::size_t i(0); i < nr_done; ++i) { for (std::size_t j(0); j < np; ++j) { @@ -645,9 +657,9 @@ ddc::DiscreteElement PolarBSplines -template -void PolarBSplines::Impl::integrals( - PolarSplineSpan> int_vals) const +template +void PolarBSplines::Impl::integrals( + PolarSplineSpan int_vals) const { auto r_bspl_space = ddc::discrete_space(); auto p_bspl_space = ddc::discrete_space(); @@ -659,19 +671,19 @@ void PolarBSplines::Impl::integrals( assert(int_vals.spline_coef.domain().template extent() == p_bspl_space.nbasis() || int_vals.spline_coef.domain().template extent() == p_bspl_space.size()); - ddc::Chunk r_integrals_alloc( + ddc::Chunk> r_integrals_alloc( r_bspl_space.full_domain().take_first( - typename BSplinesR::discrete_vector_type {r_bspl_space.nbasis()})); - ddc::Chunk p_integrals_alloc( + ddc::DiscreteVector {r_bspl_space.nbasis()})); + ddc::Chunk> p_integrals_alloc( p_bspl_space.full_domain().take_first( - typename BSplinesP::discrete_vector_type {p_bspl_space.size()})); + ddc::DiscreteVector {p_bspl_space.size()})); ddc::ChunkSpan r_integrals = r_integrals_alloc.span_view(); ddc::ChunkSpan p_integrals = p_integrals_alloc.span_view(); r_bspl_space.integrals(r_integrals); p_bspl_space.integrals(p_integrals); - ddc::for_each(singular_domain(), [&](auto k) { + ddc::for_each(singular_domain(), [&](auto k) { int_vals.singular_spline_coef(k) = ddc::transform_reduce( ddc::select(m_singular_basis_elements.domain()), 0.0, @@ -696,7 +708,7 @@ void PolarBSplines::Impl::integrals( if (int_vals.spline_coef.domain().template extent() == p_bspl_space.size()) { ddc::DiscreteDomain periodic_points(p_integrals.domain().take_last( - typename BSplinesP::discrete_vector_type {BSplinesP::degree()})); + ddc::DiscreteVector {BSplinesP::degree()})); tensor_product_discrete_domain_type repeat_domain(r_tensor_product_dom, periodic_points); ddc::for_each(repeat_domain, [&](auto idx) { int_vals.spline_coef(idx) = 0.0; }); } diff --git a/vendor/sll/tests/bernstein.cpp b/vendor/sll/tests/bernstein.cpp index 8a19795c0..965169933 100644 --- a/vendor/sll/tests/bernstein.cpp +++ b/vendor/sll/tests/bernstein.cpp @@ -59,6 +59,9 @@ struct BernsteinFixture>> : pu { }; static constexpr std::size_t poly_degree = D; + struct Bernstein : BernsteinPolynomialBasis + { + }; }; using degrees = std::integer_sequence; @@ -69,14 +72,13 @@ TYPED_TEST_SUITE(BernsteinFixture, Cases); TYPED_TEST(BernsteinFixture, PartitionOfUnity) { - std::size_t constexpr degree = TestFixture::poly_degree; using DimX = typename TestFixture::DimX; using DimY = typename TestFixture::DimY; using Corner1 = typename TestFixture::Corner1; using Corner2 = typename TestFixture::Corner2; using Corner3 = typename TestFixture::Corner3; + using Bernstein = typename TestFixture::Bernstein; using CoordXY = ddc::Coordinate; - using Bernstein = BernsteinPolynomialBasis; const CoordXY c1(-1.0, -1.0); const CoordXY c2(0.0, 1.0); diff --git a/vendor/sll/tests/mapping_jacobian.cpp b/vendor/sll/tests/mapping_jacobian.cpp index 9fede5a6f..069220182 100644 --- a/vendor/sll/tests/mapping_jacobian.cpp +++ b/vendor/sll/tests/mapping_jacobian.cpp @@ -36,16 +36,24 @@ using CoordRP = ddc::Coordinate; int constexpr BSDegree = 3; -using BSplinesR = ddc::NonUniformBSplines; -using BSplinesP = ddc::NonUniformBSplines; +struct BSplinesR : ddc::NonUniformBSplines +{ +}; +struct BSplinesP : ddc::NonUniformBSplines +{ +}; using InterpPointsR = ddc:: GrevilleInterpolationPoints; using InterpPointsP = ddc:: GrevilleInterpolationPoints; -using IDimR = typename InterpPointsR::interpolation_mesh_type; -using IDimP = typename InterpPointsP::interpolation_mesh_type; +struct IDimR : InterpPointsR::interpolation_mesh_type +{ +}; +struct IDimP : InterpPointsP::interpolation_mesh_type +{ +}; using SplineRPBuilder = ddc::SplineBuilder2D< Kokkos::DefaultHostExecutionSpace, @@ -254,11 +262,11 @@ TEST_P(InverseJacobianMatrix, InverseMatrixDiscCzarMap) ddc::init_discrete_space(r_knots); ddc::init_discrete_space(p_knots); - ddc::init_discrete_space(InterpPointsR::get_sampling()); - ddc::init_discrete_space(InterpPointsP::get_sampling()); + ddc::init_discrete_space(InterpPointsR::get_sampling()); + ddc::init_discrete_space(InterpPointsP::get_sampling()); - IDomainR interpolation_domain_R(InterpPointsR::get_domain()); - IDomainP interpolation_domain_P(InterpPointsP::get_domain()); + IDomainR interpolation_domain_R(InterpPointsR::get_domain()); + IDomainP interpolation_domain_P(InterpPointsP::get_domain()); IDomainRP grid(interpolation_domain_R, interpolation_domain_P); SplineRPBuilder builder(grid); diff --git a/vendor/sll/tests/mapping_jacobian_matrix_coef.cpp b/vendor/sll/tests/mapping_jacobian_matrix_coef.cpp index ea735b953..8f13f2b2e 100644 --- a/vendor/sll/tests/mapping_jacobian_matrix_coef.cpp +++ b/vendor/sll/tests/mapping_jacobian_matrix_coef.cpp @@ -36,16 +36,24 @@ using CoordRP = ddc::Coordinate; int constexpr BSDegree = 3; -using BSplinesR = ddc::NonUniformBSplines; -using BSplinesP = ddc::NonUniformBSplines; +struct BSplinesR : ddc::NonUniformBSplines +{ +}; +struct BSplinesP : ddc::NonUniformBSplines +{ +}; using InterpPointsR = ddc:: GrevilleInterpolationPoints; using InterpPointsP = ddc:: GrevilleInterpolationPoints; -using IDimR = typename InterpPointsR::interpolation_mesh_type; -using IDimP = typename InterpPointsP::interpolation_mesh_type; +struct IDimR : InterpPointsR::interpolation_mesh_type +{ +}; +struct IDimP : InterpPointsP::interpolation_mesh_type +{ +}; using SplineRPBuilder = ddc::SplineBuilder2D< Kokkos::DefaultHostExecutionSpace, @@ -294,11 +302,11 @@ TEST_P(JacobianMatrixAndJacobianCoefficients, MatrixDiscCzarMap) ddc::init_discrete_space(r_knots); ddc::init_discrete_space(p_knots); - ddc::init_discrete_space(InterpPointsR::get_sampling()); - ddc::init_discrete_space(InterpPointsP::get_sampling()); + ddc::init_discrete_space(InterpPointsR::get_sampling()); + ddc::init_discrete_space(InterpPointsP::get_sampling()); - IDomainR interpolation_domain_R(InterpPointsR::get_domain()); - IDomainP interpolation_domain_P(InterpPointsP::get_domain()); + IDomainR interpolation_domain_R(InterpPointsR::get_domain()); + IDomainP interpolation_domain_P(InterpPointsP::get_domain()); IDomainRP grid(interpolation_domain_R, interpolation_domain_P); SplineRPBuilder builder(grid); diff --git a/vendor/sll/tests/metric_tensor.cpp b/vendor/sll/tests/metric_tensor.cpp index 1990ecc19..86d93429d 100644 --- a/vendor/sll/tests/metric_tensor.cpp +++ b/vendor/sll/tests/metric_tensor.cpp @@ -30,17 +30,27 @@ using CoordRP = ddc::Coordinate; int constexpr BSDegree = 3; -using BSplinesR = ddc::NonUniformBSplines; -using BSplinesP = ddc::NonUniformBSplines; -using PolarBSplinesRP = PolarBSplines; +struct BSplinesR : ddc::NonUniformBSplines +{ +}; +struct BSplinesP : ddc::NonUniformBSplines +{ +}; +struct PolarBSplinesRP : PolarBSplines +{ +}; using InterpPointsR = ddc:: GrevilleInterpolationPoints; using InterpPointsP = ddc:: GrevilleInterpolationPoints; -using IDimR = typename InterpPointsR::interpolation_mesh_type; -using IDimP = typename InterpPointsP::interpolation_mesh_type; +struct IDimR : InterpPointsR::interpolation_mesh_type +{ +}; +struct IDimP : InterpPointsP::interpolation_mesh_type +{ +}; using BSDomainR = ddc::DiscreteDomain; using BSDomainP = ddc::DiscreteDomain; diff --git a/vendor/sll/tests/polar_bsplines.cpp b/vendor/sll/tests/polar_bsplines.cpp index c2e0b3035..9f1daa209 100644 --- a/vendor/sll/tests/polar_bsplines.cpp +++ b/vendor/sll/tests/polar_bsplines.cpp @@ -38,9 +38,16 @@ struct PolarBsplineFixture; - using BSplineP = std:: - conditional_t, ddc::NonUniformBSplines>; + struct BSplineR : ddc::NonUniformBSplines + { + }; + struct BSplineP + : std::conditional_t< + Uniform, + ddc::UniformBSplines, + ddc::NonUniformBSplines> + { + }; using GrevillePointsR = ddc::GrevilleInterpolationPoints< BSplineR, @@ -51,8 +58,15 @@ struct PolarBsplineFixture; - using IDimR = typename GrevillePointsR::interpolation_mesh_type; - using IDimP = typename GrevillePointsP::interpolation_mesh_type; + struct IDimR : GrevillePointsR::interpolation_mesh_type + { + }; + struct IDimP : GrevillePointsP::interpolation_mesh_type + { + }; + struct BSplines : PolarBSplines + { + }; }; using degrees = std::integer_sequence; @@ -65,7 +79,6 @@ TYPED_TEST_SUITE(PolarBsplineFixture, Cases); TYPED_TEST(PolarBsplineFixture, PartitionOfUnity) { - int constexpr continuity = TestFixture::continuity; using DimR = typename TestFixture::DimR; using IDimR = typename TestFixture::IDimR; using DVectR = ddc::DiscreteVector; @@ -106,7 +119,7 @@ TYPED_TEST(PolarBsplineFixture, PartitionOfUnity) IDimR, IDimP>; using DiscreteMapping = DiscreteToCartesian; - using BSplines = PolarBSplines; + using BSplines = typename TestFixture::BSplines; using CoordR = ddc::Coordinate; using CoordP = ddc::Coordinate; using GrevillePointsR = typename TestFixture::GrevillePointsR; @@ -140,10 +153,12 @@ TYPED_TEST(PolarBsplineFixture, PartitionOfUnity) ddc::init_discrete_space(breaks); } - ddc::init_discrete_space(GrevillePointsR::get_sampling()); - ddc::init_discrete_space(GrevillePointsP::get_sampling()); - ddc::DiscreteDomain interpolation_domain_R(GrevillePointsR::get_domain()); - ddc::DiscreteDomain interpolation_domain_P(GrevillePointsP::get_domain()); + ddc::init_discrete_space(GrevillePointsR::template get_sampling()); + ddc::init_discrete_space(GrevillePointsP::template get_sampling()); + ddc::DiscreteDomain interpolation_domain_R( + GrevillePointsR::template get_domain()); + ddc::DiscreteDomain interpolation_domain_P( + GrevillePointsP::template get_domain()); ddc::DiscreteDomain interpolation_domain(interpolation_domain_R, interpolation_domain_P); diff --git a/vendor/sll/tests/polar_splines.cpp b/vendor/sll/tests/polar_splines.cpp index 9e1f6dd5c..2028f447a 100644 --- a/vendor/sll/tests/polar_splines.cpp +++ b/vendor/sll/tests/polar_splines.cpp @@ -33,11 +33,17 @@ static constexpr std::size_t spline_r_degree = DEGREE_R; static constexpr std::size_t spline_p_degree = DEGREE_P; static constexpr int continuity = CONTINUITY; -using BSplinesR = ddc::NonUniformBSplines; +struct BSplinesR : ddc::NonUniformBSplines +{ +}; #if defined(BSPLINES_TYPE_UNIFORM) -using BSplinesP = ddc::UniformBSplines; +struct BSplinesP : ddc::UniformBSplines +{ +}; #elif defined(BSPLINES_TYPE_NON_UNIFORM) -using BSplinesP = ddc::NonUniformBSplines; +struct BSplinesP : ddc::NonUniformBSplines +{ +}; #endif using GrevillePointsR = ddc:: @@ -45,8 +51,15 @@ using GrevillePointsR = ddc:: using GrevillePointsP = ddc:: GrevilleInterpolationPoints; -using IDimR = GrevillePointsR::interpolation_mesh_type; -using IDimP = GrevillePointsP::interpolation_mesh_type; +struct IDimR : GrevillePointsR::interpolation_mesh_type +{ +}; +struct IDimP : GrevillePointsP::interpolation_mesh_type +{ +}; +struct BSplines : PolarBSplines +{ +}; #if defined(CIRCULAR_MAPPING) using CircToCart = CircularToCartesian; @@ -57,7 +70,6 @@ using CircToCart = CzarnyToCartesian; TEST(PolarSplineTest, ConstantEval) { using PolarCoord = ddc::Coordinate; - using BSplines = PolarBSplines; using CoordR = ddc::Coordinate; using CoordP = ddc::Coordinate; using Spline = PolarSpline; @@ -120,10 +132,10 @@ TEST(PolarSplineTest, ConstantEval) #endif } - ddc::init_discrete_space(GrevillePointsR::get_sampling()); - ddc::init_discrete_space(GrevillePointsP::get_sampling()); - ddc::DiscreteDomain interpolation_domain_R(GrevillePointsR::get_domain()); - ddc::DiscreteDomain interpolation_domain_P(GrevillePointsP::get_domain()); + ddc::init_discrete_space(GrevillePointsR::get_sampling()); + ddc::init_discrete_space(GrevillePointsP::get_sampling()); + ddc::DiscreteDomain interpolation_domain_R(GrevillePointsR::get_domain()); + ddc::DiscreteDomain interpolation_domain_P(GrevillePointsP::get_domain()); ddc::DiscreteDomain interpolation_domain(interpolation_domain_R, interpolation_domain_P); diff --git a/vendor/sll/tests/pseudo_cartesian_matrix.cpp b/vendor/sll/tests/pseudo_cartesian_matrix.cpp index 0025c02c3..84634cabe 100644 --- a/vendor/sll/tests/pseudo_cartesian_matrix.cpp +++ b/vendor/sll/tests/pseudo_cartesian_matrix.cpp @@ -39,8 +39,12 @@ class PseudoCartesianJacobianMatrixTest static int constexpr BSDegree = 3; - using BSplinesR = ddc::NonUniformBSplines; - using BSplinesP = ddc::NonUniformBSplines; + struct BSplinesR : ddc::NonUniformBSplines + { + }; + struct BSplinesP : ddc::NonUniformBSplines + { + }; using InterpPointsR = ddc::GrevilleInterpolationPoints< @@ -53,8 +57,12 @@ class PseudoCartesianJacobianMatrixTest ddc::BoundCond::PERIODIC>; - using IDimR = typename InterpPointsR::interpolation_mesh_type; - using IDimP = typename InterpPointsP::interpolation_mesh_type; + struct IDimR : InterpPointsR::interpolation_mesh_type + { + }; + struct IDimP : InterpPointsP::interpolation_mesh_type + { + }; using BSDomainR = ddc::DiscreteDomain; @@ -170,11 +178,11 @@ class PseudoCartesianJacobianMatrixTest ddc::init_discrete_space(r_knots); ddc::init_discrete_space(p_knots); - ddc::init_discrete_space(InterpPointsR::get_sampling()); - ddc::init_discrete_space(InterpPointsP::get_sampling()); + ddc::init_discrete_space(InterpPointsR::template get_sampling()); + ddc::init_discrete_space(InterpPointsP::template get_sampling()); - IDomainR interpolation_domain_R(InterpPointsR::get_domain()); - IDomainP interpolation_domain_P(InterpPointsP::get_domain()); + IDomainR interpolation_domain_R(InterpPointsR::template get_domain()); + IDomainP interpolation_domain_P(InterpPointsP::template get_domain()); IDomainRP grid(interpolation_domain_R, interpolation_domain_P); // --- Define the operators. ---------------------------------------------------------------------- diff --git a/vendor/sll/tests/refined_discrete_mapping.cpp b/vendor/sll/tests/refined_discrete_mapping.cpp index e0dbe1021..61f6c7d5a 100644 --- a/vendor/sll/tests/refined_discrete_mapping.cpp +++ b/vendor/sll/tests/refined_discrete_mapping.cpp @@ -40,8 +40,12 @@ using CoordXY = ddc::Coordinate; int constexpr BSDegree = 3; -using BSplinesR = ddc::NonUniformBSplines; -using BSplinesP = ddc::NonUniformBSplines; +struct BSplinesR : ddc::NonUniformBSplines +{ +}; +struct BSplinesP : ddc::NonUniformBSplines +{ +}; using SplineInterpPointsR = ddc:: @@ -49,8 +53,12 @@ using SplineInterpPointsR = ddc:: using SplineInterpPointsP = ddc:: GrevilleInterpolationPoints; -using IDimR = typename SplineInterpPointsR::interpolation_mesh_type; -using IDimP = typename SplineInterpPointsP::interpolation_mesh_type; +struct IDimR : SplineInterpPointsR::interpolation_mesh_type +{ +}; +struct IDimP : SplineInterpPointsP::interpolation_mesh_type +{ +}; using SplineRPBuilder = ddc::SplineBuilder2D< Kokkos::DefaultHostExecutionSpace, @@ -544,11 +552,11 @@ TEST(RefinedDiscreteMapping, TestRefinedDiscreteMapping) ddc::init_discrete_space(r_knots); ddc::init_discrete_space(p_knots); - ddc::init_discrete_space(SplineInterpPointsR::get_sampling()); - ddc::init_discrete_space(SplineInterpPointsP::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsR::get_sampling()); + ddc::init_discrete_space(SplineInterpPointsP::get_sampling()); - IDomainR interpolation_domain_R(SplineInterpPointsR::get_domain()); - IDomainP interpolation_domain_P(SplineInterpPointsP::get_domain()); + IDomainR interpolation_domain_R(SplineInterpPointsR::get_domain()); + IDomainP interpolation_domain_P(SplineInterpPointsP::get_domain()); IDomainRP grid(interpolation_domain_R, interpolation_domain_P);