Tpetra parallel linear algebra  Version of the Day
Tpetra_Experimental_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_EXPERIMENTAL_BLOCKVECTOR_DECL_HPP
43 #define TPETRA_EXPERIMENTAL_BLOCKVECTOR_DECL_HPP
44 
46 #include "Tpetra_Experimental_BlockMultiVector.hpp"
47 #include "Tpetra_Vector.hpp"
48 
49 namespace Tpetra {
50 namespace Experimental {
51 namespace Classes {
52 
78 template<class Scalar = ::Tpetra::Details::DefaultTypes::scalar_type,
80  class GO = ::Tpetra::Details::DefaultTypes::global_ordinal_type,
82 class BlockVector : public BlockMultiVector<Scalar, LO, GO, Node> {
83 private:
85  typedef Teuchos::ScalarTraits<Scalar> STS;
86 
87 public:
89 
90 
100  typedef typename base_type::node_type node_type;
102  typedef typename Node::device_type device_type;
103 
110 
125  typedef Kokkos::View<impl_scalar_type*,
126  Kokkos::LayoutRight,
127  device_type,
128  Kokkos::MemoryTraits<Kokkos::Unmanaged> >
130 
135  typedef Kokkos::View<const impl_scalar_type*,
136  Kokkos::LayoutRight,
137  device_type,
138  Kokkos::MemoryTraits<Kokkos::Unmanaged> >
140 
142 
144 
174  BlockVector (const map_type& meshMap, const LO blockSize);
175 
180  BlockVector (const map_type& meshMap,
181  const map_type& pointMap,
182  const LO blockSize);
183 
197  BlockVector (const mv_type& X_mv,
198  const map_type& meshMap,
199  const LO blockSize);
200 
206  const map_type& newMeshMap,
207  const map_type& newPointMap,
208  const size_t offset = 0);
209 
215  const map_type& newMeshMap,
216  const size_t offset = 0);
217 
222  BlockVector ();
223 
225 
227 
233 
235 
237 
253  bool replaceLocalValues (const LO localRowIndex, const Scalar vals[]) const;
254 
264  bool replaceGlobalValues (const GO globalRowIndex, const Scalar vals[]) const;
265 
275  bool sumIntoLocalValues (const LO localRowIndex, const Scalar vals[]) const;
276 
286  bool sumIntoGlobalValues (const GO globalRowIndex, const Scalar vals[]) const;
287 
298  bool getLocalRowView (const LO localRowIndex, Scalar*& vals) const;
299 
310  bool getGlobalRowView (const GO globalRowIndex, Scalar*& vals) const;
311 
324  little_vec_type getLocalBlock (const LO localRowIndex) const;
326 };
327 
328 } // namespace Classes
329 } // namespace Experimental
330 } // namespace Tpetra
331 
332 #endif // TPETRA_EXPERIMENTAL_BLOCKMULTIVECTOR_DECL_HPP
Tpetra::Experimental::Classes::BlockVector::local_ordinal_type
base_type::local_ordinal_type local_ordinal_type
The type of local indices.
Definition: Tpetra_Experimental_BlockVector_decl.hpp:96
Tpetra::Experimental::Classes::BlockVector::getVectorView
vec_type getVectorView()
Get a Tpetra::Vector that views this BlockVector's data.
Definition: Tpetra_Experimental_BlockVector_def.hpp:99
Tpetra::Experimental::Classes::BlockVector::vec_type
Tpetra::Vector< Scalar, LO, GO, Node > vec_type
The specialization of Tpetra::Vector that this class uses.
Definition: Tpetra_Experimental_BlockVector_decl.hpp:109
Tpetra::Experimental::Classes::BlockMultiVector::local_ordinal_type
LO local_ordinal_type
The type of local indices.
Definition: Tpetra_Experimental_BlockMultiVector_decl.hpp:175
Tpetra::Details::DefaultTypes::node_type
::Kokkos::Compat::KokkosDeviceWrapperNode< execution_space > node_type
Default value of Node template parameter.
Definition: Tpetra_Details_DefaultTypes.hpp:105
Tpetra::Experimental::Classes::BlockVector::impl_scalar_type
base_type::impl_scalar_type impl_scalar_type
The implementation type of entries in the vector.
Definition: Tpetra_Experimental_BlockVector_decl.hpp:94
Tpetra::Experimental::Classes::BlockMultiVector::node_type
Node node_type
The Kokkos Node type.
Definition: Tpetra_Experimental_BlockMultiVector_decl.hpp:182
Tpetra::Experimental::Classes::BlockMultiVector::scalar_type
Scalar scalar_type
The type of entries in the matrix.
Definition: Tpetra_Experimental_BlockMultiVector_decl.hpp:167
Tpetra::Experimental::Classes::BlockVector::node_type
base_type::node_type node_type
The Kokkos Node type.
Definition: Tpetra_Experimental_BlockVector_decl.hpp:100
Tpetra::Experimental::Classes::BlockVector::getLocalRowView
bool getLocalRowView(const LO localRowIndex, Scalar *&vals) const
Get a writeable view of the entries at the given mesh point, using a local index.
Definition: Tpetra_Experimental_BlockVector_def.hpp:137
Tpetra::Experimental::Classes::BlockVector::map_type
Tpetra::Map< LO, GO, Node > map_type
The specialization of Tpetra::Map that this class uses.
Definition: Tpetra_Experimental_BlockVector_decl.hpp:105
Tpetra::Experimental::Classes::BlockVector
Vector for multiple degrees of freedom per mesh point.
Definition: Tpetra_Experimental_BlockVector_decl.hpp:82
Tpetra::Experimental::Classes::BlockVector::BlockVector
BlockVector()
Default constructor.
Definition: Tpetra_Experimental_BlockVector_def.hpp:95
Tpetra::Experimental::Classes::BlockVector::sumIntoGlobalValues
bool sumIntoGlobalValues(const GO globalRowIndex, const Scalar vals[]) const
Sum into all values at the given mesh point, using a global index.
Definition: Tpetra_Experimental_BlockVector_def.hpp:130
Tpetra::Experimental::Classes::BlockMultiVector::impl_scalar_type
mv_type::impl_scalar_type impl_scalar_type
The implementation type of entries in the matrix.
Definition: Tpetra_Experimental_BlockMultiVector_decl.hpp:173
Tpetra::Experimental::Classes::BlockVector::getGlobalRowView
bool getGlobalRowView(const GO globalRowIndex, Scalar *&vals) const
Get a writeable view of the entries at the given mesh point, using a global index.
Definition: Tpetra_Experimental_BlockVector_def.hpp:144
Tpetra::Experimental::Classes::BlockVector::scalar_type
base_type::scalar_type scalar_type
The type of entries in the vector.
Definition: Tpetra_Experimental_BlockVector_decl.hpp:92
Tpetra::Experimental::Classes::BlockVector::const_little_vec_type
Kokkos::View< const impl_scalar_type *, Kokkos::LayoutRight, device_type, Kokkos::MemoryTraits< Kokkos::Unmanaged > > const_little_vec_type
"Const block view" of all degrees of freedom at a mesh point.
Definition: Tpetra_Experimental_BlockVector_decl.hpp:139
Tpetra::Experimental::Classes::BlockVector::sumIntoLocalValues
bool sumIntoLocalValues(const LO localRowIndex, const Scalar vals[]) const
Sum into all values at the given mesh point, using a local index.
Definition: Tpetra_Experimental_BlockVector_def.hpp:123
Tpetra::Classes::MultiVector
One or more distributed dense vectors.
Definition: Tpetra_MultiVector_decl.hpp:389
Tpetra::Details::DefaultTypes::local_ordinal_type
int local_ordinal_type
Default value of Scalar template parameter.
Definition: Tpetra_Details_DefaultTypes.hpp:72
Tpetra::Experimental::Classes::BlockVector::global_ordinal_type
base_type::global_ordinal_type global_ordinal_type
The type of global indices.
Definition: Tpetra_Experimental_BlockVector_decl.hpp:98
Tpetra_Experimental_BlockVector_fwd.hpp
Forward declaration of Tpetra::Experimental::BlockVector.
Tpetra::Experimental::Classes::BlockVector::replaceLocalValues
bool replaceLocalValues(const LO localRowIndex, const Scalar vals[]) const
Replace all values at the given mesh point, using a local index.
Definition: Tpetra_Experimental_BlockVector_def.hpp:108
Tpetra::Experimental::Classes::BlockVector::device_type
Node::device_type device_type
The Kokkos Device type.
Definition: Tpetra_Experimental_BlockVector_decl.hpp:102
Tpetra::Experimental::Classes::BlockMultiVector
MultiVector for multiple degrees of freedom per mesh point.
Definition: Tpetra_Experimental_BlockMultiVector_decl.hpp:147
Tpetra::Classes::Map
A parallel distribution of indices over processes.
Definition: Tpetra_Map_decl.hpp:247
Tpetra::Experimental::Classes::BlockVector::getLocalBlock
little_vec_type getLocalBlock(const LO localRowIndex) const
Get a view of the degrees of freedom at the given mesh point, using a local index.
Definition: Tpetra_Experimental_BlockVector_def.hpp:162
Tpetra::Experimental::Classes::BlockVector::mv_type
Tpetra::MultiVector< Scalar, LO, GO, Node > mv_type
The specialization of Tpetra::MultiVector that this class uses.
Definition: Tpetra_Experimental_BlockVector_decl.hpp:107
Tpetra::Experimental::Classes::BlockVector::little_vec_type
Kokkos::View< impl_scalar_type *, Kokkos::LayoutRight, device_type, Kokkos::MemoryTraits< Kokkos::Unmanaged > > little_vec_type
"Block view" of all degrees of freedom at a mesh point.
Definition: Tpetra_Experimental_BlockVector_decl.hpp:129
Tpetra
Namespace Tpetra contains the class and methods constituting the Tpetra library.
Tpetra::Experimental::Classes::BlockVector::replaceGlobalValues
bool replaceGlobalValues(const GO globalRowIndex, const Scalar vals[]) const
Replace all values at the given mesh point, using a global index.
Definition: Tpetra_Experimental_BlockVector_def.hpp:115
Tpetra::Experimental::Classes::BlockMultiVector::global_ordinal_type
GO global_ordinal_type
The type of global indices.
Definition: Tpetra_Experimental_BlockMultiVector_decl.hpp:177
Tpetra::Experimental::Classes::BlockMultiVector::little_vec_type
Kokkos::View< impl_scalar_type *, Kokkos::LayoutRight, device_type, Kokkos::MemoryTraits< Kokkos::Unmanaged > > little_vec_type
"Block view" of all degrees of freedom at a mesh point, for a single column of the MultiVector.
Definition: Tpetra_Experimental_BlockMultiVector_decl.hpp:203
Tpetra::Classes::Vector
A distributed dense vector.
Definition: Tpetra_Vector_decl.hpp:82