| 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 friend class ObjectFactory; 00042 public: 00044 std::string getClassName() { return "NurbsDisk"; } 00045 00046 00048 void setLocalFrame(bool f) { localFrameStr=(f==true)?"true":"false"; } 00049 00050 bool getLocalFrame() { return localFrameStr=="true"?true:false; } 00051 00053 void setScaleFactor(const double scale) { 00054 scaleFactor=scale; 00055 } 00056 00057 double getScaleFactor() { return scaleFactor; } 00058 00060 void setDrawDegree(int drawDegree_) { 00061 drawDegree=drawDegree_; 00062 } 00063 00064 int getDrawDegree() { return drawDegree; } 00065 00067 void setRadii(double Ri_, double Ro_) { 00068 Ri=Ri_; 00069 Ro=Ro_; 00070 } 00071 00073 void setRi(double Ri_) { 00074 Ri=Ri_; 00075 } 00076 00078 void setRo(double Ro_) { 00079 Ro=Ro_; 00080 } 00081 00082 double getRi() { return Ri; } 00083 double getRo() { return Ro; } 00084 00088 void setKnotVecAzimuthal(const std::vector<double> &KnotVecAzimuthal_) { 00089 KnotVecAzimuthal=KnotVecAzimuthal_; 00090 } 00091 00092 std::vector<double> getKnotVecAzimuthal() { return KnotVecAzimuthal; } 00093 00097 void setKnotVecRadial(const std::vector<double> &KnotVecRadial_) { 00098 KnotVecRadial=KnotVecRadial_; 00099 } 00100 00101 std::vector<double> getKnotVecRadial() { return KnotVecRadial; } 00102 00104 void setElementNumberAzimuthal(int ElementNumberAzimuthal_) { 00105 ElementNumberAzimuthal=ElementNumberAzimuthal_; 00106 } 00107 00108 int getElementNumberAzimuthal() { return ElementNumberAzimuthal; } 00109 00111 void setElementNumberRadial(int ElementNumberRadial_) { 00112 ElementNumberRadial=ElementNumberRadial_; 00113 } 00114 00115 int getElementNumberRadial() { return ElementNumberRadial; } 00116 00118 void setInterpolationDegreeRadial(int InterpolationDegreeRadial_) { 00119 InterpolationDegreeRadial=InterpolationDegreeRadial_; 00120 } 00121 00122 int getInterpolationDegreeRadial() { return InterpolationDegreeRadial; } 00123 00125 void setInterpolationDegreeAzimuthal(int InterpolationDegreeAzimuthal_) { 00126 InterpolationDegreeAzimuthal=InterpolationDegreeAzimuthal_; 00127 } 00128 00129 int getInterpolationDegreeAzimuthal() { return InterpolationDegreeAzimuthal; } 00131 void setDiskNormal(float *DiskNormal_) { 00132 DiskNormal=DiskNormal_; 00133 } 00134 00135 float* getDiskNormal() { return DiskNormal; } 00136 00138 void setDiskPoint(float *DiskPoint_) { 00139 DiskPoint=DiskPoint_; 00140 } 00141 00142 float* getDiskPoint() { return DiskPoint; } 00143 00145 void append(const std::vector<double>& row) { 00146 if(data==0) throw std::runtime_error("can not append data to an environment object"); 00147 data->append(row); 00148 } 00149 00150 int getRows() { return data?data->getRows():-1; } 00151 std::vector<double> getRow(int i) { 00152 int NodeDofs = (getElementNumberRadial() + 1) * (getElementNumberAzimuthal() + getInterpolationDegreeAzimuthal()); 00153 return data?data->getRow(i):std::vector<double>(7+3*NodeDofs+3*getElementNumberAzimuthal()*drawDegree*2); 00154 } 00155 00157 virtual void initializeUsingXML(xercesc::DOMElement *element); 00158 00160 xercesc::DOMElement* writeXMLFile(xercesc::DOMNode *parent); 00161 protected: 00162 NurbsDisk(); 00163 virtual ~NurbsDisk(); 00164 00166 H5::VectorSerie<double>* data; 00167 00171 std::string localFrameStr; 00172 00174 double scaleFactor; 00175 00177 int drawDegree; 00178 00180 double Ri, Ro; 00181 00183 int ElementNumberAzimuthal, ElementNumberRadial; 00184 00186 int InterpolationDegreeAzimuthal, InterpolationDegreeRadial; 00187 00189 std::vector<double> KnotVecAzimuthal, KnotVecRadial; 00190 00192 float *DiskNormal; 00193 00195 float *DiskPoint; 00196 00198 void createHDF5File(); 00199 void openHDF5File(); 00200 }; 00201 00202 } 00203 00204 #endif /* _OPENMBV_NURBSDISK_H_ */ 00205
1.8.0