Sacado_ScalarParameterFamily.hpp

Go to the documentation of this file.
00001 // $Id: Sacado_ScalarParameterFamily.hpp,v 1.2 2007/06/23 00:46:31 etphipp Exp $ 
00002 // $Source: /space/CVS/Trilinos/packages/sacado/src/parameter/Sacado_ScalarParameterFamily.hpp,v $ 
00003 // @HEADER
00004 // ***********************************************************************
00005 // 
00006 //                           Sacado Package
00007 //                 Copyright (2006) Sandia Corporation
00008 // 
00009 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00010 // the U.S. Government retains certain rights in this software.
00011 // 
00012 // This library is free software; you can redistribute it and/or modify
00013 // it under the terms of the GNU Lesser General Public License as
00014 // published by the Free Software Foundation; either version 2.1 of the
00015 // License, or (at your option) any later version.
00016 //  
00017 // This library is distributed in the hope that it will be useful, but
00018 // WITHOUT ANY WARRANTY; without even the implied warranty of
00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020 // Lesser General Public License for more details.
00021 //  
00022 // You should have received a copy of the GNU Lesser General Public
00023 // License along with this library; if not, write to the Free Software
00024 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00025 // USA
00026 // Questions? Contact David M. Gay (dmgay@sandia.gov) or Eric T. Phipps
00027 // (etphipp@sandia.gov).
00028 // 
00029 // ***********************************************************************
00030 // @HEADER
00031 
00032 #ifndef SACADO_SCALARPARAMETERFAMILY_HPP
00033 #define SACADO_SCALARPARAMETERFAMILY_HPP
00034 
00035 #include "Sacado_ParameterFamilyBase.hpp"
00036 #include "Sacado_ScalarParameterEntry.hpp"
00037 
00038 namespace Sacado {
00039   
00041   class ScalarParameterFamily : 
00042     public Sacado::ParameterFamilyBase<Sacado::AbstractScalarParameterEntry,
00043                                        Sacado::ScalarParameterEntry> 
00044   {
00045 
00047     typedef Sacado::ParameterFamilyBase<Sacado::AbstractScalarParameterEntry,
00048           Sacado::ScalarParameterEntry>  BaseT;
00049 
00050   public:
00051   
00053     ScalarParameterFamily(const std::string& name, 
00054         bool supports_ad, 
00055         bool supports_analytic) : 
00056       BaseT(name, supports_ad, supports_analytic) {}
00057       
00058 
00060     virtual ~ScalarParameterFamily() {}
00061 
00063     void setRealValueForAllTypes(double value) {
00064       for (iterator it = family.begin(); it != family.end(); ++it)
00065   (*it).second->setRealValue(value);
00066     }
00067 
00069     template <class ValueType>
00070     void setValueAsConstant(const ValueType& value) {
00071       getEntry<ValueType>()->setValueAsConstant(value);
00072     }
00073 
00075     template <class ValueType>
00076     void setValueAsIndependent(const ValueType& value) {
00077       getEntry<ValueType>()->setValueAsIndependent(value);
00078     }
00079 
00081     template <class ValueType>
00082     const ValueType& getValue() const {
00083       return getEntry<ValueType>()->getValue();
00084     }
00085 
00086   private:
00087 
00089     ScalarParameterFamily(const ScalarParameterFamily&);
00090     
00092     ScalarParameterFamily& operator = (const ScalarParameterFamily&);
00093 
00094   };
00095 
00100   template <class ValueType>
00101   ValueType getValue(const ScalarParameterFamily& spf)
00102   {
00103     return spf.template getValue<ValueType>();
00104   }
00105 
00106 } // namespace Sacado
00107 
00108 #endif

Generated on Tue Oct 20 12:55:06 2009 for Sacado Package Browser (Single Doxygen Collection) by doxygen 1.4.7