diff --git a/c_source/pruning/pruneVoids.cpp b/c_source/pruning/pruneVoids.cpp index 534abc0..d4a08aa 100644 --- a/c_source/pruning/pruneVoids.cpp +++ b/c_source/pruning/pruneVoids.cpp @@ -81,7 +81,7 @@ typedef struct voidStruct { float center[3], macrocenter[3]; int accepted; int voidType; - int parentID, numChildren, level; + int parentIndx, numChildren, level; bool isLeaf, hasHighCentralDen; gsl_vector *eval; gsl_matrix *evec; @@ -339,8 +339,8 @@ int main(int argc, char **argv) { voids[i-1].isLeaf = true; voids[i-1].hasHighCentralDen = false; + voids[i-1].parentIndx = -1; voids[i-1].numChildren = 0; - voids[i-1].parentID = -1; voids[i-1].level = 0; voids[i-1].eval = gsl_vector_alloc(3); @@ -515,7 +515,7 @@ int main(int argc, char **argv) { } if (allZonesMatch) { - voids[iVoid].parentID = checkID; + voids[iVoid].parentIndx = iCheck; voids[iCheck].numChildren++; } } @@ -525,17 +525,10 @@ int main(int argc, char **argv) { // compute level in tree for (iVoid = 0; iVoid < numVoids; iVoid++) { int level = 0; - int parentID = voids[iVoid].parentID; - while (parentID != -1) { + int parentIndx = voids[iVoid].parentIndx; + while (parentIndx != -1) { level++; - - // find the index of the parent - for (i = 0; i < numVoids; i++) { - if (voids[i].voidID == parentID) { - parentID = voids[i].voidID; - break; - } - } + parentIndx = voids[parentIndx].parentIndx; } voids[iVoid].level = level; } @@ -951,7 +944,7 @@ int main(int argc, char **argv) { numAreParents = 0; iGood = 0; for (iVoid = 0; iVoid < voids.size(); iVoid++) { - if (voids[iVoid].parentID != -1) { + if (voids[iVoid].parentIndx != -1) { numAreParents++; voids[iVoid].isLeaf = true; } else { @@ -1039,7 +1032,7 @@ void openFiles(string outputDir, string sampleName, *fpBarycenter = fopen((outputDir+"/"+prefix+"macrocenters_"+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 ID, 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 index, tree level, number of children, central density\n"); *fpSkyPositions = fopen((outputDir+"/"+prefix+"sky_positions_"+dataPortion+"_"+sampleName).c_str(), "w"); fprintf(*fpSkyPositions, "# RA, dec, redshift, radius (Mpc/h), void ID\n"); @@ -1145,7 +1138,7 @@ void outputVoids(string outputDir, string sampleName, string prefix, outVoid.voidID, outVoid.densCon, outVoid.numPart, - outVoid.parentID, + outVoid.parentIndx, outVoid.level, outVoid.numChildren, outVoid.centralDen);