mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-04 15:21:11 +00:00
Merge branch 'master' of bitbucket.org:cosmicvoids/void_identification
This commit is contained in:
commit
e43bfe31af
2 changed files with 18 additions and 5 deletions
|
@ -274,7 +274,7 @@ void selectBox(SimuData *simu, std::vector<long>& targets, generateMock_info& ar
|
|||
numAccepted++;
|
||||
}
|
||||
}
|
||||
cout << "Num accepted here = " << numAccepted << " / input = " << simu->NumPart << endl;
|
||||
cout << "SELECTBOX: Num accepted here = " << numAccepted << " / input = " << simu->NumPart << " (after resubsampling)" << endl;
|
||||
}
|
||||
|
||||
class PreselectParticles: public SimulationPreprocessor
|
||||
|
@ -385,7 +385,7 @@ void buildBox(SimuData *simu, long num_targets, long loaded,
|
|||
}
|
||||
}
|
||||
|
||||
void saveBox(SimuData *&boxed, const std::string& outbox)
|
||||
void saveBox(SimuData *&boxed, const std::string& outbox, generateMock_info& args_info)
|
||||
{
|
||||
double *ranges = boxed->as<double>("ranges");
|
||||
NcFile f(outbox.c_str(), NcFile::Replace, 0, 0, NcFile::Netcdf4);
|
||||
|
@ -395,6 +395,11 @@ void saveBox(SimuData *&boxed, const std::string& outbox)
|
|||
int num_snapshots = *boxed->as<int>("num_snapshots");
|
||||
long *uniqueID = boxed->as<long>("uniqueID");
|
||||
|
||||
if (!f.is_valid())
|
||||
{
|
||||
cerr << "Could not create parameter file '" << outbox << "'. Aborting." << endl;
|
||||
exit(1);
|
||||
}
|
||||
f.add_att("range_x_min", ranges[0]);
|
||||
f.add_att("range_x_max", ranges[1]);
|
||||
f.add_att("range_y_min", ranges[2]);
|
||||
|
@ -403,6 +408,7 @@ void saveBox(SimuData *&boxed, const std::string& outbox)
|
|||
f.add_att("range_z_max", ranges[5]);
|
||||
f.add_att("mask_index", -1);
|
||||
f.add_att("is_observation", 0);
|
||||
f.add_att("data_subsampling", args_info.subsample_arg);
|
||||
|
||||
NcDim *NumPart_dim = f.add_dim("numpart_dim", boxed->NumPart);
|
||||
NcDim *NumSnap_dim = f.add_dim("numsnap_dim", num_snapshots);
|
||||
|
@ -446,6 +452,13 @@ void makeBoxFromParameter(SimuData *simu, SimuData* &boxed, generateMock_info& a
|
|||
boxed->time = simu->time;
|
||||
boxed->BoxSize = simu->BoxSize;
|
||||
|
||||
NcAtt *d_sub = f.get_att("data_subsampling");
|
||||
if (d_sub == 0 || d_sub->as_double(0) != args_info.subsample_arg)
|
||||
{
|
||||
cerr << "Parameter file was not generated with the same simulation subsampling argument. Particles will be different. Stop here." << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
NcVar *v_id = f.get_var("particle_ids");
|
||||
NcVar *v_snap = f.get_var("snapshot_split");
|
||||
long *edges1;
|
||||
|
@ -710,7 +723,7 @@ int main(int argc, char **argv)
|
|||
delete[] efac;
|
||||
}
|
||||
|
||||
saveBox(simuOut, args_info.outputParameter_arg);
|
||||
saveBox(simuOut, args_info.outputParameter_arg, args_info);
|
||||
generateOutput(simuOut, args_info.axis_arg,
|
||||
args_info.output_arg);
|
||||
delete preselector;
|
||||
|
|
|
@ -108,8 +108,8 @@ int main(int argc, char *argv[]) {
|
|||
printf("Unable to open file %s.\n\n",partfile);
|
||||
exit(0);
|
||||
}
|
||||
fread(&np2,1,sizeof(int),part);
|
||||
fread(&nvp,1,sizeof(int),part);
|
||||
fread(&np2,1,sizeof(pid_t),part);
|
||||
fread(&nvp,1,sizeof(pid_t),part);
|
||||
/*printf("nvp = %d\n",nvp);fflush(stdout);*/
|
||||
|
||||
nvpsum += nvp;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue