43 #ifndef __Panzer_GatherTangent_Epetra_impl_hpp__
44 #define __Panzer_GatherTangent_Epetra_impl_hpp__
53 #include "Epetra_Vector.h"
63 #include "Teuchos_Assert.hpp"
66 #include "Thyra_SpmdVectorBase.hpp"
73 template<
typename EvalT,
typename TRAITS,
typename LO,
typename GO>
79 globalIndexer_(indexer),
80 useTimeDerivativeSolutionVector_(false),
81 globalDataKey_(
"Tangent Gather Container")
85 using PHX::typeAsString;
99 if (p.
isType<
bool>(
"Use Time Derivative Solution Vector"))
101 p.
get<
bool>(
"Use Time Derivative Solution Vector");
102 if (p.
isType<
string>(
"Global Data Key"))
111 MDField<ScalarT, Cell, NODE>(names[fd], basis->functional);
116 string firstName(
"<none>");
118 firstName = names[0];
119 string n(
"GatherTangent (Epetra): " + firstName +
" (" +
120 typeAsString<EvalT>() +
")");
129 template<
typename EvalT,
typename TRAITS,
typename LO,
typename GO>
133 typename TRAITS::SetupData ,
136 using std::logic_error;
146 const string& fieldName((*indexerNames_)[fd]);
147 fieldIds_[fd] = globalIndexer_->getFieldNum(fieldName);
151 "GatherTangent_Epetra<Residual>: Could not find field \"" + fieldName +
152 "\" in the global indexer. ");
154 indexerNames_ = null;
162 template<
typename EvalT,
typename TRAITS,
typename LO,
typename GO>
166 typename TRAITS::PreEvalData d)
169 using Teuchos::rcp_dynamic_cast;
172 if (d.gedc->containsDataObject(globalDataKey_))
174 RCP<GED> ged = d.gedc->getDataObject(globalDataKey_);
175 dxdpEvRoGed_ = rcp_dynamic_cast<EVROGED>(ged,
true);
184 template<
typename EvalT,
typename TRAITS,
typename LO,
typename GO>
188 typename TRAITS::EvalData workset)
195 using Teuchos::ptrFromRef;
197 using Teuchos::rcp_dynamic_cast;
198 using Thyra::SpmdVectorBase;
202 if (dxdpEvRoGed_.is_null())
206 string blockId(this->wda(workset).block_id);
207 const vector<size_t>& localCellIds = this->wda(workset).cell_local_ids;
208 int numCells(localCellIds.size()),
numFields(gatherFields_.size());
215 for (
int cell(0); cell < numCells; ++cell)
217 size_t cellLocalId(localCellIds[cell]);
218 auto LIDs = globalIndexer_->getElementLIDs(cellLocalId);
221 for (
int fieldIndex(0); fieldIndex <
numFields; ++fieldIndex)
223 MDField<ScalarT, Cell, NODE>&
field = gatherFields_[fieldIndex];
224 int fieldNum(fieldIds_[fieldIndex]);
225 const vector<int>& elmtOffset =
226 globalIndexer_->getGIDFieldOffsets(blockId, fieldNum);
227 int numBases(elmtOffset.size());
230 for (
int basis(0); basis < numBases; ++basis)
232 int offset(elmtOffset[basis]), lid(LIDs[offset]);
233 field(cell, basis) = (*dxdpEvRoGed_)[lid];
239 #endif // __Panzer_GatherTangent_Epetra_impl_hpp__
std::vector< PHX::MDField< ScalarT, Cell, NODE > > gatherFields_
The fields to be gathered.
T & get(const std::string &name, T def_value)
std::string globalDataKey_
The key identifying the GlobalEvaluationData.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Teuchos::RCP< std::vector< std::string > > indexerNames_
A list of the names of the fields to be gathered.
GatherTangent_Epetra()
Default Constructor (disabled).
void postRegistrationSetup(typename TRAITS::SetupData d, PHX::FieldManager< TRAITS > &fm)
Post-Registration Setup.
This class provides a boundary exchange communication mechanism for vectors.
PHX::MDField< ScalarT, panzer::Cell, panzer::BASIS > field
A field to which we'll contribute, or in which we'll store, the result of computing this integral...
bool isType(const std::string &name) const
Description and data layouts associated with a particular basis.
#define TEUCHOS_ASSERT(assertion_test)
void preEvaluate(typename TRAITS::PreEvalData d)
Pre-Evaluate: Sets the tangent vector.
void evaluateFields(typename TRAITS::EvalData d)
Evaluate Fields: Gather operation.
bool useTimeDerivativeSolutionVector_
A flag indicating whether we should be working with or .