1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2024-11-10 08:55:37 +00:00

namespace macro refactoring to avoid conflicts

This commit is contained in:
Antonin Portelli 2015-01-28 17:15:05 +00:00
parent 583fd05edf
commit 3f812ee514
32 changed files with 75 additions and 69 deletions

View File

@ -27,7 +27,7 @@
#include <LatAnalyze/RandGen.hpp> #include <LatAnalyze/RandGen.hpp>
#include <fstream> #include <fstream>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* ASCII datafile class * * ASCII datafile class *
@ -72,6 +72,9 @@ public:
// IO // IO
virtual void close(void); virtual void close(void);
virtual void open(const std::string &name, const unsigned int mode); virtual void open(const std::string &name, const unsigned int mode);
public:
// default ASCII precision
static const unsigned int defaultDoublePrec = 15;
private: private:
// IO // IO
virtual std::string load(const std::string &name = ""); virtual std::string load(const std::string &name = "");
@ -83,6 +86,6 @@ private:
std::unique_ptr<AsciiParserState> state_{nullptr}; std::unique_ptr<AsciiParserState> state_{nullptr};
}; };
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_AsciiFile_hpp_ #endif // Latan_AsciiFile_hpp_

View File

@ -24,7 +24,7 @@
#include <LatAnalyze/Function.hpp> #include <LatAnalyze/Function.hpp>
#include <LatAnalyze/Model.hpp> #include <LatAnalyze/Model.hpp>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* <Class> * * <Class> *
@ -76,6 +76,6 @@ private:
Index nPar_{-1}; Index nPar_{-1};
}; };
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_Chi2Function_hpp_ #endif // Latan_Chi2Function_hpp_

View File

@ -24,7 +24,7 @@
#include <LatAnalyze/Function.hpp> #include <LatAnalyze/Function.hpp>
#include <LatAnalyze/MathInterpreter.hpp> #include <LatAnalyze/MathInterpreter.hpp>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* compiled double function class * * compiled double function class *
@ -59,6 +59,6 @@ private:
std::ostream & operator<<(std::ostream &out, CompiledDoubleFunction &f); std::ostream & operator<<(std::ostream &out, CompiledDoubleFunction &f);
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_CompiledFunction_hpp_ #endif // Latan_CompiledFunction_hpp_

View File

@ -24,7 +24,7 @@
#include <LatAnalyze/Model.hpp> #include <LatAnalyze/Model.hpp>
#include <LatAnalyze/MathInterpreter.hpp> #include <LatAnalyze/MathInterpreter.hpp>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* compiled double model class * * compiled double model class *
@ -60,6 +60,6 @@ private:
std::ostream & operator<<(std::ostream &out, CompiledDoubleModel &f); std::ostream & operator<<(std::ostream &out, CompiledDoubleModel &f);
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_CompiledModel_hpp_ #endif // Latan_CompiledModel_hpp_

View File

@ -27,7 +27,7 @@
#include <fstream> #include <fstream>
#include <vector> #include <vector>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* Dataset class * * Dataset class *
@ -129,6 +129,6 @@ void Dataset<T>::ptVectorMean(T &m, const std::vector<const T *> &v)
} }
} }
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_Dataset_hpp_ #endif // Latan_Dataset_hpp_

View File

@ -23,7 +23,7 @@
#include <LatAnalyze/Global.hpp> #include <LatAnalyze/Global.hpp>
#include <LatAnalyze/Function.hpp> #include <LatAnalyze/Function.hpp>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* Derivative * * Derivative *
@ -42,6 +42,7 @@ public:
Index getNPoint(void) const; Index getNPoint(void) const;
Index getOrder(void) const; Index getOrder(void) const;
double getStep(void) const; double getStep(void) const;
void setFunction(const DoubleFunction &f);
void setOrderAndPoint(const Index order, const DVec point); void setOrderAndPoint(const Index order, const DVec point);
void setStep(const double step); void setStep(const double step);
// function call // function call
@ -54,7 +55,7 @@ protected:
private: private:
void makeCoefficients(void); void makeCoefficients(void);
private: private:
const DoubleFunction &f_; const DoubleFunction *f_;
Index dir_, order_; Index dir_, order_;
double step_; double step_;
DVec point_, coefficient_; DVec point_, coefficient_;
@ -76,6 +77,7 @@ public:
using Derivative::getNPoint; using Derivative::getNPoint;
using Derivative::getStep; using Derivative::getStep;
using Derivative::getOrder; using Derivative::getOrder;
using Derivative::setStep;
Index getPrecOrder(void) const; Index getPrecOrder(void) const;
void setOrder(const Index order, const Index precOrder = defaultPrecOrder); void setOrder(const Index order, const Index precOrder = defaultPrecOrder);
// function call // function call
@ -87,6 +89,6 @@ private:
Index precOrder_; Index precOrder_;
}; };
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_Derivative_hpp_ #endif // Latan_Derivative_hpp_

View File

@ -39,7 +39,7 @@ public:\
name(std::string msg, std::string loc);\ name(std::string msg, std::string loc);\
} }
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
namespace Exceptions namespace Exceptions
{ {
@ -60,6 +60,6 @@ namespace Exceptions
DECL_EXC(System, Runtime); DECL_EXC(System, Runtime);
} }
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_Exceptions_hpp_ #endif // Latan_Exceptions_hpp_

View File

@ -29,7 +29,7 @@
#include <queue> #include <queue>
#include <unordered_map> #include <unordered_map>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* Abstract datafile class * * Abstract datafile class *
@ -147,6 +147,6 @@ void Io::save(const IoT &data, const std::string &fileName,
file.template save(data, realName); file.template save(data, realName);
} }
END_NAMESPACE END_LATAN_NAMESPACE
#endif #endif

View File

@ -23,7 +23,7 @@
#include <LatAnalyze/Global.hpp> #include <LatAnalyze/Global.hpp>
#include <LatAnalyze/Minimizer.hpp> #include <LatAnalyze/Minimizer.hpp>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* base class for data fit * * base class for data fit *
@ -75,6 +75,6 @@ private:
IMat isXXCorr_, isYYCorr_, isYXCorr_, isDataCorr_; IMat isXXCorr_, isYYCorr_, isYXCorr_, isDataCorr_;
}; };
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_FitInterface_hpp_ #endif // Latan_FitInterface_hpp_

View File

@ -27,7 +27,7 @@
#include <stack> #include <stack>
#include <vector> #include <vector>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* Double function class * * Double function class *
@ -180,6 +180,6 @@ DSample DoubleFunctionSample::operator()(const double arg0,
return (*this)(arg); return (*this)(arg);
} }
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_Function_hpp_ #endif // Latan_Function_hpp_

View File

@ -34,8 +34,8 @@
#include <vector> #include <vector>
#include <cstdlib> #include <cstdlib>
#define BEGIN_NAMESPACE namespace Latan { #define BEGIN_LATAN_NAMESPACE namespace Latan {
#define END_NAMESPACE } #define END_LATAN_NAMESPACE }
// macro utilities // macro utilities
#define unique_arg(...) __VA_ARGS__ #define unique_arg(...) __VA_ARGS__
@ -61,7 +61,7 @@ Class & operator=(const ExprType<Derived> &m)\
return *this;\ return *this;\
} }
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
// Eigen type aliases ////////////////////////////////////////////////////////// // Eigen type aliases //////////////////////////////////////////////////////////
const int dynamic = -1; const int dynamic = -1;
@ -284,7 +284,7 @@ ProgressBar::ProgressBar(const A current, const B total, const Index nCol)
, nCol_(nCol) , nCol_(nCol)
{} {}
END_NAMESPACE END_LATAN_NAMESPACE
#include <LatAnalyze/Exceptions.hpp> #include <LatAnalyze/Exceptions.hpp>

