openmbvcppinterface 3.1.0 OpenMBV C++ Interface

nurbsdisk.h
1 /*
2 OpenMBV - Open Multi Body Viewer.
3 Copyright (C) 2009 Markus Friedrich
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #ifndef _OPENMBV_NURBSDISK_H_
21 #define _OPENMBV_NURBSDISK_H_
22
23 #include <openmbvcppinterface/dynamiccoloredbody.h>
24 #include <hdf5serie/vectorserie.h>
25 #include <vector>
26 #include <cassert>
27 #include <stdexcept>
28
29 namespace OpenMBV {
30
40 class NurbsDisk : public DynamicColoredBody {
41 friend class ObjectFactory;
42 public:
44 void setLocalFrame(bool f) { localFrameStr=(f)?"true":"false"; }
45
46 bool getLocalFrame() { return localFrameStr=="true"?true:false; }
47
49 void setScaleFactor(const double scale) {
50 scaleFactor=scale;
51 }
52
53 double getScaleFactor() { return scaleFactor; }
54
56 void setDrawDegree(int drawDegree_) {
57 drawDegree=drawDegree_;
58 }
59
60 int getDrawDegree() { return drawDegree; }
61
63 void setRadii(double Ri_, double Ro_) {
64 Ri=Ri_;
65 Ro=Ro_;
66 }
67
69 void setRi(double Ri_) {
70 Ri=Ri_;
71 }
72
74 void setRo(double Ro_) {
75 Ro=Ro_;
76 }
77
78 double getRi() { return Ri; }
79 double getRo() { return Ro; }
80
84 void setKnotVecAzimuthal(const std::vector<double> &KnotVecAzimuthal_) {
85 KnotVecAzimuthal=KnotVecAzimuthal_;
86 }
87
88 std::vector<double> getKnotVecAzimuthal() { return KnotVecAzimuthal; }
89
93 void setKnotVecRadial(const std::vector<double> &KnotVecRadial_) {
94 KnotVecRadial=KnotVecRadial_;
95 }
96
97 std::vector<double> getKnotVecRadial() { return KnotVecRadial; }
98
100 void setElementNumberAzimuthal(int ElementNumberAzimuthal_) {
101 ElementNumberAzimuthal=ElementNumberAzimuthal_;
102 }
103
104 int getElementNumberAzimuthal() { return ElementNumberAzimuthal; }
105
107 void setElementNumberRadial(int ElementNumberRadial_) {
108 ElementNumberRadial=ElementNumberRadial_;
109 }
110
111 int getElementNumberRadial() { return ElementNumberRadial; }
112
114 void setInterpolationDegreeRadial(int InterpolationDegreeRadial_) {
115 InterpolationDegreeRadial=InterpolationDegreeRadial_;
116 }
117
118 int getInterpolationDegreeRadial() { return InterpolationDegreeRadial; }
119
121 void setInterpolationDegreeAzimuthal(int InterpolationDegreeAzimuthal_) {
122 InterpolationDegreeAzimuthal=InterpolationDegreeAzimuthal_;
123 }
124
125 int getInterpolationDegreeAzimuthal() { return InterpolationDegreeAzimuthal; }
127 void setDiskNormal(float *DiskNormal_) {
128 DiskNormal=DiskNormal_;
129 }
130
131 float* getDiskNormal() { return DiskNormal; }
132
134 void setDiskPoint(float *DiskPoint_) {
135 DiskPoint=DiskPoint_;
136 }
137
138 float* getDiskPoint() { return DiskPoint; }
139
141 template<typename T>
142 void append(const T& row) {
143 if(data==nullptr) throw std::runtime_error("can not append data to an environment object");
144 data->append(row);
145 }
146
147 int getRows() override { return data?data->getRows():0; }
148 std::vector<double> getRow(int i) override {
149 int NodeDofs = (getElementNumberRadial() + 1) * (getElementNumberAzimuthal() + getInterpolationDegreeAzimuthal());
150 return data?data->getRow(i):std::vector<double>(7+3*NodeDofs+3*getElementNumberAzimuthal()*drawDegree*2);
151 }
152
154 void initializeUsingXML(xercesc::DOMElement *element) override;
155
157 xercesc::DOMElement* writeXMLFile(xercesc::DOMNode *parent) override;
158 protected:
159 NurbsDisk();
160 ~NurbsDisk() override;
161
163 H5::VectorSerie<double>* data{nullptr};
164
168 std::string localFrameStr;
169
171 double scaleFactor{1};
172
174 int drawDegree{1};
175
177 double Ri{0.};
178 double Ro{0.};
179
181 int ElementNumberAzimuthal{0};
182 int ElementNumberRadial{0};
183
185 int InterpolationDegreeAzimuthal{8};
186 int InterpolationDegreeRadial{3};
187
189 std::vector<double> KnotVecAzimuthal, KnotVecRadial;
190
192 float *DiskNormal{nullptr};
193
195 float *DiskPoint{nullptr};
196
198 void createHDF5File() override;
199 void openHDF5File() override;
200 };
201
202 }
203
204 #endif /* _OPENMBV_NURBSDISK_H_ */
205
OpenMBV::NurbsDisk::getRow
std::vector< double > getRow(int i) override
Definition: nurbsdisk.h:148
OpenMBV::NurbsDisk::InterpolationDegreeAzimuthal
int InterpolationDegreeAzimuthal
Definition: nurbsdisk.h:185
OpenMBV::NurbsDisk::drawDegree
int drawDegree
Definition: nurbsdisk.h:174
OpenMBV::NurbsDisk::setLocalFrame
void setLocalFrame(bool f)
Definition: nurbsdisk.h:44
OpenMBV::NurbsDisk::setRi
void setRi(double Ri_)
Definition: nurbsdisk.h:69
OpenMBV::NurbsDisk::createHDF5File
void createHDF5File() override
Definition: nurbsdisk.cc:66
OpenMBV::NurbsDisk
Class for all bodies with a NURBS surface and a primitive closure.
Definition: nurbsdisk.h:40
OpenMBV::ObjectFactory
Definition: objectfactory.h:38
OpenMBV::NurbsDisk::scaleFactor
double scaleFactor
Definition: nurbsdisk.h:171
H5::VectorSerie::getRow
void getRow(int row, size_t size, T data[])
OpenMBV::NurbsDisk::setElementNumberAzimuthal
void setElementNumberAzimuthal(int ElementNumberAzimuthal_)
Definition: nurbsdisk.h:100
OpenMBV::NurbsDisk::setDiskNormal
void setDiskNormal(float *DiskNormal_)
Definition: nurbsdisk.h:127
OpenMBV::NurbsDisk::setKnotVecAzimuthal
void setKnotVecAzimuthal(const std::vector< double > &KnotVecAzimuthal_)
Definition: nurbsdisk.h:84
OpenMBV::NurbsDisk::writeXMLFile
xercesc::DOMElement * writeXMLFile(xercesc::DOMNode *parent) override
Definition: nurbsdisk.cc:45
OpenMBV::NurbsDisk::setDiskPoint
void setDiskPoint(float *DiskPoint_)
Definition: nurbsdisk.h:134
OpenMBV::NurbsDisk::setInterpolationDegreeRadial
void setInterpolationDegreeRadial(int InterpolationDegreeRadial_)
Definition: nurbsdisk.h:114
OpenMBV::NurbsDisk::setRadii
void setRadii(double Ri_, double Ro_)
Definition: nurbsdisk.h:63
OpenMBV::NurbsDisk::setKnotVecRadial
void setKnotVecRadial(const std::vector< double > &KnotVecRadial_)
Definition: nurbsdisk.h:93
OpenMBV::NurbsDisk::setInterpolationDegreeAzimuthal
void setInterpolationDegreeAzimuthal(int InterpolationDegreeAzimuthal_)
Definition: nurbsdisk.h:121
OpenMBV::NurbsDisk::KnotVecAzimuthal
std::vector< double > KnotVecAzimuthal
Definition: nurbsdisk.h:189
OpenMBV::DynamicColoredBody
Definition: dynamiccoloredbody.h:28
OpenMBV::NurbsDisk::DiskNormal
float * DiskNormal
Definition: nurbsdisk.h:192
OpenMBV::NurbsDisk::data
H5::VectorSerie< double > * data
Definition: nurbsdisk.h:163
OpenMBV::NurbsDisk::getRows
int getRows() override
Definition: nurbsdisk.h:147
H5::VectorSerie< double >
OpenMBV::NurbsDisk::setRo
void setRo(double Ro_)
Definition: nurbsdisk.h:74
OpenMBV::NurbsDisk::DiskPoint
float * DiskPoint
Definition: nurbsdisk.h:195
OpenMBV::NurbsDisk::initializeUsingXML
void initializeUsingXML(xercesc::DOMElement *element) override
Definition: nurbsdisk.cc:111
OpenMBV::NurbsDisk::append
void append(const T &row)
Definition: nurbsdisk.h:142
OpenMBV::NurbsDisk::setDrawDegree
void setDrawDegree(int drawDegree_)
Definition: nurbsdisk.h:56
OpenMBV::NurbsDisk::setScaleFactor
void setScaleFactor(const double scale)
Definition: nurbsdisk.h:49
H5::VectorSerie::append
void append(const T data[], size_t size)
OpenMBV::NurbsDisk::Ri
double Ri
Definition: nurbsdisk.h:177
OpenMBV::NurbsDisk::setElementNumberRadial
void setElementNumberRadial(int ElementNumberRadial_)
Definition: nurbsdisk.h:107
OpenMBV::NurbsDisk::ElementNumberAzimuthal
int ElementNumberAzimuthal
Definition: nurbsdisk.h:181
OpenMBV::NurbsDisk::localFrameStr
std::string localFrameStr
String that contains, whether reference Frame should be drawn (="True") or not (="False")
Definition: nurbsdisk.h:168
H5::VectorSerie::getRows
int getRows()