11 #ifndef PANZER_MODEL_EVALUATOR_EPETRA_HPP
12 #define PANZER_MODEL_EVALUATOR_EPETRA_HPP
16 #include "Epetra_Map.h"
17 #include "Epetra_Vector.h"
18 #include "Epetra_Comm.h"
19 #include "Epetra_CrsGraph.h"
22 #include "Teuchos_AbstractFactory.hpp"
31 #include "Thyra_VectorBase.hpp"
39 class FieldManagerBuilder;
51 bool build_transient_support);
59 bool build_transient_support);
138 template <
typename ResponseEvaluatorFactory_BuilderT>
140 const std::vector<WorksetDescriptor> & wkst_desc,
141 const ResponseEvaluatorFactory_BuilderT & builder);
152 const bool write_graphviz_file=
false,
153 const std::string& graphviz_file_prefix=
"")
154 {
responseLibrary_->buildResponseEvaluators(physicsBlocks,eqset_factory,cm_factory,closure_models,user_data,write_graphviz_file,graphviz_file_prefix); }
164 const bool write_graphviz_file=
false,
165 const std::string& graphviz_file_prefix=
"")
166 {
responseLibrary_->buildResponseEvaluators(physicsBlocks,cm_factory,closure_models,user_data,write_graphviz_file,graphviz_file_prefix); }
205 void evalModel_basic(
const InArgs& inArgs,
const OutArgs& outArgs )
const;
259 std::vector<Teuchos::RCP<const Epetra_Map> >
g_map_;
263 std::vector<Teuchos::RCP<Epetra_Map> >
p_map_;
264 std::vector<Teuchos::RCP<Epetra_Vector> >
p_init_;
266 std::vector<Teuchos::RCP<Teuchos::Array<std::string> > >
p_names_;
296 template <
typename ResponseEvaluatorFactory_BuilderT>
299 const std::vector<WorksetDescriptor> & wkst_desc,
300 const ResponseEvaluatorFactory_BuilderT & builder)
304 "panzer::ModelEvaluator_Epetra::addResponse: Response with name \"" << responseName <<
"\" "
305 "cannot be added to the model evaluator because evalModel has already been called!");
312 "panzer::ModelEvaluator_Epetra::addResponse: Response with name \"" << responseName <<
"\" "
313 "has already been added to the model evaluator!");
320 "panzer::ModelEvaluator_Epetra::addResponse: Response with name \"" << responseName <<
"\" "
321 "has no residual type! Not sure what is going on!");
325 TEUCHOS_TEST_FOR_EXCEPTION(resp==Teuchos::null,std::logic_error,
326 "panzer::ModelEvaluator_Epetra::addResponse: Response with name \"" << responseName <<
"\" "
327 "resulted in bad cast to panzer::ResponseMESupportBase<Residual>, the type of the response is incompatible!");
339 if(respJacBase!=Teuchos::null) {
345 "panzer::ModelEvaluator_Epetra::addResponse: Response with name \"" << responseName <<
"\" "
346 "resulted in bad cast to panzer::ResponseMESupportBase<Jacobian>, the type of the response is incompatible!");
349 if(resp->supportsDerivative())
350 resp->setDerivative(resp->buildEpetraDerivative());
353 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
356 std::cout <<
"******************************************************" << std::endl;
357 std::cout <<
"EPETRA DOING IT " << respHesBase << std::endl;
358 std::cout <<
"******************************************************" << std::endl;
359 if(respHesBase!=Teuchos::null) {
365 "panzer::ModelEvaluator_Epetra::addResponse: Response with name \"" << responseName <<
"\" "
366 "resulted in bad cast to panzer::ResponseMESupportBase<Hessian>, the type of the response is incompatible!");
369 if(resp->supportsDerivative())
370 resp->setDerivative(resp->buildDerivative());
390 bool build_transient_support);
int addResponse(const std::string &responseName, const std::vector< WorksetDescriptor > &wkst_desc, const ResponseEvaluatorFactory_BuilderT &builder)
void applyDirichletBCs(const Teuchos::RCP< Thyra::VectorBase< double > > &x, const Teuchos::RCP< Thyra::VectorBase< double > > &f) const
void buildResponses(const std::vector< Teuchos::RCP< panzer::PhysicsBlock > > &physicsBlocks, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &cm_factory, const Teuchos::ParameterList &closure_models, const Teuchos::ParameterList &user_data, const bool write_graphviz_file=false, const std::string &graphviz_file_prefix="")
Allocates and initializes an equation set template manager.
Teuchos::RCP< const Epetra_Vector > get_p_init(int l) const
Teuchos::RCP< const Epetra_Vector > get_x_init() const
OutArgs createOutArgs() const
std::vector< std::string > g_names_
double oneTimeDirichletBeta_
void copyThyraIntoEpetra(const Thyra::VectorBase< double > &thyraVec, Epetra_MultiVector &x) const
Teuchos::RCP< ModelEvaluator_Epetra > buildEpetraME(const Teuchos::RCP< FieldManagerBuilder > &fmb, const Teuchos::RCP< ResponseLibrary< panzer::Traits > > &rLibrary, const Teuchos::RCP< LinearObjFactory< panzer::Traits > > &lof, const std::vector< Teuchos::RCP< Teuchos::Array< std::string > > > &p_names, const std::vector< Teuchos::RCP< Teuchos::Array< double > > > &p_values, const Teuchos::RCP< panzer::GlobalData > &global_data, bool build_transient_support)
Teuchos::RCP< const Epetra_Vector > get_x_dot_init() const
Teuchos::RCP< const Epetra_Map > get_p_map(int l) const
Teuchos::RCP< Epetra_Operator > create_W() const
Teuchos::RCP< Epetra_Vector > x_dot_init_
void initializeEpetraObjs(panzer::BlockedEpetraLinearObjFactory< panzer::Traits, int > &lof)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Teuchos::RCP< const Epetra_Map > get_g_map(int l) const
Teuchos::RCP< panzer::LinearObjFactory< panzer::Traits > > lof_
void evalModel_basic_dfdp(AssemblyEngineInArgs ae_inargs, const InArgs &inArgs, const OutArgs &outArgs) const
std::vector< bool > is_distributed_parameter_
void evalModel_basic_dgdx(AssemblyEngineInArgs ae_inargs, const InArgs &inArgs, const OutArgs &outArgs) const
bool required_basic_g(const OutArgs &outArgs) const
Are their required responses in the out args? g and DgDx.
Teuchos::RCP< panzer::GlobalData > global_data_
Teuchos::RCP< LinearObjContainer > ghostedContainer_
Teuchos::RCP< Teuchos::AbstractFactory< Epetra_Operator > > epetraOperatorFactory_
double get_t_init() const
void set_t_init(double t)
Set initial time value.
bool build_transient_support_
ModelEvaluator_Epetra(const Teuchos::RCP< panzer::FieldManagerBuilder > &fmb, const Teuchos::RCP< panzer::ResponseLibrary< panzer::Traits > > &rLibrary, const Teuchos::RCP< panzer::LinearObjFactory< panzer::Traits > > &lof, const std::vector< Teuchos::RCP< Teuchos::Array< std::string > > > &p_names, const std::vector< Teuchos::RCP< Teuchos::Array< double > > > &p_values, const Teuchos::RCP< panzer::GlobalData > &global_data, bool build_transient_support)
std::vector< Teuchos::RCP< const Epetra_Map > > g_map_
void buildResponses(const std::vector< Teuchos::RCP< panzer::PhysicsBlock > > &physicsBlocks, const panzer::EquationSetFactory &eqset_factory, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &cm_factory, const Teuchos::ParameterList &closure_models, const Teuchos::ParameterList &user_data, const bool write_graphviz_file=false, const std::string &graphviz_file_prefix="")
Teuchos::RCP< Epetra_Vector > dummy_f_
Teuchos::RCP< const Epetra_Map > get_x_map() const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
int addDistributedParameter(const std::string name, const Teuchos::RCP< Epetra_Map > &global_map, const Teuchos::RCP< Epetra_Import > &importer, const Teuchos::RCP< Epetra_Vector > &ghosted_vector)
bool oneTimeDirichletBeta_on_
Teuchos::RCP< panzer::ResponseLibrary< panzer::Traits > > getResponseLibrary() const
Get the response library used by this evaluator.
InArgs createInArgs() const
Teuchos::RCP< Epetra_Vector > x0_
void initializeParameterVector(const std::vector< Teuchos::RCP< Teuchos::Array< std::string > > > &p_names, const std::vector< Teuchos::RCP< Teuchos::Array< double > > > &p_values, const Teuchos::RCP< panzer::ParamLib > ¶meter_library)
panzer::AssemblyEngine_TemplateManager< panzer::Traits > ae_tm_
Teuchos::RCP< const Epetra_Map > map_x_
void evalModel(const InArgs &inArgs, const OutArgs &outArgs) const
Teuchos::RCP< panzer::ResponseLibrary< panzer::Traits > > responseLibrary_
bool required_basic_dfdp(const OutArgs &outArgs) const
Are derivatives of the residual with respect to the parameters in the out args? DfDp.
std::vector< Teuchos::RCP< Epetra_Vector > > p_init_
std::vector< std::tuple< std::string, int, Teuchos::RCP< Epetra_Import >, Teuchos::RCP< Epetra_Vector > > > distributed_parameter_container_
void evalModel_basic(const InArgs &inArgs, const OutArgs &outArgs) const
for evaluation and handling of normal quantities, x,f,W, etc
Teuchos::Array< panzer::ParamVec > parameter_vector_
std::vector< Teuchos::RCP< Teuchos::Array< std::string > > > p_names_
Teuchos::RCP< panzer::FieldManagerBuilder > fmb_
Teuchos::RCP< const Epetra_Map > get_f_map() const
void evalModel_basic_g(AssemblyEngineInArgs ae_inargs, const InArgs &inArgs, const OutArgs &outArgs) const
void copyEpetraIntoThyra(const Epetra_MultiVector &x, const Teuchos::Ptr< Thyra::VectorBase< double > > &thyraVec) const
bool required_basic_dgdx(const OutArgs &outArgs) const
Are their required responses in the out args? DgDx.
std::vector< Teuchos::RCP< Epetra_Map > > p_map_
Teuchos::RCP< const Teuchos::Array< std::string > > get_p_names(int l) const
void setOneTimeDirichletBeta(const double &beta) const