Skip to content
Snippets Groups Projects
Commit 6898434e authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

get rid of a whole bunch of warnings

parent acf97948
Branches
Tags
No related merge requests found
......@@ -137,14 +137,14 @@ void distributed_particles<particle_type, rnumber, interp_neighbours>::redistrib
int rsrc, rdst;
/* get list of id-s to send */
for (auto &pp: x)
for (int i=0; i<2; i++)
for (unsigned int i=0; i<2; i++)
if (this->vel->get_rank(pp.second.data[2]) == nr[i])
ps[i].push_back(pp.first);
/* prepare data for send recv */
for (int i=0; i<2; i++)
for (unsigned int i=0; i<2; i++)
nps[i] = ps[i].size();
for (rsrc = 0; rsrc<this->nprocs; rsrc++)
for (int i=0; i<2; i++)
for (unsigned int i=0; i<2; i++)
{
rdst = MOD(rsrc+ro[i], this->nprocs);
if (this->myrank == rsrc)
......@@ -167,7 +167,7 @@ void distributed_particles<particle_type, rnumber, interp_neighbours>::redistrib
}
//DEBUG_MSG("I have to send %d %d particles\n", nps[0], nps[1]);
//DEBUG_MSG("I have to recv %d %d particles\n", npr[0], npr[1]);
for (int i=0; i<2; i++)
for (unsigned int i=0; i<2; i++)
pr[i].resize(npr[i]);
int buffer_size = (nps[0] > nps[1]) ? nps[0] : nps[1];
......@@ -176,7 +176,7 @@ void distributed_particles<particle_type, rnumber, interp_neighbours>::redistrib
//DEBUG_MSG("buffer size is %d\n", buffer_size);
double *buffer = new double[buffer_size*state_dimension(particle_type)*(1+vals.size())];
for (rsrc = 0; rsrc<this->nprocs; rsrc++)
for (int i=0; i<2; i++)
for (unsigned int i=0; i<2; i++)
{
rdst = MOD(rsrc+ro[i], this->nprocs);
if (this->myrank == rsrc && nps[i] > 0)
......@@ -195,7 +195,7 @@ void distributed_particles<particle_type, rnumber, interp_neighbours>::redistrib
x[p].data + state_dimension(particle_type),
buffer + pcounter*(1+vals.size())*state_dimension(particle_type));
x.erase(p);
for (int tindex=0; tindex<vals.size(); tindex++)
for (unsigned int tindex=0; tindex<vals.size(); tindex++)
{
std::copy(vals[tindex][p].data,
vals[tindex][p].data + state_dimension(particle_type),
......@@ -230,11 +230,11 @@ void distributed_particles<particle_type, rnumber, interp_neighbours>::redistrib
2*(rsrc*this->nprocs + rdst)+1,
this->comm,
MPI_STATUS_IGNORE);
int pcounter = 0;
unsigned int pcounter = 0;
for (int p: pr[1-i])
{
x[p] = buffer + (pcounter*(1+vals.size()))*state_dimension(particle_type);
for (int tindex=0; tindex<vals.size(); tindex++)
for (unsigned int tindex=0; tindex<vals.size(); tindex++)
{
vals[tindex][p] = buffer + (pcounter*(1+vals.size()) + tindex+1)*state_dimension(particle_type);
}
......@@ -267,7 +267,7 @@ void distributed_particles<particle_type, rnumber, interp_neighbours>::AdamsBash
{
this->get_rhs(this->state, this->rhs[0]);
for (auto &pp: this->state)
for (int i=0; i<state_dimension(particle_type); i++)
for (unsigned int i=0; i<state_dimension(particle_type); i++)
switch(nsteps)
{
case 1:
......@@ -323,7 +323,7 @@ template <particle_types particle_type, class rnumber, int interp_neighbours>
void distributed_particles<particle_type, rnumber, interp_neighbours>::read()
{
double *temp = new double[this->chunk_size*state_dimension(particle_type)];
for (int cindex=0; cindex<this->get_number_of_chunks(); cindex++)
for (unsigned int cindex=0; cindex<this->get_number_of_chunks(); cindex++)
{
//read state
if (this->myrank == 0)
......@@ -334,7 +334,7 @@ void distributed_particles<particle_type, rnumber, interp_neighbours>::read()
MPI_DOUBLE,
0,
this->comm);
for (int p=0; p<this->chunk_size; p++)
for (unsigned int p=0; p<this->chunk_size; p++)
{
if (this->vel->get_rank(temp[state_dimension(particle_type)*p+2]) == this->myrank)
this->state[p+cindex*this->chunk_size] = temp + state_dimension(particle_type)*p;
......@@ -351,7 +351,7 @@ void distributed_particles<particle_type, rnumber, interp_neighbours>::read()
MPI_DOUBLE,
0,
this->comm);
for (int p=0; p<this->chunk_size; p++)
for (unsigned int p=0; p<this->chunk_size; p++)
{
auto pp = this->state.find(p+cindex*this->chunk_size);
if (pp != this->state.end())
......@@ -370,10 +370,10 @@ void distributed_particles<particle_type, rnumber, interp_neighbours>::write(
{
double *data = new double[this->nparticles*3];
double *yy = new double[this->nparticles*3];
for (int cindex=0; cindex<this->get_number_of_chunks(); cindex++)
for (unsigned int cindex=0; cindex<this->get_number_of_chunks(); cindex++)
{
std::fill_n(yy, this->chunk_size*3, 0);
for (int p=0; p<this->chunk_size; p++)
for (unsigned int p=0; p<this->chunk_size; p++)
{
auto pp = y.find(p+cindex*this->chunk_size);
if (pp != y.end())
......@@ -401,11 +401,11 @@ void distributed_particles<particle_type, rnumber, interp_neighbours>::write(
{
double *temp0 = new double[this->chunk_size*state_dimension(particle_type)];
double *temp1 = new double[this->chunk_size*state_dimension(particle_type)];
for (int cindex=0; cindex<this->get_number_of_chunks(); cindex++)
for (unsigned int cindex=0; cindex<this->get_number_of_chunks(); cindex++)
{
//write state
std::fill_n(temp0, state_dimension(particle_type)*this->chunk_size, 0);
for (int p=0; p<this->chunk_size; p++)
for (unsigned int p=0; p<this->chunk_size; p++)
{
auto pp = this->state.find(p + cindex*this->chunk_size);
if (pp != this->state.end())
......@@ -427,7 +427,7 @@ void distributed_particles<particle_type, rnumber, interp_neighbours>::write(
for (int i=0; i<this->integration_steps; i++)
{
std::fill_n(temp0, state_dimension(particle_type)*this->chunk_size, 0);
for (int p=0; p<this->chunk_size; p++)
for (unsigned int p=0; p<this->chunk_size; p++)
{
auto pp = this->rhs[i].find(p + cindex*this->chunk_size);
if (pp != this->rhs[i].end())
......
......@@ -54,7 +54,7 @@ double fluid_solver_base<rnumber>::autocorrel(cnumber *a)
double sum_local;
this->cospectrum(a, a, spec);
sum_local = 0.0;
for (int n = 0; n < this->nshells; n++)
for (unsigned int n = 0; n < this->nshells; n++)
{
sum_local += spec[n*9] + spec[n*9 + 4] + spec[n*9 + 8];
}
......
......@@ -106,16 +106,16 @@ void particles<particle_type, rnumber, interp_neighbours>::AdamsBashforth(
switch(nsteps)
{
case 1:
for (int p=0; p<this->nparticles; p++)
for (int i=0; i<state_dimension(particle_type); i++)
for (unsigned int p=0; p<this->nparticles; p++)
for (unsigned int i=0; i<state_dimension(particle_type); i++)
{
ii = p*state_dimension(particle_type)+i;
this->state[ii] += this->dt*this->rhs[0][ii];
}
break;
case 2:
for (int p=0; p<this->nparticles; p++)
for (int i=0; i<state_dimension(particle_type); i++)
for (unsigned int p=0; p<this->nparticles; p++)
for (unsigned int i=0; i<state_dimension(particle_type); i++)
{
ii = p*state_dimension(particle_type)+i;
this->state[ii] += this->dt*(3*this->rhs[0][ii]
......@@ -123,8 +123,8 @@ void particles<particle_type, rnumber, interp_neighbours>::AdamsBashforth(
}
break;
case 3:
for (int p=0; p<this->nparticles; p++)
for (int i=0; i<state_dimension(particle_type); i++)
for (unsigned int p=0; p<this->nparticles; p++)
for (unsigned int i=0; i<state_dimension(particle_type); i++)
{
ii = p*state_dimension(particle_type)+i;
this->state[ii] += this->dt*(23*this->rhs[0][ii]
......@@ -133,8 +133,8 @@ void particles<particle_type, rnumber, interp_neighbours>::AdamsBashforth(
}
break;
case 4:
for (int p=0; p<this->nparticles; p++)
for (int i=0; i<state_dimension(particle_type); i++)
for (unsigned int p=0; p<this->nparticles; p++)
for (unsigned int i=0; i<state_dimension(particle_type); i++)
{
ii = p*state_dimension(particle_type)+i;
this->state[ii] += this->dt*(55*this->rhs[0][ii]
......@@ -144,8 +144,8 @@ void particles<particle_type, rnumber, interp_neighbours>::AdamsBashforth(
}
break;
case 5:
for (int p=0; p<this->nparticles; p++)
for (int i=0; i<state_dimension(particle_type); i++)
for (unsigned int p=0; p<this->nparticles; p++)
for (unsigned int i=0; i<state_dimension(particle_type); i++)
{
ii = p*state_dimension(particle_type)+i;
this->state[ii] += this->dt*(1901*this->rhs[0][ii]
......@@ -156,8 +156,8 @@ void particles<particle_type, rnumber, interp_neighbours>::AdamsBashforth(
}
break;
case 6:
for (int p=0; p<this->nparticles; p++)
for (int i=0; i<state_dimension(particle_type); i++)
for (unsigned int p=0; p<this->nparticles; p++)
for (unsigned int i=0; i<state_dimension(particle_type); i++)
{
ii = p*state_dimension(particle_type)+i;
this->state[ii] += this->dt*(4277*this->rhs[0][ii]
......@@ -187,7 +187,7 @@ template <particle_types particle_type, class rnumber, int interp_neighbours>
void particles<particle_type, rnumber, interp_neighbours>::read()
{
if (this->myrank == 0)
for (int cindex=0; cindex<this->get_number_of_chunks(); cindex++)
for (unsigned int cindex=0; cindex<this->get_number_of_chunks(); cindex++)
{
this->read_state_chunk(cindex, this->state+cindex*this->chunk_size*state_dimension(particle_type));
if (this->iteration > 0)
......@@ -215,7 +215,7 @@ void particles<particle_type, rnumber, interp_neighbours>::write(
const bool write_rhs)
{
if (this->myrank == 0)
for (int cindex=0; cindex<this->get_number_of_chunks(); cindex++)
for (unsigned int cindex=0; cindex<this->get_number_of_chunks(); cindex++)
{
this->write_state_chunk(cindex, this->state+cindex*this->chunk_size*state_dimension(particle_type));
if (write_rhs)
......@@ -232,7 +232,7 @@ void particles<particle_type, rnumber, interp_neighbours>::sample(
double *y = new double[this->nparticles*3];
field->sample(this->nparticles, state_dimension(particle_type), this->state, y);
if (this->myrank == 0)
for (int cindex=0; cindex<this->get_number_of_chunks(); cindex++)
for (unsigned int cindex=0; cindex<this->get_number_of_chunks(); cindex++)
this->write_point3D_chunk(dset_name, cindex, y+cindex*this->chunk_size*3);
delete[] y;
}
......
......@@ -135,7 +135,7 @@ particles_io_base<particle_type>::particles_io_base(
H5Sget_simple_extent_dims(dspace, &this->hdf5_state_dims.front(), NULL);
assert(this->hdf5_state_dims[this->hdf5_state_dims.size()-1] == state_dimension(particle_type));
this->nparticles = 1;
for (int i=1; i<this->hdf5_state_dims.size()-1; i++)
for (unsigned int i=1; i<this->hdf5_state_dims.size()-1; i++)
this->nparticles *= this->hdf5_state_dims[i];
prop_list = H5Dget_create_plist(dset);
this->hdf5_state_chunks.resize(this->hdf5_state_dims.size());
......@@ -144,7 +144,7 @@ particles_io_base<particle_type>::particles_io_base(
H5Sclose(dspace);
H5Dclose(dset);
this->chunk_size = 1;
for (auto i=1; i<this->hdf5_state_dims.size()-1; i++)
for (unsigned int i=1; i<this->hdf5_state_dims.size()-1; i++)
this->chunk_size *= this->hdf5_state_chunks[i];
dset = H5Dopen(this->hdf5_group_id, "rhs", H5P_DEFAULT);
dspace = H5Dget_space(dset);
......@@ -230,7 +230,7 @@ void particles_io_base<particle_type>::read_state_chunk(
NULL);
hsize_t *offset = new hsize_t[this->hdf5_state_dims.size()];
offset[0] = this->iteration / this->traj_skip;
for (int i=1; i<this->hdf5_state_dims.size()-1; i++)
for (unsigned int i=1; i<this->hdf5_state_dims.size()-1; i++)
offset[i] = this->chunk_offsets[cindex][i-1];
offset[this->hdf5_state_dims.size()-1] = 0;
H5Sselect_hyperslab(
......@@ -263,7 +263,7 @@ void particles_io_base<particle_type>::write_state_chunk(
NULL);
hsize_t *offset = new hsize_t[this->hdf5_state_dims.size()];
offset[0] = this->iteration / this->traj_skip;
for (int i=1; i<this->hdf5_state_dims.size()-1; i++)
for (unsigned int i=1; i<this->hdf5_state_dims.size()-1; i++)
offset[i] = this->chunk_offsets[cindex][i-1];
offset[this->hdf5_state_dims.size()-1] = 0;
H5Sselect_hyperslab(
......@@ -299,7 +299,7 @@ void particles_io_base<particle_type>::read_rhs_chunk(
hsize_t *offset = new hsize_t[this->hdf5_rhs_dims.size()];
offset[0] = this->hdf5_rhs_dims[0]-1;
offset[1] = rhsindex;
for (int i=2; i<this->hdf5_rhs_dims.size()-1; i++)
for (unsigned int i=2; i<this->hdf5_rhs_dims.size()-1; i++)
offset[i] = this->chunk_offsets[cindex][i-2];
offset[this->hdf5_rhs_dims.size()-1] = 0;
//for (int i=0; i<this->hdf5_rhs_dims.size(); i++)
......@@ -340,7 +340,7 @@ void particles_io_base<particle_type>::write_rhs_chunk(
hsize_t *offset = new hsize_t[this->hdf5_rhs_dims.size()];
offset[0] = this->hdf5_rhs_dims[0];
offset[1] = rhsindex;
for (int i=2; i<this->hdf5_rhs_dims.size()-1; i++)
for (unsigned int i=2; i<this->hdf5_rhs_dims.size()-1; i++)
offset[i] = this->chunk_offsets[cindex][i-2];
offset[this->hdf5_rhs_dims.size()-1] = 0;
DEBUG_MSG("rhs write offsets are %d %d %d %d\n",
......@@ -376,7 +376,7 @@ void particles_io_base<particle_type>::write_point3D_chunk(
NULL);
hsize_t *offset = new hsize_t[this->hdf5_state_dims.size()];
offset[0] = this->iteration / this->traj_skip;
for (int i=1; i<this->hdf5_state_dims.size()-1; i++)
for (unsigned int i=1; i<this->hdf5_state_dims.size()-1; i++)
offset[i] = this->chunk_offsets[cindex][i-1];
offset[this->hdf5_state_dims.size()-1] = 0;
H5Sselect_hyperslab(
......
......@@ -77,10 +77,10 @@ class particles_io_base
int myrank, nprocs;
MPI_Comm comm;
int nparticles;
unsigned int nparticles;
std::string name;
int chunk_size;
unsigned int chunk_size;
int traj_skip;
hid_t hdf5_group_id;
......
......@@ -272,7 +272,7 @@ void rFFTW_distributed_particles<particle_type, rnumber, interp_neighbours>::red
{
// remove the particle from the local list
x.erase(p);
for (int i=0; i<vals.size(); i++)
for (unsigned int i=0; i<vals.size(); i++)
vals[i].erase(p);
}
// if the particle is in the local domain, do nothing
......@@ -351,7 +351,7 @@ void rFFTW_distributed_particles<particle_type, rnumber, interp_neighbours>::red
std::copy(x[p].data,
x[p].data + state_dimension(particle_type),
buffer + pcounter*(1+vals.size())*state_dimension(particle_type));
for (int tindex=0; tindex<vals.size(); tindex++)
for (unsigned int tindex=0; tindex<vals.size(); tindex++)
{
std::copy(vals[tindex][p].data,
vals[tindex][p].data + state_dimension(particle_type),
......@@ -390,7 +390,7 @@ void rFFTW_distributed_particles<particle_type, rnumber, interp_neighbours>::red
{
x[p] = buffer + (pcounter*(1+vals.size()))*state_dimension(particle_type);
newdp[1-i].insert(p);
for (int tindex=0; tindex<vals.size(); tindex++)
for (unsigned int tindex=0; tindex<vals.size(); tindex++)
{
vals[tindex][p] = buffer + (pcounter*(1+vals.size()) + tindex+1)*state_dimension(particle_type);
}
......@@ -426,7 +426,7 @@ void rFFTW_distributed_particles<particle_type, rnumber, interp_neighbours>::Ada
{
this->get_rhs(this->state, this->domain_particles, this->rhs[0]);
for (auto &pp: this->state)
for (int i=0; i<state_dimension(particle_type); i++)
for (unsigned int i=0; i<state_dimension(particle_type); i++)
switch(nsteps)
{
case 1:
......@@ -523,7 +523,7 @@ void rFFTW_distributed_particles<particle_type, rnumber, interp_neighbours>::rea
{
double *temp = new double[this->chunk_size*state_dimension(particle_type)];
int tmpint1, tmpint2;
for (int cindex=0; cindex<this->get_number_of_chunks(); cindex++)
for (unsigned int cindex=0; cindex<this->get_number_of_chunks(); cindex++)
{
//read state
if (this->myrank == 0)
......@@ -534,7 +534,7 @@ void rFFTW_distributed_particles<particle_type, rnumber, interp_neighbours>::rea
MPI_DOUBLE,
0,
this->comm);
for (int p=0; p<this->chunk_size; p++)
for (unsigned int p=0; p<this->chunk_size; p++)
{
if (this->vel->get_rank_info(temp[state_dimension(particle_type)*p+2], tmpint1, tmpint2))
{
......@@ -553,7 +553,7 @@ void rFFTW_distributed_particles<particle_type, rnumber, interp_neighbours>::rea
MPI_DOUBLE,
0,
this->comm);
for (int p=0; p<this->chunk_size; p++)
for (unsigned int p=0; p<this->chunk_size; p++)
{
auto pp = this->state.find(p+cindex*this->chunk_size);
if (pp != this->state.end())
......@@ -578,10 +578,10 @@ void rFFTW_distributed_particles<particle_type, rnumber, interp_neighbours>::wri
double *data = new double[this->nparticles*3];
double *yy = new double[this->nparticles*3];
int pindex = 0;
for (int cindex=0; cindex<this->get_number_of_chunks(); cindex++)
for (unsigned int cindex=0; cindex<this->get_number_of_chunks(); cindex++)
{
std::fill_n(yy, this->chunk_size*3, 0);
for (int p=0; p<this->chunk_size; p++, pindex++)
for (unsigned int p=0; p<this->chunk_size; p++, pindex++)
{
if (this->domain_particles[-1].find(pindex) != this->domain_particles[-1].end() ||
this->domain_particles[ 0].find(pindex) != this->domain_particles[ 0].end())
......@@ -612,12 +612,12 @@ void rFFTW_distributed_particles<particle_type, rnumber, interp_neighbours>::wri
double *temp0 = new double[this->chunk_size*state_dimension(particle_type)];
double *temp1 = new double[this->chunk_size*state_dimension(particle_type)];
int pindex = 0;
for (int cindex=0; cindex<this->get_number_of_chunks(); cindex++)
for (unsigned int cindex=0; cindex<this->get_number_of_chunks(); cindex++)
{
//write state
std::fill_n(temp0, state_dimension(particle_type)*this->chunk_size, 0);
pindex = cindex*this->chunk_size;
for (int p=0; p<this->chunk_size; p++, pindex++)
for (unsigned int p=0; p<this->chunk_size; p++, pindex++)
{
if (this->domain_particles[-1].find(pindex) != this->domain_particles[-1].end() ||
this->domain_particles[ 0].find(pindex) != this->domain_particles[ 0].end())
......@@ -642,7 +642,7 @@ void rFFTW_distributed_particles<particle_type, rnumber, interp_neighbours>::wri
{
std::fill_n(temp0, state_dimension(particle_type)*this->chunk_size, 0);
pindex = cindex*this->chunk_size;
for (int p=0; p<this->chunk_size; p++, pindex++)
for (unsigned int p=0; p<this->chunk_size; p++, pindex++)
{
if (this->domain_particles[-1].find(pindex) != this->domain_particles[-1].end() ||
this->domain_particles[ 0].find(pindex) != this->domain_particles[ 0].end())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment