11 #ifndef PANZER_ASSEMBLY_ENGINE_IMPL_HPP
12 #define PANZER_ASSEMBLY_ENGINE_IMPL_HPP
14 #include "Phalanx_FieldManager.hpp"
22 template <
typename EvalT>
26 : m_field_manager_builder(fmb), m_lin_obj_factory(lof), countersInitialized_(false)
33 template <
typename EvalT>
44 if ( flags.
getValue() & EvaluationFlags::Initialize ) {
45 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::AssemblyEngine::evaluate_gather("+PHX::print<EvalT>()+
")", eval_gather);
59 if ( flags.
getValue() & EvaluationFlags::VolumetricFill) {
60 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::AssemblyEngine::evaluate_volume("+PHX::print<EvalT>()+
")", eval_vol);
61 this->evaluateVolume(in);
71 if ( flags.
getValue() & EvaluationFlags::BoundaryFill) {
73 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::AssemblyEngine::evaluate_neumannbcs("+PHX::print<EvalT>()+
")",eval_neumannbcs);
74 this->evaluateNeumannBCs(in);
78 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::AssemblyEngine::evaluate_interfacebcs("+PHX::print<EvalT>()+
")",eval_interfacebcs);
79 this->evaluateInterfaceBCs(in);
84 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::AssemblyEngine::evaluate_dirichletbcs("+PHX::print<EvalT>()+
")",eval_dirichletbcs);
85 this->evaluateDirichletBCs(in);
89 if ( flags.
getValue() & EvaluationFlags::Scatter) {
90 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::AssemblyEngine::evaluate_scatter("+PHX::print<EvalT>()+
")",eval_scatter);
92 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::AssemblyEngine::lof->ghostToGlobalContainer("+PHX::print<EvalT>()+
")",lof_gtgc);
96 PANZER_FUNC_TIME_MONITOR_DIFF(
"panzer::AssemblyEngine::gedc.ghostToGlobal("+PHX::print<EvalT>()+
")",gedc_gtg);
109 template <
typename EvalT>
143 template <
typename EvalT>
147 const std::vector< Teuchos::RCP< PHX::FieldManager<panzer::Traits> > > &
148 volume_field_managers = m_field_manager_builder->getVolumeFieldManagers();
149 const std::vector<WorksetDescriptor> & wkstDesc = m_field_manager_builder->getVolumeWorksetDescriptors();
161 for (std::size_t block = 0; block < volume_field_managers.size(); ++block) {
164 std::vector<panzer::Workset>& w = *wkstContainer->
getWorksets(wd);
166 fm->template preEvaluate<EvalT>(ped);
169 for (std::size_t i = 0; i < w.size(); ++i) {
181 fm->template evaluateFields<EvalT>(workset);
189 fm->template postEvaluate<EvalT>(NULL);
195 template <
typename EvalT>
204 template <
typename EvalT>
213 template <
typename EvalT>
219 if(!countersInitialized_) {
220 localCounter_ = m_lin_obj_factory->buildPrimitiveGhostedLinearObjContainer();
221 globalCounter_ = m_lin_obj_factory->buildPrimitiveLinearObjContainer();
222 summedGhostedCounter_ = m_lin_obj_factory->buildPrimitiveGhostedLinearObjContainer();
223 countersInitialized_ =
true;
232 summedGhostedCounter_->initialize();
233 globalCounter_->initialize();
241 m_lin_obj_factory->ghostToGlobalContainer(*localCounter_,*globalCounter_,LOC::F);
245 m_lin_obj_factory->globalToGhostContainer(*globalCounter_,*summedGhostedCounter_,LOC::F);
258 if(itr->second->requiresDirichletAdjustment()) {
260 if(loc!=Teuchos::null) {
261 m_lin_obj_factory->adjustForDirichletConditions(*localCounter_,*summedGhostedCounter_,*loc);
271 return globalCounter_;
276 template <
typename EvalT>
285 ped.
gedc->addDataObject(
"Dirichlet Counter",preEval_loc);
296 double betaValue = in.
beta;
303 std::map<unsigned,PHX::FieldManager<panzer::Traits> >,
305 m_field_manager_builder->getBCFieldManagers();
309 typedef typename std::map<panzer::BC,
310 std::map<unsigned,PHX::FieldManager<panzer::Traits> >,
314 for (bcfm_it_type bcfm_it = bc_field_managers.begin();
315 bcfm_it != bc_field_managers.end(); ++bcfm_it) {
317 const panzer::BC& bc = bcfm_it->first;
318 const std::map<unsigned,PHX::FieldManager<panzer::Traits> > bc_fm =
324 "Failed to find corresponding bc workset!");
325 const std::map<unsigned,panzer::Workset>& bc_wkst = *bc_wkst_ptr;
328 if (bc.
bcType() == bc_type) {
329 std::ostringstream timerName;
330 timerName <<
"panzer::AssemblyEngine::evaluateBCs: " << bc.
identifier();
331 #ifdef PANZER_TEUCHOS_TIME_MONITOR
338 std::ostringstream timerSideName;
339 timerSideName <<
"panzer::AssemblyEngine::evaluateBCs: " << bc.
identifier() <<
", side=" << side->first;
340 #ifdef PANZER_TEUCHOS_TIME_MONITOR
346 unsigned local_side_index = side->first;
351 std::map<unsigned,panzer::Workset>::const_iterator wkst_it =
352 bc_wkst.find(local_side_index);
355 "Failed to find corresponding bc workset side!");
361 local_side_fm.template preEvaluate<EvalT>(ped);
364 workset.alpha = in.
alpha;
365 workset.beta = betaValue;
366 workset.time = in.
time;
370 local_side_fm.template evaluateFields<EvalT>(workset);
373 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
FieldManager::iterator begin()
#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.
static RCP< Time > getNewTimer(const std::string &name)
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)
FieldManager::iterator end()
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)