Debian Codegraph @

packages/nox/test/epetra/FiniteDifferenceColoring/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 // This is needed to get the FillType enum values from NOX_Epetra_Interface
25 #include "NOX_Epetra.H"
26 #include "Teuchos_RCP.hpp"
27
28 // Forward Declarations
29 class Epetra_Comm;
30 class Epetra_Map;
31 class Epetra_IntVector;
32 class Epetra_Vector;
33 class Epetra_Import;
34 class Epetra_CrsGraph;
35 class Epetra_CrsMatrix;
36
37 // Finite Element Problem Class
38 class FiniteElementProblem {
39
40 public:
41
42 // Flag to tell the evaluate routine what objects to fill
43 enum FillType {F_ONLY, MATRIX_ONLY, ALL};
44
45 public:
46
47 // Constructor
48 FiniteElementProblem(int NumGlobalElements, Epetra_Comm& Comm);
49
50 // Destructor
51 ~FiniteElementProblem();
52
53 // Evaluates the function (F) and/or the Jacobian using the solution
54 // values in solnVector.
55 bool evaluate(FillType f, const Epetra_Vector *solnVector,
56 Epetra_Vector *rhsVector, Epetra_RowMatrix *matrix,
57 NOX::Epetra::Interface::Required::FillType fill=NOX::Epetra::Interface::Required::Residual);
58
59 // Return a reference to the Epetra_Vector with the initial guess
60 // that is generated by the FiniteElementProblem class.
61 Teuchos::RCP<Epetra_Vector> getSolution();
62
63 // Return a reference to the Epetra_Vector with the Jacobian
64 // that is generated by the FiniteElementProblem class.
65 Teuchos::RCP<Epetra_CrsMatrix> getJacobian();
66
67 // Return a reference to the Epetra_CrsGraph that is generated by
68 // the FiniteElementProblem class.
69 Teuchos::RCP<Epetra_CrsGraph> getGraph();
70
71 // Return a list of the local ids of non-linear unknowns
72 const int* getNonLinearUnknowns() const{return nonlinearUnknowns;}
73
74 // Return the number of local of non-linear unknowns
75 int NumLocalNonLinearUnknowns() const{return N_nonlinearUnknowns;}
76
77
78 private:
79
80 // inserts the global column indices into the Graph
81 Epetra_CrsGraph& generateGraph(Epetra_CrsGraph& AA);
82
83 private:
84
85 FillType flag;
86 Epetra_Map *StandardMap;
87 Epetra_Map *OverlapMap;
88 Epetra_Import *Importer;
89 Epetra_Import *ColumnToOverlapImporter;
90 Teuchos::RCP<Epetra_Vector> initialSolution;
91 Epetra_Vector *rhs;
92 Teuchos::RCP<Epetra_CrsGraph> AA;
93 Teuchos::RCP<Epetra_CrsMatrix> A;
94 Epetra_Comm *Comm;
95 int N_nonlinearUnknowns;
96 int* nonlinearUnknowns;
97
98 int MyPID; // Process number
99 int NumProc; // Total number of processes
100 int NumMyElements; // Number of elements owned by this process
101 int NumGlobalElements; // Total Number of elements
102
103 };
104 #endif
105
106
107
108