/usr/include/odindata/integration.h is in libodin-dev 1.8.5-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | /***************************************************************************
integration.h - description
-------------------
begin : Fri Apr 6 2001
copyright : (C) 2001 by Thies Jochimsen
email : jochimse@cns.mpg.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef INTEGRATION_H
#define INTEGRATION_H
#include <odindata/data.h>
/**
* @addtogroup odindata
* @{
*/
/**
* Base class of all function classes which should be integrated.
* To use this class, derive from it and overload the virtual
* function 'evaluate'.
*/
class Integrand {
public:
/**
* Returns the function value at position 'x'.
*/
virtual double evaluate(double x) const = 0;
/**
* Returns the integral from 'xmin' to 'xmax'.
* Integration is performed with 'max_subintervals' at which the function
* will be calculated and the specified relative 'error_limit'.
*/
double get_integral(double xmin, double xmax, unsigned int max_subintervals=1000, double error_limit=1e-7) const;
protected:
Integrand() {}
virtual ~Integrand() {}
};
////////////////////////////////////////////////////////////
class GslData4Integr; // forward declaration
/**
* Class which is used for integration of functions.
*/
class FunctionIntegral {
public:
/**
* Prepare an integration of function 'func'
* with 'max_subintervals' at which the function
* will be calculated and the specified relative 'error_limit'.
*/
FunctionIntegral(const Integrand& func, unsigned int max_subintervals=1000, double error_limit=1e-7);
/**
* Destructor
*/
~FunctionIntegral();
/**
* Returns the integral from 'xmin' to 'xmax'.
*/
double get_integral(double xmin, double xmax) const;
private:
static double integrand(double x, void *params);
const Integrand& f;
unsigned int n_intervals;
double errlimit;
GslData4Integr* gsldata;
};
/** @}
*/
#endif
|