Commit 16c75948 authored by snuverink_j's avatar snuverink_j
Browse files

fixes for compilation on Mac with clang

parent e4becf25
......@@ -60,14 +60,18 @@ if ( ${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel" )
add_compile_options (-openmp)
endif ()
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
elseif (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
add_compile_options (-Werror -Wsign-compare -Wunused-variable -Warray-bounds)
# Increase template depth for boost
add_compile_options (-ftemplate-depth=1024)
# Allow overloaded virtual functions (instances to be fixed in OPAL)
add_compile_options (-Wno-overloaded-virtual)
add_definitions(-DIPPL_RESTRICT_BUG)
if (ENABLE_OpenMP)
add_compile_options (-fopenmp)
endif ()
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
elseif (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
if (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "4.7.3")
message (FATAL_ERROR "To build OPAL you need GCC version 4.7.3 or greater")
endif ()
......@@ -116,7 +120,7 @@ find_package (Boost
if (Boost_INCLUDE_DIRS)
if (${Boost_VERSION} VERSION_LESS 106000)
message (FATAL_ERROR
"Found Boost library is to old; required is version 1.60.0 or newer!")
"Found Boost library is too old; required is version 1.60.0 or newer!")
endif ()
message ("Found Boost include dir: ${Boost_INCLUDE_DIR}")
message ("Found Boost library dir: ${Boost_LIBRARY_DIR}")
......
......@@ -313,7 +313,7 @@ int LOMB_class::moment(std::vector<LOMB_TYPE> *indata, double *ave, double *adev
s = ((*p).x - *ave);
ep += s * (*p).y;
*adev = *adev + (double)abs((double)s);
*adev = *adev + (double)std::abs((double)s);
pnr = s * s;
*var += pnr * (*p).y;
......
......@@ -141,7 +141,7 @@ Vector_t MultipoleT::rotateFrameInverse(Vector_t &B) {
}
bool MultipoleT::insideAperture(const Vector_t &R) {
if (abs(R[1]) <= verticalApert_m / 2. && abs(R[0]) <= horizApert_m / 2.) {
if (std::abs(R[1]) <= verticalApert_m / 2. && std::abs(R[0]) <= horizApert_m / 2.) {
return true;
}
else {
......@@ -168,12 +168,12 @@ Vector_t MultipoleT::transformCoords(const Vector_t &R) {
// point along the trajectory
double deltaAlpha, S = 0.0, localRadius;
double stepSize = varStep_m; // mm -> has a big effect on tracking time
if (abs(R[2]) <= stepSize) {
if (std::abs(R[2]) <= stepSize) {
return R; // no transformation around origin
}
Y = R;
Vector_t temp;
while (abs(Y[2]) > stepSize and getRadius(S) != -1) {
while (std::abs(Y[2]) > stepSize and getRadius(S) != -1) {
localRadius = getRadius(S);
deltaAlpha = stepSize / localRadius;
if (R[2] < 0) {
......
......@@ -731,9 +731,9 @@ size_t PartBunchBase<T, Dim>::calcNumPartsOutside(Vector_t x) {
const Vector_t meanR = get_rmean();
for(unsigned long k = 0; k < getLocalNum(); ++ k)
if (abs(R[k](0) - meanR(0)) > x(0) ||
abs(R[k](1) - meanR(1)) > x(1) ||
abs(R[k](2) - meanR(2)) > x(2)) {
if (std::abs(R[k](0) - meanR(0)) > x(0) ||
std::abs(R[k](1) - meanR(1)) > x(1) ||
std::abs(R[k](2) - meanR(2)) > x(2)) {
++localnum;
}
......@@ -924,9 +924,9 @@ void PartBunchBase<T, Dim>::boundp_destroy() {
/* delete the particle if the ditance to the beam center
* is larger than 8 times of beam's rms size
*/
if (abs(R[ii](0) - rmean_m(0)) > checkfactor * rrms_m[0] ||
abs(R[ii](1) - rmean_m(1)) > checkfactor * rrms_m[1] ||
abs(R[ii](2) - rmean_m(2)) > checkfactor * rrms_m[2])
if (std::abs(R[ii](0) - rmean_m(0)) > checkfactor * rrms_m[0] ||
std::abs(R[ii](1) - rmean_m(1)) > checkfactor * rrms_m[1] ||
std::abs(R[ii](2) - rmean_m(2)) > checkfactor * rrms_m[2])
{
// put particle onto deletion list
destroy(1, ii);
......@@ -948,8 +948,8 @@ void PartBunchBase<T, Dim>::boundp_destroy() {
/* delete the particle if the ditance to the beam center
* is larger than 8 times of beam's rms size
*/
if (abs(R[ii](0) - rmean_m(0)) > checkfactor * rrms_m[0] ||
abs(R[ii](2) - rmean_m(2)) > checkfactor * rrms_m[2])
if (std::abs(R[ii](0) - rmean_m(0)) > checkfactor * rrms_m[0] ||
std::abs(R[ii](2) - rmean_m(2)) > checkfactor * rrms_m[2])
{
// put particle onto deletion list
destroy(1, ii);
......
......@@ -52,7 +52,7 @@ Quaternion getQuaternion(Vector_t u, Vector_t ref)
axis(0) = sqrt(1 - u*u) * cos(v);
axis(1) = sqrt(1 - u*u) * sin(v);
axis(2) = u;
} while(abs(dot(axis, ref)) > 0.9);
} while(std::abs(dot(axis, ref)) > 0.9);
axis -= dot(axis, ref) * ref;
axis = normalize(axis);
......
......@@ -1215,7 +1215,7 @@ void DataSink::writeImpactStatistics(PartBunchBase<double, 3> *beam, long long &
setInform(fid);
fid.precision(6);
fid << setiosflags(std::ios::scientific);
fid << std::setiosflags(std::ios::scientific);
double t = beam->getT() * 1.0e9;
if(!nEmissionMode) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment