Skip to content

Commit

Permalink
Merge branch 'pvidal_330-confusion-between-x-and-y-for-edges-in-multi…
Browse files Browse the repository at this point in the history
…patch-geometries-files' into 'main'

Fix convention 2 in geometries files

Closes #330

See merge request gysela-developpers/gyselalibxx!653
  • Loading branch information
EmilyBourne committed Aug 12, 2024
1 parent 80e386b commit 3a0e6c6
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 81 deletions.
6 changes: 3 additions & 3 deletions src/multipatch/connectivity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ So we obtain four logical edges
In the code, we define edges as follows.
Every edge of a logical patch is identified via the patch it belongs to, the dimension
and whether it is at the front or the back of the domain.
So e.g.the edge $`[a_x^{(i)}, b_x^{(i)}] \times \{ a_y^{(i)} \}`$ would be identified with patch $i$, dimensions `RDimXi` and `FRONT`.
$`[a_x^{(i)}, b_x^{(i)}] \times \{ b_y^{(i)} \}`$ would be identified with patch $i$, dimensions `RDimXi` and `BACK` and
$`\{ b_x^{(i)} \} \times [a_y^{(i)}, b_y^{(i)}]`$ would be identified with patch $i$, dimensions `RDimYi` and `BACK`.
So e.g.the edge $`[a_x^{(i)}, b_x^{(i)}] \times \{ a_y^{(i)} \}`$ would be identified with patch $i$, dimensions `Yi` and `FRONT`.
$`[a_x^{(i)}, b_x^{(i)}] \times \{ b_y^{(i)} \}`$ would be identified with patch $i$, dimensions `Yi` and `BACK` and
$`\{ b_x^{(i)} \} \times [a_y^{(i)}, b_y^{(i)}]`$ would be identified with patch $i$, dimensions `Xi` and `BACK`.

#### Sticking and Coordinate Transformation

Expand Down
9 changes: 6 additions & 3 deletions src/multipatch/connectivity/connectivity_details.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ template <
class FoundGrids = ddc::detail::TypeSeq<>,
class MatchingEdge = equivalent_edge_t<StartEdge, InterfaceTypeSeq>,
bool grid_already_found // Periodic case
= ddc::in_tags_v<typename StartEdge::grid, FoundGrids>>
= ddc::in_tags_v<typename StartEdge::perpendicular_grid, FoundGrids>>
struct CollectGridsAlongDim;

