Alsvinn  0.5.3
The fast FVM simulator with UQ support
ConservedVariables.hpp
Go to the documentation of this file.
1 /* Copyright (c) 2018 ETH Zurich, Kjetil Olsen Lye
2  * This program is free software: you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation, either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program. If not, see <http://www.gnu.org/licenses/>.
14  */
15 
16 #pragma once
17 #include "alsfvm/types.hpp"
18 namespace alsfvm {
19 namespace equation {
20 namespace linear {
21 
27 public:
29  : u(0) {
30  // empty
31  }
33  : u(u_) {
34  // empty
35  }
36 
38  : u(u_.x) {
39  // empty
40  }
41 
42  __device__ __host__ static constexpr size_t size() {
43  return 1;
44  }
45 
47  return u;
48  }
49 
50  __device__ __host__ real operator[](size_t index) const {
51  return u;
52  }
53 
55 };
56 
63  return ConservedVariables(a.u - b.u);
64 }
65 
72  return ConservedVariables(a.u + b.u);
73 }
74 
80  const ConservedVariables& b) {
81  return ConservedVariables(a * b.u);
82 }
83 
89  ConservedVariables& a, real b) {
90  return ConservedVariables(a.u / b);
91 }
92 
93 
94 
95 } // namespace alsfvm
96 } // namespace equation
97 } // namespace linear
__device__ __host__ ConservedVariables operator*(real a, const ConservedVariables &b)
Definition: ConservedVariables.hpp:79
__device__ __host__ ConservedVariables(real u_)
Definition: ConservedVariables.hpp:32
#define __host__
Definition: types.hpp:46
real u
Definition: ConservedVariables.hpp:54
__device__ __host__ real & operator[](size_t index)
Definition: ConservedVariables.hpp:46
double real
Definition: types.hpp:65
__device__ __host__ ConservedVariables()
Definition: ConservedVariables.hpp:28
__device__ __host__ ConservedVariables operator/(const ConservedVariables &a, real b)
Definition: ConservedVariables.hpp:88
Definition: vec1.hpp:24
__device__ __host__ ConservedVariables operator+(const ConservedVariables &a, const ConservedVariables &b)
Definition: ConservedVariables.hpp:70
#define __device__
Definition: types.hpp:45
Various utility functions to implement the tecno flux.
Definition: types.hpp:30
__device__ __host__ ConservedVariables(const rvec1 &u_)
Definition: ConservedVariables.hpp:37
Definition: ConservedVariables.hpp:26
__device__ static __host__ constexpr size_t size()
Definition: ConservedVariables.hpp:42
__device__ __host__ ConservedVariables operator-(const ConservedVariables &a, const ConservedVariables &b)
Definition: ConservedVariables.hpp:61
__device__ __host__ real operator[](size_t index) const
Definition: ConservedVariables.hpp:50