43 #ifndef __Panzer_TpetraVector_ReadOnly_GlobalEvaluationData_impl_hpp__ 
   44 #define __Panzer_TpetraVector_ReadOnly_GlobalEvaluationData_impl_hpp__ 
   46 #include "Thyra_TpetraThyraWrappers.hpp" 
   52 template <
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
 
   58                              "TpetraVector_ReadOnly_GED has been initialized, cannot call \"useConstantValues\"!");
 
   64   globalFilteredPairs_.push_back(pair);
 
   67 template <
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
 
   75   ghostedMap_ = ghostedMap;
 
   82   ghostedSpace_ = Thyra::tpetraVectorSpace<ScalarT, LocalOrdinalT,
 
   83     GlobalOrdinalT, NodeT>(ghostedMap_);
 
   84   ownedSpace_   = Thyra::tpetraVectorSpace<ScalarT, LocalOrdinalT,
 
   85     GlobalOrdinalT, NodeT>(ownedMap_);
 
   90    filteredPairs_.resize(globalFilteredPairs_.size());
 
   91    for(std::size_t i=0;i<globalFilteredPairs_.size();i++) {
 
   92      std::vector<LocalOrdinalT> 
lids;
 
   93      const std::vector<GlobalOrdinalT> & gids = globalFilteredPairs_[i].first;
 
   94      for(std::size_t j=0;j<gids.size();j++) {
 
   95        LocalOrdinalT lid = ghostedMap->getLocalElement(gids[j]);
 
  103      filteredPairs_[i].first = 
lids;
 
  104      filteredPairs_[i].second = globalFilteredPairs_[i].second;
 
  107   isInitialized_ = 
true;
 
  110 template <
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
 
  116     "Owned vector has not been set, can't perform the halo exchange!");
 
  123   ghostedVector_->doImport(*ownedVector_, *importer_, Tpetra::INSERT);
 
  126 template <
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
 
  132                               "TpetraVector_ReadOnly_GED has not been initialized, cannot call \"initializeData\"!");
 
  134    ghostedVector_->putScalar(0.0);
 
  136    typedef typename VectorType::dual_view_type::t_dev::memory_space DMS;
 
  137    auto values_2d = ghostedVector_->template getLocalView<DMS>();
 
  138    auto values = Kokkos::subview(values_2d, Kokkos::ALL (), 0);
 
  141    for(std::size_t i=0;i<filteredPairs_.size();i++) {
 
  142      const std::vector<int> & 
lids = filteredPairs_[i].first;
 
  143      double value = filteredPairs_[i].second;
 
  144      for(std::size_t j=0;j<lids.size();j++)
 
  145        values(lids[j]) = value;
 
  149 template <
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
 
  155   ownedVector_ = ownedVector;
 
  158 template <
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
 
  167 template <
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
 
  175   return ghostedVector_;
 
  178 template <
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
 
  184   typedef Thyra::TpetraOperatorVectorExtraction<ScalarT,LocalOrdinalT,GlobalOrdinalT,NodeT> TOE;
 
  186   ownedVector_ = TOE::getConstTpetraVector(ownedVector);
 
  189 template <
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
 
  195   return (ownedVector_ == Teuchos::null) ? Teuchos::null :
 
  196     Thyra::createConstVector(ownedVector_, ownedSpace_);
 
  199 template <
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
 
  207   return Thyra::createVector(ghostedVector_,ghostedSpace_);
 
  210 template <
typename ScalarT,
typename LocalOrdinalT,
typename GlobalOrdinalT,
typename NodeT>
 
  215   const std::string tab = 
"    ";
 
  217   os << tab << 
"TpetraVector_ReadOnly_GlobalEvaluationData\n" 
  218      << tab << 
"  init    = " << isInitialized_ << 
"\n" 
  219      << tab << 
"  owned   = " << ownedVector_   << 
"\n" 
  220      << tab << 
"  ghosted = " << ghostedVector_ << 
"\n";
 
Tpetra::Vector< ScalarT, LocalOrdinalT, GlobalOrdinalT, NodeT > VectorType
virtual void initializeData()
Clear out the ghosted vector. 
void setOwnedVector(const Teuchos::RCP< const Thyra::VectorBase< double > > &ownedVector)
Set the owned vector (Thyra version) 
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void useConstantValues(const std::vector< GlobalOrdinalT > &indices, double value)
void print(std::ostream &os) const 
Diagnostic function. 
Teuchos::RCP< const Thyra::VectorBase< double > > getOwnedVector() const 
Get the owned vector (Thyra version) 
Kokkos::View< const LO **, PHX::Device > lids
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
virtual void globalToGhost(int mem)
void setOwnedVector_Tpetra(const Teuchos::RCP< const VectorType > &ownedVector)
Set the owned vector (Tpetra version) 
Teuchos::RCP< const VectorType > getOwnedVector_Tpetra() const 
Get the owned vector (Tpetra version) 
Teuchos::RCP< VectorType > getGhostedVector_Tpetra() const 
Get the ghosted vector (Tpetra version) 
#define TEUCHOS_ASSERT(assertion_test)
std::pair< std::vector< GlobalOrdinalT >, double > FilteredGlobalPair
Teuchos::RCP< Thyra::VectorBase< double > > getGhostedVector() const 
Get the ghosted vector (Thyra version) 
void initialize(const Teuchos::RCP< const ImportType > &importer, const Teuchos::RCP< const MapType > &ghostedMap, const Teuchos::RCP< const MapType > &ownedMap)