OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
AmrPCInterpolater.hpp
Go to the documentation of this file.
1 //
2 // Class AmrPCInterpolater
3 // Piecewise constant interpolation of data on coarse cells to fine cells.
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 template <class Level>
23  : AmrInterpolater<Level>(1)
24 { }
25 
26 
27 template <class Level>
29  const AmrIntVect_t& iv,
30  const basefab_t& fab,
31  umap_t& map,
32  const scalar_t& scale,
33  Level* mglevel)
34 {
35  AmrIntVect_t civ = iv;
36  civ.coarsen(mglevel->refinement());
37 
38  if ( !mglevel->applyBoundary(civ, fab, map, scale) )
39  map[mglevel->serialize(civ)] += scale;
40 }
41 
42 
43 template <class Level>
45  const AmrIntVect_t& /*iv*/,
46  umap_t& /*map*/,
47  const scalar_t& /*scale*/,
48  lo_t /*dir*/, lo_t /*shift*/, const basefab_t& /*rfab*/,
49  const AmrIntVect_t& /*riv*/,
50  Level* /*mglevel*/)
51 {
52  // do nothing
53 }
54 
55 
56 template <class Level>
58  const AmrIntVect_t& iv,
59  umap_t& map,
60  const scalar_t& scale,
61  lo_t /*dir*/, lo_t /*shift*/, const basefab_t& fab,
62  Level* mglevel)
63 {
64  /*
65  * The AmrPCInterpolater interpolates directly to the
66  * fine ghost cell.
67  */
68  this->stencil(iv, fab, map, scale, mglevel);
69 }
amr::AmrIntVect_t AmrIntVect_t
Level::scalar_t scalar_t
Level::lo_t lo_t
Level::umap_t umap_t
Level::basefab_t basefab_t
void stencil(const AmrIntVect_t &iv, const basefab_t &fab, umap_t &map, const scalar_t &scale, Level *mglevel)
void fine(const AmrIntVect_t &iv, umap_t &map, const scalar_t &scale, lo_t dir, lo_t shift, const basefab_t &fab, Level *mglevel)
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)