User Manual, Developers Guide and API Documentation

Interpolation.hpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002  * This file is part of openWNS (open Wireless Network Simulator)
00003  * _____________________________________________________________________________
00004  *
00005  * Copyright (C) 2004-2007
00006  * Chair of Communication Networks (ComNets)
00007  * Kopernikusstr. 5, D-52074 Aachen, Germany
00008  * phone: ++49-241-80-27910,
00009  * fax: ++49-241-80-22242
00010  * email: info@openwns.org
00011  * www: http://www.openwns.org
00012  * _____________________________________________________________________________
00013  *
00014  * openWNS is free software; you can redistribute it and/or modify it under the
00015  * terms of the GNU Lesser General Public License version 2 as published by the
00016  * Free Software Foundation;
00017  *
00018  * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
00019  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00020  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00021  * details.
00022  *
00023  * You should have received a copy of the GNU Lesser General Public License
00024  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00025  *
00026  ******************************************************************************/
00027 
00028 #ifndef WNS_INTERPOLATION_HPP
00029 #define WNS_INTERPOLATION_HPP
00030 
00031 #include <vector>
00032 #include <WNS/container/Matrix.hpp>
00033 #include <WNS/container/MultiAccessible.hpp>
00034 
00035 namespace wns
00036 {
00037 
00041     namespace InterpolationDefs
00042     {
00046         typedef double CoordType;
00047 
00051         typedef container::MultiAccessibleDefs::SizeType SizeType;
00052     }
00053 
00061     template<typename T,
00062          InterpolationDefs::SizeType N>
00063     class Interpolation
00064         : public container::MultiReadAccessible<T, N, T, InterpolationDefs::CoordType>
00065     {
00069         typedef container::MultiReadAccessible<T, N, T, InterpolationDefs::CoordType>
00070         SuperType;
00071     public:
00075         typedef InterpolationDefs::SizeType SizeType;
00076 
00080         typedef T ValueType;
00081 
00085         typedef typename SuperType::IndexType CoordType;
00086 
00091         typedef container::MultiReadAccessible<ValueType, N, ValueType> DiscreteContainer;
00092 
00096         typedef container::Matrix<ValueType, N, ValueType> InitType;
00097 
00098 
00106         Interpolation(const DiscreteContainer& discreteValues)
00107             : SuperType(),
00108               values(&discreteValues)
00109         {}
00110 
00118         const DiscreteContainer& discretes() const
00119         {
00120             return *values;
00121         }
00122 
00127         virtual SizeType dimSize(const SizeType& dim) const
00128         {
00129             return values->dimSize(dim);
00130         }
00131 
00132     private:
00133         const DiscreteContainer* values;
00134     };
00135 
00139     template<typename T>
00140     class Interpolation<T, 1>
00141         : public container::MultiReadAccessible<T, 1, T, InterpolationDefs::CoordType>
00142     {
00143         typedef container::MultiReadAccessible<T, 1, T, InterpolationDefs::CoordType>
00144         SuperType;
00145     public:
00146         typedef InterpolationDefs::SizeType SizeType;
00147         typedef T ValueType;
00148 
00149         typedef typename SuperType::IndexType CoordType;
00150 
00151         typedef container::MultiReadAccessible<ValueType, 1, ValueType> DiscreteContainer;
00152         typedef container::Matrix<ValueType, 1, ValueType> InitType;
00153 
00154         Interpolation(const DiscreteContainer& discreteValues)
00155             : SuperType(),
00156               values(&discreteValues)
00157         {}
00158 
00159         const DiscreteContainer& discretes() const
00160         {
00161             return *values;
00162         }
00163 
00164         virtual SizeType dimSize(const SizeType& dim) const
00165         {
00166             return values->dimSize(dim);
00167         }
00168 
00169     private:
00170         const DiscreteContainer* values;
00171     };
00172 
00173 }
00174 
00175 #endif // WNS_INTERPOLATION_HPP
00176 
00177 

Generated on Thu May 24 03:31:36 2012 for openWNS by  doxygen 1.5.5