fvgridgeometry.hh 24.1 KB
Newer Older
1
2
3
4
5
6
7
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
 *   See the file COPYING for full copying permissions.                      *
 *                                                                           *
 *   This program is free software: you can redistribute it and/or modify    *
 *   it under the terms of the GNU General Public License as published by    *
8
 *   the Free Software Foundation, either version 3 of the License, or       *
9
10
11
12
13
14
15
16
17
18
19
20
 *   (at your option) any later version.                                     *
 *                                                                           *
 *   This program is distributed in the hope that it will be useful,         *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            *
 *   GNU General Public License for more details.                            *
 *                                                                           *
 *   You should have received a copy of the GNU General Public License       *
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.   *
 *****************************************************************************/
/*!
 * \file
Kilian Weishaupt's avatar
Kilian Weishaupt committed
21
22
 * \ingroup StaggeredDiscretization
 * \copydoc Dumux::StaggeredFVGridGeometry
23
 */
24
25
#ifndef DUMUX_DISCRETIZATION_STAGGERED_FV_GRID_GEOMETRY
#define DUMUX_DISCRETIZATION_STAGGERED_FV_GRID_GEOMETRY
26

27
#include <dumux/common/deprecated.hh>
28
#include <dumux/common/indextraits.hh>
29
#include <dumux/discretization/basegridgeometry.hh>
30
#include <dumux/discretization/checkoverlapsize.hh>
31
#include <dumux/discretization/method.hh>
32
#include <dumux/discretization/extrusion.hh>
33

34
namespace Dumux {
35

36
37
38
/*!
 * \ingroup StaggeredDiscretization
 * \brief Base class for cell center of face specific auxiliary FvGridGeometry classes.
39
 *        Provides a common interface and a pointer to the actual gridGeometry.
40
 */
41
template<class ActualGridGeometry>
42
43
44
45
class GridGeometryView
{
public:

46
47
    explicit GridGeometryView(const ActualGridGeometry* actualGridGeometry)
    : gridGeometry_(actualGridGeometry) {}
48

49
    //! export  the GridView type and the discretization method
50
    using GridView = typename ActualGridGeometry::GridView;
51
    static constexpr DiscretizationMethod discMethod = DiscretizationMethod::staggered;
52
    using LocalView = typename ActualGridGeometry::LocalView;
53

54
55
56
    /*!
     * \brief Returns true if this view if related to cell centered dofs
     */
57
    static constexpr bool isCellCenter() { return false; }
58
59
60
61

