mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-04-23 03:00:17 -04:00
Started implementing the solvers... Inheritance is a little unclear, wrote todo notes in the source. Added test object factories for consistent testing.
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
#include <sstream>
|
||||
#include "float.h"
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include "Eigen/Core"
|
||||
|
||||
/// A wrapper around std::vector
|
||||
/** This wrapper makes the standard vector multi-dimensional.
|
||||
|
||||
@@ -9,12 +9,13 @@
|
||||
#include <string>
|
||||
#include "Solvers.h"
|
||||
#include "MatrixMath.h"
|
||||
#include <unsupported/Eigen/Polynomials>
|
||||
#include "unsupported/Eigen/Polynomials"
|
||||
|
||||
namespace CoolProp{
|
||||
|
||||
// Just a forward declaration
|
||||
class Poly2DResidual;
|
||||
class Poly2DFracResidual;
|
||||
|
||||
/// The base class for all Polynomials
|
||||
/** A clear and straight forward implementation of polynomial operations. Still
|
||||
@@ -103,12 +104,14 @@ public:
|
||||
double integral(const Eigen::MatrixXd &coefficients, const double &x_in, const double &y_in, const int &axis);
|
||||
|
||||
protected:
|
||||
// TODO: Why doe these base definitions not work with derived classes?
|
||||
/// Uses the Brent solver to find the roots of p(x_in,y_in)-z_in
|
||||
/// @param res Poly2DResidual object to calculate residuals and derivatives
|
||||
/// @param min double value that represents the minimum value
|
||||
/// @param max double value that represents the maximum value
|
||||
double solve_limits(Poly2DResidual res, const double &min, const double &max);
|
||||
|
||||
// TODO: Why doe these base definitions not work with derived classes?
|
||||
/// Uses the Newton solver to find the roots of p(x_in,y_in)-z_in
|
||||
/// @param res Poly2DResidual object to calculate residuals and derivatives
|
||||
/// @param guess double value that represents the start value
|
||||
@@ -287,6 +290,21 @@ public:
|
||||
/// @param y_base double value that represents the base value for a centred fit in the 2nd dimension
|
||||
double integral(const Eigen::MatrixXd &coefficients, const double &x_in, const double &y_in, const int &axis, const int &x_exp, const int &y_exp, const double &x_base, const double &y_base);
|
||||
|
||||
protected:
|
||||
// TODO: Why doe these base definitions not work with derived classes?
|
||||
/// Uses the Brent solver to find the roots of p(x_in,y_in)-z_in
|
||||
/// @param res Poly2DResidual object to calculate residuals and derivatives
|
||||
/// @param min double value that represents the minimum value
|
||||
/// @param max double value that represents the maximum value
|
||||
double solve_limits(Poly2DFracResidual res, const double &min, const double &max);
|
||||
|
||||
// TODO: Why doe these base definitions not work with derived classes?
|
||||
/// Uses the Newton solver to find the roots of p(x_in,y_in)-z_in
|
||||
/// @param res Poly2DResidual object to calculate residuals and derivatives
|
||||
/// @param guess double value that represents the start value
|
||||
double solve_guess(Poly2DFracResidual res, const double &guess);
|
||||
|
||||
public:
|
||||
/// Returns a vector with ALL the real roots of p(x_in,y_in)-z_in
|
||||
/// @param coefficients vector containing the ordered coefficients
|
||||
/// @param in double value that represents the current input in x (1st dimension) or y (2nd dimension)
|
||||
|
||||
20
include/TestObjects.h
Normal file
20
include/TestObjects.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* This file contains some basic methods to generate
|
||||
* objects that can be used in the test routines.
|
||||
* This makes the tests themselves much more readable
|
||||
* and assures that the objects used for testing are the
|
||||
* same in all places.
|
||||
*/
|
||||
#include "IncompressibleFluid.h"
|
||||
#include "Eigen/Core"
|
||||
#include "MatrixMath.h"
|
||||
|
||||
#if defined ENABLE_CATCH
|
||||
namespace CoolPropTesting {
|
||||
|
||||
Eigen::MatrixXd makeMatrix(const std::vector<double> &coefficients);
|
||||
CoolProp::IncompressibleFluid incompressibleFluidObject();
|
||||
//IncompressibleBackend incompressibleBackendObject();
|
||||
|
||||
} // namespace CoolPropTesting
|
||||
#endif // ENABLE_CATCH
|
||||
Reference in New Issue
Block a user