View File

@ -24,7 +24,7 @@
#include <LatAnalyze/RootFinder.hpp> #include <LatAnalyze/RootFinder.hpp>
#include <gsl/gsl_multiroots.h> #include <gsl/gsl_multiroots.h>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* GslHybridRootFinder * * GslHybridRootFinder *
@ -46,6 +46,6 @@ private:
gsl_multiroot_fsolver *solver_{nullptr}; gsl_multiroot_fsolver *solver_{nullptr};
}; };
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_GslHybridRootFinder_hpp_ #endif // Latan_GslHybridRootFinder_hpp_

View File

@ -25,7 +25,7 @@
#include <LatAnalyze/Integrator.hpp> #include <LatAnalyze/Integrator.hpp>
#include <gsl/gsl_integration.h> #include <gsl/gsl_integration.h>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* GSL general quadrature adaptive integration with singularities * * GSL general quadrature adaptive integration with singularities *
@ -53,6 +53,6 @@ private:
gsl_integration_workspace *workspace_; gsl_integration_workspace *workspace_;
}; };
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_GslQagsIntegrator_hpp_ #endif // Latan_GslQagsIntegrator_hpp_

View File

@ -23,7 +23,7 @@
#include <LatAnalyze/Global.hpp> #include <LatAnalyze/Global.hpp>
#include <LatAnalyze/Function.hpp> #include <LatAnalyze/Function.hpp>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* abstract integrator class * * abstract integrator class *
@ -41,6 +41,6 @@ public:
const double xMax) = 0; const double xMax) = 0;
}; };
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_Integrator_hpp_ #endif // Latan_Integrator_hpp_

View File

@ -22,7 +22,7 @@
#include <LatAnalyze/Global.hpp> #include <LatAnalyze/Global.hpp>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* Abstract class for IO objects * * Abstract class for IO objects *
@ -44,6 +44,6 @@ public:
virtual IoType getType(void) const = 0; virtual IoType getType(void) const = 0;
}; };
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_IoObject_hpp_ #endif // Latan_IoObject_hpp_

View File

@ -27,7 +27,7 @@
for (Latan::Index j = 0; j < mat.cols(); ++j)\ for (Latan::Index j = 0; j < mat.cols(); ++j)\
for (Latan::Index i = 0; i < mat.rows(); ++i) for (Latan::Index i = 0; i < mat.rows(); ++i)
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* matrix type * * matrix type *
@ -68,6 +68,6 @@ IoObject::IoType Mat<T>::getType(void) const
return IoType::noType; return IoType::noType;
} }
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_Mat_hpp_ #endif // Latan_Mat_hpp_

View File

@ -25,7 +25,7 @@
#include <LatAnalyze/StatArray.hpp> #include <LatAnalyze/StatArray.hpp>
#include <functional> #include <functional>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* matrix sample class * * matrix sample class *
@ -390,6 +390,6 @@ IoObject::IoType MatSample<T>::getType(void) const
return IoType::noType; return IoType::noType;
} }
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_MatSample_hpp_ #endif // Latan_MatSample_hpp_

View File

@ -24,7 +24,7 @@
#include <LatAnalyze/Function.hpp> #include <LatAnalyze/Function.hpp>
#include <LatAnalyze/MathInterpreter.hpp> #include <LatAnalyze/MathInterpreter.hpp>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* Custom math functions * * Custom math functions *
@ -125,6 +125,6 @@ DECL_STD_FUNC(fmin)
// Absolute value // Absolute value
DECL_STD_FUNC(fabs) DECL_STD_FUNC(fabs)
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_Math_hpp_ #endif // Latan_Math_hpp_

View File

