RectGrid.h

00001 //===========================================================================
00002 // GoTools - SINTEF Geometry Tools version 1.1
00003 //
00004 // GoTools module: CORE
00005 //
00006 // Copyright (C) 2000-2007 SINTEF ICT, Applied Mathematics, Norway.
00007 //
00008 // This program is free software; you can redistribute it and/or          
00009 // modify it under the terms of the GNU General Public License            
00010 // as published by the Free Software Foundation version 2 of the License. 
00011 //
00012 // This program is distributed in the hope that it will be useful,        
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of         
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          
00015 // GNU General Public License for more details.                           
00016 //
00017 // You should have received a copy of the GNU General Public License      
00018 // along with this program; if not, write to the Free Software            
00019 // Foundation, Inc.,                                                      
00020 // 59 Temple Place - Suite 330,                                           
00021 // Boston, MA  02111-1307, USA.                                           
00022 //
00023 // Contact information: E-mail: tor.dokken@sintef.no                      
00024 // SINTEF ICT, Department of Applied Mathematics,                         
00025 // P.O. Box 124 Blindern,                                                 
00026 // 0314 Oslo, Norway.                                                     
00027 //
00028 // Other licenses are also available for this software, notably licenses
00029 // for:
00030 // - Building commercial software.                                        
00031 // - Building software whose source code you wish to keep private.        
00032 //===========================================================================
00033 #ifndef _RECTGRID_H
00034 #define _RECTGRID_H
00035 
00036 #include "GeomObject.h"
00037 
00038 namespace Go
00039 {
00042 
00043 
00046 class RectGrid : public GeomObject
00047 {
00048 public:
00049 
00052     RectGrid()
00053         : numu_(0), numv_(0), dim_(-1)
00054     {
00055     }
00056     
00065     RectGrid(int numu, int numv, int dim, double* pts)
00066         : numu_(numu), numv_(numv), dim_(dim),
00067           points_(pts, pts + numu*numv*dim)
00068     {
00069     }
00071     virtual ~RectGrid();
00072 
00073     // Inherited from GeomObject
00074     virtual BoundingBox boundingBox() const;
00075 
00076     // Inherited from GeomObject
00077     virtual int dimension() const;
00078 
00079     // Inherited from GeomObject
00080     virtual ClassType instanceType() const;
00081 
00082     // Inherited from GeomObject
00083     static ClassType classType()
00084     {
00085         return Class_RectGrid;
00086     }
00087 
00088     // Inherited from GeomObject
00089     virtual GeomObject* clone() const
00090     {
00091         return new RectGrid(*this);
00092     }
00093 
00094     // Inherited from Streamable
00095     void read(std::istream& is);
00096 
00097     // Inherited from Streamable
00098     void write(std::ostream& os) const;
00099 
00108     void setGrid(int numu, int numv, int dim, const double* pts)
00109     {
00110         std::vector<double> tmp(pts, pts + numu*numv*dim);
00111         points_.swap(tmp);
00112         numu_ = numu;
00113         numv_ = numv;
00114         dim_ = dim;
00115     }
00116 
00119     int numCoefs_u() const
00120     {
00121         return numu_;
00122     }
00123 
00126     int numCoefs_v() const
00127     {
00128         return numv_;
00129     }
00130 
00134     double* rawData()
00135     {
00136         return &points_[0];
00137     }
00138 
00142     const double* rawData() const
00143     {
00144         return &points_[0];
00145     }
00146 
00147     void swapDirections();
00148 
00149 private:
00150     int numu_;
00151     int numv_;
00152     int dim_;
00153     std::vector<double> points_;
00154 };
00155 
00157 } // namespace Go
00158 
00159 
00160 #endif // _RECTGRID_H
00161 
00162 

Generated on Mon Jun 11 14:48:18 2007 for GoTools Core Library by  doxygen 1.5.1