Alsvinn  0.5.3
The fast FVM simulator with UQ support
vector_operations.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"
21 
22 namespace alsfvm {
23 namespace cuda {
24 
33 template<class T>
34 void add(T* result, const T* a, const T* b, size_t size);
35 
44 template<class T>
45 void multiply(T* result, const T* a, const T* b, size_t size);
46 
55 template<class T>
56 void subtract(T* result, const T* a, const T* b, size_t size);
57 
66 template<class T>
67 void divide(T* result, const T* a, const T* b, size_t size);
68 
77 template<class T>
78 void add(T* result, const T* a, T scalar, size_t size);
79 
88 template<class T>
89 void multiply(T* result, const T* a, T scalar, size_t size);
90 
99 template<class T>
100 void subtract(T* result, const T* a, T scalar, size_t size);
101 
110 template<class T>
111 void divide(T* result, const T* a, T scalar, size_t size);
112 
117 template<class T>
118 void add_linear_combination(T a1, T* v1,
119  T a2, const T* v2,
120  T a3, const T* v3,
121  T a4, const T* v4,
122  T a5, const T* v5,
123  size_t size);
124 
128 template<class T>
129 void add_power(T* a, const T* b, double power, size_t size);
130 
134 template<class T>
135 void add_power(T* a, const T* b, double power, double factor, size_t size);
136 
137 
141 template<class T>
142 void subtract_power(T* a, const T* b, double power, size_t size);
143 
144 
145 template<class T>
146 T compute_total_variation(const T* a, size_t nx, size_t ny, size_t nz, int p,
147  const ivec3& start, const ivec3& end);
148 
149 template<class T>
150 T compute_total_variation(const T* a, size_t nx, size_t ny, size_t nz,
151  size_t direction, int p,
152  const ivec3& start, const ivec3& end);
153 }
154 
155 
156 }
void divide(T *result, const T *a, const T *b, size_t size)
void add_power(T *a, const T *b, double power, size_t size)
void add(T *result, const T *a, const T *b, size_t size)
void subtract(T *result, const T *a, const T *b, size_t size)
size_t nx
Definition: VolumeFactory.cpp:87
vec3< int > ivec3
Definition: types.hpp:77
void add_linear_combination(T a1, T *v1, T a2, const T *v2, T a3, const T *v3, T a4, const T *v4, T a5, const T *v5, size_t size)
void subtract_power(T *a, const T *b, double power, size_t size)
size_t ny
Definition: VolumeFactory.cpp:88
void multiply(T *result, const T *a, const T *b, size_t size)
T compute_total_variation(const T *a, size_t nx, size_t ny, size_t nz, int p, const ivec3 &start, const ivec3 &end)
size_t nz
Definition: VolumeFactory.cpp:89
Various utility functions to implement the tecno flux.
Definition: types.hpp:30
float p
Definition: sodshocktube.py:5