Vlasiator ebf0dd394 on dev (v5.4.0 + 1054 commits)
Loading...
Searching...
No Matches
cpu_1d_plm.hpp
Go to the documentation of this file.
1/*
2 * This file is part of Vlasiator.
3 * Copyright 2010-2016 Finnish Meteorological Institute
4 *
5 * For details of usage, see the COPYING file and read the "Rules of the Road"
6 * at http://www.physics.helsinki.fi/vlasiator/
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
23#ifndef CPU_1D_PLM_H
24#define CPU_1D_PLM_H
25
26#include "vec.h"
28
29using namespace std;
30
37
38static inline void compute_plm_coeff(const Vec * const values,const uint k, Vec a[2], const Realf threshold)
39{
40 // scale values closer to 1 for more accurate slope limiter calculation
41 const Realf scale = 1./threshold;
42 //Vec v_1 = values[k - 1] * scale;
43 //Vec v_2 = values[k] * scale;
44 //Vec v_3 = values[k + 1] * scale;
45 //Vec d_cv = slope_limiter(v_1, v_2, v_3) * threshold;
46 const Vec d_cv = slope_limiter( values[k-1]*scale, values[k]*scale, values[k+1]*scale)*threshold;
47 a[0] = values[k] - d_cv * 0.5;
48 a[1] = d_cv * 0.5;
49}
50
51#endif
static void compute_plm_coeff(const Vec *const values, const uint k, Vec a[2], const Realf threshold)
float Realf
Definition definitions.h:33
const int k
__global__ void const Realf const uint *__restrict__ const uint *__restrict__ const vmesh::GlobalID *__restrict__ const uint const uint const uint const Realf threshold
Real slope_limiter(const Real &l, const Real &m, const Real &r)
An interface to a type with floating point values.