mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-04 23:31:12 +00:00
Merged
This commit is contained in:
commit
5b8a97d170
69 changed files with 13326 additions and 310 deletions
|
@ -1,6 +1,9 @@
|
|||
#include <cmath>
|
||||
#include <CosmoTool/loadSimu.hpp>
|
||||
#include "simulation_loader.hpp"
|
||||
#ifdef SDF_SUPPORT
|
||||
#include "sdfloader_internal.hpp"
|
||||
#endif
|
||||
|
||||
using std::min;
|
||||
using namespace CosmoTool;
|
||||
|
@ -39,3 +42,45 @@ void SimulationLoader::applyTransformations(SimuData *s)
|
|||
redshift_gravity*s->Vel[redshift_axis][i]/100.;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SimulationLoader::basicPreprocessing(SimuData *d,
|
||||
SimulationPreprocessor *preproc)
|
||||
{
|
||||
if (preproc == 0)
|
||||
return;
|
||||
|
||||
long numAccepted = 0;
|
||||
bool *accepted = new bool[d->NumPart];
|
||||
for (long i = 0; i < d->NumPart; i++)
|
||||
{
|
||||
SingleParticle p;
|
||||
|
||||
for (int k = 0; k < 3; k++)
|
||||
{
|
||||
p.Pos[k] = (d->Pos[k]) ? 0 : d->Pos[k][i];
|
||||
p.Vel[k] = (d->Vel[k]) ? 0 : d->Vel[k][i];
|
||||
}
|
||||
p.ID = (d->Id) ? 0 : d->Id[i];
|
||||
|
||||
accepted[i] = preproc->accept(p);
|
||||
numAccepted += accepted[i];
|
||||
}
|
||||
|
||||
for (int k = 0; k < 3; k++)
|
||||
{
|
||||
filteredCopy(d->Pos[k], accepted, d->NumPart);
|
||||
filteredCopy(d->Vel[k], accepted, d->NumPart);
|
||||
}
|
||||
filteredCopy(d->Id, accepted, d->NumPart);
|
||||
filteredCopy(d->type, accepted, d->NumPart);
|
||||
d->NumPart = accepted;
|
||||
delete[] accepted;
|
||||
}
|
||||
|
||||
void simulationLoadersInit(int& argc, char **& argv)
|
||||
{
|
||||
#ifdef SDF_SUPPORT
|
||||
sdfLoaderInit(argc, argv);
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue