26 const Teuchos::RCP<const panzer::GlobalIndexer> & indexer,
27 const Teuchos::ParameterList& p)
29 indexers_.push_back(indexer);
31 const std::vector<std::string>& names =
32 *(p.get< Teuchos::RCP< std::vector<std::string> > >(
"DOF Names"));
34 indexerNames_ = p.get< Teuchos::RCP< std::vector<std::string> > >(
"Indexer Names");
37 Teuchos::RCP<const panzer::PureBasis> basis;
38 if(p.isType< Teuchos::RCP<panzer::PureBasis> >(
"Basis"))
39 basis = p.get< Teuchos::RCP<panzer::PureBasis> >(
"Basis");
41 basis = p.get< Teuchos::RCP<const panzer::PureBasis> >(
"Basis");
43 gatherFieldOrientations_.resize(names.size());
44 for (std::size_t fd = 0; fd < names.size(); ++fd) {
45 gatherFieldOrientations_[fd] =
47 PHX::MDField<ScalarT,Cell,NODE>(basis->name()+
" Orientation",basis->functional);
48 this->addEvaluatedField(gatherFieldOrientations_[fd]);
51 this->setName(
"Gather Orientation");
56GatherOrientation(
const std::vector<Teuchos::RCP<const GlobalIndexer> > & indexers,
57 const Teuchos::ParameterList& p)
60 const std::vector<std::string>& names =
61 *(p.get< Teuchos::RCP< std::vector<std::string> > >(
"DOF Names"));
63 indexerNames_ = p.get< Teuchos::RCP< std::vector<std::string> > >(
"Indexer Names");
66 Teuchos::RCP<const panzer::PureBasis> basis;
67 if(p.isType< Teuchos::RCP<panzer::PureBasis> >(
"Basis"))
68 basis = p.get< Teuchos::RCP<panzer::PureBasis> >(
"Basis");
70 basis = p.get< Teuchos::RCP<const panzer::PureBasis> >(
"Basis");
73 for (std::size_t fd = 0; fd < names.size(); ++fd) {
75 PHX::MDField<ScalarT,Cell,NODE>(basis->name()+
" Orientation",basis->functional);
79 this->setName(
"Gather Orientation");
88 TEUCHOS_ASSERT(gatherFieldOrientations_.size() == indexerNames_->size());
90 indexerIds_.resize(gatherFieldOrientations_.size());
91 subFieldIds_.resize(gatherFieldOrientations_.size());
93 for (std::size_t fd = 0; fd < gatherFieldOrientations_.size(); ++fd) {
95 const std::string& fieldName = (*indexerNames_)[fd];
98 subFieldIds_[fd] = indexers_[indexerIds_[fd]]->getFieldNum(fieldName);
101 indexerNames_ = Teuchos::null;
109 std::vector<double> orientation;
112 std::string blockId = this->wda(workset).block_id;
113 const std::vector<std::size_t> & localCellIds = this->wda(workset).cell_local_ids;
116 for (std::size_t fieldIndex=0; fieldIndex<gatherFieldOrientations_.size();fieldIndex++) {
118 int indexerId = indexerIds_[fieldIndex];
119 int subFieldNum = subFieldIds_[fieldIndex];
121 auto subRowIndexer = indexers_[indexerId];
122 const std::vector<int> & elmtOffset = subRowIndexer->getGIDFieldOffsets(blockId,subFieldNum);
125 for(std::size_t worksetCellIndex=0;worksetCellIndex<localCellIds.size();++worksetCellIndex) {
126 std::size_t cellLocalId = localCellIds[worksetCellIndex];
128 subRowIndexer->getElementOrientation(cellLocalId,orientation);
131 for(std::size_t basis=0;basis<elmtOffset.size();basis++) {
132 int offset = elmtOffset[basis];
133 (gatherFieldOrientations_[fieldIndex])(worksetCellIndex,basis) = orientation[offset];
134 (gatherFieldOrientations_[fieldIndex])(worksetCellIndex,basis) = std::sqrt(-1.0);