SyFi
0.3
|
00001 // Copyright (C) 2006-2009 Kent-Andre Mardal and Simula Research Laboratory 00002 // 00003 // This file is part of SyFi. 00004 // 00005 // SyFi 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 // SyFi 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 SyFi. If not, see <http://www.gnu.org/licenses/>. 00017 00018 #ifndef SIMPLEX_IS_INCLUDED 00019 #define SIMPLEX_IS_INCLUDED 00020 00021 #include "Ptv.h" 00022 #include <vector> 00023 #include <iterator> 00024 #include <iostream> 00025 00026 /* 00027 * Note: at present the OrderedPtvSet class is more general than a OrderedPtvSet. 00028 * It is actually a point set. Still, we will only use it as a OrderedPtvSet. 00029 * It might be that we should use a different name and/or implement 00030 * a sub class or something which is strictly a OrderedPtvSet. 00031 */ 00032 00033 using namespace std; 00034 00035 namespace SyFi 00036 { 00037 00038 class OrderedPtvSet 00039 { 00040 vector<Ptv> Ptvs; 00041 00042 public: 00043 OrderedPtvSet(); 00044 OrderedPtvSet(const Ptv& p0, const Ptv& p1); 00045 OrderedPtvSet(const Ptv& p0, const Ptv& p1, const Ptv& p2); 00046 OrderedPtvSet(const Ptv& p0, const Ptv& p1, const Ptv& p2, const Ptv& p3); 00047 virtual ~OrderedPtvSet(); 00048 00049 void append(const Ptv& p); 00050 unsigned int size() const; 00051 const Ptv& operator [] (unsigned int i) const; 00052 Ptv& operator [] (unsigned int i); 00053 OrderedPtvSet& operator = (const OrderedPtvSet& p); 00054 bool less(const OrderedPtvSet& s) const; 00055 }; 00056 00057 struct OrderedPtvSet_is_less : public std::binary_function<OrderedPtvSet, OrderedPtvSet, bool> 00058 { 00059 bool operator() (const OrderedPtvSet &lh, const OrderedPtvSet &rh) const { return lh.less(rh); } 00060 }; 00061 00062 std::ostream & operator<< ( std::ostream& os, const OrderedPtvSet& p); 00063 00064 // Note that this OrderedPtvSet_i might be implemented as a subclass ? 00065 class OrderedPtvSet_i 00066 { 00067 pair<OrderedPtvSet,vector<unsigned int> > si; 00068 00069 public: 00070 OrderedPtvSet_i(); 00071 OrderedPtvSet_i(OrderedPtvSet& s, unsigned int i); 00072 OrderedPtvSet_i(OrderedPtvSet& s, unsigned int i0, unsigned int i1); 00073 virtual ~OrderedPtvSet_i(); 00074 00075 const OrderedPtvSet& get_OrderedPtvSet() const; 00076 unsigned int get_i(unsigned int n) const; 00077 unsigned int size() const; 00078 bool less(const OrderedPtvSet_i& si) const; 00079 }; 00080 00081 struct OrderedPtvSet_i_is_less : public std::binary_function<OrderedPtvSet_i, OrderedPtvSet_i, bool> 00082 { 00083 bool operator() (const OrderedPtvSet_i &lh, const OrderedPtvSet_i &rh) const { return lh.less(rh); } 00084 }; 00085 00086 std::ostream & operator<< ( std::ostream& os, const OrderedPtvSet_i& si); 00087 00088 } // namespace SyFi 00089 #endif