Panzer Version of the Day
Loading...
Searching...
No Matches
Panzer_ResponseEvaluatorFactory_Probe_impl.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Panzer: A partial differential equation assembly
4// engine for strongly coupled complex multiphysics systems
5//
6// Copyright 2011 NTESS and the Panzer contributors.
7// SPDX-License-Identifier: BSD-3-Clause
8// *****************************************************************************
9// @HEADER
10
11#ifndef __Panzer_ResponseEvaluatorFactory_Probe_impl_hpp__
12#define __Panzer_ResponseEvaluatorFactory_Probe_impl_hpp__
13
14#include <string>
15
16#include "PanzerDiscFE_config.hpp"
17
23
24namespace panzer {
25
26template <typename EvalT,typename LO,typename GO>
28buildResponseObject(const std::string & responseName) const
29{
30 Teuchos::RCP<ResponseBase> response = Teuchos::rcp(new Response_Probe<EvalT>(responseName,comm_,linearObjFactory_));
31 response->setRequiresDirichletAdjustment(applyDirichletToDerivative_);
32
33 return response;
34}
35
36template <typename EvalT,typename LO,typename GO>
38buildAndRegisterEvaluators(const std::string & responseName,
40 const panzer::PhysicsBlock & physicsBlock,
41 const Teuchos::ParameterList & user_data) const
42{
43 using Teuchos::RCP;
44 using Teuchos::rcp;
45
46 // build scatter evaluator
47 {
48 std::string field = (fieldName_=="" ? responseName : fieldName_);
49
50 // If blocked, pull out the local indexer for the particular field. This
51 // must resolve the field name the same way the scatter evaluator does, so
52 // that the indexer and the block it scatters into agree.
53 auto tmp_global_indexer = globalIndexer_;
54 auto blocked_dof_manager = Teuchos::rcp_dynamic_cast<const panzer::BlockedDOFManager>(globalIndexer_);
55 if (nonnull(blocked_dof_manager)) {
56 int field_number = blocked_dof_manager->getFieldNum(field);
57 TEUCHOS_TEST_FOR_EXCEPTION(field_number < 0,std::logic_error,
58 "ResponseEvaluatorFactory_Probe: field \"" << field << "\" was not "
59 "found in the blocked DOF manager.");
60 int product_vector_block_index = blocked_dof_manager->getFieldBlock(field_number);
61 tmp_global_indexer = (blocked_dof_manager->getFieldDOFManagers()[product_vector_block_index]);
62 }
63
64 Teuchos::RCP<ProbeScatterBase> scatterObj =
65 (tmp_global_indexer != Teuchos::null) ? Teuchos::rcp(new ProbeScatter<LO,GO>(tmp_global_indexer)) : Teuchos::null;
66
67 // Get basis and integration rule associated with field
68 std::vector<panzer::StrPureBasisPair> blockFields = physicsBlock.getProvidedDOFs();
69 RCP<const panzer::PureBasis> basis;
70 for (auto&& v : blockFields) {
71 if (v.first == field) {
72 basis = v.second;
73 break;
74 }
75 }
76 RCP<panzer::IntegrationRule> ir = physicsBlock.getIntegrationRules().at(cubatureDegree_);
77
78 // build useful evaluator
79 Teuchos::RCP<PHX::Evaluator<panzer::Traits> > eval
81 field,
82 fieldComponent_,
83 point_,
84 *ir,
85 basis,
86 globalIndexer_,
87 scatterObj));
88
89 this->template registerEvaluator<EvalT>(fm, eval);
90
91 // require last field
92 fm.template requireField<EvalT>(*eval->evaluatedFields()[0]);
93 }
94}
95
96template <typename EvalT,typename LO,typename GO>
98typeSupported() const
99{
100 // There is no Hessian scatter evaluator for a probe response, so Hessian is
101 // deliberately absent here; claiming it would build a response object that
102 // nothing ever fills.
103 if(PHX::print<EvalT>()==PHX::print<panzer::Traits::Residual>() ||
104 PHX::print<EvalT>()==PHX::print<panzer::Traits::Tangent>() ||
105 PHX::print<EvalT>()==PHX::print<panzer::Traits::Jacobian>()
106 )
107 return true;
108
109 return false;
110}
111
112}
113
114#endif
PHX::MDField< ScalarT, panzer::Cell, panzer::BASIS > field
A field to which we'll contribute, or in which we'll store, the result of computing this integral.
Object that contains information on the physics and discretization of a block of elements with the SA...
const std::map< int, Teuchos::RCP< panzer::IntegrationRule > > & getIntegrationRules() const
Returns the unique set of point rules, key is the unique panzer::PointRule::name()
const std::vector< StrPureBasisPair > & getProvidedDOFs() const
virtual void buildAndRegisterEvaluators(const std::string &responseName, PHX::FieldManager< panzer::Traits > &fm, const panzer::PhysicsBlock &physicsBlock, const Teuchos::ParameterList &user_data) const
virtual Teuchos::RCP< ResponseBase > buildResponseObject(const std::string &responseName) const