PeriDyno 1.0.0
Loading...
Searching...
No Matches
Group.h
Go to the documentation of this file.
1
16
17#pragma once
21
22namespace dyno
23{
24 template<typename TDataType>
25 class Group : public Node
26 {
27 DECLARE_TCLASS(Group, TDataType);
28
29 public:
30 typedef typename TDataType::Real Real;
31 typedef typename TDataType::Coord Coord;
32
34
35 public:
36
37 DEF_VAR(std::string, PointId, "", "Primtive ID");
38
39 DEF_VAR(std::string, EdgeId, "", "Primtive ID");
40
41 DEF_VAR(std::string, PrimitiveId, "", "Primtive ID");
42
43 DEF_ARRAY_IN(uint, PointId, DeviceType::GPU, "PointId");
44
45 DEF_ARRAY_IN(uint, EdgeId, DeviceType::GPU, "EdgeId");
46
47 DEF_ARRAY_IN(uint, PrimitiveId, DeviceType::GPU, "primtive id");
48
49
50 public:
51
52 std::vector<uint> getSelectPrimitives()
53 {
55 }
56 std::vector<uint> getSelectEdges()
57 {
58 return selectedEdgeID;
59 } std::vector<uint> getSelectPoints()
60 {
61 return selectedPointID;
62 }
63 std::vector<uint> selectedPointID;
64 std::vector<uint> selectedEdgeID;
65 std::vector<uint> selectedPrimitiveID;
66
67 protected:
68 void resetStates() override;
69
70 void varChanged();
71
72 private:
73
74 void substrFromTwoString(std::string& first, std::string& Second, std::string& line, std::string& MyStr, int& index);
75
76 void updateID(std::string currentString, std::vector<uint>& idSet)
77 {
78 std::vector<std::string> parmList;
79 int parmNum = -1;
80
81 parmNum = getparmNum(currentString);
82
83 int tempStart = -1;
84
85 if (currentString.size())
86 {
87 std::string first = " ";
88 std::string second = " ";
89
90 for (size_t i = 0; i < parmNum; i++)
91 {
92 std::string tempS;
93 tempStart++;
94 substrFromTwoString(first, second, currentString, tempS, tempStart);
95
96 parmList.push_back(tempS);
97 }
98 }
99
100 for (auto it : parmList)
101 {
102 std::string ss = "\-";
103 auto s = it.find(ss);
104 int tempint1;
105 int tempint2;
106 if (s == std::string::npos)
107 {
108 std::stringstream ss1 = std::stringstream(it);
109 ss1 >> tempint1;
110 idSet.push_back(tempint1);
111 }
112 else
113 {
114 std::stringstream ss1 = std::stringstream(it.substr(0, s));
115 std::stringstream ss2 = std::stringstream(it.substr(s + 1, it.size() - 1));
116
117 ss1 >> tempint1;
118 ss2 >> tempint2;
119
120
121 int length = tempint2 - tempint1 + 1;
122
123 for (size_t i = 0; i < length; i++)
124 {
125 idSet.push_back(tempint1);
126 tempint1++;
127 }
128 }
129 }
130
131 }
132
133 int getparmNum(std::string currentString)
134 {
135 std::string findstr = " ";
136
137 int j = findstr.length();
138 int parmNum = 0;
139 int pos = 0;
140 int k = 0;
141
142 while ((k = currentString.find(findstr, pos)) != -1)
143 {
144 parmNum++;
145 pos = k + j;
146 }
147
148 if (parmNum == 0)
149 {
150 printf("********************* The input file is invalid*********************\n");
151
152 }
153 else
154 {
155 printf("string size : %d \n", parmNum);
156 }
157
158 return parmNum;
159 }
160 };
161
162
163
165}
#define IMPLEMENT_TCLASS(name, T1)
Definition Object.h:103
DEF_VAR(std::string, PointId, "", "Primtive ID")
std::vector< uint > getSelectPrimitives()
Definition Group.h:52
std::vector< uint > selectedPointID
Definition Group.h:63
std::vector< uint > selectedEdgeID
Definition Group.h:64
DEF_VAR(std::string, EdgeId, "", "Primtive ID")
DECLARE_TCLASS(Group, TDataType)
void varChanged()
TDataType::Coord Coord
Definition Group.h:31
void resetStates() override
std::vector< uint > getSelectEdges()
Definition Group.h:56
DEF_ARRAY_IN(uint, EdgeId, DeviceType::GPU, "EdgeId")
int getparmNum(std::string currentString)
Definition Group.h:133
void substrFromTwoString(std::string &first, std::string &Second, std::string &line, std::string &MyStr, int &index)
TDataType::Real Real
Definition Group.h:30
DEF_ARRAY_IN(uint, PointId, DeviceType::GPU, "PointId")
DEF_ARRAY_IN(uint, PrimitiveId, DeviceType::GPU, "primtive id")
std::vector< uint > selectedPrimitiveID
Definition Group.h:65
DEF_VAR(std::string, PrimitiveId, "", "Primtive ID")
std::vector< uint > getSelectPoints()
Definition Group.h:59
void updateID(std::string currentString, std::vector< uint > &idSet)
Definition Group.h:76
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25
unsigned int uint
Definition VkProgram.h:14