@ -31,7 +31,7 @@
#define MAXIDLENGTH 256 #define MAXIDLENGTH 256
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* Class for runtime context * * Class for runtime context *
@ -313,6 +313,6 @@ private:
std::ostream & operator<<(std::ostream &out, const MathInterpreter &program); std::ostream & operator<<(std::ostream &out, const MathInterpreter &program);
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_MathInterpreter_hpp_ #endif // Latan_MathInterpreter_hpp_

View File

@ -25,7 +25,7 @@
#include <LatAnalyze/Mat.hpp> #include <LatAnalyze/Mat.hpp>
#include <LatAnalyze/Solver.hpp> #include <LatAnalyze/Solver.hpp>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* Abstract minimizer class * * Abstract minimizer class *
@ -62,6 +62,6 @@ private:
Vec<bool> hasHighLimit_, hasLowLimit_; Vec<bool> hasHighLimit_, hasLowLimit_;
}; };
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_Minimizer_hpp_ #endif // Latan_Minimizer_hpp_

View File

@ -25,7 +25,7 @@
#include <LatAnalyze/Minimizer.hpp> #include <LatAnalyze/Minimizer.hpp>
#include <Minuit2/FCNBase.h> #include <Minuit2/FCNBase.h>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* Minuit minimizer * * Minuit minimizer *
@ -59,6 +59,6 @@ public:
virtual const DVec & operator()(const DoubleFunction &f); virtual const DVec & operator()(const DoubleFunction &f);
}; };
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_MinuitMinimizer_hpp_ #endif // Latan_MinuitMinimizer_hpp_

View File

@ -25,15 +25,16 @@
#include <LatAnalyze/Mat.hpp> #include <LatAnalyze/Mat.hpp>
#include <vector> #include <vector>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* Double model class * * Double model class *
******************************************************************************/ ******************************************************************************/
class DoubleModel class DoubleModel
{ {
private: public:
typedef std::function<double(const double *, const double *)> vecFunc; typedef std::function<double(const double *, const double *)> vecFunc;
private:
struct ModelSize{Index nArg, nPar;}; struct ModelSize{Index nArg, nPar;};
public: public:
// constructor // constructor
@ -61,6 +62,6 @@ private:
vecFunc f_; vecFunc f_;
}; };
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_Model_hpp_ #endif // Latan_Model_hpp_

View File

@ -23,7 +23,7 @@
#include <LatAnalyze/Global.hpp> #include <LatAnalyze/Global.hpp>
#include <iostream> #include <iostream>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
template <typename DataObj> template <typename DataObj>
class ParserState class ParserState
@ -54,6 +54,6 @@ ParserState<DataObj>::ParserState(std::istream *streamPt, std::string *namePt,
, streamName(namePt) , streamName(namePt)
{} {}
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_ParserState_hpp_ #endif // Latan_ParserState_hpp_

View File

@ -35,7 +35,7 @@
#define GNUPLOT_ARGS "-p" #define GNUPLOT_ARGS "-p"
#endif #endif
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* Plot objects * * Plot objects *
@ -267,6 +267,6 @@ private:
std::ostream & operator<<(std::ostream &out, const Plot &plot); std::ostream & operator<<(std::ostream &out, const Plot &plot);
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_Plot_hpp_ #endif // Latan_Plot_hpp_

View File

@ -25,7 +25,7 @@
#define RLXG_STATE_SIZE 105u #define RLXG_STATE_SIZE 105u
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
class RandGenState: public Array<int, RLXG_STATE_SIZE, 1>, class RandGenState: public Array<int, RLXG_STATE_SIZE, 1>,
public IoObject public IoObject
@ -92,12 +92,12 @@ public:
void setState(const RandGenState &state); void setState(const RandGenState &state);
// generators // generators
double uniform(const double a = 0.0, const double b = 1.0); double uniform(const double a = 0.0, const double b = 1.0);
double discreteUniform(const unsigned int n); unsigned int discreteUniform(const unsigned int n);
double gaussian(const double mean = 0.0, const double sigma = 1.0); double gaussian(const double mean = 0.0, const double sigma = 1.0);
private: private:
RanLxd generator_; RanLxd generator_;
}; };
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_RandGen_hpp_ #endif // Latan_RandGen_hpp_

