16 #ifndef dealii_vector_element_access_h
17 #define dealii_vector_element_access_h
29 template <
typename VectorType>
34 add(
const typename VectorType::value_type
value,
39 set(
typename VectorType::value_type
value,
43 static typename VectorType::value_type
49 template <
typename VectorType>
60 template <
typename VectorType>
71 template <
typename VectorType>
72 inline typename VectorType::value_type
81 #if defined(DEAL_II_WITH_TRILINOS) && defined(DEAL_II_WITH_MPI)
90 Epetra_FEVector vector =
V.trilinos_vector();
94 vector[0][trilinos_i] +=
value;
107 Epetra_FEVector vector =
V.trilinos_vector();
111 vector[0][trilinos_i] =
value;
121 Epetra_FEVector vector =
V.trilinos_vector();
125 return vector[0][trilinos_i];
130 # ifdef DEAL_II_TRILINOS_WITH_TPETRA
131 template <
typename NumberType>
152 template <
typename NumberType>
160 Tpetra::Vector<NumberType, int, types::global_dof_index> vector =
163 vector.getMap()->getLocalElement(
166 vector.template sync<Kokkos::HostSpace>();
167 auto vector_2d = vector.template getLocalView<Kokkos::HostSpace>();
168 auto vector_1d = Kokkos::subview(vector_2d, Kokkos::ALL(), 0);
170 vector.template modify<Kokkos::HostSpace>();
171 vector_1d(trilinos_i) +=
value;
172 vector.template sync<
173 typename Tpetra::Vector<NumberType, int, types::global_dof_index>::
174 device_type::memory_space>();
179 template <
typename NumberType>
187 Tpetra::Vector<NumberType, int, types::global_dof_index> vector =
190 vector.getMap()->getLocalElement(
193 vector.template sync<Kokkos::HostSpace>();
194 auto vector_2d = vector.template getLocalView<Kokkos::HostSpace>();
195 auto vector_1d = Kokkos::subview(vector_2d, Kokkos::ALL(), 0);
197 vector.template modify<Kokkos::HostSpace>();
198 vector_1d(trilinos_i) =
value;
199 vector.template sync<
200 typename Tpetra::Vector<NumberType, int, types::global_dof_index>::
201 device_type::memory_space>();
206 template <
typename NumberType>
213 Tpetra::Vector<NumberType, int, types::global_dof_index> vector =
216 vector.getMap()->getLocalElement(
219 vector.template sync<Kokkos::HostSpace>();
220 auto vector_2d = vector.template getLocalView<Kokkos::HostSpace>();
221 auto vector_1d = Kokkos::subview(vector_2d, Kokkos::ALL(), 0);
223 return vector_1d(trilinos_i);