00001 // $Id: FEApp_HeatNonlinearSourcePDE.hpp,v 1.3.2.2 2007/08/14 00:19:05 etphipp Exp $ 00002 // $Source: /space/CVS/Trilinos/packages/sacado/example/FEApp/FEApp_HeatNonlinearSourcePDE.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 FEAPP_HEATNONLINEARSOURCEPDE_HPP 00033 #define FEAPP_HEATNONLINEARSOURCEPDE_HPP 00034 00035 #include "Teuchos_RCP.hpp" 00036 00037 #include "FEApp_AbstractPDE.hpp" 00038 #include "FEApp_SourceFunctionFactory.hpp" 00039 #include "Sacado_ScalarParameterLibrary.hpp" 00040 00041 namespace FEApp { 00042 00043 template <typename ScalarT> 00044 class HeatNonlinearSourcePDE : public FEApp::AbstractPDE<ScalarT> { 00045 public: 00046 00048 HeatNonlinearSourcePDE(const Teuchos::RCP< const FEApp::AbstractSourceFunction<ScalarT> >& src_func); 00049 00051 virtual ~HeatNonlinearSourcePDE(); 00052 00054 virtual unsigned int numEquations() const; 00055 00057 virtual void init(unsigned int numQuadPoints, unsigned int numNodes); 00058 00060 virtual void 00061 evaluateElementResidual(const FEApp::AbstractQuadrature& quadRule, 00062 const FEApp::AbstractElement& element, 00063 const std::vector<ScalarT>* dot, 00064 const std::vector<ScalarT>& solution, 00065 std::vector<ScalarT>& residual); 00066 00067 private: 00068 00070 HeatNonlinearSourcePDE(const HeatNonlinearSourcePDE&); 00071 00073 HeatNonlinearSourcePDE& operator=(const HeatNonlinearSourcePDE&); 00074 00075 protected: 00076 00078 Teuchos::RCP< const FEApp::AbstractSourceFunction<ScalarT> > source; 00079 00081 unsigned int num_qp; 00082 00084 unsigned int num_nodes; 00085 00087 std::vector< std::vector<double> > phi; 00088 00090 std::vector< std::vector<double> > dphi; 00091 00093 std::vector<double> jac; 00094 00096 std::vector<ScalarT> u; 00097 00099 std::vector<ScalarT> du; 00100 00102 std::vector<ScalarT> udot; 00103 00105 std::vector<ScalarT> f; 00106 00107 }; 00108 00109 class HeatNonlinearSourcePDE_TemplateBuilder { 00110 public: 00111 HeatNonlinearSourcePDE_TemplateBuilder( 00112 const Teuchos::RCP<Teuchos::ParameterList>& params_, 00113 const Teuchos::RCP<Sacado::ScalarParameterLibrary>& paramLib) : 00114 params(Teuchos::rcp(&(params_->sublist("Source Function")),false)), 00115 pl(paramLib) {} 00116 template <typename T> 00117 Teuchos::RCP<FEApp::AbstractPDE_NTBase> build() const { 00118 FEApp::SourceFunctionFactory<T> factory(params, pl); 00119 Teuchos::RCP< FEApp::AbstractSourceFunction<T> > source = 00120 factory.create(); 00121 return Teuchos::rcp( new FEApp::HeatNonlinearSourcePDE<T>(source)); 00122 } 00123 protected: 00124 Teuchos::RCP<Teuchos::ParameterList> params; 00125 Teuchos::RCP<Sacado::ScalarParameterLibrary> pl; 00126 }; 00127 00128 } 00129 00130 // Include implementation 00131 #ifndef SACADO_ETI 00132 #include "FEApp_HeatNonlinearSourcePDEImpl.hpp" 00133 #endif 00134 00135 #endif // FEAPP_HEATNONLINERASOURCEPDE_HPP
1.4.7