59 const std::map<std::string,WorksetNeeds> & needs)
60 : wkstFactory_(factory), worksetSize_(-1)
70 : wkstFactory_(wc.wkstFactory_)
71 , worksetSize_(wc.worksetSize_)
94 std::map<std::string,WorksetNeeds>::const_iterator itr =
ebToNeeds_.find(eBlock);
96 TEUCHOS_TEST_FOR_EXCEPTION(itr==
ebToNeeds_.end(),std::logic_error,
97 "WorksetContainer::lookupNeeds no WorksetNeeds object is associated "
98 "with the element block \""+eBlock+
"\".");
103 Teuchos::RCP<std::vector<Workset> >
106 Teuchos::RCP<std::vector<Workset> > worksetVector;
107 WorksetMap::iterator itr =
worksets_.find(wd);
118 if(worksetVector!=Teuchos::null)
125 worksetVector = itr->second;
127 return worksetVector;
131 Teuchos::RCP<std::map<unsigned,Workset> >
134 Teuchos::RCP<std::map<unsigned,Workset> > worksetMap;
150 if(worksetMap!=Teuchos::null)
153 if(worksetMap!=Teuchos::null)
160 worksetMap = itr->second;
168 setGlobalIndexer(
const Teuchos::RCP<const panzer::UniqueGlobalIndexerBase> & ugi)
175 addBasis(
const std::string & type,
int order,
const std::string & rep_field)
185 needs.
bases.push_back(basis);
194 applyOrientations(
const Teuchos::RCP<const panzer::UniqueGlobalIndexerBase> & ugi)
202 TEUCHOS_TEST_FOR_EXCEPTION(
globalIndexer_ == Teuchos::null, std::logic_error,
203 "global indexer is not set yet");
207 for(WorksetMap::iterator itr=
worksets_.begin();
209 std::string eBlock = itr->first.getElementBlock();
225 std::size_t hash = std::hash<WorksetDescriptor>()(wd);
226 for(std::size_t i=0;i<worksets.size();i++)
227 worksets[i].setIdentifier(hash+i);
233 std::size_t hash = std::hash<WorksetDescriptor>()(wd);
234 std::size_t offset = 0;
235 for(
auto itr : workset_map) {
237 workset_map[itr.first].setIdentifier(hash+offset);
244 applyOrientations(
const std::string & eBlock, std::vector<Workset> & worksets)
const
254 Teuchos::FancyOStream fout(Teuchos::rcpFromRef(std::cout));
255 fout.setOutputToRootOnly(0);
257 fout <<
"Panzer Warning: No global indexer assigned to a workset container. "
258 <<
"Orientation of the basis for edge basis functions cannot be applied, "
259 <<
"if those basis functions are used, there will be problems!" << std::endl;
264 TEUCHOS_TEST_FOR_EXCEPTION(
orientations_ == Teuchos::null, std::logic_error,
265 "intrepid2 orientation is not constructed");
274 if(needs.
bases.size()>0) {
276 TEUCHOS_ASSERT(needs.
getBases().size()==0);
278 for(std::size_t w=0;w<needs.
bases.size();w++) {
286 std::vector<Intrepid2::Orientation> ortsPerBlock;
289 for(std::size_t i=0;i<worksets.size();i++) {
291 if(worksets[i].num_cells<=0)
continue;
293 for(std::size_t j=0;j<worksets[i].numDetails();j++) {
296 ortsPerBlock.clear();
297 for (
int k=0;k<worksets[i].num_cells;++k) {
301 for(std::size_t basis_index=0;basis_index<
details.bases.size();basis_index++) {
302 Teuchos::RCP<const BasisIRLayout> layout =
details.bases[basis_index]->basis_layout;
305 if(layout->getBasis()->name()!=basis.
name())
308 TEUCHOS_ASSERT(layout!=Teuchos::null);
309 TEUCHOS_ASSERT(layout->getBasis()!=Teuchos::null);
310 if(layout->getBasis()->requiresOrientations()) {
312 details.bases[basis_index]->applyOrientations(ortsPerBlock);
319 else if(needs.
getBases().size()>0) {
321 TEUCHOS_ASSERT(needs.
bases.size()==0);
325 for(
const auto & bd : needs.
getBases()) {
328 std::vector<Intrepid2::Orientation> ortsPerBlock;
331 for(std::size_t i=0;i<worksets.size();i++) {
333 if(worksets[i].num_cells<=0)
continue;
335 for(std::size_t j=0;j<worksets[i].numDetails();j++) {
338 ortsPerBlock.clear();
340 for (
int k=0;k<
details.numOwnedCells();++k) {
346 details.getBasisValues(bd,
id).applyOrientations(ortsPerBlock);
366 Teuchos::FancyOStream fout(Teuchos::rcpFromRef(std::cout));
367 fout.setOutputToRootOnly(0);
369 fout <<
"Panzer Warning: No global indexer assigned to a workset container. "
370 <<
"Orientation of the basis for edge basis functions cannot be applied, "
371 <<
"if those basis functions are used, there will be problems!";
381 if(needs.
bases.size()>0) {
383 TEUCHOS_ASSERT(needs.
getBases().size()==0);
384 for(std::size_t i=0;i<needs.
bases.size();i++) {
391 std::vector<Intrepid2::Orientation> ortsPerBlock;
394 for(std::map<unsigned,Workset>::iterator itr=worksets.begin();
395 itr!=worksets.end();++itr) {
398 if(itr->second.num_cells<=0)
continue;
400 for(std::size_t j=0;j<itr->second.numDetails();j++) {
403 ortsPerBlock.clear();
404 for (
int k=0;k<itr->second.num_cells;++k) {
408 for(std::size_t basis_index=0;basis_index<
details.bases.size();basis_index++) {
409 Teuchos::RCP<const BasisIRLayout> layout =
details.bases[basis_index]->basis_layout;
412 if(layout->getBasis()->name()!=basis.
name())
415 TEUCHOS_ASSERT(layout!=Teuchos::null);
416 TEUCHOS_ASSERT(layout->getBasis()!=Teuchos::null);
417 if(layout->getBasis()->requiresOrientations()) {
419 details.bases[basis_index]->applyOrientations(ortsPerBlock);
426 else if(needs.
getBases().size()>0) {
428 TEUCHOS_ASSERT(needs.
bases.size()==0);
432 for(
const auto & bd : needs.
getBases()) {
435 std::vector<Intrepid2::Orientation> ortsPerBlock;
438 for(std::map<unsigned,Workset>::iterator itr=worksets.begin();
439 itr!=worksets.end();++itr) {
442 if(itr->second.num_cells<=0)
continue;
444 for(std::size_t j=0;j<itr->second.numDetails();j++) {
447 ortsPerBlock.clear();
448 for (
int k=0;k<itr->second.num_cells;++k) {
454 details.getBasisValues(bd,
id).applyOrientations(ortsPerBlock);
463 const std::vector<std::string> & elementBlockNames,
464 std::map<std::string,Teuchos::RCP<std::vector<Workset> > > & volumeWksts)
466 for(std::size_t i=0;i<elementBlockNames.size();i++) {
468 volumeWksts[elementBlockNames[i]] = wc.
getWorksets(wd);
473 const std::vector<BC> & bcs,
474 std::map<
BC,Teuchos::RCP<std::map<unsigned,Workset> >,
LessBC> & sideWksts)
476 for(std::size_t i=0;i<bcs.size();i++) {
478 Teuchos::RCP<std::map<unsigned,Workset> > wksts = wc.
getSideWorksets(wd);
479 if(wksts!=Teuchos::null)
480 sideWksts[bcs[i]] = wksts;