From 78f3e84e37435612952784688d67bc72361a5672 Mon Sep 17 00:00:00 2001 From: Francesco Biscani Date: Fri, 12 Dec 2008 10:43:41 +0100 Subject: [PATCH] Use constructor instead of SetParameter and remove needless file. --- AstroToolbox/Astro_Functions.cpp | 6 +++--- AstroToolbox/ZeroFinder.cpp | 34 ---------------------------------- AstroToolbox/ZeroFinder.h | 14 ++++++++------ CMakeLists.txt | 3 +-- 4 files changed, 12 insertions(+), 45 deletions(-) delete mode 100644 AstroToolbox/ZeroFinder.cpp diff --git a/AstroToolbox/Astro_Functions.cpp b/AstroToolbox/Astro_Functions.cpp index cc88679..35e6229 100644 --- a/AstroToolbox/Astro_Functions.cpp +++ b/AstroToolbox/Astro_Functions.cpp @@ -18,7 +18,8 @@ using namespace std; class CZF : public ZeroFinder::Function1D { -public: +public: + CZF(const double &a, const double &b):Function1D(a,b) {} double operator()(const double &x) const { return (p1*tan(x) - log(tan(0.5*x + M_PI_4)) - p2); @@ -45,9 +46,8 @@ double Mean2Eccentric (const double &M, const double &e) n_of_it++; } } else { - CZF FF; // function to find its zero point + CZF FF(e,M); // function to find its zero point ZeroFinder::FZero fz(-M_PI_2 + 1e-8, M_PI_2 - 1e-8); - FF.SetParameters(e, M); Ecc_New = fz.FindZero(FF); Eccentric = Ecc_New; } diff --git a/AstroToolbox/ZeroFinder.cpp b/AstroToolbox/ZeroFinder.cpp deleted file mode 100644 index c4e46ae..0000000 --- a/AstroToolbox/ZeroFinder.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// ------------------------------------------------------------------------ // -// This source file is part of the 'ESA Advanced Concepts Team's // -// Space Mechanics Toolbox' software. // -// // -// The source files are for research use only, // -// and are distributed WITHOUT ANY WARRANTY. Use them on your own risk. // -// // -// Copyright (c) 2004-2007 European Space Agency // -// ------------------------------------------------------------------------ // - -#include -#include -#include -#include "ZeroFinder.h" - -namespace ZeroFinder { - void Function1D::SetParameters(double a, double b) - { - p1 = a; - p2 = b; - } - - void Function1D_7param::SetParameters(double a, double b, double c, double d, double e, double f, double g) - { - p1 = a; - p2 = b; - p3 = c; - p4 = d; - p5 = e; - p6 = f; - p7 = g; - } -} - diff --git a/AstroToolbox/ZeroFinder.h b/AstroToolbox/ZeroFinder.h index 5a605a4..27499bc 100644 --- a/AstroToolbox/ZeroFinder.h +++ b/AstroToolbox/ZeroFinder.h @@ -27,18 +27,20 @@ namespace ZeroFinder */ class Function1D { - public: + public: + Function1D(const double &a, const double &b):p1(a),p2(b) {} // parameters - double p1,p2; - void SetParameters(double a, double b); + const double p1,p2; }; class Function1D_7param { - public: + public: + Function1D_7param(const double &a, const double &b, const double &c, + const double &d, const double &e, const double &f, + const double &g):p1(a),p2(b),p3(c),p4(d),p5(e),p6(f),p7(g) {} // parameters - double p1,p2,p3,p4,p5,p6,p7; - void SetParameters(double a, double b, double c, double d, double e, double f, double g); + const double p1,p2,p3,p4,p5,p6,p7; }; diff --git a/CMakeLists.txt b/CMakeLists.txt index c6abbce..ba38552 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ PROJECT(PaGMO) - + CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fmessage-length=0 -Wdisabled-optimization") @@ -34,7 +34,6 @@ SET(PAGMO_LIB_SRC_LIST ${CMAKE_SOURCE_DIR}/AstroToolbox/PowSwingByInv.cpp ${CMAKE_SOURCE_DIR}/AstroToolbox/propagateKEP.cpp ${CMAKE_SOURCE_DIR}/AstroToolbox/time2distance.cpp - ${CMAKE_SOURCE_DIR}/AstroToolbox/ZeroFinder.cpp ${CMAKE_SOURCE_DIR}/Functions/rng/PkRandom.cpp ${CMAKE_SOURCE_DIR}/Functions/objfuns/trajobjfuns.cpp ${CMAKE_SOURCE_DIR}/GOclasses/algorithms/ASA.cpp -- 2.11.4.GIT