mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-04 23:31:12 +00:00
Opportunity to change the unit of gadget file
This commit is contained in:
parent
4e89f5eb2c
commit
bd3e494732
2 changed files with 13 additions and 2 deletions
|
@ -18,6 +18,8 @@ using namespace CosmoTool;
|
|||
|
||||
#define LIGHT_SPEED 299792.458
|
||||
|
||||
static double gadgetUnit=1e-3;
|
||||
|
||||
SimuData *doLoadRamses(const char *basename, int baseid, int velAxis, bool goRedshift)
|
||||
{
|
||||
SimuData *d, *outd;
|
||||
|
@ -65,7 +67,13 @@ SimuData *doLoadRamses(const char *basename, int baseid, int velAxis, bool goRed
|
|||
|
||||
SimuData *myLoadGadget(const char *fname, int id, int flags)
|
||||
{
|
||||
return loadGadgetMulti(fname, id, flags);
|
||||
SimuData *sim = loadGadgetMulti(fname, id, flags);
|
||||
sim->BoxSize *= gadgetUnit;
|
||||
for (int j = 0; j < 3; j++)
|
||||
for (long i = 0; i < sim->NumPart; i++)
|
||||
sim->Pos[j][i] *= gadgetUnit;
|
||||
|
||||
return sim;
|
||||
}
|
||||
|
||||
SimuData *doLoadSimulation(const char *gadgetname, int velAxis, bool goRedshift, SimuData *(*loadFunction)(const char *fname, int id, int flags))
|
||||
|
@ -490,6 +498,8 @@ int main(int argc, char **argv)
|
|||
|
||||
generateMock_conf_print_version();
|
||||
|
||||
gadgetUnit=args_info.gadgetUnit_arg;
|
||||
|
||||
if (args_info.ramsesBase_given || args_info.ramsesId_given)
|
||||
{
|
||||
if (args_info.ramsesBase_given && args_info.ramsesId_given)
|
||||
|
|
|
@ -29,4 +29,5 @@ option "cosmo" - "Apply cosmological redshift" flag on
|
|||
|
||||
option "subsample" - "Subsample the input simulation by the specified amount" double optional
|
||||
|
||||
option "inputParameter" - "Input geometry (optional, warning!)" string optional
|
||||
option "inputParameter" - "Input geometry (optional, warning!)" string optional
|
||||
option "gadgetUnit" - "Unit of length in gadget file in Mpc/h" double optional default="0.001"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue