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 
45 #include <Tpetra_Experimental_BlockMultiVector.hpp>
46 #include <Tpetra_Vector.hpp>
47 
48 namespace Tpetra {
49 namespace Experimental {
50 
76 template<class Scalar = Details::DefaultTypes::scalar_type,
78  class GO = Details::DefaultTypes::global_ordinal_type,
80 class BlockVector : public BlockMultiVector<Scalar, LO, GO, Node> {
81 private:
83  typedef Teuchos::ScalarTraits<Scalar> STS;
84 
85 public:
87 
88 
98  typedef typename base_type::node_type node_type;
99 
106 
122 
128 
130 
132 
162  BlockVector (const map_type& meshMap, const LO blockSize);
163 
168  BlockVector (const map_type& meshMap,
169  const map_type& pointMap,
170  const LO blockSize);
171 
185  BlockVector (const mv_type& X_mv,
186  const map_type& meshMap,
187  const LO blockSize);
188 
194  const map_type& newMeshMap,
195  const map_type& newPointMap,
196  const size_t offset = 0);
197 
203  const map_type& newMeshMap,
204  const size_t offset = 0);
205 
210  BlockVector ();
211 
213 
215 
220  vec_type getVectorView ();
221 
223 
225 
241  bool replaceLocalValues (const LO localRowIndex, const Scalar vals[]) const;
242 
252  bool replaceGlobalValues (const GO globalRowIndex, const Scalar vals[]) const;
253 
263  bool sumIntoLocalValues (const LO localRowIndex, const Scalar vals[]) const;
264 
274  bool sumIntoGlobalValues (const GO globalRowIndex, const Scalar vals[]) const;
275 
286  bool getLocalRowView (const LO localRowIndex, Scalar*& vals) const;
287 
298  bool getGlobalRowView (const GO globalRowIndex, Scalar*& vals) const;
299 
312  little_vec_type getLocalBlock (const LO localRowIndex) const;
314 };
315 
316 } // namespace Experimental
317 } // namespace Tpetra
318 
319 #endif // TPETRA_EXPERIMENTAL_BLOCKMULTIVECTOR_DECL_HPP
bool getLocalRowView(const LO localRowIndex, Scalar *&vals) const
Get a writeable view of the entries at the given mesh point, using a local index. ...
Namespace Tpetra contains the class and methods constituting the Tpetra library.
base_type::impl_scalar_type impl_scalar_type
The implementation type of entries in the vector.
KokkosClassic::DefaultNode::DefaultNodeType node_type
Default value of Node template parameter.
MultiVector for multiple degrees of freedom per mesh point.
Vector for multiple degrees of freedom per mesh point.
int local_ordinal_type
Default value of LocalOrdinal template parameter.
mv_type::impl_scalar_type impl_scalar_type
The implementation type of entries in the matrix.
Tpetra::Vector< Scalar, LO, GO, Node > vec_type
The specialization of Tpetra::Vector that this class uses.
base_type::node_type node_type
The Kokkos Node type.
bool sumIntoGlobalValues(const GO globalRowIndex, const Scalar vals[]) const
Sum into all values at the given mesh point, using a global index.
base_type::local_ordinal_type local_ordinal_type
The type of local indices.
Tpetra::Map< LO, GO, Node > map_type
The specialization of Tpetra::Map that this class uses.
LittleVector< impl_scalar_type, LO > little_vec_type
"Block view" of all degrees of freedom at a mesh point.
base_type::scalar_type scalar_type
The type of entries in the vector.
Nonowning view of a set of degrees of freedom corresponding to a mesh point in a block vector or mult...
base_type::global_ordinal_type global_ordinal_type
The type of global indices.
vec_type getVectorView()
Get a Tpetra::Vector that views this BlockVector&#39;s data.
double scalar_type
Default value of Scalar template parameter.
bool getGlobalRowView(const GO globalRowIndex, Scalar *&vals) const
Get a writeable view of the entries at the given mesh point, using a global index.
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.
LittleVector< const impl_scalar_type, LO > const_little_vec_type
"Const block view" of all degrees of freedom at a mesh point.
bool sumIntoLocalValues(const LO localRowIndex, const Scalar vals[]) const
Sum into all values at the given mesh point, using a local index.
A distributed dense vector.
bool replaceGlobalValues(const GO globalRowIndex, const Scalar vals[]) const
Replace all values at the given mesh point, using a global index.
Tpetra::MultiVector< Scalar, LO, GO, Node > mv_type
The specialization of Tpetra::MultiVector that this class uses.
bool replaceLocalValues(const LO localRowIndex, const Scalar vals[]) const
Replace all values at the given mesh point, using a local index.