43 #ifndef PANZER_BCSTRATEGY_WEAKDIRICHLET_DEFAULT_IMPL_IMPL_HPP
44 #define PANZER_BCSTRATEGY_WEAKDIRICHLET_DEFAULT_IMPL_IMPL_HPP
46 #include "Teuchos_ParameterList.hpp"
47 #include "Teuchos_RCP.hpp"
48 #include "Teuchos_Assert.hpp"
49 #include "Phalanx_DataLayout_MDALayout.hpp"
50 #include "Phalanx_FieldManager.hpp"
55 #include "Phalanx_MDField.hpp"
56 #include "Phalanx_DataLayout.hpp"
57 #include "Phalanx_DataLayout_MDALayout.hpp"
62 #include "Panzer_WeakDirichlet_Residual.hpp"
63 #include "Panzer_GatherSolution_Epetra.hpp"
64 #include "Panzer_ScatterResidual_Epetra.hpp"
65 #include "Panzer_Normals.hpp"
68 template <
typename EvalT>
71 const Teuchos::RCP<panzer::GlobalData>& global_data) :
79 template <
typename EvalT>
87 template <
typename EvalT>
92 const Teuchos::ParameterList& user_data)
const
94 buildAndRegisterGatherAndOrientationEvaluators(fm,pb,lof,user_data);
95 buildAndRegisterScatterEvaluators(fm,pb,lof,user_data);
99 template <
typename EvalT>
104 const Teuchos::ParameterList& user_data)
const
106 using Teuchos::ParameterList;
118 for (vector<std::tuple<std::string,std::string,std::string,
int,Teuchos::RCP<panzer::PureBasis>,Teuchos::RCP<panzer::IntegrationRule> > >::const_iterator eq =
119 m_residual_contributions.begin(); eq != m_residual_contributions.end(); ++eq) {
121 const string& residual_name = std::get<0>(*eq);
122 const string& dof_name = std::get<1>(*eq);
123 const string& flux_name = std::get<2>(*eq);
125 const RCP<const panzer::PureBasis> basis = std::get<4>(*eq);
126 const RCP<const panzer::IntegrationRule> ir = std::get<5>(*eq);
132 ParameterList p(s.str());
133 p.set<std::string>(
"Name",
"Side Normal");
135 p.set< Teuchos::RCP<panzer::IntegrationRule> >(
"IR", Teuchos::rcp_const_cast<panzer::IntegrationRule>(ir));
136 p.set<
bool>(
"Normalize",
true);
140 this->
template registerEvaluator<EvalT>(fm, op);
145 ParameterList p(
"Neumann Residual: " + residual_name +
" to DOF: " + dof_name);
146 p.set(
"Residual Name", residual_name);
147 p.set(
"DOF Name",dof_name);
148 p.set(
"Flux Name", flux_name);
149 p.set(
"Normal Name",
"Side Normal");
150 p.set(
"Basis", basis);
153 RCP< PHX::Evaluator<panzer::Traits> > op =
156 this->
template registerEvaluator<EvalT>(fm, op);
163 template <
typename EvalT>
168 const Teuchos::ParameterList& user_data)
const
170 using Teuchos::ParameterList;
179 for (vector<std::tuple<std::string,std::string,std::string,
int,Teuchos::RCP<panzer::PureBasis>,Teuchos::RCP<panzer::IntegrationRule> > >::const_iterator eq =
180 m_residual_contributions.begin(); eq != m_residual_contributions.end(); ++eq) {
182 const string& residual_name = std::get<0>(*eq);
183 const string& dof_name = std::get<1>(*eq);
184 const RCP<const panzer::PureBasis> basis = std::get<4>(*eq);
185 const RCP<const panzer::IntegrationRule> ir = std::get<5>(*eq);
189 ParameterList p(
"Scatter: "+ residual_name +
" to " + dof_name);
192 string scatter_field_name =
"Dummy Scatter: " + this->m_bc.identifier() + residual_name;
193 p.set(
"Scatter Name", scatter_field_name);
194 p.set(
"Basis", basis);
196 RCP<vector<string> > residual_names = rcp(
new vector<string>);
197 residual_names->push_back(residual_name);
198 p.set(
"Dependent Names", residual_names);
200 RCP<map<string,string> > names_map = rcp(
new map<string,string>);
201 names_map->insert(std::pair<string,string>(residual_name,dof_name));
202 p.set(
"Dependent Map", names_map);
204 RCP< PHX::Evaluator<panzer::Traits> > op = lof.
buildScatter<EvalT>(p);
206 this->
template registerEvaluator<EvalT>(fm, op);
211 PHX::Tag<typename EvalT::ScalarT> tag(scatter_field_name,
212 rcp(
new PHX::MDALayout<Dummy>(0)));
213 fm.template requireField<EvalT>(tag);
222 template <
typename EvalT>
226 m_required_dof_names.push_back(required_dof_name);
230 template <
typename EvalT>
233 const std::string dof_name,
234 const std::string flux_name,
235 const int integration_order,
238 Teuchos::RCP<panzer::PureBasis> basis = this->getBasis(dof_name,side_pb);
240 Teuchos::RCP<panzer::IntegrationRule> ir = buildIntegrationRule(integration_order,side_pb);
242 m_residual_contributions.push_back(std::make_tuple(residual_name,
251 template <
typename EvalT>
252 const std::vector<std::tuple<std::string,std::string,std::string,int,Teuchos::RCP<panzer::PureBasis>,Teuchos::RCP<panzer::IntegrationRule> > >
255 return m_residual_contributions;
259 template <
typename EvalT>
260 Teuchos::RCP<panzer::PureBasis>
264 const std::vector<std::pair<std::string,Teuchos::RCP<panzer::PureBasis> > >& dofBasisPair = side_pb.
getProvidedDOFs();
265 Teuchos::RCP<panzer::PureBasis> basis;
266 for (std::vector<std::pair<std::string,Teuchos::RCP<panzer::PureBasis> > >::const_iterator it =
267 dofBasisPair.begin(); it != dofBasisPair.end(); ++it) {
268 if (it->first == dof_name)
272 TEUCHOS_TEST_FOR_EXCEPTION(is_null(basis), std::runtime_error,
273 "Error the name \"" << dof_name
274 <<
"\" is not a valid DOF for the boundary condition:\n"
275 << this->m_bc <<
"\n");
281 template <
typename EvalT>
282 Teuchos::RCP<panzer::IntegrationRule>
292 template <
typename EvalT>