escript  Revision_
Functions.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2016 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 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16 
17 
18 #ifndef __PASO_FUNCTIONS_H__
19 #define __PASO_FUNCTIONS_H__
20 
21 #include "Paso.h"
22 #include "performance.h"
23 #include "SystemMatrix.h"
24 
25 namespace paso {
26 
27 struct Function
28 {
30  virtual ~Function();
31 
33  virtual SolverResult call(double* value, const double* arg, Performance* pp) = 0;
34 
37  SolverResult derivative(double* J0w, const double* w, const double* f0,
38  const double* x0, double* setoff, Performance* pp);
39 
41  virtual dim_t getLen() = 0;
42 
44 };
45 
46 struct LinearSystem : public Function
47 {
48  LinearSystem(SystemMatrix_ptr A, double* b, Options* options);
49  virtual ~LinearSystem();
50 
51  virtual SolverResult call(double* value, const double* arg, Performance* pp);
52 
53  virtual dim_t getLen() { return n; }
54 
56  double* tmp;
57  double* b;
59 };
60 
61 } // namespace paso
62 
63 #endif // __PASO_FUNCTIONS_H__
64 
Definition: Options.h:89
double * tmp
Definition: Functions.h:56
SolverResult derivative(double *J0w, const double *w, const double *f0, const double *x0, double *setoff, Performance *pp)
Definition: Functions.cpp:32
boost::shared_ptr< JMPI_ > JMPI
Definition: EsysMPI.h:71
virtual dim_t getLen()
returns the length of the vectors used by this function
Definition: Functions.h:53
virtual SolverResult call(double *value, const double *arg, Performance *pp)=0
sets value=F(arg)
Definition: performance.h:54
boost::shared_ptr< SystemMatrix > SystemMatrix_ptr
Definition: SystemMatrix.h:40
Definition: AMG.cpp:45
Definition: Functions.h:46
virtual ~Function()
Definition: Functions.cpp:28
SystemMatrix_ptr mat
Definition: Functions.h:55
Definition: Functions.h:27
Function(const escript::JMPI &mpi_info)
Definition: Functions.cpp:23
const escript::JMPI mpi_info
Definition: Functions.h:43
SolverResult
Definition: Paso.h:42
double * b
Definition: Functions.h:57
dim_t n
Definition: Functions.h:58
index_t dim_t
Definition: DataTypes.h:64
virtual dim_t getLen()=0
returns the length of the vectors used by this function