//=========================================================================== // GoTools Core - SINTEF Geometry Tools Core library, version 2.0.1 // // Copyright (C) 2000-2007, 2010 SINTEF ICT, Applied Mathematics, Norway. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation version 2 of the License. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., // 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. // // Contact information: E-mail: tor.dokken@sintef.no // SINTEF ICT, Department of Applied Mathematics, // P.O. Box 124 Blindern, // 0314 Oslo, Norway. // // Other licenses are also available for this software, notably licenses // for: // - Building commercial software. // - Building software whose source code you wish to keep private. //=========================================================================== 00013 #ifndef _RECTGRID_H 00014 #define _RECTGRID_H 00015 00016 #include "GoTools/geometry/GeomObject.h" 00017 00018 namespace Go 00019 { 00020 00023 class RectGrid : public GeomObject 00024 { 00025 public: 00026 00029 RectGrid() 00030 : numu_(0), numv_(0), dim_(-1) 00031 { 00032 } 00033 00042 RectGrid(int numu, int numv, int dim, double* pts) 00043 : numu_(numu), numv_(numv), dim_(dim), 00044 points_(pts, pts + numu*numv*dim) 00045 { 00046 } 00048 virtual ~RectGrid(); 00049 00050 // Inherited from GeomObject 00051 virtual BoundingBox boundingBox() const; 00052 00053 // Inherited from GeomObject 00054 virtual int dimension() const; 00055 00056 // Inherited from GeomObject 00057 virtual ClassType instanceType() const; 00058 00059 // Inherited from GeomObject 00060 static ClassType classType() 00061 { 00062 return Class_RectGrid; 00063 } 00064 00065 // Inherited from GeomObject 00066 virtual GeomObject* clone() const 00067 { 00068 return new RectGrid(*this); 00069 } 00070 00071 // Inherited from Streamable 00072 void read(std::istream& is); 00073 00074 // Inherited from Streamable 00075 void write(std::ostream& os) const; 00076 00085 void setGrid(int numu, int numv, int dim, const double* pts) 00086 { 00087 std::vector<double> tmp(pts, pts + numu*numv*dim); 00088 points_.swap(tmp); 00089 numu_ = numu; 00090 numv_ = numv; 00091 dim_ = dim; 00092 } 00093 00096 int numCoefs_u() const 00097 { 00098 return numu_; 00099 } 00100 00103 int numCoefs_v() const 00104 { 00105 return numv_; 00106 } 00107 00111 double* rawData() 00112 { 00113 return &points_[0]; 00114 } 00115 00119 const double* rawData() const 00120 { 00121 return &points_[0]; 00122 } 00123 00124 void swapDirections(); 00125 00126 private: 00127 int numu_; 00128 int numv_; 00129 int dim_; 00130 std::vector<double> points_; 00131 }; 00132 00133 } // namespace Go 00134 00135 00136 #endif // _RECTGRID_H 00137
Generated on Tue Sep 21 15:44:17 2010 for GoTools Core by  doxygen 1.6.3