66 const Teuchos::RCP<const BlockedDOFManager> & indexer,
67 const Teuchos::ParameterList& p)
68 : gidIndexer_(indexer)
69 , useTimeDerivativeSolutionVector_(false)
70 , globalDataKey_(
"Tangent Gather Container")
72 const std::vector<std::string>& names =
73 *(p.get< Teuchos::RCP< std::vector<std::string> > >(
"DOF Names"));
75 indexerNames_ = p.get< Teuchos::RCP< std::vector<std::string> > >(
"Indexer Names");
77 Teuchos::RCP<panzer::PureBasis> basis =
78 p.get< Teuchos::RCP<panzer::PureBasis> >(
"Basis");
81 for (std::size_t fd = 0; fd < names.size(); ++fd) {
83 PHX::MDField<ScalarT,Cell,NODE>(names[fd],basis->functional);
87 if (p.isType<
bool>(
"Use Time Derivative Solution Vector"))
90 if (p.isType<std::string>(
"Global Data Key"))
93 this->setName(
"Gather Tangent");
132 using Teuchos::ArrayRCP;
133 using Teuchos::ptrFromRef;
134 using Teuchos::rcp_dynamic_cast;
137 using Thyra::SpmdVectorBase;
142 if (blockedContainer_ == Teuchos::null)
145 Teuchos::FancyOStream out(Teuchos::rcpFromRef(std::cout));
146 out.setShowProcRank(
true);
147 out.setOutputToRootOnly(-1);
149 std::vector<std::pair<int,GO> > GIDs;
150 std::vector<LO> LIDs;
153 std::string blockId = this->wda(workset).block_id;
154 const std::vector<std::size_t> & localCellIds = this->wda(workset).cell_local_ids;
156 Teuchos::RCP<ProductVectorBase<double> > x;
157 if (useTimeDerivativeSolutionVector_)
158 x = rcp_dynamic_cast<ProductVectorBase<double> >(blockedContainer_->get_dxdt());
160 x = rcp_dynamic_cast<ProductVectorBase<double> >(blockedContainer_->get_x());
163 for(std::size_t worksetCellIndex=0;worksetCellIndex<localCellIds.size();++worksetCellIndex) {
164 LO cellLocalId = localCellIds[worksetCellIndex];
166 gidIndexer_->getElementGIDsPair(cellLocalId,GIDs,blockId);
169 LIDs.resize(GIDs.size());
170 for(std::size_t i=0;i<GIDs.size();i++) {
172 RCP<const MapType> x_map = blockedContainer_->getMapForBlock(GIDs[i].first);
174 LIDs[i] = x_map->getLocalElement(GIDs[i].second);
178 Teuchos::ArrayRCP<const double> local_x;
179 for (std::size_t fieldIndex=0; fieldIndex<gatherFields_.size();fieldIndex++) {
180 int fieldNum = fieldIds_[fieldIndex];
181 int indexerId = gidIndexer_->getFieldBlock(fieldNum);
184 RCP<SpmdVectorBase<double> > block_x = rcp_dynamic_cast<SpmdVectorBase<double> >(x->getNonconstVectorBlock(indexerId));
185 block_x->getLocalData(ptrFromRef(local_x));
187 const std::vector<int> & elmtOffset = gidIndexer_->getGIDFieldOffsets(blockId,fieldNum);
190 for(std::size_t basis=0;basis<elmtOffset.size();basis++) {
191 int offset = elmtOffset[basis];
192 int lid = LIDs[offset];
194 (gatherFields_[fieldIndex])(worksetCellIndex,basis) = local_x[lid];