From d63c34c4c409c553dd5a259615cab83ca0addc99 Mon Sep 17 00:00:00 2001 From: OlegJakushkin Date: Tue, 19 Jul 2016 02:18:35 +0300 Subject: [PATCH 1/3] [DOCS]: ReadMe update --- README.md | 91 ++++++++++++++++++++++++++----------------------------- 1 file changed, 43 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index 761730db9..0a60a614f 100644 --- a/README.md +++ b/README.md @@ -8,61 +8,47 @@ NOT Stable - Under heavy development [![Coverage Status](https://coveralls.io/repos/github/kiliakis/BLonD-minimal-cpp/badge.svg?branch=master)](https://coveralls.io/github/kiliakis/BLonD-minimal-cpp?branch=master) ## Requirements -* cmake version >= 3.0.2 [install](https://cmake.org/install/) -* gcc version >= 4.8.0 [install](https://gcc.gnu.org/wiki/InstallingGCC) -* FFTW3 Library [install](http://www.fftw.org/download.html) - - -## Installation - -#### BLonD++ installation - -1. clone the code into a directory (lets call it BLonD++/) +* cmake version >= 2.8 [install](https://cmake.org/install/) +####Linux +* gcc version >= 4.8.0 [install](https://gcc.gnu.org/wiki/InstallingGCC) +####Windows +* Visual Studio version >= 2015 with C++ compiler [install](https://www.visualstudio.com/) + +## Installation (Windows and Linux) +1. clone the code into a directory (lets call it BLonD-minimal-cpp/): ```bash - git clone --branch=master --recursive https://github.com/kiliakis/BLonD-minimal-cpp.git BLonD++ + git clone --branch=master https://github.com/kiliakis/BLonD-minimal-cpp ``` - -2. run the commands +2. To compile all dependencies and build blond library run the commands: ```bash - cd BLonD++ + cd BLonD-minimal-cpp mkdir build cd build - cmake --help .. # to see avaliable options - cmake .. # use opptions like cmake -DUSE_FFTW_OMP=True .. for the multithreaded version on Linux - cmake --build .. + cmake -DWITH_FFTW=True -DWITH_GOOGLETEST=True -DWITH_BENCHMARK=True .. # Configuration + cmake --build . # Compilation + ctest -VV # Testing ``` - + What was happening here: + 1. we opened folder with downloaded Blond source files + 2. created a folder to hold solution and project files + 3. On configuration step: + 1. Downloaded build and installed external libraries (FFTW, GoogleTest, GoogleBenchmark) into `BLonD-minimal-cpp\external\install` + 2. Generated solution and project files + 4. Compiled and linked default build configuration + 5. Executed unit tests 3. The executables should be ready! - 4. Developer's Notes: - * By default, the Release version of the code is compiled. You can build a debug version with `cmake -DCMAKE_BUILD_TYPE=Debug ..` + * On Linux, by default, the Release version of the code is compiled. You can build a debug version by adding `-DCMAKE_BUILD_TYPE=Debug` argument to configuration command, before `..` + * On Windows by default, the Debug version of the code is compiled. You can build a debug version by adding `--target ALL_BUILD --config Release` argument to Compilation command after `.` + * On Windows one shall copy contents of `external/install/bin/fftw/$(configuration)` into corresponding to given build configuration folder to be able to test and run executables. + * To commit properly formatted code, reformatted by clang-format on each build please add `-DWITH_FORMAT=True` argument to configuration command, before `..`, note clang-format shall be [installed](http://llvm.org/releases/download.html) -#### Libraries Installation - -* FFTW3 Library - If you are using a Linux distribution, you can install FFTW3 simply by running the install-linux.sh script as: - ```bash - cd BLonD++ - sh install-linux.sh - ``` - - If this doesn't work, then you should try the following set of commands: - ```bash - wget http://www.fftw.org/fftw-3.3.4.tar.gz - tar -xzvf fftw-3.3.4.tar.gz - cd fftw-3.3.4 - ./configure - make - make install #you may need sudo access for this step, if you don't have it then try ./configure --prefix=/path/to/install - ``` - *Note that if you want to use the multi-threaded version of this library you must configure as `./configure --enable-openmp`.* - +## Using system Libraries (advanced) +If FFTW, GoogleTest or GoogleBenchmark are already installed in your system you can set `-DWITH_*` to `False` or skip this arguments when calling configuration commands ## Configuration - -The following definitions, found in file include/configuration.h, can be commented / uncommented to alter simulation's configuration: - +The following definitions, found in file include/blond/configuration.h, can be commented / uncommented to alter simulation's configuration: ```c #define TIMING #define PRINT_RESULTS @@ -70,7 +56,6 @@ The following definitions, found in file include/configuration.h, can be comment *Note that a re-compile is needed every time a change is made.* ## Usage - The following optional command line arguments can be specified in order to specify some basic simulation parameters: * -m , --threads=\ : Number of OpenMP threads that will be used in the simulation (default: 1) @@ -81,20 +66,30 @@ The following optional command line arguments can be specified in order to speci Example: `./testcase -t 1000 -p2000` Or type: `./testcase -h` for more -## Running the Unit-Tests (googletest) +## Running the Unit-Tests Once you have successfully compiled the code you can run the tests: ```bash -cd BLonD++/build +cd BLonD-minimal-cpp/build ctest -VV ``` Then you can generate unit-test documentation: -## Building Unit-Test Documentation + +## Building Documentation +To generate html documentation with search and graphical class hierarchy's please [install Doxygen](http://www.stack.nl/~dimitri/doxygen/download.html) and [Graphviz](http://www.graphviz.org/Download..php) and run: ```bash -cd BLonD++/build +cd BLonD-minimal-cpp/build +doxygen Doxyfile +``` + +#### Building Unit-Test Documentation (Linux only) +To generate html documentation on unit tests coverage please install [genhtml](http://linux.die.net/man/1/genhtml) and [lcov](http://ltp.sourceforge.net/coverage/lcov.php) +```bash +cd BLonD-minimal-cpp/build lcov --capture --directory .. --output-file coverage.info genhtml coverage.info --output-directory html ``` + ## Original BLonD Links * Repository: https://gitlab.cern.ch/dquartul/BLonD From 772d97cdede603195405fd4533c4144130d97a9c Mon Sep 17 00:00:00 2001 From: OlegJakushkin Date: Tue, 19 Jul 2016 17:36:07 +0300 Subject: [PATCH 2/3] [Windows]: Fixing [Windows build failer](https://github.com/kiliakis/BLonD-minimal-cpp/issues/25) --- CMakeLists.txt | 5 +- README.md | 26 +++++------ include/blond/beams/Beams.h | 5 +- include/blond/beams/Slices.h | 4 +- include/blond/exp.h | 8 ++-- include/blond/fft.h | 2 +- include/blond/globals.h | 2 +- include/blond/impedances/InducedVoltage.h | 8 ++-- include/blond/impedances/Intensity.h | 8 ++-- .../input_parameters/GeneralParameters.h | 4 +- include/blond/input_parameters/RfParameters.h | 4 +- include/blond/llrf/LHCNoiseFB.h | 2 +- include/blond/llrf/PhaseLoop.h | 10 ++-- include/blond/llrf/PhaseNoise.h | 6 +-- include/blond/math_functions.h | 4 +- include/blond/optionparser.h | 46 +++++++++---------- include/blond/sin.h | 8 ++-- include/blond/trackers/Tracker.h | 4 +- include/blond/utilities.h | 4 +- include/blond/vdtcore_common.h | 2 - src/beams/Slices.cpp | 18 ++++---- src/input_parameters/RfParameters.cpp | 1 + src/llrf/PhaseNoise.cpp | 8 ++-- src/trackers/Tracker.cpp | 1 + unit-tests/testFullRing.cpp | 4 -- 25 files changed, 92 insertions(+), 102 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c3166ff0c..ed776ab02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,7 +75,8 @@ endif () #Compiler settings #MSVC vs Other if (MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj -Zm500 /MP${N} /openmp /fp:precise") + add_definitions(-D_USE_MATH_DEFINES) #needed for VDT + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj -Zm500 /MP${N} /openmp /fp:precise ") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GR-") else () check_cxx_compiler_flag(-std=c++11 COMPILER_HAS_CXX11) @@ -109,7 +110,9 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU) message(FATAL_ERROR "ERROR: Insufficient compiler version, need at lest 4.8 to continue") endif () set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast") set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -flto") + elseif (CMAKE_C_COMPILER_ID MATCHES "Clang") if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.8) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3") diff --git a/README.md b/README.md index 0081a51ae..de83dd9d1 100644 --- a/README.md +++ b/README.md @@ -18,19 +18,19 @@ NOT Stable - Under heavy development ## Installation (Windows and Linux) 1. clone the code into a directory (lets call it BLonD-minimal-cpp/): - ```bash - git clone --branch=master https://github.com/kiliakis/BLonD-minimal-cpp - ``` +```bash +git clone --branch=master https://github.com/kiliakis/BLonD-minimal-cpp +``` 2. To compile all dependencies and build blond library run the commands: - ```bash - cd BLonD-minimal-cpp - mkdir build - cd build - cmake -DWITH_FFTW=True -DWITH_GOOGLETEST=True -DWITH_BENCHMARK=True .. # Configuration - cmake --build . # Compilation - ctest -VV # Testing - ``` - What was happening here: +```bash +cd BLonD-minimal-cpp +mkdir build +cd build +cmake -DWITH_FFTW=True -DWITH_GOOGLETEST=True -DWITH_BENCHMARK=True .. # Configuration +cmake --build . # Compilation +ctest -VV # Testing +``` +What was happening here: 1. we opened folder with downloaded Blond source files 2. created a folder to hold solution and project files 3. On configuration step: @@ -54,7 +54,7 @@ The following definitions, found in file include/blond/configuration.h, can be c ```c #define TIMING #define PRINT_RESULTS -``` +`` *Note that a re-compile is needed every time a change is made.* ## Usage diff --git a/include/blond/beams/Beams.h b/include/blond/beams/Beams.h index ea2ed239c..20df8692c 100644 --- a/include/blond/beams/Beams.h +++ b/include/blond/beams/Beams.h @@ -8,13 +8,10 @@ #ifndef BEAMS_BEAMS_H_ #define BEAMS_BEAMS_H_ -class Beams; - #include -#include #include -class API Beams { +class API Beams { public: f_vector_t dt; f_vector_t dE; diff --git a/include/blond/beams/Slices.h b/include/blond/beams/Slices.h index b0a5319dd..1bbed83a6 100644 --- a/include/blond/beams/Slices.h +++ b/include/blond/beams/Slices.h @@ -8,8 +8,6 @@ #ifndef BEAMS_SLICES_H_ #define BEAMS_SLICES_H_ -class Slices; - #include #include @@ -19,7 +17,7 @@ enum cuts_unit_type { s, rad }; enum fit_type { normal_fit, gaussian_fit }; -class API Slices { +class API Slices { public: ftype bl_fwhm, bp_fwhm; ftype bp_rms, bl_rms; diff --git a/include/blond/exp.h b/include/blond/exp.h index 363b35674..636873752 100644 --- a/include/blond/exp.h +++ b/include/blond/exp.h @@ -152,10 +152,10 @@ inline float fast_expf(float initial_x) { //------------------------------------------------------------------------------ -void expv(const uint32_t size, double const * __restrict__ iarray, double* __restrict__ oarray); -void fast_expv(const uint32_t size, double const * __restrict__ iarray, double* __restrict__ oarray); -void expfv(const uint32_t size, float const * __restrict__ iarray, float* __restrict__ oarray); -void fast_expfv(const uint32_t size, float const * __restrict__ iarray, float* __restrict__ oarray); +void expv(const uint32_t size, double const * __restrict iarray, double* __restrict oarray); +void fast_expv(const uint32_t size, double const * __restrict iarray, double* __restrict oarray); +void expfv(const uint32_t size, float const * __restrict iarray, float* __restrict oarray); +void fast_expfv(const uint32_t size, float const * __restrict iarray, float* __restrict oarray); } // end namespace vdt diff --git a/include/blond/fft.h b/include/blond/fft.h index 49b51a431..ecc34a848 100644 --- a/include/blond/fft.h +++ b/include/blond/fft.h @@ -38,7 +38,7 @@ namespace fft { enum fft_type_t { FFT, IFFT, RFFT, IRFFT }; - struct API fft_plan_t { + struct API fft_plan_t { fftw_plan p; // fftw_plan uint n; // size of the fft fft_type_t type; diff --git a/include/blond/globals.h b/include/blond/globals.h index 675788860..0e1c57842 100644 --- a/include/blond/globals.h +++ b/include/blond/globals.h @@ -13,7 +13,7 @@ #include #include -struct API Context { +struct API Context { static Slices* Slice; static GeneralParameters* GP; static Beams* Beam; diff --git a/include/blond/impedances/InducedVoltage.h b/include/blond/impedances/InducedVoltage.h index 326ea9b1b..a012b1dc6 100644 --- a/include/blond/impedances/InducedVoltage.h +++ b/include/blond/impedances/InducedVoltage.h @@ -20,7 +20,7 @@ typedef enum freq_res_option_t { floor_option } freq_res_option_t; -class API InducedVoltage { +class API InducedVoltage { public: std::vector fInducedVoltage; @@ -38,7 +38,7 @@ class API InducedVoltage { virtual ~InducedVoltage(){}; }; -class API InducedVoltageTime : public InducedVoltage { +class API InducedVoltageTime : public InducedVoltage { public: std::vector fWakeSourceList; std::vector fTimeArray; @@ -57,7 +57,7 @@ class API InducedVoltageTime : public InducedVoltage { ~InducedVoltageTime(); }; -class API InducedVoltageFreq : public InducedVoltage { +class API InducedVoltageFreq : public InducedVoltage { public: // Impedance sources inputed as a list (eg: list of BBResonators objects)* std::vector fImpedanceSourceList; @@ -110,7 +110,7 @@ class API InducedVoltageFreq : public InducedVoltage { ~InducedVoltageFreq(); }; -class API TotalInducedVoltage : public InducedVoltage { +class API TotalInducedVoltage : public InducedVoltage { public: std::vector fInducedVoltageList; std::vector fTimeArray; diff --git a/include/blond/impedances/Intensity.h b/include/blond/impedances/Intensity.h index 48c5ad6f8..1dacd3289 100644 --- a/include/blond/impedances/Intensity.h +++ b/include/blond/impedances/Intensity.h @@ -8,13 +8,13 @@ #ifndef IMPEDANCES_INTENSITY_H_ #define IMPEDANCES_INTENSITY_H_ -// class API Intensity; +// class API Intensity; #include #include #include -class API Intensity { +class API Intensity { public: // *Time array of the wake in [s]* f_vector_t fTimeArray; @@ -31,7 +31,7 @@ class API Intensity { virtual ~Intensity(){}; }; -class API Resonators : public Intensity { +class API Resonators : public Intensity { public: // *Shunt impepdance in* [:math:`\Omega`] f_vector_t fRS; @@ -49,7 +49,7 @@ class API Resonators : public Intensity { ~Resonators(); }; -class API InputTable : public Intensity { +class API InputTable : public Intensity { public: f_vector_t fFrequencyArrayLoaded; f_vector_t fReZArrayLoaded; diff --git a/include/blond/input_parameters/GeneralParameters.h b/include/blond/input_parameters/GeneralParameters.h index 4fa14ac7a..0fa709dc8 100644 --- a/include/blond/input_parameters/GeneralParameters.h +++ b/include/blond/input_parameters/GeneralParameters.h @@ -8,15 +8,13 @@ #ifndef INPUT_PARAMETERS_GENERALPARAMETERS_H_ #define INPUT_PARAMETERS_GENERALPARAMETERS_H_ -class GeneralParameters; - #include #include #include enum particle_type { proton, electron, user_input, none }; -class API GeneralParameters { +class API GeneralParameters { private: void eta_generation(); diff --git a/include/blond/input_parameters/RfParameters.h b/include/blond/input_parameters/RfParameters.h index 909a1eac3..a12cc5927 100644 --- a/include/blond/input_parameters/RfParameters.h +++ b/include/blond/input_parameters/RfParameters.h @@ -8,14 +8,12 @@ #ifndef INPUT_PARAMETERS_RFPARAMETERS_H_ #define INPUT_PARAMETERS_RFPARAMETERS_H_ -class RfParameters; - #include #include //#include //#include -class API RfParameters { +class API RfParameters { public: enum accelerating_systems_t { as_single, all, first }; diff --git a/include/blond/llrf/LHCNoiseFB.h b/include/blond/llrf/LHCNoiseFB.h index 2ac7af990..d662beaa9 100644 --- a/include/blond/llrf/LHCNoiseFB.h +++ b/include/blond/llrf/LHCNoiseFB.h @@ -23,7 +23,7 @@ #include #include -class API LHCNoiseFB { +class API LHCNoiseFB { private: static const ftype cfwhm; public: diff --git a/include/blond/llrf/PhaseLoop.h b/include/blond/llrf/PhaseLoop.h index 666975d7f..b094285be 100644 --- a/include/blond/llrf/PhaseLoop.h +++ b/include/blond/llrf/PhaseLoop.h @@ -14,7 +14,7 @@ #include #include -class API PhaseLoop { +class API PhaseLoop { public: virtual void track(){}; void default_track(); @@ -40,7 +40,7 @@ class API PhaseLoop { virtual ~PhaseLoop(){}; }; -class API LHC : public PhaseLoop { +class API LHC : public PhaseLoop { private: public: ftype gain2; @@ -56,7 +56,7 @@ class API LHC : public PhaseLoop { uint _delay = 0); }; -class API PSB : public PhaseLoop { +class API PSB : public PhaseLoop { private: public: f_vector_t gain2; @@ -81,7 +81,7 @@ class API PSB : public PhaseLoop { void precalculate_time(); }; -class API LHC_F : public PhaseLoop { +class API LHC_F : public PhaseLoop { private: public: ftype gain2; @@ -94,7 +94,7 @@ class API LHC_F : public PhaseLoop { void track(); }; -class API SPS_RL : public PhaseLoop { +class API SPS_RL : public PhaseLoop { private: public: ftype gain2; diff --git a/include/blond/llrf/PhaseNoise.h b/include/blond/llrf/PhaseNoise.h index 532c01251..8aa3a007c 100644 --- a/include/blond/llrf/PhaseNoise.h +++ b/include/blond/llrf/PhaseNoise.h @@ -12,7 +12,7 @@ #include #include -class PhaseNoise { +class API PhaseNoise { private: public: @@ -55,7 +55,7 @@ class PhaseNoise { }; -class LHCFlatSpectrum : public PhaseNoise { +class API LHCFlatSpectrum : public PhaseNoise { private: public: @@ -74,7 +74,7 @@ class LHCFlatSpectrum : public PhaseNoise { }; -class PSBPhaseNoiseInjection : public PhaseNoise { +class API PSBPhaseNoiseInjection : public PhaseNoise { private: public: diff --git a/include/blond/math_functions.h b/include/blond/math_functions.h index 0d8a76c98..3970229a0 100644 --- a/include/blond/math_functions.h +++ b/include/blond/math_functions.h @@ -20,7 +20,7 @@ namespace mymath { - class API Ham { + class API Ham { private: std::vector _H, _hp, _hv, _x; @@ -134,7 +134,7 @@ namespace mymath { const auto begin = xp.begin(); int k = 0; - while (x[k] < min and k < N) { + while (x[k] < min && k < N) { y[k] = left; ++k; } diff --git a/include/blond/optionparser.h b/include/blond/optionparser.h index 58c93c5e3..536f011be 100644 --- a/include/blond/optionparser.h +++ b/include/blond/optionparser.h @@ -277,7 +277,7 @@ namespace option { #ifdef _MSC_VER #include #pragma intrinsic(_BitScanReverse) - struct API MSC_Builtin_CLZ { + struct API MSC_Builtin_CLZ { static int builtin_clz(unsigned x) { unsigned long index; _BitScanReverse(&index, x); @@ -288,7 +288,7 @@ namespace option { #define __builtin_clz(x) MSC_Builtin_CLZ::builtin_clz(x) #endif - class Option; + class API Option; /** * @brief Possible results when checking if an argument is valid for a @@ -370,7 +370,7 @@ namespace option { * }; * @endcode */ - struct API Descriptor { + struct API Descriptor { /** * @brief Index of this option's linked list in the array filled in by * the parser. @@ -534,7 +534,7 @@ namespace option { * @code for (Option* opt = options[FILE]; opt; opt = opt->next()) * fname = opt->arg; ... @endcode */ - class API Option { + class API Option { Option* next_; Option* prev_; @@ -954,7 +954,7 @@ namespace option { * can serve as starting place for writing your own more complex CheckArg * functions: * @code - * struct API Arg: public option::Arg + * struct API Arg: public option::Arg * { * static void printError(const char* msg1, const option::Option& opt, * const char* msg2) @@ -1007,7 +1007,7 @@ namespace option { * }; * @endcode */ - struct API Arg { + struct API Arg { //! @brief For options that don't take an argument: Returns ARG_NONE. static ArgStatus None(const Option&, bool) { return ARG_NONE; } @@ -1035,7 +1035,7 @@ namespace option { * then the real * options and afterwards the counts will reflect the union. */ - struct API Stats { + struct API Stats { /** * @brief Number of elements needed for a @c buffer[] array to be used * for @@ -1164,7 +1164,7 @@ namespace option { } private: - class API CountOptionsAction; + class API CountOptionsAction; }; /** @@ -1187,7 +1187,7 @@ namespace option { * ... * @endcode */ - class API Parser { + class API Parser { int op_count; //!< @internal @brief see optionsCount() int nonop_count; //!< @internal @brief see nonOptionsCount() const char** nonop_args; //!< @internal @brief see nonOptions() @@ -1445,11 +1445,11 @@ namespace option { bool error() { return err; } private: - friend struct API Stats; + friend struct API Stats; - class API StoreOptionAction; + class API StoreOptionAction; - struct API Action; + struct API Action; /** * @internal @@ -1553,7 +1553,7 @@ namespace option { * Option it * parses. */ - struct API Parser::Action { + struct API Parser::Action { /** * @brief Called by Parser::workhorse() for each Option that has been * successfully @@ -1589,7 +1589,7 @@ namespace option { * counter for * each parsed Option. */ - class API Stats::CountOptionsAction : public Parser::Action { + class API Stats::CountOptionsAction : public Parser::Action { unsigned* buffer_max; public: @@ -1615,7 +1615,7 @@ namespace option { * parsed Option in * appropriate arrays (see Parser::parse()). */ - class API Parser::StoreOptionAction : public Parser::Action { + class API Parser::StoreOptionAction : public Parser::Action { Parser& parser; Option* options; Option* buffer; @@ -1905,13 +1905,13 @@ namespace option { * @internal * @brief The implementation of option::printUsage(). */ - struct API PrintUsageImplementation { + struct API PrintUsageImplementation { /** * @internal * @brief Interface for Functors that write (part of) a string * somewhere. */ - struct API IStringWriter { + struct API IStringWriter { /** * @brief Writes the given number of chars beginning at the given * pointer somewhere. @@ -2128,7 +2128,7 @@ namespace option { * the same number of columns will be returned for each row. * */ - class API LinePartIterator { + class API LinePartIterator { const Descriptor* tablestart; //!< The 1st descriptor of the current table. const Descriptor* @@ -2415,7 +2415,7 @@ namespace option { * output the string must be output piecemeal, interleaved with * the data from the other columns. */ - class API LineWrapper { + class API LineWrapper { static const int bufmask = 15; //!< Must be a power of 2 minus 1. /** * @brief Ring buffer for length component of pair (data, length). @@ -2979,13 +2979,13 @@ namespace option { * fwrite(str, size, 1, stdout); * } * - * struct API MyWriter { + * struct API MyWriter { * void write(const char* buf, size_t size) const { * fwrite(str, size, 1, stdout); * } * }; * - * struct API MyWriteFunctor { + * struct API MyWriteFunctor { * void operator()(const char* buf, size_t size) { * fwrite(str, size, 1, stdout); * } @@ -2994,7 +2994,7 @@ namespace option { * printUsage(my_write, usage); // custom write function * printUsage(MyWriter(), usage); // temporary of a custom class * MyWriter writer; - * printUsage(writer, usage); // custom class API object + * printUsage(writer, usage); // custom class API object * MyWriteFunctor wfunctor; * printUsage(&wfunctor, usage); // custom functor * printUsage(write, 1, usage); // write() to file descriptor 1 @@ -3006,7 +3006,7 @@ namespace option { * @endcode * * @par Notes: - * @li the @c write() method of a class API that is to be passed as a + * @li the @c write() method of a class API that is to be passed as a * temporary * as @c MyWriter() is in the example, must be a @c const method, * because diff --git a/include/blond/sin.h b/include/blond/sin.h index fb8b4c0bb..fcddba23a 100644 --- a/include/blond/sin.h +++ b/include/blond/sin.h @@ -41,10 +41,10 @@ inline double fast_sin(double x){double s,c;fast_sincos(x,s,c);return s;} inline float fast_sinf(float x){float s,c;fast_sincosf(x,s,c);return s;} //------------------------------------------------------------------------------ -void sinv(const uint32_t size, double const * __restrict__ iarray, double* __restrict__ oarray); -void fast_sinv(const uint32_t size, double const * __restrict__ iarray, double* __restrict__ oarray); -void sinfv(const uint32_t size, float const * __restrict__ iarray, float* __restrict__ oarray); -void fast_sinfv(const uint32_t size, float const * __restrict__ iarray, float* __restrict__ oarray); +void sinv(const uint32_t size, double const * __restrict iarray, double* __restrict oarray); +void fast_sinv(const uint32_t size, double const * __restrict iarray, double* __restrict oarray); +void sinfv(const uint32_t size, float const * __restrict iarray, float* __restrict oarray); +void fast_sinfv(const uint32_t size, float const * __restrict iarray, float* __restrict oarray); } //vdt namespace diff --git a/include/blond/trackers/Tracker.h b/include/blond/trackers/Tracker.h index 205e78011..7008e8020 100644 --- a/include/blond/trackers/Tracker.h +++ b/include/blond/trackers/Tracker.h @@ -16,7 +16,7 @@ enum solver_type { simple, full }; -class API RingAndRfSection { +class API RingAndRfSection { private: public: @@ -92,7 +92,7 @@ class API RingAndRfSection { }; -class API FullRingAndRf { +class API FullRingAndRf { private: public: diff --git a/include/blond/utilities.h b/include/blond/utilities.h index 131f97a50..ded48787d 100644 --- a/include/blond/utilities.h +++ b/include/blond/utilities.h @@ -79,7 +79,7 @@ namespace util { } // sort an array with regards to another array - struct API MyComparator { + struct API MyComparator { ftype* a; MyComparator(ftype* _a) : a(_a) {} @@ -229,7 +229,7 @@ namespace util { return res.str(); } - struct API Arg : public option::Arg { + struct API Arg : public option::Arg { static void printError(const char* msg1, const option::Option& opt, const char* msg2) { fprintf(stderr, "%s", msg1); diff --git a/include/blond/vdtcore_common.h b/include/blond/vdtcore_common.h index 512544f9a..f10f2d7e9 100644 --- a/include/blond/vdtcore_common.h +++ b/include/blond/vdtcore_common.h @@ -28,14 +28,12 @@ #ifndef VDTCOMMON_H_ #define VDTCOMMON_H_ - // #include "inttypes.h" #include namespace vdt{ namespace details{ - // Constants const double TWOPI = 2.*M_PI; const double PI = M_PI; diff --git a/src/beams/Slices.cpp b/src/beams/Slices.cpp index cd927f6d8..ddf3484fc 100644 --- a/src/beams/Slices.cpp +++ b/src/beams/Slices.cpp @@ -87,7 +87,7 @@ void Slices::set_cuts() } // TODO not implemented the best way -// If dt, dE and id were in the same struct API it would be better +// If dt, dE and id were in the same struct API it would be better void Slices::sort_particles() { /* @@ -320,11 +320,11 @@ void Slices::fwhm(const ftype shift) // First aproximation for the half maximum values int i = 0; - while (n_macroparticles[i] < half_max and i < (int) n_slices) + while (n_macroparticles[i] < half_max && i < (int) n_slices) i++; int taux1 = i; i = n_slices - 1; - while (i >= 0 and n_macroparticles[i] < half_max) + while (i >= 0 && n_macroparticles[i] < half_max) i--; int taux2 = i; @@ -384,11 +384,11 @@ ftype Slices::fast_fwhm() ftype half_max = 0.5 * n_macroparticles[max_i]; int i = 0; - while (n_macroparticles[i] < half_max and i < (int) n_slices) + while (n_macroparticles[i] < half_max && i < (int) n_slices) i++; int taux1 = i; i = n_slices - 1; - while (i >= 0 and n_macroparticles[i] < half_max) + while (i >= 0 && n_macroparticles[i] < half_max) i--; int taux2 = i; // update bp @@ -422,14 +422,14 @@ void Slices::gaussian_fit() {} /* - struct API data { + struct API data { size_t n; double * y; }; int gauss(const gsl_vector * x, void *data, gsl_vector * f) { - size_t n = ((struct API data *) data)->n; - double *y = ((struct API data *) data)->y; + size_t n = ((struct API data *) data)->n; + double *y = ((struct API data *) data)->y; double A = gsl_vector_get(x, 2); double x0 = gsl_vector_get(x, 0); @@ -473,7 +473,7 @@ void Slices::gaussian_fit() {} //gsl_matrix *J = gsl_matrix_alloc(n, p); //gsl_matrix *covar = gsl_matrix_alloc(p, p); ftype y[n], weights[n]; - struct API data d = { n, y }; + struct API data d = { n, y }; gsl_multifit_function f; ftype x_init[3] = { x0, sx, A }; gsl_vector_view x = gsl_vector_view_array(x_init, p); diff --git a/src/input_parameters/RfParameters.cpp b/src/input_parameters/RfParameters.cpp index 1ea55a7ad..40d7ba122 100644 --- a/src/input_parameters/RfParameters.cpp +++ b/src/input_parameters/RfParameters.cpp @@ -8,6 +8,7 @@ #include #include #include +#include /* :How to use RF programs: diff --git a/src/llrf/PhaseNoise.cpp b/src/llrf/PhaseNoise.cpp index a0de88531..fd3b1a6b1 100644 --- a/src/llrf/PhaseNoise.cpp +++ b/src/llrf/PhaseNoise.cpp @@ -31,7 +31,7 @@ void PhaseNoise::spectrum_to_phase_noise(f_vector_t &t, uint dt = 0; if (transform == transform_t::transform_none - or transform == transform_t::r) { + || transform == transform_t::r) { nt = 2 * (ReSLen - 1); dt = 1 / (2 * f_max); } else if (transform == transform_t::c) { @@ -67,7 +67,7 @@ void PhaseNoise::spectrum_to_phase_noise(f_vector_t &t, // std::cout << "mean r2 : " << mymath::mean(r2.data(), r2.size()) << "\n"; if (transform == transform_t::transform_none - or transform == transform_t::r) { + || transform == transform_t::r) { f_vector_t Gt(nt); auto factor = 2 * constant::pi; @@ -312,7 +312,7 @@ void PSBPhaseNoiseInjection::generate() n_points_pos_f_incl_zero = nt / 2 + 1; auto new_delta_f = f_max / (n_points_pos_f_incl_zero - 1); - // Construct spectrum + // Construct API spectrum auto nmin = std::floor(fFMin * f_s0 / new_delta_f); auto nmax = std::ceil(fFMax * f_s0 / new_delta_f); @@ -456,7 +456,7 @@ void LHCFlatSpectrum::generate() uint nf = fNt / 2 + 1; // #points in frequency domain auto df = GP->f_rev[k] / fNt; - // Construct spectrum + // Construct API spectrum auto nmin = std::floor(fFMin * fFs[k] / df); auto nmax = std::ceil(fFMax * fFs[k] / df); diff --git a/src/trackers/Tracker.cpp b/src/trackers/Tracker.cpp index 46ad69bb3..a0f875fa1 100644 --- a/src/trackers/Tracker.cpp +++ b/src/trackers/Tracker.cpp @@ -8,6 +8,7 @@ #include #include #include +#include // Two versions of kick, drift one with periodicity and another without // periodiciy diff --git a/unit-tests/testFullRing.cpp b/unit-tests/testFullRing.cpp index 550c291a0..39745aca0 100644 --- a/unit-tests/testFullRing.cpp +++ b/unit-tests/testFullRing.cpp @@ -1,8 +1,4 @@ #include -#include -#include - -#include #include #include From b89a9f0ad3103599511283a97b1f38180d576d30 Mon Sep 17 00:00:00 2001 From: OlegJakushkin Date: Tue, 19 Jul 2016 17:41:09 +0300 Subject: [PATCH 3/3] [DOCS]: README.md bugfix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 33f0b5b4d..2ada3b82e 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ The following definitions, found in file include/blond/configuration.h, can be c ```c #define TIMING #define PRINT_RESULTS -`` +``` *Note that a re-compile is needed every time a change is made.* ## Usage