OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
AmrBoundary.h
Go to the documentation of this file.
1//
2// Class AmrBoundary
3// Interface for mesh boundary conditions.
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_BOUNDARY_H
22#define AMR_BOUNDARY_H
23
24#include <vector>
25
26#include "Amr/AmrDefs.h"
27
28template <class Level>
30
31public:
32 typedef typename Level::umap_t umap_t;
33 typedef typename Level::lo_t lo_t;
34 typedef typename Level::go_t go_t;
35 typedef typename Level::scalar_t scalar_t;
36 typedef typename Level::basefab_t basefab_t;
38
39public:
40
44 AmrBoundary(go_t nPoints) : nPoints_m(nPoints) { };
45
46
52 bool isBoundary(const AmrIntVect_t& iv, const go_t* nr) const {
53 return AMREX_D_TERM( isBoundary(iv, 0, nr),
54 || isBoundary(iv, 1, nr),
55 || isBoundary(iv, 2, nr));
56 }
57
63 bool isBoundary(const AmrIntVect_t& iv,
64 const lo_t& dir,
65 const go_t* nr) const {
66 return ( iv[dir] < 0 || iv[dir] >= nr[0] );
67 }
68
78 virtual void apply(const AmrIntVect_t& iv,
79 const lo_t& dir,
80 umap_t& map,
81 const scalar_t& value,
82 Level* mglevel,
83 const go_t* nr) = 0;
84
88 const go_t& getNumberOfPoints() const {
89 return nPoints_m;
90 }
91
92private:
94};
95
96#endif
const int nr
Definition: ClassicRandom.h:24
amrex::IntVect AmrIntVect_t
Definition: AmrDefs.h:48
double scalar_t
const go_t & getNumberOfPoints() const
Definition: AmrBoundary.h:88
Level::umap_t umap_t
Definition: AmrBoundary.h:32
Level::scalar_t scalar_t
Definition: AmrBoundary.h:35
bool isBoundary(const AmrIntVect_t &iv, const lo_t &dir, const go_t *nr) const
Definition: AmrBoundary.h:63
Level::lo_t lo_t
Definition: AmrBoundary.h:33
bool isBoundary(const AmrIntVect_t &iv, const go_t *nr) const
Definition: AmrBoundary.h:52
Level::basefab_t basefab_t
Definition: AmrBoundary.h:36
const go_t nPoints_m
Number of points used for boundary.
Definition: AmrBoundary.h:93
virtual void apply(const AmrIntVect_t &iv, const lo_t &dir, umap_t &map, const scalar_t &value, Level *mglevel, const go_t *nr)=0
Level::go_t go_t
Definition: AmrBoundary.h:34
AmrBoundary(go_t nPoints)
Definition: AmrBoundary.h:44
amr::AmrIntVect_t AmrIntVect_t
Definition: AmrBoundary.h:37