SyFi 0.3
|
00001 // Copyright (C) 2006-2009 Kent-Andre Mardal and Simula Research Laboratory. 00002 // Licensed under the GNU GPL Version 2, or (at your option) any later version. 00003 00004 #ifndef PTV_INCLUDED 00005 #define PTV_INCLUDED 00006 00007 #include <functional> 00008 #include <iostream> 00009 00010 class Ptv 00011 { 00012 00013 public: 00014 unsigned int dim; 00015 double* v; 00016 static double tol; 00017 Ptv(unsigned int size_); 00018 Ptv(unsigned int size_, double* v_); 00019 Ptv(double x, double y); 00020 Ptv(double x, double y, double z); 00021 Ptv(const Ptv& p); 00022 Ptv(); 00023 void redim(unsigned int size_, double *v_); 00024 void redim(unsigned int size_); 00025 void fill(double *v_); 00026 00027 virtual ~Ptv(); 00028 00029 const unsigned int size() const; 00030 00031 const double& operator [] (unsigned int i) const; 00032 double& operator [] (unsigned int i); 00033 Ptv& operator = (const Ptv& p); 00034 00035 bool less(const Ptv& p) const; 00036 00037 }; 00038 00039 struct Ptv_is_less : public std::binary_function<Ptv, Ptv, bool> 00040 { 00041 bool operator() (const Ptv &lh, const Ptv &rh) const { return lh.less(rh); } 00042 }; 00043 00044 class Ptv_match : public std::unary_function<Ptv, bool> 00045 { 00046 protected: 00047 static double tol; 00048 unsigned int d; 00049 double v; 00050 public: 00051 Ptv_match(); 00052 Ptv_match(unsigned int d_, double v_); 00053 virtual ~Ptv_match() {} 00054 bool operator() (const Ptv &p); 00055 }; 00056 00057 std::ostream & operator<< ( std::ostream& os, const Ptv& p); 00058 #endif