59 const std::map<std::string,WorksetNeeds> & needs)
60 : wkstFactory_(factory), worksetSize_(0)
70 : wkstFactory_(wc.wkstFactory_)
71 , worksetSize_(wc.worksetSize_)
104 std::map<std::string,WorksetNeeds>::const_iterator itr =
ebToNeeds_.find(eBlock);
106 TEUCHOS_TEST_FOR_EXCEPTION(itr==
ebToNeeds_.end(),std::logic_error,
107 "WorksetContainer::lookupNeeds no WorksetNeeds object is associated "
108 "with the element block \""+eBlock+
"\".");
113Teuchos::RCP<std::vector<Workset> >
116 Teuchos::RCP<std::vector<Workset> > worksetVector;
117 WorksetMap::iterator itr =
worksets_.find(wd);
130 if(worksetVector!=Teuchos::null)
137 worksetVector = itr->second;
139 return worksetVector;
143Teuchos::RCP<std::map<unsigned,Workset> >
146 Teuchos::RCP<std::map<unsigned,Workset> > worksetMap;
162 if(worksetMap!=Teuchos::null)
165 if(worksetMap!=Teuchos::null)
172 worksetMap = itr->second;
187addBasis(
const std::string & type,
int order,
const std::string & rep_field)
197 needs.
bases.push_back(basis);
214 TEUCHOS_TEST_FOR_EXCEPTION(
globalIndexer_ == Teuchos::null, std::logic_error,
215 "global indexer is not set yet");
219 for(WorksetMap::iterator itr=
worksets_.begin();
221 std::string eBlock = itr->first.getElementBlock();
237 std::size_t hash = std::hash<WorksetDescriptor>()(wd);
238 for(std::size_t i=0;i<worksets.size();i++)
239 worksets[i].setIdentifier(hash+i);
245 std::size_t hash = std::hash<WorksetDescriptor>()(wd);
246 std::size_t offset = 0;
247 for(
auto itr : workset_map) {
249 workset_map[itr.first].setIdentifier(hash+offset);
256applyOrientations(
const std::string & eBlock, std::vector<Workset> & worksets)
const
266 Teuchos::FancyOStream fout(Teuchos::rcpFromRef(std::cout));
267 fout.setOutputToRootOnly(0);
269 fout <<
"Panzer Warning: No global indexer assigned to a workset container or factory. "
270 <<
"Orientation of the basis for edge basis functions cannot be applied, "
271 <<
"if those basis functions are used, there will be problems!" << std::endl;
277 TEUCHOS_TEST_FOR_EXCEPTION(
orientations_ == Teuchos::null, std::logic_error,
278 "intrepid2 orientation is not constructed");
290 if(needs.
bases.size()>0) {
292 TEUCHOS_ASSERT(needs.
getBases().size()==0);
294 for(std::size_t w=0;w<needs.
bases.size();w++) {
302 std::vector<Intrepid2::Orientation> ortsPerBlock;
305 for(std::size_t i=0;i<worksets.size();i++) {
307 if(worksets[i].num_cells<=0)
continue;
309 for(std::size_t j=0;j<worksets[i].numDetails();j++) {
312 ortsPerBlock.clear();
313 for (
int k=0;k<worksets[i].num_cells;++k) {
317 for(std::size_t basis_index=0;basis_index<
details.bases.size();basis_index++) {
318 Teuchos::RCP<const BasisIRLayout> layout =
details.bases[basis_index]->basis_layout;
321 if(layout->getBasis()->name()!=basis.
name())
324 TEUCHOS_ASSERT(layout!=Teuchos::null);
325 TEUCHOS_ASSERT(layout->getBasis()!=Teuchos::null);
326 if(layout->getBasis()->requiresOrientations()) {
328 auto & bv = *
details.bases[basis_index];
329 if(not bv.orientationsApplied())
330 bv.applyOrientations(ortsPerBlock,(
int) worksets[i].num_cells);
337 else if(needs.
getBases().size()>0) {
339 TEUCHOS_ASSERT(needs.
bases.size()==0);
343 for(
const auto & bd : needs.
getBases()) {
346 std::vector<Intrepid2::Orientation> ortsPerBlock;
349 for(std::size_t i=0;i<worksets.size();i++) {
351 if(worksets[i].num_cells<=0)
continue;
353 for(std::size_t j=0;j<worksets[i].numDetails();j++) {
356 ortsPerBlock.clear();
358 for (
int k=0;k<
details.numOwnedCells();++k) {
364 auto & bv =
details.getBasisValues(bd,
id);
365 if(not bv.orientationsApplied())
366 bv.applyOrientations(ortsPerBlock,(
int) worksets[i].num_cells);
386 Teuchos::FancyOStream fout(Teuchos::rcpFromRef(std::cout));
387 fout.setOutputToRootOnly(0);
389 fout <<
"Panzer Warning: No global indexer assigned to a workset container or factory. "
390 <<
"Orientation of the basis for edge basis functions cannot be applied, "
391 <<
"if those basis functions are used, there will be problems!";
403 if(needs.
bases.size()>0) {
405 TEUCHOS_ASSERT(needs.
getBases().size()==0);
406 for(std::size_t i=0;i<needs.
bases.size();i++) {
413 std::vector<Intrepid2::Orientation> ortsPerBlock;
416 for(std::map<unsigned,Workset>::iterator itr=worksets.begin();
417 itr!=worksets.end();++itr) {
420 if(itr->second.num_cells<=0)
continue;
422 for(std::size_t j=0;j<itr->second.numDetails();j++) {
425 ortsPerBlock.clear();
426 for (
int k=0;k<itr->second.num_cells;++k) {
430 for(std::size_t basis_index=0;basis_index<
details.bases.size();basis_index++) {
431 Teuchos::RCP<const BasisIRLayout> layout =
details.bases[basis_index]->basis_layout;
434 if(layout->getBasis()->name()!=basis.
name())
437 TEUCHOS_ASSERT(layout!=Teuchos::null);
438 TEUCHOS_ASSERT(layout->getBasis()!=Teuchos::null);
439 if(layout->getBasis()->requiresOrientations()) {
441 auto & bv = *
details.bases[basis_index];
442 if(not bv.orientationsApplied())
443 bv.applyOrientations(ortsPerBlock,(
int) itr->second.num_cells);
450 else if(needs.
getBases().size()>0) {
452 TEUCHOS_ASSERT(needs.
bases.size()==0);
456 for(
const auto & bd : needs.
getBases()) {
459 std::vector<Intrepid2::Orientation> ortsPerBlock;
462 for(std::map<unsigned,Workset>::iterator itr=worksets.begin();
463 itr!=worksets.end();++itr) {
466 if(itr->second.num_cells<=0)
continue;
468 for(std::size_t j=0;j<itr->second.numDetails();j++) {
471 ortsPerBlock.clear();
472 for (
int k=0;k<itr->second.num_cells;++k) {
478 auto & bv =
details.getBasisValues(bd,
id);
479 if(not bv.orientationsApplied())
480 bv.applyOrientations(ortsPerBlock,(
int) itr->second.num_cells);
489 const std::vector<std::string> & elementBlockNames,
490 std::map<std::string,Teuchos::RCP<std::vector<Workset> > > & volumeWksts)
492 for(std::size_t i=0;i<elementBlockNames.size();i++) {
494 volumeWksts[elementBlockNames[i]] = wc.
getWorksets(wd);
499 const std::vector<BC> & bcs,
500 std::map<
BC,Teuchos::RCP<std::map<unsigned,Workset> >,
LessBC> & sideWksts)
502 for(std::size_t i=0;i<bcs.size();i++) {
504 Teuchos::RCP<std::map<unsigned,Workset> > wksts = wc.
getSideWorksets(wd);
505 if(wksts!=Teuchos::null)
506 sideWksts[bcs[i]] = wksts;
Stores input information for a boundary condition.
Description and data layouts associated with a particular basis.
bool requiresOrientations() const
std::string name() const
A unique key that is the combination of the basis type and basis order.
Class that provides access to worksets on each element block and side set.
Teuchos::RCP< std::vector< Workset > > getWorksets(const WorksetDescriptor &wd)
Access to volume worksets.
void clearVolumeWorksets()
const WorksetNeeds & lookupNeeds(const std::string &eBlock) const
Look up an input physics block, throws an exception if it can not be found.
void setIdentifiers(const WorksetDescriptor &wd, std::vector< Workset > &worksets)
void applyOrientations(const Teuchos::RCP< const panzer::GlobalIndexer > &ugi)
void addBasis(const std::string &type, int order, const std::string &rep_field)
WorksetMap worksets_
Maps element blocks to input physics block objects.
void setGlobalIndexer(const Teuchos::RCP< const panzer::GlobalIndexer > &ugi)
void setNeeds(const std::string &eBlock, const WorksetNeeds &needs)
Teuchos::RCP< std::vector< Intrepid2::Orientation > > orientations_
Teuchos::RCP< std::map< unsigned, Workset > > getSideWorksets(const WorksetDescriptor &desc)
Access, and construction of side worksets.
WorksetContainer()
Default contructor, starts with no workset factory objects.
Teuchos::RCP< const WorksetFactoryBase > wkstFactory_
Teuchos::RCP< const panzer::GlobalIndexer > globalIndexer_
std::map< std::string, WorksetNeeds > ebToNeeds_
How to construct worksets.
const std::string & getElementBlock(const int block=0) const
Get element block name.
bool connectsElementBlocks() const
Identifies this workset as an interface between two element blocks.
bool applyOrientations() const
WorksetDescriptor blockDescriptor(const std::string &eBlock)
void getVolumeWorksetsFromContainer(WorksetContainer &wc, const std::vector< std::string > &elementBlockNames, std::map< std::string, Teuchos::RCP< std::vector< Workset > > > &volumeWksts)
void buildIntrepidOrientation(std::vector< Intrepid2::Orientation > &orientation, panzer::ConnManager &connMgr)
void getSideWorksetsFromContainer(WorksetContainer &wc, const std::vector< BC > &bcs, std::map< BC, Teuchos::RCP< std::map< unsigned, Workset > >, LessBC > &sideWksts)
std::vector< std::string > rep_field_name
const std::vector< panzer::IntegrationDescriptor > & getIntegrators() const
Get a list of integrators being requested.
const std::vector< panzer::BasisDescriptor > & getBases() const
Get a list of bases being requested.
std::vector< Teuchos::RCP< const PureBasis > > bases