mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-05 07:41:11 +00:00
Correct scaling factor for particle positions
This commit is contained in:
parent
dbec582fca
commit
a969852064
2 changed files with 39 additions and 38 deletions
|
@ -9,37 +9,6 @@ bool loadParticleInfo(ParticleInfo& info,
|
||||||
const std::string& particles,
|
const std::string& particles,
|
||||||
const std::string& extra_info)
|
const std::string& extra_info)
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
UnformattedRead f(particles);
|
|
||||||
|
|
||||||
int numpart;
|
|
||||||
|
|
||||||
f.beginCheckpoint();
|
|
||||||
numpart = f.readInt32();
|
|
||||||
f.endCheckpoint();
|
|
||||||
|
|
||||||
info.particles.resize(numpart);
|
|
||||||
|
|
||||||
f.beginCheckpoint();
|
|
||||||
for (int i = 0; i < numpart; i++)
|
|
||||||
info.particles[i].x = f.readReal32();
|
|
||||||
f.endCheckpoint();
|
|
||||||
|
|
||||||
f.beginCheckpoint();
|
|
||||||
for (int i = 0; i < numpart; i++)
|
|
||||||
info.particles[i].y = f.readReal32();
|
|
||||||
f.endCheckpoint();
|
|
||||||
|
|
||||||
f.beginCheckpoint();
|
|
||||||
for (int i = 0; i < numpart; i++)
|
|
||||||
info.particles[i].z = f.readReal32();
|
|
||||||
f.endCheckpoint();
|
|
||||||
}
|
|
||||||
catch (const NoSuchFileException& e)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
NcFile f_info(extra_info.c_str());
|
NcFile f_info(extra_info.c_str());
|
||||||
|
|
||||||
|
@ -53,5 +22,44 @@ bool loadParticleInfo(ParticleInfo& info,
|
||||||
info.ranges[2][0] = f_info.get_att("range_z_min")->as_double(0);
|
info.ranges[2][0] = f_info.get_att("range_z_min")->as_double(0);
|
||||||
info.ranges[2][1] = f_info.get_att("range_z_max")->as_double(0);
|
info.ranges[2][1] = f_info.get_att("range_z_max")->as_double(0);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
UnformattedRead f(particles);
|
||||||
|
|
||||||
|
int numpart;
|
||||||
|
float mul, offset;
|
||||||
|
|
||||||
|
f.beginCheckpoint();
|
||||||
|
numpart = f.readInt32();
|
||||||
|
f.endCheckpoint();
|
||||||
|
|
||||||
|
info.particles.resize(numpart);
|
||||||
|
|
||||||
|
offset = info.ranges[0][0];
|
||||||
|
mul = info.ranges[0][1] - info.ranges[0][0];
|
||||||
|
f.beginCheckpoint();
|
||||||
|
for (int i = 0; i < numpart; i++)
|
||||||
|
info.particles[i].x = info.ranges[0][0] + mul*f.readReal32();
|
||||||
|
f.endCheckpoint();
|
||||||
|
|
||||||
|
offset = info.ranges[0][0];
|
||||||
|
mul = info.ranges[0][1] - info.ranges[0][0];
|
||||||
|
f.beginCheckpoint();
|
||||||
|
for (int i = 0; i < numpart; i++)
|
||||||
|
info.particles[i].y = f.readReal32();
|
||||||
|
f.endCheckpoint();
|
||||||
|
|
||||||
|
offset = info.ranges[0][0];
|
||||||
|
mul = info.ranges[0][1] - info.ranges[0][0];
|
||||||
|
f.beginCheckpoint();
|
||||||
|
for (int i = 0; i < numpart; i++)
|
||||||
|
info.particles[i].z = f.readReal32();
|
||||||
|
f.endCheckpoint();
|
||||||
|
}
|
||||||
|
catch (const NoSuchFileException& e)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,13 +181,6 @@ public:
|
||||||
int p = lookupParent(i, voids_for_zones);
|
int p = lookupParent(i, voids_for_zones);
|
||||||
if ((i % 1000) == 0) std::cout << i << std::endl;
|
if ((i % 1000) == 0) std::cout << i << std::endl;
|
||||||
|
|
||||||
if (p < 0)
|
|
||||||
{
|
|
||||||
if (i != 0)
|
|
||||||
std::cerr << "Warning ! Voids without parent and it is not the root !" << std::endl;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
nodes[p].children.push_back(&nodes[i]);
|
nodes[p].children.push_back(&nodes[i]);
|
||||||
nodes[i].parent = &nodes[p];
|
nodes[i].parent = &nodes[p];
|
||||||
inserted++;
|
inserted++;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue