escript  Revision_
Functions.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2020 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Apache License, version 2.0
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014-2017 by Centre for Geoscience Computing (GeoComp)
14 * Development from 2019 by School of Earth and Environmental Sciences
15 **
16 *****************************************************************************/
17 
18 
19 #ifndef __PASO_FUNCTIONS_H__
20 #define __PASO_FUNCTIONS_H__
21 
22 #include "Paso.h"
23 #include "performance.h"
24 #include "SystemMatrix.h"
25 
26 namespace paso {
27 
28 struct Function
29 {
31  virtual ~Function();
32 
34  virtual SolverResult call(double* value, const double* arg, Performance* pp) = 0;
35 
38  SolverResult derivative(double* J0w, const double* w, const double* f0,
39  const double* x0, double* setoff, Performance* pp);
40 
42  virtual dim_t getLen() = 0;
43 
45 };
46 
47 struct LinearSystem : public Function
48 {
49  LinearSystem(SystemMatrix_ptr<double> A, double* b, Options* options);
50  virtual ~LinearSystem();
51 
52  virtual SolverResult call(double* value, const double* arg, Performance* pp);
53 
54  virtual dim_t getLen() { return n; }
55 
57  double* tmp;
58  double* b;
60 };
61 
62 } // namespace paso
63 
64 #endif // __PASO_FUNCTIONS_H__
65 
index_t dim_t
Definition: DataTypes.h:66
boost::shared_ptr< JMPI_ > JMPI
Definition: EsysMPI.h:74
Definition: BiCGStab.cpp:25
boost::shared_ptr< SystemMatrix< T > > SystemMatrix_ptr
Definition: SystemMatrix.h:42
SolverResult
Definition: Paso.h:44
Definition: Functions.h:29
const escript::JMPI mpi_info
Definition: Functions.h:44
Function(const escript::JMPI &mpi_info)
Definition: Functions.cpp:23
virtual dim_t getLen()=0
returns the length of the vectors used by this function
SolverResult derivative(double *J0w, const double *w, const double *f0, const double *x0, double *setoff, Performance *pp)
Definition: Functions.cpp:32
virtual SolverResult call(double *value, const double *arg, Performance *pp)=0
sets value=F(arg)
virtual ~Function()
Definition: Functions.cpp:28
Definition: Functions.h:48
virtual ~LinearSystem()
Definition: Solver_Function.cpp:36
virtual SolverResult call(double *value, const double *arg, Performance *pp)
sets value=F(arg)
Definition: Solver_Function.cpp:44
LinearSystem(SystemMatrix_ptr< double > A, double *b, Options *options)
Definition: Solver_Function.cpp:26
SystemMatrix_ptr< double > mat
Definition: Functions.h:56
virtual dim_t getLen()
returns the length of the vectors used by this function
Definition: Functions.h:54
double * b
Definition: Functions.h:58
double * tmp
Definition: Functions.h:57
dim_t n
Definition: Functions.h:59
Definition: Options.h:80
Definition: performance.h:56