11 #ifndef PANZER_GATHER_ORIENTATION_IMPL_HPP
12 #define PANZER_GATHER_ORIENTATION_IMPL_HPP
14 #include "Teuchos_Assert.hpp"
15 #include "Phalanx_DataLayout.hpp"
21 #include "Teuchos_FancyOStream.hpp"
23 template<
typename EvalT,
typename TRAITS,
typename LO,
typename GO>
29 indexers_.push_back(indexer);
31 const std::vector<std::string>& names =
43 gatherFieldOrientations_.resize(names.size());
44 for (std::size_t fd = 0; fd < names.size(); ++fd) {
45 gatherFieldOrientations_[fd] =
48 this->addEvaluatedField(gatherFieldOrientations_[fd]);
51 this->setName(
"Gather Orientation");
54 template<
typename EvalT,
typename TRAITS,
typename LO,
typename GO>
60 const std::vector<std::string>& names =
73 for (std::size_t fd = 0; fd < names.size(); ++fd) {
79 this->setName(
"Gather Orientation");
83 template<
typename EvalT,
typename TRAITS,
typename LO,
typename GO>
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;
105 template<
typename EvalT,
typename TRAITS,
typename LO,
typename GO>
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);
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)