Debian Codegraph @

packages/nox/examples/epetra/NOX_1DFEMNonlinear/FiniteElementProblem.H

raw
1 // @HEADER
2 // *****************************************************************************
3 // NOX: An Object-Oriented Nonlinear Solver Package
4 //
5 // Copyright 2002 NTESS and the NOX contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9
10 // Finite Element Problem Class
11 /* Provides function (F) and Jacobian evaluations for the following equation
12 * via a 1D linear finite element discretization with Epetra objects.
13 *
14 * d2u
15 * --- - k * u**2 = 0
16 * dx2
17 *
18 * subject to @ x=0, u=1
19 */
20
21 #ifndef _NOX_EXAMPLE_EPETRA_NONLINEAR_FINITEELEMENTPROBLEM_H
22 #define _NOX_EXAMPLE_EPETRA_NONLINEAR_FINITEELEMENTPROBLEM_H
23
24 #include "Teuchos_RCP.hpp"
25
26 // Forward Declarations
27 class Epetra_Comm;
28 class Epetra_Map;
29 class Epetra_Vector;
30 class Epetra_Import;
31 class Epetra_CrsGraph;
32 class Epetra_CrsMatrix;
33
34 // Flag to tell the evaluate routine what objects to fill
35 enum FillType {F_ONLY, MATRIX_ONLY, ALL};
36
37 // Finite Element Problem Class
38 class FiniteElementProblem {
39
40 public:
41
42 // Constructor
43 FiniteElementProblem(int NumGlobalElements, Epetra_Comm& Comm);
44
45 // Destructor
46 ~FiniteElementProblem();
47
48 // Evaluates the function (F) and/or the Jacobian using the solution
49 // values in solnVector.
50 bool evaluate(FillType f, const Epetra_Vector *solnVector,
51 Epetra_Vector *rhsVector, Epetra_RowMatrix *matrix);
52
53 // Return a reference to the Epetra_Vector with the initial guess
54 // that is generated by the FiniteElementProblem class.
55 Teuchos::RCP<Epetra_Vector> getSolution();
56
57 // Return a reference to the Epetra_Vector with the Jacobian
58 // that is generated by the FiniteElementProblem class.
59 Teuchos::RCP<Epetra_CrsMatrix> getJacobian();
60
61 private:
62
63 // inserts the global column indices into the Graph
64 Epetra_CrsGraph& generateGraph(Epetra_CrsGraph& AA);
65
66 private:
67
68 FillType flag;
69 Epetra_Map *StandardMap;
70 Epetra_Map *OverlapMap;
71 Epetra_Import *Importer;
72 Teuchos::RCP<Epetra_Vector> initialSolution;
73 Epetra_Vector *rhs;
74 Epetra_CrsGraph *AA;
75 Teuchos::RCP<Epetra_CrsMatrix> A;
76 Epetra_Comm *Comm;
77
78 int MyPID; // Process number
79 int NumProc; // Total number of processes
80 int NumMyElements; // Number of elements owned by this process
81 int NumGlobalElements; // Total Number of elements
82
83 };
84 #endif
85
86
87
88