Tsunami Project Lab
Loading...
Searching...
No Matches
tsunami_lab::io::NetCdf::Grid Struct Reference

#include <NetCdf.h>

Public Member Functions

bool inBounds (t_real i_x, t_real i_y) const
 
t_real sampleNearest (t_real i_x, t_real i_y) const
 

Public Attributes

t_idx nx = 0
 number of x-coordinates
 
t_idx ny = 0
 number of y-coordinates
 
std::vector< t_realx
 monotonically ascending x (size nx)
 
std::vector< t_realy
 monotonically ascending y (size ny)
 
std::vector< t_realz
 2d field in (y, x) order (size nx * ny)
 

Detailed Description

Regular 2d grid loaded from a netCDF input file: monotonically increasing coordinates x and y plus a 2d field z stored in row-major (y, x) order, i.e. z[iy * nx + ix]. Used for the bathymetry and earthquake-displacement inputs of TsunamiEvent2d.

Member Function Documentation

◆ inBounds()

bool tsunami_lab::io::NetCdf::Grid::inBounds ( t_real i_x,
t_real i_y ) const
inline

True if the query point lies inside the inclusive bounding box spanned by the cell-centre coordinates. Callers that want "zero outside" semantics (e.g. earthquake displacement that only covers part of the simulation domain) check this first.

◆ sampleNearest()

tsunami_lab::t_real tsunami_lab::io::NetCdf::Grid::sampleNearest ( t_real i_x,
t_real i_y ) const

Nearest-neighbor sample at (i_x, i_y). Always returns the value at the closest grid cell — clamps to the boundary when (i_x, i_y) lies outside the bbox, so callers wanting strict out-of-bbox handling must guard with inBounds().

Assumes the grid is uniformly spaced (the regular-grid assumption from the spec); the index is computed in O(1) from the spacing of the coordinate variables.

Member Data Documentation

◆ nx

t_idx tsunami_lab::io::NetCdf::Grid::nx = 0

number of x-coordinates

◆ ny

t_idx tsunami_lab::io::NetCdf::Grid::ny = 0

number of y-coordinates

◆ x

std::vector<t_real> tsunami_lab::io::NetCdf::Grid::x

monotonically ascending x (size nx)

◆ y

std::vector<t_real> tsunami_lab::io::NetCdf::Grid::y

monotonically ascending y (size ny)

◆ z

std::vector<t_real> tsunami_lab::io::NetCdf::Grid::z

2d field in (y, x) order (size nx * ny)


The documentation for this struct was generated from the following files: