EpetraExt Package Browser (Single Doxygen Collection) Development
Loading...
Searching...
No Matches
GLpApp_GLpYUEpetraDataPool.hpp
Go to the documentation of this file.
1/*
2//@HEADER
3// ***********************************************************************
4//
5// EpetraExt: Epetra Extended - Linear Algebra Services Package
6// Copyright (2011) Sandia Corporation
7//
8// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9// the U.S. Government retains certain rights in this software.
10//
11// Redistribution and use in source and binary forms, with or without
12// modification, are permitted provided that the following conditions are
13// met:
14//
15// 1. Redistributions of source code must retain the above copyright
16// notice, this list of conditions and the following disclaimer.
17//
18// 2. Redistributions in binary form must reproduce the above copyright
19// notice, this list of conditions and the following disclaimer in the
20// documentation and/or other materials provided with the distribution.
21//
22// 3. Neither the name of the Corporation nor the names of the
23// contributors may be used to endorse or promote products derived from
24// this software without specific prior written permission.
25//
26// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37//
38// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
39//
40// ***********************************************************************
41//@HEADER
42*/
43
44#ifndef GLPAPP_GLPYUEPETRADATAPOOL_H
45#define GLPAPP_GLPYUEPETRADATAPOOL_H
46
47//#include "Epetra_config.h"
48
49#include <iostream>
50
51#include "Epetra_Map.h"
52#include "Epetra_MultiVector.h"
53#include "Epetra_Vector.h"
54#include "Epetra_Import.h"
55#include "Epetra_Export.h"
56#include "Epetra_CrsMatrix.h"
57#include "Epetra_FECrsMatrix.h"
59#include "Epetra_LAPACK.h"
60#include "Epetra_FEVector.h"
64#include "GenSQP_DataPool.hpp"
68
69#ifdef HAVE_MPI
70# include "Epetra_MpiComm.h"
71#else
72# include "Epetra_SerialComm.h"
73#endif
74
75namespace GLpApp {
76
78{
79public:
80
82 Teuchos::RCP<const Epetra_Comm> const& commptr
83 ,const double beta
84 ,const double len_x // Ignored if myfile is *not* empty
85 ,const double len_y // Ignored if myfile is *not* empty
86 ,const int local_nx // Ignored if myfile is *not* empty
87 ,const int local_ny // Ignored if myfile is *not* empty
88 ,const char myfile[]
89 ,const bool trace
90 );
91
95 void computeAll( const GenSQP::Vector &x );
96
98 int solveAugsys( const Teuchos::RCP<const Epetra_MultiVector> & rhsy,
99 const Teuchos::RCP<const Epetra_MultiVector> & rhsu,
100 const Teuchos::RCP<const Epetra_MultiVector> & rhsp,
101 const Teuchos::RCP<Epetra_MultiVector> & y,
102 const Teuchos::RCP<Epetra_MultiVector> & u,
103 const Teuchos::RCP<Epetra_MultiVector> & p,
104 double tol );
105
106 Teuchos::RCP<const Epetra_Comm> getCommPtr();
107
108 Teuchos::RCP<Epetra_FECrsMatrix> getA();
109 Teuchos::RCP<Epetra_FECrsMatrix> getB();
110 Teuchos::RCP<Epetra_FECrsMatrix> getH();
111 Teuchos::RCP<Epetra_FECrsMatrix> getR();
112 Teuchos::RCP<Epetra_CrsMatrix> getAugmat();
113 Teuchos::RCP<Epetra_FECrsMatrix> getNpy();
114
115 Teuchos::RCP<Epetra_FEVector> getb();
116 Teuchos::RCP<Epetra_FEVector> getq();
117 Teuchos::RCP<Epetra_FEVector> getNy();
118
120 void computeNy(const Teuchos::RCP<const Epetra_MultiVector> & y);
121
123 void computeNpy(const Teuchos::RCP<const Epetra_MultiVector> & y);
124
126 void computeAugmat();
127
128 Teuchos::RCP<const Epetra_SerialDenseMatrix> getipcoords();
129 Teuchos::RCP<const Epetra_IntSerialDenseVector> getipindx();
130 Teuchos::RCP<const Epetra_SerialDenseMatrix> getpcoords();
131 Teuchos::RCP<const Epetra_IntSerialDenseVector> getpindx();
132 Teuchos::RCP<const Epetra_IntSerialDenseMatrix> gett();
133 Teuchos::RCP<const Epetra_IntSerialDenseMatrix> gete();
134
135 double getbeta();
136
138 void PrintVec( const Teuchos::RCP<const Epetra_Vector> & x );
139
140private:
141
142 Teuchos::RCP<const Epetra_Comm> commptr_;
143
145 Teuchos::RCP<Epetra_SerialDenseMatrix> ipcoords_;
147 Teuchos::RCP<Epetra_IntSerialDenseVector> ipindx_;
149 Teuchos::RCP<Epetra_SerialDenseMatrix> pcoords_;
151 Teuchos::RCP<Epetra_IntSerialDenseVector> pindx_;
153 Teuchos::RCP<Epetra_IntSerialDenseMatrix> t_;
155 Teuchos::RCP<Epetra_IntSerialDenseMatrix> e_;
156
158 Teuchos::RCP<Epetra_FECrsMatrix> A_;
160 Teuchos::RCP<Epetra_FECrsMatrix> B_;
162 Teuchos::RCP<Epetra_FECrsMatrix> H_;
164 Teuchos::RCP<Epetra_FECrsMatrix> R_;
165
167 Teuchos::RCP<Epetra_MultiVector> B_bar_;
168
173 Teuchos::RCP<Epetra_CrsMatrix> Augmat_;
174
176 Teuchos::RCP<Epetra_FECrsMatrix> Npy_;
177
179 Teuchos::RCP<Epetra_FEVector> b_;
181 Teuchos::RCP<Epetra_FEVector> q_;
182
183 Teuchos::RCP<Epetra_FEVector> Ny_;
184
186 double beta_;
187
188};
189
190class Usr_Par {
191public:
192
193 Usr_Par();
194
197
199
201
203
207
209
211
213
215
217
219 delete [] NNNw;
220 delete [] NdNdx1Nw;
221 delete [] NdNdx2Nw;
222 }
223
224 void Print(std::ostream& os) const;
225};
226
227} // namespace GLpApp
228
229#endif // GLPAPP_GLPYUEPETRADATAPOOL_H
Teuchos::RCP< Epetra_FEVector > getNy()
Teuchos::RCP< Epetra_FECrsMatrix > H_
Volume mass matrix.
Teuchos::RCP< Epetra_FECrsMatrix > R_
Edge mass matrix.
Teuchos::RCP< Epetra_FECrsMatrix > getB()
Teuchos::RCP< Epetra_FECrsMatrix > getR()
Teuchos::RCP< Epetra_IntSerialDenseVector > ipindx_
Global nodes (interior, nonoverlapping) in this subdomain.
Teuchos::RCP< const Epetra_SerialDenseMatrix > getpcoords()
Teuchos::RCP< Epetra_SerialDenseMatrix > pcoords_
Coordinates of all nodes in this subdomain.
Teuchos::RCP< Epetra_FEVector > q_
The desired state.
Teuchos::RCP< const Epetra_SerialDenseMatrix > getipcoords()
Teuchos::RCP< const Epetra_IntSerialDenseVector > getipindx()
Teuchos::RCP< Epetra_FEVector > b_
Right-hand side of the PDE.
int solveAugsys(const Teuchos::RCP< const Epetra_MultiVector > &rhsy, const Teuchos::RCP< const Epetra_MultiVector > &rhsu, const Teuchos::RCP< const Epetra_MultiVector > &rhsp, const Teuchos::RCP< Epetra_MultiVector > &y, const Teuchos::RCP< Epetra_MultiVector > &u, const Teuchos::RCP< Epetra_MultiVector > &p, double tol)
Solves augmented system.
Teuchos::RCP< const Epetra_Comm > getCommPtr()
Teuchos::RCP< Epetra_FEVector > Ny_
Teuchos::RCP< Epetra_FEVector > getb()
void computeNy(const Teuchos::RCP< const Epetra_MultiVector > &y)
Calls the function that computes the nonlinear term.
Teuchos::RCP< Epetra_CrsMatrix > Augmat_
Augmented system matrix: [ I Jac* ] [Jac 0 ].
void computeNpy(const Teuchos::RCP< const Epetra_MultiVector > &y)
Calls the function that computes the Jacobian of the nonlinear term.
Teuchos::RCP< const Epetra_IntSerialDenseMatrix > gete()
void computeAll(const GenSQP::Vector &x)
Calls functions to compute nonlinear quantities and the augmented system matrix.
Teuchos::RCP< Epetra_IntSerialDenseMatrix > t_
Elements (this includes all overlapping nodes).
Teuchos::RCP< Epetra_FECrsMatrix > getA()
void PrintVec(const Teuchos::RCP< const Epetra_Vector > &x)
Outputs the solution vector to files.
Teuchos::RCP< Epetra_CrsMatrix > getAugmat()
Teuchos::RCP< Epetra_FECrsMatrix > A_
Volume stiffness matrix.
void computeAugmat()
Assembles the augmented system (KKT-type) matrix.
Teuchos::RCP< Epetra_MultiVector > B_bar_
Basis matrix for p_bar=B*p.
Teuchos::RCP< Epetra_SerialDenseMatrix > ipcoords_
Coordinates of nodes that are unique to this subdomain.
Teuchos::RCP< Epetra_FECrsMatrix > Npy_
Jacobian of the nonlinear term.
Teuchos::RCP< Epetra_IntSerialDenseMatrix > e_
Edges.
Teuchos::RCP< Epetra_FECrsMatrix > getNpy()
Teuchos::RCP< const Epetra_IntSerialDenseMatrix > gett()
Teuchos::RCP< Epetra_FEVector > getq()
Teuchos::RCP< Epetra_IntSerialDenseVector > pindx_
Global nodes (interior + shared, overlapping) in this subdomain.
Teuchos::RCP< Epetra_FECrsMatrix > B_
Control/state mass matrix.
double beta_
Regularization parameter.
Teuchos::RCP< const Epetra_IntSerialDenseVector > getpindx()
Teuchos::RCP< const Epetra_Comm > commptr_
Teuchos::RCP< Epetra_FECrsMatrix > getH()
void Print(std::ostream &os) const
Epetra_SerialDenseMatrix S3
Epetra_SerialDenseMatrix Nodes
Epetra_SerialDenseVector Nw
Epetra_SerialDenseMatrix S2
Epetra_SerialDenseMatrix * NdNdx2Nw
Epetra_SerialDenseMatrix Nx1
Epetra_SerialDenseMatrix * NdNdx1Nw
Epetra_SerialDenseMatrix N
Epetra_SerialDenseMatrix S1
Epetra_SerialDenseMatrix Nx2
Epetra_SerialDenseMatrix * NNNw
Epetra_SerialDenseVector Weights
Epetra_SerialDenseMatrix NNw
Provides the interface to a generic data pool.
Provides the interface to generic abstract vector libraries.