Stokhos Package Browser (Single Doxygen Collection)
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
example
epetra
epetra/SimpleME.hpp
Go to the documentation of this file.
1
// $Id$
2
// $Source$
3
// @HEADER
4
// ***********************************************************************
5
//
6
// Stokhos Package
7
// Copyright (2009) Sandia Corporation
8
//
9
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
10
// license for use of this work by or on behalf of the U.S. Government.
11
//
12
// Redistribution and use in source and binary forms, with or without
13
// modification, are permitted provided that the following conditions are
14
// met:
15
//
16
// 1. Redistributions of source code must retain the above copyright
17
// notice, this list of conditions and the following disclaimer.
18
//
19
// 2. Redistributions in binary form must reproduce the above copyright
20
// notice, this list of conditions and the following disclaimer in the
21
// documentation and/or other materials provided with the distribution.
22
//
23
// 3. Neither the name of the Corporation nor the names of the
24
// contributors may be used to endorse or promote products derived from
25
// this software without specific prior written permission.
26
//
27
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
28
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
31
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
32
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
33
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
34
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
35
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
36
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
//
39
// Questions? Contact Eric T. Phipps (etphipp@sandia.gov).
40
//
41
// ***********************************************************************
42
// @HEADER
43
44
#ifndef SIMPLE_ME_HPP
45
#define SIMPLE_ME_HPP
46
47
#include "Teuchos_RCP.hpp"
48
#include "Teuchos_Array.hpp"
49
50
#include "EpetraExt_ModelEvaluator.h"
51
52
#include "
Epetra_Map.h
"
53
#include "
Epetra_LocalMap.h
"
54
#include "
Epetra_Import.h
"
55
#include "
Epetra_CrsGraph.h
"
56
#include "
Epetra_CrsMatrix.h
"
57
58
/* Simple model evaluator demonstrating how to use the Stokhos
59
* ModelEvaluator to solve a nonlinear stochastic Galerkin problem.
60
* It represents the simple function
61
*
62
* f(x,a) = | a^2 - x_0 |
63
* | x_1^2 - x_0 |
64
*
65
* where x = [x_0 x_1]^T and a is a parameter. It has a root at x = [ a^2, a].
66
* The parameter a may be represented by a given polynomial chaos expansion,
67
* and the corresponding expansion for x computed by Stokhos.
68
*/
69
class
SimpleME
:
public
EpetraExt::ModelEvaluator {
70
public
:
71
73
SimpleME
(
const
Teuchos::RCP<const Epetra_Comm>& comm);
74
77
79
Teuchos::RCP<const Epetra_Map>
get_x_map
()
const
;
80
82
Teuchos::RCP<const Epetra_Map>
get_f_map
()
const
;
83
85
Teuchos::RCP<const Epetra_Map>
get_p_map
(
int
l)
const
;
86
88
Teuchos::RCP<const Teuchos::Array<std::string> >
89
get_p_names
(
int
l)
const
;
90
92
Teuchos::RCP<const Epetra_Vector>
get_x_init
()
const
;
93
95
Teuchos::RCP<const Epetra_Vector>
get_p_init
(
int
l)
const
;
96
98
Teuchos::RCP<Epetra_Operator>
create_W
()
const
;
99
101
InArgs
createInArgs
()
const
;
102
104
OutArgs
createOutArgs
()
const
;
105
107
void
evalModel
(
const
InArgs& inArgs,
const
OutArgs& outArgs)
const
;
108
110
111
protected
:
112
114
Teuchos::RCP<Epetra_Map>
x_map
;
115
117
Teuchos::RCP<Epetra_Map>
x_overlapped_map
;
118
120
Teuchos::RCP<Epetra_Import>
importer
;
121
123
Teuchos::RCP<Epetra_Vector>
x_init
;
124
126
Teuchos::RCP<Epetra_Vector>
x_overlapped
;
127
129
Teuchos::RCP<Epetra_Map>
p_map
;
130
132
Teuchos::RCP<Epetra_Vector>
p_init
;
133
135
Teuchos::RCP< Teuchos::Array<std::string> >
p_names
;
136
138
Teuchos::RCP<Epetra_CrsGraph>
graph
;
139
140
};
141
142
#endif
// SIMPLE_ME_HPP
Epetra_CrsGraph.h
Epetra_CrsMatrix.h
Epetra_Import.h
Epetra_LocalMap.h
Epetra_Map.h
SimpleME::importer
Teuchos::RCP< Epetra_Import > importer
Importer to overlapped distribution.
Definition
epetra/SimpleME.hpp:120
SimpleME::p_names
Teuchos::RCP< Teuchos::Array< std::string > > p_names
Parameter names.
Definition
epetra/SimpleME.hpp:135
SimpleME::createOutArgs
OutArgs createOutArgs() const
Create OutArgs.
Definition
epetra/SimpleME.cpp:176
SimpleME::createInArgs
InArgs createInArgs() const
Create InArgs.
Definition
epetra/SimpleME.cpp:156
SimpleME::get_p_init
Teuchos::RCP< const Epetra_Vector > get_p_init(int l) const
Return initial parameters.
Definition
epetra/SimpleME.cpp:134
SimpleME::create_W
Teuchos::RCP< Epetra_Operator > create_W() const
Create W = alpha*M + beta*J matrix.
Definition
epetra/SimpleME.cpp:146
SimpleME::graph
Teuchos::RCP< Epetra_CrsGraph > graph
Jacobian graph.
Definition
epetra/SimpleME.hpp:138
SimpleME::evalModel
void evalModel(const InArgs &inArgs, const OutArgs &outArgs) const
Evaluate model on InArgs.
Definition
epetra/SimpleME.cpp:194
SimpleME::x_map
Teuchos::RCP< Epetra_Map > x_map
Solution vector map.
Definition
epetra/SimpleME.hpp:114
SimpleME::p_init
Teuchos::RCP< Epetra_Vector > p_init
Initial parameters.
Definition
epetra/SimpleME.hpp:132
SimpleME::x_init
Teuchos::RCP< Epetra_Vector > x_init
Initial guess.
Definition
epetra/SimpleME.hpp:123
SimpleME::x_overlapped_map
Teuchos::RCP< Epetra_Map > x_overlapped_map
Overlapped solution vector map.
Definition
epetra/SimpleME.hpp:117
SimpleME::x_overlapped
Teuchos::RCP< Epetra_Vector > x_overlapped
Overlapped solution vector.
Definition
epetra/SimpleME.hpp:126
SimpleME::get_p_names
Teuchos::RCP< const Teuchos::Array< std::string > > get_p_names(int l) const
Return array of parameter names.
Definition
epetra/SimpleME.cpp:116
SimpleME::get_x_init
Teuchos::RCP< const Epetra_Vector > get_x_init() const
Return initial solution.
Definition
epetra/SimpleME.cpp:128
SimpleME::get_f_map
Teuchos::RCP< const Epetra_Map > get_f_map() const
Return residual vector map.
Definition
epetra/SimpleME.cpp:98
SimpleME::p_map
Teuchos::RCP< Epetra_Map > p_map
Parameter vector map.
Definition
epetra/SimpleME.hpp:129
SimpleME::get_p_map
Teuchos::RCP< const Epetra_Map > get_p_map(int l) const
Return parameter vector map.
Definition
epetra/SimpleME.cpp:104
SimpleME::get_x_map
Teuchos::RCP< const Epetra_Map > get_x_map() const
Return solution vector map.
Definition
epetra/SimpleME.cpp:92
SimpleME::SimpleME
SimpleME(const Teuchos::RCP< const Epetra_Comm > &comm)
Constructor.
Definition
epetra/SimpleME.cpp:48
Generated by
1.17.0