1 /* ---------------------------------------------------------------------- 2 This is the 3 4 ██╗ ██╗ ██████╗ ██████╗ ██████╗ ██╗ ██╗████████╗███████╗ 5 ██║ ██║██╔════╝ ██╔════╝ ██╔════╝ ██║ ██║╚══██╔══╝██╔════╝ 6 ██║ ██║██║ ███╗██║ ███╗██║ ███╗███████║ ██║ ███████╗ 7 ██║ ██║██║ ██║██║ ██║██║ ██║██╔══██║ ██║ ╚════██║ 8 ███████╗██║╚██████╔╝╚██████╔╝╚██████╔╝██║ ██║ ██║ ███████║ 9 ╚══════╝╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝® 10 11 DEM simulation engine, released by 12 DCS Computing Gmbh, Linz, Austria 13 http://www.dcs-computing.com, office@dcs-computing.com 14 15 LIGGGHTS® is part of CFDEM®project: 16 http://www.liggghts.com | http://www.cfdem.com 17 18 Core developer and main author: 19 Christoph Kloss, christoph.kloss@dcs-computing.com 20 21 LIGGGHTS® is open-source, distributed under the terms of the GNU Public 22 License, version 2 or later. It is distributed in the hope that it will 23 be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 24 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. You should have 25 received a copy of the GNU General Public License along with LIGGGHTS®. 26 If not, see http://www.gnu.org/licenses . See also top-level README 27 and LICENSE files. 28 29 LIGGGHTS® and CFDEM® are registered trade marks of DCS Computing GmbH, 30 the producer of the LIGGGHTS® software and the CFDEM®coupling software 31 See http://www.cfdem.com/terms-trademark-policy for details. 32 33 ------------------------------------------------------------------------- 34 Contributing author and copyright for this file: 35 36 Christoph Kloss (DCS Computing GmbH, Linz) 37 Christoph Kloss (JKU Linz) 38 Philippe Seil (JKU Linz) 39 Richard Berger (JKU Linz) 40 41 Copyright 2012- DCS Computing GmbH, Linz 42 Copyright 2009-2015 JKU Linz 43 ------------------------------------------------------------------------- */ 44 45 #include "bounding_box.h" 46 #include <algorithm> 47 48 namespace LAMMPS_NS 49 { 50 BoundingBox()51 BoundingBox::BoundingBox() 52 : xLo(0.), xHi(0.), yLo(0.), yHi(0.), zLo(0.), zHi(0.), initGiven(false), dirty(true) 53 {} BoundingBox(double xLo_,double xHi_,double yLo_,double yHi_,double zLo_,double zHi_)54 BoundingBox::BoundingBox(double xLo_, double xHi_, double yLo_, double yHi_, double zLo_, double zHi_) 55 : xLo(xLo_), xHi(xHi_), yLo(yLo_), yHi(yHi_), zLo(zLo_), zHi(zHi_), initGiven(true), dirty(true) 56 {} 57 ~BoundingBox()58 BoundingBox::~BoundingBox() 59 {} 60 reset()61 void BoundingBox::reset() 62 { 63 xLo = 0.; xHi = 0.; 64 yLo = 0.; yHi = 0.; 65 zLo = 0.; zHi = 0.; 66 initGiven = false; 67 dirty = true; 68 } 69 extendByDelta(double delta)70 void BoundingBox::extendByDelta(double delta) 71 { 72 xLo = xLo-delta; 73 yLo = yLo-delta; 74 zLo = zLo-delta; 75 xHi = xHi+delta; 76 yHi = yHi+delta; 77 zHi = zHi+delta; 78 } 79 extrude(double length,const double * vec)80 void BoundingBox::extrude(double length, const double * vec) 81 { 82 xLo = std::min(xLo, (xLo + length * vec[0])); 83 yLo = std::min(yLo, (yLo + length * vec[1])); 84 zLo = std::min(zLo, (zLo + length * vec[2])); 85 xHi = std::max(xHi, (xHi + length * vec[0])); 86 yHi = std::max(yHi, (yHi + length * vec[1])); 87 zHi = std::max(zHi, (zHi + length * vec[2])); 88 } 89 90 } /* namespace LAMMPS_NS */ 91