/home/runner/work/amr-wind/amr-wind/amr-wind/utilities/MultiLevelVector.H Source File

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/utilities/MultiLevelVector.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
MultiLevelVector.H
Go to the documentation of this file.
1#ifndef MULTILEVELVECTOR_H
2#define MULTILEVELVECTOR_H
3
4#include "AMReX_Geometry.H"
5#include "AMReX_Vector.H"
6#include "AMReX_GpuContainers.H"
7#include "AMReX_MFParallelFor.H"
11
12namespace amr_wind {
13
23{
24public:
26
27 void resize(const int axis, const amrex::Vector<amrex::Geometry>& geom);
28
29 const amrex::Vector<amrex::Real>& host_data(const int lev) const
30 {
31 return m_data_h[lev];
32 };
33
34 amrex::Vector<amrex::Real>& host_data(const int lev)
35 {
36 return m_data_h[lev];
37 };
38
39 const amrex::Gpu::DeviceVector<amrex::Real>&
40 device_data(const int lev) const
41 {
42 return m_data_d[lev];
43 };
44
46
47 void copy_to_field(Field& fld);
48
49 int size() const { return static_cast<int>(m_data_h.size()); }
50
51 int ncells(const int lev) const
52 {
53 return static_cast<int>(m_data_h[lev].size());
54 }
55
56private:
58 int m_axis{2};
59 amrex::Vector<amrex::Gpu::DeviceVector<amrex::Real>> m_data_d;
60 amrex::Vector<amrex::Vector<amrex::Real>> m_data_h;
61};
62} // namespace amr_wind
63#endif
Definition Field.H:116
Definition MultiLevelVector.H:23
int ncells(const int lev) const
Definition MultiLevelVector.H:51
void copy_to_field(Field &fld)
Definition MultiLevelVector.cpp:32
amrex::Vector< amrex::Gpu::DeviceVector< amrex::Real > > m_data_d
Definition MultiLevelVector.H:59
int size() const
Definition MultiLevelVector.H:49
int m_axis
Definition MultiLevelVector.H:58
amrex::Vector< amrex::Real > & host_data(const int lev)
Definition MultiLevelVector.H:34
const amrex::Vector< amrex::Real > & host_data(const int lev) const
Definition MultiLevelVector.H:29
void resize(const int axis, const amrex::Vector< amrex::Geometry > &geom)
Definition MultiLevelVector.cpp:5
void copy_host_to_device()
Definition MultiLevelVector.cpp:23
MultiLevelVector(const FieldLoc floc=FieldLoc::CELL)
Definition MultiLevelVector.H:25
const FieldLoc m_floc
Definition MultiLevelVector.H:57
const amrex::Gpu::DeviceVector< amrex::Real > & device_data(const int lev) const
Definition MultiLevelVector.H:40
amrex::Vector< amrex::Vector< amrex::Real > > m_data_h
Definition MultiLevelVector.H:60
FieldLoc
Definition FieldDescTypes.H:27
@ CELL
Cell-centered (default)
Definition BCInterface.cpp:7