Line | Branch | Exec | Source |
---|---|---|---|
1 | // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- | ||
2 | // vi: set et ts=4 sw=4 sts=4: | ||
3 | // | ||
4 | // SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder | ||
5 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
6 | // | ||
7 | /*! | ||
8 | * \file | ||
9 | * \ingroup FacetCoupling | ||
10 | * \copydoc Dumux::FacetCouplingMapper | ||
11 | */ | ||
12 | #ifndef DUMUX_FACETCOUPLING_MAPPER_HH | ||
13 | #define DUMUX_FACETCOUPLING_MAPPER_HH | ||
14 | |||
15 | #include <memory> | ||
16 | |||
17 | #include <dune/common/indices.hh> | ||
18 | #include <dumux/discretization/method.hh> | ||
19 | |||
20 | namespace Dumux { | ||
21 | |||
22 | /*! | ||
23 | * \ingroup FacetCoupling | ||
24 | * \brief Implementation for the coupling mapper that sets up and stores | ||
25 | * the coupling maps between two domains of dimension d and (d-1). | ||
26 | * The implementations are specific to the discretization method | ||
27 | * used in the bulk domain, which is extracted automatically from | ||
28 | * the bulk grid geometry. Implementations for the different methods | ||
29 | * have to be provided and included at the end of this file. | ||
30 | * | ||
31 | * \tparam BulkFVG the d-dimensional finite-volume grid geometry | ||
32 | * \tparam LowDimFVG the (d-1)-dimensional finite-volume grid geometry | ||
33 | * \tparam bulkId The index of the bulk grid within the hierarchy of grids | ||
34 | * \tparam lowDimId The index of the facet grid within the hierarchy of grids | ||
35 | * \tparam bulkDM Discretization method used in the bulk domain | ||
36 | */ | ||
37 | template< class BulkFVG, | ||
38 | class LowDimFVG, | ||
39 | std::size_t bulkId = 0, | ||
40 | std::size_t lowDimId = 1, | ||
41 | class DiscretizationMethod = typename BulkFVG::DiscretizationMethod > | ||
42 | class FacetCouplingMapper; | ||
43 | |||
44 | /*! | ||
45 | * \ingroup FacetCoupling | ||
46 | * \brief Specialization of the mapper class for the case of | ||
47 | * three domains with the grid dimensions d, (d-1) & (d-2). | ||
48 | * | ||
49 | * \tparam BulkFVG The d-dimensional finite-volume grid geometry | ||
50 | * \tparam FacetFVG The (d-1)-dimensional finite-volume grid geometry | ||
51 | * \tparam EdgeFVG The (d-2)-dimensional finite-volume grid geometry | ||
52 | * \tparam bulkId The index of the bulk grid within the hierarchy of grids | ||
53 | * \tparam facetId The index of the facet grid within the hierarchy of grids | ||
54 | * \tparam edgeId The index of the edge grid within the hierarchy of grids | ||
55 | */ | ||
56 | template< class BulkFVG, class FacetFVG, class EdgeFVG, | ||
57 | std::size_t bulkId = 0, | ||
58 | std::size_t facetId = 1, | ||
59 | std::size_t edgeId = 2 > | ||
60 | 18 | class FacetCouplingThreeDomainMapper | |
61 | : public FacetCouplingMapper<BulkFVG, FacetFVG, bulkId, facetId> | ||
62 | , public FacetCouplingMapper<FacetFVG, EdgeFVG, facetId, edgeId> | ||
63 | { | ||
64 | using BulkFacetMapper = FacetCouplingMapper<BulkFVG, FacetFVG, bulkId, facetId>; | ||
65 | using FacetEdgeMapper = FacetCouplingMapper<FacetFVG, EdgeFVG, facetId, edgeId>; | ||
66 | |||
67 | // grid dimensions | ||
68 | static constexpr int bulkDim = BulkFVG::GridView::dimension; | ||
69 | static constexpr int facetDim = FacetFVG::GridView::dimension; | ||
70 | static constexpr int edgeDim = EdgeFVG::GridView::dimension; | ||
71 | |||
72 | //! The grid id type | ||
73 | template<std::size_t id> | ||
74 | using GridIdType = Dune::index_constant<id>; | ||
75 | |||
76 | public: | ||
77 | //! export domain ids | ||
78 | static constexpr auto bulkGridId = Dune::index_constant< bulkId >(); | ||
79 | static constexpr auto facetGridId = Dune::index_constant< facetId >(); | ||
80 | static constexpr auto edgeGridId = Dune::index_constant< edgeId >(); | ||
81 | |||
82 | //! Export the coupling stencil type for the provided domain index | ||
83 | template<std::size_t i> | ||
84 | using Stencil = typename std::conditional< (i == edgeId), | ||
85 | typename FacetEdgeMapper::template Stencil<i>, | ||
86 | typename BulkFacetMapper::template Stencil<i> >::type; | ||
87 | |||
88 | //! Export the coupling map type for the provided domain indices | ||
89 | template<std::size_t i, std::size_t j> | ||
90 | using CouplingMap = typename std::conditional< (i != edgeId && j != edgeId), | ||
91 | typename BulkFacetMapper::template CouplingMap<i,j>, | ||
92 | typename FacetEdgeMapper::template CouplingMap<i,j> >::type; | ||
93 | |||
94 | //! Allow retrievment of grid id for a given grid dimension | ||
95 | template<int dim> | ||
96 | static constexpr GridIdType< ( dim == bulkDim ? bulkId : (dim == facetDim ? facetId : edgeId) ) > gridId() | ||
97 | { return GridIdType< ( dim == bulkDim ? bulkId : (dim == facetDim ? facetId : edgeId) ) >(); } | ||
98 | |||
99 | /*! | ||
100 | * \brief Update coupling maps. | ||
101 | * | ||
102 | * \param bulkFvGridGeometry The finite-volume grid geometry of the bulk grid | ||
103 | * \param facetFvGridGeometry The finite-volume grid geometry of the codimension-one grid | ||
104 | * \param edgeFvGridGeometry The finite-volume grid geometry of the codimension-two grid | ||
105 | * \param embeddings Class that contains the embedments among the grids and entity insertion indices | ||
106 | */ | ||
107 | template< class Embeddings > | ||
108 | 8 | void update(const BulkFVG& bulkFvGridGeometry, | |
109 | const FacetFVG& facetFvGridGeometry, | ||
110 | const EdgeFVG& edgeFvGridGeometry, | ||
111 | std::shared_ptr<const Embeddings> embeddings) | ||
112 | { | ||
113 |
2/6✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
8 | BulkFacetMapper::update(bulkFvGridGeometry, facetFvGridGeometry, embeddings); |
114 |
2/6✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
8 | FacetEdgeMapper::update(facetFvGridGeometry, edgeFvGridGeometry, embeddings); |
115 | 8 | } | |
116 | |||
117 | //! Pull up the parents' access operators to allow for individual updates | ||
118 | using BulkFacetMapper::update; | ||
119 | using FacetEdgeMapper::update; | ||
120 | |||
121 | //! Pull up the parents' access operators | ||
122 | using BulkFacetMapper::couplingMap; | ||
123 | using FacetEdgeMapper::couplingMap; | ||
124 | }; | ||
125 | |||
126 | } // end namespace Dumux | ||
127 | |||
128 | // Here, we have to include all available implementations | ||
129 | #include <dumux/multidomain/facet/box/couplingmapper.hh> | ||
130 | #include <dumux/multidomain/facet/cellcentered/tpfa/couplingmapper.hh> | ||
131 | #include <dumux/multidomain/facet/cellcentered/mpfa/couplingmapper.hh> | ||
132 | |||
133 | #endif | ||
134 |