1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2024-09-20 05:25:37 +01: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 <fstream>
BEGIN_NAMESPACE
BEGIN_LATAN_NAMESPACE
/******************************************************************************
* ASCII datafile class *
@ -72,6 +72,9 @@ public:
// IO
virtual void close(void);
virtual void open(const std::string &name, const unsigned int mode);
public:
// default ASCII precision
static const unsigned int defaultDoublePrec = 15;
private:
// IO
virtual std::string load(const std::string &name = "");
@ -83,6 +86,6 @@ private:
std::unique_ptr<AsciiParserState> state_{nullptr};
};
END_NAMESPACE
END_LATAN_NAMESPACE
#endif // Latan_AsciiFile_hpp_

View File

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

View File

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

View File

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

View File

@ -27,7 +27,7 @@
#include <fstream>
#include <vector>
BEGIN_NAMESPACE
BEGIN_LATAN_NAMESPACE
/******************************************************************************
* 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_

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,7 +25,7 @@
#define RLXG_STATE_SIZE 105u
BEGIN_NAMESPACE
BEGIN_LATAN_NAMESPACE
class RandGenState: public Array<int, RLXG_STATE_SIZE, 1>,
public IoObject
@ -92,12 +92,12 @@ public:
void setState(const RandGenState &state);
// generators
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);
private:
RanLxd generator_;
};
END_NAMESPACE
END_LATAN_NAMESPACE
#endif // Latan_RandGen_hpp_

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -29,7 +29,7 @@
#include <LatAnalyze/Model.hpp>
#include <vector>
BEGIN_NAMESPACE
BEGIN_LATAN_NAMESPACE
/******************************************************************************
* 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_

View File

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