Xpetra Version of the Day
Loading...
Searching...
No Matches
Xpetra_VectorFactory_decl.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Xpetra: A linear algebra interface package
4//
5// Copyright 2012 NTESS and the Xpetra contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef XPETRA_VECTORFACTORY_DECL_HPP
11#define XPETRA_VECTORFACTORY_DECL_HPP
12
13#include "Xpetra_ConfigDefs.hpp"
14#include "Xpetra_Vector.hpp"
15
17
20#include "Xpetra_Exceptions.hpp"
21
22namespace Xpetra {
23
24template <class Scalar /* = Vector<>::scalar_type*/,
25 class LocalOrdinal /* = typename Vector<Scalar>::local_ordinal_type*/,
26 class GlobalOrdinal /* = typename Vector<Scalar, LocalOrdinal>::local_ordinal_type*/,
27 class Node /* = typename Vector<Scalar, LocalOrdinal, GlobalOrdinal>::node_type*/>
29#undef XPETRA_VECTORFACTORY_SHORT
31
32 private:
34 VectorFactory() = default;
35
36 public:
39 Build(const Teuchos::RCP<const Xpetra::Map<LocalOrdinal, GlobalOrdinal, Node>>& map, bool zeroOut = true) {
40 XPETRA_MONITOR("VectorFactory::Build");
41
43 bmap = Teuchos::rcp_dynamic_cast<const Xpetra::BlockedMap<LocalOrdinal, GlobalOrdinal, Node>>(map);
44
45 if (!bmap.is_null()) {
47 }
48
49 if (map->lib() == UseTpetra) {
50 return rcp(new TpetraVector(map, zeroOut));
51 }
52
54 TEUCHOS_UNREACHABLE_RETURN(Teuchos::null);
55 }
56
57}; // class VectorFactory
58
59#define XPETRA_VECTORFACTORY_SHORT
60
61} // namespace Xpetra
62
63#define XPETRA_VECTORFACTORY_SHORT
64#endif // XPETRA_VECTORFACTORY_DECL_HPP
#define XPETRA_MONITOR(funcName)
#define XPETRA_FACTORY_END
bool is_null() const
static Teuchos::RCP< Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &map, bool zeroOut=true)
Constructor specifying the number of non-zeros for all rows.
VectorFactory()=default
Private constructor. This is a static class.
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)