/home/runner/work/amr-wind/amr-wind/amr-wind/overset/overset_types.H Source File

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/overset/overset_types.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
overset_types.H
Go to the documentation of this file.
1#ifndef OVERSET_TYPES_H
2#define OVERSET_TYPES_H
3
4#include "AMReX_Gpu.H"
5
7
10template <typename T>
12{
13 using ArrayType = amrex::Gpu::DeviceVector<T>;
14 using HostArrayType = amrex::Vector<T>;
15
18
21
23
25 explicit AmrDualArray(const size_t len) : d_view(len), h_view(len) {}
26
28 void resize(const size_t len)
29 {
30 d_view.resize(len);
31 h_view.resize(len);
32 }
33
35 size_t size() const { return d_view.size(); }
36
39 {
40 amrex::Gpu::copy(
41 amrex::Gpu::hostToDevice, h_view.begin(), h_view.end(),
42 d_view.begin());
43 }
44
47 {
48 amrex::Gpu::copy(
49 amrex::Gpu::deviceToHost, d_view.begin(), d_view.end(),
50 h_view.begin());
51 }
52};
53
54} // namespace amr_wind::tioga_iface
55
56#endif /* OVERSET_TYPES_H */
Definition overset_types.H:6
Definition overset_types.H:12
amrex::Vector< T > HostArrayType
Definition overset_types.H:14
void copy_to_host()
Copy data from device to host.
Definition overset_types.H:46
void resize(const size_t len)
Resize arrays on host and device.
Definition overset_types.H:28
ArrayType d_view
Data on device.
Definition overset_types.H:17
HostArrayType h_view
Data on host.
Definition overset_types.H:20
AmrDualArray(const size_t len)
Construct arrays on host/device with a given length.
Definition overset_types.H:25
void copy_to_device()
Copy data from host to device.
Definition overset_types.H:38
size_t size() const
Return the size of the arrays.
Definition overset_types.H:35
AmrDualArray()
Definition overset_types.H:22
amrex::Gpu::DeviceVector< T > ArrayType
Definition overset_types.H:13