Tpetra parallel linear algebra Version of the Day
Loading...
Searching...
No Matches
Tpetra_Vector_decl.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Tpetra: Templated Linear Algebra Services Package
4//
5// Copyright 2008 NTESS and the Tpetra contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef TPETRA_VECTOR_DECL_HPP
11#define TPETRA_VECTOR_DECL_HPP
12
15
16#include "Tpetra_ConfigDefs.hpp"
17#include "Tpetra_Vector_fwd.hpp"
19
20namespace Tpetra {
21
40template <class Scalar,
41 class LocalOrdinal,
42 class GlobalOrdinal,
43 class Node>
44class Vector : public MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> {
45 private:
47
48 public:
50
51
70 typedef typename Node::device_type device_type;
71
73 typedef Node node_type;
74
80 typedef typename base_type::dot_type dot_type;
81
88 typedef typename base_type::mag_type mag_type;
89
92
95
97 typedef typename base_type::map_type map_type;
98
100
102
104 Vector();
105
111 //
116 explicit Vector(const Teuchos::RCP<const map_type>& map,
117 const bool zeroOut = true);
118
131 const Teuchos::DataAccess copyOrView);
132
140 const Teuchos::RCP<const map_type>& map,
141 const local_ordinal_type rowOffset = 0);
142
144 Vector(const Teuchos::RCP<const map_type>& map,
145 const Teuchos::ArrayView<const Scalar>& A);
146
159 Vector(const Teuchos::RCP<const map_type>& map,
160 const dual_view_type& view);
161
176 Vector(const Teuchos::RCP<const map_type>& map,
177 const dual_view_type& view,
178 const dual_view_type& origView);
179
188 Vector(const Teuchos::RCP<const map_type>& map,
190
197 const size_t j);
198
208
211
219
223
233 virtual ~Vector() = default;
235
237
238
240
242 void replaceGlobalValue(const GlobalOrdinal globalRow, const Scalar& value);
243
263 void
265 const Scalar& value,
266 const bool atomic = base_type::useAtomicUpdatesByDefault);
267
269
271 void replaceLocalValue(const LocalOrdinal myRow, const Scalar& value);
272
290 void
292 const Scalar& value,
293 const bool atomic = base_type::useAtomicUpdatesByDefault);
294
296
298
299
300 using MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::get1dCopy; // overloading, not hiding
302 void get1dCopy(const Teuchos::ArrayView<Scalar>& A) const;
303
304 using MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::getDataNonConst; // overloading, not hiding
306 Teuchos::ArrayRCP<Scalar> getDataNonConst() {
307 return getDataNonConst(0);
308 }
309
310 using MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::getData; // overloading, not hiding
312 Teuchos::ArrayRCP<const Scalar> getData() const {
313 return getData(0);
314 }
315
316 Teuchos::RCP<const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
317 offsetView(const Teuchos::RCP<const map_type>& subMap,
318 const size_t offset) const;
319
320 Teuchos::RCP<Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
321 offsetViewNonConst(const Teuchos::RCP<const map_type>& subMap,
322 const size_t offset);
324
326
327 using MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::dot; // overloading, not hiding
330
331 using MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::norm1; // overloading, not hiding
333 mag_type norm1() const;
334
335 using MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::norm2; // overloading, not hiding
337 mag_type norm2() const;
338
339 using MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::normInf; // overloading, not hiding
341 mag_type normInf() const;
342
343 using MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::meanValue; // overloading, not hiding
345 Scalar meanValue() const;
346
348
350
352 virtual std::string description() const;
353
375 virtual void
376 describe(Teuchos::FancyOStream& out,
377 const Teuchos::EVerbosityLevel verbLevel =
378 Teuchos::Describable::verbLevel_default) const;
380}; // class Vector
381
384template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
385Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>
386createCopy(const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& src);
387
393template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
394Teuchos::RCP<Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
398
399} // namespace Tpetra
400
401#endif // TPETRA_VECTOR_DECL_HPP
Declaration of the Tpetra::MultiVector class.
Forward declaration of Tpetra::Vector.
Struct that holds views of the contents of a CrsMatrix.
A parallel distribution of indices over processes.
One or more distributed dense vectors.
typename KokkosKernels::Details::InnerProductSpaceTraits< impl_scalar_type >::dot_type dot_type
Type of an inner ("dot") product result.
Kokkos::DualView< impl_scalar_type **, Kokkos::LayoutLeft, device_type > dual_view_type
Kokkos::DualView specialization used by this class.
typename KokkosKernels::ArithTraits< impl_scalar_type >::mag_type mag_type
Type of a norm result.
static const bool useAtomicUpdatesByDefault
Whether sumIntoLocalValue and sumIntoGlobalValue should use atomic updates by default.
typename KokkosKernels::ArithTraits< Scalar >::val_type impl_scalar_type
The type used internally in place of Scalar.
A distributed dense vector.
virtual ~Vector()=default
Destructor (virtual for memory safety of derived classes).
void replaceGlobalValue(const GlobalOrdinal globalRow, const Scalar &value)
Replace current value at the specified location with specified value.
base_type::impl_scalar_type impl_scalar_type
The type used internally in place of Scalar.
void sumIntoLocalValue(const LocalOrdinal myRow, const Scalar &value, const bool atomic=base_type::useAtomicUpdatesByDefault)
Add value to existing value, using local (row) index.
mag_type normInf() const
Return the infinity-norm of this Vector.
Scalar meanValue() const
Compute mean (average) value of this Vector.
base_type::mag_type mag_type
Type of a norm result.
void replaceLocalValue(const LocalOrdinal myRow, const Scalar &value)
Replace current value at the specified location with specified values.
GlobalOrdinal global_ordinal_type
This class' third template parameter; the type of global indices.
mag_type norm2() const
Return the two-norm of this Vector.
Scalar scalar_type
This class' first template parameter; the type of each entry in the Vector.
base_type::dot_type dot_type
Type of an inner ("dot") product result.
Vector & operator=(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &)=default
Copy assignment (shallow copy).
Node node_type
The Kokkos Node type.
LocalOrdinal local_ordinal_type
This class' second template parameter; the type of local indices.
void sumIntoGlobalValue(const GlobalOrdinal globalRow, const Scalar &value, const bool atomic=base_type::useAtomicUpdatesByDefault)
Add value to existing value, using global (row) index.
base_type::wrapped_dual_view_type wrapped_dual_view_type
WrappedDualView specialization used by this class.
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > createVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
Nonmember Vector "constructor": Create a Vector from a given Map.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Describe this object in a human-readable way to the given output stream.
Vector()
Default constructor: makes a Vector with no rows or columns.
Vector(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &&)=default
Move constructor (shallow move).
Teuchos::ArrayRCP< const Scalar > getData() const
Const view of the local values of this vector.
virtual std::string description() const
Return a one-line description of this object.
Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > & operator=(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &&)=default
Move assigment (shallow move).
Node::device_type device_type
The Kokkos device type.
Vector(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &)=default
Copy constructor (shallow copy).
void get1dCopy(const Teuchos::ArrayView< Scalar > &A) const
Return multi-vector values in user-provided two-dimensional array (using Teuchos memory management cl...
base_type::dual_view_type dual_view_type
Kokkos::DualView specialization used by this class.
Teuchos::ArrayRCP< Scalar > getDataNonConst()
View of the local values of this vector.
dot_type dot(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &y) const
Return the dot product of this Vector and the input Vector x.
mag_type norm1() const
Return the one-norm of this Vector.
base_type::map_type map_type
The type of the Map specialization used by this class.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
MultiVector< ST, LO, GO, NT > createCopy(const MultiVector< ST, LO, GO, NT > &src)
Return a deep copy of the given MultiVector.