|
FhSim
3.1.0
Marine systems simulation
|
#include <VisualBakedScalarField.h>
Inheritance diagram for environmentmodels::VisualBakedScalarField:
Collaboration diagram for environmentmodels::VisualBakedScalarField:Public Member Functions | |
| void | FinalSetup (const double T, const double *const X, ISimObjectCreator *Creator) override |
| void | OdeFcn (const double T, const double *const X, double *const XDot) const override |
| No state; the ODE function is a no-op. | |
Protected Member Functions | |
| VisualBakedScalarField (std::string SimObjectName, ISimObjectCreator *Creator, int numAxes) | |
| ~VisualBakedScalarField () override | |
| Releases the cloned material and the baked textures. | |
| void | ResolveCounts (const double extent[3], std::size_t budget, int counts[3]) const |
| void | ValidateGridCounts (ISimObjectCreator *Creator, const int counts[3], const std::string &extentParameterName) const |
| bool | MaskInaccurate () const |
| environment::field::ScalarField & | Field () const |
Base class for visualisers that evaluate a scalar field once and let the GPU read it.
Owns everything the plane and the volume visualisers share: the XML parameters naming the field and its colour, visible and alpha ranges; the Spacing xor Resolution rule; resolving the field through the Environment Provider; deriving an encoding range, probing the field when the configuration states none; baking; uploading the bake; and cloning the material each instance writes its uniforms on.
The lifecycle split is deliberate and load-bearing. FinalSetup runs before RenderInit and is compiled in both builds, so every failure that does not need Ogre - a missing field, a time-dependent field without VisualiseAsConstant, an oversized grid - is detected in the constructor or in FinalSetup and is therefore reachable in the no-visualisation build.
|
protected |
Read the shared XML parameters.
| [in] | SimObjectName | Unique name for this simulation object. |
| [in] | Creator | Object creator/registry. |
| [in] | numAxes | Axes the derived visualiser samples: 2 for a plane, 3 for a volume. Decides the length of Spacing and Resolution. |
| std::runtime_error | when both Spacing and Resolution are configured, or when FieldName is missing. |
|
protected |
The resolved scalar field.
| std::runtime_error | when called before FinalSetup. |
|
override |
Resolve the Environment Provider and the scalar field.
| [in] | T | Simulation time [s]. |
| [in] | X | State vector. |
| [in] | Creator | Object creator/registry. |
| std::runtime_error | when the Environment resource is absent, when no field named FieldName is registered, or when the field is not time-invariant and VisualiseAsConstant was not set. |
|
inlineprotected |
Whether a cell the field flagged as inaccurate is masked.
ShowExtrapolated was set.
|
protected |
Turn the configured spacing or resolution into per-axis sample counts.
Uses Resolution when configured, Spacing when that is configured instead, and otherwise derives a spacing that lands near budget cells.
| [in] | extent | Edge length of each axis of the sampling box [m]. |
| [in] | budget | Target cell count used when neither parameter is configured. |
| [out] | counts | Resulting samples along each axis; each at least 1. |
|
protected |
Fail on a grid the render system could not hold.
| [in] | Creator | Object creator/registry, used to report the failing parameter. |
| [in] | counts | Samples along each axis. |
| [in] | extentParameterName | Parameter naming the size of the sampled region - BoxSize for a volume, Size for a plane. It is blamed only when neither Spacing nor Resolution is configured, because the grid is then derived from that extent and no grid parameter exists to blame. |
| std::runtime_error | when the grid exceeds util::kMaxBakeCells, or when an axis exceeds util::kMaxAxisSize2D for a two-axis visualiser or util::kMaxAxisSize3D for a three-axis one. |