|
FhSim
3.1.0
Marine systems simulation
|
#include <FieldState.h>
Collaboration diagram for environment::field::AggregationField::State:Public Member Functions | |
| std::size_t | Size () const |
| The number of aggregations. | |
| std::size_t | SlotCount () const |
| The number of slots (aggregations and holes). | |
| bool | IsLive (std::size_t slot) const |
| True when the slot holds an aggregation. | |
| AggregationId | NextId () const |
| The id the next add gets. | |
| aggregation::Bump | Load (std::size_t i) const |
| template<class Visitor > | |
| void | ForEachCandidate (const aggregation::Box &query, Visitor &&visit) const |
Calls visit(slot) once for each aggregation whose support box overlaps the query box. | |
| void | Candidates (const aggregation::Box &query, std::vector< std::uint32_t > &out) const |
The slots of ForEachCandidate in out (cleared first). | |
| std::vector< double > | SlotMassInBox (const OrientedBox &box) const |
| The mass [kg] of each slot inside an oriented box (0 for a hole); see MassPerAggregationInBox. | |
| void | WriteSlot (std::size_t slot, const Aggregation &aggregation) |
| double | LiveMass () const |
| The sum of the masses of the live slots, in slot order. | |
| std::optional< std::size_t > | SlotOf (AggregationId id) const |
| The slot of a live id, or none. | |
| AggregationId | IdOf (std::size_t slot) const |
| The id of a slot. | |
| std::vector< aggregation::TiledGrid::Item > | AllItems () const |
| The grid items of every live slot. | |
| aggregation::TiledGrid | FirstGrid (const std::optional< AggregationGridBounds > &bounds) const |
| The empty grid of a first change: over the bounds, or over the support boxes; none when neither exists. | |
| std::shared_ptr< State > | CopyWithRoom (std::size_t extra) const |
A copy with room for extra more slots, so appending them does not copy the arrays again. Copies every member. | |
| std::shared_ptr< State > | Compacted () const |
| A keyed state without holes, with the same origin and grid geometry. | |
Public Attributes | |
| std::array< double, 3 > | origin {0.0, 0.0, 0.0} |
| Positions below are relative to this point. | |
| std::vector< float > | x |
| std::vector< float > | y |
| std::vector< float > | z |
| std::vector< float > | a |
| std::vector< float > | b |
| std::vector< float > | c |
| std::vector< float > | cosPhi |
| std::vector< float > | sinPhi |
| std::vector< float > | amp |
| std::vector< aggregation::Box > | boxes |
| std::vector< Aggregation > | shapes |
| The aggregations as given, in double precision. | |
| std::vector< std::array< double, 2 > > | patchCentres |
| Thomas process patch centres of the last Initialise; may be empty. | |
| std::vector< std::size_t > | patchIndices |
| Per aggregation; empty when patchCentres is. | |
| aggregation::HashGrid | grid |
| double | totalMass = 0.0 |
| bool | keyed = false |
| aggregation::TiledGrid | tiled |
| The index of a keyed state; no extent until a change leaves a box or gives bounds. | |
| std::vector< AggregationId > | ids |
| Per slot, rising. | |
| std::vector< std::uint8_t > | live |
| Per slot; 0 for a hole. | |
| std::size_t | liveCount = 0 |
| AggregationId | nextId = 0 |
| The id of the next add. | |
The immutable snapshot: bump constants as a structure of arrays, bounding boxes and the index.
The arrays have one entry per slot. A state from SetAggregations (not keyed) has slot = index = id and the HashGrid. A keyed state (ApplyChanges, ADR 0005 D20) has the TiledGrid, an id per slot (rising) and slots that are holes (removed; not in the grid).
| void environment::field::AggregationField::State::WriteSlot | ( | std::size_t | slot, |
| const Aggregation & | aggregation | ||
| ) |
Writes the float constants, the support box and the shape of a slot, as SetAggregations computes them. A slot equal to SlotCount() is appended.