11 #ifndef __Panzer_ScatterDirichletResidual_Epetra_Hessian_impl_hpp__ 
   12 #define __Panzer_ScatterDirichletResidual_Epetra_Hessian_impl_hpp__ 
   15 #ifdef Panzer_BUILD_HESSIAN_SUPPORT 
   27 template<
typename TRAITS,
typename LO,
typename GO>
 
   32    : globalIndexer_(indexer)
 
   33    , colGlobalIndexer_(cIndexer) 
 
   34    , globalDataKey_(
"Residual Scatter Container")
 
   35    , preserveDiagonal_(false)
 
   37   std::string scatterName = p.
get<std::string>(
"Scatter Name");
 
   42   const std::vector<std::string>& names = 
 
   51   side_subcell_dim_ = p.
get<
int>(
"Side Subcell Dimension");
 
   52   local_side_id_ = p.
get<
int>(
"Local Side ID");
 
   55   scatterFields_.resize(names.size());
 
   56   for (std::size_t eq = 0; eq < names.size(); ++eq) {
 
   60     this->addDependentField(scatterFields_[eq]);
 
   63   checkApplyBC_ = p.
get<
bool>(
"Check Apply BC");
 
   65     applyBC_.resize(names.size());
 
   66     for (std::size_t eq = 0; eq < names.size(); ++eq) {
 
   68       this->addDependentField(applyBC_[eq]);
 
   73   this->addEvaluatedField(*scatterHolder_);
 
   75   if (p.
isType<std::string>(
"Global Data Key"))
 
   76      globalDataKey_ = p.
get<std::string>(
"Global Data Key");
 
   78   if (p.
isType<
bool>(
"Preserve Diagonal"))
 
   79      preserveDiagonal_ = p.
get<
bool>(
"Preserve Diagonal");
 
   81   this->setName(scatterName+
" Scatter Residual (Hessian)");
 
   84 template<
typename TRAITS,
typename LO,
typename GO>
 
   90   fieldIds_.resize(scatterFields_.size());
 
   93   for(std::size_t fd=0;fd<scatterFields_.size();++fd) {
 
   95     std::string fieldName = fieldMap_->find(scatterFields_[fd].fieldTag().name())->second;
 
   96     fieldIds_[fd] = globalIndexer_->getFieldNum(fieldName);
 
  100   num_nodes = scatterFields_[0].extent(1);
 
  101   num_eq = scatterFields_.size();
 
  104 template<
typename TRAITS,
typename LO,
typename GO>
 
  112   if(epetraContainer_==Teuchos::null) {
 
  117     dirichletCounter_ = Teuchos::null;
 
  124     dirichletCounter_ = epetraContainer->get_f();
 
  129 template<
typename TRAITS,
typename LO,
typename GO>
 
  140   PHX::View<const int*, Kokkos::LayoutRight, PHX::Device> cLIDs, rLIDs;
 
  141    std::vector<double> jacRow;
 
  143    bool useColumnIndexer = colGlobalIndexer_!=Teuchos::null;
 
  146    std::string blockId = this->wda(workset).block_id;
 
  147    const std::vector<std::size_t> & localCellIds = this->wda(workset).cell_local_ids;
 
  158    for(std::size_t worksetCellIndex=0;worksetCellIndex<localCellIds.size();++worksetCellIndex) {
 
  159       std::size_t cellLocalId = localCellIds[worksetCellIndex];
 
  161       rLIDs = globalIndexer_->getElementLIDs(cellLocalId); 
 
  163         cLIDs = colGlobalIndexer_->getElementLIDs(cellLocalId); 
 
  168       for(std::size_t fieldIndex = 0; fieldIndex < scatterFields_.size(); fieldIndex++) {
 
  169          int fieldNum = fieldIds_[fieldIndex];
 
  172          const std::pair<std::vector<int>,std::vector<int> > & indicePair 
 
  173                = globalIndexer_->getGIDFieldOffsets_closure(blockId,fieldNum, side_subcell_dim_, local_side_id_);
 
  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;
 
  198                for(
int i=0;i<numEntries;i++) {
 
  199                   if(preserveDiagonal_) {
 
  200                     if(row!=rowIndices[i])
 
  209             const ScalarT scatterField = (scatterFields_[fieldIndex])(worksetCellIndex,basisId);
 
  211             if(dirichletCounter_!=Teuchos::null) {
 
  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);
 
  221             if(!preserveDiagonal_) {
 
T & get(const std::string &name, T def_value)
bool is_null(const std::shared_ptr< T > &p)
panzer::Traits::Hessian::ScalarT ScalarT
int ExtractMyRowView(int MyRow, int &NumEntries, double *&Values, int *&Indices) const 
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
T * ptrFromStlVector(std::vector< T > &v)
bool isType(const std::string &name) const 
ScatterDirichletResidual_Epetra()
#define TEUCHOS_ASSERT(assertion_test)
int ReplaceMyValues(int MyRow, int NumEntries, const double *Values, const int *Indices)
Pushes residual values into the residual vector for a Newton-based solve.