/home/runner/work/amr-wind/amr-wind/amr-wind/core/IntScratchField.H Source File

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/core/IntScratchField.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
IntScratchField.H
Go to the documentation of this file.
1#ifndef INTSCRATCHFIELD_H
2#define INTSCRATCHFIELD_H
3
4#include <string>
5#include <utility>
6
9#include "AMReX_iMultiFab.H"
10#include "AMReX_Vector.H"
11#include "AMReX_PhysBCFunct.H"
12
13namespace amr_wind {
14
15class FieldRepo;
16
20{
21public:
22 friend class FieldRepo;
23
26
28 inline const std::string& name() const { return m_name; }
29
31 inline int num_comp() const { return m_ncomp; }
32
34 inline const amrex::IntVect& num_grow() const { return m_ngrow; }
35
37 inline FieldLoc field_location() const { return m_floc; }
38
40 amrex::iMultiFab& operator()(int lev) { return m_data[lev]; }
41 const amrex::iMultiFab& operator()(int lev) const { return m_data[lev]; }
42
43 amrex::Vector<amrex::iMultiFab*> vec_ptrs() noexcept
44 {
45 return amrex::GetVecOfPtrs(m_data);
46 }
47
48 amrex::Vector<const amrex::iMultiFab*> vec_const_ptrs() const noexcept
49 {
50 return amrex::GetVecOfConstPtrs(m_data);
51 }
52
54 const FieldRepo& repo() const { return m_repo; }
55
56 void setVal(int value) noexcept;
57
58protected:
60 const FieldRepo& repo,
61 std::string name,
62 const int ncomp = 1,
63 const int ngrow = 1,
64 const FieldLoc floc = FieldLoc::CELL)
65 : m_repo(repo)
66 , m_name(std::move(name))
67 , m_ncomp(ncomp)
68 , m_ngrow(ngrow)
69 , m_floc(floc)
70 {}
71
73 std::string m_name;
75 amrex::IntVect m_ngrow;
77
78 amrex::Vector<amrex::iMultiFab> m_data;
79};
80
81} // namespace amr_wind
82
83#endif /* INTSCRATCHFIELD_H */
Definition FieldRepo.H:86
Definition IntScratchField.H:20
int m_ncomp
Definition IntScratchField.H:74
amrex::Vector< amrex::iMultiFab > m_data
Definition IntScratchField.H:78
amrex::iMultiFab & operator()(int lev)
Return the field data for a given level.
Definition IntScratchField.H:40
void setVal(int value) noexcept
Definition IntScratchField.cpp:13
FieldLoc field_location() const
Cell, node, face where the field is stored.
Definition IntScratchField.H:37
FieldLoc m_floc
Definition IntScratchField.H:76
amrex::Vector< const amrex::iMultiFab * > vec_const_ptrs() const noexcept
Definition IntScratchField.H:48
const amrex::IntVect & num_grow() const
Ghost cells.
Definition IntScratchField.H:34
int num_comp() const
Number of components for this field.
Definition IntScratchField.H:31
std::string m_name
Definition IntScratchField.H:73
const FieldRepo & repo() const
Return a reference to the field repository that created this field.
Definition IntScratchField.H:54
IntScratchField(const FieldRepo &repo, std::string name, const int ncomp=1, const int ngrow=1, const FieldLoc floc=FieldLoc::CELL)
Definition IntScratchField.H:59
amrex::Vector< amrex::iMultiFab * > vec_ptrs() noexcept
Definition IntScratchField.H:43
const std::string & name() const
Name if available for this scratch field.
Definition IntScratchField.H:28
amrex::IntVect m_ngrow
Definition IntScratchField.H:75
const FieldRepo & m_repo
Definition IntScratchField.H:72
IntScratchField & operator=(const IntScratchField &)=delete
const amrex::iMultiFab & operator()(int lev) const
Definition IntScratchField.H:41
IntScratchField(const IntScratchField &)=delete
FieldLoc
Definition FieldDescTypes.H:27
@ CELL
Cell-centered (default)
Definition BCInterface.cpp:7