50 #include "Phalanx_DataLayout_MDALayout.hpp"
51 #include "Phalanx_FieldManager.hpp"
53 #include "Teuchos_FancyOStream.hpp"
55 #include "Shards_CellTopology.hpp"
59 #include "Panzer_Workset_Builder.hpp"
76 os <<
"panzer::FieldManagerBuilder output: Not implemented yet!";
82 const std::vector<WorksetDescriptor> & wkstDesc,
88 bool closureModelByEBlock)
94 "panzer::FMB::setupVolumeFieldManagers: method function getWorksetContainer() returns null. "
95 "Plase call setWorksetContainer() before calling this method");
97 "panzer::FMB::setupVolumeFieldManagers: physics block count must match workset descriptor count.");
99 phx_volume_field_managers_.clear();
103 for (std::size_t blkInd=0;blkInd<physicsBlocks.size();++blkInd) {
108 setupData.
worksets_ = getWorksetContainer()->getWorksets(wd);
109 setupData.
orientations_ = getWorksetContainer()->getOrientations();
122 if(!physicsBlockGatherDisabled())
125 if(!physicsBlockScatterDisabled())
128 if(closureModelByEBlock)
137 setKokkosExtendedDataTypeDimensions(wd.
getElementBlock(),*globalIndexer,user_data,*fm);
140 fm->postRegistrationSetup(setupData);
143 volume_workset_desc_.push_back(wd);
144 phx_volume_field_managers_.push_back(fm);
156 std::vector<WorksetDescriptor> wkstDesc;
157 for(std::size_t i=0;i<physicsBlocks.size();i++)
158 wkstDesc.push_back(
blockDescriptor(physicsBlocks[i]->elementBlockID()));
161 setupVolumeFieldManagers(physicsBlocks,wkstDesc,cm_factory,closure_models,lo_factory,user_data,eef);
177 "panzer::FMB::setupBCFieldManagers: method function getWorksetContainer() returns null. "
178 "Plase call setWorksetContainer() before calling this method");
183 std::map<std::string,Teuchos::RCP<panzer::PhysicsBlock> > physicsBlocks_map;
185 std::vector<Teuchos::RCP<panzer::PhysicsBlock> >::const_iterator blkItr;
186 for(blkItr=physicsBlocks.begin();blkItr!=physicsBlocks.end();++blkItr) {
191 physicsBlocks_map.insert(std::make_pair(blockId,pb));
198 std::vector<panzer::BC>::const_iterator bc;
199 for (bc=bcs.begin(); bc != bcs.end(); ++bc) {
202 currentWkst = getWorksetContainer()->getSideWorksets(wd);
203 if (currentWkst.
is_null())
continue;
205 BCType bc_type = bc->bcType();
209 for (std::map<unsigned,panzer::Workset>::const_iterator wkst = currentWkst->begin();
210 wkst != currentWkst->end(); ++wkst) {
212 std::map<unsigned,PHX::FieldManager<panzer::Traits> >& field_managers =
213 bc_field_managers_[*bc];
218 for (
int block_id_index = 0; block_id_index < 2; ++block_id_index) {
219 const std::string element_block_id = block_id_index == 0 ? bc->elementBlockID() : bc->elementBlockID2();
221 std::map<std::string,Teuchos::RCP<panzer::PhysicsBlock> >::const_iterator
222 volume_pb_itr = physicsBlocks_map.find(element_block_id);
225 "panzer::FMB::setupBCFieldManagers: Cannot find physics block corresponding to element block \""
226 << element_block_id <<
"\"");
233 wkst->second.details(block_id_index).subcell_index,
234 volume_cell_topology);
244 bcs_type = bcstm->begin(); bcs_type != bcstm->end(); ++bcs_type) {
245 bcs_type->setDetailsIndex(block_id_index);
246 side_pb->setDetailsIndex(block_id_index);
247 bcs_type->setup(*side_pb, user_data);
248 bcs_type->buildAndRegisterEvaluators(fm, *side_pb, cm_factory, closure_models, user_data);
249 bcs_type->buildAndRegisterGatherAndOrientationEvaluators(fm, *side_pb, lo_factory, user_data);
250 if ( ! physicsBlockScatterDisabled())
251 bcs_type->buildAndRegisterScatterEvaluators(fm, *side_pb, lo_factory, user_data);
258 std::vector<PHX::index_size_type> derivative_dimensions;
259 derivative_dimensions.push_back(gid_count);
262 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
266 derivative_dimensions[0] = 1;
267 if (user_data.
isType<
int>(
"Tangent Dimension"))
268 derivative_dimensions[0] = user_data.
get<
int>(
"Tangent Dimension");
275 worksets->push_back(wkst->second);
277 setupData.
orientations_ = getWorksetContainer()->getOrientations();
279 fm.postRegistrationSetup(setupData);
282 const std::string element_block_id = bc->elementBlockID();
284 std::map<std::string,Teuchos::RCP<panzer::PhysicsBlock> >::const_iterator volume_pb_itr
285 = physicsBlocks_map.find(element_block_id);
288 "panzer::FMB::setupBCFieldManagers: Cannot find physics block corresponding to element block \"" << element_block_id <<
"\"");
294 std::map<unsigned,PHX::FieldManager<panzer::Traits> >& field_managers =
295 bc_field_managers_[*bc];
298 for (std::map<unsigned,panzer::Workset>::const_iterator wkst =
299 currentWkst->begin(); wkst != currentWkst->end();
306 wkst->first,volume_cell_topology);
316 bcs_type = bcstm->begin(); bcs_type != bcstm->end(); ++bcs_type) {
317 bcs_type->setup(*side_pb,user_data);
318 bcs_type->buildAndRegisterEvaluators(fm,*side_pb,cm_factory,closure_models,user_data);
319 bcs_type->buildAndRegisterGatherAndOrientationEvaluators(fm,*side_pb,lo_factory,user_data);
320 if(!physicsBlockScatterDisabled())
321 bcs_type->buildAndRegisterScatterEvaluators(fm,*side_pb,lo_factory,user_data);
328 worksets->push_back(wkst->second);
330 setupData.
orientations_ = getWorksetContainer()->getOrientations();
333 setKokkosExtendedDataTypeDimensions(element_block_id,*globalIndexer,user_data,fm);
335 fm.postRegistrationSetup(setupData);
347 if(phx_volume_field_managers_.size()<1)
350 TEUCHOS_ASSERT(phx_volume_field_managers_.size()==physicsBlocks.size());
352 std::vector<Teuchos::RCP<panzer::PhysicsBlock> >::const_iterator blkItr;
354 for (blkItr=physicsBlocks.begin();blkItr!=physicsBlocks.end();++blkItr,++index) {
355 std::string blockId = (*blkItr)->elementBlockID();
356 phx_volume_field_managers_[index]->writeGraphvizFile(filename_prefix+
"_VOLUME_"+blockId);
366 typedef std::map<panzer::BC,std::map<unsigned,PHX::FieldManager<panzer::Traits> >,
panzer::LessBC> FMMap;
368 FMMap::const_iterator blkItr;
370 for (blkItr=bc_field_managers_.begin();blkItr!=bc_field_managers_.end();++blkItr,++bc_index) {
377 type =
"_Dirichlet_";
381 type =
"_Interface_";
387 fm.writeGraphvizFile(filename_prefix+
"_BC_"+std::to_string(bc_index)+type+sideId+
"_"+blockId);
398 if(phx_volume_field_managers_.size()<1)
401 TEUCHOS_ASSERT(phx_volume_field_managers_.size()==physicsBlocks.size());
403 std::vector<Teuchos::RCP<panzer::PhysicsBlock> >::const_iterator blkItr;
405 for (blkItr=physicsBlocks.begin();blkItr!=physicsBlocks.end();++blkItr,++index) {
407 std::string blockId = (*blkItr)->elementBlockID();
409 std::string filename = filename_prefix+
"_VOLUME_"+blockId+
".txt";
411 ofs.open(filename.c_str());
413 ofs << *(phx_volume_field_managers_[index]) << std::endl;
425 typedef std::map<panzer::BC,std::map<unsigned,PHX::FieldManager<panzer::Traits> >,
panzer::LessBC> FMMap;
427 FMMap::const_iterator blkItr;
429 for (blkItr=bc_field_managers_.begin();blkItr!=bc_field_managers_.end();++blkItr,++bc_index) {
436 type =
"_Dirichlet_";
440 type =
"_Interface_";
447 std::string filename = filename_prefix+
"_BC_"+std::to_string(bc_index)+type+sideId+
"_"+blockId+
".txt";
449 ofs.open(filename.c_str());
451 ofs << fm << std::endl;
468 std::vector<PHX::index_size_type> derivative_dimensions;
475 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
477 std::vector<PHX::index_size_type> derivative_dimensions;
485 std::vector<PHX::index_size_type> derivative_dimensions;
486 derivative_dimensions.push_back(1);
487 if (user_data.
isType<
int>(
"Tangent Dimension"))
488 derivative_dimensions[0] = user_data.
get<
int>(
"Tangent Dimension");
Interface for constructing a BCStrategy_TemplateManager.
virtual int getElementBlockGIDCount(const std::string &blockId) const =0
How any GIDs are associate with a particular element block.
void setupVolumeFieldManagers(const std::vector< Teuchos::RCP< panzer::PhysicsBlock > > &physicsBlocks, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &cm_factory, const Teuchos::ParameterList &closure_models, const LinearObjFactory< panzer::Traits > &lo_factory, const Teuchos::ParameterList &user_data)
Teuchos::RCP< const std::vector< Intrepid2::Orientation > > orientations_
BCType
Type of boundary condition.
std::string elementBlockID() const
Returns the element block id associated with this sideset.
T & get(const std::string &name, T def_value)
void writeVolumeGraphvizDependencyFiles(std::string filename_prefix, const std::vector< Teuchos::RCP< panzer::PhysicsBlock > > &physicsBlocks) const
void buildAndRegisterClosureModelEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &factory, const Teuchos::ParameterList &models, const Teuchos::ParameterList &user_data) const
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void buildAndRegisterScatterEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::LinearObjFactory< panzer::Traits > &lof, const Teuchos::ParameterList &user_data) const
const std::string & getElementBlock(const int block=0) const
Get element block name.
void writeBCGraphvizDependencyFiles(std::string filename_prefix) const
void buildAndRegisterGatherAndOrientationEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::LinearObjFactory< panzer::Traits > &lof, const Teuchos::ParameterList &user_data) const
void setKokkosExtendedDataTypeDimensions(const std::string &eblock, const panzer::UniqueGlobalIndexerBase &globalIndexer, const Teuchos::ParameterList &user_data, PHX::FieldManager< panzer::Traits > &fm) const
virtual Teuchos::RCP< panzer::BCStrategy_TemplateManager< panzer::Traits > > buildBCStrategy(const panzer::BC &bc, const Teuchos::RCP< panzer::GlobalData > &global_data) const =0
void writeBCTextDependencyFiles(std::string filename_prefix) const
Teuchos::RCP< panzer::GlobalData > globalData() const
void buildAndRegisterDOFProjectionsToIPEvaluators(PHX::FieldManager< panzer::Traits > &fm, const Teuchos::Ptr< const panzer::LinearObjFactory< panzer::Traits > > &lof, const Teuchos::ParameterList &user_data) const
void print(std::ostream &os) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Data for determining cell topology and dimensionality.
void writeVolumeTextDependencyFiles(std::string filename_prefix, const std::vector< Teuchos::RCP< panzer::PhysicsBlock > > &physicsBlocks) const
std::string elementBlockID() const
BCType bcType() const
Returns the boundary condition type (Dirichlet or Neumann or Interface).
virtual Teuchos::RCP< const panzer::UniqueGlobalIndexerBase > getRangeGlobalIndexer() const =0
Get the range global indexer object associated with this factory.
virtual bool registerEvaluators(PHX::FieldManager< panzer::Traits > &fm, const WorksetDescriptor &wd, const PhysicsBlock &pb) const =0
std::string sidesetID() const
Returns the set id.
std::ostream & operator<<(std::ostream &os, const AssemblyEngineInArgs &in)
bool isType(const std::string &name) const
WorksetDescriptor blockDescriptor(const std::string &eBlock)
WorksetDescriptor bcDescriptor(const panzer::BC &bc)
Stores input information for a boundary condition.
void setupBCFieldManagers(const std::vector< panzer::BC > &bcs, const std::vector< Teuchos::RCP< panzer::PhysicsBlock > > &physicsBlocks, const panzer::EquationSetFactory &eqset_factory, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &cm_factory, const panzer::BCStrategyFactory &bc_factory, const Teuchos::ParameterList &closure_models, const LinearObjFactory< panzer::Traits > &lo_factory, const Teuchos::ParameterList &user_data)
#define TEUCHOS_ASSERT(assertion_test)
void buildAndRegisterEquationSetEvaluators(PHX::FieldManager< panzer::Traits > &fm, const Teuchos::ParameterList &user_data) const
Teuchos::RCP< const std::vector< panzer::Workset > > worksets_