62 const Teuchos::RCP<const panzer::GlobalIndexer> & cIndexer,
63 const Teuchos::ParameterList& p)
69 std::string scatterName = p.get<std::string>(
"Scatter Name");
71 Teuchos::rcp(
new PHX::Tag<ScalarT>(scatterName,Teuchos::rcp(
new PHX::MDALayout<Dummy>(0))));
74 const std::vector<std::string>& names =
75 *(p.get< Teuchos::RCP< std::vector<std::string> > >(
"Dependent Names"));
78 fieldMap_ = p.get< Teuchos::RCP< std::map<std::string,std::string> > >(
"Dependent Map");
80 Teuchos::RCP<PHX::DataLayout> dl =
81 p.get< Teuchos::RCP<panzer::PureBasis> >(
"Basis")->functional;
88 for (std::size_t eq = 0; eq < names.size(); ++eq) {
89 scatterFields_[eq] = PHX::MDField<const ScalarT,Cell,NODE>(names[eq],dl);
98 for (std::size_t eq = 0; eq < names.size(); ++eq) {
99 applyBC_[eq] = PHX::MDField<const bool,Cell,NODE>(std::string(
"APPLY_BC_")+
fieldMap_->find(names[eq])->second,dl);
100 this->addDependentField(
applyBC_[eq]);
107 if (p.isType<std::string>(
"Global Data Key"))
110 if (p.isType<
bool>(
"Preserve Diagonal"))
113 this->setName(scatterName+
" Scatter Residual (Hessian)");
146 Teuchos::RCP<LinearObjContainer> loc = Teuchos::rcp_dynamic_cast<LOCPair_GlobalEvaluationData>(d.gedc->getDataObject(
globalDataKey_),
true)->getGhostedLOC();
147 epetraContainer_ = Teuchos::rcp_dynamic_cast<EpetraLinearObjContainer>(loc,
true);
153 Teuchos::RCP<GlobalEvaluationData> dataContainer = d.gedc->getDataObject(
"Dirichlet Counter");
154 Teuchos::RCP<EpetraLinearObjContainer> epetraContainer = Teuchos::rcp_dynamic_cast<EpetraLinearObjContainer>(dataContainer,
true);
172 PHX::View<const int*, Kokkos::LayoutRight, PHX::Device> cLIDs, rLIDs;
173 std::vector<double> jacRow;
178 std::string blockId = this->
wda(workset).block_id;
179 const std::vector<std::size_t> & localCellIds = this->
wda(workset).cell_local_ids;
181 Teuchos::RCP<const EpetraLinearObjContainer> epetraContainer =
epetraContainer_;
182 TEUCHOS_ASSERT(epetraContainer!=Teuchos::null);
183 Teuchos::RCP<Epetra_CrsMatrix> Jac = epetraContainer->get_A();
190 for(std::size_t worksetCellIndex=0;worksetCellIndex<localCellIds.size();++worksetCellIndex) {
191 std::size_t cellLocalId = localCellIds[worksetCellIndex];
200 for(std::size_t fieldIndex = 0; fieldIndex <
scatterFields_.size(); fieldIndex++) {
204 const std::pair<std::vector<int>,std::vector<int> > & indicePair
206 const std::vector<int> & elmtOffset = indicePair.first;
207 const std::vector<int> & basisIdMap = indicePair.second;
210 for(std::size_t basis=0;basis<elmtOffset.size();basis++) {
211 int offset = elmtOffset[basis];
212 int row = rLIDs[offset];
216 int basisId = basisIdMap[basis];
219 if (!
applyBC_[fieldIndex](worksetCellIndex,basisId))
225 int * rowIndices = 0;
226 double * rowValues = 0;
228 Jac->ExtractMyRowView(row,numEntries,rowValues,rowIndices);
230 for(
int i=0;i<numEntries;i++) {
232 if(row!=rowIndices[i])
245 (*dirichletCounter_)[row] = 1.0;
249 jacRow.resize(scatterField.size());
250 for(
int sensIndex=0;sensIndex<scatterField.size();++sensIndex)
251 jacRow[sensIndex] = scatterField.fastAccessDx(sensIndex).fastAccessDx(0);
254 int err = Jac->ReplaceMyValues(row, cLIDs.size(),
256 TEUCHOS_ASSERT(err==0);