| Hosted by: |
OpenMBV C++ Interface |
BerliOS Project Page |
00001 /* 00002 OpenMBV - Open Multi Body Viewer. 00003 Copyright (C) 2009 Markus Friedrich 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 */ 00019 00020 #ifndef _OPENMBV_NURBSDISK_H_ 00021 #define _OPENMBV_NURBSDISK_H_ 00022 00023 #include <openmbvcppinterface/dynamiccoloredbody.h> 00024 #include <hdf5serie/vectorserie.h> 00025 #include <vector> 00026 #include <assert.h> 00027 #include <stdexcept> 00028 00029 namespace OpenMBV { 00030 00040 class NurbsDisk : public DynamicColoredBody { 00041 public: 00043 NurbsDisk(); 00044 00046 std::string getClassName() { return "NurbsDisk"; } 00047 00048 00050 void setLocalFrame(bool f) { localFrameStr=(f==true)?"true":"false"; } 00051 00052 bool getLocalFrame() { return localFrameStr=="true"?true:false; } 00053 00055 void setScaleFactor(const double scale) { 00056 scaleFactor=scale; 00057 } 00058 00059 double getScaleFactor() { return scaleFactor; } 00060 00062 void setDrawDegree(int drawDegree_) { 00063 drawDegree=drawDegree_; 00064 } 00065 00066 int getDrawDegree() { return drawDegree; } 00067 00069 void setRadii(double Ri_, double Ro_) { 00070 Ri=Ri_; 00071 Ro=Ro_; 00072 } 00073 00075 void setRi(double Ri_) { 00076 Ri=Ri_; 00077 } 00078 00080 void setRo(double Ro_) { 00081 Ro=Ro_; 00082 } 00083 00084 double getRi() { return Ri; } 00085 double getRo() { return Ro; } 00086 00090 void setKnotVecAzimuthal(const std::vector<double> &KnotVecAzimuthal_) { 00091 KnotVecAzimuthal=KnotVecAzimuthal_; 00092 } 00093 00094 std::vector<double> getKnotVecAzimuthal() { return KnotVecAzimuthal; } 00095 00099 void setKnotVecRadial(const std::vector<double> &KnotVecRadial_) { 00100 KnotVecRadial=KnotVecRadial_; 00101 } 00102 00103 std::vector<double> getKnotVecRadial() { return KnotVecRadial; } 00104 00106 void setElementNumberAzimuthal(int ElementNumberAzimuthal_) { 00107 ElementNumberAzimuthal=ElementNumberAzimuthal_; 00108 } 00109 00110 int getElementNumberAzimuthal() { return ElementNumberAzimuthal; } 00111 00113 void setElementNumberRadial(int ElementNumberRadial_) { 00114 ElementNumberRadial=ElementNumberRadial_; 00115 } 00116 00117 int getElementNumberRadial() { return ElementNumberRadial; } 00118 00120 void setInterpolationDegreeRadial(int InterpolationDegreeRadial_) { 00121 InterpolationDegreeRadial=InterpolationDegreeRadial_; 00122 } 00123 00124 int getInterpolationDegreeRadial() { return InterpolationDegreeRadial; } 00125 00127 void setInterpolationDegreeAzimuthal(int InterpolationDegreeAzimuthal_) { 00128 InterpolationDegreeAzimuthal=InterpolationDegreeAzimuthal_; 00129 } 00130 00131 int getInterpolationDegreeAzimuthal() { return InterpolationDegreeAzimuthal; } 00133 void setDiskNormal(float *DiskNormal_) { 00134 DiskNormal=DiskNormal_; 00135 } 00136 00137 float* getDiskNormal() { return DiskNormal; } 00138 00140 void setDiskPoint(float *DiskPoint_) { 00141 DiskPoint=DiskPoint_; 00142 } 00143 00144 float* getDiskPoint() { return DiskPoint; } 00145 00147 void append(const std::vector<double>& row) { 00148 if(data==0) throw std::runtime_error("can not append data to an environment object"); 00149 data->append(row); 00150 } 00151 00152 int getRows() { return data?data->getRows():-1; } 00153 std::vector<double> getRow(int i) { 00154 int NodeDofs = (getElementNumberRadial() + 1) * (getElementNumberAzimuthal() + getInterpolationDegreeAzimuthal()); 00155 return data?data->getRow(i):std::vector<double>(7+3*NodeDofs+3*getElementNumberAzimuthal()*drawDegree*2); 00156 } 00157 00159 virtual void initializeUsingXML(xercesc::DOMElement *element); 00160 00162 xercesc::DOMElement* writeXMLFile(xercesc::DOMNode *parent); 00163 00164 protected: 00166 virtual ~NurbsDisk(); 00167 00169 H5::VectorSerie<double>* data; 00170 00174 std::string localFrameStr; 00175 00177 double scaleFactor; 00178 00180 int drawDegree; 00181 00183 double Ri, Ro; 00184 00186 int ElementNumberAzimuthal, ElementNumberRadial; 00187 00189 int InterpolationDegreeAzimuthal, InterpolationDegreeRadial; 00190 00192 std::vector<double> KnotVecAzimuthal, KnotVecRadial; 00193 00195 float *DiskNormal; 00196 00198 float *DiskPoint; 00199 00201 void createHDF5File(); 00202 void openHDF5File(); 00203 }; 00204 00205 } 00206 00207 #endif /* _OPENMBV_NURBSDISK_H_ */ 00208
1.8.0