/home/runner/work/kynema-sgf/kynema-sgf/src/core/ScratchField.H Source File

Kynema-SGF API: /home/runner/work/kynema-sgf/kynema-sgf/src/core/ScratchField.H Source File
Kynema-SGF API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
ScratchField.H
Go to the documentation of this file.
1#ifndef SCRATCHFIELD_H
2#define SCRATCHFIELD_H
3
4#include <string>
5#include <utility>
6
9#include "AMReX_MultiFab.H"
10#include "AMReX_Vector.H"
11#include "AMReX_PhysBCFunct.H"
12
13namespace kynema_sgf {
14
15class FieldRepo;
16
30{
31public:
32 friend class FieldRepo;
33
34 ScratchField(const ScratchField&) = delete;
36
38 [[nodiscard]] const std::string& name() const { return m_name; }
39
41 [[nodiscard]] int num_comp() const { return m_ncomp; }
42
44 [[nodiscard]] const amrex::IntVect& num_grow() const { return m_ngrow; }
45
47 [[nodiscard]] FieldLoc field_location() const { return m_floc; }
48
50 amrex::MultiFab& operator()(int lev) { return m_data[lev]; }
51 const amrex::MultiFab& operator()(int lev) const { return m_data[lev]; }
52
53 amrex::Vector<amrex::MultiFab*> vec_ptrs()
54 {
55 return amrex::GetVecOfPtrs(m_data);
56 }
57
58 [[nodiscard]] amrex::Vector<const amrex::MultiFab*> vec_const_ptrs() const
59 {
60 return amrex::GetVecOfConstPtrs(m_data);
61 }
62
64 [[nodiscard]] const FieldRepo& repo() const { return m_repo; }
65
68 ViewField<ScratchField> subview(const int scomp = 0, const int ncomp = 1)
69 {
70 return {*this, scomp, ncomp};
71 }
72
75 void fillpatch(amrex::Real time);
76 void fillpatch(amrex::Real time, const amrex::IntVect& ng);
77
78 void fillpatch(
79 int lev,
80 amrex::Real time,
81 amrex::MultiFab& mfab,
82 const amrex::IntVect& nghost);
83
84 void fillpatch(
85 int lev,
86 amrex::Real time,
87 amrex::MultiFab& mfab,
88 const amrex::IntVect& nghost,
89 amrex::Vector<amrex::BCRec>& bcrec);
90
91protected:
93 const FieldRepo& repo,
94 std::string name,
95 const int ncomp = 1,
96 const int ngrow = 1,
97 const FieldLoc floc = FieldLoc::CELL)
98 : m_repo(repo)
99 , m_name(std::move(name))
100 , m_ncomp(ncomp)
101 , m_ngrow(ngrow)
102 , m_floc(floc)
103 {}
104
106 std::string m_name;
108 amrex::IntVect m_ngrow;
110
111 amrex::Vector<amrex::MultiFab> m_data;
112};
113
114} // namespace kynema_sgf
115
116#endif /* SCRATCHFIELD_H */
Definition FieldRepo.H:86
amrex::IntVect m_ngrow
Definition ScratchField.H:108
void fillpatch(amrex::Real time)
Fill ghosts, using additional coarse levels when two-level nesting cannot guarantee all interpolation...
Definition ScratchField.cpp:50
FieldLoc m_floc
Definition ScratchField.H:109
std::string m_name
Definition ScratchField.H:106
amrex::Vector< amrex::MultiFab * > vec_ptrs()
Definition ScratchField.H:53
FieldLoc field_location() const
Cell, node, face where the field is stored.
Definition ScratchField.H:47
const std::string & name() const
Name if available for this scratch field.
Definition ScratchField.H:38
int num_comp() const
Number of components for this field.
Definition ScratchField.H:41
int m_ncomp
Definition ScratchField.H:107
ScratchField & operator=(const ScratchField &)=delete
const FieldRepo & m_repo
Definition ScratchField.H:105
friend class FieldRepo
Definition ScratchField.H:32
ViewField< ScratchField > subview(const int scomp=0, const int ncomp=1)
Definition ScratchField.H:68
ScratchField(const FieldRepo &repo, std::string name, const int ncomp=1, const int ngrow=1, const FieldLoc floc=FieldLoc::CELL)
Definition ScratchField.H:92
const FieldRepo & repo() const
Return a reference to the field repository that created this field.
Definition ScratchField.H:64
amrex::MultiFab & operator()(int lev)
Return the field data for a given level.
Definition ScratchField.H:50
const amrex::MultiFab & operator()(int lev) const
Definition ScratchField.H:51
amrex::Vector< const amrex::MultiFab * > vec_const_ptrs() const
Definition ScratchField.H:58
amrex::Vector< amrex::MultiFab > m_data
Definition ScratchField.H:111
const amrex::IntVect & num_grow() const
Ghost cells.
Definition ScratchField.H:44
ScratchField(const ScratchField &)=delete
Definition ViewField.H:24
FieldLoc
Definition FieldDescTypes.H:29
@ CELL
Cell-centered (default)
Definition FieldDescTypes.H:30
This test case is intended as an evaluation of the momentum advection scheme.
Definition BCInterface.cpp:12