Skip to content

Commit 7500542

Browse files
committed
cxx compiler option + style
1 parent 39efe0a commit 7500542

19 files changed

+84
-178
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
99
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${USER_CXX_FLAGS}")
1010

1111
# find packages
12+
message(STATUS "Configured CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
1213
message(STATUS "Configured CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
1314

1415
find_package(MPI)

build.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#!/bin/sh
2-
3-
source ./config.sh
2+
. ./config.sh
43
mkdir -p build
54
cd build
6-
cmake -DUSER_CXX_FLAGS="${CXX_FLAGS}" ..
5+
cmake -DCMAKE_CXX_COMPILER="${CXX_COMPILER}" -DUSER_CXX_FLAGS="${CXX_FLAGS}" ..
76
make
8-
cd ..

config_template.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/bash
22

3+
#C++ compiler
4+
CXX_COMPILER="g++"
5+
36
# C++ flags
47
CXX_FLAGS="-O3 -flto -Wall -Wno-unused-function"
58

6-
# currently unused:
7-
# C++ compiler
8-
# CXX="g++"

examples/ex1/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// Observable functions
1111
class Parabola: public MCIObservableFunctionInterface{
1212
public:
13-
Parabola(const int &ndim): MCIObservableFunctionInterface(ndim, 1) {}
13+
explicit Parabola(const int &ndim): MCIObservableFunctionInterface(ndim, 1) {}
1414

1515
void observableFunction(const double * in, double * out){
1616
out[0] = 4.*in[0] - in[0]*in[0];
@@ -19,7 +19,7 @@ class Parabola: public MCIObservableFunctionInterface{
1919

2020
class NormalizedParabola: public MCIObservableFunctionInterface{
2121
public:
22-
NormalizedParabola(const int &ndim): MCIObservableFunctionInterface(ndim, 1) {}
22+
explicit NormalizedParabola(const int &ndim): MCIObservableFunctionInterface(ndim, 1) {}
2323

2424
void observableFunction(const double * in, double * out){
2525
out[0] = (4. - in[0]) * 5.;
@@ -33,7 +33,7 @@ class NormalizedParabola: public MCIObservableFunctionInterface{
3333
// the 48 is for normalization (even if not strictly necessary)
3434
class NormalizedLine: public MCISamplingFunctionInterface{
3535
public:
36-
NormalizedLine(const int &ndim): MCISamplingFunctionInterface(ndim, 1) {}
36+
explicit NormalizedLine(const int &ndim): MCISamplingFunctionInterface(ndim, 1) {}
3737

3838
void samplingFunction(const double * in, double * protovalue){
3939
protovalue[0] = 0.2 * abs(in[0]);

examples/ex1/run.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/bin/bash
2-
ORIGDIR=$(pwd)
1+
#!/bin/sh
32
cd ../../build/examples
43
./ex1.exe
5-
cd "${ORIGDIR}"

examples/ex2/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Observable functions
1212
class Parabola: public MCIObservableFunctionInterface{
1313
public:
14-
Parabola(const int &ndim): MCIObservableFunctionInterface(ndim, 1) {}
14+
explicit Parabola(const int &ndim): MCIObservableFunctionInterface(ndim, 1) {}
1515

1616
void observableFunction(const double * in, double * out){
1717
out[0] = 4.*in[0] - in[0]*in[0];
@@ -20,7 +20,7 @@ class Parabola: public MCIObservableFunctionInterface{
2020

2121
class NormalizedParabola: public MCIObservableFunctionInterface{
2222
public:
23-
NormalizedParabola(const int &ndim): MCIObservableFunctionInterface(ndim, 1) {}
23+
explicit NormalizedParabola(const int &ndim): MCIObservableFunctionInterface(ndim, 1) {}
2424

2525
void observableFunction(const double * in, double * out){
2626
out[0] = (4. - in[0]) * 5.;
@@ -34,7 +34,7 @@ class NormalizedParabola: public MCIObservableFunctionInterface{
3434
// the 48 is for normalization (even if not strictly necessary)
3535
class NormalizedLine: public MCISamplingFunctionInterface{
3636
public:
37-
NormalizedLine(const int &ndim): MCISamplingFunctionInterface(ndim, 1) {}
37+
explicit NormalizedLine(const int &ndim): MCISamplingFunctionInterface(ndim, 1) {}
3838

3939
void samplingFunction(const double * in, double * protovalue){
4040
protovalue[0] = 0.2 * abs(in[0]);

examples/ex2/run.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/bin/bash
2-
ORIGDIR=$(pwd)
1+
#!/bin/sh
32
cd ../../build/examples
43
mpirun -np $1 ./ex2.exe
5-
cd "${ORIGDIR}"

include/mci/MCICallBackOnAcceptanceInterface.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class MCICallBackOnAcceptanceInterface
2222
// Call-back function, called if a move is accepted by the MCI Integrator
2323
virtual void callBackFunction(const double *in, const bool flag_observation) = 0;
2424
// ^walker position
25-
2625
};
2726

2827

include/mci/MCIObservableFunctionInterface.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class MCIObservableFunctionInterface
3939
// Compute the observable and store it inside out
4040
virtual void observableFunction(const double * in, double * out) = 0;
4141
// ^input = walker positions ^resulting observables
42-
4342
};
4443

4544

include/mci/MCIntegrator.hpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ class MCI
2121
std::uniform_real_distribution<double> _rd; //after initialization (done in the constructor) can be used with _rd(_rgen)
2222

2323
int _ndim; // number of dimensions
24-
double ** _rrange; // ranges for random initialization
2524
double ** _irange; // integration ranges
2625
double _vol; // Integration volume
2726

@@ -86,13 +85,12 @@ class MCI
8685
void storeWalkerPositions();
8786

8887
public:
89-
MCI(const int & ndim); //Constructor, need the number of dimensions
88+
explicit MCI(const int & ndim); //Constructor, need the number of dimensions
9089
~MCI(); //Destructor
9190

9291
// --- Setters
9392
void setSeed(const uint_fast64_t seed);
9493

95-
void setRRange(const double * const * rrange); // if set, initialize walkers within these bounds on every newRandomX(), else use irange
9694
void setIRange(const double * const * irange); // keep walkers within these bounds during integration (defaults to full range of double floats)
9795

9896
void setX(const double * x);
@@ -118,7 +116,6 @@ class MCI
118116

119117
// --- Getters
120118
int getNDim(){return _ndim;}
121-
double getRRange(const int &i, const int &j){return *(*(_rrange+i)+j);}
122119
double getIRange(const int &i, const int &j){return *(*(_irange+i)+j);}
123120
double getX(const int &i){return *(_xold+i);}
124121
double getMRT2Step(const int &i){return *(_mrt2step+i);}

0 commit comments

Comments
 (0)