PeriDyno 1.0.0
Loading...
Searching...
No Matches
OceanPatch.h
Go to the documentation of this file.
1
16#pragma once
17#include <cufft.h>
18#include <vector>
19#include "Node.h"
20
21#include "Complex.h"
23
24namespace dyno {
25
26 struct WindParam
27 {
28 float windSpeed;
29 float A;
31 float global;
32 };
33
34 template<typename TDataType>
35 class OceanPatch : public Node
36 {
37 DECLARE_TCLASS(OceanPatch, TDataType)
38 public:
39 typedef typename TDataType::Real Real;
40 typedef typename TDataType::Coord Coord;
41 typedef typename ::dyno::Complex<Real> Complex;
42
45
46 std::string getNodeType() override { return "Height Fields"; }
47 public:
48 DEF_VAR(uint, WindType, 2, "wind Types");
49
50 DEF_VAR(Real, Amplitude, 0, "");
51
52 DEF_VAR(Real, WindSpeed, 0, "");
53
54 DEF_VAR(Real, Choppiness, 0, "");
55
56 DEF_VAR(Real, GlobalShift, 0, "");
57
58
59 DEF_VAR(Real, WindDirection, Real(60), "Wind direction");
60
61 DEF_VAR(uint, Resolution, 512, "");
62
63 DEF_VAR(Real, PatchSize, Real(512), "Real patch size");
64
65 DEF_VAR(Real, TimeScale, Real(1), "");
66
67 public:
69
70 protected:
71 void resetStates() override;
72
73 void updateStates() override;
74 void postUpdateStates() override;
75
76 private:
78
79 std::vector<WindParam> mParams; //A set of pre-defined configurations
80
81 DArray2D<Complex> mH0; //Initial spectrum
82 DArray2D<Complex> mHt; //Current spectrum
83
84 DArray2D<Complex> mDxt; //x-axis offset
85 DArray2D<Complex> mDzt; //z-axis offset
86
87 DArray2D<Coord> mDisp; //xyz-axis offset
88
89 const Real g = 9.81f; //Gravity
90
92
93 cufftHandle fftPlan;
94
95 int mSpectrumWidth; //with of spectrum
96 int mSpectrumHeight; //height of spectrum
97 };
98
100}
#define DECLARE_TCLASS(name, T1)
Definition Object.h:87
#define IMPLEMENT_TCLASS(name, T1)
Definition Object.h:103
DEF_VAR(Real, Amplitude, 0, "")
DArray2D< Complex > mHt
Definition OceanPatch.h:82
std::vector< WindParam > mParams
Definition OceanPatch.h:79
DEF_VAR(Real, Choppiness, 0, "")
DArray2D< Complex > mDxt
Definition OceanPatch.h:84
DEF_VAR(uint, Resolution, 512, "")
DArray2D< Complex > mDzt
Definition OceanPatch.h:85
DArray2D< Complex > mH0
Definition OceanPatch.h:81
void updateStates() override
DEF_VAR(Real, WindSpeed, 0, "")
::dyno::Complex< Real > Complex
Definition OceanPatch.h:41
DArray2D< Coord > mDisp
Definition OceanPatch.h:87
DEF_INSTANCE_STATE(HeightField< TDataType >, HeightField, "Height field")
DEF_VAR(Real, PatchSize, Real(512), "Real patch size")
DEF_VAR(uint, WindType, 2, "wind Types")
DEF_VAR(Real, GlobalShift, 0, "")
const Real g
Definition OceanPatch.h:89
DEF_VAR(Real, TimeScale, Real(1), "")
TDataType::Coord Coord
Definition OceanPatch.h:40
DEF_VAR(Real, WindDirection, Real(60), "Wind direction")
std::string getNodeType() override
Definition OceanPatch.h:46
TDataType::Real Real
Definition OceanPatch.h:39
void resetStates() override
void postUpdateStates() override
cufftHandle fftPlan
Definition OceanPatch.h:93
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25
Array2D< T, DeviceType::GPU > DArray2D
Definition Array2D.inl:90
unsigned int uint
Definition VkProgram.h:14