EpetraExt Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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
Teuchos::RCP< Epetra_FEVector > Ny_
Teuchos::RCP< Epetra_FECrsMatrix > getR()
Teuchos::RCP< Epetra_FEVector > getq()
Teuchos::RCP< const Epetra_Comm > commptr_
Teuchos::RCP< Epetra_FEVector > b_
Right-hand side of the PDE.
Teuchos::RCP< const Epetra_IntSerialDenseVector > getpindx()
double beta_
Regularization parameter.
void PrintVec(const Teuchos::RCP< const Epetra_Vector > &x)
Outputs the solution vector to files.
Epetra_SerialDenseMatrix NNw
Teuchos::RCP< const Epetra_IntSerialDenseMatrix > gett()
void computeNpy(const Teuchos::RCP< const Epetra_MultiVector > &y)
Calls the function that computes the Jacobian of the nonlinear term.
Epetra_SerialDenseMatrix Nx2
Epetra_SerialDenseMatrix * NdNdx2Nw
Teuchos::RCP< Epetra_CrsMatrix > Augmat_
Augmented system matrix: [ I Jac* ] [Jac 0 ].
Epetra_SerialDenseMatrix S3
void computeNy(const Teuchos::RCP< const Epetra_MultiVector > &y)
Calls the function that computes the nonlinear term.
Epetra_SerialDenseVector Weights
Teuchos::RCP< Epetra_FECrsMatrix > A_
Volume stiffness matrix.
Epetra_SerialDenseMatrix S1
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)
Teuchos::RCP< const Epetra_IntSerialDenseMatrix > gete()
Provides the interface to generic abstract vector libraries.
void Print(std::ostream &os) const
Teuchos::RCP< Epetra_FECrsMatrix > getNpy()
Teuchos::RCP< Epetra_IntSerialDenseMatrix > t_
Elements (this includes all overlapping nodes).
Teuchos::RCP< Epetra_SerialDenseMatrix > pcoords_
Coordinates of all nodes in this subdomain.
Provides the interface to a generic data pool.
Epetra_SerialDenseMatrix S2
Epetra_SerialDenseMatrix * NdNdx1Nw
Teuchos::RCP< Epetra_FECrsMatrix > Npy_
Jacobian of the nonlinear term.
Teuchos::RCP< Epetra_FECrsMatrix > R_
Edge mass matrix.
void computeAugmat()
Assembles the augmented system (KKT-type) matrix.
Teuchos::RCP< const Epetra_SerialDenseMatrix > getpcoords()
Teuchos::RCP< Epetra_FECrsMatrix > B_
Control/state mass matrix.
const double tol
Teuchos::RCP< Epetra_SerialDenseMatrix > ipcoords_
Coordinates of nodes that are unique to this subdomain.
Teuchos::RCP< const Epetra_IntSerialDenseVector > getipindx()
Teuchos::RCP< Epetra_FECrsMatrix > getH()
Teuchos::RCP< const Epetra_SerialDenseMatrix > getipcoords()
void computeAll(const GenSQP::Vector &x)
Calls functions to compute nonlinear quantities and the augmented system matrix.
Teuchos::RCP< Epetra_FECrsMatrix > getB()
Teuchos::RCP< Epetra_FEVector > q_
The desired state.
Teuchos::RCP< Epetra_FECrsMatrix > getA()
Epetra_SerialDenseMatrix Nodes
Teuchos::RCP< Epetra_IntSerialDenseVector > pindx_
Global nodes (interior + shared, overlapping) in this subdomain.
Teuchos::RCP< Epetra_MultiVector > B_bar_
Basis matrix for p_bar=B*p.
Teuchos::RCP< Epetra_CrsMatrix > getAugmat()
Epetra_SerialDenseMatrix Nx1
Epetra_SerialDenseVector Nw
Epetra_SerialDenseMatrix * NNNw
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< Epetra_FEVector > getNy()
Teuchos::RCP< const Epetra_Comm > getCommPtr()
Epetra_SerialDenseMatrix N
Teuchos::RCP< Epetra_FEVector > getb()
Teuchos::RCP< Epetra_IntSerialDenseMatrix > e_
Edges.
Teuchos::RCP< Epetra_IntSerialDenseVector > ipindx_
Global nodes (interior, nonoverlapping) in this subdomain.
Teuchos::RCP< Epetra_FECrsMatrix > H_
Volume mass matrix.