FEApp_Application.hpp

Go to the documentation of this file.
00001 // $Id: FEApp_Application.hpp,v 1.8 2008/08/01 22:57:12 etphipp Exp $ 
00002 // $Source: /space/CVS/Trilinos/packages/sacado/example/FEApp/FEApp_Application.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_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_TemplateTypes.hpp"
00051 #include "FEApp_InitPostOps.hpp"
00052 
00053 #include "Sacado_ScalarParameterLibrary.hpp"
00054 #include "Sacado_ScalarParameterVector.hpp"
00055 
00056 #if SG_ACTIVE
00057 #include "EpetraExt_BlockVector.h"
00058 #include "EpetraExt_BlockCrsMatrix.h"
00059 #include "Stokhos_OrthogPolyBasis.hpp"
00060 #include "FEApp_BlockDiscretization.hpp"
00061 #endif
00062 
00063 #if SGFAD_ACTIVE
00064 #include "Stokhos_TripleProduct.hpp"
00065 #endif
00066 
00067 namespace FEApp {
00068 
00069   class Application {
00070   public:
00071 
00073     Application(const std::vector<double>& coords,
00074     const Teuchos::RCP<const Epetra_Comm>& comm,
00075     const Teuchos::RCP<Teuchos::ParameterList>& params,
00076     bool is_transient);
00077 
00079     ~Application();
00080 
00082     Teuchos::RCP<const Epetra_Map> getMap() const;
00083 
00085     Teuchos::RCP<const Epetra_CrsGraph> getJacobianGraph() const;
00086 
00088     Teuchos::RCP<const Epetra_Vector> getInitialSolution() const;
00089 
00091     Teuchos::RCP<Sacado::ScalarParameterLibrary> getParamLib();
00092 
00094     bool isTransient() const;
00095 
00097     Teuchos::RCP<Epetra_Operator> createW() const;
00098 
00100     Teuchos::RCP<Epetra_Operator> createPrec() const;
00101 
00103 
00106     void computeGlobalResidual(const Epetra_Vector* xdot,
00107              const Epetra_Vector& x,
00108              const Sacado::ScalarParameterVector* p,
00109              Epetra_Vector& f);
00110 
00112 
00115     void computeGlobalJacobian(double alpha, double beta,
00116              const Epetra_Vector* xdot,
00117              const Epetra_Vector& x,
00118              const Sacado::ScalarParameterVector* p,
00119              Epetra_Vector* f,
00120              Epetra_Operator& jac);
00121 
00123 
00126     void computeGlobalPreconditioner(double alpha, double beta,
00127              const Epetra_Vector* xdot,
00128              const Epetra_Vector& x,
00129              const Sacado::ScalarParameterVector* p,
00130              Epetra_Vector* f,
00131              Epetra_Operator& jac);
00132     
00134 
00137     void computeGlobalTangent(double alpha, double beta,
00138             bool sum_derivs,
00139             const Epetra_Vector* xdot,
00140             const Epetra_Vector& x,
00141             Sacado::ScalarParameterVector* p,
00142             const Epetra_MultiVector* Vx,
00143             const Teuchos::SerialDenseMatrix<int,double>* Vp,
00144             Epetra_Vector* f,
00145             Epetra_MultiVector* JVx,
00146             Epetra_MultiVector* fVp);
00147 
00149 
00152     void computeGlobalSGResidual(const Epetra_Vector* sg_xdot,
00153          const Epetra_Vector& sg_x,
00154          const Sacado::ScalarParameterVector* p,
00155          Epetra_Vector& sg_f);
00156 
00158 
00161     void computeGlobalSGJacobian(double alpha, double beta,
00162          const Epetra_Vector* sg_xdot,
00163          const Epetra_Vector& sg_x,
00164          const Sacado::ScalarParameterVector* p,
00165          Epetra_Vector* sg_f,
00166          Epetra_Operator& sg_jac); 
00167 
00169 
00172     void computeGlobalSGPreconditioner(double alpha, double beta,
00173                const Epetra_Vector* sg_xdot,
00174                const Epetra_Vector& sg_x,
00175                const Sacado::ScalarParameterVector* p,
00176                Epetra_Vector* sg_f,
00177                Epetra_Operator& sg_jac); 
00178 
00179   private:
00180     
00182     Application(const Application&);
00183 
00185     Application& operator=(const Application&);
00186 
00187   protected:
00188 
00190     bool transient;
00191     
00193     Teuchos::RCP<FEApp::AbstractDiscretization> disc;
00194 
00196     std::vector< Teuchos::RCP<FEApp::NodeBC> > bc;
00197 
00199     Teuchos::RCP<const FEApp::AbstractQuadrature> quad;
00200 
00202     FEApp::AbstractPDE_TemplateManager<ValidTypes> pdeTM;
00203 
00205     Teuchos::RCP<Epetra_Vector> initial_x;
00206 
00208     Teuchos::RCP<Epetra_Import> importer;
00209 
00211     Teuchos::RCP<Epetra_Export> exporter;
00212 
00214     Teuchos::RCP<Epetra_Vector> overlapped_x;
00215 
00217     Teuchos::RCP<Epetra_Vector> overlapped_xdot;
00218 
00220     Teuchos::RCP<Epetra_Vector> overlapped_f;
00221 
00223     Teuchos::RCP<Epetra_CrsMatrix> overlapped_jac;
00224 
00226     Teuchos::RCP<Sacado::ScalarParameterLibrary> paramLib;
00227 
00229     bool enable_sg;
00230 
00231 #if SG_ACTIVE
00232 
00234     std::string sg_solver_method;
00235 
00237     Teuchos::RCP<const Stokhos::OrthogPolyBasis<double> > sg_basis;
00238 
00239      typedef SGType::expansion_type::tp_type tp_type;
00241     Teuchos::RCP<const tp_type> Cijk;
00242 
00244     Teuchos::RCP<FEApp::BlockDiscretization> sg_disc;
00245 
00247     Teuchos::RCP<EpetraExt::BlockVector> sg_initial_x;
00248 
00250     Teuchos::RCP<Epetra_Import> sg_importer;
00251 
00253     Teuchos::RCP<Epetra_Export> sg_exporter;
00254 
00256     Teuchos::RCP<EpetraExt::BlockVector> sg_overlapped_x;
00257 
00259     Teuchos::RCP<EpetraExt::BlockVector> sg_overlapped_xdot;
00260 
00262     Teuchos::RCP<EpetraExt::BlockVector> sg_overlapped_f;
00263 
00265     Teuchos::RCP<EpetraExt::BlockCrsMatrix> sg_overlapped_jac;
00266 
00268     Teuchos::RCP<FEApp::SGResidualOp> sg_res_fill_op;
00269 
00271     Teuchos::RCP<FEApp::SGJacobianOp> sg_full_jac_fill_op;
00272 
00274     Teuchos::RCP<FEApp::SGMatrixFreeJacobianOp> sg_mf_jac_fill_op;
00275 
00277     Teuchos::RCP<Teuchos::ParameterList> precParams;
00278 
00279 #endif
00280 
00281   };
00282 
00283 }
00284 
00285 #endif // FEAPP_APPLICATION_HPP

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