/// Specialisation of CollectGridsAlongDim to iterate recursively over the grids on the dimension.
Expand All @@ -320,7 +320,8 @@ struct CollectGridsAlongDim<
{
/// The new list of grids that have been found including the grid from the current patch.
using NewGridList =
typename AddToTypeSeq<typename StartEdge::grid, FoundGrids, insert_pos>::type;
typename AddToTypeSeq<typename StartEdge::perpendicular_grid, FoundGrids, insert_pos>::
type;
/// The type found by the class.
using type = typename CollectGridsAlongDim<
typename SwapExtremity<MatchingEdge>::type,
Expand All @@ -347,7 +348,9 @@ template <class StartEdge, class InterfaceTypeSeq, InsertPosition insert_pos, cl
struct CollectGridsAlongDim<StartEdge, InterfaceTypeSeq, insert_pos, FoundGrids, OutsideEdge, false>
{
/// The type found by the class.
using type = typename AddToTypeSeq<typename StartEdge::grid, FoundGrids, insert_pos>::type;
using type =
typename AddToTypeSeq<typename StartEdge::perpendicular_grid, FoundGrids, insert_pos>::
type;
};

/**
Expand Down
17 changes: 11 additions & 6 deletions src/multipatch/connectivity/edge.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,25 @@ enum Extremity { FRONT, BACK };
* For example, in the patch defined on logical index range
* @f$ [a_x, b_x]\times[a_y, b_y] @f$,
*
* * the edge IDimX, BACK refers to the set @f$ [a_x, b_x]\times\{b_y\} @f$,
* * and the edge IDimX, FRONT refers to the set @f$ [a_x, b_x]\times\{a_y\} @f$.
* * the edge GridY, BACK refers to the set @f$ [a_x, b_x]\times\{b_y\} @f$,
* * and the edge GridY, FRONT refers to the set @f$ [a_x, b_x]\times\{a_y\} @f$.
*
* @tparam Patch Patch where the edge is defined.
* @tparam Grid Discrete dimension where the edge is defined.
* @tparam Grid1D Grid on the complementary dimension of the edge.
* @tparam extremity_val The BACK or FRONT value.
*/
template <class Patch, class Grid, Extremity extremity_val>
template <class Patch, class Grid1D, Extremity extremity_val>
struct Edge
{
/// @brief Patch where the edge is defined.
using associated_patch = Patch;
/// @brief Discrete dimension where the edge is defined.
using grid = Grid;
/// @brief Grid on the perpendicular dimension of the edge.
using perpendicular_grid = Grid1D;
/// @brief Grid parallel to the edge.
using parallel_grid = std::conditional_t<
std::is_same_v<Grid1D, typename Patch::Grid1>,
typename Patch::Grid2,
typename Patch::Grid1>;
/// @brief Design if the edge is on the BACK or the FRONT of the other dimension.
static constexpr Extremity extremity = extremity_val;
};
Expand Down
7 changes: 3 additions & 4 deletions src/multipatch/connectivity/edge_transformation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@

#include <ddc/ddc.hpp>

#include <ddc_helper.hpp>

#include "ddc_aliases.hpp"
#include "ddc_helper.hpp"
#include "edge.hpp"
#include "interface.hpp"

Expand Down Expand Up @@ -41,8 +40,8 @@ class EdgeTransformation
"The interface cannot be an interface with the outside domain.");


using EdgeGrid1 = typename Interface::Edge1::grid;
using EdgeGrid2 = typename Interface::Edge2::grid;
using EdgeGrid1 = typename Interface::Edge1::parallel_grid;
using EdgeGrid2 = typename Interface::Edge2::parallel_grid;

using EdgeDim1 = typename EdgeGrid1::continuous_dimension_type;
using EdgeDim2 = typename EdgeGrid2::continuous_dimension_type;
Expand Down
18 changes: 9 additions & 9 deletions tests/multipatch/connectivity/coord_transformation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ class CoordinateTransformationTest : public ::testing::Test

