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"
63 #include "Panzer_GatherSolution_Epetra.hpp"
64 #include "Panzer_GatherBasisCoordinates.hpp"
65 #include "Panzer_ScatterDirichletResidual_Epetra.hpp"
66 #include "Panzer_BasisValues_Evaluator.hpp"
67 #include "Panzer_PointValues_Evaluator.hpp"
72 template <
typename EvalT>
76 const bool in_check_apply_bc) :
79 check_apply_bc(in_check_apply_bc),
80 descriptor_map_built(false)
86 template <
typename EvalT>
94 template <
typename EvalT>
102 buildDescriptorMapFromVectors();
104 buildAndRegisterGatherAndOrientationEvaluators(fm,pb,lof,user_data);
105 buildAndRegisterScatterEvaluators(fm,pb,lof,user_data);
110 template <
typename EvalT>
126 buildDescriptorMapFromVectors();
132 itr!=m_provided_dofs_desc.end(); ++itr) {
142 std::string dofName = desc.
dofName;
145 ParameterList p(
"Scatter: "+residualName +
" to " + dofName);
148 string scatter_field_name =
"Dummy Scatter: " + this->m_bc.identifier() + residualName;
149 p.set(
"Scatter Name", scatter_field_name);
152 const vector<pair<string,RCP<panzer::PureBasis> > >& dofBasisPair = pb.
getProvidedDOFs();
155 dofBasisPair.begin(); it != dofBasisPair.end(); ++it) {
156 if (it->first == dofName)
161 "Error the name \"" << dofName
162 <<
"\" is not a valid DOF for the boundary condition:\n"
163 << this->m_bc <<
"\n");
165 p.set(
"Basis", basis);
168 residual_names->push_back(residualName);
169 p.set(
"Dependent Names", residual_names);
172 names_map->insert(std::make_pair(residualName,dofName));
173 p.set(
"Dependent Map", names_map);
176 "Error - physics block is not a side set!");
178 p.set<
int>(
"Side Subcell Dimension",
182 p.set(
"Check Apply BC",check_apply_bc);
186 this->
template registerEvaluator<EvalT>(fm, op);
191 PHX::Tag<typename EvalT::ScalarT> tag(scatter_field_name,
192 rcp(
new PHX::MDALayout<Dummy>(0)));
193 fm.template requireField<EvalT>(tag);
201 template <
typename EvalT>
217 buildDescriptorMapFromVectors();
226 const std::map<std::string,Teuchos::RCP<panzer::PureBasis> > & bases = pb.
getBases();
228 it!=bases.end();it++) {
236 this->
template registerEvaluator<EvalT>(fm, basis_op);
247 this->
template registerEvaluator<EvalT>(fm, eval);
254 this->
template registerEvaluator<EvalT>(fm, eval);
262 itr!=m_provided_dofs_desc.end(); ++itr) {
265 std::string dofName = itr->second.dofName;
266 std::string fieldDof = !itr->second.timeDerivative.first
267 ? itr->second.dofName : itr->second.timeDerivative.second;
269 const vector<pair<string,RCP<panzer::PureBasis> > >& dofBasisPair = pb.
getProvidedDOFs();
272 dofBasisPair.begin(); it != dofBasisPair.end(); ++it) {
273 if (it->first == dofName)
278 "Error the name \"" << dofName
279 <<
"\" is not a valid DOF for the boundary condition:\n"
280 << this->m_bc <<
"\n");
283 ParameterList p(
"BC Gather");
286 gather_field_names_vec->push_back(fieldDof);
287 gather_names_vec->push_back(dofName);
289 p.set(
"DOF Names", gather_field_names_vec);
290 p.set(
"Indexer Names", gather_names_vec);
291 p.set(
"Basis", basis);
292 p.set(
"Use Time Derivative Solution Vector",itr->second.timeDerivative.first);
295 this->
template registerEvaluator<EvalT>(fm, op);
299 ParameterList p(
"Gather Orientation");
302 gather_field_names_vec->push_back(fieldDof);
303 gather_names_vec->push_back(dofName);
305 p.set(
"DOF Names", gather_field_names_vec);
306 p.set(
"Indexer Names", gather_names_vec);
307 p.set(
"Basis", basis);
311 this->
template registerEvaluator<EvalT>(fm, op);
319 p.set(
"Name",fieldDof);
321 p.set(
"Point Rule",pointRule);
325 this->
template registerEvaluator<EvalT>(fm, eval);
332 itr!=m_provided_dofs_desc.end(); ++itr) {
342 ? itr->second.dofName : itr->second.timeDerivative.second;
344 std::string targetName = desc.
targetName.second;
346 const vector<pair<string,RCP<panzer::PureBasis> > >& dofBasisPair = pb.
getProvidedDOFs();
349 dofBasisPair.begin(); it != dofBasisPair.end(); ++it) {
350 if (it->first == itr->second.dofName)
355 "Error the name \"" << itr->second.dofName
356 <<
"\" is not a valid DOF for the boundary condition:\n"
357 << this->m_bc <<
"\n");
360 ParameterList p(
"Dirichlet Residual: "+residualName +
" to " + dofName);
361 p.set(
"Residual Name", residualName);
362 p.set(
"DOF Name", dofName);
363 p.set(
"Value Name", targetName);
369 this->
template registerEvaluator<EvalT>(fm, op);
372 else if(basis->
isVectorBasis()&&(dofName.compare(dofName.substr(0,dofName.find_last_of(
"_"))+
"_face")==0)) {
376 p.set(
"Residual Name", residualName);
377 p.set(
"DOF Name", dofName);
378 p.set(
"Value Name", targetName);
380 p.set(
"Point Rule", pointRule);
385 this->
template registerEvaluator<EvalT>(fm, op);
391 p.set(
"Residual Name", residualName);
392 p.set(
"DOF Name", dofName);
393 p.set(
"Value Name", targetName);
395 p.set(
"Point Rule", pointRule);
400 this->
template registerEvaluator<EvalT>(fm, op);
408 template <
typename EvalT>
412 if(descriptor_map_built)
416 std::map<std::string,std::string> dof_names_to_residual_map;
417 for(std::map<std::string,std::string>::const_iterator itr=residual_to_dof_names_map.begin();
418 itr!=residual_to_dof_names_map.end();++itr) {
419 dof_names_to_residual_map[itr->second] = itr->first;
422 for(std::size_t i=0;i<required_dof_names.size();i++) {
423 std::string dof_name = required_dof_names[i];
429 if(dof_names_to_residual_map.find(dof_name)!=dof_names_to_residual_map.end()) {
430 std::string residual_name = dof_names_to_residual_map[dof_name];
431 std::string target_name = residual_to_target_field_map.find(residual_name)->second;
436 addTarget(target_name,
442 descriptor_map_built =
true;
447 template <
typename EvalT>
460 template <
typename EvalT>
463 const std::string & dofName,
464 const std::string & residualName)
466 typename std::map<std::string,DOFDescriptor>::iterator itr = m_provided_dofs_desc.find(dofName);
471 desc.coefficientResidual =
false;
472 desc.targetName = std::make_pair(
true,targetName);
473 desc.residualName = (residualName==
"") ? std::make_pair(
true,
"RESIDUAL_"+dofName)
474 : std::make_pair(
true,residualName);
477 template <
typename EvalT>
480 const std::string & dofName,
481 const std::string & residualName)
483 typename std::map<std::string,DOFDescriptor>::iterator itr = m_provided_dofs_desc.find(dofName);
488 desc.coefficientResidual =
true;
489 desc.targetName = std::make_pair(
true,targetName);
490 desc.residualName = (residualName==
"") ? std::make_pair(
true,
"RESIDUAL_"+dofName)
491 : std::make_pair(
true,residualName);
496 template <
typename EvalT>
499 const std::string & dofName,
500 const std::string & dotName,
501 const std::string & residualName)
503 typename std::map<std::string,DOFDescriptor>::iterator itr = m_provided_dofs_desc.find(dofName);
508 desc.targetName = std::make_pair(
true,targetName);
509 desc.timeDerivative = (dotName==
"") ? std::make_pair(
true,
"DXDT_"+dofName)
510 : std::make_pair(
true,dotName);
511 desc.residualName = (residualName==
"") ? std::make_pair(
true,
"RESIDUAL_"+dofName)
512 : 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