1
0
Fork 0
mirror of https://github.com/cosmo-sims/MUSIC.git synced 2024-09-19 17:03:46 +02:00

added new option "gadget_cell_centered=yes/no" to enable half-cell shift for gadget particle positions

This commit is contained in:
Oliver Hahn 2013-03-21 22:09:59 +01:00
parent edb2dce773
commit 7e69a43036

View file

@ -24,6 +24,7 @@ public:
bool do_baryons_;
double omegab_;
double gamma_;
bool shift_halfcell_;
protected:
@ -756,6 +757,8 @@ public:
blongids_ = cf.getValueSafe<bool>("output","gadget_longids",false);
shift_halfcell_ = cf.getValueSafe<bool>("output","gadget_cell_centered",false);
//if( nfiles_ < (int)ceil((double)npart/(double)npartmax_) )
// LOGWARN("Should use more files.");
@ -955,6 +958,14 @@ public:
shift[2] = -(double)cf_.getValue<int>( "setup", "shift_z" )*h;
}
*/
if( shift_halfcell_ )
{
double h = 1.0/(1<<(levelmin_+1));
shift = new double[3];
shift[0] = shift[1] = shift[2] = -h;
}
size_t npart = npfine+npcoarse;
size_t nwritten = 0;
@ -1213,6 +1224,13 @@ public:
shift[2] = -(double)cf_.getValue<int>( "setup", "shift_z" )*h;
}*/
if( shift_halfcell_ )
{
double h = 1.0/(1<<(levelmin_+1));
shift = new double[3];
shift[0] = shift[1] = shift[2] = -h;
}
size_t npart = gh.count_leaf_cells(gh.levelmin(), gh.levelmax());;
size_t nwritten = 0;