| 1 |
// @HEADER |
| 2 |
// ***************************************************************************** |
| 3 |
// LOCA: Library of Continuation Algorithms Package |
| 4 |
// |
| 5 |
// Copyright 2001-2005 NTESS and the LOCA contributors. |
| 6 |
// SPDX-License-Identifier: BSD-3-Clause |
| 7 |
// ***************************************************************************** |
| 8 |
// @HEADER |
| 9 |
|
| 10 |
#ifndef LINEAR_SYSTEM_H |
| 11 |
#define LINEAR_SYSTEM_H |
| 12 |
|
| 13 |
// Trilinos headers |
| 14 |
#include "Epetra_CrsMatrix.h" |
| 15 |
#include "Epetra_Map.h" |
| 16 |
#ifdef HAVE_MPI |
| 17 |
#include "Epetra_MpiComm.h" |
| 18 |
#else |
| 19 |
#include "Epetra_SerialComm.h" |
| 20 |
#endif |
| 21 |
#include "Epetra_Vector.h" |
| 22 |
#include "LOCA_Parameter_Vector.H" |
| 23 |
#include "Teuchos_RCP.hpp" |
| 24 |
#include "Teuchos_ParameterList.hpp" |
| 25 |
|
| 26 |
// ParaCont headers |
| 27 |
#include "ProblemLOCAPrototype.H" |
| 28 |
|
| 29 |
class LinearSystem: |
| 30 |
public ProblemLOCAPrototype{ |
| 31 |
|
| 32 |
public: |
| 33 |
|
| 34 |
// Constructor |
| 35 |
#ifdef HAVE_MPI |
| 36 |
LinearSystem( const Teuchos::RCP <Epetra_MpiComm> & aComm ); |
| 37 |
#else |
| 38 |
LinearSystem( const Teuchos::RCP <Epetra_SerialComm> & aComm ); |
| 39 |
#endif |
| 40 |
|
| 41 |
// Destructor |
| 42 |
~LinearSystem(); |
| 43 |
|
| 44 |
// Implementation of ProblemNOXPrototype |
| 45 |
// virtual methods --------------------------------------- |
| 46 |
// |
| 47 |
// Compute F |
| 48 |
virtual bool ComputeF(const Epetra_Vector & x, |
| 49 |
Epetra_Vector & f); |
| 50 |
|
| 51 |
// Compute the Jacobian of F |
| 52 |
virtual bool ComputeJacF(const Epetra_Vector & x); |
| 53 |
|
| 54 |
// Returns a pointer to the Jacobian of F |
| 55 |
virtual Teuchos::RCP <Epetra_CrsMatrix> |
| 56 |
GetJacF() const; |
| 57 |
|
| 58 |
// Returns a pointer to the initial guess |
| 59 |
virtual Teuchos::RCP <Epetra_Vector> |
| 60 |
GetInitialGuess() const; |
| 61 |
|
| 62 |
// Implementation of ProblemLOCAPrototype |
| 63 |
// virtual methods -------------------------------------- |
| 64 |
// |
| 65 |
// Pointer to the continuable parameter list |
| 66 |
virtual LOCA::ParameterVector |
| 67 |
GetContinuableParams() const; |
| 68 |
|
| 69 |
// Setting one continuation parameter |
| 70 |
virtual bool SetContinuableParameter(std::string label, |
| 71 |
double value); |
| 72 |
|
| 73 |
// Updates the continuation file |
| 74 |
virtual bool UpdateContinuationFile( |
| 75 |
const std::string & fileName, |
| 76 |
const int & idStep, |
| 77 |
const Teuchos::ParameterList & continuationFileParams); |
| 78 |
|
| 79 |
// Setting the continuation file parameters |
| 80 |
virtual bool SetContinuationFileParameters(const Epetra_Vector & x); |
| 81 |
|
| 82 |
// Getting the continuation file parameters |
| 83 |
virtual Teuchos::RCP <Teuchos::ParameterList> |
| 84 |
GetContinuationFileParameters(); |
| 85 |
|
| 86 |
// Printing the solution at each step |
| 87 |
virtual bool PrintSolutionFile(const std::string & fileName, |
| 88 |
const Epetra_Vector & x, |
| 89 |
const Teuchos::ParameterList & xParams); |
| 90 |
|
| 91 |
private: |
| 92 |
|
| 93 |
// Internally stored variables ---------------------- |
| 94 |
// |
| 95 |
// Communicator |
| 96 |
#ifdef HAVE_MPI |
| 97 |
Teuchos::RCP <Epetra_MpiComm> comm; |
| 98 |
#else |
| 99 |
Teuchos::RCP <Epetra_SerialComm> comm; |
| 100 |
#endif |
| 101 |
|
| 102 |
// Continuable parameter list |
| 103 |
LOCA::ParameterVector continuableParams; |
| 104 |
|
| 105 |
// The continuation file parameters |
| 106 |
Teuchos::RCP <Teuchos::ParameterList> |
| 107 |
continuationFileParams; |
| 108 |
|
| 109 |
// Initial Guess |
| 110 |
Teuchos::RCP <Epetra_Vector> initialGuess; |
| 111 |
|
| 112 |
// Jacobian |
| 113 |
Teuchos::RCP <Epetra_CrsMatrix> jacobian; |
| 114 |
|
| 115 |
// From Local to global indices (vector map) |
| 116 |
int * myGlobalElements; |
| 117 |
|
| 118 |
// Local number of elements (vector map) |
| 119 |
int numMyElements; |
| 120 |
|
| 121 |
// Epetra Map of the vector's components |
| 122 |
Teuchos::RCP <Epetra_Map> vectorMap; |
| 123 |
}; |
| 124 |
|
| 125 |
#endif |