Skip to content

Commit

Permalink
[Windows]: Fixing [Windows build failer](blond-org#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegJakushkin committed Jul 19, 2016
1 parent ce7d09a commit 772d97c
Show file tree
Hide file tree
Showing 25 changed files with 92 additions and 102 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
5 changes: 1 addition & 4 deletions include/blond/beams/Beams.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@
#ifndef BEAMS_BEAMS_H_
#define BEAMS_BEAMS_H_

class Beams;

#include <blond/configuration.h>
#include <blond/globals.h>
#include <blond/utilities.h>

class API Beams {
class API Beams {
public:
f_vector_t dt;
f_vector_t dE;
Expand Down
4 changes: 1 addition & 3 deletions include/blond/beams/Slices.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#ifndef BEAMS_SLICES_H_
#define BEAMS_SLICES_H_

class Slices;

#include <blond/configuration.h>
#include <blond/utilities.h>

Expand All @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions include/blond/exp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion include/blond/fft.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion include/blond/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <blond/input_parameters/GeneralParameters.h>
#include <blond/input_parameters/RfParameters.h>

struct API Context {
struct API Context {
static Slices* Slice;
static GeneralParameters* GP;
static Beams* Beam;
Expand Down
8 changes: 4 additions & 4 deletions include/blond/impedances/InducedVoltage.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<ftype> fInducedVoltage;

Expand All @@ -38,7 +38,7 @@ class API InducedVoltage {
virtual ~InducedVoltage(){};
};

class API InducedVoltageTime : public InducedVoltage {
class API InducedVoltageTime : public InducedVoltage {
public:
std::vector<Intensity*> fWakeSourceList;
std::vector<ftype> fTimeArray;
Expand All @@ -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<Intensity*> fImpedanceSourceList;
Expand Down Expand Up @@ -110,7 +110,7 @@ class API InducedVoltageFreq : public InducedVoltage {
~InducedVoltageFreq();
};

class API TotalInducedVoltage : public InducedVoltage {
class API TotalInducedVoltage : public InducedVoltage {
public:
std::vector<InducedVoltage*> fInducedVoltageList;
std::vector<ftype> fTimeArray;
Expand Down
8 changes: 4 additions & 4 deletions include/blond/impedances/Intensity.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
#ifndef IMPEDANCES_INTENSITY_H_
#define IMPEDANCES_INTENSITY_H_

// class API Intensity;
// class API Intensity;

#include <blond/configuration.h>
#include <blond/utilities.h>
#include <vector>

class API Intensity {
class API Intensity {
public:
// *Time array of the wake in [s]*
f_vector_t fTimeArray;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions include/blond/input_parameters/GeneralParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@
#ifndef INPUT_PARAMETERS_GENERALPARAMETERS_H_
#define INPUT_PARAMETERS_GENERALPARAMETERS_H_

class GeneralParameters;

#include <blond/configuration.h>
#include <blond/utilities.h>
#include <vector>

enum particle_type { proton, electron, user_input, none };

class API GeneralParameters {
class API GeneralParameters {

private:
void eta_generation();
Expand Down
4 changes: 1 addition & 3 deletions include/blond/input_parameters/RfParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
#ifndef INPUT_PARAMETERS_RFPARAMETERS_H_
#define INPUT_PARAMETERS_RFPARAMETERS_H_

class RfParameters;

#include <blond/beams/Beams.h>
#include <blond/input_parameters/GeneralParameters.h>
//#include <algorithm>
//#include <iterator>

class API RfParameters {
class API RfParameters {
public:
enum accelerating_systems_t { as_single, all, first };

Expand Down
2 changes: 1 addition & 1 deletion include/blond/llrf/LHCNoiseFB.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <blond/utilities.h>
#include <functional>

class API LHCNoiseFB {
class API LHCNoiseFB {
private:
static const ftype cfwhm;
public:
Expand Down
10 changes: 5 additions & 5 deletions include/blond/llrf/PhaseLoop.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <blond/llrf/PhaseNoise.h>
#include <blond/utilities.h>

class API PhaseLoop {
class API PhaseLoop {
public:
virtual void track(){};
void default_track();
Expand All @@ -40,7 +40,7 @@ class API PhaseLoop {
virtual ~PhaseLoop(){};
};

class API LHC : public PhaseLoop {
class API LHC : public PhaseLoop {
private:
public:
ftype gain2;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions include/blond/llrf/PhaseNoise.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <blond/configuration.h>
#include <blond/globals.h>

class PhaseNoise {
class API PhaseNoise {
private:

public:
Expand Down Expand Up @@ -55,7 +55,7 @@ class PhaseNoise {
};


class LHCFlatSpectrum : public PhaseNoise {
class API LHCFlatSpectrum : public PhaseNoise {
private:

public:
Expand All @@ -74,7 +74,7 @@ class LHCFlatSpectrum : public PhaseNoise {
};


class PSBPhaseNoiseInjection : public PhaseNoise {
class API PSBPhaseNoiseInjection : public PhaseNoise {
private:

public:
Expand Down
4 changes: 2 additions & 2 deletions include/blond/math_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
namespace mymath {


class API Ham {
class API Ham {
private:
std::vector<uint> _H, _hp, _hv, _x;

Expand Down Expand Up @@ -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;
}
Expand Down
Loading

0 comments on commit 772d97c

Please sign in to comment.