opm-grid
Toggle main menu visibility
Loading...
Searching...
No Matches
GlobalIdMapping.hpp
1
/*
2
Copyright 2014 Statoil ASA.
3
Copyright 2014 Dr. Markus Blatt - HPC-Simulation-Software & Services
4
5
This file is part of The Open Porous Media project (OPM).
6
7
OPM is free software: you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation, either version 3 of the License, or
10
(at your option) any later version.
11
12
OPM is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
16
17
You should have received a copy of the GNU General Public License
18
along with OPM. If not, see <http://www.gnu.org/licenses/>.
19
*/
20
#ifndef OPM_GLOBALIDMAPPING_HEADER
21
#define OPM_GLOBALIDMAPPING_HEADER
22
#include <vector>
23
namespace
Dune
24
{
25
namespace
cpgrid
26
{
30
class
GlobalIdMapping
31
{
32
public
:
37
38
void
swap
(std::vector<int>& cellMapping,
39
std::vector<int>& faceMapping,
40
std::vector<int>& pointMapping)
41
{
42
cellMapping_
.swap(cellMapping);
43
faceMapping_
.swap(faceMapping);
44
pointMapping_
.swap(pointMapping);
45
}
46
48
template
<
int
codim>
49
std::vector<int>&
getMapping
()
50
{
51
static_assert
(codim == 0 || codim == 1 || codim==3,
52
"Mappings only available for codimension 0, 1, and 3"
);
53
if
(codim==0)
54
return
cellMapping_
;
55
if
(codim==1)
56
return
faceMapping_
;
57
return
pointMapping_
;
58
}
59
62
template
<
int
codim>
63
const
std::vector<int>&
getMapping
()
const
64
{
65
static_assert
(codim == 0 || codim == 1 || codim==3,
66
"Mappings only available for codimension 0, 1, and 3"
);
67
if
(codim==0)
68
return
cellMapping_
;
69
if
(codim==1)
70
return
faceMapping_
;
71
return
pointMapping_
;
72
}
73
protected
:
75
std::vector<int>
cellMapping_
;
77
std::vector<int>
faceMapping_
;
79
std::vector<int>
pointMapping_
;
80
};
81
}
82
}
83
84
#endif
Dune::cpgrid::GlobalIdMapping
Class managing the mappings of local indices to global ids.
Definition
GlobalIdMapping.hpp:31
Dune::cpgrid::GlobalIdMapping::pointMapping_
std::vector< int > pointMapping_
A vector containing the global id of point with index i at position i.
Definition
GlobalIdMapping.hpp:79
Dune::cpgrid::GlobalIdMapping::getMapping
std::vector< int > & getMapping()
Get the vector with the mappings for a codimension.
Definition
GlobalIdMapping.hpp:49
Dune::cpgrid::GlobalIdMapping::cellMapping_
std::vector< int > cellMapping_
A vector containing the global id of cell with index i at position i.
Definition
GlobalIdMapping.hpp:75
Dune::cpgrid::GlobalIdMapping::getMapping
const std::vector< int > & getMapping() const
Get the vector with the mappings for a codimension.
Definition
GlobalIdMapping.hpp:63
Dune::cpgrid::GlobalIdMapping::faceMapping_
std::vector< int > faceMapping_
A vector containing the global id of face with index i at position i.
Definition
GlobalIdMapping.hpp:77
Dune::cpgrid::GlobalIdMapping::swap
void swap(std::vector< int > &cellMapping, std::vector< int > &faceMapping, std::vector< int > &pointMapping)
Swap data for initialization.
Definition
GlobalIdMapping.hpp:38
Dune::cpgrid
Copyright 2019 Equinor AS.
Definition
GridPartitioning.cpp:673
Dune
The namespace Dune is the main namespace for all Dune code.
Definition
CartesianIndexMapper.hpp:10
opm
grid
cpgrid
GlobalIdMapping.hpp
Generated by
1.17.0