FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
marenv::wake::BlendedField< Snapshot, Traits > Class Template Reference

#include <BlendedField.h>

+ Inheritance diagram for marenv::wake::BlendedField< Snapshot, Traits >:
+ Collaboration diagram for marenv::wake::BlendedField< Snapshot, Traits >:

Public Types

using Value = typename Traits::Value
 

Public Member Functions

Status Sample (double t, const double pos[3], Value &out) const override
 
Traits::Parts SampleParts (double t, const double pos[3]) const override
 
bool MayReach (const WakeQueryRegion &region) const override
 
std::uint64_t Revision () const override
 The number of publishes (see WakeField::Revision()).
 
bool StaticFrom (double t) const override
 No blend at t or later and the published snapshot at rest (see WakeField::StaticFrom()).
 
void SampleMany (double t, std::span< const std::array< double, 3 > > positions, std::span< Value > out, std::span< Status > status) const override
 Sample() at every point, the published state loaded once (see WakeField::SampleMany()).
 
void Sketch (double t, FieldSketch &out) const override
 Appends the sketch of the snapshot blended to at t (see WakeField::Sketch()); nothing before the first publish.
 

Protected Types

using Blend = WakeBlend< Snapshot, Value, typename Traits::Sum, typename Traits::Samples >
 

Protected Member Functions

template<class Sampler >
Status SampleWith (double t, const double pos[3], const Sampler &sampler, Value &out) const
 
template<class Sampler >
Traits::Parts PartsWith (double t, const double pos[3], const Sampler &sampler) const
 SampleParts() with each snapshot sampled by sampler, as SampleWith().
 

Protected Attributes

Blend m_blend
 The published snapshots and the blend between them (single writer).
 

Detailed Description

template<class Snapshot, class Traits = WakeFieldTraits>
class marenv::wake::BlendedField< Snapshot, Traits >

A field that publishes immutable snapshots and blends them (CONTEXT.md, Blended field; contract C4).

It owns the WakeBlend of Snapshot and implements the virtuals of the field that only load the state once and forward to the snapshot: Sample(), SampleParts(), MayReach(), Revision(), StaticFrom(), SampleMany() and Sketch(). A derived class adds Publish() and the snapshot, and may sample the snapshot another way through SampleWith() and PartsWith() (SourceSetWake leaves point sources out by tag). Adding a virtual to WakeField (or JetField) means one declaration there and one body here.

Performance contract (MENV-0068, 76dbc01): one atomic Load() per query or batch, and no reference-count update per point.

Template Parameters
SnapshotAn immutable published state: BlendSnapshot of Traits::Value, with MayReach(), Sketch() and Stationary() (see WakeBlend).
TraitsWakeFieldTraits or JetFieldTraits.

Member Function Documentation

◆ MayReach()

template<class Snapshot , class Traits = WakeFieldTraits>
bool marenv::wake::BlendedField< Snapshot, Traits >::MayReach ( const WakeQueryRegion &  region) const
inlineoverride

Returns false only if the published state contributes nothing in the region (see WakeField::MayReach()).

The snapshot blended to counts from the publish instant on, the one blended from until the blend has ended by region.tBegin (WakeBlend::MayReach()). True before the first Publish().

◆ Sample()

template<class Snapshot , class Traits = WakeFieldTraits>
Status marenv::wake::BlendedField< Snapshot, Traits >::Sample ( double  t,
const double  pos[3],
Value &  out 
) const
inlineoverride

Returns the blended sample at pos (see WakeField::Sample()).

Returns
Status::OK where a published snapshot contributes; Status::ERROR_NOT_SET before the first Publish() and before the first blend has started, with the sample zero.

◆ SampleParts()

template<class Snapshot , class Traits = WakeFieldTraits>
Traits::Parts marenv::wake::BlendedField< Snapshot, Traits >::SampleParts ( double  t,
const double  pos[3] 
) const
inlineoverride

Returns the sample split into the parts the blend weighs (see WakeField::SampleParts(); owner ruling R136).

While the published state blends at t or later, the parts hold the samples of the snapshot blended to and of the snapshot blended from at (t, pos); otherwise Sample(t, pos).

◆ SampleWith()

template<class Snapshot , class Traits = WakeFieldTraits>
template<class Sampler >
Status marenv::wake::BlendedField< Snapshot, Traits >::SampleWith ( double  t,
const double  pos[3],
const Sampler &  sampler,
Value &  out 
) const
inlineprotected

Sample() with each snapshot sampled by sampler(snapshot, t, pos, value) instead of Snapshot::Sample (the state is loaded once).

Parameters
[in]samplerCallable as bool (const Snapshot&, double, const double*, Value&), with the meaning of Snapshot::Sample.

The documentation for this class was generated from the following file: