opm-grid
Toggle main menu visibility
Loading...
Searching...
No Matches
LookUpCellCentroid.hh
1
//===========================================================================
2
//
3
// File: LookUpCellCentroid.hh
4
//
5
// Created: Wed July 26 10:48:00 2023
6
//
7
// Author(s): Antonella Ritorto <antonella.ritorto@opm-op.com>
8
//
9
//
10
// $Date$
11
//
12
// $Revision$
13
//
14
//===========================================================================
15
16
/*
17
Copyright 2023 Equinor ASA.
18
19
This file is part of The Open Porous Media project (OPM).
20
21
OPM is free software: you can redistribute it and/or modify
22
it under the terms of the GNU General Public License as published by
23
the Free Software Foundation, either version 3 of the License, or
24
(at your option) any later version.
25
26
OPM is distributed in the hope that it will be useful,
27
but WITHOUT ANY WARRANTY; without even the implied warranty of
28
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29
GNU General Public License for more details.
30
31
You should have received a copy of the GNU General Public License
32
along with OPM. If not, see <http://www.gnu.org/licenses/>.
33
*/
34
35
#include <dune/grid/common/mcmgmapper.hh>
36
#include <opm/input/eclipse/EclipseState/Grid/EclipseGrid.hpp>
37
38
39
40
#include <type_traits>
41
42
namespace
Dune
43
{
44
class
CpGrid
;
45
}
46
47
namespace
Opm
48
{
49
50
class
EclipseGrid;
51
58
template
<
typename
Gr
id
,
typename
Gr
id
View>
59
struct
LookUpCellCentroid
60
{
65
explicit
LookUpCellCentroid
(
const
GridView& gridView,
66
const
Dune::CartesianIndexMapper<Grid>
& cartMapper,
67
const
Opm::EclipseGrid* eclgrid) :
68
gridView_(gridView),
69
cartMapper_(&cartMapper),
70
eclGrid_(eclgrid)
71
{
72
}
73
84
template
<
typename
Gr
id
Type = Gr
id
>
85
typename
std::enable_if_t<!std::is_same_v<GridType,Dune::CpGrid>, std::array<double,3>>
86
operator()
(std::size_t elemIdx)
const
;
87
96
// \param [in] elemIdx Element Index.
98
template
<
typename
Gr
id
Type = Gr
id
>
99
typename
std::enable_if_t<std::is_same_v<GridType,Dune::CpGrid>, std::array<double,3>>
100
operator()
(std::size_t elemIdx)
const
;
101
102
103
const
GridView& gridView_;
104
const
Dune::CartesianIndexMapper<Grid>
* cartMapper_;
105
const
Opm::EclipseGrid* eclGrid_;
106
107
};
// end LookUpCellCentroid struct
108
}
109
// end namespace Opm
110
111
112
template
<
typename
Gr
id
,
typename
Gr
id
View>
113
template
<
typename
Gr
id
Type>
114
typename
std::enable_if_t<!std::is_same_v<GridType,Dune::CpGrid>, std::array<double,3>>
115
Opm::LookUpCellCentroid<Grid,GridView>::operator()
(std::size_t elemIdx)
const
116
{
117
static_assert
(std::is_same_v<Grid,GridType>);
118
return
this
-> eclGrid_ -> getCellCenter(
this
-> cartMapper_->cartesianIndex(elemIdx));
119
}
120
121
template
<
typename
Gr
id
,
typename
Gr
id
View>
122
template
<
typename
Gr
id
Type>
123
typename
std::enable_if_t<std::is_same_v<GridType,Dune::CpGrid>,std::array<double,3>>
124
Opm::LookUpCellCentroid<Grid,GridView>::operator()
(std::size_t elemIdx)
const
125
{
126
static_assert
(std::is_same_v<Grid,GridType>);
127
return
this
-> gridView_.grid().getEclCentroid(elemIdx);
// Warning! might need to be changed, due to issue in simulators
128
}
Dune::CartesianIndexMapper
Interface class to access the logical Cartesian grid as used in industry standard simulator decks.
Definition
CartesianIndexMapper.hpp:16
Dune::CpGrid
[ provides Dune::Grid ]
Definition
CpGrid.hpp:203
Dune
The namespace Dune is the main namespace for all Dune code.
Definition
CartesianIndexMapper.hpp:10
Opm
Holds the implementation of the CpGrid as a pimple.
Definition
CellQuadrature.cpp:68
Opm::LookUpCellCentroid::operator()
std::enable_if_t<!std::is_same_v< GridType, Dune::CpGrid >, std::array< double, 3 > > operator()(std::size_t elemIdx) const
: Call operator
Definition
LookUpCellCentroid.hh:115
Opm::LookUpCellCentroid::LookUpCellCentroid
LookUpCellCentroid(const GridView &gridView, const Dune::CartesianIndexMapper< Grid > &cartMapper, const Opm::EclipseGrid *eclgrid)
: Constructor taking a GridView, CartesianMapper
Definition
LookUpCellCentroid.hh:65
opm
grid
LookUpCellCentroid.hh
Generated by
1.17.0