PeriDyno 1.0.0
Loading...
Searching...
No Matches
ImChart.h
Go to the documentation of this file.
1
16
17#pragma once
18
19#include "ImWidget.h"
20
21namespace dyno
22{
23 class ImChart : public ImWidget
24 {
26 public:
27 ImChart();
28 ~ImChart() override;
29
30 void setCoord(ImVec2 coord);
31 ImVec2 getCoord() const;
32
33 public:
34 DECLARE_ENUM(InputMode,
35 Var = 0,
36 Array = 1);
37
38 DEF_VAR_IN(unsigned, FrameNumber, "");
39 DEF_VAR_IN(Real, Value, "");
40 DEF_ARRAY_IN(Real, Array, DeviceType::GPU, "");
41
42 DEF_ENUM(InputMode, InputMode, InputMode::Array, "");
43
44 DEF_VAR(Real, Min, Real(-1), "");
45 DEF_VAR(Real, Max, Real(1), "");
46 DEF_VAR(bool, FixHeight, false, "");
47 //DEF_VAR(bool, FixCount, false, "");
48 DEF_VAR(int, Count, -1, "");
49 DEF_VAR(std::string, Title, "chart", "");
50 DEF_VAR(bool, OutputFile, false, "");
51 DEF_VAR(std::string, OutputPath, "D:/outputTxt", "OutputPath");
52
53
54 protected:
55 virtual void paint();
56 virtual void update();
57 virtual bool initialize();
58
60 void varChange();
61 void drawArray();
62 void drawValue();
63 void outputTxt();
64
65
66 private:
67
68 ImVec2 mCoord = ImVec2(0, 0);
69#ifdef CUDA_BACKEND
70 Reduction<Real> m_reduce_real;
71#endif // CUDA_BACKEND
72
73#ifdef VK_BACKEND
74 VkReduce<Real> m_reduce_real;
75#endif // VK_BACKEND
76
77
78 float min = -1;
79 float max = 1;
80
81 Real* valuePtr = nullptr;
82
84 std::vector<Real>* valueVec;
86
87 std::shared_ptr<Node> mNode;
88
89 int frameNumber = 0;
90 int count = 20;
91
92 std::string file_postfix = ".txt";
93
94 bool isOut = false;
95
96 };
97};
#define DECLARE_CLASS(name)
Definition Object.h:65
double Real
Definition Typedef.inl:23
This class is designed to be elegant, so it can be directly passed to GPU as parameters.
Definition Array.h:27
DEF_VAR(bool, OutputFile, false, "")
DArray< Real > d_Value
Definition ImChart.h:85
void outputTxt()
Definition ImChart.cpp:252
int frameNumber
Definition ImChart.h:89
void resetCanvas()
virtual bool initialize()
Definition ImChart.cpp:127
virtual void paint()
Definition ImChart.cpp:137
float max
Definition ImChart.h:79
Real * valuePtr
Definition ImChart.h:81
CArray< Real > c_Value
Definition ImChart.h:83
float min
Definition ImChart.h:78
DEF_ENUM(InputMode, InputMode, InputMode::Array, "")
ImVec2 getCoord() const
Definition ImChart.cpp:122
virtual void update()
Definition ImChart.cpp:132
DEF_VAR(Real, Min, Real(-1), "")
DEF_VAR(std::string, Title, "chart", "")
ImVec2 mCoord
Definition ImChart.h:68
DEF_VAR(bool, FixHeight, false, "")
~ImChart() override
Definition ImChart.cpp:33
void setCoord(ImVec2 coord)
Definition ImChart.cpp:117
void drawValue()
Definition ImChart.cpp:202
DEF_VAR(std::string, OutputPath, "D:/outputTxt", "OutputPath")
std::shared_ptr< Node > mNode
Definition ImChart.h:87
std::vector< Real > * valueVec
Definition ImChart.h:84
DEF_VAR_IN(Real, Value, "")
std::string file_postfix
Definition ImChart.h:92
DEF_VAR(int, Count, -1, "")
DECLARE_ENUM(InputMode, Var=0, Array=1)
void varChange()
Definition ImChart.cpp:38
DEF_ARRAY_IN(Real, Array, DeviceType::GPU, "")
DEF_VAR(Real, Max, Real(1), "")
DEF_VAR_IN(unsigned, FrameNumber, "")
void drawArray()
Definition ImChart.cpp:158
implement functions for reducing a range to a single value
Definition VkReduce.h:12
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25
Array< T, DeviceType::GPU > DArray
Definition Array.inl:89
Array< T, DeviceType::CPU > CArray
Definition Array.h:151