1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702
|
/*=========================================================================
Copyright (c) 2007, Los Alamos National Security, LLC
All rights reserved.
Copyright 2007. Los Alamos National Security, LLC.
This software was produced under U.S. Government contract DE-AC52-06NA25396
for Los Alamos National Laboratory (LANL), which is operated by
Los Alamos National Security, LLC for the U.S. Department of Energy.
The U.S. Government has rights to use, reproduce, and distribute this software.
NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY,
EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE.
If software is modified to produce derivative works, such modified software
should be clearly marked, so as not to confuse it with the version available
from LANL.
Additionally, redistribution and use in source and binary forms, with or
without modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Los Alamos National Security, LLC, Los Alamos National
Laboratory, LANL, the U.S. Government, nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#include "Partition.h"
#include "FOFHaloProperties.h"
#include "HaloCenterFinder.h"
#ifndef USE_VTK_COSMO
#include "Timings.h"
#endif
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <set>
#include <math.h>
using namespace std;
/////////////////////////////////////////////////////////////////////////
//
// FOFHaloProperties uses the results of the CosmoHaloFinder to locate the
// particle within every halo in order to calculate properties on halos
//
/////////////////////////////////////////////////////////////////////////
FOFHaloProperties::FOFHaloProperties()
{
// Get the number of processors and rank of this processor
this->numProc = Partition::getNumProc();
this->myProc = Partition::getMyProc();
}
FOFHaloProperties::~FOFHaloProperties()
{
}
/////////////////////////////////////////////////////////////////////////
//
// Set linked list structure which will locate all particles in a halo
//
/////////////////////////////////////////////////////////////////////////
void FOFHaloProperties::setHalos(
int numberHalos,
int* haloStartIndex,
int* haloParticleCount,
int* nextParticleIndex)
{
this->numberOfHalos = numberHalos;
this->halos = haloStartIndex;
this->haloCount = haloParticleCount;
this->haloList = nextParticleIndex;
}
/////////////////////////////////////////////////////////////////////////
//
// Set parameters for the halo center finder
//
/////////////////////////////////////////////////////////////////////////
void FOFHaloProperties::setParameters(
const string& outName,
POSVEL_T rL,
POSVEL_T deadSz,
POSVEL_T pDist)
{
this->outFile = outName;
// Halo finder parameters
this->boxSize = rL;
this->deadSize = deadSz;
this->bb = pDist;
}
/////////////////////////////////////////////////////////////////////////
//
// Set the particle vectors that have already been read and which
// contain only the alive particles for this processor
//
/////////////////////////////////////////////////////////////////////////
void FOFHaloProperties::setParticles(
vector<POSVEL_T>* xLoc,
vector<POSVEL_T>* yLoc,
vector<POSVEL_T>* zLoc,
vector<POSVEL_T>* xVel,
vector<POSVEL_T>* yVel,
vector<POSVEL_T>* zVel,
vector<POSVEL_T>* pmass,
vector<POTENTIAL_T>* potential,
vector<ID_T>* id,
vector<MASK_T>* maskData,
vector<STATUS_T>* state)
{
this->particleCount = (long)xLoc->size();
// Extract the contiguous data block from a vector pointer
this->xx = &(*xLoc)[0];
this->yy = &(*yLoc)[0];
this->zz = &(*zLoc)[0];
this->vx = &(*xVel)[0];
this->vy = &(*yVel)[0];
this->vz = &(*zVel)[0];
this->mass = &(*pmass)[0];
this->pot = &(*potential)[0];
this->tag = &(*id)[0];
this->mask = &(*maskData)[0];
this->status = &(*state)[0];
}
void FOFHaloProperties::setParticles(
long count,
POSVEL_T* xLoc,
POSVEL_T* yLoc,
POSVEL_T* zLoc,
POSVEL_T* xVel,
POSVEL_T* yVel,
POSVEL_T* zVel,
POSVEL_T* pmass,
ID_T* id)
{
this->particleCount = count;
// Extract the contiguous data block from a vector pointer
this->xx = xLoc;
this->yy = yLoc;
this->zz = zLoc;
this->vx = xVel;
this->vy = yVel;
this->vz = zVel;
this->mass = pmass;
this->tag = id;
}
/////////////////////////////////////////////////////////////////////////
//
// Find the index of the particle at the center of every FOF halo which is the
// particle with the minimum value in the potential array.
//
/////////////////////////////////////////////////////////////////////////
void FOFHaloProperties::FOFHaloCenterMinimumPotential(vector<int>* haloCenter)
{
for (int halo = 0; halo < this->numberOfHalos; halo++) {
// First particle in halo
int p = this->halos[halo];
POTENTIAL_T minPotential = this->pot[p];
int centerIndex = p;
// Next particle
p = this->haloList[p];
// Search for minimum
while (p != -1) {
if (minPotential > this->pot[p]) {
minPotential = this->pot[p];
centerIndex = p;
}
p = this->haloList[p];
}
// Save the minimum potential index for this halo
(*haloCenter).push_back(centerIndex);
}
}
/////////////////////////////////////////////////////////////////////////
//
// Calculate the mass of every FOF halo accumulating individual mass
//
// m_FOF = ((Sum i=1 to n_FOF) m_i) / n_FOF
// m_FOF is the mass of an FOF halo
// n_FOF is the number of particles in the halo
// m_i is the mass of an individual particle
//
/////////////////////////////////////////////////////////////////////////
void FOFHaloProperties::FOFHaloMass(
vector<POSVEL_T>* haloMass)
{
POSVEL_T lmass;
double mKahan;
for (int halo = 0; halo < this->numberOfHalos; halo++) {
mKahan = KahanSummation(halo, this->mass);
lmass = (POSVEL_T) mKahan;
(*haloMass).push_back(lmass);
}
}
/////////////////////////////////////////////////////////////////////////
//
// Calculate the center of mass of every FOF halo
//
// x_FOF = ((Sum i=1 to n_FOF) x_i * x_mass) / n_mass
// x_FOF is the center of mass vector
// n_mass is the total mass of particles in the halo
// x_i is the position vector of particle i
//
/////////////////////////////////////////////////////////////////////////
void FOFHaloProperties::FOFCenterOfMass(
vector<POSVEL_T>* xCenterOfMass,
vector<POSVEL_T>* yCenterOfMass,
vector<POSVEL_T>* zCenterOfMass)
{
POSVEL_T xCofMass, yCofMass, zCofMass;
double xKahan, yKahan, zKahan;
for (int halo = 0; halo < this->numberOfHalos; halo++) {
double totalMass = KahanSummation(halo, this->mass);
xKahan = KahanSummation2(halo, this->xx, this->mass);
yKahan = KahanSummation2(halo, this->yy, this->mass);
zKahan = KahanSummation2(halo, this->zz, this->mass);
xCofMass = (POSVEL_T) (xKahan / totalMass);
yCofMass = (POSVEL_T) (yKahan / totalMass);
zCofMass = (POSVEL_T) (zKahan / totalMass);
(*xCenterOfMass).push_back(xCofMass);
(*yCenterOfMass).push_back(yCofMass);
(*zCenterOfMass).push_back(zCofMass);
}
}
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
//
// Calculate the average position of particles of every FOF halo
//
// x_FOF = ((Sum i=1 to n_FOF) x_i) / n_FOF
// x_FOF is the average position vector
// n_FOF is the number of particles in the halo
// x_i is the position vector of particle i
//
/////////////////////////////////////////////////////////////////////////
void FOFHaloProperties::FOFPosition(
vector<POSVEL_T>* xMeanPos,
vector<POSVEL_T>* yMeanPos,
vector<POSVEL_T>* zMeanPos)
{
POSVEL_T xMean, yMean, zMean;
double xKahan, yKahan, zKahan;
for (int halo = 0; halo < this->numberOfHalos; halo++) {
xKahan = KahanSummation(halo, this->xx);
yKahan = KahanSummation(halo, this->yy);
zKahan = KahanSummation(halo, this->zz);
xMean = (POSVEL_T) (xKahan / this->haloCount[halo]);
yMean = (POSVEL_T) (yKahan / this->haloCount[halo]);
zMean = (POSVEL_T) (zKahan / this->haloCount[halo]);
(*xMeanPos).push_back(xMean);
(*yMeanPos).push_back(yMean);
(*zMeanPos).push_back(zMean);
}
}
/////////////////////////////////////////////////////////////////////////
//
// Calculate the average velocity of particles of every FOF halo
//
// v_FOF = ((Sum i=1 to n_FOF) v_i) / n_FOF
// v_FOF is the average velocity vector
// n_FOF is the number of particles in the halo
// v_i is the velocity vector of particle i
//
/////////////////////////////////////////////////////////////////////////
void FOFHaloProperties::FOFVelocity(
vector<POSVEL_T>* xMeanVel,
vector<POSVEL_T>* yMeanVel,
vector<POSVEL_T>* zMeanVel)
{
POSVEL_T xMean, yMean, zMean;
double xKahan, yKahan, zKahan;
for (int halo = 0; halo < this->numberOfHalos; halo++) {
xKahan = KahanSummation(halo, this->vx);
yKahan = KahanSummation(halo, this->vy);
zKahan = KahanSummation(halo, this->vz);
xMean = (POSVEL_T) (xKahan / this->haloCount[halo]);
yMean = (POSVEL_T) (yKahan / this->haloCount[halo]);
zMean = (POSVEL_T) (zKahan / this->haloCount[halo]);
(*xMeanVel).push_back(xMean);
(*yMeanVel).push_back(yMean);
(*zMeanVel).push_back(zMean);
}
}
/////////////////////////////////////////////////////////////////////////
//
// Calculate the velocity dispersion of every FOF halo
//
// o_FOF = sqrt((avg_part_vel_dot_prod - dot_prod_halo_vel) / 3)
// avg_part_vel_dot_prod = ((Sum i=1 to n_FOF) v_i dot v_i) / n_FOF
// n_FOF is the number of particles in the halo
// v_i is the velocity vector of particle i
// dot_prod_halo_vel = v_FOF dot v_FOF
// v_FOF is the average velocity vector of all particles in the halo
//
/////////////////////////////////////////////////////////////////////////
void FOFHaloProperties::FOFVelocityDispersion(
vector<POSVEL_T>* xAvgVel,
vector<POSVEL_T>* yAvgVel,
vector<POSVEL_T>* zAvgVel,
vector<POSVEL_T>* velDisp)
{
for (int halo = 0; halo < this->numberOfHalos; halo++) {
// First particle in the halo
int p = this->halos[halo];
POSVEL_T particleDot = 0.0;
// Iterate over all particles in the halo collecting dot products
while (p != -1) {
particleDot += dotProduct(this->vx[p], this->vy[p], this->vz[p]);
p = this->haloList[p];
}
// Average of all the dot products
particleDot /= this->haloCount[halo];
// Dot product of the average velocity for the entire halo
POSVEL_T haloDot = dotProduct((*xAvgVel)[halo],
(*yAvgVel)[halo], (*zAvgVel)[halo]);
// Velocity dispersion
POSVEL_T vDispersion = (POSVEL_T)sqrt((particleDot - haloDot) / 3.0);
// Save onto supplied vector
velDisp->push_back(vDispersion);
}
}
/////////////////////////////////////////////////////////////////////////
//
// Dot product of a vector
//
/////////////////////////////////////////////////////////////////////////
POSVEL_T FOFHaloProperties::dotProduct(POSVEL_T x, POSVEL_T y, POSVEL_T z)
{
POSVEL_T dotProd = x * x + y * y + z * z;
return dotProd;
}
/////////////////////////////////////////////////////////////////////////
//
// Calculate the Kahan summation
// Reduces roundoff error in floating point arithmetic
//
/////////////////////////////////////////////////////////////////////////
POSVEL_T FOFHaloProperties::KahanSummation(int halo, POSVEL_T* data)
{
POSVEL_T dataSum, dataRem, v, w;
// First particle in halo and first step in Kahan summation
int p = this->halos[halo];
dataSum = data[p];
dataRem = 0.0;
// Next particle
p = this->haloList[p];
// Remaining steps in Kahan summation
while (p != -1) {
v = data[p] - dataRem;
w = dataSum + v;
dataRem = (w - dataSum) - v;
dataSum = w;
p = this->haloList[p];
}
return dataSum;
}
/////////////////////////////////////////////////////////////////////////
//
// Calculate the Kahan summation on two variables multiplied
// Reduces roundoff error in floating point arithmetic
//
/////////////////////////////////////////////////////////////////////////
POSVEL_T FOFHaloProperties::KahanSummation2(int halo,
POSVEL_T* data1, POSVEL_T* data2)
{
POSVEL_T dataSum, dataRem, v, w;
// First particle in halo and first step in Kahan summation
int p = this->halos[halo];
dataSum = data1[p] * data2[p];
dataRem = 0.0;
// Next particle
p = this->haloList[p];
// Remaining steps in Kahan summation
while (p != -1) {
v = (data1[p] * data2[p]) - dataRem;
w = dataSum + v;
dataRem = (w - dataSum) - v;
dataSum = w;
p = this->haloList[p];
}
return dataSum;
}
/////////////////////////////////////////////////////////////////////////
//
// Calculate the incremental mean using Kahan summation
//
/////////////////////////////////////////////////////////////////////////
POSVEL_T FOFHaloProperties::incrementalMean(int halo, POSVEL_T* data)
{
double dataMean, dataRem, diff, value, v, w;
// First particle in halo and first step in incremental mean
int p = this->halos[halo];
dataMean = data[p];
dataRem = 0.0;
int count = 1;
// Next particle
p = this->haloList[p];
count++;
// Remaining steps in incremental mean
while (p != -1) {
diff = data[p] - dataMean;
value = diff / count;
v = value - dataRem;
w = dataMean + v;
dataRem = (w - dataMean) - v;
dataMean = w;
p = this->haloList[p];
count++;
}
return (POSVEL_T) dataMean;
}
#ifndef USE_VTK_COSMO
/////////////////////////////////////////////////////////////////////////
//
// Write the halo catalog file
//
// Output one entry per halo
// Location (xx,yy,zz) is the location of particle closest to centroid
// Eventually this needs to be the particle with the minimum potential
// Velocity (vx,vy,vz) is the average velocity of all halo particles
// Mass is the #particles in the halo * mass of one particle
// Tag is the unique id of the halo
//
/////////////////////////////////////////////////////////////////////////
void FOFHaloProperties::FOFHaloCatalog(
vector<int>* haloCenter,
vector<POSVEL_T>* haloMass,
vector<POSVEL_T>* xMeanVel,
vector<POSVEL_T>* yMeanVel,
vector<POSVEL_T>* zMeanVel)
{
// Compose ascii and .cosmo binary file names
ostringstream aname, cname;
if (this->numProc == 1) {
aname << this->outFile << ".halocatalog.ascii";
cname << this->outFile << ".halocatalog.cosmo";
} else {
aname << this->outFile << ".halocatalog.ascii." << myProc;
cname << this->outFile << ".halocatalog.cosmo." << myProc;
}
ofstream aStream(aname.str().c_str(), ios::out);
ofstream cStream(cname.str().c_str(), ios::out|ios::binary);
char str[1024];
float fBlock[COSMO_FLOAT];
int iBlock[COSMO_INT];
for (int halo = 0; halo < this->numberOfHalos; halo++) {
int centerIndex = (*haloCenter)[halo];
int haloTag = this->tag[this->halos[halo]];
// Write ascii
sprintf(str, "%12.4E %12.4E %12.4E %12.4E %12.4E %12.4E %12.4E %12d\n",
this->xx[centerIndex],
(*xMeanVel)[halo],
this->yy[centerIndex],
(*yMeanVel)[halo],
this->zz[centerIndex],
(*zMeanVel)[halo],
(*haloMass)[halo],
haloTag);
aStream << str;
fBlock[0] = this->xx[centerIndex];
fBlock[1] = (*xMeanVel)[halo];
fBlock[2] = this->yy[centerIndex];
fBlock[3] = (*yMeanVel)[halo];
fBlock[4] = this->zz[centerIndex];
fBlock[5] = (*zMeanVel)[halo];
fBlock[6] = (*haloMass)[halo];
cStream.write(reinterpret_cast<char*>(fBlock),
COSMO_FLOAT * sizeof(POSVEL_T));
iBlock[0] = haloTag;
cStream.write(reinterpret_cast<char*>(iBlock),
COSMO_INT * sizeof(ID_T));
}
aStream.close();
cStream.close();
}
/////////////////////////////////////////////////////////////////////////
//
// For each processor print the halo index and size for debugging
//
/////////////////////////////////////////////////////////////////////////
void FOFHaloProperties::printHaloSizes(int minSize)
{
for (int i = 0; i < this->numberOfHalos; i++)
if (this->haloCount[i] > minSize)
cout << "Rank " << Partition::getMyProc()
<< " Halo " << i
<< " size = " << this->haloCount[i] << endl;
}
/////////////////////////////////////////////////////////////////////////
//
// Copy locations and tags of halo particles to the allocated arrays
//
/////////////////////////////////////////////////////////////////////////
void FOFHaloProperties::extractLocation(
int halo,
int* actualIndx,
POSVEL_T* xLocHalo,
POSVEL_T* yLocHalo,
POSVEL_T* zLocHalo,
ID_T* id)
{
int p = this->halos[halo];
for (int i = 0; i < this->haloCount[halo]; i++) {
xLocHalo[i] = this->xx[p];
yLocHalo[i] = this->yy[p];
zLocHalo[i] = this->zz[p];
id[i] = this->tag[p];
actualIndx[i] = p;
p = this->haloList[p];
}
}
#endif
/////////////////////////////////////////////////////////////////////////
//
// Copy locations, velocities and tags of halo particles to the allocated arrays
//
/////////////////////////////////////////////////////////////////////////
void FOFHaloProperties::extractInformation(
int halo,
int* actualIndx,
POSVEL_T* xLocHalo,
POSVEL_T* yLocHalo,
POSVEL_T* zLocHalo,
POSVEL_T* xVelHalo,
POSVEL_T* yVelHalo,
POSVEL_T* zVelHalo,
POSVEL_T* massHalo,
ID_T* id)
{
int p = this->halos[halo];
for (int i = 0; i < this->haloCount[halo]; i++) {
xLocHalo[i] = this->xx[p];
yLocHalo[i] = this->yy[p];
zLocHalo[i] = this->zz[p];
xVelHalo[i] = this->vx[p];
yVelHalo[i] = this->vy[p];
zVelHalo[i] = this->vz[p];
massHalo[i] = this->mass[p];
id[i] = this->tag[p];
actualIndx[i] = p;
p = this->haloList[p];
}
}
#ifndef USE_VTK_COSMO
/////////////////////////////////////////////////////////////////////////
//
// For the requested processor and halo index output locations for
// a scatter plot for debugging
//
/////////////////////////////////////////////////////////////////////////
void FOFHaloProperties::printLocations(int halo)
{
int p = this->halos[halo];
for (int i = 0; i < this->haloCount[halo]; i++) {
cout << "FOF INFO " << this->myProc << " " << halo
<< " INDEX " << p << " TAG " << this->tag[p] << " LOCATION "
<< this->xx[p] << " " << this->yy[p] << " " << this->zz[p] << endl;
p = this->haloList[p];
}
}
/////////////////////////////////////////////////////////////////////////
//
// For the requested processor and halo index output bounding box
//
/////////////////////////////////////////////////////////////////////////
void FOFHaloProperties::printBoundingBox(int halo)
{
POSVEL_T minBox[DIMENSION], maxBox[DIMENSION];
for (int dim = 0; dim < DIMENSION; dim++) {
minBox[dim] = this->boxSize;
maxBox[dim] = 0.0;
}
int p = this->halos[halo];
for (int i = 0; i < this->haloCount[halo]; i++) {
if (minBox[0] > this->xx[p])
minBox[0] = this->xx[p];
if (maxBox[0] < this->xx[p])
maxBox[0] = this->xx[p];
if (minBox[1] > this->yy[p])
minBox[1] = this->yy[p];
if (maxBox[1] < this->yy[p])
maxBox[1] = this->yy[p];
if (minBox[2] > this->zz[p])
minBox[2] = this->zz[p];
if (maxBox[2] < this->zz[p])
maxBox[2] = this->zz[p];
p = this->haloList[p];
}
cout << "FOF BOUNDING BOX " << this->myProc << " " << halo << ": "
<< minBox[0] << ":" << maxBox[0] << " "
<< minBox[1] << ":" << maxBox[1] << " "
<< minBox[2] << ":" << maxBox[2] << " " << endl;
}
#endif
|