View File

@ -24,7 +24,7 @@
#include <LatAnalyze/Function.hpp> #include <LatAnalyze/Function.hpp>
#include <LatAnalyze/Solver.hpp> #include <LatAnalyze/Solver.hpp>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* RootFinder * * RootFinder *
@ -42,6 +42,6 @@ public:
= 0; = 0;
}; };
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_RootFinder_hpp_ #endif // Latan_RootFinder_hpp_

View File

@ -22,7 +22,7 @@
#include <LatAnalyze/Global.hpp> #include <LatAnalyze/Global.hpp>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* Solver * * Solver *
@ -65,6 +65,6 @@ private:
Verbosity verbosity_{Verbosity::Silent}; Verbosity verbosity_{Verbosity::Silent};
}; };
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_Solver_hpp_ #endif // Latan_Solver_hpp_

View File

@ -27,7 +27,7 @@
#define FOR_STAT_ARRAY(ar, i) \ #define FOR_STAT_ARRAY(ar, i) \
for (Latan::Index i = -(ar).offset; i < (ar).size(); ++i) for (Latan::Index i = -(ar).offset; i < (ar).size(); ++i)
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* Array class with statistics * * Array class with statistics *
@ -259,6 +259,6 @@ inline Mat<double> ReducOp::tensProd(const Mat<double> &v1,
return v1*v2.transpose(); return v1*v2.transpose();
} }
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_StatArray_hpp_ #endif // Latan_StatArray_hpp_

View File

@ -25,7 +25,7 @@
#include <LatAnalyze/Function.hpp> #include <LatAnalyze/Function.hpp>
#include <LatAnalyze/XYStatData.hpp> #include <LatAnalyze/XYStatData.hpp>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* tabulated function: 1D only * * tabulated function: 1D only *
@ -50,6 +50,6 @@ private:
std::map<double, double> value_; std::map<double, double> value_;
}; };
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_TabFunction_hpp_ #endif // Latan_TabFunction_hpp_

View File

@ -27,7 +27,7 @@
#include <LatAnalyze/Minimizer.hpp> #include <LatAnalyze/Minimizer.hpp>
#include <LatAnalyze/XYStatData.hpp> #include <LatAnalyze/XYStatData.hpp>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* object for fit result * * object for fit result *
@ -123,6 +123,6 @@ SampleFitResult XYSampleData::fit(Minimizer &minimizer, const DVec &init,
return fit(minimizer, init, modelVector); return fit(minimizer, init, modelVector);
} }
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_XYSampleData_hpp_ #endif // Latan_XYSampleData_hpp_

View File

@ -29,7 +29,7 @@
#include <LatAnalyze/Model.hpp> #include <LatAnalyze/Model.hpp>
#include <vector> #include <vector>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* object for fit result * * object for fit result *
@ -133,6 +133,6 @@ FitResult XYStatData::fit(Minimizer &minimizer, const DVec &init,
} }
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_XYData_hpp_ #endif // Latan_XYData_hpp_

View File

@ -25,7 +25,7 @@
#include <iostream> #include <iostream>
#include <vector> #include <vector>
BEGIN_NAMESPACE BEGIN_LATAN_NAMESPACE
/****************************************************************************** /******************************************************************************
* XML parameter file reader * * XML parameter file reader *
@ -176,6 +176,6 @@ std::vector<T> XmlReader::getAllValues(const std::string &nodeName,
return getAllValues<T>(root_, nodeName, nodeNames...); return getAllValues<T>(root_, nodeName, nodeNames...);
} }
END_NAMESPACE END_LATAN_NAMESPACE
#endif // Latan_XmlReader_hpp_ #endif // Latan_XmlReader_hpp_