#include <ERF_LatLonMap.H>
|
| | LatLonMap (const amrex::MultiFab &lat, const amrex::MultiFab &lon, const amrex::BoxArray &ba2d, const amrex::DistributionMapping &dm, const amrex::Geometry &geom0) |
| |
| LatLonStatus | locate (amrex::Real req_lat, amrex::Real req_lon, LatLonLocation &loc) const |
| |
| LatLonLocation | locate_or_abort (amrex::Real req_lat, amrex::Real req_lon, const std::string &what) const |
| |
| void | rotation_at (amrex::Real x, amrex::Real y, amrex::Real &cos_alpha, amrex::Real &sin_alpha) const |
| |
|
| amrex::MultiFab | m_ll |
| |
| amrex::Box | m_dom |
| |
| amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > | m_problo |
| |
| amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > | m_dx |
| |
◆ LatLonMap()
| LatLonMap::LatLonMap |
( |
const amrex::MultiFab & |
lat, |
|
|
const amrex::MultiFab & |
lon, |
|
|
const amrex::BoxArray & |
ba2d, |
|
|
const amrex::DistributionMapping & |
dm, |
|
|
const amrex::Geometry & |
geom0 |
|
) |
| |
181 m_dx(geom0.CellSizeArray())
183 m_dom = geom0.Domain();
193 MultiFab latlon(ba2d, dm, 2, 0);
196 BoxArray ba_one(
m_dom);
197 Vector<int> pmap(1, ParallelDescriptor::IOProcessorNumber());
198 DistributionMapping dm_one(pmap);
199 m_ll.define(ba_one, dm_one, 2, 0, MFInfo().SetArena(The_Pinned_Arena()));
200 m_ll.ParallelCopy(latlon, 0, 0, 2);
203 Gpu::streamSynchronize();
void pack_latlon(MultiFab &latlon, const MultiFab &lat, const MultiFab &lon)
Definition: ERF_LatLonMap.cpp:47
amrex::Box m_dom
Definition: ERF_LatLonMap.H:174
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > m_dx
Definition: ERF_LatLonMap.H:176
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > m_problo
Definition: ERF_LatLonMap.H:175
amrex::MultiFab m_ll
Definition: ERF_LatLonMap.H:173
◆ locate()
209 Real out[9] = {Real(0.0), Real(0.0), Real(0.0), Real(0.0), Real(0.0),
210 Real(0.0), Real(0.0), Real(0.0), Real(0.0)};
212 if (ParallelDescriptor::IOProcessor()) {
215 req_lat, req_lon, l);
216 out[0] = l.
x; out[1] = l.
y;
217 out[2] = l.
lat; out[3] = l.
lon;
220 out[8] =
static_cast<Real
>(
static_cast<int>(status));
223 ParallelDescriptor::Bcast(out, 9, ParallelDescriptor::IOProcessorNumber());
225 loc.
x = out[0]; loc.
y = out[1];
226 loc.
lat = out[2]; loc.
lon = out[3];
229 return static_cast<LatLonStatus>(
static_cast<int>(std::lround(out[8])));
LatLonStatus
Definition: ERF_LatLonMap.H:106
LatLonStatus locate_latlon_on_grid(const Array4< const Real > &ll, const Box &dom, const GpuArray< Real, AMREX_SPACEDIM > &problo, const GpuArray< Real, AMREX_SPACEDIM > &dx, Real req_lat, Real req_lon, LatLonLocation &loc)
Definition: ERF_LatLonMap.cpp:113
Definition: ERF_LatLonMap.H:87
amrex::Real cos_alpha
Definition: ERF_LatLonMap.H:102
amrex::Real lat
Definition: ERF_LatLonMap.H:94
amrex::Real x
Definition: ERF_LatLonMap.H:89
amrex::Real near_lat
Definition: ERF_LatLonMap.H:98
amrex::Real y
Definition: ERF_LatLonMap.H:90
amrex::Real sin_alpha
Definition: ERF_LatLonMap.H:103
amrex::Real near_lon
Definition: ERF_LatLonMap.H:99
amrex::Real lon
Definition: ERF_LatLonMap.H:95
Referenced by locate_or_abort(), ObsNudging::resolve_positions(), and ERF::resolve_station_positions().
◆ locate_or_abort()
| LatLonLocation LatLonMap::locate_or_abort |
( |
amrex::Real |
req_lat, |
|
|
amrex::Real |
req_lon, |
|
|
const std::string & |
what |
|
) |
| const |
237 const std::string at = what +
" at lat=" + std::to_string(req_lat) +
238 " long=" + std::to_string(req_lon);
240 Abort(at +
": the latitude/longitude arrays are degenerate near it, so it cannot be inverted");
246 Abort(at +
" is outside the domain (the nearest grid point is at lat=" +
247 std::to_string(loc.
near_lat) +
" long=" + std::to_string(loc.
near_lon) +
")");
LatLonStatus locate(amrex::Real req_lat, amrex::Real req_lon, LatLonLocation &loc) const
Definition: ERF_LatLonMap.cpp:207
Referenced by ERF::InitData_post(), and LineSampler::resolve_latlon().
◆ rotation_at()
| void LatLonMap::rotation_at |
( |
amrex::Real |
x, |
|
|
amrex::Real |
y, |
|
|
amrex::Real & |
cos_alpha, |
|
|
amrex::Real & |
sin_alpha |
|
) |
| const |
255 Real out[2] = {Real(1.0), Real(0.0)};
257 if (ParallelDescriptor::IOProcessor()) {
258 const int i = std::clamp(
static_cast<int>(std::floor((
x -
m_problo[0]) /
m_dx[0])),
260 const int j = std::clamp(
static_cast<int>(std::floor((
y -
m_problo[1]) /
m_dx[1])),
265 ParallelDescriptor::Bcast(out, 2, ParallelDescriptor::IOProcessorNumber());
void grid_rotation_from_latlon(const Array4< const Real > &ll, const Box &dom, int i, int j, Real &cos_alpha, Real &sin_alpha)
Definition: ERF_LatLonMap.cpp:63
Referenced by ObsNudging::resolve_positions(), and ERF::resolve_station_positions().
◆ m_dom
| amrex::Box LatLonMap::m_dom |
|
private |
◆ m_dx
| amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> LatLonMap::m_dx |
|
private |
◆ m_ll
| amrex::MultiFab LatLonMap::m_ll |
|
private |
◆ m_problo
| amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> LatLonMap::m_problo |
|
private |
The documentation for this class was generated from the following files: