FEApp_Application.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 #ifndef FEAPP_APPLICATION_HPP
00033 #define FEAPP_APPLICATION_HPP
00034 
00035 #include <vector>
00036 
00037 #include "Teuchos_RCP.hpp"
00038 #include "Teuchos_ParameterList.hpp"
00039 #include "Teuchos_SerialDenseMatrix.hpp"
00040 #include "Epetra_Vector.h"
00041 #include "Epetra_CrsMatrix.h"
00042 #include "Epetra_Import.h"
00043 #include "Epetra_Export.h"
00044 
00045 #include "FEApp_NodeBC.hpp"
00046 #include "FEApp_AbstractPDE.hpp"
00047 #include "FEApp_AbstractQuadrature.hpp"
00048 #include "FEApp_AbstractDiscretization.hpp"
00049 #include "FEApp_AbstractProblem.hpp"
00050 #include "FEApp_GlobalFill.hpp"
00051 #include "FEApp_TemplateTypes.hpp"
00052 #include "FEApp_InitPostOps.hpp"
00053 
00054 #include "Sacado_ScalarParameterLibrary.hpp"
00055 #include "Sacado_ScalarParameterVector.hpp"
00056 
00057 #if SG_ACTIVE
00058 #include "EpetraExt_BlockVector.h"
00059 #include "EpetraExt_BlockCrsMatrix.h"
00060 #include "Stokhos_OrthogPolyBasis.hpp"
00061 #include "Stokhos_Quadrature.hpp"
00062 #include "Stokhos_VectorOrthogPoly.hpp"
00063 #include "Stokhos_VectorOrthogPolyTraitsEpetra.hpp"
00064 #endif
00065 
00066 namespace FEApp {
00067 
00068   class Application {
00069   public:
00070 
00072     Application(const std::vector<double>& coords,
00073     const Teuchos::RCP<const Epetra_Comm>& comm,
00074     const Teuchos::RCP<Teuchos::ParameterList>& params,
00075     bool is_transient,
00076     const Epetra_Vector* initial_soln = NULL);
00077 
00079     ~Application();
00080 
00082     Teuchos::RCP<const Epetra_Map> getMap() const;
00083 
00085     Teuchos::RCP<const Epetra_Map> getResponseMap() const;
00086 
00088     Teuchos::RCP<const Epetra_CrsGraph> getJacobianGraph() const;
00089 
00091     Teuchos::RCP<const Epetra_Vector> getInitialSolution() const;
00092 
00094     Teuchos::RCP<ParamLib> getParamLib();
00095 
00097     bool isTransient() const;
00098 
00100     Teuchos::RCP<Epetra_Operator> createW() const;
00101 
00103     Teuchos::RCP<Epetra_Operator> createPrec() const;
00104 
00106 
00109     void computeGlobalResidual(
00110           const Epetra_Vector* xdot,
00111           const Epetra_Vector& x,
00112           const Teuchos::Array< Teuchos::RCP<ParamVec> >& p,
00113           Epetra_Vector& f);
00114 
00116 
00119     void computeGlobalJacobian(
00120        double alpha, double beta,
00121        const Epetra_Vector* xdot,
00122        const Epetra_Vector& x,
00123        const Teuchos::Array< Teuchos::RCP<ParamVec> >& p,
00124        Epetra_Vector* f,
00125        Epetra_Operator& jac);
00126     
00128 
00131     void computeGlobalPreconditioner(
00132           double alpha, double beta,
00133           const Epetra_Vector* xdot,
00134           const Epetra_Vector& x,
00135           const Teuchos::Array< Teuchos::RCP<ParamVec> >& p,
00136           Epetra_Vector* f,
00137           Epetra_Operator& jac);
00138     
00140 
00143     void computeGlobalTangent(double alpha, double beta,
00144                               bool sum_derivs,
00145                               const Epetra_Vector* xdot,
00146                               const Epetra_Vector& x,
00147             const Teuchos::Array< Teuchos::RCP<ParamVec> >& p,
00148                               ParamVec* deriv_p,
00149                               const Epetra_MultiVector* Vx,
00150                               const Teuchos::SerialDenseMatrix<int,double>* Vp,
00151                               Epetra_Vector* f,
00152                               Epetra_MultiVector* JVx,
00153                               Epetra_MultiVector* fVp);
00154 
00156 
00159     void 
00160     evaluateResponses(const Epetra_Vector* xdot,
00161                       const Epetra_Vector& x,
00162                       const Teuchos::Array< Teuchos::RCP<ParamVec> >& p,
00163                       Epetra_Vector& g);
00164 
00166 
00169     void 
00170     evaluateResponseTangents(
00171      const Epetra_Vector* xdot,
00172      const Epetra_Vector& x,
00173      const Teuchos::Array< Teuchos::RCP<ParamVec> >& p,
00174      const Teuchos::Array< Teuchos::RCP<ParamVec> >& deriv_p,
00175      const Teuchos::Array< Teuchos::RCP<Epetra_MultiVector> >& dxdot_dp,
00176      const Teuchos::Array< Teuchos::RCP<Epetra_MultiVector> >& dx_dp,
00177      Epetra_Vector* g,
00178      const Teuchos::Array< Teuchos::RCP<Epetra_MultiVector> >& gt);
00179 
00181 
00184     void 
00185     evaluateResponseGradients(
00186       const Epetra_Vector* xdot,
00187       const Epetra_Vector& x,
00188       const Teuchos::Array< Teuchos::RCP<ParamVec> >& p,
00189       const Teuchos::Array< Teuchos::RCP<ParamVec> >& deriv_p,
00190       Epetra_Vector* g,
00191       Epetra_MultiVector* dg_dx,
00192       Epetra_MultiVector* dg_dxdot,
00193       const Teuchos::Array< Teuchos::RCP<Epetra_MultiVector> >& dg_dp);
00194 
00195 #if SG_ACTIVE
00196 
00197     Teuchos::RCP<Stokhos::OrthogPolyExpansion<int,double> >
00198     getStochasticExpansion() { return sg_expansion; }
00199 
00201 
00204     void computeGlobalSGResidual(
00205             const Stokhos::VectorOrthogPoly<Epetra_Vector>* sg_xdot,
00206       const Stokhos::VectorOrthogPoly<Epetra_Vector>& sg_x,
00207       const ParamVec* p,
00208       const ParamVec* sg_p,
00209       const Teuchos::Array<SGType>* sg_p_vals,
00210       Stokhos::VectorOrthogPoly<Epetra_Vector>& sg_f);
00211 
00213 
00216     void computeGlobalSGJacobian(
00217       double alpha, double beta,
00218       const Stokhos::VectorOrthogPoly<Epetra_Vector>* sg_xdot,
00219       const Stokhos::VectorOrthogPoly<Epetra_Vector>& sg_x,
00220       const ParamVec* p,
00221       const ParamVec* sg_p,
00222       const Teuchos::Array<SGType>* sg_p_vals,
00223       Stokhos::VectorOrthogPoly<Epetra_Vector>* sg_f,
00224       Stokhos::VectorOrthogPoly<Epetra_Operator>& sg_jac);
00225 
00227 
00230     void 
00231     evaluateSGResponses(const Stokhos::VectorOrthogPoly<Epetra_Vector>* sg_xdot,
00232       const Stokhos::VectorOrthogPoly<Epetra_Vector>& sg_x,
00233       const ParamVec* p,
00234       const ParamVec* sg_p,
00235       const Teuchos::Array<SGType>* sg_p_vals,
00236       Stokhos::VectorOrthogPoly<Epetra_Vector>& sg_g);
00237 
00238 #endif
00239 
00240   private:
00241     
00243     Application(const Application&);
00244 
00246     Application& operator=(const Application&);
00247 
00248   protected:
00249 
00251     Teuchos::RCP<Teuchos::ParameterList> params;
00252 
00254     bool transient;
00255     
00257     Teuchos::RCP<FEApp::AbstractDiscretization> disc;
00258 
00260     std::vector< Teuchos::RCP<FEApp::NodeBC> > bc;
00261 
00263     Teuchos::RCP<const FEApp::AbstractQuadrature> quad;
00264 
00266     FEApp::AbstractPDE_TemplateManager<EvalTypes> pdeTM;
00267 
00269     Teuchos::RCP<Epetra_Vector> initial_x;
00270 
00272     Teuchos::RCP<Epetra_Import> importer;
00273 
00275     Teuchos::RCP<Epetra_Export> exporter;
00276 
00278     Teuchos::RCP<Epetra_Vector> overlapped_x;
00279 
00281     Teuchos::RCP<Epetra_Vector> overlapped_xdot;
00282 
00284     Teuchos::RCP<Epetra_Vector> overlapped_f;
00285 
00287     Teuchos::RCP<Epetra_CrsMatrix> overlapped_jac;
00288 
00290     Teuchos::RCP<ParamLib> paramLib;
00291 
00293     std::vector< Teuchos::RCP<FEApp::AbstractResponseFunction> > responses;
00294 
00296     Teuchos::RCP<Epetra_Map> response_map;
00297 
00298 #if SG_ACTIVE
00299 
00301     Teuchos::RCP<const Stokhos::OrthogPolyBasis<int,double> > sg_basis;
00302 
00304     Teuchos::RCP<const Stokhos::Quadrature<int,double> > sg_quad;
00305 
00307     Teuchos::RCP<Stokhos::OrthogPolyExpansion<int,double> > sg_expansion;
00308 
00310     Teuchos::RCP< Stokhos::VectorOrthogPoly<Epetra_Vector> >  sg_overlapped_x;
00311 
00313     Teuchos::RCP< Stokhos::VectorOrthogPoly<Epetra_Vector> > sg_overlapped_xdot;
00314 
00316     Teuchos::RCP< Stokhos::VectorOrthogPoly<Epetra_Vector> > sg_overlapped_f;
00317 
00319     Teuchos::RCP< Stokhos::VectorOrthogPoly<Epetra_CrsMatrix> > sg_overlapped_jac;
00320 
00322     Teuchos::RCP< FEApp::GlobalFill<FEApp::SGResidualType> > sg_res_global_fill;
00323 
00325     Teuchos::RCP< FEApp::GlobalFill<FEApp::SGJacobianType> > sg_jac_global_fill;
00326 
00327 #endif
00328 
00329   };
00330 
00331 }
00332 
00333 #endif // FEAPP_APPLICATION_HPP

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