Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_ExplicitModelEvaluator.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Panzer: A partial differential equation assembly
5 // engine for strongly coupled complex multiphysics systems
6 // Copyright (2011) Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Roger P. Pawlowski (rppawlo@sandia.gov) and
39 // Eric C. Cyr (eccyr@sandia.gov)
40 // ***********************************************************************
41 // @HEADER
42 
43 #ifndef PANZER_EXPLICIT_MODEL_EVALUATOR_HPP
44 #define PANZER_EXPLICIT_MODEL_EVALUATOR_HPP
45 
46 #include "PanzerDiscFE_config.hpp"
47 
48 #include "Thyra_ModelEvaluatorDelegatorBase.hpp"
49 #include "Thyra_BlockedLinearOpBase.hpp"
50 
52 
53 #ifdef PANZER_HAVE_EPETRA_STACK
55 #endif
56 
58 
59 namespace panzer {
60 
66 template<typename Scalar>
68  : public Thyra::ModelEvaluatorDelegatorBase<Scalar>,
69  public panzer::MassMatrixModelEvaluator<Scalar> {
70 public:
71 
74 
79  bool constantMassMatrix,
80  bool useLumpedMass,
81  bool applyMassInverse=true);
82 
84 
86  Thyra::ModelEvaluatorBase::InArgs<Scalar> getNominalValues() const;
87 
89  Thyra::ModelEvaluatorBase::InArgs<Scalar> createInArgs() const;
90 
92  Thyra::ModelEvaluatorBase::OutArgs<Scalar> createOutArgs() const;
93 
96 
98  {
99  Thyra::apply(*invMassMatrix_,Thyra::NOTRANS,*input,output.ptr());
100  }
101 
103  {
104  Thyra::apply(*mass_,Thyra::NOTRANS,*input,output.ptr());
105  }
106 
107 private: // data members
108 
113  const Teuchos::RCP<Thyra::VectorBase<Scalar> > & f) const
114  {
115  if(panzerModel_!=Teuchos::null) { panzerModel_->applyDirichletBCs(x,f); return; }
116 #ifdef PANZER_HAVE_EPETRA_STACK
117  if(panzerEpetraModel_!=Teuchos::null) { panzerEpetraModel_->applyDirichletBCs(x,f); return; }
118 #endif
119 
120  TEUCHOS_ASSERT(false);
121  }
122 
126  void buildInverseMassMatrix(const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs) const;
127 
129  void buildArgsPrototypes();
130 
133 
135  void evalModelImpl(const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs,
136  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
137 
139 
147  void setOneTimeDirichletBeta(double beta,const Thyra::ModelEvaluator<Scalar> & me) const;
148 
151 
154 
157 
158 #ifdef PANZER_HAVE_EPETRA_STACK
161 #endif
162 
167 
168  // build prototype in/out args
169  Thyra::ModelEvaluatorBase::InArgs<Scalar> prototypeInArgs_;
170  Thyra::ModelEvaluatorBase::OutArgs<Scalar> prototypeOutArgs_;
171 
172  // hide the default constructor
174 
175 };
176 
177 } // end namespace panzer
178 
179 #endif
virtual void applyInverseMassMatrix(const Teuchos::RCP< Thyra::MultiVectorBase< Scalar > > input, const Teuchos::RCP< Thyra::MultiVectorBase< Scalar > > output) const
Thyra::ModelEvaluatorBase::OutArgs< Scalar > prototypeOutArgs_
Thyra::ModelEvaluatorBase::InArgs< Scalar > createInArgs() const
Build the in args, modifies the underlying models in args slightly.
void buildArgsPrototypes()
Build prototype in/out args.
Thyra::ModelEvaluatorBase::InArgs< Scalar > prototypeInArgs_
Teuchos::RCP< const Thyra::LinearOpBase< Scalar > > invMassMatrix_
Teuchos::RCP< Thyra::LinearOpBase< Scalar > > mass_
Teuchos::RCP< panzer::ModelEvaluator< Scalar > > getPanzerUnderlyingModel()
Get the underlying panzer::ModelEvaluator.
Teuchos::RCP< Thyra::VectorBase< Scalar > > scrap_f_
void evalModelImpl(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const
Evaluation of model, applies the mass matrix to the RHS.
Teuchos::RCP< Thyra::VectorBase< Scalar > > zero_
Thyra::ModelEvaluatorBase::InArgs< Scalar > getNominalValues() const
Build the nominal values, modifies the underlying models in args slightly.
Ptr< T > ptr() const
void setOneTimeDirichletBeta(double beta, const Thyra::ModelEvaluator< Scalar > &me) const
Teuchos::RCP< const panzer::ModelEvaluator< Scalar > > panzerModel_
Access to the panzer model evaluator pointer (thyra version)
Thyra::ModelEvaluatorBase::OutArgs< Scalar > createOutArgs() const
Build the out args, modifies the underlying models in args slightly.
bool constantMassMatrix_
Is the mass matrix constant.
void applyDirichletBCs(const Teuchos::RCP< Thyra::VectorBase< Scalar > > &x, const Teuchos::RCP< Thyra::VectorBase< Scalar > > &f) const
#define TEUCHOS_ASSERT(assertion_test)
void buildInverseMassMatrix(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs) const
bool massLumping_
Use mass lumping, or a full solve.
virtual void applyMassMatrix(const Teuchos::RCP< Thyra::MultiVectorBase< Scalar > > input, const Teuchos::RCP< Thyra::MultiVectorBase< Scalar > > output) const