FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
SourceSetWake.h
1#pragma once
3
4#include <marenv/marenv.h>
5#include <marenv/wake/BlendedField.h>
6#include <marenv/wake/Kernel.h>
7#include <marenv/wake/LineKernel.h>
8#include <marenv/wake/WakeBlend.h>
9#include <marenv/wake/WakeField.h>
10#include <marenv/wake/WakeTypes.h>
11
12#include <memory>
13#include <span>
14#include <vector>
15
16namespace marenv::wake
17{
18namespace detail
19{
24{
25 std::vector<ElementarySource> sources;
26 double velocity[3];
28 double t0;
30 std::vector<KernelProfile> profiles;
31 std::vector<LineKernelProfile> lineProfiles;
32 std::vector<LineSource> lines;
33
35 bool Sample(double t, const double pos[3], WakeSample& out) const { return SampleExcluding(t, pos, {}, out); }
36
38 bool SampleExcluding(double t, const double pos[3], std::span<const int> excludedTags, WakeSample& out) const;
39
41 bool MayReach(const WakeQueryRegion& region) const;
42
44 void Sketch(double t, FieldSketch& out) const;
45
47 bool Stationary() const { return velocity[0] == 0.0 && velocity[1] == 0.0 && velocity[2] == 0.0; }
48};
49} // namespace detail
50
110class SourceSetWake : public BlendedField<detail::SourceSetSnapshot>
111{
112public:
114 SourceSetWake() = default;
115
118 explicit SourceSetWake(const KernelParams& params);
119
120 ~SourceSetWake() override = default;
121
142 void Publish(SourceSet sources, const double velocity[3], double t0, double blendTime, double seabedDepth);
143
151 Status SampleExcluding(double t, const double pos[3], std::span<const int> excludedTags, WakeSample& out) const override;
152
154 WakeSampleParts SamplePartsExcluding(double t, const double pos[3], std::span<const int> excludedTags) const override;
155
156private:
158
160 static std::shared_ptr<const Snapshot> MakeSnapshot(SourceSet sources, const double velocity[3], const KernelParams& params, double t0);
161
162 KernelParams m_params;
163};
164} // namespace marenv::wake
Definition BlendedField.h:104
Definition SourceSetWake.h:111
Status SampleExcluding(double t, const double pos[3], std::span< const int > excludedTags, WakeSample &out) const override
WakeSampleParts SamplePartsExcluding(double t, const double pos[3], std::span< const int > excludedTags) const override
SampleParts() with the sources of the given tags left out in every snapshot, as SampleExcluding() (EN...
SourceSetWake(const KernelParams &params)
void Publish(SourceSet sources, const double velocity[3], double t0, double blendTime, double seabedDepth)
SourceSetWake()=default
A field whose sources compose with the default KernelParams.
Status
Definition marenv.h:40
Definition FieldSketch.h:16
Definition Kernel.h:131
Definition WakeTypes.h:102
Definition WakeTypes.h:118
Definition WakeField.h:23
Definition WakeSampleParts.h:111
Definition WakeTypes.h:21
Definition SourceSetWake.h:24
ImageSet images
The images of the sources, from params (R53, R98).
Definition SourceSetWake.h:29
bool Sample(double t, const double pos[3], WakeSample &out) const
Composed deficit and source velocity at pos; always true, a source set has no extent (WakeBlendSnapsh...
Definition SourceSetWake.h:35
double t0
Time at which the sources are at their given positions, s.
Definition SourceSetWake.h:28
bool MayReach(const WakeQueryRegion &region) const
MayReach() of the snapshot: false only if its deficit is 0 (cutoff 0) or below the cutoff everywhere ...
std::vector< ElementarySource > sources
The point sources at t0, with unit flowDir.
Definition SourceSetWake.h:25
std::vector< LineSource > lines
The line sources as published, for Sketch().
Definition SourceSetWake.h:32
KernelParams params
Kernel parameters, with the publish's seabed depth.
Definition SourceSetWake.h:27
bool SampleExcluding(double t, const double pos[3], std::span< const int > excludedTags, WakeSample &out) const
Sample() with the point sources of the given tags left out (ENV-0107); always true.
double velocity[3]
Velocity of the sources and source velocity u_s, m/s, NED.
Definition SourceSetWake.h:26
std::vector< KernelProfile > profiles
One profile per point source, same index, built once at Publish (MENV-0036).
Definition SourceSetWake.h:30
std::vector< LineKernelProfile > lineProfiles
One profile per line source, built once at Publish (MENV-0044).
Definition SourceSetWake.h:31
void Sketch(double t, FieldSketch &out) const
Appends the point and line sources at t (see WakeField::Sketch()).
bool Stationary() const
Whether the sources are at rest (velocity 0), so the snapshot does not change with t.
Definition SourceSetWake.h:47