OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
AmrLagrangeInterpolater.h
Go to the documentation of this file.
1//
2// Class AmrLagrangeInterpolater
3// Lagrange interpolation for coarse-fine interfaces.
4//
5// Copyright (c) 2017 - 2020, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
6// All rights reserved
7//
8// Implemented as part of the PhD thesis
9// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
10//
11// This file is part of OPAL.
12//
13// OPAL is free software: you can redistribute it and/or modify
14// it under the terms of the GNU General Public License as published by
15// the Free Software Foundation, either version 3 of the License, or
16// (at your option) any later version.
17//
18// You should have received a copy of the GNU General Public License
19// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
20//
21#ifndef AMR_LAGRANGE_INTERPOLATER_H
22#define AMR_LAGRANGE_INTERPOLATER_H
23
24#include "AmrInterpolater.h"
25
26#if AMREX_SPACEDIM == 3
27 #include <bitset>
28 #include <iterator>
29 #include <array>
30#endif
31
32#include "Ippl.h"
33
34template <class Level>
36{
37public:
38
39 typedef typename Level::go_t go_t;
40 typedef typename Level::lo_t lo_t;
41 typedef typename Level::scalar_t scalar_t;
42 typedef typename Level::umap_t umap_t;
43 typedef typename Level::basefab_t basefab_t;
45
46 enum Order {
47 LINEAR = 1,
49 };
50
51#if AMREX_SPACEDIM == 3
52 typedef std::bitset<25> qbits_t;
53 typedef std::bitset<9> lbits_t;
54 typedef std::array<unsigned int long, 9> qpattern_t;
55 typedef std::array<unsigned int long, 4> lpattern_t;
56#endif
57
58public:
59
61
62 void stencil(const AmrIntVect_t& iv,
63 const basefab_t& fab,
64 umap_t& map,
65 const scalar_t& scale,
66 Level* mglevel);
67
68 void coarse(const AmrIntVect_t& iv,
69 umap_t& map,
70 const scalar_t& scale,
71 lo_t dir, lo_t shift, const basefab_t& rfab,
72 const AmrIntVect_t& riv,
73 Level* mglevel);
74
75 void fine(const AmrIntVect_t& iv,
76 umap_t& map,
77 const scalar_t& scale,
78 lo_t dir, lo_t shift,
79 Level* mglevel);
80
81private:
82
98 void fineLinear_m(const AmrIntVect_t& iv,
99 umap_t& map,
100 const scalar_t& scale,
101 lo_t dir, lo_t shift,
102 Level* mglevel);
103
119 void fineQuadratic_m(const AmrIntVect_t& iv,
120 umap_t& map,
121 const scalar_t& scale,
122 lo_t dir, lo_t shift,
123 Level* mglevel);
124
140 void crseLinear_m(const AmrIntVect_t& iv,
141 umap_t& map,
142 const scalar_t& scale,
143 lo_t dir, lo_t shift, const basefab_t& rfab,
144 const AmrIntVect_t& riv,
145 Level* mglevel);
146
163 void crseQuadratic_m(const AmrIntVect_t& iv,
164 umap_t& map,
165 const scalar_t& scale,
166 lo_t dir, lo_t shift, const basefab_t& rfab,
167 const AmrIntVect_t& riv,
168 Level* mglevel);
169
170private:
171#if AMREX_SPACEDIM == 3
172 static constexpr qpattern_t qpattern_ms {
173 473536,
174 14798,
175 236768,
176 15153152,
177 947072,
178 29596,
179 7399,
180 7576576,
181 30306304
182 };
183
184 static constexpr lpattern_t lpattern_ms {
185 27,
186 216,
187 432,
188 54
189 };
190#endif
191
192 // y_b y_t
193 static const scalar_t lookup1a_ms[2];
194 static const scalar_t lookup2a_ms[2];
195 static const scalar_t lookup1b_ms[2];
196 static const scalar_t lookup2b_ms[2];
197#if AMREX_SPACEDIM == 3
198 static const scalar_t lookup3_ms[2];
199 static const scalar_t lookup3r_ms[2];
200 static const scalar_t lookup4_ms[2];
201 static const scalar_t lookup4r_ms[2];
202 static const scalar_t lookup5_ms[2];
203 static const scalar_t lookup5r_ms[2];
204 static const scalar_t lookup6_ms;
205 static const scalar_t factor_ms;
206#endif
207};
208
210
211#endif
amrex::IntVect AmrIntVect_t
Definition: AmrDefs.h:48
double scalar_t
void fine(const AmrIntVect_t &iv, umap_t &map, const scalar_t &scale, lo_t dir, lo_t shift, Level *mglevel)
static const scalar_t lookup1a_ms[2]
void crseLinear_m(const AmrIntVect_t &iv, umap_t &map, const scalar_t &scale, lo_t dir, lo_t shift, const basefab_t &rfab, const AmrIntVect_t &riv, Level *mglevel)
void fineLinear_m(const AmrIntVect_t &iv, umap_t &map, const scalar_t &scale, lo_t dir, lo_t shift, Level *mglevel)
void crseQuadratic_m(const AmrIntVect_t &iv, umap_t &map, const scalar_t &scale, lo_t dir, lo_t shift, const basefab_t &rfab, const AmrIntVect_t &riv, Level *mglevel)
static const scalar_t lookup1b_ms[2]
static const scalar_t lookup2b_ms[2]
void coarse(const AmrIntVect_t &iv, umap_t &map, const scalar_t &scale, lo_t dir, lo_t shift, const basefab_t &rfab, const AmrIntVect_t &riv, Level *mglevel)
void fineQuadratic_m(const AmrIntVect_t &iv, umap_t &map, const scalar_t &scale, lo_t dir, lo_t shift, Level *mglevel)
void stencil(const AmrIntVect_t &iv, const basefab_t &fab, umap_t &map, const scalar_t &scale, Level *mglevel)
static const scalar_t lookup2a_ms[2]