30 const Teuchos::RCP<const panzer::GlobalIndexer> & cIndexer,
31 const Teuchos::ParameterList& p)
37 std::string scatterName = p.get<std::string>(
"Scatter Name");
39 Teuchos::rcp(
new PHX::Tag<ScalarT>(scatterName,Teuchos::rcp(
new PHX::MDALayout<Dummy>(0))));
42 const std::vector<std::string>& names =
43 *(p.get< Teuchos::RCP< std::vector<std::string> > >(
"Dependent Names"));
46 fieldMap_ = p.get< Teuchos::RCP< std::map<std::string,std::string> > >(
"Dependent Map");
48 Teuchos::RCP<PHX::DataLayout> dl =
49 p.get< Teuchos::RCP<panzer::PureBasis> >(
"Basis")->functional;
56 for (std::size_t eq = 0; eq < names.size(); ++eq) {
57 scatterFields_[eq] = PHX::MDField<const ScalarT,Cell,NODE>(names[eq],dl);
66 for (std::size_t eq = 0; eq < names.size(); ++eq) {
67 applyBC_[eq] = PHX::MDField<const bool,Cell,NODE>(std::string(
"APPLY_BC_")+
fieldMap_->find(names[eq])->second,dl);
68 this->addDependentField(
applyBC_[eq]);
75 if (p.isType<std::string>(
"Global Data Key"))
78 if (p.isType<
bool>(
"Preserve Diagonal"))
81 this->setName(scatterName+
" Scatter Residual (Hessian)");
114 Teuchos::RCP<LinearObjContainer> loc = Teuchos::rcp_dynamic_cast<LOCPair_GlobalEvaluationData>(d.gedc->getDataObject(
globalDataKey_),
true)->getGhostedLOC();
115 epetraContainer_ = Teuchos::rcp_dynamic_cast<EpetraLinearObjContainer>(loc,
true);
121 Teuchos::RCP<GlobalEvaluationData> dataContainer = d.gedc->getDataObject(
"Dirichlet Counter");
122 Teuchos::RCP<EpetraLinearObjContainer> epetraContainer = Teuchos::rcp_dynamic_cast<EpetraLinearObjContainer>(dataContainer,
true);
140 PHX::View<const int*, Kokkos::LayoutRight, PHX::Device> cLIDs, rLIDs;
141 std::vector<double> jacRow;
146 std::string blockId = this->
wda(workset).block_id;
147 const std::vector<std::size_t> & localCellIds = this->
wda(workset).cell_local_ids;
149 Teuchos::RCP<const EpetraLinearObjContainer> epetraContainer =
epetraContainer_;
150 TEUCHOS_ASSERT(epetraContainer!=Teuchos::null);
151 Teuchos::RCP<Epetra_CrsMatrix> Jac = epetraContainer->get_A();
158 for(std::size_t worksetCellIndex=0;worksetCellIndex<localCellIds.size();++worksetCellIndex) {
159 std::size_t cellLocalId = localCellIds[worksetCellIndex];
168 for(std::size_t fieldIndex = 0; fieldIndex <
scatterFields_.size(); fieldIndex++) {
172 const std::pair<std::vector<int>,std::vector<int> > & indicePair
174 const std::vector<int> & elmtOffset = indicePair.first;
175 const std::vector<int> & basisIdMap = indicePair.second;
178 for(std::size_t basis=0;basis<elmtOffset.size();basis++) {
179 int offset = elmtOffset[basis];
180 int row = rLIDs[offset];
184 int basisId = basisIdMap[basis];
187 if (!
applyBC_[fieldIndex](worksetCellIndex,basisId))
193 int * rowIndices = 0;
194 double * rowValues = 0;
196 Jac->ExtractMyRowView(row,numEntries,rowValues,rowIndices);
198 for(
int i=0;i<numEntries;i++) {
200 if(row!=rowIndices[i])
213 (*dirichletCounter_)[row] = 1.0;
217 jacRow.resize(scatterField.size());
218 for(
int sensIndex=0;sensIndex<scatterField.size();++sensIndex)
219 jacRow[sensIndex] = scatterField.fastAccessDx(sensIndex).fastAccessDx(0);
222 int err = Jac->ReplaceMyValues(row, cLIDs.size(),
224 TEUCHOS_ASSERT(err==0);