~liggghts-dev/+junk/liggghts-dev

« back to all changes in this revision

Viewing changes to src/region.cpp

  • Committer: Anton Gladky
  • Date: 2011-12-03 07:21:52 UTC
  • Revision ID: gladky.anton@gmail.com-20111203072152-kuse4ike0ac0g8fx
New upstream version

Show diffs side-by-side

added added

removed removed

Lines of Context:
427
427
    // impossible to calculate volume if bbox non-existent
428
428
    if(!bboxflag) return 0;
429
429
 
430
 
    double pos[3];
 
430
    double pos[3],bbox_vol,region_vol;
431
431
    int n_in = 0;
432
432
 
433
433
    for(int i = 0; i < n_test; i++)
442
442
    MyMPI::My_MPI_Sum_Scalar(n_in,world);
443
443
    if(n_in == 0) error->all("Unable to calculate region volume - are you operating on a 2d region?");
444
444
 
445
 
    double bbox_vol = (extent_xhi - extent_xlo) * (extent_yhi - extent_ylo) * (extent_zhi - extent_zlo);
446
 
    return (static_cast<double>(n_in)/static_cast<double>(n_test) * bbox_vol);
 
445
    bbox_vol = (extent_xhi - extent_xlo) * (extent_yhi - extent_ylo) * (extent_zhi - extent_zlo);
 
446
    region_vol = static_cast<double>(n_in)/static_cast<double>(n_test) * bbox_vol;
 
447
    return region_vol;
447
448
}