FEApp_BrusselatorNodeBCStrategyImpl.hpp

Go to the documentation of this file.
00001 // $Id$ 
00002 // $Source$ 
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 #include "FEApp_BrusselatorParameters.hpp"
00033 
00034 template <typename EvalT>
00035 FEApp::BrusselatorNodeBCStrategy<EvalT>::
00036 BrusselatorNodeBCStrategy(
00037         const ScalarT& alpha_, 
00038         const ScalarT& beta_,
00039         const Teuchos::RCP<ParamLib>& paramLib) :
00040   alpha(alpha_),
00041   beta(beta_),
00042   offsets(2),
00043   pl(paramLib)
00044 {
00045   offsets[0] = 0;
00046   offsets[1] = 1;
00047 
00048   // Add "alpha" to parameter library
00049   std::string name = "Brusselator Alpha";
00050   if (!pl->isParameter(name))
00051     pl->addParameterFamily(name, true, false);
00052   if (!pl->template isParameterForType<EvalT>(name)) {
00053     Teuchos::RCP< BrusselatorAlphaParameter<EvalT> > tmpa = 
00054       Teuchos::rcp(new BrusselatorAlphaParameter<EvalT>(alpha));
00055     pl->template addEntry<EvalT>(name, tmpa);
00056   }
00057 
00058   // Add "beta" to parameter library
00059   name = "Brusselator Beta";
00060   if (!pl->isParameter(name))
00061     pl->addParameterFamily(name, true, false);
00062   if (!pl->template isParameterForType<EvalT>(name)) {
00063     Teuchos::RCP< BrusselatorBetaParameter<EvalT> > tmpb = 
00064       Teuchos::rcp(new BrusselatorBetaParameter<EvalT>(beta));
00065     pl->template addEntry<EvalT>(name, tmpb);
00066   }
00067 }
00068 
00069 template <typename EvalT>
00070 FEApp::BrusselatorNodeBCStrategy<EvalT>::
00071 ~BrusselatorNodeBCStrategy()
00072 {
00073 }
00074 
00075 template <typename EvalT>
00076 const std::vector<unsigned int>&
00077 FEApp::BrusselatorNodeBCStrategy<EvalT>::
00078 getOffsets() const
00079 {
00080   return offsets;
00081 }
00082 
00083 template <typename EvalT>
00084 void
00085 FEApp::BrusselatorNodeBCStrategy<EvalT>::
00086 evaluateResidual(const std::vector<ScalarT>* dot,
00087                  const std::vector<ScalarT>& solution,
00088                  std::vector<ScalarT>& residual) const
00089 {
00090   alpha = pl->template getValue<EvalT>("Brusselator Alpha");
00091   beta = pl->template getValue<EvalT>("Brusselator Beta");
00092 
00093   residual[0] = solution[0] - alpha;
00094   residual[1] = solution[1] - beta/alpha;
00095 }

Generated on Wed May 12 21:39:32 2010 for Sacado Package Browser (Single Doxygen Collection) by  doxygen 1.4.7