mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-04 23:31:12 +00:00
Moved subsampling to the loaders to be able to do online subsampling (only implemented for gadget and multidark so far, the other coming in...)
This commit is contained in:
parent
ecb4479178
commit
5cf7a94538
9 changed files with 330 additions and 34 deletions
|
@ -1,8 +1,34 @@
|
|||
#include <cmath>
|
||||
#include <CosmoTool/loadSimu.hpp>
|
||||
#include "simulation_loader.hpp"
|
||||
|
||||
using std::min;
|
||||
using namespace CosmoTool;
|
||||
|
||||
template<typename T> void reallocArray(T *& a, long newSize, long toCopy)
|
||||
{
|
||||
T *b = new T[newSize];
|
||||
if (a != 0)
|
||||
{
|
||||
memcpy(b, a, sizeof(T)*toCopy);
|
||||
delete[] a;
|
||||
}
|
||||
a = b;
|
||||
}
|
||||
|
||||
void SimulationLoader::reallocSimu(SimuData *s, long newNumPart)
|
||||
{
|
||||
long to_copy = min(newNumPart, s->NumPart);
|
||||
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
reallocArray(s->Pos[j], newNumPart, to_copy);
|
||||
reallocArray(s->Vel[j], newNumPart, to_copy);
|
||||
}
|
||||
reallocArray(s->Id, newNumPart, to_copy);
|
||||
reallocArray(s->type, newNumPart, to_copy);
|
||||
}
|
||||
|
||||
void SimulationLoader::applyTransformations(SimuData *s)
|
||||
{
|
||||
float redshift_gravity = do_redshift ? 1.0 : 0.0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue