Tpetra parallel linear algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
139  FEMultiVector (const Teuchos::RCP<const map_type>& map,
140  const Teuchos::RCP<const Import<local_ordinal_type, global_ordinal_type, node_type>>& importer,
141  const size_t numVecs,
142  const bool zeroOut = true);
143 
145  FEMultiVector (const FEMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>&) = delete;
146 
148  FEMultiVector (FEMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>&&) = delete;
149 
151  FEMultiVector&
152  operator= (const FEMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>&) = delete;
153 
155  FEMultiVector&
156  operator= (FEMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>&&) = delete;
157 
167  virtual ~FEMultiVector () = default;
168 
170 
172 
174  void beginAssembly ();
175 
177  void endAssembly ();
178 
179  void beginModify ();
180  void endModify ();
181 
184  void globalAssemble ();
185 
191  void doOwnedPlusSharedToOwned(const CombineMode CM=Tpetra::ADD);
192 
197  void doOwnedToOwnedPlusShared(const CombineMode CM=Tpetra::ADD);
198 
200  void switchActiveMultiVector();
201 
202  protected:
207  void replaceMap (const Teuchos::RCP<const map_type>& map);
208 
210  enum FEWhichActive
211  {
212  FE_ACTIVE_OWNED_PLUS_SHARED,
213  FE_ACTIVE_OWNED
214  };
215 
216  enum class FillState
217  {
218  open, // matrix is "open". Values can freely summed in to and replaced
219  modify, // matrix is open for modification. *local* values can be replaced
220  closed
221  };
222  Teuchos::RCP<FillState> fillState_;
223 
225  Teuchos::RCP<base_type> inactiveMultiVector_;
226 
232  Teuchos::RCP<FEWhichActive> activeMultiVector_;
233 
235  Teuchos::RCP<const Import<local_ordinal_type, global_ordinal_type, node_type>> importer_;
236  };
237 
238 } // namespace Tpetra
239 
240 #endif // TPETRA_FEMULTIVECTOR_DECL_HPP
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.
void replaceMap(const Teuchos::RCP< const map_type > &map)
Replace the underlying Map in place.
typename map_type::device_type device_type
This class&#39; preferred Kokkos device type.
int local_ordinal_type
Default value of Scalar template parameter.
typename Kokkos::ArithTraits< Scalar >::val_type impl_scalar_type
The type used internally in place of Scalar.
Declaration of the Tpetra::MultiVector class.
CombineMode
Rule for combining data in an Import or Export.
Sum new values.
Kokkos::DualView< impl_scalar_type **, Kokkos::LayoutLeft, device_type > dual_view_type
Kokkos::DualView specialization used by this class.
Map< LocalOrdinal, GlobalOrdinal, Node > map_type
The type of the Map specialization used by this class.
Forward declaration of Tpetra::FEMultiVector.
typename Kokkos::Details::InnerProductSpaceTraits< impl_scalar_type >::dot_type dot_type
Type of an inner (&quot;dot&quot;) product result.