43 #ifndef PANZER_GATHER_ORIENTATION_IMPL_HPP
44 #define PANZER_GATHER_ORIENTATION_IMPL_HPP
46 #include "Teuchos_Assert.hpp"
47 #include "Phalanx_DataLayout.hpp"
53 #include "Teuchos_FancyOStream.hpp"
55 template<
typename EvalT,
typename TRAITS,
typename LO,
typename GO>
61 indexers_.push_back(indexer);
63 const std::vector<std::string>& names =
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");
86 template<
typename EvalT,
typename TRAITS,
typename LO,
typename GO>
92 const std::vector<std::string>& names =
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");
115 template<
typename EvalT,
typename TRAITS,
typename LO,
typename GO>
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;
137 template<
typename EvalT,
typename TRAITS,
typename LO,
typename GO>
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);
Teuchos::RCP< std::vector< std::string > > indexerNames_
T & get(const std::string &name, T def_value)
int getFieldBlock(const std::string &fieldName, const std::vector< Teuchos::RCP< const GlobalIndexer >> &ugis)
std::vector< PHX::MDField< ScalarT, Cell, NODE > > gatherFieldOrientations_
void evaluateFields(typename TRAITS::EvalData d)
bool isType(const std::string &name) const
#define TEUCHOS_ASSERT(assertion_test)
void postRegistrationSetup(typename TRAITS::SetupData d, PHX::FieldManager< TRAITS > &vm)