11 #ifndef PANZER_BCSTRATEGY_DIRICHLET_DEFAULT_IMPL_IMPL_HPP
12 #define PANZER_BCSTRATEGY_DIRICHLET_DEFAULT_IMPL_IMPL_HPP
16 #include "Teuchos_Assert.hpp"
18 #include "Phalanx_DataLayout_MDALayout.hpp"
19 #include "Phalanx_FieldManager.hpp"
21 #include "Phalanx_MDField.hpp"
22 #include "Phalanx_DataLayout.hpp"
23 #include "Phalanx_DataLayout_MDALayout.hpp"
28 #include "Panzer_Dirichlet_Residual.hpp"
32 #ifdef PANZER_HAVE_EPETRA_STACK
33 #include "Panzer_GatherSolution_Epetra.hpp"
34 #include "Panzer_ScatterDirichletResidual_Epetra.hpp"
37 #include "Panzer_GatherBasisCoordinates.hpp"
38 #include "Panzer_BasisValues_Evaluator.hpp"
39 #include "Panzer_PointValues_Evaluator.hpp"
44 template <
typename EvalT>
48 const bool in_check_apply_bc) :
51 check_apply_bc(in_check_apply_bc),
52 descriptor_map_built(false)
58 template <
typename EvalT>
66 template <
typename EvalT>
74 buildDescriptorMapFromVectors();
76 buildAndRegisterGatherAndOrientationEvaluators(fm,pb,lof,user_data);
77 buildAndRegisterScatterEvaluators(fm,pb,lof,user_data);
82 template <
typename EvalT>
98 buildDescriptorMapFromVectors();
104 itr!=m_provided_dofs_desc.end(); ++itr) {
114 std::string dofName = desc.
dofName;
117 ParameterList p(
"Scatter: "+residualName +
" to " + dofName);
120 string scatter_field_name =
"Dummy Scatter: " + this->m_bc.identifier() + residualName;
121 p.set(
"Scatter Name", scatter_field_name);
124 const vector<pair<string,RCP<panzer::PureBasis> > >& dofBasisPair = pb.
getProvidedDOFs();
127 dofBasisPair.begin(); it != dofBasisPair.end(); ++it) {
128 if (it->first == dofName)
133 "Error the name \"" << dofName
134 <<
"\" is not a valid DOF for the boundary condition:\n"
135 << this->m_bc <<
"\n");
137 p.set(
"Basis", basis);
140 residual_names->push_back(residualName);
141 p.set(
"Dependent Names", residual_names);
144 names_map->insert(std::make_pair(residualName,dofName));
145 p.set(
"Dependent Map", names_map);
148 "Error - physics block is not a side set!");
150 p.set<
int>(
"Side Subcell Dimension",
154 p.set(
"Check Apply BC",check_apply_bc);
158 this->
template registerEvaluator<EvalT>(fm, op);
165 fm.template requireField<EvalT>(tag);
173 template <
typename EvalT>
189 buildDescriptorMapFromVectors();
198 const std::map<std::string,Teuchos::RCP<panzer::PureBasis> > & bases = pb.
getBases();
200 it!=bases.end();it++) {
208 this->
template registerEvaluator<EvalT>(fm, basis_op);
219 this->
template registerEvaluator<EvalT>(fm, eval);
226 this->
template registerEvaluator<EvalT>(fm, eval);
234 itr!=m_provided_dofs_desc.end(); ++itr) {
237 std::string dofName = itr->second.dofName;
238 std::string fieldDof = !itr->second.timeDerivative.first
239 ? itr->second.dofName : itr->second.timeDerivative.second;
241 const vector<pair<string,RCP<panzer::PureBasis> > >& dofBasisPair = pb.
getProvidedDOFs();
244 dofBasisPair.begin(); it != dofBasisPair.end(); ++it) {
245 if (it->first == dofName)
250 "Error the name \"" << dofName
251 <<
"\" is not a valid DOF for the boundary condition:\n"
252 << this->m_bc <<
"\n");
255 ParameterList p(
"BC Gather");
258 gather_field_names_vec->push_back(fieldDof);
259 gather_names_vec->push_back(dofName);
261 p.set(
"DOF Names", gather_field_names_vec);
262 p.set(
"Indexer Names", gather_names_vec);
263 p.set(
"Basis", basis);
264 p.set(
"Use Time Derivative Solution Vector",itr->second.timeDerivative.first);
267 this->
template registerEvaluator<EvalT>(fm, op);
271 ParameterList p(
"Gather Orientation");
274 gather_field_names_vec->push_back(fieldDof);
275 gather_names_vec->push_back(dofName);
277 p.set(
"DOF Names", gather_field_names_vec);
278 p.set(
"Indexer Names", gather_names_vec);
279 p.set(
"Basis", basis);
283 this->
template registerEvaluator<EvalT>(fm, op);
291 p.set(
"Name",fieldDof);
293 p.set(
"Point Rule",pointRule);
297 this->
template registerEvaluator<EvalT>(fm, eval);
304 itr!=m_provided_dofs_desc.end(); ++itr) {
314 ? itr->second.dofName : itr->second.timeDerivative.second;
316 std::string targetName = desc.
targetName.second;
318 const vector<pair<string,RCP<panzer::PureBasis> > >& dofBasisPair = pb.
getProvidedDOFs();
321 dofBasisPair.begin(); it != dofBasisPair.end(); ++it) {
322 if (it->first == itr->second.dofName)
327 "Error the name \"" << itr->second.dofName
328 <<
"\" is not a valid DOF for the boundary condition:\n"
329 << this->m_bc <<
"\n");
332 ParameterList p(
"Dirichlet Residual: "+residualName +
" to " + dofName);
333 p.set(
"Residual Name", residualName);
334 p.set(
"DOF Name", dofName);
335 p.set(
"Value Name", targetName);
341 this->
template registerEvaluator<EvalT>(fm, op);
348 p.set(
"Residual Name", residualName);
349 p.set(
"DOF Name", dofName);
350 p.set(
"Value Name", targetName);
352 p.set(
"Point Rule", pointRule);
357 this->
template registerEvaluator<EvalT>(fm, op);
363 p.set(
"Residual Name", residualName);
364 p.set(
"DOF Name", dofName);
365 p.set(
"Value Name", targetName);
367 p.set(
"Point Rule", pointRule);
372 this->
template registerEvaluator<EvalT>(fm, op);
380 template <
typename EvalT>
384 if(descriptor_map_built)
388 std::map<std::string,std::string> dof_names_to_residual_map;
389 for(std::map<std::string,std::string>::const_iterator itr=residual_to_dof_names_map.begin();
390 itr!=residual_to_dof_names_map.end();++itr) {
391 dof_names_to_residual_map[itr->second] = itr->first;
394 for(std::size_t i=0;i<required_dof_names.size();i++) {
395 std::string dof_name = required_dof_names[i];
401 if(dof_names_to_residual_map.find(dof_name)!=dof_names_to_residual_map.end()) {
402 std::string residual_name = dof_names_to_residual_map[dof_name];
403 std::string target_name = residual_to_target_field_map.find(residual_name)->second;
408 addTarget(target_name,
414 descriptor_map_built =
true;
419 template <
typename EvalT>
432 template <
typename EvalT>
435 const std::string & dofName,
436 const std::string & residualName)
438 typename std::map<std::string,DOFDescriptor>::iterator itr = m_provided_dofs_desc.find(dofName);
443 desc.coefficientResidual =
false;
444 desc.targetName = std::make_pair(
true,targetName);
445 desc.residualName = (residualName==
"") ? std::make_pair(
true,
"RESIDUAL_"+dofName)
446 : std::make_pair(
true,residualName);
449 template <
typename EvalT>
452 const std::string & dofName,
453 const std::string & residualName)
455 typename std::map<std::string,DOFDescriptor>::iterator itr = m_provided_dofs_desc.find(dofName);
460 desc.coefficientResidual =
true;
461 desc.targetName = std::make_pair(
true,targetName);
462 desc.residualName = (residualName==
"") ? std::make_pair(
true,
"RESIDUAL_"+dofName)
463 : std::make_pair(
true,residualName);
468 template <
typename EvalT>
471 const std::string & dofName,
472 const std::string & dotName,
473 const std::string & residualName)
475 typename std::map<std::string,DOFDescriptor>::iterator itr = m_provided_dofs_desc.find(dofName);
480 desc.targetName = std::make_pair(
true,targetName);
481 desc.timeDerivative = (dotName==
"") ? std::make_pair(
true,
"DXDT_"+dofName)
482 : std::make_pair(
true,dotName);
483 desc.residualName = (residualName==
"") ? std::make_pair(
true,
"RESIDUAL_"+dofName)
484 : std::make_pair(
true,residualName);
std::string name() const
A unique key that is the combination of the basis type and basis order.
RCP< const T > getConst() const
virtual void buildAndRegisterGatherScatterEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::PhysicsBlock &pb, const panzer::LinearObjFactory< panzer::Traits > &lof, const Teuchos::ParameterList &user_data) const
virtual void buildAndRegisterGatherAndOrientationEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::PhysicsBlock &side_pb, const LinearObjFactory< panzer::Traits > &lof, const Teuchos::ParameterList &user_data) const
Object that contains information on the physics and discretization of a block of elements with the SA...
const std::map< std::string, Teuchos::RCP< panzer::PureBasis > > & getBases() const
Returns the unique set of bases, key is the unique panzer::PureBasis::name() of the basis...
Default implementation for accessing the GlobalData object.
const panzer::CellData & cellData() const
bool is_null(const std::shared_ptr< T > &p)
std::pair< bool, std::string > timeDerivative
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
int cardinality() const
Returns the number of basis coefficients.
Teuchos::RCP< const shards::CellTopology > getCellTopology() const
Get CellTopology for the base cell.
Interpolates basis DOF values to IP DOF values.
std::size_t numCells() const
BCStrategy_Dirichlet_DefaultImpl(const panzer::BC &bc, const Teuchos::RCP< panzer::GlobalData > &global_data, const bool check_apply_bc=false)
bool requiresOrientations() const
Interpolates basis DOF values to IP DOF Curl values.
void buildDescriptorMapFromVectors() const
std::map< std::string, DOFDescriptor >::const_iterator DescriptorIterator
For convenience, declare the DOFDescriptor iterator.
Teuchos::RCP< PHX::Evaluator< Traits > > buildScatterDirichlet(const Teuchos::ParameterList &pl) const
Use preconstructed dirichlet scatter evaluators.
virtual void buildAndRegisterScatterEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::PhysicsBlock &side_pb, const LinearObjFactory< panzer::Traits > &lof, const Teuchos::ParameterList &user_data) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
std::pair< bool, std::string > residualName
Data for determining cell topology and dimensionality.
void addDOF(const std::string &dofName)
virtual ~BCStrategy_Dirichlet_DefaultImpl()
bool isVectorBasis() const
void addTarget(const std::string &targetName, const std::string &dofName, const std::string &residualName="")
void addDotTarget(const std::string &targetName, const std::string &dofName, const std::string &dotName="", const std::string &residualName="")
Teuchos::RCP< PHX::Evaluator< Traits > > buildGather(const Teuchos::ParameterList &pl) const
Use preconstructed gather evaluators.
const shards::CellTopology getBaseCellTopology() const
void addCoefficientTarget(const std::string &targetName, const std::string &dofName, const std::string &residualName="")
bool isScalarBasis() const
Teuchos::RCP< PHX::Evaluator< Traits > > buildGatherOrientation(const Teuchos::ParameterList &pl) const
Use preconstructed gather evaluators.
std::pair< bool, std::string > targetName
Stores input information for a boundary condition.
#define TEUCHOS_ASSERT(assertion_test)
Teuchos::RCP< PHX::DataLayout > functional
<Cell,Basis> or <Cell,Basis>
Evaluates a Dirichlet BC residual corresponding to a field value.
Gathers coordinates for the basis function from the workset and stores them in the field manager...
Interpolates basis DOF values to IP DOF values.
const std::vector< StrPureBasisPair > & getProvidedDOFs() const