DamBreak++ Wave Simulator 0.3
DamBreak++ Simulation Framework
Loading...
Searching...
No Matches
Testvs19_WaveSimulator.h
Go to the documentation of this file.
1#pragma once
2
3// SfxBase19 package includes
4#include "include/Sfx_TimePrm.h"
5#include "include/Sfx_Simulator.h"
6#include "include/Sfx_WaveFunc.h"
7#include "include/Sfx_Observer.h"
8// BaseNumTypes package include
9#include "Sfx/Sfx_FieldLattice.h"
10// Nov19 includes
11#include "../dbpp_SectionFlow.h"
13
14// forward declarations
15namespace Sfx {
16 class TwoStepIntegrator;
17}
18//namespace dbpp { class SectionFlow; }
19namespace Testvs19 {
20 class DamBreakSystem;
21}
22
23namespace Testvs19
24{
28 class WaveSimulator : public Sfx::Simulator,
29 public std::enable_shared_from_this<WaveSimulator>,
30 virtual public Sfx::Observer
31 {
33 using ListSectionPtr = std::shared_ptr<ListSectionsFlow<dbpp::SectionFlow>>;
34 public:
39 {
40 SINE = 0,
42 };
43
46 enum class eRiverBedForm
47 {
48 FLAT = 0,
49 STEP = 1,
50 RANDOM = 2
51 };
52
53 public:
54 WaveSimulator(/*Testvs19::DamBreakSystem* aDbSystem*/);
59 WaveSimulator( const WaveSimulator& aOther) = delete;
60 WaveSimulator( const WaveSimulator&& aOther) = delete;
61 WaveSimulator& operator= ( const WaveSimulator& aOther) = delete;
62 WaveSimulator& operator= ( const WaveSimulator&& aOther) = delete;
63
64 //
65 // Simulator interface
66 //
67
72 bool init() override final;
77 void run() override final;
81 void unInitialize() override final {};
86 std::valarray<float64> getH() const noexcept
87 {
88 // C++17 copy elison (no temporary created, unmaterialize to 'xvalue')
89 return std::valarray<float64>( m_waveProfile.data(), m_waveProfile.size());
90 }
91
92 //
93 // Observer interface
94 //
95
99 void update() override final;
100
101 protected:
102 //std::shared_ptr<Sfx::FieldLattice> m_Waterlevel; .... coming
103 std::shared_ptr<Sfx::SfxTimePrm> m_Tip; // time integr. prms: dt, t_stop
104 std::shared_ptr<Sfx::WaveFunc> m_Z; // depth function (is it Z?)
105 std::shared_ptr<Sfx::WaveFunc> m_H; // initial surface function
106
107 // load H into lambda for efficiency
108// virtual void setIC( const ListSectionFlow<dbpp::SectionFlow>& aListSectionFlow); // set initial conditions
109
115 virtual void saveResults( std::ofstream& aFile, const float32 aTime);
120 std::shared_ptr<WaveSimulator> sharedPtrTo() { return shared_from_this(); }
121 private:
124 std::vector<float64> m_waveProfile;
125 //Testvs19::DamBreakSystem* m_dbSystem; /**< */
127 };
128} // End of namespace
Physical system under study (physical object)
Definition Testvs19_DamBreakSystem.h:31
std::shared_ptr< Sfx::SfxTimePrm > m_Tip
Definition Testvs19_WaveSimulator.h:103
eSurfaceWaveForm m_InitWaveForm
Definition Testvs19_WaveSimulator.h:122
std::shared_ptr< WaveSimulator > sharedPtrTo()
share the ownership of 'this' with all existing std::shared_ptr that refer to *this.
Definition Testvs19_WaveSimulator.h:120
void run() override final
main loop o fthe simulator
Definition Testvs19_WaveSimulator.cxx:192
void update() override final
update wave profile
Definition Testvs19_WaveSimulator.cxx:157
void unInitialize() override final
clean-up
Definition Testvs19_WaveSimulator.h:81
WaveSimulator()
Definition Testvs19_WaveSimulator.cxx:38
WaveSimulator(const WaveSimulator &&aOther)=delete
ListSectionPtr m_setofSectFlow
Definition Testvs19_WaveSimulator.h:126
WaveSimulator(const WaveSimulator &aOther)=delete
prevent client from using it
std::shared_ptr< ListSectionsFlow< dbpp::SectionFlow > > ListSectionPtr
Definition Testvs19_WaveSimulator.h:33
virtual void saveResults(std::ofstream &aFile, const float32 aTime)
Dump results in a file.
Definition Testvs19_WaveSimulator.cxx:418
WaveSimulator & operator=(const WaveSimulator &aOther)=delete
eRiverBedForm
Definition Testvs19_WaveSimulator.h:47
@ RANDOM
Definition Testvs19_WaveSimulator.h:50
@ STEP
Definition Testvs19_WaveSimulator.h:49
@ FLAT
Definition Testvs19_WaveSimulator.h:48
std::valarray< float64 > getH() const noexcept
water level of each section
Definition Testvs19_WaveSimulator.h:86
std::vector< float64 > m_waveProfile
Definition Testvs19_WaveSimulator.h:124
std::shared_ptr< Sfx::WaveFunc > m_H
Definition Testvs19_WaveSimulator.h:105
std::shared_ptr< Sfx::WaveFunc > m_Z
Definition Testvs19_WaveSimulator.h:104
eSurfaceWaveForm
Definition Testvs19_WaveSimulator.h:39
@ FCTSTEP
Definition Testvs19_WaveSimulator.h:41
@ SINE
Definition Testvs19_WaveSimulator.h:40
bool init() override final
initialize simulator
Definition Testvs19_WaveSimulator.cxx:47
eRiverBedForm m_RiverBed
Definition Testvs19_WaveSimulator.h:123
Definition HydUtils.h:15
Definition Testvs19_BaseRhsPhysicsAlgorithm.cpp:19