Commit 5fe9de79 authored by snuverink_j's avatar snuverink_j
Browse files

fix clang compiler errors in IPPL tests; add CacheTest to CMake

parent af23c0b3
......@@ -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;
}
......
......@@ -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);
......
......@@ -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;
......
......@@ -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:
......
......@@ -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) {
......
......@@ -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
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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
......
......@@ -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
......@@ -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]);
......
......@@ -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]);
......
......@@ -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]);
......
......@@ -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]);
......
......@@ -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]);
......
......@@ -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++) {
......
......@@ -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;
......
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