43 #ifndef PANZER_GATHER_TANGENT_TPETRA_IMPL_HPP 44 #define PANZER_GATHER_TANGENT_TPETRA_IMPL_HPP 46 #include "Teuchos_Assert.hpp" 47 #include "Phalanx_DataLayout.hpp" 54 #include "Teuchos_FancyOStream.hpp" 56 #include "Tpetra_Vector.hpp" 57 #include "Tpetra_Map.hpp" 59 template<
typename EvalT,
typename TRAITS,
typename LO,
typename GO,
typename NodeT>
64 : globalIndexer_(indexer)
65 , useTimeDerivativeSolutionVector_(false)
66 , globalDataKey_(
"Tangent Gather Container")
68 const std::vector<std::string>& names =
81 for (std::size_t fd = 0; fd < names.size(); ++fd) {
87 if (p.
isType<
bool>(
"Use Time Derivative Solution Vector"))
90 if (p.
isType<std::string>(
"Global Data Key"))
93 this->setName(
"Gather Tangent");
97 template<
typename EvalT,
typename TRAITS,
typename LO,
typename GO,
typename NodeT>
104 fieldIds_.resize(gatherFields_.size());
106 for (std::size_t fd = 0; fd < gatherFields_.size(); ++fd) {
107 const std::string& fieldName = (*indexerNames_)[fd];
108 fieldIds_[fd] = globalIndexer_->getFieldNum(fieldName);
111 this->utils.setFieldData(gatherFields_[fd],fm);
114 indexerNames_ = Teuchos::null;
118 template<
typename EvalT,
typename TRAITS,
typename LO,
typename GO,
typename NodeT>
123 using Teuchos::rcp_dynamic_cast;
128 if (d.gedc.containsDataObject(globalDataKey_)) {
133 if(loc_pair!=Teuchos::null) {
135 tpetraContainer_ = rcp_dynamic_cast<LOC>(loc,
true);
138 if(tpetraContainer_==Teuchos::null) {
139 tpetraContainer_ = rcp_dynamic_cast<LOC>(ged,
true);
145 template<
typename EvalT,
typename TRAITS,
typename LO,
typename GO,
typename NodeT>
151 if (tpetraContainer_ == Teuchos::null)
156 std::vector<LO> LIDs;
159 std::string blockId = this->wda(workset).block_id;
160 const std::vector<std::size_t> & localCellIds = this->wda(workset).cell_local_ids;
163 if (useTimeDerivativeSolutionVector_)
164 x = tpetraContainer_->get_dxdt();
166 x = tpetraContainer_->get_x();
176 for(std::size_t worksetCellIndex=0;worksetCellIndex<localCellIds.size();++worksetCellIndex) {
177 std::size_t cellLocalId = localCellIds[worksetCellIndex];
179 LIDs = globalIndexer_->getElementLIDs(cellLocalId);
182 for (std::size_t fieldIndex=0; fieldIndex<gatherFields_.size();fieldIndex++) {
183 int fieldNum = fieldIds_[fieldIndex];
184 const std::vector<int> & elmtOffset = globalIndexer_->getGIDFieldOffsets(blockId,fieldNum);
190 (gatherFields_[fieldIndex])(worksetCellIndex,
basis) = x_array[lid];
Teuchos::RCP< std::vector< std::string > > indexerNames_
void preEvaluate(typename TRAITS::PreEvalData d)
void evaluateFields(typename TRAITS::EvalData d)
T & get(const std::string &name, T def_value)
std::vector< PHX::MDField< ScalarT, Cell, NODE > > gatherFields_
bool useTimeDerivativeSolutionVector_
std::string globalDataKey_
bool isType(const std::string &name) const
Teuchos::RCP< LinearObjContainer > getGhostedLOC() const
Teuchos::RCP< const panzer::PureBasis > basis
Interpolates basis DOF values to IP DOF values.
void postRegistrationSetup(typename TRAITS::SetupData d, PHX::FieldManager< TRAITS > &vm)
#define TEUCHOS_ASSERT(assertion_test)
Teuchos::RCP< PHX::DataLayout > functional
<Cell,Basis> or <Cell,Basis>