TEST_F(CoordinateTransformationTest, InvertedOrientation)
{
using EgdeX1B = Edge<Patch1, GridX1, BACK>;
using EgdeX2F = Edge<Patch2, GridX2, FRONT>;
using Interface12 = Interface<EgdeX1B, EgdeX2F, false>;
using EgdeY1B = Edge<Patch1, GridY1, BACK>;
using EgdeY2F = Edge<Patch2, GridY2, FRONT>;
using Interface12 = Interface<EgdeY1B, EgdeY2F, false>;

// Coordinate transformation .................................................................
EdgeTransformation<Interface12> coord_transformation(idx_range_x1, idx_range_x2);
Expand All @@ -84,9 +84,9 @@ TEST_F(CoordinateTransformationTest, InvertedOrientation)

TEST_F(CoordinateTransformationTest, StickingDifferentDimensions)
{
using EgdeX1B = Edge<Patch1, GridX1, BACK>;
using EgdeY2F = Edge<Patch2, GridY2, FRONT>;
using Interface12 = Interface<EgdeX1B, EgdeY2F, true>;
using EgdeY1B = Edge<Patch1, GridY1, BACK>;
using EgdeX2F = Edge<Patch2, GridX2, FRONT>;
using Interface12 = Interface<EgdeY1B, EgdeX2F, true>;

// Coordinate transformation .................................................................
EdgeTransformation<Interface12> coord_transformation(idx_range_x1, idx_range_y2);
Expand All @@ -101,9 +101,9 @@ TEST_F(CoordinateTransformationTest, StickingDifferentDimensions)

TEST_F(CoordinateTransformationTest, ReverseTransformation)
{
using EgdeX1B = Edge<Patch1, GridX1, BACK>;
using EgdeX2F = Edge<Patch2, GridX2, FRONT>;
using Interface12 = Interface<EgdeX1B, EgdeX2F, false>;
using EgdeY1B = Edge<Patch1, GridY1, BACK>;
using EgdeY2F = Edge<Patch2, GridY2, FRONT>;
using Interface12 = Interface<EgdeY1B, EgdeY2F, false>;

// Coordinate transformation .................................................................
EdgeTransformation<Interface12> coord_transformation(idx_range_x1, idx_range_x2);
Expand Down
55 changes: 27 additions & 28 deletions tests/multipatch/connectivity/index_transformation_non_uniform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,17 @@ class IndexTransformationNonUniformTest : public ::testing::Test

TEST_F(IndexTransformationNonUniformTest, IndexAvaibility)
{
using EgdeX1B = Edge<Patch1, GridX1, BACK>;
using EgdeX2F = Edge<Patch2, GridX2, FRONT>;
using Interface12 = Interface<EgdeX1B, EgdeX2F, false>;
using EdgeY1B = Edge<Patch1, GridY1, BACK>;
using EdgeY2F = Edge<Patch2, GridY2, FRONT>;
using Interface12 = Interface<EdgeY1B, EdgeY2F, false>;

using EgdeX1B = Edge<Patch1, GridX1, BACK>;
using EgdeX3F = Edge<Patch3, GridX3, FRONT>;
using Interface13 = Interface<EgdeX1B, EgdeX3F, false>;

using EgdeX1B = Edge<Patch1, GridX1, BACK>;
using EgdeX3F = Edge<Patch3, GridX3, FRONT>;
using Interface31 = Interface<EgdeX3F, EgdeX1B, false>;
using EdgeY1B = Edge<Patch1, GridY1, BACK>;
using EdgeY3F = Edge<Patch3, GridY3, FRONT>;
using Interface13 = Interface<EdgeY1B, EdgeY3F, false>;

using EdgeY1B = Edge<Patch1, GridY1, BACK>;
using EdgeY3F = Edge<Patch3, GridY3, FRONT>;
using Interface31 = Interface<EdgeY3F, EdgeY1B, false>;

// Coordinate transformation .................................................................
// Index starting at 0
Expand Down Expand Up @@ -181,13 +180,13 @@ TEST_F(IndexTransformationNonUniformTest, IndexAvaibility)

TEST_F(IndexTransformationNonUniformTest, InvertedOrientation)
{
using EgdeX1B = Edge<Patch1, GridX1, BACK>;
using EgdeX2F = Edge<Patch2, GridX2, FRONT>;
using Interface12 = Interface<EgdeX1B, EgdeX2F, false>;
using EdgeY1B = Edge<Patch1, GridY1, BACK>;
using EdgeY2F = Edge<Patch2, GridY2, FRONT>;
using Interface12 = Interface<EdgeY1B, EdgeY2F, false>;

using EgdeX1B = Edge<Patch1, GridX1, BACK>;
using EgdeX3F = Edge<Patch3, GridX3, FRONT>;
using Interface13 = Interface<EgdeX1B, EgdeX3F, false>;
using EdgeY1B = Edge<Patch1, GridY1, BACK>;
using EdgeY3F = Edge<Patch3, GridY3, FRONT>;
using Interface13 = Interface<EdgeY1B, EdgeY3F, false>;

// Coordinate transformation .................................................................
// Index starting at 0
Expand All @@ -211,13 +210,13 @@ TEST_F(IndexTransformationNonUniformTest, InvertedOrientation)

TEST_F(IndexTransformationNonUniformTest, StickingDifferentDimensions)
{
using EgdeX1B = Edge<Patch1, GridX1, BACK>;
using EgdeY2F = Edge<Patch2, GridY2, FRONT>;
using Interface12 = Interface<EgdeX1B, EgdeY2F, true>;
using EdgeY1B = Edge<Patch1, GridY1, BACK>;
using EdgeX2F = Edge<Patch2, GridX2, FRONT>;
using Interface12 = Interface<EdgeY1B, EdgeX2F, true>;

using EgdeX1B = Edge<Patch1, GridX1, BACK>;
using EgdeY3F = Edge<Patch3, GridY3, FRONT>;
using Interface13 = Interface<EgdeX1B, EgdeY3F, true>;
using EdgeY1B = Edge<Patch1, GridY1, BACK>;
using EdgeX3F = Edge<Patch3, GridX3, FRONT>;
using Interface13 = Interface<EdgeY1B, EdgeX3F, true>;

// Coordinate transformation .................................................................
// Index starting at 0
Expand All @@ -241,13 +240,13 @@ TEST_F(IndexTransformationNonUniformTest, StickingDifferentDimensions)

TEST_F(IndexTransformationNonUniformTest, ReverseTransformation)
{
using EgdeX1B = Edge<Patch1, GridX1, BACK>;
using EgdeX2F = Edge<Patch2, GridX2, FRONT>;
using Interface12 = Interface<EgdeX1B, EgdeX2F, false>;
using EdgeY1B = Edge<Patch1, GridY1, BACK>;
using EdgeY2F = Edge<Patch2, GridY2, FRONT>;
using Interface12 = Interface<EdgeY1B, EdgeY2F, false>;

using EgdeX1B = Edge<Patch1, GridX1, BACK>;
using EgdeX3F = Edge<Patch3, GridX3, FRONT>;
using Interface13 = Interface<EgdeX1B, EgdeX3F, false>;
using EdgeY1B = Edge<Patch1, GridY1, BACK>;
using EdgeY3F = Edge<Patch3, GridY3, FRONT>;
using Interface13 = Interface<EdgeY1B, EdgeY3F, false>;

// Coordinate transformation .................................................................
EdgeTransformation<Interface12> index_transformation_12(idx_range_x1, idx_range_x2);
Expand Down
55 changes: 27 additions & 28 deletions tests/multipatch/connectivity/index_transformation_uniform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,17 @@ class IndexTransformationUniformTest : public ::testing::Test

TEST_F(IndexTransformationUniformTest, IndexAvaibility)
{
using EgdeX1B = Edge<Patch1, GridX1, BACK>;
using EgdeX2F = Edge<Patch2, GridX2, FRONT>;
using Interface12 = Interface<EgdeX1B, EgdeX2F, false>;
using EdgeY1B = Edge<Patch1, GridY1, BACK>;
using EdgeY2F = Edge<Patch2, GridY2, FRONT>;
using Interface12 = Interface<EdgeY1B, EdgeY2F, false>;

using EgdeX1B = Edge<Patch1, GridX1, BACK>;
using EgdeX3F = Edge<Patch3, GridX3, FRONT>;
using Interface13 = Interface<EgdeX1B, EgdeX3F, false>;

using EgdeX1B = Edge<Patch1, GridX1, BACK>;
using EgdeX3F = Edge<Patch3, GridX3, FRONT>;
using Interface31 = Interface<EgdeX3F, EgdeX1B, false>;
using EdgeY1B = Edge<Patch1, GridY1, BACK>;
using EdgeY3F = Edge<Patch3, GridY3, FRONT>;
using Interface13 = Interface<EdgeY1B, EdgeY3F, false>;

using EdgeY1B = Edge<Patch1, GridY1, BACK>;
using EdgeY3F = Edge<Patch3, GridY3, FRONT>;
using Interface31 = Interface<EdgeY3F, EdgeY1B, false>;

// Coordinate transformation .................................................................
// Index starting at 0
Expand Down Expand Up @@ -131,13 +130,13 @@ TEST_F(IndexTransformationUniformTest, IndexAvaibility)

TEST_F(IndexTransformationUniformTest, InvertedOrientation)
{
using EgdeX1B = Edge<Patch1, GridX1, BACK>;
using EgdeX2F = Edge<Patch2, GridX2, FRONT>;
using Interface12 = Interface<EgdeX1B, EgdeX2F, false>;
using EdgeY1B = Edge<Patch1, GridY1, BACK>;
using EdgeY2F = Edge<Patch2, GridY2, FRONT>;
using Interface12 = Interface<EdgeY1B, EdgeY2F, false>;

using EgdeX1B = Edge<Patch1, GridX1, BACK>;
using EgdeX3F = Edge<Patch3, GridX3, FRONT>;
using Interface13 = Interface<EgdeX1B, EgdeX3F, false>;
using EdgeY1B = Edge<Patch1, GridY1, BACK>;
using EdgeY3F = Edge<Patch3, GridY3, FRONT>;
using Interface13 = Interface<EdgeY1B, EdgeY3F, false>;

// Coordinate transformation .................................................................
// Index starting at 0
Expand All @@ -161,13 +160,13 @@ TEST_F(IndexTransformationUniformTest, InvertedOrientation)

TEST_F(IndexTransformationUniformTest, StickingDifferentDimensions)
{
using EgdeX1B = Edge<Patch1, GridX1, BACK>;
using EgdeY2F = Edge<Patch2, GridY2, FRONT>;
using Interface12 = Interface<EgdeX1B, EgdeY2F, true>;
using EdgeY1B = Edge<Patch1, GridY1, BACK>;
using EdgeX2F = Edge<Patch2, GridX2, FRONT>;
using Interface12 = Interface<EdgeY1B, EdgeX2F, true>;

using EgdeX1B = Edge<Patch1, GridX1, BACK>;
using EgdeY3F = Edge<Patch3, GridY3, FRONT>;
using Interface13 = Interface<EgdeX1B, EgdeY3F, true>;
using EdgeY1B = Edge<Patch1, GridY1, BACK>;
using EdgeX3F = Edge<Patch3, GridX3, FRONT>;
using Interface13 = Interface<EdgeY1B, EdgeX3F, true>;

// Coordinate transformation .................................................................
// Index starting at 0
Expand All @@ -191,13 +190,13 @@ TEST_F(IndexTransformationUniformTest, StickingDifferentDimensions)

TEST_F(IndexTransformationUniformTest, ReverseTransformation)
{
using EgdeX1B = Edge<Patch1, GridX1, BACK>;
using EgdeX2F = Edge<Patch2, GridX2, FRONT>;
using Interface12 = Interface<EgdeX1B, EgdeX2F, false>;
using EdgeY1B = Edge<Patch1, GridY1, BACK>;
using EdgeY2F = Edge<Patch2, GridY2, FRONT>;
using Interface12 = Interface<EdgeY1B, EdgeY2F, false>;

using EgdeX1B = Edge<Patch1, GridX1, BACK>;
using EgdeX3F = Edge<Patch3, GridX3, FRONT>;
using Interface13 = Interface<EgdeX1B, EgdeX3F, false>;
using EdgeY1B = Edge<Patch1, GridY1, BACK>;
using EdgeY3F = Edge<Patch3, GridY3, FRONT>;
using Interface13 = Interface<EdgeY1B, EdgeY3F, false>;

// Coordinate transformation .................................................................
EdgeTransformation<Interface12> index_transformation_12(idx_range_x1, idx_range_x2);
Expand Down

0 comments on commit 3a0e6c6

Please sign in to comment.