Tpetra parallel linear algebra Version of the Day
Loading...
Searching...
No Matches
Tpetra_BlockVector_decl.hpp
1// @HEADER
2// ***********************************************************************
3//
4// Tpetra: Templated Linear Algebra Services Package
5// Copyright (2008) Sandia Corporation
6//
7// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8// the U.S. Government retains certain rights in this software.
9//
10// Redistribution and use in source and binary forms, with or without
11// modification, are permitted provided that the following conditions are
12// met:
13//
14// 1. Redistributions of source code must retain the above copyright
15// notice, this list of conditions and the following disclaimer.
16//
17// 2. Redistributions in binary form must reproduce the above copyright
18// notice, this list of conditions and the following disclaimer in the
19// documentation and/or other materials provided with the distribution.
20//
21// 3. Neither the name of the Corporation nor the names of the
22// contributors may be used to endorse or promote products derived from
23// this software without specific prior written permission.
24//
25// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36//
37// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38//
39// ************************************************************************
40// @HEADER
41
42#ifndef TPETRA_BLOCKVECTOR_DECL_HPP
43#define TPETRA_BLOCKVECTOR_DECL_HPP
44
46#include "Tpetra_BlockMultiVector.hpp"
47#include "Tpetra_Vector.hpp"
48
49namespace Tpetra {
50
76template<class Scalar,
77 class LO,
78 class GO,
79 class Node>
80class BlockVector : public BlockMultiVector<Scalar, LO, GO, Node> {
81private:
83 typedef Teuchos::ScalarTraits<Scalar> STS;
84
85public:
87
88
90 typedef typename base_type::scalar_type scalar_type;
92 typedef typename base_type::impl_scalar_type impl_scalar_type;
94 typedef typename base_type::local_ordinal_type local_ordinal_type;
96 typedef typename base_type::global_ordinal_type global_ordinal_type;
98 typedef typename base_type::node_type node_type;
100 typedef typename Node::device_type device_type;
101
108
123 typedef typename base_type::little_vec_type
125 typedef typename base_type::little_host_vec_type
126 little_host_vec_type;
127
132 typedef typename base_type::const_little_vec_type
134 typedef typename base_type::const_little_host_vec_type
135 const_little_host_vec_type;
136
138
140
145 BlockVector ();
146
149
152
156
160
163 const Teuchos::DataAccess copyOrView);
164
194 BlockVector (const map_type& meshMap, const LO blockSize);
195
201 const map_type& pointMap,
202 const LO blockSize);
203
217 BlockVector (const mv_type& X_mv,
218 const map_type& meshMap,
219 const LO blockSize);
220
233 BlockVector (const vec_type& X_vec,
234 const map_type& meshMap,
235 const LO blockSize);
236
242 const map_type& newMeshMap,
243 const map_type& newPointMap,
244 const size_t offset = 0);
245
251 const map_type& newMeshMap,
252 const size_t offset = 0);
253
255
257
263
265
267
283 bool replaceLocalValues (const LO localRowIndex, const Scalar vals[]);
284
294 bool replaceGlobalValues (const GO globalRowIndex, const Scalar vals[]);
295
305 bool sumIntoLocalValues (const LO localRowIndex, const Scalar vals[]);
306
316 bool sumIntoGlobalValues (const GO globalRowIndex, const Scalar vals[]);
317
327 const_little_host_vec_type getLocalBlockHost (const LO localRowIndex,
328 Access::ReadOnlyStruct) const;
329 little_host_vec_type getLocalBlockHost (const LO localRowIndex,
330 Access::OverwriteAllStruct);
331 little_host_vec_type getLocalBlockHost (const LO localRowIndex,
332 Access::ReadWriteStruct);
334};
335
336} // namespace Tpetra
337
338#endif // TPETRA_BLOCKMULTIVECTOR_DECL_HPP
Forward declaration of Tpetra::BlockVector.
MultiVector for multiple degrees of freedom per mesh point.
Vector for multiple degrees of freedom per mesh point.
const_little_host_vec_type getLocalBlockHost(const LO localRowIndex, Access::ReadOnlyStruct) const
Get a view of the degrees of freedom at the given mesh point, using a local index.
base_type::scalar_type scalar_type
The type of entries in the vector.
BlockVector(const BlockVector< Scalar, LO, GO, Node > &)=default
Copy constructor (shallow copy).
base_type::little_vec_type little_vec_type
"Block view" of all degrees of freedom at a mesh point.
base_type::local_ordinal_type local_ordinal_type
The type of local indices.
Tpetra::MultiVector< Scalar, LO, GO, Node > mv_type
The specialization of Tpetra::MultiVector that this class uses.
Tpetra::Map< LO, GO, Node > map_type
The specialization of Tpetra::Map that this class uses.
base_type::node_type node_type
The Kokkos Node type.
bool sumIntoGlobalValues(const GO globalRowIndex, const Scalar vals[])
Sum into all values at the given mesh point, using a global index.
BlockVector< Scalar, LO, GO, Node > & operator=(const BlockVector< Scalar, LO, GO, Node > &)=default
Copy assigment (shallow copy).
Tpetra::Vector< Scalar, LO, GO, Node > vec_type
The specialization of Tpetra::Vector that this class uses.
bool replaceGlobalValues(const GO globalRowIndex, const Scalar vals[])
Replace all values at the given mesh point, using a global index.
base_type::const_little_vec_type const_little_vec_type
"Const block view" of all degrees of freedom at a mesh point.
BlockVector()
Default constructor.
bool sumIntoLocalValues(const LO localRowIndex, const Scalar vals[])
Sum into all values at the given mesh point, using a local index.
vec_type getVectorView()
Get a Tpetra::Vector that views this BlockVector's data.
base_type::impl_scalar_type impl_scalar_type
The implementation type of entries in the vector.
bool replaceLocalValues(const LO localRowIndex, const Scalar vals[])
Replace all values at the given mesh point, using a local index.
BlockVector(BlockVector< Scalar, LO, GO, Node > &&)=default
Move constructor (shallow move).
Node::device_type device_type
The Kokkos Device type.
base_type::global_ordinal_type global_ordinal_type
The type of global indices.
Struct that holds views of the contents of a CrsMatrix.
A distributed dense vector.
Namespace Tpetra contains the class and methods constituting the Tpetra library.