Xpetra Version of the Day
Loading...
Searching...
No Matches
Xpetra_EpetraVectorFactory.cpp
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#include "Xpetra_VectorFactory.hpp"
11#include "Xpetra_Vector.hpp"
12#include "Xpetra_BlockedVector.hpp"
13
14namespace Xpetra {
15
16#if defined(HAVE_XPETRA_EPETRA)
17
18// we need the Epetra specialization only if Epetra is enabled
19#if !defined(XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES)
20
21RCP<Xpetra::Vector<double, int, int, EpetraNode>>
23 Build(const Teuchos::RCP<const Xpetra::Map<int, int, EpetraNode>>& map, bool zeroOut) {
24 XPETRA_MONITOR("VectorFactory::Build");
25
27 bmap = Teuchos::rcp_dynamic_cast<const Xpetra::BlockedMap<LocalOrdinal, GlobalOrdinal, Node>>(map);
28
29 if (!bmap.is_null()) {
31 }
32
33#ifdef HAVE_XPETRA_TPETRA
34 if (map->lib() == UseTpetra) {
35 return rcp(new TpetraVector(map, zeroOut));
36 }
37#endif // HAVE_XPETRA_TPETRA
38
39 if (map->lib() == UseEpetra) {
40 return rcp(new EpetraVectorT<GlobalOrdinal, EpetraNode>(map, zeroOut));
41 }
42
44}
45
46#endif // #if !defined(XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES)
47
48#if !defined(XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES)
49
52 Build(const Teuchos::RCP<const Xpetra::Map<int, long long, EpetraNode>>& map, bool zeroOut) {
53 XPETRA_MONITOR("VectorFactory::Build");
54
56 Teuchos::rcp_dynamic_cast<const Xpetra::BlockedMap<LocalOrdinal, GlobalOrdinal, Node>>(map);
57 if (!bmap.is_null()) {
59 }
60
61#ifdef HAVE_XPETRA_TPETRA
62 if (map->lib() == UseTpetra) {
63 return rcp(new TpetraVector(map, zeroOut));
64 }
65#endif
66
67 if (map->lib() == UseEpetra) {
68 return rcp(new EpetraVectorT<GlobalOrdinal, Node>(map, zeroOut));
69 }
70
72}
73
74#endif // #if !defined(XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES)
75
76// we need the Epetra specialization only if Epetra is enabled
77#if !defined(XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES)
78
79RCP<Xpetra::Vector<int, int, int, EpetraNode>>
81 Build(const Teuchos::RCP<const Xpetra::Map<int, int, EpetraNode>>& map, bool zeroOut) {
82 XPETRA_MONITOR("VectorFactory::Build");
83
85 Teuchos::rcp_dynamic_cast<const Xpetra::BlockedMap<LocalOrdinal, GlobalOrdinal, Node>>(map);
86 if (!bmap.is_null()) {
88 }
89
90#ifdef HAVE_XPETRA_TPETRA
91 if (map->lib() == UseTpetra) {
92 return rcp(new TpetraVector(map, zeroOut));
93 }
94#endif // HAVE_XPETRA_TPETRA
95
96 if (map->lib() == UseEpetra) {
97 return rcp(new EpetraIntVectorT<GlobalOrdinal, Node>(map, zeroOut));
98 }
99
101}
102
103#endif // #if !defined(XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES)
104
105#if !defined(XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES)
106
109 Build(const Teuchos::RCP<const Xpetra::Map<int, long long, EpetraNode>>& map, bool zeroOut) {
110 XPETRA_MONITOR("VectorFactory::Build");
111
113 Teuchos::rcp_dynamic_cast<const Xpetra::BlockedMap<LocalOrdinal, GlobalOrdinal, Node>>(map);
114
115 if (!bmap.is_null()) {
117 }
118
119#ifdef HAVE_XPETRA_TPETRA
120 if (map->lib() == UseTpetra) {
121 return rcp(new TpetraVector(map, zeroOut));
122 }
123#endif // HAVE_XPETRA_TPETRA
124
125 if (map->lib() == UseEpetra) {
126 return rcp(new EpetraIntVectorT<GlobalOrdinal, Node>(map, zeroOut));
127 }
128
130}
131
132#endif // #if !defined(XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES)
133
134#endif // #if defined(HAVE_XPETRA_EPETRA)
135
136} // namespace Xpetra
#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.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)