escript  Revision_
Functions.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2018 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 
43  const escript::JMPI mpi_info;
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;
58  dim_t n;
59 };
60 
61 } // namespace paso
62 
63 #endif // __PASO_FUNCTIONS_H__
64 
paso::EPSILON
static const real_t EPSILON
Definition: ReactiveSolver.cpp:52
escript::DataTypes::real_t
double real_t
type of all real-valued scalars in escript
Definition: DataTypes.h:73
paso::util::lsup
double lsup(dim_t n, const double *x, escript::JMPI mpiinfo)
returns the global Lsup of x
Definition: PasoUtil.cpp:489
paso::Function::derivative
SolverResult derivative(double *J0w, const double *w, const double *f0, const double *x0, double *setoff, Performance *pp)
Definition: Functions.cpp:43
performance.h
paso::LinearSystem::n
dim_t n
Definition: Functions.h:69
paso::SystemMatrix_ptr
boost::shared_ptr< SystemMatrix > SystemMatrix_ptr
Definition: SystemMatrix.h:51
paso::LinearSystem::tmp
double * tmp
Definition: Functions.h:67
escript::fabs
escript::DataTypes::real_t fabs(const escript::DataTypes::cplx_t c)
Definition: ArrayOps.h:643
MPI_MAX
#define MPI_MAX
Definition: EsysMPI.h:52
paso::Function::call
virtual SolverResult call(double *value, const double *arg, Performance *pp)=0
sets value=F(arg)
Solver.h
paso::LinearSystem
Definition: Functions.h:57
Paso.h
paso::util::update
void update(dim_t n, double a, double *x, double b, const double *y)
Definition: PasoUtil.cpp:362
paso::LinearSystem::mat
SystemMatrix_ptr mat
Definition: Functions.h:66
escript::DataTypes::dim_t
index_t dim_t
Definition: DataTypes.h:87
paso::Function
Definition: Functions.h:38
escript::JMPI
boost::shared_ptr< JMPI_ > JMPI
Definition: EsysMPI.h:70
paso::SolverResult
SolverResult
Definition: Paso.h:53
paso::LinearSystem::getLen
virtual dim_t getLen()
returns the length of the vectors used by this function
Definition: Functions.h:64
paso::LinearSystem::~LinearSystem
virtual ~LinearSystem()
Definition: Solver_Function.cpp:47
SystemMatrix.h
paso::util::linearCombination
void linearCombination(dim_t n, double *z, double a, const double *x, double b, const double *y)
Definition: PasoUtil.cpp:411
paso::Function::~Function
virtual ~Function()
Definition: Functions.cpp:39
MPI_DOUBLE
#define MPI_DOUBLE
Definition: EsysMPI.h:45
paso::Function::Function
Function(const escript::JMPI &mpi_info)
Definition: Functions.cpp:34
paso::LinearSystem::call
virtual SolverResult call(double *value, const double *arg, Performance *pp)
sets value=F(arg)
Definition: Solver_Function.cpp:55
paso::LinearSystem::b
double * b
Definition: Functions.h:68
PasoUtil.h
paso::util::zeroes
void zeroes(dim_t n, double *x)
fills array x with zeroes
Definition: PasoUtil.cpp:342
escript::DataTypes::real_t_eps
real_t real_t_eps()
Returns the machine epsilon for the real_t type.
Definition: DataTypes.h:120
paso::LinearSystem::LinearSystem
LinearSystem(SystemMatrix_ptr A, double *b, Options *options)
Definition: Solver_Function.cpp:37
Functions.h
paso::Function::getLen
virtual dim_t getLen()=0
returns the length of the vectors used by this function
paso::Function::mpi_info
const escript::JMPI mpi_info
Definition: Functions.h:66
paso
Definition: BiCGStab.cpp:25
paso::NoError
Definition: Paso.h:66
paso::Options
Definition: Options.h:76
paso::Performance
Definition: performance.h:65