43 #ifndef PANZER_BCSTRATEGY_DIRICHLET_DEFAULT_IMPL_IMPL_HPP
44 #define PANZER_BCSTRATEGY_DIRICHLET_DEFAULT_IMPL_IMPL_HPP
48 #include "Teuchos_Assert.hpp"
50 #include "Phalanx_DataLayout_MDALayout.hpp"
51 #include "Phalanx_FieldManager.hpp"
53 #include "Phalanx_MDField.hpp"
54 #include "Phalanx_DataLayout.hpp"
55 #include "Phalanx_DataLayout_MDALayout.hpp"
60 #include "Panzer_Dirichlet_Residual.hpp"
64 #ifdef PANZER_HAVE_EPETRA_STACK
65 #include "Panzer_GatherSolution_Epetra.hpp"
66 #include "Panzer_ScatterDirichletResidual_Epetra.hpp"
69 #include "Panzer_GatherBasisCoordinates.hpp"
70 #include "Panzer_BasisValues_Evaluator.hpp"
71 #include "Panzer_PointValues_Evaluator.hpp"
76 template <
typename EvalT>
80 const bool in_check_apply_bc) :
83 check_apply_bc(in_check_apply_bc),
84 descriptor_map_built(false)
90 template <
typename EvalT>
98 template <
typename EvalT>
106 buildDescriptorMapFromVectors();
108 buildAndRegisterGatherAndOrientationEvaluators(fm,pb,lof,user_data);
109 buildAndRegisterScatterEvaluators(fm,pb,lof,user_data);
114 template <
typename EvalT>
130 buildDescriptorMapFromVectors();
136 itr!=m_provided_dofs_desc.end(); ++itr) {
146 std::string dofName = desc.
dofName;
149 ParameterList p(
"Scatter: "+residualName +
" to " + dofName);
152 string scatter_field_name =
"Dummy Scatter: " + this->m_bc.identifier() + residualName;
153 p.set(
"Scatter Name", scatter_field_name);
156 const vector<pair<string,RCP<panzer::PureBasis> > >& dofBasisPair = pb.
getProvidedDOFs();
159 dofBasisPair.begin(); it != dofBasisPair.end(); ++it) {
160 if (it->first == dofName)
165 "Error the name \"" << dofName
166 <<
"\" is not a valid DOF for the boundary condition:\n"
167 << this->m_bc <<
"\n");
169 p.set(
"Basis", basis);
172 residual_names->push_back(residualName);
173 p.set(
"Dependent Names", residual_names);
176 names_map->insert(std::make_pair(residualName,dofName));
177 p.set(
"Dependent Map", names_map);
180 "Error - physics block is not a side set!");
182 p.set<
int>(
"Side Subcell Dimension",
186 p.set(
"Check Apply BC",check_apply_bc);
190 this->
template registerEvaluator<EvalT>(fm, op);
197 fm.template requireField<EvalT>(tag);
205 template <
typename EvalT>
221 buildDescriptorMapFromVectors();
230 const std::map<std::string,Teuchos::RCP<panzer::PureBasis> > & bases = pb.
getBases();
232 it!=bases.end();it++) {
240 this->
template registerEvaluator<EvalT>(fm, basis_op);
251 this->
template registerEvaluator<EvalT>(fm, eval);
258 this->
template registerEvaluator<EvalT>(fm, eval);
266 itr!=m_provided_dofs_desc.end(); ++itr) {
269 std::string dofName = itr->second.dofName;
270 std::string fieldDof = !itr->second.timeDerivative.first
271 ? itr->second.dofName : itr->second.timeDerivative.second;
273 const vector<pair<string,RCP<panzer::PureBasis> > >& dofBasisPair = pb.
getProvidedDOFs();
276 dofBasisPair.begin(); it != dofBasisPair.end(); ++it) {
277 if (it->first == dofName)
282 "Error the name \"" << dofName
283 <<
"\" is not a valid DOF for the boundary condition:\n"
284 << this->m_bc <<
"\n");
287 ParameterList p(
"BC Gather");
290 gather_field_names_vec->push_back(fieldDof);
291 gather_names_vec->push_back(dofName);
293 p.set(
"DOF Names", gather_field_names_vec);
294 p.set(
"Indexer Names", gather_names_vec);
295 p.set(
"Basis", basis);
296 p.set(
"Use Time Derivative Solution Vector",itr->second.timeDerivative.first);
299 this->
template registerEvaluator<EvalT>(fm, op);
303 ParameterList p(
"Gather Orientation");
306 gather_field_names_vec->push_back(fieldDof);
307 gather_names_vec->push_back(dofName);
309 p.set(
"DOF Names", gather_field_names_vec);
310 p.set(
"Indexer Names", gather_names_vec);
311 p.set(
"Basis", basis);
315 this->
template registerEvaluator<EvalT>(fm, op);
323 p.set(
"Name",fieldDof);
325 p.set(
"Point Rule",pointRule);
329 this->
template registerEvaluator<EvalT>(fm, eval);
336 itr!=m_provided_dofs_desc.end(); ++itr) {
346 ? itr->second.dofName : itr->second.timeDerivative.second;
348 std::string targetName = desc.
targetName.second;
350 const vector<pair<string,RCP<panzer::PureBasis> > >& dofBasisPair = pb.
getProvidedDOFs();
353 dofBasisPair.begin(); it != dofBasisPair.end(); ++it) {
354 if (it->first == itr->second.dofName)
359 "Error the name \"" << itr->second.dofName
360 <<
"\" is not a valid DOF for the boundary condition:\n"
361 << this->m_bc <<
"\n");
364 ParameterList p(
"Dirichlet Residual: "+residualName +
" to " + dofName);
365 p.set(
"Residual Name", residualName);
366 p.set(
"DOF Name", dofName);
367 p.set(
"Value Name", targetName);
373 this->
template registerEvaluator<EvalT>(fm, op);
380 p.set(
"Residual Name", residualName);
381 p.set(
"DOF Name", dofName);
382 p.set(
"Value Name", targetName);
384 p.set(
"Point Rule", pointRule);
389 this->
template registerEvaluator<EvalT>(fm, op);
395 p.set(
"Residual Name", residualName);
396 p.set(
"DOF Name", dofName);
397 p.set(
"Value Name", targetName);
399 p.set(
"Point Rule", pointRule);
404 this->
template registerEvaluator<EvalT>(fm, op);
412 template <
typename EvalT>
416 if(descriptor_map_built)
420 std::map<std::string,std::string> dof_names_to_residual_map;
421 for(std::map<std::string,std::string>::const_iterator itr=residual_to_dof_names_map.begin();
422 itr!=residual_to_dof_names_map.end();++itr) {
423 dof_names_to_residual_map[itr->second] = itr->first;
426 for(std::size_t i=0;i<required_dof_names.size();i++) {
427 std::string dof_name = required_dof_names[i];
433 if(dof_names_to_residual_map.find(dof_name)!=dof_names_to_residual_map.end()) {
434 std::string residual_name = dof_names_to_residual_map[dof_name];
435 std::string target_name = residual_to_target_field_map.find(residual_name)->second;
440 addTarget(target_name,
446 descriptor_map_built =
true;
451 template <
typename EvalT>
464 template <
typename EvalT>
467 const std::string & dofName,
468 const std::string & residualName)
470 typename std::map<std::string,DOFDescriptor>::iterator itr = m_provided_dofs_desc.find(dofName);
475 desc.coefficientResidual =
false;
476 desc.targetName = std::make_pair(
true,targetName);
477 desc.residualName = (residualName==
"") ? std::make_pair(
true,
"RESIDUAL_"+dofName)
478 : std::make_pair(
true,residualName);
481 template <
typename EvalT>
484 const std::string & dofName,
485 const std::string & residualName)
487 typename std::map<std::string,DOFDescriptor>::iterator itr = m_provided_dofs_desc.find(dofName);
492 desc.coefficientResidual =
true;
493 desc.targetName = std::make_pair(
true,targetName);
494 desc.residualName = (residualName==
"") ? std::make_pair(
true,
"RESIDUAL_"+dofName)
495 : std::make_pair(
true,residualName);
500 template <
typename EvalT>
503 const std::string & dofName,
504 const std::string & dotName,
505 const std::string & residualName)
507 typename std::map<std::string,DOFDescriptor>::iterator itr = m_provided_dofs_desc.find(dofName);
512 desc.targetName = std::make_pair(
true,targetName);
513 desc.timeDerivative = (dotName==
"") ? std::make_pair(
true,
"DXDT_"+dofName)
514 : std::make_pair(
true,dotName);
515 desc.residualName = (residualName==
"") ? std::make_pair(
true,
"RESIDUAL_"+dofName)
516 : 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