80 const Teuchos::ParameterList& p)
84 std::string scatterName = p.get<std::string>(
"Scatter Name");
86 Teuchos::rcp(
new PHX::Tag<ScalarT>(scatterName,Teuchos::rcp(
new PHX::MDALayout<Dummy>(0))));
89 const std::vector<std::string>& names =
90 *(p.get< Teuchos::RCP< std::vector<std::string> > >(
"Dependent Names"));
93 fieldMap_ = p.get< Teuchos::RCP< std::map<std::string,std::string> > >(
"Dependent Map");
96 scatterIC_ = p.isParameter(
"Scatter Initial Condition") ? p.get<
bool>(
"Scatter Initial Condition") :
false;
98 Teuchos::RCP<PHX::DataLayout> dl = (!
scatterIC_) ?
99 p.get< Teuchos::RCP<panzer::PureBasis> >(
"Basis")->functional :
100 p.get< Teuchos::RCP<const panzer::PureBasis> >(
"Basis")->functional;
108 for (std::size_t eq = 0; eq < names.size(); ++eq) {
109 scatterFields_[eq] = PHX::MDField<const ScalarT,Cell,NODE>(names[eq],dl);
115 checkApplyBC_ = p.isParameter(
"Check Apply BC") ? p.get<
bool>(
"Check Apply BC") :
false;
118 for (std::size_t eq = 0; eq < names.size(); ++eq) {
119 applyBC_[eq] = PHX::MDField<const bool,Cell,NODE>(std::string(
"APPLY_BC_")+
fieldMap_->find(names[eq])->second,dl);
120 this->addDependentField(
applyBC_[eq]);
127 if (p.isType<std::string>(
"Global Data Key"))
130 this->setName(scatterName+
" Scatter Dirichlet Residual");
139 const Workset & workset_0 = (*d.worksets_)[0];
140 const std::string blockId = this->
wda(workset_0).block_id;
147 int maxElementBlockGIDCount = -1;
152 const int globalFieldNum =
globalIndexer_->getFieldNum(fieldName);
161 const auto& offsets = offsetPair.first;
162 fieldOffsets_[fd] = PHX::View<int*>(
"ScatterDirichletResidual_BlockedTpetra(Residual):fieldOffsets",offsets.size());
163 auto hostOffsets = Kokkos::create_mirror_view(
fieldOffsets_[fd]);
164 for (std::size_t i=0; i < offsets.size(); ++i)
165 hostOffsets(i) = offsets[i];
169 const auto& basisIndex = offsetPair.second;
170 basisIndexForMDFieldOffsets_[fd] = PHX::View<int*>(
"ScatterDirichletResidual_BlockedTpetra(Residual):basisIndexForMDFieldOffsets",basisIndex.size());
172 for (std::size_t i=0; i < basisIndex.size(); ++i)
173 hostBasisIndex(i) = basisIndex[i];
180 fieldOffsets_[fd] = PHX::View<int*>(
"ScatterDirichletResidual_BlockedTpetra(Residual):fieldOffsets",offsets.size());
181 auto hostOffsets = Kokkos::create_mirror_view(
fieldOffsets_[fd]);
182 for (std::size_t i=0; i < offsets.size(); ++i)
183 hostOffsets(i) = offsets[i];
187 maxElementBlockGIDCount = std::max(
fieldGlobalIndexers_[fd]->getElementBlockGIDCount(blockId),maxElementBlockGIDCount);
193 worksetLIDs_ = PHX::View<LO**>(
"ScatterResidual_BlockedTpetra(Residual):worksetLIDs",
195 maxElementBlockGIDCount);
221 using Teuchos::rcp_dynamic_cast;
225 const auto& localCellIds = this->
wda(workset).cell_local_ids_k;
227 RCP<ProductVectorBase<double> > thyraScatterTarget = (!
scatterIC_) ?
232 int currentWorksetLIDSubBlock = -1;
233 for (std::size_t fieldIndex = 0; fieldIndex <
scatterFields_.size(); fieldIndex++) {
241 auto& tpetraScatterTarget = *((rcp_dynamic_cast<Thyra::TpetraVector<RealType,LO,GO,NodeT>>(thyraScatterTarget->getNonconstVectorBlock(
productVectorBlockIndex_[fieldIndex]),
true))->getTpetraVector());
242 const auto& kokkosScatterTarget = tpetraScatterTarget.getLocalViewDevice(Tpetra::Access::ReadWrite);
245 auto& tpetraDirichletCounter = *((rcp_dynamic_cast<Thyra::TpetraVector<RealType,LO,GO,NodeT>>(
dirichletCounter_->getNonconstVectorBlock(
productVectorBlockIndex_[fieldIndex]),
true))->getTpetraVector());
246 const auto& kokkosDirichletCounter = tpetraDirichletCounter.getLocalViewDevice(Tpetra::Access::ReadWrite);
252 const auto fieldValues =
scatterFields_[fieldIndex].get_static_view();
253 const auto applyBC =
applyBC_[fieldIndex].get_static_view();
258 Kokkos::parallel_for(Kokkos::RangePolicy<PHX::ExecutionSpace>(0,workset.num_cells), KOKKOS_LAMBDA (
const int& cell) {
259 for (
int basis=0; basis < static_cast<int>(fieldOffsets.size()); ++basis) {
260 const int lid = worksetLIDs(cell,fieldOffsets(basis));
263 const int basisIndex = basisIndices(basis);
267 if (!applyBC(cell,basisIndex))
270 kokkosScatterTarget(lid,0) = fieldValues(cell,basisIndex);
271 kokkosDirichletCounter(lid,0) = 1.0;
277 Kokkos::parallel_for(Kokkos::RangePolicy<PHX::ExecutionSpace>(0,workset.num_cells), KOKKOS_LAMBDA (
const int& cell) {
278 for (
int basis=0; basis < static_cast<int>(fieldOffsets.size()); ++basis) {
279 const int lid = worksetLIDs(cell,fieldOffsets(basis));
282 kokkosScatterTarget(lid,0) = fieldValues(cell,basis);
283 kokkosDirichletCounter(lid,0) = 1.0;
306 const std::vector<Teuchos::RCP<const panzer::GlobalIndexer> > & colIndexers,
307 const Teuchos::ParameterList& p)
320 std::string scatterName = p.get<std::string>(
"Scatter Name");
322 Teuchos::rcp(
new PHX::Tag<ScalarT>(scatterName,Teuchos::rcp(
new PHX::MDALayout<Dummy>(0))));
325 const std::vector<std::string>& names =
326 *(p.get< Teuchos::RCP< std::vector<std::string> > >(
"Dependent Names"));
329 fieldMap_ = p.get< Teuchos::RCP< std::map<std::string,std::string> > >(
"Dependent Map");
331 Teuchos::RCP<PHX::DataLayout> dl =
332 p.get< Teuchos::RCP<panzer::PureBasis> >(
"Basis")->functional;
339 for (std::size_t eq = 0; eq < names.size(); ++eq) {
340 scatterFields_[eq] = PHX::MDField<const ScalarT,Cell,NODE>(names[eq],dl);
349 for (std::size_t eq = 0; eq < names.size(); ++eq) {
350 applyBC_[eq] = PHX::MDField<const bool,Cell,NODE>(std::string(
"APPLY_BC_")+
fieldMap_->find(names[eq])->second,dl);
351 this->addDependentField(
applyBC_[eq]);
358 if (p.isType<std::string>(
"Global Data Key"))
361 this->setName(scatterName+
" Scatter Dirichlet Residual (Jacobian)");
370 const Workset & workset_0 = (*d.worksets_)[0];
371 const std::string blockId = this->
wda(workset_0).block_id;
380 const int globalFieldNum =
globalIndexer_->getFieldNum(fieldName);
383 fieldIds_[fd] = fieldGlobalIndexer->getFieldNum(fieldName);
387 const auto& offsets = offsetPair.first;
388 fieldOffsets_[fd] = PHX::View<int*>(
"ScatterDirichletResidual_BlockedTpetra(Jacobian):fieldOffsets",offsets.size());
389 auto hostOffsets = Kokkos::create_mirror_view(
fieldOffsets_[fd]);
390 for (std::size_t i=0; i < offsets.size(); ++i)
391 hostOffsets(i) = offsets[i];
395 const auto& basisIndex = offsetPair.second;
396 basisIndexForMDFieldOffsets_[fd] = PHX::View<int*>(
"ScatterDirichletResidual_BlockedTpetra(Jacobian):basisIndexForMDFieldOffsets",basisIndex.size());
398 for (std::size_t i=0; i < basisIndex.size(); ++i)
399 hostBasisIndex(i) = basisIndex[i];
407 int elementBlockGIDCount = 0;
408 for (
const auto& blockDOFMgr :
globalIndexer_->getFieldDOFManagers())
409 elementBlockGIDCount += blockDOFMgr->getElementBlockGIDCount(blockId);
411 worksetLIDs_ = PHX::View<LO**>(
"ScatterDirichletResidual_BlockedTpetra(Jacobian):worksetLIDs",
413 elementBlockGIDCount);
416 const auto& blockGlobalIndexers =
globalIndexer_->getFieldDOFManagers();
417 const int numBlocks =
static_cast<int>(
globalIndexer_->getFieldDOFManagers().size());
418 blockOffsets_ = PHX::View<LO*>(
"ScatterDirichletResidual_BlockedTpetra(Jacobian):blockOffsets_",
420 const auto hostBlockOffsets = Kokkos::create_mirror_view(
blockOffsets_);
421 for (
int blk=0;blk<numBlocks;blk++) {
423 hostBlockOffsets(blk) = blockOffset;
425 hostBlockOffsets(numBlocks) = hostBlockOffsets(numBlocks-1) + blockGlobalIndexers[blockGlobalIndexers.size()-1]->getElementBlockGIDCount(blockId);
436 colBlockOffsets_ = PHX::View<LO*>(
"ScatterDirichletResidual_BlockedTpetra(Jacobian):colBlockOffsets_",
439 hostColOffsets(0) = 0;
440 for (
int blk=0;blk<numColBlocks;blk++)
441 hostColOffsets(blk+1) = hostColOffsets(blk) +
colGlobalIndexers_[blk]->getElementBlockGIDCount(blockId);
444 colWorksetLIDs_ = PHX::View<LO**>(
"ScatterDirichletResidual_BlockedTpetra(Jacobian):colWorksetLIDs",
462 "ScatterDirichletResidual_BlockedTpetra(Jacobian):hostJacTpetraBlocks", numRowBlocks, numColBlocks);
464 "ScatterDirichletResidual_BlockedTpetra(Jacobian):jacTpetraBlocks", numRowBlocks, numColBlocks);
465 blockExistsInJac_ = PHX::View<int**>(
"ScatterDirichletResidual_BlockedTpetra(Jacobian):blockExistsInJac", numRowBlocks, numColBlocks);
472 for (
int blk=0;blk<numBlocks;blk++) {
473 const int blockDerivativeSize = hostBlockOffsets(blk+1) - hostBlockOffsets(blk);
475 "ERROR: the derivative dimension for sub block "
476 << blk <<
"with a value of " << blockDerivativeSize
477 <<
"is larger than the size allocated for cLIDs and vals "
478 <<
"in the evaluate call! You must manually increase the "
479 <<
"size and recompile!");
506 using Teuchos::rcp_dynamic_cast;
511 const auto& localCellIds = this->
wda(workset).cell_local_ids_k;
516 const RCP<ProductVectorBase<double>> thyraBlockResidual = rcp_dynamic_cast<ProductVectorBase<double>>(
blockedContainer_->get_f());
517 const bool haveResidual = Teuchos::nonnull(thyraBlockResidual);
518 const RCP<BlockedLinearOpBase<double>> Jac = rcp_dynamic_cast<BlockedLinearOpBase<double>>(
blockedContainer_->get_A(),
true);
525 TEUCHOS_ASSERT(
static_cast<int>(
jacTpetraBlocks_.extent(0))==numFieldBlocks &&
531 for (
int row=0; row < numFieldBlocks; ++row) {
532 for (
int col=0; col < numColFieldBlocks; ++col) {
533 const auto thyraTpetraOperator = rcp_dynamic_cast<Thyra::TpetraLinearOp<double,LO,GO,NodeT>>(Jac->getNonconstBlock(row,col),
false);
534 if (nonnull(thyraTpetraOperator)) {
550 const auto tpetraCrsMatrix = rcp_dynamic_cast<Tpetra::CrsMatrix<double,LO,GO,NodeT>>(thyraTpetraOperator->getTpetraOperator(),
true);
551 const auto managedMatrix = tpetraCrsMatrix->getLocalMatrixDevice();
552 const auto managedGraph = managedMatrix.graph;
555 using StaticCrsGraphType =
typename LocalMatrixType::StaticCrsGraphType;
556 StaticCrsGraphType unmanagedGraph;
557 unmanagedGraph.entries =
typename StaticCrsGraphType::entries_type(managedGraph.entries.data(),managedGraph.entries.extent(0));
558 unmanagedGraph.row_map =
typename StaticCrsGraphType::row_map_type(managedGraph.row_map.data(),managedGraph.row_map.extent(0));
559 unmanagedGraph.row_block_offsets =
typename StaticCrsGraphType::row_block_type(managedGraph.row_block_offsets.data(),managedGraph.row_block_offsets.extent(0));
561 typename LocalMatrixType::values_type unmanagedValues(managedMatrix.values.data(),managedMatrix.values.extent(0));
562 LocalMatrixType unmanagedMatrix(managedMatrix.values.label(), managedMatrix.numCols(), unmanagedValues, unmanagedGraph);
566 hostBlockExistsInJac(row,col) = 1;
569 hostBlockExistsInJac(row,col) = 0;
574 Kokkos::deep_copy(jacTpetraBlocks,hostJacTpetraBlocks);
575 Kokkos::deep_copy(blockExistsInJac,hostBlockExistsInJac);
582 const auto& globalIndexers =
globalIndexer_->getFieldDOFManagers();
584 for (
size_t block=0; block < globalIndexers.size(); ++block) {
585 const auto subviewOfBlockLIDs = Kokkos::subview(
worksetLIDs_,Kokkos::ALL(), std::make_pair(blockOffsets_h(block),blockOffsets_h(block+1)));
586 globalIndexers[block]->getElementLIDs(localCellIds,subviewOfBlockLIDs);
592 const auto subviewOfBlockLIDs = Kokkos::subview(
colWorksetLIDs_,Kokkos::ALL(), std::make_pair(colBlockOffsets_h(block),colBlockOffsets_h(block+1)));
598 for (std::size_t fieldIndex = 0; fieldIndex <
scatterFields_.size(); fieldIndex++) {
601 typename Tpetra::Vector<double,LO,GO,panzer::TpetraNodeType>::dual_view_type::t_dev kokkosResidual;
603 auto& tpetraResidual = *((rcp_dynamic_cast<Thyra::TpetraVector<RealType,LO,GO,NodeT>>(thyraBlockResidual->getNonconstVectorBlock(blockRowIndex),
true))->getTpetraVector());
604 kokkosResidual = tpetraResidual.getLocalViewDevice(Tpetra::Access::ReadWrite);
608 auto& tpetraDirichletCounter = *((rcp_dynamic_cast<Thyra::TpetraVector<RealType,LO,GO,NodeT>>(
dirichletCounter_->getNonconstVectorBlock(blockRowIndex),
true))->getTpetraVector());
609 const auto& kokkosDirichletCounter = tpetraDirichletCounter.getLocalViewDevice(Tpetra::Access::ReadWrite);
612 const PHX::View<const int*> fieldOffsets =
fieldOffsets_[fieldIndex];
615 const PHX::View<const ScalarT**> fieldValues =
scatterFields_[fieldIndex].get_static_view();
619 const auto& applyBC =
applyBC_[fieldIndex].get_static_view();
622 Kokkos::parallel_for(Kokkos::RangePolicy<PHX::ExecutionSpace>(0,workset.num_cells), KOKKOS_LAMBDA (
const int& cell) {
626 for(
int basis=0; basis < static_cast<int>(fieldOffsets.size()); ++basis) {
627 const int block_row_offset = blockOffsets(blockRowIndex);
628 const int rowLID = worksetLIDs(cell,block_row_offset+fieldOffsets(basis));
633 const int basisIndex = basisIndices(basis);
637 if (!applyBC(cell,basisIndex))
640 typedef PHX::MDField<const ScalarT,Cell,NODE>
FieldType;
641 typename FieldType::array_type::reference_type tmpFieldVal = fieldValues(cell,basisIndex);
644 kokkosResidual(rowLID,0) = tmpFieldVal.val();
646 kokkosDirichletCounter(rowLID,0) = 1.0;
649 for (
int blockColIndex=0; blockColIndex < numColFieldBlocks; ++blockColIndex) {
650 if (blockExistsInJac(blockRowIndex,blockColIndex)) {
651 const auto& rowEntries = jacTpetraBlocks(blockRowIndex,blockColIndex).row(rowLID);
652 for (
int i=0; i < rowEntries.length; ++i)
658 for (
int blockColIndex=0; blockColIndex < numColFieldBlocks; ++blockColIndex) {
659 if (blockExistsInJac(blockRowIndex,blockColIndex)) {
660 const int start = colBlockOffsets(blockColIndex);
661 const int stop = colBlockOffsets(blockColIndex+1);
662 const int sensSize = stop-start;
664 for (
int i=0; i < sensSize; ++i) {
665 cLIDs[i] = colWorksetLIDs(cell,start+i);
666 vals[i] = tmpFieldVal.fastAccessDx(start+i);
668 jacTpetraBlocks(blockRowIndex,blockColIndex).replaceValues(rowLID,cLIDs,sensSize,vals,
true,
true);
677 for (
int row=0; row < numFieldBlocks; ++row) {
678 for (
int col=0; col < numColFieldBlocks; ++col) {
679 if (hostBlockExistsInJac(row,col)) {
680 hostJacTpetraBlocks(row,col).~CrsMatrix();
697 const Teuchos::ParameterList& p)
701 std::string scatterName = p.get<std::string>(
"Scatter Name");
703 Teuchos::rcp(
new PHX::Tag<ScalarT>(scatterName,Teuchos::rcp(
new PHX::MDALayout<Dummy>(0))));
706 const std::vector<std::string>& names =
707 *(p.get< Teuchos::RCP< std::vector<std::string> > >(
"Dependent Names"));
710 fieldMap_ = p.get< Teuchos::RCP< std::map<std::string,std::string> > >(
"Dependent Map");
713 scatterIC_ = p.isParameter(
"Scatter Initial Condition") ? p.get<
bool>(
"Scatter Initial Condition") :
false;
715 Teuchos::RCP<PHX::DataLayout> dl = (!
scatterIC_) ?
716 p.get< Teuchos::RCP<panzer::PureBasis> >(
"Basis")->functional :
717 p.get< Teuchos::RCP<const panzer::PureBasis> >(
"Basis")->functional;
725 for (std::size_t eq = 0; eq < names.size(); ++eq) {
726 scatterFields_[eq] = PHX::MDField<const ScalarT,Cell,NODE>(names[eq],dl);
732 checkApplyBC_ = p.isParameter(
"Check Apply BC") ? p.get<
bool>(
"Check Apply BC") :
false;
735 for (std::size_t eq = 0; eq < names.size(); ++eq) {
736 applyBC_[eq] = PHX::MDField<const bool,Cell,NODE>(std::string(
"APPLY_BC_")+
fieldMap_->find(names[eq])->second,dl);
737 this->addDependentField(
applyBC_[eq]);
744 if (p.isType<std::string>(
"Global Data Key"))
747 this->setName(scatterName+
" Scatter Dirichlet Residual");
756 const Workset & workset_0 = (*d.worksets_)[0];
757 const std::string blockId = this->
wda(workset_0).block_id;
764 int maxElementBlockGIDCount = -1;
769 const int globalFieldNum =
globalIndexer_->getFieldNum(fieldName);
778 const auto& offsets = offsetPair.first;
779 fieldOffsets_[fd] = PHX::View<int*>(
"ScatterDirichletResidual_BlockedTpetra(Tangent):fieldOffsets",offsets.size());
780 auto hostOffsets = Kokkos::create_mirror_view(
fieldOffsets_[fd]);
781 for (std::size_t i=0; i < offsets.size(); ++i)
782 hostOffsets(i) = offsets[i];
786 const auto& basisIndex = offsetPair.second;
787 basisIndexForMDFieldOffsets_[fd] = PHX::View<int*>(
"ScatterDirichletResidual_BlockedTpetra(Tangent):basisIndexForMDFieldOffsets",basisIndex.size());
789 for (std::size_t i=0; i < basisIndex.size(); ++i)
790 hostBasisIndex(i) = basisIndex[i];
797 fieldOffsets_[fd] = PHX::View<int*>(
"ScatterDirichletResidual_BlockedTpetra(Tangent):fieldOffsets",offsets.size());
798 auto hostOffsets = Kokkos::create_mirror_view(
fieldOffsets_[fd]);
799 for (std::size_t i=0; i < offsets.size(); ++i)
800 hostOffsets(i) = offsets[i];
804 maxElementBlockGIDCount = std::max(
fieldGlobalIndexers_[fd]->getElementBlockGIDCount(blockId),maxElementBlockGIDCount);
810 worksetLIDs_ = PHX::View<LO**>(
"ScatterResidual_BlockedTpetra(Tangent):worksetLIDs",
812 maxElementBlockGIDCount);
822 std::vector<std::string> activeParameters =
823 Teuchos::rcp_dynamic_cast<ParameterList_GlobalEvaluationData>(d.gedc->getDataObject(
"PARAMETER_NAMES"))->getActiveParameters();
825 const int numBlocks =
static_cast<int>(
globalIndexer_->getFieldDOFManagers().size());
829 dfdpFieldsVoV_.initialize(
"ScatterResidual_Tpetra<Tangent>::dfdpFieldsVoV_",activeParameters.size(),numBlocks);
832 for(std::size_t i=0;i<activeParameters.size();i++) {
833 Teuchos::RCP<ContainerType> paramBlockedContainer = Teuchos::rcp_dynamic_cast<ContainerType>(d.gedc->getDataObject(activeParameters[i]),
true);
834 Teuchos::RCP<Thyra::ProductVectorBase<double>> productVector =
835 Teuchos::rcp_dynamic_cast<Thyra::ProductVectorBase<double>>(paramBlockedContainer->get_f(),
true);
837 for(
int j=0;j<numBlocks;j++)
838 dfdpVectors_[i][j] = Teuchos::rcp_dynamic_cast<Thyra::TpetraVector<RealType,LO,GO,NodeT>>(productVector->getNonconstVectorBlock(j),
true)->getTpetraVector();
842 Teuchos::RCP<const ContainerType> blockContainer
843 = Teuchos::rcp_dynamic_cast<ContainerType>(d.gedc->getDataObject(
"Dirichlet Counter"),
true);
845 dirichletCounter_ = Teuchos::rcp_dynamic_cast<Thyra::ProductVectorBase<double> >(blockContainer->get_f(),
true);
859 using Teuchos::rcp_dynamic_cast;
863 const auto& localCellIds = this->
wda(workset).cell_local_ids_k;
865 RCP<ProductVectorBase<double> > thyraScatterTarget = (!
scatterIC_) ?
877 int currentWorksetLIDSubBlock = -1;
878 for (std::size_t fieldIndex = 0; fieldIndex <
scatterFields_.size(); fieldIndex++) {
886 auto& tpetraScatterTarget = *((rcp_dynamic_cast<Thyra::TpetraVector<RealType,LO,GO,NodeT>>(thyraScatterTarget->getNonconstVectorBlock(
productVectorBlockIndex_[fieldIndex]),
true))->getTpetraVector());
887 const auto& kokkosScatterTarget = tpetraScatterTarget.getLocalViewDevice(Tpetra::Access::ReadWrite);
890 auto& tpetraDirichletCounter = *((rcp_dynamic_cast<Thyra::TpetraVector<RealType,LO,GO,NodeT>>(
dirichletCounter_->getNonconstVectorBlock(
productVectorBlockIndex_[fieldIndex]),
true))->getTpetraVector());
891 const auto& kokkosDirichletCounter = tpetraDirichletCounter.getLocalViewDevice(Tpetra::Access::ReadWrite);
897 const auto fieldValues =
scatterFields_[fieldIndex].get_static_view();
898 const auto applyBC =
applyBC_[fieldIndex].get_static_view();
901 const auto& kokkosTangents = Kokkos::subview(tangentFieldsDevice,Kokkos::ALL(),
productVectorBlockIndex_[fieldIndex]);
902 const std::size_t num_params = Sacado::dimension_scalar(fieldValues)-1;
906 Kokkos::parallel_for(Kokkos::RangePolicy<PHX::ExecutionSpace>(0,workset.num_cells), KOKKOS_LAMBDA (
const int& cell) {
907 for (
int basis=0; basis < static_cast<int>(fieldOffsets.size()); ++basis) {
908 const int lid = worksetLIDs(cell,fieldOffsets(basis));
911 const int basisIndex = basisIndices(basis);
915 if (!applyBC(cell,basisIndex))
918 kokkosScatterTarget(lid,0) = fieldValues(cell,basisIndex).val();
919 for(std::size_t i_param=0; i_param<num_params; i_param++)
920 kokkosTangents(i_param)(lid,0) = fieldValues(cell,basisIndex).fastAccessDx(i_param);
922 kokkosDirichletCounter(lid,0) = 1.0;
928 Kokkos::parallel_for(Kokkos::RangePolicy<PHX::ExecutionSpace>(0,workset.num_cells), KOKKOS_LAMBDA (
const int& cell) {
929 for (
int basis=0; basis < static_cast<int>(fieldOffsets.size()); ++basis) {
930 const int lid = worksetLIDs(cell,fieldOffsets(basis));
933 kokkosScatterTarget(lid,0) = fieldValues(cell,basis).val();
934 for(std::size_t i_param=0; i_param<num_params; i_param++)
935 kokkosTangents(i_param)(lid,0) = fieldValues(cell,basis).fastAccessDx(i_param);
936 kokkosDirichletCounter(lid,0) = 1.0;
948 dfdpFieldsVoV_.addView(Kokkos::View<RealType**,Kokkos::LayoutLeft,PHX::Device>(),i,j);