Tpetra parallel linear algebra  Version of the Day
Tpetra_FEMultiVector_decl.hpp
Go to the documentation of this file.
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_FEMULTIVECTOR_DECL_HPP
43 #define TPETRA_FEMULTIVECTOR_DECL_HPP
44 
47 
50 
51 namespace Tpetra {
52 
53  template <class Scalar,
54  class LocalOrdinal,
55  class GlobalOrdinal,
56  class Node>
57  class FEMultiVector :
58  public MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>
59  {
60  private:
62  friend base_type;
63 
65  void beginFill ();
66 
68  void endFill ();
69 
70  public:
72 
73 
75  using scalar_type = Scalar;
77  using local_ordinal_type = LocalOrdinal;
79  using global_ordinal_type = GlobalOrdinal;
80 
82  using device_type = typename base_type::device_type;
83 
85  using execution_space = typename base_type::execution_space;
86 
88  using node_type = Node;
89 
91  using dual_view_type = typename base_type::dual_view_type;
92 
94  using map_type = typename base_type::map_type;
95 
97  using impl_scalar_type = typename base_type::impl_scalar_type;
98 
100  using dot_type = typename base_type::dot_type;
101 
103  using mag_type = typename base_type::mag_type;
104 
106 
108 
110  FEMultiVector () = delete;
111 
134  FEMultiVector (const Teuchos::RCP<const map_type>& map,
135  const Teuchos::RCP<const Import<local_ordinal_type, global_ordinal_type, node_type>>& importer,
136  const size_t numVecs,
137  const bool zeroOut = true);
138 
140  FEMultiVector (const FEMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>&) = delete;
141 
143  FEMultiVector (FEMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>&&) = delete;
144 
146  FEMultiVector&
147  operator= (const FEMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>&) = delete;
148 
150  FEMultiVector&
151  operator= (FEMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>&&) = delete;
152 
162  virtual ~FEMultiVector () = default;
163 
165 
167 
169  void beginAssembly ();
170 
172  void endAssembly ();
173 
174  void beginModify ();
175  void endModify ();
176 
179  void globalAssemble ();
180 
186  void doOwnedPlusSharedToOwned(const CombineMode CM=Tpetra::ADD);
187 
192  void doOwnedToOwnedPlusShared(const CombineMode CM=Tpetra::ADD);
193 
195  void switchActiveMultiVector();
196 
197  protected:
202  void replaceMap (const Teuchos::RCP<const map_type>& map);
203 
205  enum FEWhichActive
206  {
207  FE_ACTIVE_OWNED_PLUS_SHARED,
208  FE_ACTIVE_OWNED
209  };
210 
211  enum class FillState
212  {
213  open, // matrix is "open". Values can freely summed in to and replaced
214  modify, // matrix is open for modification. *local* values can be replaced
215  closed
216  };
217  Teuchos::RCP<FillState> fillState_;
218 
220  Teuchos::RCP<base_type> inactiveMultiVector_;
221 
227  Teuchos::RCP<FEWhichActive> activeMultiVector_;
228 
230  Teuchos::RCP<const Import<local_ordinal_type, global_ordinal_type, node_type>> importer_;
231  };
232 
233 } // namespace Tpetra
234 
235 #endif // TPETRA_FEMULTIVECTOR_DECL_HPP
Forward declaration of Tpetra::FEMultiVector.
Declaration of the Tpetra::MultiVector class.
One or more distributed dense vectors.
typename Kokkos::Details::InnerProductSpaceTraits< impl_scalar_type >::dot_type dot_type
Type of an inner ("dot") product result.
typename Kokkos::Details::ArithTraits< Scalar >::val_type impl_scalar_type
The type used internally in place of Scalar.
Kokkos::DualView< impl_scalar_type **, Kokkos::LayoutLeft, device_type > dual_view_type
Kokkos::DualView specialization used by this class.
typename map_type::device_type device_type
This class' preferred Kokkos device type.
Map< LocalOrdinal, GlobalOrdinal, Node > map_type
The type of the Map specialization used by this class.
typename device_type::execution_space execution_space
Type of the (new) Kokkos execution space.
typename Kokkos::ArithTraits< impl_scalar_type >::mag_type mag_type
Type of a norm result.
int local_ordinal_type
Default value of Scalar template parameter.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
CombineMode
Rule for combining data in an Import or Export.
@ ADD
Sum new values.