|
FhSim
3.1.0
Marine systems simulation
|
#include <ParametricScalarField.h>
Inheritance diagram for marenv::field::ParametricScalarField:
Collaboration diagram for marenv::field::ParametricScalarField:Public Member Functions | |
| ParametricScalarField (std::string name, Quantity quantity, std::string unit, ParametricFieldSpec spec, std::shared_ptr< marenv::seafloor::BathymetryField > seafloor, std::vector< Property > properties={}) | |
| ~ParametricScalarField () override=default | |
| Default destructor. | |
| marenv::Status | GetValue (double time, const double position[3], double &value) const override |
| bool | IsTimeInvariant () const override |
| bool | IsThreadSafe () const override |
Public Member Functions inherited from marenv::field::ScalarField | |
| virtual | ~ScalarField ()=default |
| Virtual destructor. | |
| virtual void | GetValues (double time, std::span< const std::array< double, 3 > > positions, std::span< double > values, std::span< marenv::Status > statuses) const |
| const std::string & | Name () const |
| Quantity | GetQuantity () const |
| const std::string & | Unit () const |
| const std::vector< Property > & | Properties () const |
| bool | Has (const std::string &key) const |
| double | Get (const std::string &key, double fallback=0.0) const |
| const std::string & | Species () const |
| void | SetSpecies (std::string species) |
Additional Inherited Members | |
Protected Member Functions inherited from marenv::field::ScalarField | |
| ScalarField (std::string name, Quantity quantity, std::string unit, std::vector< Property > properties) | |
A scalar field built from an analytic background plus a sum of analytic features.
Fills the gap between ConstantScalarField, which is uniform, and DepthLayeredScalarField, which varies only with depth: a ParametricScalarField varies in all three dimensions and may optionally be referenced to the seafloor, which is what a demersal species distribution needs.
The value at a position is built up in a fixed order:
d is looked up once. With ZReference::Seafloor the working vertical coordinate becomes zEff = d - z, the height above the bottom, positive up; otherwise zEff = z, the NED depth. A bathymetry status that is not usable (marenv::IsUsable, e.g. ERROR_NOT_SET) is returned as it is, with the value 0 (ENV-0061).z > d, that is below the seabed, the value is 0 and the status is marenv::Status::OUT_OF_RANGE_INACCURATE.zEff.The field is analytic rather than gridded because the distributions it is meant for are static and synthetic. A sum of Gaussians expresses them exactly, is C-infinity so a derived echogram has no facet artefacts, and is reviewable as a short JSON document where a resampled grid would be a binary artefact of tens of megabytes.
centre[2] of 5 sits 5 m above the seabed, and a background profile entry at 0 is the seabed itself. This is the single easiest thing to misread in a configuration file. const OdeFcn and is evaluated at rejected integrator trial states. | marenv::field::ParametricScalarField::ParametricScalarField | ( | std::string | name, |
| Quantity | quantity, | ||
| std::string | unit, | ||
| ParametricFieldSpec | spec, | ||
| std::shared_ptr< marenv::seafloor::BathymetryField > | seafloor, | ||
| std::vector< Property > | properties = {} |
||
| ) |
Constructs a parametric scalar field from a validated specification.
| [in] | name | Unique field name. Must not be empty. |
| [in] | quantity | Advisory tag describing what the field measures. It also sets the default lower clamp limit. |
| [in] | unit | Unit of the field values, e.g. "degC". May be empty. |
| [in] | spec | The field configuration. |
| [in] | seafloor | Bathymetry used for seafloor-relative coordinates and for the below-seabed mask. Must not be null when either is in use. The XML builder passes the Environment's bathymetry, fixed at construction (by default flat at 200 m; Bathymetry.Model = "NetCDF" for a NetCDF seabed, R124); a bathymetry set later (EnvironmentProvider::SetBathymetry) is not seen. |
| [in] | properties | Static properties. Keys must be unique and non-empty. |
| std::invalid_argument | if name is empty, if a property key is empty or repeated, if a used sigma or a front width is not positive, if a depth profile background is malformed, or if the configuration needs a bathymetry field and seafloor is null. |
|
overridevirtual |
Returns the field value at a position, as described in the class documentation.
Returns the scalar value at a given position and time.
| [in] | time | Simulation time [s]. |
| [in] | position | Position in the NED frame [x, y, z] [m]. |
| [out] | value | The value at the given time and position. |
Implements marenv::field::ScalarField.
|
inlineoverridevirtual |
GetValue reads only the immutable specification, plus the bathymetry when one is configured.
Reimplemented from marenv::field::ScalarField.
|
inlineoverridevirtual |
The specification is fixed at construction, so the value ignores time.
Reimplemented from marenv::field::ScalarField.