43 #ifndef PANZER_MODEL_EVALUATOR_EPETRA_HPP
44 #define PANZER_MODEL_EVALUATOR_EPETRA_HPP
48 #include "Epetra_Map.h"
49 #include "Epetra_Vector.h"
50 #include "Epetra_Comm.h"
51 #include "Epetra_CrsGraph.h"
54 #include "Teuchos_AbstractFactory.hpp"
63 #include "Thyra_VectorBase.hpp"
71 class FieldManagerBuilder;
83 bool build_transient_support);
91 bool build_transient_support);
170 template <
typename ResponseEvaluatorFactory_BuilderT>
172 const std::vector<WorksetDescriptor> & wkst_desc,
173 const ResponseEvaluatorFactory_BuilderT & builder);
184 const bool write_graphviz_file=
false,
185 const std::string& graphviz_file_prefix=
"")
186 {
responseLibrary_->buildResponseEvaluators(physicsBlocks,eqset_factory,cm_factory,closure_models,user_data,write_graphviz_file,graphviz_file_prefix); }
196 const bool write_graphviz_file=
false,
197 const std::string& graphviz_file_prefix=
"")
198 {
responseLibrary_->buildResponseEvaluators(physicsBlocks,cm_factory,closure_models,user_data,write_graphviz_file,graphviz_file_prefix); }
237 void evalModel_basic(
const InArgs& inArgs,
const OutArgs& outArgs )
const;
291 std::vector<Teuchos::RCP<const Epetra_Map> >
g_map_;
295 std::vector<Teuchos::RCP<Epetra_Map> >
p_map_;
296 std::vector<Teuchos::RCP<Epetra_Vector> >
p_init_;
298 std::vector<Teuchos::RCP<Teuchos::Array<std::string> > >
p_names_;
328 template <
typename ResponseEvaluatorFactory_BuilderT>
331 const std::vector<WorksetDescriptor> & wkst_desc,
332 const ResponseEvaluatorFactory_BuilderT & builder)
336 "panzer::ModelEvaluator_Epetra::addResponse: Response with name \"" << responseName <<
"\" "
337 "cannot be added to the model evaluator because evalModel has already been called!");
344 "panzer::ModelEvaluator_Epetra::addResponse: Response with name \"" << responseName <<
"\" "
345 "has already been added to the model evaluator!");
352 "panzer::ModelEvaluator_Epetra::addResponse: Response with name \"" << responseName <<
"\" "
353 "has no residual type! Not sure what is going on!");
357 TEUCHOS_TEST_FOR_EXCEPTION(resp==Teuchos::null,std::logic_error,
358 "panzer::ModelEvaluator_Epetra::addResponse: Response with name \"" << responseName <<
"\" "
359 "resulted in bad cast to panzer::ResponseMESupportBase<Residual>, the type of the response is incompatible!");
371 if(respJacBase!=Teuchos::null) {
377 "panzer::ModelEvaluator_Epetra::addResponse: Response with name \"" << responseName <<
"\" "
378 "resulted in bad cast to panzer::ResponseMESupportBase<Jacobian>, the type of the response is incompatible!");
381 if(resp->supportsDerivative())
382 resp->setDerivative(resp->buildEpetraDerivative());
385 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
388 std::cout <<
"******************************************************" << std::endl;
389 std::cout <<
"EPETRA DOING IT " << respHesBase << std::endl;
390 std::cout <<
"******************************************************" << std::endl;
391 if(respHesBase!=Teuchos::null) {
397 "panzer::ModelEvaluator_Epetra::addResponse: Response with name \"" << responseName <<
"\" "
398 "resulted in bad cast to panzer::ResponseMESupportBase<Hessian>, the type of the response is incompatible!");
401 if(resp->supportsDerivative())
402 resp->setDerivative(resp->buildDerivative());
422 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