43 #ifndef PANZER_ASSEMBLY_ENGINE_IMPL_HPP
44 #define PANZER_ASSEMBLY_ENGINE_IMPL_HPP
46 #include "Phalanx_FieldManager.hpp"
54 template <
typename EvalT>
58 : m_field_manager_builder(fmb), m_lin_obj_factory(lof), countersInitialized_(false)
65 template <
typename EvalT>
76 if ( flags.
getValue() & EvaluationFlags::Initialize ) {
77 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::AssemblyEngine::evaluate_gather("+PHX::typeAsString<EvalT>()+
")", eval_gather);
91 if ( flags.
getValue() & EvaluationFlags::VolumetricFill) {
92 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::AssemblyEngine::evaluate_volume("+PHX::typeAsString<EvalT>()+
")", eval_vol);
93 this->evaluateVolume(in);
103 if ( flags.
getValue() & EvaluationFlags::BoundaryFill) {
105 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::AssemblyEngine::evaluate_neumannbcs("+PHX::typeAsString<EvalT>()+
")",eval_neumannbcs);
106 this->evaluateNeumannBCs(in);
110 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::AssemblyEngine::evaluate_interfacebcs("+PHX::typeAsString<EvalT>()+
")",eval_interfacebcs);
111 this->evaluateInterfaceBCs(in);
116 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::AssemblyEngine::evaluate_dirichletbcs("+PHX::typeAsString<EvalT>()+
")",eval_dirichletbcs);
117 this->evaluateDirichletBCs(in);
121 if ( flags.
getValue() & EvaluationFlags::Scatter) {
122 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::AssemblyEngine::evaluate_scatter("+PHX::typeAsString<EvalT>()+
")",eval_scatter);
137 template <
typename EvalT>
171 template <
typename EvalT>
175 const std::vector< Teuchos::RCP< PHX::FieldManager<panzer::Traits> > > &
176 volume_field_managers = m_field_manager_builder->getVolumeFieldManagers();
177 const std::vector<WorksetDescriptor> & wkstDesc = m_field_manager_builder->getVolumeWorksetDescriptors();
189 for (std::size_t block = 0; block < volume_field_managers.size(); ++block) {
192 std::vector<panzer::Workset>& w = *wkstContainer->
getWorksets(wd);
194 fm->template preEvaluate<EvalT>(ped);
197 for (std::size_t i = 0; i < w.size(); ++i) {
209 fm->template evaluateFields<EvalT>(workset);
217 fm->template postEvaluate<EvalT>(NULL);
223 template <
typename EvalT>
232 template <
typename EvalT>
241 template <
typename EvalT>
247 if(!countersInitialized_) {
248 localCounter_ = m_lin_obj_factory->buildPrimitiveGhostedLinearObjContainer();
249 globalCounter_ = m_lin_obj_factory->buildPrimitiveLinearObjContainer();
250 summedGhostedCounter_ = m_lin_obj_factory->buildPrimitiveGhostedLinearObjContainer();
251 countersInitialized_ =
true;
260 summedGhostedCounter_->initialize();
261 globalCounter_->initialize();
269 m_lin_obj_factory->ghostToGlobalContainer(*localCounter_,*globalCounter_,LOC::F);
273 m_lin_obj_factory->globalToGhostContainer(*globalCounter_,*summedGhostedCounter_,LOC::F);
286 if(itr->second->requiresDirichletAdjustment()) {
288 if(loc!=Teuchos::null) {
289 m_lin_obj_factory->adjustForDirichletConditions(*localCounter_,*summedGhostedCounter_,*loc);
299 return globalCounter_;
304 template <
typename EvalT>
313 ped.
gedc->addDataObject(
"Dirichlet Counter",preEval_loc);
324 double betaValue = in.
beta;
331 std::map<unsigned,PHX::FieldManager<panzer::Traits> >,
333 m_field_manager_builder->getBCFieldManagers();
337 typedef typename std::map<panzer::BC,
338 std::map<unsigned,PHX::FieldManager<panzer::Traits> >,
342 for (bcfm_it_type bcfm_it = bc_field_managers.begin();
343 bcfm_it != bc_field_managers.end(); ++bcfm_it) {
345 const panzer::BC& bc = bcfm_it->first;
346 const std::map<unsigned,PHX::FieldManager<panzer::Traits> > bc_fm =
352 "Failed to find corresponding bc workset!");
353 const std::map<unsigned,panzer::Workset>& bc_wkst = *bc_wkst_ptr;
356 if (bc.
bcType() == bc_type) {
357 std::ostringstream timerName;
358 timerName <<
"panzer::AssemblyEngine::evaluateBCs: " << bc.
identifier();
359 PANZER_FUNC_TIME_MONITOR_DIFF(timerName.str(),eval_BCs);
363 std::ostringstream timerSideName;
364 timerSideName <<
"panzer::AssemblyEngine::evaluateBCs: " << bc.
identifier() <<
", side=" << side->first;
365 PANZER_FUNC_TIME_MONITOR_DIFF(timerSideName.str(),Side);
368 unsigned local_side_index = side->first;
373 std::map<unsigned,panzer::Workset>::const_iterator wkst_it =
374 bc_wkst.find(local_side_index);
377 "Failed to find corresponding bc workset side!");
383 local_side_fm.template preEvaluate<EvalT>(ped);
386 workset.alpha = in.
alpha;
387 workset.beta = betaValue;
388 workset.time = in.
time;
392 local_side_fm.template evaluateFields<EvalT>(workset);
395 local_side_fm.template postEvaluate<EvalT>(NULL);
Teuchos::RCP< GlobalEvaluationDataContainer > gedc
bool evaluate_transient_terms
void addDataObject(const std::string &key, const Teuchos::RCP< GlobalEvaluationData > &ged)
BCType
Type of boundary condition.
std::unordered_map< std::string, Teuchos::RCP< GlobalEvaluationData > >::iterator iterator
const_iterator begin() const
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
std::string second_sensitivities_name
bool evaluate_transient_terms
virtual void adjustForDirichletConditions(const GlobalEvaluationData &localBCRows, const GlobalEvaluationData &globalBCRows)=0
void initialize()
Call initialize on all containers.
Teuchos::RCP< panzer::LinearObjContainer > ghostedContainer_
std::vector< double > gather_seeds
void evaluate(const panzer::AssemblyEngineInArgs &input_arguments, const EvaluationFlags flags=EvaluationFlags(EvaluationFlags::All))
void globalToGhost(int p)
Call global to ghost on all the containers.
double alpha
If workset corresponds to a sub cell, what is the dimension?
Teuchos::RCP< panzer::LinearObjContainer > container_
std::string identifier() const
A unique string identifier for this boundary condition.
std::string first_sensitivities_name
Teuchos::RCP< std::map< unsigned, Workset > > getSideWorksets(const WorksetDescriptor &desc)
Access, and construction of side worksets.
void evaluateInterfaceBCs(const panzer::AssemblyEngineInArgs &input_arguments)
const_iterator end() const
void evaluateVolume(const panzer::AssemblyEngineInArgs &input_arguments)
void setRequiresDirichletAdjustment(bool b)
Teuchos::RCP< std::vector< Workset > > getWorksets(const WorksetDescriptor &wd)
Access to volume worksets.
std::vector< double > gather_seeds
BCType bcType() const
Returns the boundary condition type (Dirichlet or Neumann or Interface).
Teuchos::RCP< LinearObjContainer > evaluateDirichletBCs(const panzer::AssemblyEngineInArgs &input_arguments)
This method returns the global counter used to indicate which rows are boundary conditions.
void evaluateBCs(const panzer::BCType bc_type, const panzer::AssemblyEngineInArgs &input_arguments, const Teuchos::RCP< LinearObjContainer > preEval_loc=Teuchos::null)
void ghostToGlobal(int p)
Call ghost to global on all the containers.
void fillGlobalEvaluationDataContainer(GlobalEvaluationDataContainer &gedc) const
Using internal map fill the global evaluation data container object.
std::string first_sensitivities_name
AssemblyEngine(const Teuchos::RCP< panzer::FieldManagerBuilder > &fmb, const Teuchos::RCP< const panzer::LinearObjFactory< panzer::Traits > > &lof)
bool apply_dirichlet_beta
virtual void initialize()=0
std::string second_sensitivities_name
WorksetDescriptor bcDescriptor(const panzer::BC &bc)
Stores input information for a boundary condition.
Teuchos::RCP< LinearObjContainer > evaluateOnlyDirichletBCs(const panzer::AssemblyEngineInArgs &input_arguments)
void evaluateNeumannBCs(const panzer::AssemblyEngineInArgs &input_arguments)