Overture  Version 25
EquationSolver.h
Go to the documentation of this file.
1 #ifndef EQUATION_SOLVER_H
2 #define EQUATION_SOLVER_H
3 
4 #include "Oges.h"
5 
6 // base class for equations solvers such as yale, harwell, slap, petsc etc.
8 {
9  public:
10  EquationSolver(Oges & oges_);
11  virtual ~EquationSolver();
12  virtual int solve(realCompositeGridFunction & u,
14 
15  virtual int saveBinaryMatrix(aString filename00,
18 
19  // new way to set coefficients:
21  const IntegerArray & boundaryConditions,
22  const RealArray & bcData );
23  // old way to set coefficients:
25  const IntegerArray & boundaryConditions=Overture::nullIntArray(),
26  const RealArray & bcData=Overture::nullRealArray() );
27 
29  CompositeGridOperators & op, const IntegerArray & boundaryConditions,
30  const RealArray & bcData,
31  RealArray & constantCoeff = Overture::nullRealArray(),
32  realCompositeGridFunction *variableCoeff=NULL );
33 
34  // call this function when the grid changes (and before setCoefficientsAndBoundaryConditions)
35  virtual int setGrid( CompositeGrid & cg );
36 
37  // Set the MultigridCompositeGrid to use: (for use with Ogmg)
38  virtual int set( MultigridCompositeGrid & mgcg );
39 
40  const aString & getName() const;
41 
42  virtual real getMaximumResidual();
43 
44  virtual int printStatistics( FILE *file = stdout ) const; // output any relevant statistics
45 
46  // assign values to rhs for the the extra equations
47  virtual int setExtraEquationValues( realCompositeGridFunction & f, real *value );
48 
49  // return solution values from the extra equations
50  virtual int getExtraEquationValues( const realCompositeGridFunction & u, real *value );
51 
52  // evaluate the dot product of an extra equation times u
53  virtual int evaluateExtraEquation( const realCompositeGridFunction & u, real & value, int extraEquation=0 );
54 
55  virtual int evaluateExtraEquation( const realCompositeGridFunction & u, real & value,
56  real & sumOfExtraEquationCoefficients, int extraEquation=0 );
57 
58  virtual int allocateMatrix(int,int,int,int);
59  virtual int setMatrixElement(int,int,int,real);
60  virtual int displayMatrix();
61 
62 // So far a common data structure is used by all vector types, so there is no need to have these:
63 // virtual void setRHSVectorElement(int,real);
64 // virtual void setSolVectorElement(int,real);
65 
66  virtual real sizeOf( FILE *file=NULL ); // return number of bytes allocated
67 
68  protected:
69 
72 
76  real maximumResidual; // after solve, this is the maximumResidual (if computed)
77  int numberOfIterations; // number of iterations required for the solve.
78 
79  // here we save the values of the current state so we can compare for any changes
80  // with oges.parameters
86 };
87 
88 
89 #endif