EpetraExt Package Browser (Single Doxygen Collection)  Development
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"
58 #include "Epetra_LinearProblem.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 
75 namespace GLpApp {
76 
78 {
79 public:
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 
104  double tol );
105 
107 
114 
118 
121 
124 
126  void computeAugmat();
127 
134 
135  double getbeta();
136 
139 
140 private:
141 
143 
156 
165 
168 
174 
177 
182 
184 
186  double beta_;
187 
188 };
189 
190 class Usr_Par {
191 public:
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
GLpApp::GLpYUEpetraDataPool::getbeta
double getbeta()
Definition: GLpApp_GLpYUEpetraDataPool.cpp:515
GLpApp
Definition: GLpApp_AdvDiffReactOptModel.cpp:93
GLpApp::GLpYUEpetraDataPool::Augmat_
Teuchos::RCP< Epetra_CrsMatrix > Augmat_
Augmented system matrix: [ I Jac* ] [Jac 0 ].
Definition: GLpApp_GLpYUEpetraDataPool.hpp:173
Epetra_SerialDenseVector
Epetra_IntSerialDenseVector.h
GLpApp::GLpYUEpetraDataPool::getq
Teuchos::RCP< Epetra_FEVector > getq()
Definition: GLpApp_GLpYUEpetraDataPool.cpp:511
GLpApp::GLpYUEpetraDataPool::e_
Teuchos::RCP< Epetra_IntSerialDenseMatrix > e_
Edges.
Definition: GLpApp_GLpYUEpetraDataPool.hpp:155
GLpApp::GLpYUEpetraDataPool::computeNy
void computeNy(const Teuchos::RCP< const Epetra_MultiVector > &y)
Calls the function that computes the nonlinear term.
Definition: GLpApp_GLpYUEpetraDataPool.cpp:530
GLpApp::Usr_Par::Nx1
Epetra_SerialDenseMatrix Nx1
Definition: GLpApp_GLpYUEpetraDataPool.hpp:200
GLpApp::Usr_Par::Usr_Par
Usr_Par()
Definition: GLpApp_GLpYUEpetraDataPool.cpp:687
Epetra_SerialDenseVector.h
GLpApp::GLpYUEpetraDataPool::getpindx
Teuchos::RCP< const Epetra_IntSerialDenseVector > getpindx()
Definition: GLpApp_GLpYUEpetraDataPool.cpp:523
GLpApp::Usr_Par::~Usr_Par
~Usr_Par()
Definition: GLpApp_GLpYUEpetraDataPool.hpp:218
GLpApp::GLpYUEpetraDataPool::getR
Teuchos::RCP< Epetra_FECrsMatrix > getR()
Definition: GLpApp_GLpYUEpetraDataPool.cpp:503
GLpApp::GLpYUEpetraDataPool::GLpYUEpetraDataPool
GLpYUEpetraDataPool(Teuchos::RCP< const Epetra_Comm > const &commptr, const double beta, const double len_x, const double len_y, const int local_nx, const int local_ny, const char myfile[], const bool trace)
Definition: GLpApp_GLpYUEpetraDataPool.cpp:225
GLpApp::GLpYUEpetraDataPool::gett
Teuchos::RCP< const Epetra_IntSerialDenseMatrix > gett()
Definition: GLpApp_GLpYUEpetraDataPool.cpp:525
GLpApp::GLpYUEpetraDataPool::A_
Teuchos::RCP< Epetra_FECrsMatrix > A_
Volume stiffness matrix.
Definition: GLpApp_GLpYUEpetraDataPool.hpp:158
GLpApp::GLpYUEpetraDataPool::gete
Teuchos::RCP< const Epetra_IntSerialDenseMatrix > gete()
Definition: GLpApp_GLpYUEpetraDataPool.cpp:527
GLpApp::Usr_Par::Nw
Epetra_SerialDenseVector Nw
Definition: GLpApp_GLpYUEpetraDataPool.hpp:208
GLpApp::Usr_Par::NNNw
Epetra_SerialDenseMatrix * NNNw
Definition: GLpApp_GLpYUEpetraDataPool.hpp:212
GLpApp::Usr_Par::N
Epetra_SerialDenseMatrix N
Definition: GLpApp_GLpYUEpetraDataPool.hpp:198
Epetra_CrsMatrix.h
GLpApp::GLpYUEpetraDataPool::getNpy
Teuchos::RCP< Epetra_FECrsMatrix > getNpy()
Definition: GLpApp_GLpYUEpetraDataPool.cpp:507
GLpApp::Usr_Par::NdNdx2Nw
Epetra_SerialDenseMatrix * NdNdx2Nw
Definition: GLpApp_GLpYUEpetraDataPool.hpp:216
GLpApp::GLpYUEpetraDataPool::computeAugmat
void computeAugmat()
Assembles the augmented system (KKT-type) matrix.
Definition: GLpApp_GLpYUEpetraDataPool.cpp:552
GLpApp::GLpYUEpetraDataPool::getpcoords
Teuchos::RCP< const Epetra_SerialDenseMatrix > getpcoords()
Definition: GLpApp_GLpYUEpetraDataPool.cpp:521
Epetra_Vector.h
GenSQP_YUEpetraVector.hpp
GLpApp::GLpYUEpetraDataPool
Definition: GLpApp_GLpYUEpetraDataPool.hpp:77
GLpApp::GLpYUEpetraDataPool::B_
Teuchos::RCP< Epetra_FECrsMatrix > B_
Control/state mass matrix.
Definition: GLpApp_GLpYUEpetraDataPool.hpp:160
Epetra_SerialComm.h
Epetra_LinearProblem.h
Teuchos::RCP< const Epetra_Comm >
Epetra_FECrsMatrix.h
Epetra_MpiComm.h
GLpApp::GLpYUEpetraDataPool::t_
Teuchos::RCP< Epetra_IntSerialDenseMatrix > t_
Elements (this includes all overlapping nodes).
Definition: GLpApp_GLpYUEpetraDataPool.hpp:153
GLpApp::GLpYUEpetraDataPool::pcoords_
Teuchos::RCP< Epetra_SerialDenseMatrix > pcoords_
Coordinates of all nodes in this subdomain.
Definition: GLpApp_GLpYUEpetraDataPool.hpp:149
GenSQP_DataPool.hpp
GLpApp::Usr_Par::Nodes
Epetra_SerialDenseMatrix Nodes
Definition: GLpApp_GLpYUEpetraDataPool.hpp:195
GenSQP::DataPool
Provides the interface to a generic data pool.
Definition: GenSQP_DataPool.hpp:59
GLpApp::GLpYUEpetraDataPool::getipindx
Teuchos::RCP< const Epetra_IntSerialDenseVector > getipindx()
Definition: GLpApp_GLpYUEpetraDataPool.cpp:519
Epetra_LAPACK.h
GLpApp::GLpYUEpetraDataPool::getH
Teuchos::RCP< Epetra_FECrsMatrix > getH()
Definition: GLpApp_GLpYUEpetraDataPool.cpp:501
GLpApp::GLpYUEpetraDataPool::computeAll
void computeAll(const GenSQP::Vector &x)
Calls functions to compute nonlinear quantities and the augmented system matrix.
Definition: GLpApp_GLpYUEpetraDataPool.cpp:277
GLpApp::GLpYUEpetraDataPool::R_
Teuchos::RCP< Epetra_FECrsMatrix > R_
Edge mass matrix.
Definition: GLpApp_GLpYUEpetraDataPool.hpp:164
GLpApp::GLpYUEpetraDataPool::q_
Teuchos::RCP< Epetra_FEVector > q_
The desired state.
Definition: GLpApp_GLpYUEpetraDataPool.hpp:181
GLpApp::Usr_Par::S1
Epetra_SerialDenseMatrix S1
Definition: GLpApp_GLpYUEpetraDataPool.hpp:204
EpetraExt::tol
const double tol
Definition: hypre_UnitTest.cpp:72
Epetra_Export.h
GLpApp::GLpYUEpetraDataPool::Npy_
Teuchos::RCP< Epetra_FECrsMatrix > Npy_
Jacobian of the nonlinear term.
Definition: GLpApp_GLpYUEpetraDataPool.hpp:176
GLpApp::Usr_Par::NNw
Epetra_SerialDenseMatrix NNw
Definition: GLpApp_GLpYUEpetraDataPool.hpp:210
GLpApp::GLpYUEpetraDataPool::ipcoords_
Teuchos::RCP< Epetra_SerialDenseMatrix > ipcoords_
Coordinates of nodes that are unique to this subdomain.
Definition: GLpApp_GLpYUEpetraDataPool.hpp:145
Epetra_FEVector.h
Epetra_SerialDenseMatrix.h
Epetra_Import.h
GLpApp::GLpYUEpetraDataPool::getipcoords
Teuchos::RCP< const Epetra_SerialDenseMatrix > getipcoords()
Definition: GLpApp_GLpYUEpetraDataPool.cpp:517
GLpApp::Usr_Par::Print
void Print(std::ostream &os) const
Definition: GLpApp_GLpYUEpetraDataPool.cpp:783
GLpApp::Usr_Par::S2
Epetra_SerialDenseMatrix S2
Definition: GLpApp_GLpYUEpetraDataPool.hpp:205
GLpApp::Usr_Par::S3
Epetra_SerialDenseMatrix S3
Definition: GLpApp_GLpYUEpetraDataPool.hpp:206
GLpApp::GLpYUEpetraDataPool::getNy
Teuchos::RCP< Epetra_FEVector > getNy()
Definition: GLpApp_GLpYUEpetraDataPool.cpp:513
GLpApp::Usr_Par::NdNdx1Nw
Epetra_SerialDenseMatrix * NdNdx1Nw
Definition: GLpApp_GLpYUEpetraDataPool.hpp:214
GLpApp::Usr_Par::Weights
Epetra_SerialDenseVector Weights
Definition: GLpApp_GLpYUEpetraDataPool.hpp:196
GenSQP::Vector
Provides the interface to generic abstract vector libraries.
Definition: GenSQP_Vector.hpp:62
GLpApp::GLpYUEpetraDataPool::getB
Teuchos::RCP< Epetra_FECrsMatrix > getB()
Definition: GLpApp_GLpYUEpetraDataPool.cpp:499
GLpApp::GLpYUEpetraDataPool::solveAugsys
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.
Definition: GLpApp_GLpYUEpetraDataPool.cpp:292
GLpApp::GLpYUEpetraDataPool::pindx_
Teuchos::RCP< Epetra_IntSerialDenseVector > pindx_
Global nodes (interior + shared, overlapping) in this subdomain.
Definition: GLpApp_GLpYUEpetraDataPool.hpp:151
GLpApp::GLpYUEpetraDataPool::getA
Teuchos::RCP< Epetra_FECrsMatrix > getA()
Definition: GLpApp_GLpYUEpetraDataPool.cpp:497
GLpApp::GLpYUEpetraDataPool::getAugmat
Teuchos::RCP< Epetra_CrsMatrix > getAugmat()
Definition: GLpApp_GLpYUEpetraDataPool.cpp:505
Epetra_Map.h
GLpApp::GLpYUEpetraDataPool::H_
Teuchos::RCP< Epetra_FECrsMatrix > H_
Volume mass matrix.
Definition: GLpApp_GLpYUEpetraDataPool.hpp:162
GLpApp::Usr_Par
Definition: GLpApp_GLpYUEpetraDataPool.hpp:190
GLpApp::GLpYUEpetraDataPool::Ny_
Teuchos::RCP< Epetra_FEVector > Ny_
Definition: GLpApp_GLpYUEpetraDataPool.hpp:183
GLpApp::GLpYUEpetraDataPool::getb
Teuchos::RCP< Epetra_FEVector > getb()
Definition: GLpApp_GLpYUEpetraDataPool.cpp:509
GLpApp::GLpYUEpetraDataPool::B_bar_
Teuchos::RCP< Epetra_MultiVector > B_bar_
Basis matrix for p_bar=B*p.
Definition: GLpApp_GLpYUEpetraDataPool.hpp:167
GLpApp::GLpYUEpetraDataPool::b_
Teuchos::RCP< Epetra_FEVector > b_
Right-hand side of the PDE.
Definition: GLpApp_GLpYUEpetraDataPool.hpp:179
GLpApp::GLpYUEpetraDataPool::ipindx_
Teuchos::RCP< Epetra_IntSerialDenseVector > ipindx_
Global nodes (interior, nonoverlapping) in this subdomain.
Definition: GLpApp_GLpYUEpetraDataPool.hpp:147
GLpApp::GLpYUEpetraDataPool::beta_
double beta_
Regularization parameter.
Definition: GLpApp_GLpYUEpetraDataPool.hpp:186
Epetra_SerialDenseMatrix
GLpApp::GLpYUEpetraDataPool::PrintVec
void PrintVec(const Teuchos::RCP< const Epetra_Vector > &x)
Outputs the solution vector to files.
Definition: GLpApp_GLpYUEpetraDataPool.cpp:682
Epetra_MultiVector.h
GLpApp::Usr_Par::Nx2
Epetra_SerialDenseMatrix Nx2
Definition: GLpApp_GLpYUEpetraDataPool.hpp:202
GLpApp::GLpYUEpetraDataPool::getCommPtr
Teuchos::RCP< const Epetra_Comm > getCommPtr()
Definition: GLpApp_GLpYUEpetraDataPool.cpp:495
GLpApp::GLpYUEpetraDataPool::commptr_
Teuchos::RCP< const Epetra_Comm > commptr_
Definition: GLpApp_GLpYUEpetraDataPool.hpp:142
GLpApp::GLpYUEpetraDataPool::computeNpy
void computeNpy(const Teuchos::RCP< const Epetra_MultiVector > &y)
Calls the function that computes the Jacobian of the nonlinear term.
Definition: GLpApp_GLpYUEpetraDataPool.cpp:541