OPAL (Object Oriented Parallel Accelerator Library) 2024.2
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 virtual ~AmrBoundary() = default;
47
53 bool isBoundary(const AmrIntVect_t& iv, const go_t* nr) const {
54 return AMREX_D_TERM( isBoundary(iv, 0, nr),
55 || isBoundary(iv, 1, nr),
56 || isBoundary(iv, 2, nr));
57 }
58
64 bool isBoundary(const AmrIntVect_t& iv,
65 const lo_t& dir,
66 const go_t* nr) const {
67 return ( iv[dir] < 0 || iv[dir] >= nr[0] );
68 }
69
79 virtual void apply(const AmrIntVect_t& iv,
80 const lo_t& dir,
81 umap_t& map,
82 const scalar_t& value,
83 Level* mglevel,
84 const go_t* nr) = 0;
85
89 const go_t& getNumberOfPoints() const {
90 return nPoints_m;
91 }
92
93private:
95};
96
97#endif
const int nr
amrex::IntVect AmrIntVect_t
Definition AmrDefs.h:48
const go_t & getNumberOfPoints() const
Definition AmrBoundary.h:89
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:64
Level::lo_t lo_t
Definition AmrBoundary.h:33
bool isBoundary(const AmrIntVect_t &iv, const go_t *nr) const
Definition AmrBoundary.h:53
Level::basefab_t basefab_t
Definition AmrBoundary.h:36
const go_t nPoints_m
Number of points used for boundary.
Definition AmrBoundary.h:94
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
virtual ~AmrBoundary()=default
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