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

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/core/ViewField.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
ViewField.H
Go to the documentation of this file.
1#ifndef VIEWFIELD_H
2#define VIEWFIELD_H
3
4#include <string>
5
7#include "AMReX_MultiFab.H"
8#include "AMReX_Vector.H"
9
10namespace amr_wind {
11
12class FieldRepo;
13
22template <typename T>
24{
25public:
26 friend T;
27
28 ViewField(const ViewField&) = delete;
29 ViewField& operator=(const ViewField&) = delete;
30
31 ViewField(ViewField&&) = default;
33
34 inline std::string name() const { return m_src.name() + "view"; }
35
37 inline int num_comp() const { return m_ncomp; }
38
39 inline const amrex::IntVect& num_grow() const { return m_src.num_grow(); }
40
41 inline FieldLoc field_location() const { return m_src.field_location(); }
42
44 amrex::MultiFab& operator()(int lev) { return m_data[lev]; }
45 const amrex::MultiFab& operator()(int lev) const { return m_data[lev]; }
46
47 amrex::Vector<amrex::MultiFab*> vec_ptrs() noexcept
48 {
49 return amrex::GetVecOfPtrs(m_data);
50 }
51
52 amrex::Vector<const amrex::MultiFab*> vec_const_ptrs() const noexcept
53 {
54 return amrex::GetVecOfConstPtrs(m_data);
55 }
56
58 const FieldRepo& repo() const { return m_src.repo(); }
59
61 T& source_field() { return m_src; }
62 const T& source_field() const { return m_src; }
63
64private:
65 // cppcheck-suppress noExplicitConstructor
66 ViewField(T& src, const int scomp = 0, const int ncomp = 1);
67
70
73
76
78 amrex::Vector<amrex::MultiFab> m_data;
79};
80
81} // namespace amr_wind
82
83#endif /* VIEWFIELD_H */
Definition FieldRepo.H:86
Definition ViewField.H:24
ViewField(ViewField &&)=default
int m_scomp
Index of the starting component.
Definition ViewField.H:72
amrex::MultiFab & operator()(int lev)
Return the field data for a given level.
Definition ViewField.H:44
amrex::Vector< amrex::MultiFab * > vec_ptrs() noexcept
Definition ViewField.H:47
amrex::Vector< amrex::MultiFab > m_data
MultiFabs holding the alias views.
Definition ViewField.H:78
T & source_field()
Return a reference to the source field from which this view is derived.
Definition ViewField.H:61
int m_ncomp
Number of sub-components in this view.
Definition ViewField.H:75
int num_comp() const
Number of components in this subview.
Definition ViewField.H:37
const amrex::MultiFab & operator()(int lev) const
Definition ViewField.H:45
ViewField(const ViewField &)=delete
friend T
Definition ViewField.H:26
const T & source_field() const
Definition ViewField.H:62
std::string name() const
Definition ViewField.H:34
ViewField & operator=(ViewField &&)=default
ViewField & operator=(const ViewField &)=delete
T & m_src
The base field.
Definition ViewField.H:69
amrex::Vector< const amrex::MultiFab * > vec_const_ptrs() const noexcept
Definition ViewField.H:52
const FieldRepo & repo() const
Return a reference to the field repository that created this field.
Definition ViewField.H:58
FieldLoc field_location() const
Definition ViewField.H:41
const amrex::IntVect & num_grow() const
Definition ViewField.H:39
FieldLoc
Definition FieldDescTypes.H:27
Definition BCInterface.cpp:7