From 5fe9de79602918bdab3c3402d00aed9e175a9b25 Mon Sep 17 00:00:00 2001 From: Jochem Snuverink <jochem.snuverink@psi.ch> Date: Fri, 17 Apr 2020 09:43:24 +0200 Subject: [PATCH] fix clang compiler errors in IPPL tests; add CacheTest to CMake --- ippl/src/Field/BCond.hpp | 2 +- ippl/src/Particle/CellParticleCachingPolicy.h | 4 +- ippl/test/FFT/TestFFT.cpp | 4 +- ippl/test/PwrSpec/testPwrSpec.cpp | 11 +---- ippl/test/parallel/volley.cpp | 2 +- ippl/test/particle/CMakeLists.txt | 14 ++++-- ippl/test/particle/CacheTest.cpp | 34 ++++++-------- ippl/test/particle/ChargedParticleFactory.hpp | 4 +- ippl/test/particle/PIC3d.cpp | 1 - ippl/test/particle/chsr-1.cpp | 47 +------------------ ippl/test/particle/p3m3d.cpp | 13 +++-- ippl/test/particle/p3m3dHeating.cpp | 28 ++++++----- ippl/test/particle/p3m3dMicrobunching.cpp | 30 +++++++----- ippl/test/particle/p3m3dRegressionTests.cpp | 30 +++++++----- ippl/test/particle/p3m3dTwoStreamParallel.cpp | 19 +++++--- ippl/test/particle/salman-1.cpp | 7 +-- ippl/test/particle/test-scatter-1.cpp | 22 ++++----- 17 files changed, 120 insertions(+), 152 deletions(-) diff --git a/ippl/src/Field/BCond.hpp b/ippl/src/Field/BCond.hpp index f969e9bed..8d35fdbde 100644 --- a/ippl/src/Field/BCond.hpp +++ b/ippl/src/Field/BCond.hpp @@ -5777,7 +5777,7 @@ LinearExtrapolateFaceBCApply2(const NDIndex<D> &dest, // Couldn't figure out how to use BrickExpression here. Just iterate through // all the elements in all 3 LField iterators (which are BrickIterators) and // do the calculation one element at a time: - for ( ; lhs != endi, rhs1 != endi, rhs2 != endi; + for ( ; lhs != endi && rhs1 != endi && rhs2 != endi; ++lhs, ++rhs1, ++rhs2) { *lhs = (*rhs2 - *rhs1)*slopeMultipplier + *rhs1; } diff --git a/ippl/src/Particle/CellParticleCachingPolicy.h b/ippl/src/Particle/CellParticleCachingPolicy.h index b626064ef..b771b250d 100644 --- a/ippl/src/Particle/CellParticleCachingPolicy.h +++ b/ippl/src/Particle/CellParticleCachingPolicy.h @@ -33,7 +33,7 @@ public: ParticleSpatialLayout<T, Dim, Mesh, C > &PLayout ) { - for(int d = 0;d<Dim;++d) + for(unsigned int d = 0;d<Dim;++d) BoxParticleCachingPolicy<T,Dim,Mesh>::setCacheDimension(d, cells[d]*PLayout.getLayout().getMesh().get_meshSpacing(d)); BoxParticleCachingPolicy<T,Dim,Mesh>:: updateCacheInformation(PLayout); @@ -45,7 +45,7 @@ public: ParticleSpatialLayout<T, Dim, Mesh, C > &PLayout ) { - for(int d = 0;d<Dim;++d) + for(unsigned int d = 0;d<Dim;++d) BoxParticleCachingPolicy<T,Dim,Mesh>::setCacheDimension(d, cells[d]*PLayout.getLayout().getMesh().get_meshSpacing(d)); BoxParticleCachingPolicy<T,Dim,Mesh>::updateGhostParticles(PData, PLayout); diff --git a/ippl/test/FFT/TestFFT.cpp b/ippl/test/FFT/TestFFT.cpp index 9cd8f8202..c0554e3f7 100644 --- a/ippl/test/FFT/TestFFT.cpp +++ b/ippl/test/FFT/TestFFT.cpp @@ -310,8 +310,8 @@ int main(int argc, char *argv[]) IpplTimings::startTimer(fInitTimer); // Rather more complete test functions (sine or cosine mode): - std::complex<double> sfact(1.0,0.0); // (1,0) for sine mode; (0,0) for cosine mode - std::complex<double> cfact(0.0,0.0); // (0,0) for sine mode; (1,0) for cosine mode + // std::complex<double> sfact(1.0,0.0); // (1,0) for sine mode; (0,0) for cosine mode + // std::complex<double> cfact(0.0,0.0); // (0,0) for sine mode; (1,0) for cosine mode /* double xfact, kx, yfact, ky, zfact, kz; diff --git a/ippl/test/PwrSpec/testPwrSpec.cpp b/ippl/test/PwrSpec/testPwrSpec.cpp index 9ed7e2d05..7773851cf 100644 --- a/ippl/test/PwrSpec/testPwrSpec.cpp +++ b/ippl/test/PwrSpec/testPwrSpec.cpp @@ -56,19 +56,15 @@ enum BC_t {OOO,OOP,PPP}; enum InterPol_t {NGP,CIC}; const double pi = acos(-1.0); -const double qmmax = 1.0; // maximum value for particle q/m -const double dt = 1.0; // size of timestep class ChargedParticles : public IpplParticleBase<playout_t> { public: - ChargedParticles(playout_t* pl, BC_t bc, Vector_t hr, Vector_t rmin, Vector_t rmax, e_dim_tag decomp[Dim], bool gCells) : + ChargedParticles(playout_t* pl, BC_t /*bc*/, Vector_t hr, Vector_t rmin, Vector_t rmax, e_dim_tag decomp[Dim], bool /*gCells*/) : IpplParticleBase<playout_t>(pl), hr_m(hr), rmin_m(rmin), - rmax_m(rmax), - bco_m(bc), - withGuardCells_m(gCells) + rmax_m(rmax) { setupBCs(); for(unsigned int i=0; i<Dim; i++) @@ -170,9 +166,6 @@ private: Vector_t rmin_m; Vector_t rmax_m; - BC_t bco_m; - - bool withGuardCells_m; e_dim_tag decomp_m[Dim]; public: diff --git a/ippl/test/parallel/volley.cpp b/ippl/test/parallel/volley.cpp index 175e16674..0d8d52550 100644 --- a/ippl/test/parallel/volley.cpp +++ b/ippl/test/parallel/volley.cpp @@ -30,7 +30,7 @@ int main(int argc, char *argv[]) { Message *msg; int mynode = ippl.myNode(); char recbuf[128]; - int recint; + int recint = 0; int sendtag = 80; if (mynode == 0) { diff --git a/ippl/test/particle/CMakeLists.txt b/ippl/test/particle/CMakeLists.txt index f747e7fce..01fc81cf4 100644 --- a/ippl/test/particle/CMakeLists.txt +++ b/ippl/test/particle/CMakeLists.txt @@ -26,10 +26,6 @@ if (ENABLE_DKS) endif () -set_source_files_properties(SOURCE PIC3d.cpp p3m3d.cpp - PROPERTY COMPILE_FLAGS - -fno-tree-vrp) - add_executable (PIC3d PIC3d.cpp) target_link_libraries ( PIC3d @@ -38,6 +34,16 @@ target_link_libraries ( boost_timer ) +add_executable (CacheTest CacheTest.cpp) +target_link_libraries ( + CacheTest + ${IPPL_LIBS} + ${H5Hut_LIBRARY} + ${HDF5_LIBRARIES} + ${MPI_CXX_LIBRARIES} + boost_timer +) + add_executable (p3m3dHeating p3m3dHeating.cpp) target_link_libraries ( p3m3dHeating diff --git a/ippl/test/particle/CacheTest.cpp b/ippl/test/particle/CacheTest.cpp index 61da3551b..07198a5d8 100644 --- a/ippl/test/particle/CacheTest.cpp +++ b/ippl/test/particle/CacheTest.cpp @@ -27,6 +27,7 @@ Example: #include "mpi.h" // dimension of our positions +#define DIM 2 const unsigned Dim = 2; // some typedefs @@ -38,9 +39,6 @@ typedef Cell Center_t; typedef CenteredFieldLayout<Dim, Mesh_t, Center_t> FieldLayout_t; typedef Field<double, Dim, Mesh_t, Center_t> Field_t; -const double qmmax = 1.0; // maximum value for particle q/m -const double dt = 1.0; // size of timestep - template<class PL> class ChargedParticles : public IpplParticleBase<PL> { public: @@ -54,11 +52,11 @@ public: withGuardCells_m(gCells) { this->addAttribute(qm); - for(int i = 0; i < 2 * Dim; i++) { + for(unsigned int i = 0; i < 2 * Dim; i++) { bc_m[i] = new ParallelPeriodicFace<double, Dim, Mesh_t, Center_t>(i); this->getBConds()[i] = ParticlePeriodicBCond;//ParticleNoBCond;// } - for(int i = 0; i < Dim; i++) + for(unsigned int i = 0; i < Dim; i++) decomp_m[i] = decomp[i]; getMesh().set_meshSpacing(&(hr_m[0])); @@ -82,11 +80,11 @@ public: bool checkParticles() { Inform msg("CheckParticles", INFORM_ALL_NODES); bool ok = true; - int i = 0; + unsigned int i = 0; NDRegion<double, Dim> region = getLocalRegion(); for(; i < this->getLocalNum(); ++i) { NDRegion<double, Dim> ppos; - for(int d = 0; d < Dim; ++d) + for(unsigned int d = 0; d < Dim; ++d) ppos[d] = PRegion<double>(this->R[i][d], this->R[i][d]); if(!region.contains(ppos)) { @@ -97,7 +95,7 @@ public: } for(; i < this->getLocalNum() + this->getGhostNum(); ++i) { NDRegion<double, Dim> ppos; - for(int d = 0; d < Dim; ++d) + for(unsigned int d = 0; d < Dim; ++d) ppos[d] = PRegion<double>(this->R[i][d], this->R[i][d]); if(region.contains(ppos)) { @@ -148,14 +146,12 @@ int main(int argc, char *argv[]) { Vektor<int, Dim> nr; - unsigned param = 1; - - if(Dim == 3) { - nr = Vektor<int, Dim>(atoi(argv[param++]), atoi(argv[param++]), atoi(argv[param++])); - } else { - nr = Vektor<int, Dim>(atoi(argv[param++]), atoi(argv[param++])); - - } + // need to use preprocessor to prevent clang compiler error +#if DIM == 3 + nr = Vektor<int, Dim>(atoi(argv[1]), atoi(argv[2]), atoi(argv[3])); +#else + nr = Vektor<int, Dim>(atoi(argv[1]), atoi(argv[2])); +#endif e_dim_tag decomp[Dim]; Mesh_t *mesh; @@ -163,10 +159,10 @@ int main(int argc, char *argv[]) { ChargedParticles<playout_t> *P; NDIndex<Dim> domain; - for(int i = 0; i < Dim; i++) + for(unsigned int i = 0; i < Dim; i++) domain[i] = domain[i] = Index(nr[i]); - for(int d = 0; d < Dim; ++d) + for(unsigned int d = 0; d < Dim; ++d) decomp[d] = PARALLEL; // create mesh and layout objects for this problem domain @@ -206,7 +202,7 @@ int main(int argc, char *argv[]) { unsigned expected_particles = P->getLocalRegion().volume(); unsigned expected_ghosts = 16; - for(int d = 0; d < Dim; ++d) { + for(unsigned int d = 0; d < Dim; ++d) { expected_ghosts += P->getLocalRegion()[d].length() * 4; } diff --git a/ippl/test/particle/ChargedParticleFactory.hpp b/ippl/test/particle/ChargedParticleFactory.hpp index 196a0fec6..a1e079a90 100644 --- a/ippl/test/particle/ChargedParticleFactory.hpp +++ b/ippl/test/particle/ChargedParticleFactory.hpp @@ -561,7 +561,7 @@ std::cout<< P->beta0 << std::endl; template<typename Particles> -void createParticleDistributionEquiPart(Particles & P, Vektor<double,3> extend_l, Vektor<double,3> extend_r, double beam_length, double part_density,double qi, double mi, int seed=0) { +void createParticleDistributionEquiPart(Particles & P, Vektor<double,3> /*extend_l*/, Vektor<double,3> /*extend_r*/, double beam_length, double part_density,double qi, double mi, int seed=0) { std::cout << "Initializing Equipartitioning" << std::endl; P->total_charge=0; const double c = 299792458000; @@ -595,7 +595,7 @@ void createParticleDistributionEquiPart(Particles & P, Vektor<double,3> extend_l } template<typename Particles> -void createParticleDistributionEquiPartSphere(Particles & P, Vektor<double,3> extend_l, Vektor<double,3> extend_r, double beam_length, unsigned Nparts,double qi, double mi, int seed=0) { +void createParticleDistributionEquiPartSphere(Particles & P, Vektor<double,3> /*extend_l*/, Vektor<double,3> /*extend_r*/, double beam_length, unsigned Nparts,double qi, double mi, int seed=0) { std::cout << "Initializing Equipartitioning Sphere" << std::endl; P->total_charge=0; const double c = 299792458000; diff --git a/ippl/test/particle/PIC3d.cpp b/ippl/test/particle/PIC3d.cpp index a724f3ee4..9385229fc 100644 --- a/ippl/test/particle/PIC3d.cpp +++ b/ippl/test/particle/PIC3d.cpp @@ -52,7 +52,6 @@ enum BC_t {OOO,OOP,PPP}; enum InterPol_t {NGP,CIC}; const double pi = acos(-1.0); -const double qmmax = 1.0; // maximum value for particle q/m const double dt = 1.0; // size of timestep diff --git a/ippl/test/particle/chsr-1.cpp b/ippl/test/particle/chsr-1.cpp index bad671cca..1aa6692d4 100644 --- a/ippl/test/particle/chsr-1.cpp +++ b/ippl/test/particle/chsr-1.cpp @@ -13,21 +13,6 @@ * ***************************************************************************/ -// -*- C++ -*- -/*************************************************************************** - * - * The IPPL Framework - * - * This program was prepared by PSI. - * All rights in the program are reserved by PSI. - * Neither PSI nor the author(s) - * makes any warranty, express or implied, or assumes any liability or - * responsibility for the use of this software - * - * Visit http://www.acl.lanl.gov/POOMS for more details - * - ***************************************************************************/ - /*************************************************************************** Hi Court and Rui I follow up on discussions at the AAC 2002 @@ -62,7 +47,6 @@ typedef ParticleSpatialLayout<T,Dim> playout_t; int n; -const T pi = acos(-1.0); const T fMax = 1.0; // maximum value for f @@ -130,33 +114,4 @@ int main(int argc, char *argv[]){ Ippl::Comm->barrier(); msg << "done ...." << endl; return 0; -} - - - - - - - - - - - - - - - - - - - - - - - -/*************************************************************************** - * $RCSfile: addheaderfooter,v $ $Author: adelmann $ - * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:17 $ - * IPPL_VERSION_ID: $Id: addheaderfooter,v 1.1.1.1 2003/01/23 07:40:17 adelmann Exp $ - ***************************************************************************/ - +} \ No newline at end of file diff --git a/ippl/test/particle/p3m3d.cpp b/ippl/test/particle/p3m3d.cpp index f440f3ef6..e4df6a369 100644 --- a/ippl/test/particle/p3m3d.cpp +++ b/ippl/test/particle/p3m3d.cpp @@ -164,11 +164,7 @@ public: } - void calculatePairForces(double interaction_radius) - { - HashPairBuilder< ChargedParticles<playout_t> > HPB(*this); - HPB.for_each(RadiusCondition<double, Dim>(interaction_radius), ApplyField<double>(-1,interaction_radius)); - } + void calculatePairForces(double interaction_radius); //setup and use the FFT solver void calculateGridForces(double interaction_radius) @@ -438,6 +434,13 @@ struct ApplyField { double R; }; +template<class PL> +void ChargedParticles<PL>::calculatePairForces(double interaction_radius) +{ + HashPairBuilder< ChargedParticles<playout_t> > HPB(*this); + HPB.for_each(RadiusCondition<double, Dim>(interaction_radius), ApplyField<double>(-1,interaction_radius)); +} + int main(int argc, char *argv[]){ Ippl ippl(argc, argv); Inform msg(argv[0]); diff --git a/ippl/test/particle/p3m3dHeating.cpp b/ippl/test/particle/p3m3dHeating.cpp index 0fd50514a..217251023 100644 --- a/ippl/test/particle/p3m3dHeating.cpp +++ b/ippl/test/particle/p3m3dHeating.cpp @@ -382,18 +382,7 @@ public: } - void calculatePairForces(double interaction_radius, double eps, double alpha) { - if (interaction_radius>0){ - if (Ippl::getNodes() > 1) { - HashPairBuilderPeriodicParallel< ChargedParticles<playout_t> > HPB(*this); - HPB.for_each(RadiusCondition<double, Dim>(interaction_radius), ApplyField<double>(-1,interaction_radius,eps,alpha),extend_l, extend_r); - } - else { - HashPairBuilderPeriodic< ChargedParticles<playout_t> > HPB(*this); - HPB.for_each(RadiusCondition<double, Dim>(interaction_radius), ApplyField<double>(-1,interaction_radius,eps,alpha),extend_l, extend_r); - } - } - } + void calculatePairForces(double interaction_radius, double eps, double alpha); void calculateGridForces(double /*interaction_radius*/, double alpha, double eps, int /*it*/=0, bool /*normalizeSphere*/=0) { // (1) scatter charge to charge density grid and transform to fourier space @@ -613,6 +602,21 @@ struct ApplyField { double a; }; +template<class PL> +void ChargedParticles<PL>::calculatePairForces(double interaction_radius, double eps, double alpha) +{ + if (interaction_radius>0){ + if (Ippl::getNodes() > 1) { + HashPairBuilderPeriodicParallel< ChargedParticles<playout_t> > HPB(*this); + HPB.for_each(RadiusCondition<double, Dim>(interaction_radius), ApplyField<double>(-1,interaction_radius,eps,alpha),extend_l, extend_r); + } + else { + HashPairBuilderPeriodic< ChargedParticles<playout_t> > HPB(*this); + HPB.for_each(RadiusCondition<double, Dim>(interaction_radius), ApplyField<double>(-1,interaction_radius,eps,alpha),extend_l, extend_r); + } + } +} + int main(int argc, char *argv[]){ Ippl ippl(argc, argv); Inform msg(argv[0]); diff --git a/ippl/test/particle/p3m3dMicrobunching.cpp b/ippl/test/particle/p3m3dMicrobunching.cpp index 662cfe223..5251efda6 100644 --- a/ippl/test/particle/p3m3dMicrobunching.cpp +++ b/ippl/test/particle/p3m3dMicrobunching.cpp @@ -392,18 +392,7 @@ class ChargedParticles : public IpplParticleBase<PL> { eps6x6_normalized_m = eps6x6_m*actual_gamma*beta0; } - void calculatePairForces(double interaction_radius, double eps, double alpha) { - if (interaction_radius>0){ - if (Ippl::getNodes() > 1) { - HashPairBuilderPeriodicParallel< ChargedParticles<playout_t> > HPB(*this); - HPB.for_each(RadiusCondition<double, Dim>(interaction_radius), ApplyField<double>(-1,interaction_radius,eps,alpha,ke),extend_l, extend_r); - } - else { - HashPairBuilderPeriodic< ChargedParticles<playout_t> > HPB(*this); - HPB.for_each(RadiusCondition<double, Dim>(interaction_radius), ApplyField<double>(-1,interaction_radius,eps,alpha,ke),extend_l, extend_r); - } - } - } + void calculatePairForces(double interaction_radius, double eps, double alpha); void calculateGridForces(double /*interaction_radius*/, double alpha, double eps, int /*it*/=0) { // (1) scatter charge to charge density grid and transform to fourier space @@ -604,6 +593,23 @@ struct ApplyField { double ke; }; + +template<class PL> +void ChargedParticles<PL>::calculatePairForces(double interaction_radius, double eps, double alpha) +{ + if (interaction_radius>0){ + if (Ippl::getNodes() > 1) { + HashPairBuilderPeriodicParallel< ChargedParticles<playout_t> > HPB(*this); + HPB.for_each(RadiusCondition<double, Dim>(interaction_radius), ApplyField<double>(-1,interaction_radius,eps,alpha,ke),extend_l, extend_r); + } + else { + HashPairBuilderPeriodic< ChargedParticles<playout_t> > HPB(*this); + HPB.for_each(RadiusCondition<double, Dim>(interaction_radius), ApplyField<double>(-1,interaction_radius,eps,alpha,ke),extend_l, extend_r); + } + } +} + + int main(int argc, char *argv[]){ Ippl ippl(argc, argv); Inform msg(argv[0]); diff --git a/ippl/test/particle/p3m3dRegressionTests.cpp b/ippl/test/particle/p3m3dRegressionTests.cpp index 60f3a31e1..13a96311c 100644 --- a/ippl/test/particle/p3m3dRegressionTests.cpp +++ b/ippl/test/particle/p3m3dRegressionTests.cpp @@ -322,18 +322,7 @@ class ChargedParticles : public IpplParticleBase<PL> { } - void calculatePairForces(double interaction_radius, double eps, double alpha) { - if (interaction_radius>0){ - if (Ippl::getNodes() > 1) { - HashPairBuilderPeriodicParallel< ChargedParticles<playout_t> > HPB(*this); - HPB.for_each(RadiusCondition<double, Dim>(interaction_radius), ApplyField<double>(-1,interaction_radius,eps,alpha),extend_l, extend_r); - } - else { - HashPairBuilderPeriodic< ChargedParticles<playout_t> > HPB(*this); - HPB.for_each(RadiusCondition<double, Dim>(interaction_radius), ApplyField<double>(-1,interaction_radius,eps,alpha),extend_l, extend_r); - } - } - } + void calculatePairForces(double interaction_radius, double eps, double alpha); //compute Greens function without making use of index computations void calcGrealSpace(double alpha, double eps) { @@ -565,6 +554,23 @@ struct ApplyField { double a; }; + +template<class PL> +void ChargedParticles<PL>::calculatePairForces(double interaction_radius, double eps, double alpha) +{ + if (interaction_radius>0){ + if (Ippl::getNodes() > 1) { + HashPairBuilderPeriodicParallel< ChargedParticles<playout_t> > HPB(*this); + HPB.for_each(RadiusCondition<double, Dim>(interaction_radius), ApplyField<double>(-1,interaction_radius,eps,alpha),extend_l, extend_r); + } + else { + HashPairBuilderPeriodic< ChargedParticles<playout_t> > HPB(*this); + HPB.for_each(RadiusCondition<double, Dim>(interaction_radius), ApplyField<double>(-1,interaction_radius,eps,alpha),extend_l, extend_r); + } + } +} + + int main(int argc, char *argv[]){ Ippl ippl(argc, argv); Inform msg(argv[0]); diff --git a/ippl/test/particle/p3m3dTwoStreamParallel.cpp b/ippl/test/particle/p3m3dTwoStreamParallel.cpp index 5b80f2f73..772001ca9 100644 --- a/ippl/test/particle/p3m3dTwoStreamParallel.cpp +++ b/ippl/test/particle/p3m3dTwoStreamParallel.cpp @@ -282,13 +282,7 @@ class ChargedParticles : public IpplParticleBase<PL> { } - void calculatePairForces(double interaction_radius, double eps, double alpha) - { - if (interaction_radius>0){ - HashPairBuilderPeriodicParallel< ChargedParticles<playout_t> > HPB(*this); - HPB.for_each(RadiusCondition<double, Dim>(interaction_radius), ApplyField<double>(-1,interaction_radius,eps,alpha),extend_l, extend_r); - } - } + void calculatePairForces(double interaction_radius, double eps, double alpha); //compute Greens function without making use of index computations void calcGrealSpace(double alpha, double eps) { @@ -547,6 +541,17 @@ struct ApplyField { double a; }; + +template<class PL> +void ChargedParticles<PL>::calculatePairForces(double interaction_radius, double eps, double alpha) +{ + if (interaction_radius>0){ + HashPairBuilderPeriodicParallel< ChargedParticles<playout_t> > HPB(*this); + HPB.for_each(RadiusCondition<double, Dim>(interaction_radius), ApplyField<double>(-1,interaction_radius,eps,alpha),extend_l, extend_r); + } +} + + int main(int argc, char *argv[]){ Ippl ippl(argc, argv); Inform msg(argv[0]); diff --git a/ippl/test/particle/salman-1.cpp b/ippl/test/particle/salman-1.cpp index 24a5752d6..50ab9cf0b 100644 --- a/ippl/test/particle/salman-1.cpp +++ b/ippl/test/particle/salman-1.cpp @@ -56,10 +56,6 @@ typedef IntNGP IntrplNGP_t; enum BC_t {OOO,OOP,PPP}; enum InterPol_t {NGP,CIC}; -const double pi = acos(-1.0); -const double qmmax = 1.0; // maximum value for particle q/m -const double dt = 1.0; // size of timestep - using namespace std; template<class PL> @@ -177,8 +173,7 @@ public: void setRMin(Vector_t x) { rmin_m = x; } void setHr(Vector_t x) { hr_m = x; } - void savePhaseSpace(string fn, int idx) { - } + void savePhaseSpace(string /*fn*/, int /*idx*/) {} inline void setBCAllPeriodic() { for (unsigned int i=0; i < 2*Dim; i++) { diff --git a/ippl/test/particle/test-scatter-1.cpp b/ippl/test/particle/test-scatter-1.cpp index 965fdf59d..5e226797b 100644 --- a/ippl/test/particle/test-scatter-1.cpp +++ b/ippl/test/particle/test-scatter-1.cpp @@ -25,6 +25,7 @@ Example: using namespace std; // dimension of our positions +#define DIM 2 const unsigned Dim = 2; // some typedefs @@ -38,8 +39,6 @@ typedef IntCIC IntrplCIC_t; typedef IntNGP IntrplNGP_t; enum InterPol_t {NGP,CIC}; -const double qmmax = 1.0; // maximum value for particle q/m -const double dt = 1.0; // size of timestep template<class PL> class ChargedParticles : public IpplParticleBase<PL> { @@ -131,15 +130,16 @@ int main(int argc, char *argv[]){ Vektor<int,Dim> nr; InterPol_t myInterpol; - if(Dim == 3) { - nr = Vektor<int,Dim>(atoi(argv[1]),atoi(argv[2]),atoi(argv[3])); - if (string(argv[4])==string("CIC")) myInterpol = CIC; - else myInterpol = NGP; - } else { - nr = Vektor<int,Dim>(atoi(argv[1]),atoi(argv[2])); - if (string(argv[3])==string("CIC")) myInterpol = CIC; - else myInterpol = NGP; - } + // need to use preprocessor to prevent clang compiler error +#if DIM == 3 + nr = Vektor<int,Dim>(atoi(argv[1]),atoi(argv[2]),atoi(argv[3])); + if (string(argv[4])==string("CIC")) myInterpol = CIC; + else myInterpol = NGP; +#else + nr = Vektor<int,Dim>(atoi(argv[1]),atoi(argv[2])); + if (string(argv[3])==string("CIC")) myInterpol = CIC; + else myInterpol = NGP; +#endif e_dim_tag decomp[Dim]; Mesh_t *mesh; -- GitLab