11#ifndef PANZER_BCSTRATEGY_WEAKDIRICHLET_DEFAULT_IMPL_IMPL_HPP
12#define PANZER_BCSTRATEGY_WEAKDIRICHLET_DEFAULT_IMPL_IMPL_HPP
14#include "Teuchos_ParameterList.hpp"
15#include "Teuchos_RCP.hpp"
16#include "Teuchos_Assert.hpp"
17#include "Phalanx_DataLayout_MDALayout.hpp"
18#include "Phalanx_FieldManager.hpp"
23#include "Phalanx_MDField.hpp"
24#include "Phalanx_DataLayout.hpp"
25#include "Phalanx_DataLayout_MDALayout.hpp"
30#include "Panzer_WeakDirichlet_Residual.hpp"
32#ifdef PANZER_HAVE_EPETRA_STACK
33#include "Panzer_GatherSolution_Epetra.hpp"
34#include "Panzer_ScatterResidual_Epetra.hpp"
37#include "Panzer_Normals.hpp"
40template <
typename EvalT>
43 const Teuchos::RCP<panzer::GlobalData>& global_data) :
51template <
typename EvalT>
59template <
typename EvalT>
64 const Teuchos::ParameterList& user_data)
const
66 buildAndRegisterGatherAndOrientationEvaluators(fm,pb,lof,user_data);
67 buildAndRegisterScatterEvaluators(fm,pb,lof,user_data);
71template <
typename EvalT>
76 const Teuchos::ParameterList& user_data)
const
78 using Teuchos::ParameterList;
90 for (vector<std::tuple<std::string,std::string,std::string,
int,Teuchos::RCP<panzer::PureBasis>,Teuchos::RCP<panzer::IntegrationRule> > >::const_iterator eq =
91 m_residual_contributions.begin(); eq != m_residual_contributions.end(); ++eq) {
93 const string& residual_name = std::get<0>(*eq);
94 const string& dof_name = std::get<1>(*eq);
95 const string& flux_name = std::get<2>(*eq);
97 const RCP<const panzer::PureBasis> basis = std::get<4>(*eq);
98 const RCP<const panzer::IntegrationRule> ir = std::get<5>(*eq);
104 ParameterList p(s.str());
105 p.set<std::string>(
"Name",
"Side Normal");
107 p.set< Teuchos::RCP<panzer::IntegrationRule> >(
"IR", Teuchos::rcp_const_cast<panzer::IntegrationRule>(ir));
108 p.set<
bool>(
"Normalize",
true);
112 this->
template registerEvaluator<EvalT>(fm, op);
117 ParameterList p(
"Neumann Residual: " + residual_name +
" to DOF: " + dof_name);
118 p.set(
"Residual Name", residual_name);
119 p.set(
"DOF Name",dof_name);
120 p.set(
"Flux Name", flux_name);
121 p.set(
"Normal Name",
"Side Normal");
122 p.set(
"Basis", basis);
125 RCP< PHX::Evaluator<panzer::Traits> > op =
128 this->
template registerEvaluator<EvalT>(fm, op);
135template <
typename EvalT>
140 const Teuchos::ParameterList& )
const
142 using Teuchos::ParameterList;
151 for (vector<std::tuple<std::string,std::string,std::string,
int,Teuchos::RCP<panzer::PureBasis>,Teuchos::RCP<panzer::IntegrationRule> > >::const_iterator eq =
152 m_residual_contributions.begin(); eq != m_residual_contributions.end(); ++eq) {
154 const string& residual_name = std::get<0>(*eq);
155 const string& dof_name = std::get<1>(*eq);
156 const RCP<const panzer::PureBasis> basis = std::get<4>(*eq);
157 const RCP<const panzer::IntegrationRule> ir = std::get<5>(*eq);
161 ParameterList p(
"Scatter: "+ residual_name +
" to " + dof_name);
164 string scatter_field_name =
"Dummy Scatter: " + this->m_bc.identifier() + residual_name;
165 p.set(
"Scatter Name", scatter_field_name);
166 p.set(
"Basis", basis);
168 RCP<vector<string> > residual_names = rcp(
new vector<string>);
169 residual_names->push_back(residual_name);
170 p.set(
"Dependent Names", residual_names);
172 RCP<map<string,string> > names_map = rcp(
new map<string,string>);
173 names_map->insert(std::pair<string,string>(residual_name,dof_name));
174 p.set(
"Dependent Map", names_map);
176 RCP< PHX::Evaluator<panzer::Traits> > op = lof.
buildScatter<EvalT>(p);
178 this->
template registerEvaluator<EvalT>(fm, op);
183 PHX::Tag<typename EvalT::ScalarT> tag(scatter_field_name,
184 rcp(
new PHX::MDALayout<Dummy>(0)));
185 fm.template requireField<EvalT>(tag);
194template <
typename EvalT>
198 m_required_dof_names.push_back(required_dof_name);
202template <
typename EvalT>
205 const std::string dof_name,
206 const std::string flux_name,
207 const int integration_order,
210 Teuchos::RCP<panzer::PureBasis> basis = this->getBasis(dof_name,side_pb);
212 Teuchos::RCP<panzer::IntegrationRule> ir = buildIntegrationRule(integration_order,side_pb);
214 m_residual_contributions.push_back(std::make_tuple(residual_name,
223template <
typename EvalT>
224const std::vector<std::tuple<std::string,std::string,std::string,int,Teuchos::RCP<panzer::PureBasis>,Teuchos::RCP<panzer::IntegrationRule> > >
227 return m_residual_contributions;
231template <
typename EvalT>
232Teuchos::RCP<panzer::PureBasis>
236 const std::vector<std::pair<std::string,Teuchos::RCP<panzer::PureBasis> > >& dofBasisPair = side_pb.
getProvidedDOFs();
237 Teuchos::RCP<panzer::PureBasis> basis;
238 for (std::vector<std::pair<std::string,Teuchos::RCP<panzer::PureBasis> > >::const_iterator it =
239 dofBasisPair.begin(); it != dofBasisPair.end(); ++it) {
240 if (it->first == dof_name)
244 TEUCHOS_TEST_FOR_EXCEPTION(is_null(basis), std::runtime_error,
245 "Error the name \"" << dof_name
246 <<
"\" is not a valid DOF for the boundary condition:\n"
247 << this->m_bc <<
"\n");
253template <
typename EvalT>
254Teuchos::RCP<panzer::IntegrationRule>
264template <
typename EvalT>
const panzer::BC bc() const
Returns the boundary condition data for this object.
virtual void buildAndRegisterGatherScatterEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::PhysicsBlock &side_pb, const panzer::LinearObjFactory< panzer::Traits > &lof, const Teuchos::ParameterList &user_data) const
virtual void buildAndRegisterScatterEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::PhysicsBlock &side_pb, const LinearObjFactory< panzer::Traits > &lof, const Teuchos::ParameterList &user_data) const
const std::vector< std::tuple< std::string, std::string, std::string, int, Teuchos::RCP< panzer::PureBasis >, Teuchos::RCP< panzer::IntegrationRule > > > getResidualContributionData() const
Returns information for the residual contribution integrations associated with this Neumann BC.
virtual ~BCStrategy_WeakDirichlet_DefaultImpl()
virtual void buildAndRegisterGatherAndOrientationEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::PhysicsBlock &side_pb, const LinearObjFactory< panzer::Traits > &lof, const Teuchos::ParameterList &user_data) const
Teuchos::RCP< panzer::PureBasis > getBasis(const std::string dof_name, const panzer::PhysicsBlock &side_pb) const
Finds the basis for the corresponding dof_name in the physics block.
Teuchos::RCP< panzer::IntegrationRule > buildIntegrationRule(const int integration_order, const panzer::PhysicsBlock &side_pb) const
Allocates and returns the integration rule associated with an integration order and side physics bloc...
virtual void addResidualContribution(const std::string residual_name, const std::string dof_name, const std::string flux_name, const int integration_order, const panzer::PhysicsBlock &side_pb)
Adds a residual contribution for a neumann condition to a particular equation.
BCStrategy_WeakDirichlet_DefaultImpl(const panzer::BC &bc, const Teuchos::RCP< panzer::GlobalData > &global_data)
virtual void requireDOFGather(const std::string required_dof_name)
Requires that a gather evaluator for the DOF be constructed.
Stores input information for a boundary condition.
Default implementation for accessing the GlobalData object.
Teuchos::RCP< PHX::Evaluator< Traits > > buildScatter(const Teuchos::ParameterList &pl) const
Use preconstructed scatter evaluators.
Object that contains information on the physics and discretization of a block of elements with the SA...
void buildAndRegisterGatherAndOrientationEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::LinearObjFactory< panzer::Traits > &lof, const Teuchos::ParameterList &user_data) const
const panzer::CellData & cellData() const
const std::vector< StrPureBasisPair > & getProvidedDOFs() const
Evaluates a Weak Dirichlet BC residual contribution.