PISM, A Parallel Ice Sheet Model
stable v2.1.1 committed by Constantine Khrulev on 2024-12-04 13:36:58 -0900
src
util
stencils.hh
Go to the documentation of this file.
1
/* Copyright (C) 2015, 2016, 2021, 2023 PISM Authors
2
*
3
* This file is part of PISM.
4
*
5
* PISM is free software; you can redistribute it and/or modify it under the
6
* terms of the GNU General Public License as published by the Free Software
7
* Foundation; either version 3 of the License, or (at your option) any later
8
* version.
9
*
10
* PISM is distributed in the hope that it will be useful, but WITHOUT ANY
11
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13
* details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with PISM; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
*/
19
20
#ifndef PISM_STENCILS_HH
21
#define PISM_STENCILS_HH
22
23
namespace
pism
{
24
enum
Direction
{
North
= 0,
East
,
South
,
West
};
25
26
namespace
stencils {
27
28
//! \brief Star stencil points (in the map-plane).
29
template
<
typename
T>
30
struct
Star
{
31
T
c
,
e
,
w
,
n
,
s
;
32
33
Star
() =
default
;
34
35
Star
(T value) {
36
set
(value);
37
}
38
39
void
set
(T input) {
40
c
=
e
=
w
=
n
=
s
= input;
41
}
42
43
//! Get the element corresponding to a given direction.
44
//! Use foo.c to get the value at i,j (center of the star).
45
inline
T&
operator[]
(
Direction
direction) {
46
switch
(direction) {
47
default
:
// just to silence the warning
48
case
North
:
49
return
n
;
50
case
East
:
51
return
e
;
52
case
South
:
53
return
s
;
54
case
West
:
55
return
w
;
56
}
57
}
58
59
inline
const
T&
operator[]
(
Direction
direction)
const
{
60
switch
(direction) {
61
default
:
// just to silence the warning
62
case
North
:
63
return
n
;
64
case
East
:
65
return
e
;
66
case
South
:
67
return
s
;
68
case
West
:
69
return
w
;
70
}
71
}
72
};
73
74
// NB: Do not change the order of elements in this struct. array::Array2D::box() depends
75
// on it.
76
template
<
typename
T>
77
struct
Box
{
78
T
c
,
n
,
nw
,
w
,
sw
,
s
,
se
,
e
,
ne
;
79
};
80
81
}
// end of namespace stencils
82
83
}
// end of namespace pism
84
85
#endif
/* PISM_STENCILS_HH */
pism::Direction
Direction
Definition:
stencils.hh:24
pism::North
@ North
Definition:
stencils.hh:24
pism::East
@ East
Definition:
stencils.hh:24
pism::South
@ South
Definition:
stencils.hh:24
pism::West
@ West
Definition:
stencils.hh:24
pism
Definition:
AgeColumnSystem.cc:23
pism::stencils::Box::n
T n
Definition:
stencils.hh:78
pism::stencils::Box::se
T se
Definition:
stencils.hh:78
pism::stencils::Box::c
T c
Definition:
stencils.hh:78
pism::stencils::Box::sw
T sw
Definition:
stencils.hh:78
pism::stencils::Box::ne
T ne
Definition:
stencils.hh:78
pism::stencils::Box::s
T s
Definition:
stencils.hh:78
pism::stencils::Box::e
T e
Definition:
stencils.hh:78
pism::stencils::Box::nw
T nw
Definition:
stencils.hh:78
pism::stencils::Box::w
T w
Definition:
stencils.hh:78
pism::stencils::Box
Definition:
stencils.hh:77
pism::stencils::Star::operator[]
T & operator[](Direction direction)
Definition:
stencils.hh:45
pism::stencils::Star::w
T w
Definition:
stencils.hh:31
pism::stencils::Star::set
void set(T input)
Definition:
stencils.hh:39
pism::stencils::Star::s
T s
Definition:
stencils.hh:31
pism::stencils::Star::c
T c
Definition:
stencils.hh:31
pism::stencils::Star::n
T n
Definition:
stencils.hh:31
pism::stencils::Star::operator[]
const T & operator[](Direction direction) const
Definition:
stencils.hh:59
pism::stencils::Star::e
T e
Definition:
stencils.hh:31
pism::stencils::Star::Star
Star(T value)
Definition:
stencils.hh:35
pism::stencils::Star::Star
Star()=default
pism::stencils::Star
Star stencil points (in the map-plane).
Definition:
stencils.hh:30
Generated by
1.9.1