Stokhos Package Browser (Single Doxygen Collection)
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
src
epetra
Stokhos_EpetraMultiVectorOrthogPoly.cpp
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
#include "
Stokhos_EpetraMultiVectorOrthogPoly.hpp
"
43
44
Stokhos::EpetraMultiVectorOrthogPoly::
45
EpetraMultiVectorOrthogPoly
() :
46
ProductContainer
<
Epetra_MultiVector
>(),
47
VectorOrthogPoly
<
Epetra_MultiVector
>(),
48
ProductEpetraMultiVector
()
49
{
50
}
51
52
Stokhos::EpetraMultiVectorOrthogPoly::
53
EpetraMultiVectorOrthogPoly
(
54
const
Teuchos::RCP<
const
Stokhos::OrthogPolyBasis<int, double>
>&
basis
,
55
const
Teuchos::RCP<const Epetra_BlockMap>& block_map) :
56
ProductContainer
<
Epetra_MultiVector
>(block_map),
57
VectorOrthogPoly
<
Epetra_MultiVector
>(
basis
, block_map),
58
ProductEpetraMultiVector
(block_map)
59
{
60
}
61
62
Stokhos::EpetraMultiVectorOrthogPoly::
63
EpetraMultiVectorOrthogPoly
(
64
const
Teuchos::RCP<
const
Stokhos::OrthogPolyBasis<int, double>
>&
basis
,
65
const
Teuchos::RCP<const Epetra_BlockMap>& block_map,
66
const
Teuchos::RCP<const Epetra_BlockMap>&
coeff_map
,
67
const
Teuchos::RCP<const EpetraExt::MultiComm>&
product_comm
,
68
int
num_vectors) :
69
ProductContainer
<
Epetra_MultiVector
>(block_map),
70
VectorOrthogPoly
<
Epetra_MultiVector
>(
basis
, block_map),
71
ProductEpetraMultiVector
(block_map,
coeff_map
,
product_comm
, num_vectors)
72
{
73
}
74
75
Stokhos::EpetraMultiVectorOrthogPoly::
76
EpetraMultiVectorOrthogPoly
(
77
const
Teuchos::RCP<
const
Stokhos::OrthogPolyBasis<int, double>
>&
basis
,
78
const
Teuchos::RCP<const Epetra_BlockMap>& block_map,
79
const
Teuchos::RCP<const Epetra_BlockMap>&
coeff_map
,
80
const
Teuchos::RCP<const Epetra_BlockMap>&
product_map
,
81
const
Teuchos::RCP<const EpetraExt::MultiComm>&
product_comm
,
82
int
num_vectors) :
83
ProductContainer
<
Epetra_MultiVector
>(block_map),
84
VectorOrthogPoly
<
Epetra_MultiVector
>(
basis
, block_map),
85
ProductEpetraMultiVector
(block_map,
coeff_map
,
product_map
,
product_comm
,
86
num_vectors)
87
{
88
}
89
90
Stokhos::EpetraMultiVectorOrthogPoly::
91
EpetraMultiVectorOrthogPoly
(
92
const
Teuchos::RCP<
const
Stokhos::OrthogPolyBasis<int, double>
>&
basis
,
93
const
Teuchos::RCP<const Epetra_BlockMap>& block_map,
94
const
Teuchos::RCP<const Epetra_BlockMap>&
coeff_map
,
95
const
Teuchos::RCP<const Epetra_BlockMap>&
product_map
,
96
const
Teuchos::RCP<const EpetraExt::MultiComm>&
product_comm
,
97
Epetra_DataAccess
CV,
98
const
Epetra_MultiVector
& block_vector) :
99
ProductContainer
<
Epetra_MultiVector
>(block_map),
100
VectorOrthogPoly
<
Epetra_MultiVector
>(
basis
, block_map),
101
ProductEpetraMultiVector
(block_map,
coeff_map
,
product_map
,
product_comm
, CV,
102
block_vector)
103
{
104
}
105
106
Stokhos::EpetraMultiVectorOrthogPoly::
107
EpetraMultiVectorOrthogPoly
(
const
Stokhos::EpetraMultiVectorOrthogPoly
& v) :
108
ProductContainer
<
Epetra_MultiVector
>(v),
109
VectorOrthogPoly
<
Epetra_MultiVector
>(v),
110
ProductEpetraMultiVector
(v)
111
{
112
}
113
114
Stokhos::EpetraMultiVectorOrthogPoly::
115
~EpetraMultiVectorOrthogPoly
() {}
116
117
Stokhos::EpetraMultiVectorOrthogPoly
&
118
Stokhos::EpetraMultiVectorOrthogPoly::
119
operator=
(
const
Stokhos::EpetraMultiVectorOrthogPoly
& v) {
120
ProductEpetraMultiVector::operator=
(v);
121
this->
basis_
= v.
basis_
;
122
return
*
this
;
123
}
124
125
void
126
Stokhos::EpetraMultiVectorOrthogPoly::
127
reset
(
128
const
Teuchos::RCP<
const
Stokhos::OrthogPolyBasis<int, double>
>& new_basis,
129
const
Teuchos::RCP<const Epetra_BlockMap>& block_map,
130
const
Teuchos::RCP<const Epetra_BlockMap>&
coeff_map
,
131
const
Teuchos::RCP<const EpetraExt::MultiComm>&
product_comm
,
132
int
num_vectors)
133
{
134
ProductEpetraMultiVector::reset
(block_map,
coeff_map
,
product_comm
,
135
num_vectors);
136
this->
basis_
= new_basis;
137
}
138
139
void
140
Stokhos::EpetraMultiVectorOrthogPoly::
141
reset
(
142
const
Teuchos::RCP<
const
Stokhos::OrthogPolyBasis<int, double>
>& new_basis,
143
const
Teuchos::RCP<const Epetra_BlockMap>& block_map,
144
const
Teuchos::RCP<const Epetra_BlockMap>&
coeff_map
,
145
const
Teuchos::RCP<const Epetra_BlockMap>&
product_map
,
146
const
Teuchos::RCP<const EpetraExt::MultiComm>&
product_comm
,
147
int
num_vectors)
148
{
149
ProductEpetraMultiVector::reset
(block_map,
coeff_map
,
product_map
,
150
product_comm
, num_vectors);
151
this->
basis_
= new_basis;
152
}
153
154
void
155
Stokhos::EpetraMultiVectorOrthogPoly::
156
computeMean
(
Epetra_MultiVector
& v)
const
157
{
158
int
lid = this->
map_
->LID(0);
159
v.
Scale
(1.0, *(this->
coeff_
[lid]));
160
}
161
162
void
163
Stokhos::EpetraMultiVectorOrthogPoly::
164
computeVariance
(
Epetra_MultiVector
& v)
const
165
{
166
const
Teuchos::Array<double>& nrm2 = this->
basis_
->norm_squared();
167
v.
PutScalar
(0.0);
168
int
i_gid;
169
for
(
int
i=1; i<this->
size
(); i++) {
170
i_gid = this->
map_
->GID(i);
171
v.
Multiply
(nrm2[i_gid], *(this->
coeff_
[i]), *(this->
coeff_
[i]), 1.0);
172
}
173
}
174
175
void
176
Stokhos::EpetraMultiVectorOrthogPoly::
177
computeStandardDeviation
(
Epetra_MultiVector
& v)
const
178
{
179
computeVariance
(v);
180
181
for
(
int
j
=0;
j
<v.
NumVectors
();
j
++)
182
for
(
int
i=0; i<v.
MyLength
(); i++)
183
v[
j
][i] = std::sqrt(v[
j
][i]);
184
}
Epetra_DataAccess
Epetra_DataAccess
j
j
Definition
Sacado_Fad_Exp_MP_Vector.hpp:527
Stokhos_EpetraMultiVectorOrthogPoly.hpp
Epetra_MultiVector
Epetra_MultiVector::Scale
int Scale(double ScalarValue)
Epetra_MultiVector::NumVectors
int NumVectors() const
Epetra_MultiVector::MyLength
int MyLength() const
Epetra_MultiVector::Multiply
int Multiply(char TransA, char TransB, double ScalarAB, const Epetra_MultiVector &A, const Epetra_MultiVector &B, double ScalarThis)
Epetra_MultiVector::PutScalar
int PutScalar(double ScalarConstant)
Stokhos::EpetraMultiVectorOrthogPoly
A container class storing an orthogonal polynomial whose coefficients are vectors,...
Definition
Stokhos_EpetraMultiVectorOrthogPoly.hpp:57
Stokhos::EpetraMultiVectorOrthogPoly::computeStandardDeviation
void computeStandardDeviation(Epetra_MultiVector &v) const
Compute standard deviation.
Definition
Stokhos_EpetraMultiVectorOrthogPoly.cpp:177
Stokhos::EpetraMultiVectorOrthogPoly::operator=
EpetraMultiVectorOrthogPoly & operator=(const EpetraMultiVectorOrthogPoly &v)
Assignment.
Definition
Stokhos_EpetraMultiVectorOrthogPoly.cpp:119
Stokhos::EpetraMultiVectorOrthogPoly::computeMean
void computeMean(Epetra_MultiVector &v) const
Compute mean.
Definition
Stokhos_EpetraMultiVectorOrthogPoly.cpp:156
Stokhos::EpetraMultiVectorOrthogPoly::~EpetraMultiVectorOrthogPoly
virtual ~EpetraMultiVectorOrthogPoly()
Destructor.
Definition
Stokhos_EpetraMultiVectorOrthogPoly.cpp:115
Stokhos::EpetraMultiVectorOrthogPoly::reset
void reset(const Teuchos::RCP< const Stokhos::OrthogPolyBasis< int, double > > &basis, const Teuchos::RCP< const Epetra_BlockMap > &block_map, const Teuchos::RCP< const Epetra_BlockMap > &coeff_map, const Teuchos::RCP< const EpetraExt::MultiComm > &product_comm, int num_vectors)
Reset to a new basis.
Definition
Stokhos_EpetraMultiVectorOrthogPoly.cpp:127
Stokhos::EpetraMultiVectorOrthogPoly::computeVariance
void computeVariance(Epetra_MultiVector &v) const
Compute variance.
Definition
Stokhos_EpetraMultiVectorOrthogPoly.cpp:164
Stokhos::EpetraMultiVectorOrthogPoly::EpetraMultiVectorOrthogPoly
EpetraMultiVectorOrthogPoly()
Constructor with no basis.
Definition
Stokhos_EpetraMultiVectorOrthogPoly.cpp:45
Stokhos::OrthogPolyBasis
Abstract base class for multivariate orthogonal polynomials.
Definition
Stokhos_OrthogPolyBasis.hpp:74
Stokhos::ProductContainer
A product (in the mathematical sense) container class whose coefficients are vectors,...
Definition
Stokhos_ProductContainer.hpp:61
Stokhos::ProductContainer< Epetra_MultiVector >::coeff_
Teuchos::Array< Teuchos::RCP< Epetra_MultiVector > > coeff_
Definition
Stokhos_ProductContainer.hpp:179
Stokhos::ProductContainer< Epetra_MultiVector >::size
ordinal_type size() const
Definition
Stokhos_ProductContainerImp.hpp:139
Stokhos::ProductContainer< Epetra_MultiVector >::map_
Teuchos::RCP< const Epetra_BlockMap > map_
Definition
Stokhos_ProductContainer.hpp:176
Stokhos::ProductEpetraMultiVector::coeff_map
Teuchos::RCP< const Epetra_BlockMap > coeff_map
Product map of block vector.
Definition
Stokhos_ProductEpetraMultiVector.hpp:190
Stokhos::ProductEpetraMultiVector::product_map
Teuchos::RCP< const Epetra_BlockMap > product_map
Product map of block vector.
Definition
Stokhos_ProductEpetraMultiVector.hpp:196
Stokhos::ProductEpetraMultiVector::product_comm
Teuchos::RCP< const EpetraExt::MultiComm > product_comm
Product multi-level communicator.
Definition
Stokhos_ProductEpetraMultiVector.hpp:193
Stokhos::ProductEpetraMultiVector::operator=
ProductEpetraMultiVector & operator=(const ProductEpetraMultiVector &v)
Assignment.
Definition
Stokhos_ProductEpetraMultiVector.cpp:127
Stokhos::ProductEpetraMultiVector::reset
void reset(const Teuchos::RCP< const Epetra_BlockMap > &block_map, const Teuchos::RCP< const Epetra_BlockMap > &coeff_map, const Teuchos::RCP< const EpetraExt::MultiComm > &product_comm, int num_vectors)
Reset to a new size.
Definition
Stokhos_ProductEpetraMultiVector.cpp:211
Stokhos::ProductEpetraMultiVector::ProductEpetraMultiVector
ProductEpetraMultiVector()
Default constructor.
Definition
Stokhos_ProductEpetraMultiVector.cpp:47
Stokhos::VectorOrthogPoly< Epetra_MultiVector >::basis
Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > basis() const
Definition
Stokhos_VectorOrthogPolyImp.hpp:114
Stokhos::VectorOrthogPoly< Epetra_MultiVector >::basis_
Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > basis_
Definition
Stokhos_VectorOrthogPoly.hpp:148
Stokhos::VectorOrthogPoly< Epetra_MultiVector >::VectorOrthogPoly
VectorOrthogPoly()
Definition
Stokhos_VectorOrthogPolyImp.hpp:46
Generated by
1.17.0