mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-04 15:21:11 +00:00
Added Gadget2 support (untested!)
This commit is contained in:
parent
ef3139d886
commit
90fd74d907
4 changed files with 17 additions and 11 deletions
|
@ -695,7 +695,11 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
else if (args_info.gadget_given)
|
else if (args_info.gadget_given)
|
||||||
{
|
{
|
||||||
loader = gadgetLoader(args_info.gadget_arg, 1/args_info.gadgetUnit_arg, NEED_POSITION|NEED_VELOCITY|NEED_GADGET_ID, preselector);
|
loader = gadgetLoader(args_info.gadget_arg, 1/args_info.gadgetUnit_arg, NEED_POSITION|NEED_VELOCITY|NEED_GADGET_ID, 1, preselector);
|
||||||
|
}
|
||||||
|
else if (args_info.gadget2_given)
|
||||||
|
{
|
||||||
|
loader = gadgetLoader(args_info.gadget_arg, 1/args_info.gadgetUnit_arg, NEED_POSITION|NEED_VELOCITY|NEED_GADGET_ID, 2, preselector);
|
||||||
}
|
}
|
||||||
else if (args_info.flash_given)
|
else if (args_info.flash_given)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,7 @@ option "ramsesBase" - "Base directory for ramses" string optional
|
||||||
option "ramsesId" - "Ramses snapshot id" int optional
|
option "ramsesId" - "Ramses snapshot id" int optional
|
||||||
|
|
||||||
option "gadget" - "Base name of gadget snapshot (without parallel writing extension)" string optional
|
option "gadget" - "Base name of gadget snapshot (without parallel writing extension)" string optional
|
||||||
|
option "gadget2" - "Base name of gadget snapshot (version 2, without parallel writing extension)" string optional
|
||||||
option "flash" - "Base name for FLASH snapshot" string optional
|
option "flash" - "Base name for FLASH snapshot" string optional
|
||||||
option "multidark" - "Base name for multidark snapshot" string optional
|
option "multidark" - "Base name for multidark snapshot" string optional
|
||||||
|
|
||||||
|
|
|
@ -36,12 +36,13 @@ private:
|
||||||
bool onefile;
|
bool onefile;
|
||||||
int _num_files;
|
int _num_files;
|
||||||
double unitMpc;
|
double unitMpc;
|
||||||
|
int gadgetFormat;
|
||||||
SimuData *gadget_header;
|
SimuData *gadget_header;
|
||||||
string snapshot_name;
|
string snapshot_name;
|
||||||
SimulationPreprocessor *preproc;
|
SimulationPreprocessor *preproc;
|
||||||
public:
|
public:
|
||||||
GadgetLoader(const string& basename, SimuData *header, int flags, bool singleFile, int _num, double unit, SimulationPreprocessor *p)
|
GadgetLoader(const string& basename, SimuData *header, int flags, bool singleFile, int _num, double unit, int gadgetFormat, SimulationPreprocessor *p)
|
||||||
: snapshot_name(basename), load_flags(flags), onefile(singleFile), _num_files(_num), unitMpc(1/unit), gadget_header(header), preproc(p)
|
: snapshot_name(basename), load_flags(flags), onefile(singleFile), _num_files(_num), unitMpc(1/unit), gadget_header(header), gadgetFormat(gadgetFormat), preproc(p)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,9 +68,9 @@ public:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (onefile)
|
if (onefile)
|
||||||
d = loadGadgetMulti(snapshot_name.c_str(), -1, load_flags);
|
d = loadGadgetMulti(snapshot_name.c_str(), -1, load_flags, gadgetFormat);
|
||||||
else
|
else
|
||||||
d = loadGadgetMulti(snapshot_name.c_str(), id, load_flags);
|
d = loadGadgetMulti(snapshot_name.c_str(), id, load_flags, gadgetFormat);
|
||||||
|
|
||||||
if (d->Id != 0)
|
if (d->Id != 0)
|
||||||
{
|
{
|
||||||
|
@ -99,7 +100,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
SimulationLoader *gadgetLoader(const std::string& snapshot, double Mpc_unitLength, int flags, SimulationPreprocessor *p)
|
SimulationLoader *gadgetLoader(const std::string& snapshot, double Mpc_unitLength, int flags, int gadgetFormat, SimulationPreprocessor *p)
|
||||||
{
|
{
|
||||||
bool singleFile = false;
|
bool singleFile = false;
|
||||||
int num_files;
|
int num_files;
|
||||||
|
@ -109,7 +110,7 @@ SimulationLoader *gadgetLoader(const std::string& snapshot, double Mpc_unitLengt
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
d = loadGadgetMulti(snapshot.c_str(), -1, 0);
|
d = loadGadgetMulti(snapshot.c_str(), -1, 0, gadgetFormat);
|
||||||
singleFile = true;
|
singleFile = true;
|
||||||
num_files = 1;
|
num_files = 1;
|
||||||
}
|
}
|
||||||
|
@ -117,7 +118,7 @@ SimulationLoader *gadgetLoader(const std::string& snapshot, double Mpc_unitLengt
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
d = loadGadgetMulti(snapshot.c_str(), 0, 0);
|
d = loadGadgetMulti(snapshot.c_str(), 0, 0, gadgetFormat);
|
||||||
num_files = 0;
|
num_files = 0;
|
||||||
}
|
}
|
||||||
catch(const NoSuchFileException& e)
|
catch(const NoSuchFileException& e)
|
||||||
|
@ -135,7 +136,7 @@ SimulationLoader *gadgetLoader(const std::string& snapshot, double Mpc_unitLengt
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
while ((d = loadGadgetMulti(snapshot.c_str(), num_files, 0)) != 0)
|
while ((d = loadGadgetMulti(snapshot.c_str(), num_files, 0, gadgetFormat)) != 0)
|
||||||
{
|
{
|
||||||
num_files++;
|
num_files++;
|
||||||
delete d;
|
delete d;
|
||||||
|
@ -146,5 +147,5 @@ SimulationLoader *gadgetLoader(const std::string& snapshot, double Mpc_unitLengt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new GadgetLoader(snapshot, header, flags, singleFile, num_files, Mpc_unitLength, p);
|
return new GadgetLoader(snapshot, header, flags, singleFile, num_files, Mpc_unitLength, gadgetFormat, p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ void delete_adaptor(void *ptr)
|
||||||
|
|
||||||
|
|
||||||
// Unit length is the size of one Mpc in the simulation units
|
// Unit length is the size of one Mpc in the simulation units
|
||||||
SimulationLoader *gadgetLoader(const std::string& snapshot, double Mpc_unitLength, int flags, SimulationPreprocessor *p);
|
SimulationLoader *gadgetLoader(const std::string& snapshot, double Mpc_unitLength, int flags, int gadgetFormat, SimulationPreprocessor *p);
|
||||||
SimulationLoader *flashLoader(const std::string& snapshot, int flags, SimulationPreprocessor *p);
|
SimulationLoader *flashLoader(const std::string& snapshot, int flags, SimulationPreprocessor *p);
|
||||||
SimulationLoader *multidarkLoader(const std::string& snapshot, SimulationPreprocessor *p);
|
SimulationLoader *multidarkLoader(const std::string& snapshot, SimulationPreprocessor *p);
|
||||||
SimulationLoader *ramsesLoader(const std::string& snapshot, int baseid, bool double_precision, int flags, SimulationPreprocessor *p);
|
SimulationLoader *ramsesLoader(const std::string& snapshot, int baseid, bool double_precision, int flags, SimulationPreprocessor *p);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue