Stokhos Package Browser (Single Doxygen Collection)
Version of the Day
src
sacado
kokkos
pce
tpetra
Tpetra_CrsMatrix_UQ_PCE_def.hpp
Go to the documentation of this file.
1
// @HEADER
2
// ***********************************************************************
3
//
4
// Stokhos Package
5
// Copyright (2009) Sandia Corporation
6
//
7
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8
// license for use of this work by or on behalf of the U.S. Government.
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 Eric T. Phipps (etphipp@sandia.gov).
38
//
39
// ***********************************************************************
40
// @HEADER
41
42
#ifndef TPETRA_CRSMATRIX_UQ_PCE_DEF_HPP
43
#define TPETRA_CRSMATRIX_UQ_PCE_DEF_HPP
44
45
// Specializations of some Tpetra::CrsMatrix methods for UQ::PCE
46
47
#include "Tpetra_CrsMatrix_def.hpp"
48
49
namespace
Tpetra
{
50
51
#define TPETRA_CRSMATRIX_UQ_PCE_SPEC(Scalar,LocalOrdinal,GlobalOrdinal,Node) \
52
template<> \
53
Teuchos::RCP<MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node, false> > \
54
CrsMatrix<Scalar , LocalOrdinal, GlobalOrdinal, Node, false>:: \
55
getColumnMapMultiVector (const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node, false>& X_domainMap, \
56
const bool force) const \
57
{ \
58
using Teuchos::null; \
59
using Teuchos::RCP; \
60
using Teuchos::rcp; \
61
\
62
TEUCHOS_TEST_FOR_EXCEPTION( \
63
! this->hasColMap (), std::runtime_error, "Tpetra::CrsMatrix::getColumn" \
64
"MapMultiVector: You may only call this method if the matrix has a " \
65
"column Map. If the matrix does not yet have a column Map, you should " \
66
"first call fillComplete (with domain and range Map if necessary)."); \
67
\
68
TEUCHOS_TEST_FOR_EXCEPTION( \
69
! this->getGraph ()->isFillComplete (), std::runtime_error, "Tpetra::" \
70
"CrsMatrix::getColumnMapMultiVector: You may only call this method if " \
71
"this matrix's graph is fill complete."); \
72
\
73
const size_t numVecs = X_domainMap.getNumVectors (); \
74
RCP<const import_type> importer = this->getGraph ()->getImporter (); \
75
RCP<const map_type> colMap = this->getColMap (); \
76
\
77
RCP<MV> X_colMap; \
78
\
79
if (! importer.is_null () || force) { \
80
if (importMV_.is_null () || \
81
importMV_->getNumVectors () != numVecs || \
82
(Kokkos::dimension_scalar(*importMV_) != \
83
Kokkos::dimension_scalar(X_domainMap))) { \
84
X_colMap = rcp (new MV (colMap, numVecs)); \
85
importMV_ = X_colMap; \
86
} \
87
else { \
88
X_colMap = importMV_; \
89
} \
90
} \
91
return X_colMap; \
92
} \
93
\
94
template <> \
95
Teuchos::RCP<MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node, false> > \
96
CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node, false>:: \
97
getRowMapMultiVector (const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node, false>& Y_rangeMap, \
98
const bool force) const \
99
{ \
100
using Teuchos::null; \
101
using Teuchos::RCP; \
102
using Teuchos::rcp; \
103
\
104
TEUCHOS_TEST_FOR_EXCEPTION( \
105
! this->getGraph ()->isFillComplete (), std::runtime_error, "Tpetra::" \
106
"CrsMatrix::getRowMapMultiVector: You may only call this method if this " \
107
"matrix's graph is fill complete."); \
108
\
109
const size_t numVecs = Y_rangeMap.getNumVectors (); \
110
RCP<const export_type> exporter = this->getGraph ()->getExporter (); \
111
RCP<const map_type> rowMap = this->getRowMap (); \
112
\
113
RCP<MV> Y_rowMap; \
114
\
115
if (! exporter.is_null () || force) { \
116
if (exportMV_.is_null () || \
117
exportMV_->getNumVectors () != numVecs || \
118
(Kokkos::dimension_scalar(*exportMV_) != \
119
Kokkos::dimension_scalar(Y_rangeMap))) { \
120
Y_rowMap = rcp (new MV (rowMap, numVecs)); \
121
exportMV_ = Y_rowMap; \
122
} \
123
else { \
124
Y_rowMap = exportMV_; \
125
} \
126
} \
127
return Y_rowMap; \
128
}
129
130
}
// namespace Tpetra
131
132
#endif // STOKHOS_TPETRA_UQ_PCE_DEF_HPP
Tpetra
Definition:
Stokhos_Tpetra_UQ_PCE.hpp:136
Generated by
1.8.14