Debian Codegraph @

packages/trilinoscouplings/examples/ml/NonlinML/FiniteElementProblem.H

raw
1 // @HEADER
2 // *****************************************************************************
3 // Trilinos: An Object-Oriented Solver Framework
4 //
5 // Copyright 2001-2024 NTESS and the Trilinos 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 // ml objects
25 #include "ml_common.h"
26 #if defined(HAVE_ML_NOX) && defined(HAVE_ML_EPETRA) && defined(HAVE_ML_AZTECOO) && defined(HAVE_ML_TEUCHOS) && defined(HAVE_ML_IFPACK) && defined(HAVE_ML_AMESOS) && defined(HAVE_ML_EPETRAEXT)
27
28 // Forward Declarations
29 class Epetra_Comm;
30 class Epetra_Map;
31 class Epetra_Vector;
32 class Epetra_Import;
33 class Epetra_CrsGraph;
34 class Epetra_CrsMatrix;
35
36 // Flag to tell the evaluate routine what objects to fill
37 enum FillType {F_ONLY, MATRIX_ONLY, ALL};
38
39 // Finite Element Problem Class
40 class FiniteElementProblem {
41
42 public:
43
44 // Constructor
45 FiniteElementProblem(int NumGlobalElements, Epetra_Comm& Comm);
46
47 // Destructor
48 ~FiniteElementProblem();
49
50 // Evaluates the function (F) and/or the Jacobian using the solution
51 // values in solnVector.
52 bool evaluate(FillType f, const Epetra_Vector *solnVector,
53 Epetra_Vector *rhsVector, Epetra_RowMatrix *matrix);
54
55 // Return a reference to the Epetra_Vector with the initial guess
56 // that is generated by the FiniteElementProblem class.
57 Epetra_Vector& getSolution();
58
59 // Return a reference to the Epetra_Vector with the Jacobian
60 // that is generated by the FiniteElementProblem class.
61 Epetra_CrsMatrix& getJacobian()
62 {return *A;}
63
64 // return a reference to the StandardMap
65 const Epetra_Map& getMap() {return *StandardMap;}
66
67 // return reference to the Graph
68 const Epetra_CrsGraph& getGraph() { return *AA; }
69
70 // return ref to Comm
71 Epetra_Comm& getComm() { return *Comm;}
72
73 // get nullspace
74 double* Get_Nullspace(const int nummyrows, const int numpde, const int dim_nullsp)
75 {
76 return NULL;
77 }
78
79 // get block info
80 bool getblockinfo(int* nblocks, int** blocks, int** block_pde)
81 {
82 *nblocks = 0;
83 *blocks = 0;
84 *block_pde = 0;
85 return false;
86 }
87
88 private:
89
90 // inserts the global column indices into the Graph
91 Epetra_CrsGraph& generateGraph(Epetra_CrsGraph& AA);
92
93 private:
94
95 FillType flag;
96 Epetra_Map *StandardMap;
97 Epetra_Map *OverlapMap;
98 Epetra_Import *Importer;
99 Epetra_Vector *initialSolution;
100 Epetra_Vector *rhs;
101 Epetra_CrsGraph *AA;
102 Epetra_CrsMatrix *A;
103 Epetra_Comm *Comm;
104
105 int MyPID; // Process number
106 int NumProc; // Total number of processes
107 int NumMyElements; // Number of elements owned by this process
108 int NumGlobalElements; // Total Number of elements
109
110 };
111 #endif // defined(HAVE_ML_NOX) && defined(HAVE_ML_EPETRA) && defined(HAVE_ML_AZTECOO)
112 #endif
113
114
115
116