FEApp_InitPostOps.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_INITPOSTOPS_HPP
00033 #define FEAPP_INITPOSTOPS_HPP
00034 
00035 #include "Teuchos_RCP.hpp"
00036 #include "Teuchos_SerialDenseMatrix.hpp"
00037 #include "Epetra_Vector.h"
00038 #include "Epetra_CrsMatrix.h"
00039 
00040 #include "FEApp_AbstractInitPostOp.hpp"
00041 #include "FEApp_TemplateTypes.hpp"
00042 #include "Sacado_ScalarParameterVector.hpp"
00043 
00044 #if SG_ACTIVE
00045 #include "Stokhos_VectorOrthogPoly.hpp"
00046 #include "Stokhos_VectorOrthogPolyTraitsEpetra.hpp"
00047 #endif
00048 
00049 namespace FEApp {
00050 
00052   class ResidualOp : public FEApp::AbstractInitPostOp<FEApp::ResidualType> {
00053   public:
00054     
00056 
00059     ResidualOp(const Teuchos::RCP<const Epetra_Vector>& overlapped_xdot,
00060                const Teuchos::RCP<const Epetra_Vector>& overlapped_x,
00061                const Teuchos::RCP<Epetra_Vector>& overlapped_f);
00062 
00064     virtual ~ResidualOp();
00065     
00067     virtual void elementInit(const FEApp::AbstractElement& e,
00068                              unsigned int neqn,
00069                              std::vector<double>* elem_xdot,
00070                              std::vector<double>& elem_x);
00071 
00073     virtual void elementPost(const FEApp::AbstractElement& e,
00074                              unsigned int neqn,
00075                              std::vector<double>& elem_f);
00076 
00078     virtual void nodeInit(const FEApp::NodeBC& bc,
00079                           unsigned int neqn,
00080                           std::vector<double>* node_xdot,
00081                           std::vector<double>& node_x);
00082 
00084     virtual void nodePost(const FEApp::NodeBC& bc,
00085                           unsigned int neqn,
00086                           std::vector<double>& node_f);
00087 
00089     virtual void finalizeFill() {}
00090 
00091   private:
00092     
00094     ResidualOp(const ResidualOp&);
00095 
00097     ResidualOp& operator=(const ResidualOp&);
00098 
00099   protected:
00100 
00102     Teuchos::RCP<const Epetra_Vector> xdot;
00103 
00105     Teuchos::RCP<const Epetra_Vector> x;
00106 
00108     Teuchos::RCP<Epetra_Vector> f;
00109 
00110   };
00111 
00113   class JacobianOp : 
00114     public FEApp::AbstractInitPostOp<FEApp::JacobianType> {
00115   public:
00116 
00118 
00121     JacobianOp(double alpha, double beta,
00122                const Teuchos::RCP<const Epetra_Vector>& overlapped_xdot,
00123                const Teuchos::RCP<const Epetra_Vector>& overlapped_x,
00124                const Teuchos::RCP<Epetra_Vector>& overlapped_f,
00125                const Teuchos::RCP<Epetra_CrsMatrix>& overlapped_jac);
00126 
00128     virtual ~JacobianOp();
00129 
00131     virtual void elementInit(const FEApp::AbstractElement& e,
00132                              unsigned int neqn,
00133                              std::vector< FadType >* elem_xdot,
00134                              std::vector< FadType >& elem_x);
00135 
00137     virtual void elementPost(const FEApp::AbstractElement& e,
00138                              unsigned int neqn,
00139                              std::vector< FadType >& elem_f);
00140 
00142     virtual void nodeInit(const FEApp::NodeBC& bc,
00143                           unsigned int neqn,
00144                           std::vector< FadType >* node_xdot,
00145                           std::vector< FadType >& node_x);
00146 
00148     virtual void nodePost(const FEApp::NodeBC& bc,
00149                           unsigned int neqn,
00150                           std::vector< FadType >& node_f);
00151 
00153     virtual void finalizeFill() {}
00154 
00155   private:
00156     
00158     JacobianOp(const JacobianOp&);
00159     
00161     JacobianOp& operator=(const JacobianOp&);
00162 
00163   protected:
00164 
00166     double m_coeff;
00167 
00169     double j_coeff;
00170 
00172     Teuchos::RCP<const Epetra_Vector> xdot;
00173 
00175     Teuchos::RCP<const Epetra_Vector> x;
00176 
00178     Teuchos::RCP<Epetra_Vector> f;
00179 
00181     Teuchos::RCP<Epetra_CrsMatrix> jac;
00182 
00183   };
00184 
00189   class TangentOp : 
00190     public FEApp::AbstractInitPostOp<FEApp::TangentType> {
00191   public:
00192 
00194 
00197     TangentOp(
00198          double alpha, double beta, bool sum_derivs,
00199          const Teuchos::RCP<const Epetra_Vector>& overlapped_xdot,
00200          const Teuchos::RCP<const Epetra_Vector>& overlapped_x,
00201          const Teuchos::RCP<ParamVec>& p,
00202          const Teuchos::RCP<const Epetra_MultiVector>& overlapped_Vx,
00203          const Teuchos::RCP<const Epetra_MultiVector>& overlapped_Vxdot,
00204          const Teuchos::RCP<const Teuchos::SerialDenseMatrix<int,double> >& Vp,
00205          const Teuchos::RCP<Epetra_Vector>& overlapped_f,
00206          const Teuchos::RCP<Epetra_MultiVector>& overlapped_JV,
00207          const Teuchos::RCP<Epetra_MultiVector>& overlapped_fp);
00208 
00210     virtual ~TangentOp();
00211 
00213     virtual void elementInit(const FEApp::AbstractElement& e,
00214                              unsigned int neqn,
00215                              std::vector< FadType >* elem_xdot,
00216                              std::vector< FadType >& elem_x);
00217 
00219     virtual void elementPost(const FEApp::AbstractElement& e,
00220                              unsigned int neqn,
00221                              std::vector< FadType >& elem_f);
00222 
00224     virtual void nodeInit(const FEApp::NodeBC& bc,
00225                           unsigned int neqn,
00226                           std::vector< FadType >* node_xdot,
00227                           std::vector< FadType >& node_x);
00228 
00230     virtual void nodePost(const FEApp::NodeBC& bc,
00231                           unsigned int neqn,
00232                           std::vector< FadType >& node_f);
00233 
00235     virtual void finalizeFill() {}
00236 
00237   private:
00238     
00240     TangentOp(const TangentOp&);
00241     
00243     TangentOp& operator=(const TangentOp&);
00244 
00245   protected:
00246 
00248     double m_coeff;
00249 
00251     double j_coeff;
00252 
00254     bool sum_derivs;
00255 
00257     Teuchos::RCP<const Epetra_Vector> xdot;
00258 
00260     Teuchos::RCP<const Epetra_Vector> x;
00261 
00263     Teuchos::RCP<ParamVec> params;
00264 
00266     Teuchos::RCP<const Epetra_MultiVector> Vx;
00267 
00269     Teuchos::RCP<const Epetra_MultiVector> Vxdot;
00270 
00272     Teuchos::RCP<const Teuchos::SerialDenseMatrix<int,double> > Vp;
00273 
00275     Teuchos::RCP<Epetra_Vector> f;
00276 
00278     Teuchos::RCP<Epetra_MultiVector> JV;
00279     
00281     Teuchos::RCP<Epetra_MultiVector> fp;
00282 
00284     int num_cols_x;
00285 
00287     int num_cols_p;
00288 
00290     int num_cols_tot;
00291 
00293     int param_offset;
00294 
00295   };
00296 
00297 #if SG_ACTIVE
00298 
00300   class SGResidualOp : 
00301     public FEApp::AbstractInitPostOp<FEApp::SGResidualType> {
00302   public:
00303     
00305 
00308     SGResidualOp(
00309     const Teuchos::RCP< Stokhos::OrthogPolyExpansion<int,double> >& expansion,
00310     const Teuchos::RCP<const Stokhos::VectorOrthogPoly<Epetra_Vector> >& xdot,
00311     const Teuchos::RCP<const Stokhos::VectorOrthogPoly<Epetra_Vector> >& x,
00312     const Teuchos::RCP< Stokhos::VectorOrthogPoly<Epetra_Vector> >& f);
00313 
00315     virtual ~SGResidualOp();
00316     
00318     virtual void elementInit(const FEApp::AbstractElement& e,
00319                              unsigned int neqn,
00320                              std::vector<SGType>* elem_xdot,
00321                              std::vector<SGType>& elem_x);
00322 
00324     virtual void elementPost(const FEApp::AbstractElement& e,
00325                              unsigned int neqn,
00326                              std::vector<SGType>& elem_f);
00327 
00329     virtual void nodeInit(const FEApp::NodeBC& bc,
00330                           unsigned int neqn,
00331                           std::vector<SGType>* node_xdot,
00332                           std::vector<SGType>& node_x);
00333 
00335     virtual void nodePost(const FEApp::NodeBC& bc,
00336                           unsigned int neqn,
00337                           std::vector<SGType>& node_f);
00338 
00340     virtual void finalizeFill();
00341 
00342   private:
00343     
00345     SGResidualOp(const SGResidualOp&);
00346 
00348     SGResidualOp& operator=(const SGResidualOp&);
00349 
00350   protected:
00351 
00353     Teuchos::RCP< Stokhos::OrthogPolyExpansion<int,double> > expansion;
00354 
00356     int nblock;
00357 
00359     Teuchos::RCP<const Stokhos::VectorOrthogPoly<Epetra_Vector> > xdot;
00360 
00362     Teuchos::RCP<const Stokhos::VectorOrthogPoly<Epetra_Vector> > x;
00363 
00365     Teuchos::RCP< Stokhos::VectorOrthogPoly<Epetra_Vector> > f;
00366 
00367   };
00368 
00370   class SGJacobianOp : 
00371     public FEApp::AbstractInitPostOp<FEApp::SGJacobianType> {
00372   public:
00373 
00375 
00378     SGJacobianOp(
00379     const Teuchos::RCP< Stokhos::OrthogPolyExpansion<int,double> >& expansion,
00380     double alpha, double beta,
00381     const Teuchos::RCP<const Stokhos::VectorOrthogPoly<Epetra_Vector> >& xdot,
00382     const Teuchos::RCP<const Stokhos::VectorOrthogPoly<Epetra_Vector> >& x,
00383     const Teuchos::RCP< Stokhos::VectorOrthogPoly<Epetra_Vector> >& f,
00384     const Teuchos::RCP< Stokhos::VectorOrthogPoly<Epetra_CrsMatrix> >& jac);
00385 
00387     virtual ~SGJacobianOp();
00388 
00390     virtual void elementInit(const FEApp::AbstractElement& e,
00391                              unsigned int neqn,
00392                              std::vector< SGFadType >* elem_xdot,
00393                              std::vector< SGFadType >& elem_x);
00394 
00396     virtual void elementPost(const FEApp::AbstractElement& e,
00397                              unsigned int neqn,
00398                              std::vector< SGFadType >& elem_f);
00399 
00401     virtual void nodeInit(const FEApp::NodeBC& bc,
00402                           unsigned int neqn,
00403                           std::vector< SGFadType >* node_xdot,
00404                           std::vector< SGFadType >& node_x);
00405 
00407     virtual void nodePost(const FEApp::NodeBC& bc,
00408                           unsigned int neqn,
00409                           std::vector< SGFadType >& node_f);
00410 
00412     virtual void finalizeFill();
00413 
00414   private:
00415     
00417     SGJacobianOp(const SGJacobianOp&);
00418     
00420     SGJacobianOp& operator=(const SGJacobianOp&);
00421 
00422   protected:
00423     
00425     Teuchos::RCP< Stokhos::OrthogPolyExpansion<int,double> > expansion;
00426 
00428     int nblock;
00429 
00431     double m_coeff;
00432 
00434     double j_coeff;
00435 
00437     Teuchos::RCP<const Stokhos::VectorOrthogPoly<Epetra_Vector> > xdot;
00438 
00440     Teuchos::RCP<const Stokhos::VectorOrthogPoly<Epetra_Vector> > x;
00441 
00443     Teuchos::RCP< Stokhos::VectorOrthogPoly<Epetra_Vector> > f;
00444 
00446     Teuchos::RCP< Stokhos::VectorOrthogPoly<Epetra_CrsMatrix> > jac;
00447 
00448   };
00449 
00450 #endif // SG_ACTIVE
00451 
00452 }
00453 
00454 #endif // FEAPP_INITPOSTOPS_HPP

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