removed extranneous tree-building routines

This commit is contained in:
Paul M. Sutter 2025-04-23 10:32:35 -04:00
parent 49fcdedc92
commit c924577a0d
2 changed files with 19 additions and 13 deletions

View file

@ -41,8 +41,6 @@
#include "pruneVoids_conf.h" #include "pruneVoids_conf.h"
#include <vector> #include <vector>
#include "assert.h" #include "assert.h"
#include "voidTree.hpp"
#include "loadZobov.hpp"
#include <gsl/gsl_integration.h> #include <gsl/gsl_integration.h>
#include <gsl/gsl_interp.h> #include <gsl/gsl_interp.h>
@ -81,7 +79,7 @@ typedef struct voidStruct {
float center[3], macrocenter[3]; float center[3], macrocenter[3];
int accepted; int accepted;
int voidType; int voidType;
int parentIndx, numChildren, level; int parentID, numChildren, level;
bool isLeaf, hasHighCentralDen; bool isLeaf, hasHighCentralDen;
gsl_vector *eval; gsl_vector *eval;
gsl_matrix *evec; gsl_matrix *evec;
@ -333,7 +331,7 @@ int main(int argc, char **argv) {
voids[i-1].isLeaf = true; voids[i-1].isLeaf = true;
voids[i-1].hasHighCentralDen = false; voids[i-1].hasHighCentralDen = false;
voids[i-1].parentIndx = -1; voids[i-1].parentID = -1;
voids[i-1].numChildren = 0; voids[i-1].numChildren = 0;
voids[i-1].level = 0; voids[i-1].level = 0;
@ -509,20 +507,28 @@ int main(int argc, char **argv) {
} }
if (allZonesMatch) { if (allZonesMatch) {
voids[iVoid].parentIndx = iCheck; voids[iVoid].parentID = checkID;
voids[iCheck].numChildren++; voids[iCheck].numChildren++;
} }
} }
} // end building tree } // end building tree
// compute level in tree // find level in tree
for (iVoid = 0; iVoid < numVoids; iVoid++) { for (iVoid = 0; iVoid < numVoids; iVoid++) {
int level = 0; int level = 0;
int parentIndx = voids[iVoid].parentIndx; int parentIndx = iVoid;
while (parentIndx != -1) { int parentID = voids[iVoid].parentID;
while (parentID != -1) {
level++; level++;
parentIndx = voids[parentIndx].parentIndx; parentID = voids[parentIndx].parentID;
// get the index of parent void
for (int iCheck = 0; iCheck < numVoids; iCheck++){
if (voids[iCheck].voidID == parentID) {
parentIndx = iCheck;
break;
}
}
} }
voids[iVoid].level = level; voids[iVoid].level = level;
} }
@ -888,7 +894,7 @@ int main(int argc, char **argv) {
numAreParents = 0; numAreParents = 0;
iGood = 0; iGood = 0;
for (iVoid = 0; iVoid < voids.size(); iVoid++) { for (iVoid = 0; iVoid < voids.size(); iVoid++) {
if (voids[iVoid].parentIndx != -1) { if (voids[iVoid].parentID != -1) {
numAreParents++; numAreParents++;
voids[iVoid].isLeaf = true; voids[iVoid].isLeaf = true;
} else { } else {
@ -976,7 +982,7 @@ void openFiles(string outputDir, string sampleName,
*fpBarycenter = fopen((outputDir+"/"+prefix+"macrocenters_"+dataPortion+"_"+sampleName).c_str(), "w"); *fpBarycenter = fopen((outputDir+"/"+prefix+"macrocenters_"+dataPortion+"_"+sampleName).c_str(), "w");
*fpCenters = fopen((outputDir+"/"+prefix+"centers_"+dataPortion+"_"+sampleName).c_str(), "w"); *fpCenters = fopen((outputDir+"/"+prefix+"centers_"+dataPortion+"_"+sampleName).c_str(), "w");
fprintf(*fpCenters, "# center x,y,z (Mpc/h), volume (normalized), radius (Mpc/h), redshift, volume (Mpc/h^3), void ID, density contrast, num part, parent index, tree level, number of children, central density\n"); fprintf(*fpCenters, "# center x,y,z (Mpc/h), volume (normalized), radius (Mpc/h), redshift, volume (Mpc/h^3), void ID, density contrast, num part, parent ID, tree level, number of children, central density\n");
*fpSkyPositions = fopen((outputDir+"/"+prefix+"sky_positions_"+dataPortion+"_"+sampleName).c_str(), "w"); *fpSkyPositions = fopen((outputDir+"/"+prefix+"sky_positions_"+dataPortion+"_"+sampleName).c_str(), "w");
fprintf(*fpSkyPositions, "# RA, dec, redshift, radius (Mpc/h), void ID\n"); fprintf(*fpSkyPositions, "# RA, dec, redshift, radius (Mpc/h), void ID\n");
@ -1082,7 +1088,7 @@ void outputVoids(string outputDir, string sampleName, string prefix,
outVoid.voidID, outVoid.voidID,
outVoid.densCon, outVoid.densCon,
outVoid.numPart, outVoid.numPart,
outVoid.parentIndx, outVoid.parentID,
outVoid.level, outVoid.level,
outVoid.numChildren, outVoid.numChildren,
outVoid.centralDen); outVoid.centralDen);

View file

@ -1,5 +1,5 @@
add_library(zobovTool loadZobov.cpp particleInfo.cpp contour_pixels.cpp) add_library(zobovTool contour_pixels.cpp)
set_target_properties(zobovTool PROPERTIES COMPILE_FLAGS ${OpenMP_CXX_FLAGS} LINK_FLAGS ${OpenMP_CXX_FLAGS}) set_target_properties(zobovTool PROPERTIES COMPILE_FLAGS ${OpenMP_CXX_FLAGS} LINK_FLAGS ${OpenMP_CXX_FLAGS})
target_link_libraries(zobovTool ${COSMOTOOL_LIBRARY} ${GSL_LIBRARIES} ${NETCDF_LIBRARIES} ${HDF5_CXX_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${DL_LIBRARY}) target_link_libraries(zobovTool ${COSMOTOOL_LIBRARY} ${GSL_LIBRARIES} ${NETCDF_LIBRARIES} ${HDF5_CXX_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${DL_LIBRARY})