58 const Teuchos::RCP<const panzer::GlobalIndexer> & indexer,
59 const Teuchos::ParameterList& p)
61 indexers_.push_back(indexer);
63 const std::vector<std::string>& names =
64 *(p.get< Teuchos::RCP< std::vector<std::string> > >(
"DOF Names"));
66 indexerNames_ = p.get< Teuchos::RCP< std::vector<std::string> > >(
"Indexer Names");
69 Teuchos::RCP<const panzer::PureBasis> basis;
70 if(p.isType< Teuchos::RCP<panzer::PureBasis> >(
"Basis"))
71 basis = p.get< Teuchos::RCP<panzer::PureBasis> >(
"Basis");
73 basis = p.get< Teuchos::RCP<const panzer::PureBasis> >(
"Basis");
75 gatherFieldOrientations_.resize(names.size());
76 for (std::size_t fd = 0; fd < names.size(); ++fd) {
77 gatherFieldOrientations_[fd] =
79 PHX::MDField<ScalarT,Cell,NODE>(basis->name()+
" Orientation",basis->functional);
80 this->addEvaluatedField(gatherFieldOrientations_[fd]);
83 this->setName(
"Gather Orientation");
88GatherOrientation(
const std::vector<Teuchos::RCP<const GlobalIndexer> > & indexers,
89 const Teuchos::ParameterList& p)
92 const std::vector<std::string>& names =
93 *(p.get< Teuchos::RCP< std::vector<std::string> > >(
"DOF Names"));
95 indexerNames_ = p.get< Teuchos::RCP< std::vector<std::string> > >(
"Indexer Names");
98 Teuchos::RCP<const panzer::PureBasis> basis;
99 if(p.isType< Teuchos::RCP<panzer::PureBasis> >(
"Basis"))
100 basis = p.get< Teuchos::RCP<panzer::PureBasis> >(
"Basis");
102 basis = p.get< Teuchos::RCP<const panzer::PureBasis> >(
"Basis");
105 for (std::size_t fd = 0; fd < names.size(); ++fd) {
107 PHX::MDField<ScalarT,Cell,NODE>(basis->name()+
" Orientation",basis->functional);
111 this->setName(
"Gather Orientation");
120 TEUCHOS_ASSERT(gatherFieldOrientations_.size() == indexerNames_->size());
122 indexerIds_.resize(gatherFieldOrientations_.size());
123 subFieldIds_.resize(gatherFieldOrientations_.size());
125 for (std::size_t fd = 0; fd < gatherFieldOrientations_.size(); ++fd) {
127 const std::string& fieldName = (*indexerNames_)[fd];
130 subFieldIds_[fd] = indexers_[indexerIds_[fd]]->getFieldNum(fieldName);
133 indexerNames_ = Teuchos::null;
141 std::vector<double> orientation;
144 std::string blockId = this->wda(workset).block_id;
145 const std::vector<std::size_t> & localCellIds = this->wda(workset).cell_local_ids;
148 for (std::size_t fieldIndex=0; fieldIndex<gatherFieldOrientations_.size();fieldIndex++) {
150 int indexerId = indexerIds_[fieldIndex];
151 int subFieldNum = subFieldIds_[fieldIndex];
153 auto subRowIndexer = indexers_[indexerId];
154 const std::vector<int> & elmtOffset = subRowIndexer->getGIDFieldOffsets(blockId,subFieldNum);
157 for(std::size_t worksetCellIndex=0;worksetCellIndex<localCellIds.size();++worksetCellIndex) {
158 std::size_t cellLocalId = localCellIds[worksetCellIndex];
160 subRowIndexer->getElementOrientation(cellLocalId,orientation);
163 for(std::size_t basis=0;basis<elmtOffset.size();basis++) {
164 int offset = elmtOffset[basis];
165 (gatherFieldOrientations_[fieldIndex])(worksetCellIndex,basis) = orientation[offset];
166 (gatherFieldOrientations_[fieldIndex])(worksetCellIndex,basis) = std::sqrt(-1.0);