OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
AmrPeriodicBoundary.h
Go to the documentation of this file.
1//
2// Class AmrPeriodicBoundary
3// Periodic boundary condition.
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_PERIODIC_BOUNDARY_H
22#define AMR_PERIODIC_BOUNDARY_H
23
24#include "AmrBoundary.h"
25
26template <class Level>
27class AmrPeriodicBoundary : public AmrBoundary<Level> {
28
29public:
30 typedef typename Level::umap_t umap_t;
31 typedef typename Level::lo_t lo_t;
32 typedef typename Level::go_t go_t;
33 typedef typename Level::scalar_t scalar_t;
35
36public:
37
39
40 void apply(const AmrIntVect_t& iv,
41 const lo_t& dir,
42 umap_t& map,
43 const scalar_t& value,
44 Level* mglevel,
45 const go_t* nr);
46};
47
48
49template <class Level>
51 const lo_t& dir,
52 umap_t& map,
53 const scalar_t& value,
54 Level* mglevel,
55 const go_t* nr)
56{
57 // find interior neighbour cell on opposite site
58 AmrIntVect_t niv = iv;
59 niv[dir] = ( iv[dir] == -1 ) ? nr[dir] - 1 : 0;
60
61 map[mglevel->serialize(niv)] += value;
62}
63
64
65#endif
const int nr
Definition: ClassicRandom.h:24
amrex::IntVect AmrIntVect_t
Definition: AmrDefs.h:48
double scalar_t
Level::umap_t umap_t
Definition: AmrBoundary.h:32
Level::scalar_t scalar_t
Definition: AmrBoundary.h:35
Level::lo_t lo_t
Definition: AmrBoundary.h:33
Level::go_t go_t
Definition: AmrBoundary.h:34
amr::AmrIntVect_t AmrIntVect_t
Definition: AmrBoundary.h:37
amr::AmrIntVect_t AmrIntVect_t
void apply(const AmrIntVect_t &iv, const lo_t &dir, umap_t &map, const scalar_t &value, Level *mglevel, const go_t *nr)
Level::scalar_t scalar_t