    /*!
     * \brief Returns true if this view if related to face dofs
     */
62
63
    static constexpr bool isFace() {return false; }

64
65
66
    /*!
     * \brief Return an integral constant index for cell centered dofs
     */
67
    static constexpr auto cellCenterIdx()
68
    { return typename ActualGridGeometry::DofTypeIndices::CellCenterIdx{}; }
69

70
71
72
    /*!
     * \brief Return an integral constant index for face dofs
     */
73
    static constexpr auto faceIdx()
74
    { return typename ActualGridGeometry::DofTypeIndices::FaceIdx{}; }
75

76
77
78
    /*!
     * \brief Return the gridView this grid geometry object lives on
     */
79
    const auto& gridView() const
80
    { return gridGeometry_->gridView(); }
81

82
83
84
85
86
    /*!
     * \brief Returns the connectivity map of which dofs have derivatives with respect
     *        to a given dof.
     */
    const auto& connectivityMap() const // TODO return correct map
87
    { return gridGeometry_->connectivityMap(); }
88

89
90
91
    /*!
     * \brief Returns the mapper for vertices to indices for possibly adaptive grids.
     */
92
    const auto& vertexMapper() const
93
    { return gridGeometry_->vertexMapper(); }
94

95
96
97
    /*!
     * \brief Returns the mapper for elements to indices for constant grids.
     */
98
    const auto& elementMapper() const
99
    { return gridGeometry_->elementMapper(); }
100

101
102
103
104
    /*!
     * \brief Returns the actual gridGeometry we are a restriction of
     */
    const ActualGridGeometry& actualGridGeometry() const
105
    { return *gridGeometry_; }
106
107

protected:
108
    const ActualGridGeometry* gridGeometry_;
109
110
111
112
113
114
115
116

};

/*!
 * \ingroup StaggeredDiscretization
 * \brief Cell center specific auxiliary FvGridGeometry classes.
 *        Required for the Dumux multi-domain framework.
 */
117
118
template <class ActualGridGeometry>
class CellCenterFVGridGeometry : public GridGeometryView<ActualGridGeometry>
119
{
120
    using ParentType = GridGeometryView<ActualGridGeometry>;
121
122
123
124
public:

    using ParentType::ParentType;

125
126
127
    /*!
     * \brief Returns true because this view is related to cell centered dofs
     */
128
129
    static constexpr bool isCellCenter() { return true; }

130
131
132
    /*!
     * \brief The total number of cell centered dofs
     */
133
    std::size_t numDofs() const
134
    { return this->gridGeometry_->numCellCenterDofs(); }
135
136
137
138
139
140
141
};

/*!
 * \ingroup StaggeredDiscretization
 * \brief Face specific auxiliary FvGridGeometry classes.
 *        Required for the Dumux multi-domain framework.
 */
142
143
template <class ActualGridGeometry>
class FaceFVGridGeometry : public GridGeometryView<ActualGridGeometry>
144
{
145
    using ParentType = GridGeometryView<ActualGridGeometry>;
146
147
148
149
public:

    using ParentType::ParentType;

150
151
152
    /*!
     * \brief Returns true because this view is related to face dofs
     */
153
154
    static constexpr bool isFace() {return true; }

155
156
157
    /*!
     * \brief The total number of cell centered dofs
     */
158
    std::size_t numDofs() const
159
    { return this->gridGeometry_->numFaceDofs(); }
160
161
};

162
/*!
Kilian Weishaupt's avatar
Kilian Weishaupt committed
163
 * \ingroup StaggeredDiscretization
164
165
166
167
 * \brief Base class for the finite volume geometry vector for staggered models
 *        This builds up the sub control volumes and sub control volume faces
 *        for each element.
 */
168
169
170
template<class GridView,
         bool cachingEnabled,
         class Traits>
171
class StaggeredFVGridGeometry;
172

Kilian Weishaupt's avatar
Kilian Weishaupt committed
173
174
175
176
177
178
/*!
 * \ingroup StaggeredDiscretization
 * \brief Base class for the finite volume geometry vector for staggered models
 *        This builds up the sub control volumes and sub control volume faces
 *        for each element. Specialization in case the FVElementGeometries are stored.
 */
179
180
181
template<class GV, class T>
class StaggeredFVGridGeometry<GV, true, T>
: public BaseGridGeometry<GV, T>
182
{
183
184
    using ThisType = StaggeredFVGridGeometry<GV, true, T>;
    using ParentType = BaseGridGeometry<GV, T>;
185
186
    using GridIndexType = typename IndexTraits<GV>::GridIndex;
    using LocalIndexType = typename IndexTraits<GV>::LocalIndex;
187
    using Element = typename GV::template Codim<0>::Entity;
188

189
190
191
    using IntersectionMapper = typename T::IntersectionMapper;
    using GeometryHelper = typename T::GeometryHelper;
    using ConnectivityMap = typename T::template ConnectivityMap<ThisType>;
192

193
public:
194
195
196
    //! export the traits
    using Traits = typename T::PublicTraits;

197
    //! export discretization method
198
    static constexpr DiscretizationMethod discMethod = DiscretizationMethod::staggered;
199
    static constexpr int upwindSchemeOrder = T::upwindSchemeOrder;
200
    static constexpr bool useHigherOrder = upwindSchemeOrder > 1;
201
    static constexpr bool cachingEnabled = true;
202

203
    //! export the type of the fv element geometry (the local view type)
204
    using LocalView = typename T::template LocalView<ThisType, true>;
205
    //! export the type of sub control volume
206
    using SubControlVolume = typename T::SubControlVolume;
207
    //! export the type of sub control volume
208
    using SubControlVolumeFace = typename T::SubControlVolumeFace;
209
210
    //! export the type of extrusion
    using Extrusion = Extrusion_t<T>;
211
212
    //! export the grid view type
    using GridView = GV;
213
    //! export the dof type indices
214
    using DofTypeIndices = typename T::DofTypeIndices;
215
216
217
218
219
220
221
222

    //! return a integral constant for cell center dofs
    static constexpr auto cellCenterIdx()
    { return typename DofTypeIndices::CellCenterIdx{}; }

    //! return a integral constant for face dofs
    static constexpr auto faceIdx()
    { return typename DofTypeIndices::FaceIdx{}; }
223

224
    //! The order of the stencil built
225
    static constexpr int upwindStencilOrder()
226
227
    {   return upwindSchemeOrder; }

228
229
230
231
232
    using CellCenterFVGridGeometryType = CellCenterFVGridGeometry<ThisType>;
    using FaceFVGridGeometryType = FaceFVGridGeometry<ThisType>;

    using FVGridGeometryTuple = std::tuple< CellCenterFVGridGeometry<ThisType>, FaceFVGridGeometry<ThisType> >;

233
    //! Constructor
234
    StaggeredFVGridGeometry(const GridView& gridView, const std::string& paramGroup = "")
235
    : ParentType(gridView)
236
237
238
239
    , intersectionMapper_(gridView)
    {
        // Check if the overlap size is what we expect
        if (!CheckOverlapSize<DiscretizationMethod::staggered>::isValid(gridView))
240
            DUNE_THROW(Dune::InvalidStateException, "The staggered discretization method needs at least an overlap of 1 for parallel computations. "
241
242
                                                     << " Set the parameter \"Grid.Overlap\" in the input file.");
    }
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261

    //! The total number of sub control volumes
    std::size_t numScv() const
    {
        return scvs_.size();
    }

    //! The total number of sub control volume faces
    std::size_t numScvf() const
    {
        return scvfs_.size();
    }

    //! The total number of boundary sub control volume faces
    std::size_t numBoundaryScvf() const
    {
        return numBoundaryScvf_;
    }

262

263
264
265
266
267
268
    //! The total number of intersections
    std::size_t numIntersections() const
    {
        return intersectionMapper_.numIntersections();
    }

269
270
271
272
273
274
275
276
277
278
    //! the total number of dofs
    std::size_t numDofs() const
    { return numCellCenterDofs() + numFaceDofs(); }

    std::size_t numCellCenterDofs() const
    { return this->gridView().size(0); }

    std::size_t numFaceDofs() const
    { return this->gridView().size(1); }

279
    //! update all fvElementGeometries (do this again after grid adaption)
280
    void update()
281
282
283
284
285
    {
        // clear containers (necessary after grid refinement)
        scvs_.clear();
        scvfs_.clear();
        scvfIndicesOfScv_.clear();
286
287
288
289
        if constexpr (Deprecated::hasUpdateGridView<IntersectionMapper, GridView>())
            intersectionMapper_.update(this->gridView());
        else
            Deprecated::update(intersectionMapper_);
290
        // determine size of containers
291
292
        std::size_t numScvs = this->gridView().size(0);
        std::size_t numScvf = 0;
293
        for (const auto& element : elements(this->gridView()))
294
295
296
297
298
299
            numScvf += element.subEntities(1);

        // reserve memory
        scvs_.resize(numScvs);
        scvfs_.reserve(numScvf);
        scvfIndicesOfScv_.resize(numScvs);
300
        localToGlobalScvfIndices_.resize(numScvs);
301
        hasBoundaryScvf_.resize(numScvs, false);
302
303

        // Build the scvs and scv faces
304
        GridIndexType scvfIdx = 0;
305
        numBoundaryScvf_ = 0;
306
        for (const auto& element : elements(this->gridView()))
307
        {
308
            auto eIdx = this->elementMapper().index(element);
309

310
            // reserve memory for the localToGlobalScvfIdx map
311
            auto numLocalFaces = intersectionMapper_.numFaces(element);
312
            localToGlobalScvfIndices_[eIdx].resize(numLocalFaces);
313

314
315
316
            scvs_[eIdx] = SubControlVolume(element.geometry(), eIdx);

            // the element-wise index sets for finite volume geometry
317
            std::vector<GridIndexType> scvfsIndexSet;
318
            scvfsIndexSet.reserve(numLocalFaces);
319

320
            GeometryHelper geometryHelper(element, this->gridView());
321

322
            for (const auto& intersection : intersections(this->gridView(), element))
323
            {
324
325
                geometryHelper.updateLocalFace(intersectionMapper_, intersection);
                const int localFaceIndex = geometryHelper.localFaceIndex();
326
327
328
329

                // inner sub control volume faces
                if (intersection.neighbor())
                {
330
                    auto nIdx = this->elementMapper().index(intersection.outside());
331
332
333
                    scvfs_.emplace_back(intersection,
                                        intersection.geometry(),
                                        scvfIdx,
334
                                        std::vector<GridIndexType>({eIdx, nIdx}),
335
                                        geometryHelper);
336
                    localToGlobalScvfIndices_[eIdx][localFaceIndex] = scvfIdx;
337
338
339
340
341
342
343
344
                    scvfsIndexSet.push_back(scvfIdx++);
                }
                // boundary sub control volume faces
                else if (intersection.boundary())
                {
                    scvfs_.emplace_back(intersection,
                                        intersection.geometry(),
                                        scvfIdx,
345
                                        std::vector<GridIndexType>({eIdx, this->gridView().size(0) + numBoundaryScvf_++}),
346
                                        geometryHelper);
347
                    localToGlobalScvfIndices_[eIdx][localFaceIndex] = scvfIdx;
348
                    scvfsIndexSet.push_back(scvfIdx++);
349
350

                    hasBoundaryScvf_[eIdx] = true;
351
352
353
354
355
356
357
                }
            }

            // Save the scvf indices belonging to this scv to build up fv element geometries fast
            scvfIndicesOfScv_[eIdx] = scvfsIndexSet;
        }

358
359
360
        // build the connectivity map for an effecient assembly
        connectivityMap_.update(*this);
    }
361
362

    //! Get a sub control volume with a global scv index
363
    const SubControlVolume& scv(GridIndexType scvIdx) const
364
365
366
367
368
    {
        return scvs_[scvIdx];
    }

    //! Get a sub control volume face with a global scvf index
369
    const SubControlVolumeFace& scvf(GridIndexType scvfIdx) const
370
371
372
373
374
    {
        return scvfs_[scvfIdx];
    }

    //! Get the sub control volume face indices of an scv by global index
375
    const std::vector<GridIndexType>& scvfIndicesOfScv(GridIndexType scvIdx) const
376
377
378
379
    {
        return scvfIndicesOfScv_[scvIdx];
    }

380
    GridIndexType localToGlobalScvfIndex(GridIndexType eIdx, LocalIndexType localScvfIdx) const
381
382
383
384
    {
        return localToGlobalScvfIndices_[eIdx][localScvfIdx];
    }

385
    const SubControlVolumeFace& scvf(GridIndexType eIdx, LocalIndexType localScvfIdx) const
386
387
388
389
    {
        return scvf(localToGlobalScvfIndex(eIdx, localScvfIdx));
    }

390
391
392
393
394
395
    /*!
     * \brief Returns the connectivity map of which dofs have derivatives with respect
     *        to a given dof.
     */
    const ConnectivityMap &connectivityMap() const
    { return connectivityMap_; }
396

397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
    //! Returns a pointer the cell center specific auxiliary class. Required for the multi-domain FVAssembler's ctor.
    std::unique_ptr<CellCenterFVGridGeometry<ThisType>> cellCenterFVGridGeometryPtr() const
    {
        return std::make_unique<CellCenterFVGridGeometry<ThisType>>(this);
    }

    //! Returns a pointer the face specific auxiliary class. Required for the multi-domain FVAssembler's ctor.
    std::unique_ptr<FaceFVGridGeometry<ThisType>> faceFVGridGeometryPtr() const
    {
        return std::make_unique<FaceFVGridGeometry<ThisType>>(this);
    }

    //! Return a copy of the cell center specific auxiliary class.
    CellCenterFVGridGeometry<ThisType> cellCenterFVGridGeometry() const
    {
        return CellCenterFVGridGeometry<ThisType>(this);
    }

    //! Return a copy of the face specific auxiliary class.
    FaceFVGridGeometry<ThisType> faceFVGridGeometry() const
    {
        return FaceFVGridGeometry<ThisType>(this);
    }
420

421
    //! Returns whether one of the geometry's scvfs lies on a boundary
422
    bool hasBoundaryScvf(GridIndexType eIdx) const
423
424
    { return hasBoundaryScvf_[eIdx]; }

425
private:
426

427
428
    // mappers
    ConnectivityMap connectivityMap_;
429
    IntersectionMapper intersectionMapper_;
430

431
432
    std::vector<SubControlVolume> scvs_;
    std::vector<SubControlVolumeFace> scvfs_;
433
434
435
    std::vector<std::vector<GridIndexType>> scvfIndicesOfScv_;
    std::vector<std::vector<GridIndexType>> localToGlobalScvfIndices_;
    GridIndexType numBoundaryScvf_;
436
    std::vector<bool> hasBoundaryScvf_;
437
438
};

Kilian Weishaupt's avatar
Kilian Weishaupt committed
439
440
441
442
443
444
/*!
 * \ingroup StaggeredDiscretization
 * \brief Base class for the finite volume geometry vector for staggered models
 *        This builds up the sub control volumes and sub control volume faces
 *        for each element. Specialization in case the FVElementGeometries are stored.
 */
445
446
447
template<class GV, class T>
class StaggeredFVGridGeometry<GV, false, T>
: public BaseGridGeometry<GV, T>
448
{
449
450
    using ThisType = StaggeredFVGridGeometry<GV, false, T>;
    using ParentType = BaseGridGeometry<GV, T>;
451
452
    using GridIndexType = typename IndexTraits<GV>::GridIndex;
    using LocalIndexType = typename IndexTraits<GV>::LocalIndex;
453
454
    using Element = typename GV::template Codim<0>::Entity;

455
456
    using IntersectionMapper = typename T::IntersectionMapper;
    using ConnectivityMap = typename T::template ConnectivityMap<ThisType>;
457
458

public:
459
460
461
    //! export the traits
    using Traits = typename T::PublicTraits;

462
463
    //! export discretization method
    static constexpr DiscretizationMethod discMethod = DiscretizationMethod::staggered;
464
    static constexpr int upwindSchemeOrder = T::upwindSchemeOrder;
465
    static constexpr bool useHigherOrder = upwindSchemeOrder > 1;
466
    static constexpr bool cachingEnabled = false;
467

468
    using GeometryHelper = typename T::GeometryHelper;
469
470

    //! export the type of the fv element geometry (the local view type)
471
    using LocalView = typename T::template LocalView<ThisType, false>;
472
    //! export the type of sub control volume
473
    using SubControlVolume = typename T::SubControlVolume;
474
    //! export the type of sub control volume
475
    using SubControlVolumeFace = typename T::SubControlVolumeFace;
476
477
    //! export the type of extrusion
    using Extrusion = Extrusion_t<T>;
478
479
480
    //! export the grid view type
    using GridView = GV;
    //! export the dof type indices
481
    using DofTypeIndices = typename T::DofTypeIndices;
482
483
484
485
486
487
488
489
490

    //! return a integral constant for cell center dofs
    static constexpr auto cellCenterIdx()
    { return typename DofTypeIndices::CellCenterIdx{}; }

    //! return a integral constant for face dofs
    static constexpr auto faceIdx()
    { return typename DofTypeIndices::FaceIdx{}; }

491
    //! The order of the stencil built
492
    static constexpr int upwindStencilOrder()
493
494
    {   return upwindSchemeOrder; }

495
496
497
498
499
500
    using CellCenterFVGridGeometryType = CellCenterFVGridGeometry<ThisType>;
    using FaceFVGridGeometryType = FaceFVGridGeometry<ThisType>;

    using FVGridGeometryTuple = std::tuple< CellCenterFVGridGeometry<ThisType>, FaceFVGridGeometry<ThisType> >;

    //! Constructor
501
    StaggeredFVGridGeometry(const GridView& gridView, const std::string& paramGroup = "")
502
503
504
505
506
507
508
509
510
511
512
513
514
515
    : ParentType(gridView)
    , intersectionMapper_(gridView)
    {
        // Check if the overlap size is what we expect
        if (!CheckOverlapSize<DiscretizationMethod::staggered>::isValid(gridView))
            DUNE_THROW(Dune::InvalidStateException, "The staggered discretization method needs at least an overlap of 1 for parallel computations. "
                                                     << " Set the parameter \"Grid.Overlap\" in the input file.");
    }

    //! update all fvElementGeometries (do this again after grid adaption)
    void update()
    {
        // clear containers (necessary after grid refinement)
        scvfIndicesOfScv_.clear();
516
517
518
519
        if constexpr (Deprecated::hasUpdateGridView<IntersectionMapper, GridView>())
            intersectionMapper_.update(this->gridView());
        else
            Deprecated::update(intersectionMapper_);
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
        neighborVolVarIndices_.clear();

        numScvs_ = numCellCenterDofs();
        numScvf_ = 0;
        numBoundaryScvf_ = 0;
        scvfIndicesOfScv_.resize(numScvs_);
        localToGlobalScvfIndices_.resize(numScvs_);
        neighborVolVarIndices_.resize(numScvs_);

        // Build the scvs and scv faces
        for (const auto& element : elements(this->gridView()))
        {
            auto eIdx = this->elementMapper().index(element);

            // the element-wise index sets for finite volume geometry
            auto numLocalFaces = intersectionMapper_.numFaces(element);
536
            std::vector<GridIndexType> scvfsIndexSet;
537
538
539
            scvfsIndexSet.reserve(numLocalFaces);
            localToGlobalScvfIndices_[eIdx].resize(numLocalFaces);

540
            std::vector<GridIndexType> neighborVolVarIndexSet;
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
            neighborVolVarIndexSet.reserve(numLocalFaces);

            for (const auto& intersection : intersections(this->gridView(), element))
            {
                const auto localFaceIndex = intersection.indexInInside();
                localToGlobalScvfIndices_[eIdx][localFaceIndex] = numScvf_;
                scvfsIndexSet.push_back(numScvf_++);

                if (intersection.neighbor())
                {
                    const auto nIdx = this->elementMapper().index(intersection.outside());
                    neighborVolVarIndexSet.emplace_back(nIdx);
                }
                else
                    neighborVolVarIndexSet.emplace_back(numScvs_ + numBoundaryScvf_++);
            }

            // Save the scvf indices belonging to this scv to build up fv element geometries fast
            scvfIndicesOfScv_[eIdx] = scvfsIndexSet;
            neighborVolVarIndices_[eIdx] = neighborVolVarIndexSet;
        }

        // build the connectivity map for an effecient assembly
        connectivityMap_.update(*this);
    }

    //! The total number of sub control volumes
    std::size_t numScv() const
    {
        return numScvs_;
    }

    //! The total number of sub control volume faces
    std::size_t numScvf() const
    {
        return numScvf_;
    }

    //! The total number of boundary sub control volume faces
    std::size_t numBoundaryScvf() const
    {
        return numBoundaryScvf_;
    }

    //! The total number of intersections
    std::size_t numIntersections() const
    {
        return intersectionMapper_.numIntersections();
    }

    //! the total number of dofs
    std::size_t numDofs() const
    { return numCellCenterDofs() + numFaceDofs(); }

    std::size_t numCellCenterDofs() const
    { return this->gridView().size(0); }

    std::size_t numFaceDofs() const
    { return this->gridView().size(1); }

601
    const std::vector<GridIndexType>& scvfIndicesOfScv(GridIndexType scvIdx) const
602
603
    { return scvfIndicesOfScv_[scvIdx]; }

604
    GridIndexType localToGlobalScvfIndex(GridIndexType eIdx, LocalIndexType localScvfIdx) const
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
    {
        return localToGlobalScvfIndices_[eIdx][localScvfIdx];
    }

    /*!
     * \brief Returns the connectivity map of which dofs have derivatives with respect
     *        to a given dof.
     */
    const ConnectivityMap &connectivityMap() const
    { return connectivityMap_; }

    //! Returns a pointer the cell center specific auxiliary class. Required for the multi-domain FVAssembler's ctor.
    std::unique_ptr<CellCenterFVGridGeometry<ThisType>> cellCenterFVGridGeometryPtr() const
    {
        return std::make_unique<CellCenterFVGridGeometry<ThisType>>(this);
    }

    //! Returns a pointer the face specific auxiliary class. Required for the multi-domain FVAssembler's ctor.
    std::unique_ptr<FaceFVGridGeometry<ThisType>> faceFVGridGeometryPtr() const
    {
        return std::make_unique<FaceFVGridGeometry<ThisType>>(this);
    }

    //! Return a copy of the cell center specific auxiliary class.
    CellCenterFVGridGeometry<ThisType> cellCenterFVGridGeometry() const
    {
        return CellCenterFVGridGeometry<ThisType>(this);
    }

    //! Return a copy of the face specific auxiliary class.
    FaceFVGridGeometry<ThisType> faceFVGridGeometry() const
    {
        return FaceFVGridGeometry<ThisType>(this);
    }

    //! Return a reference to the intersection mapper
    const IntersectionMapper& intersectionMapper() const
    {
        return intersectionMapper_;
    }

    //! Return the neighbor volVar indices for all scvfs in the scv with index scvIdx
647
    const std::vector<GridIndexType>& neighborVolVarIndices(GridIndexType scvIdx) const
648
649
650
651
652
    { return neighborVolVarIndices_[scvIdx]; }

private:

    //! Information on the global number of geometries
653
654
655
656
657
    std::size_t numScvs_;
    std::size_t numScvf_;
    std::size_t numBoundaryScvf_;
    std::vector<std::vector<GridIndexType>> localToGlobalScvfIndices_;
    std::vector<std::vector<GridIndexType>> neighborVolVarIndices_;
658
659
660
661
662
663

    // mappers
    ConnectivityMap connectivityMap_;
    IntersectionMapper intersectionMapper_;

    //! vectors that store the global data
664
    std::vector<std::vector<GridIndexType>> scvfIndicesOfScv_;
665
666
667
668
669
};

} // end namespace

#endif