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 Richard Berger (JKU Linz) 39 Philippe Seil (JKU Linz) 40 41 Copyright 2012- DCS Computing GmbH, Linz 42 Copyright 2009-2012 JKU Linz 43 ------------------------------------------------------------------------- */ 44 45 #ifdef FIX_CLASS 46 47 FixStyle(neighlist/mesh,FixNeighlistMesh) 48 49 #else 50 51 #ifndef LMP_FIX_NEIGHLIST_MESH_H 52 #define LMP_FIX_NEIGHLIST_MESH_H 53 54 #include "fix.h" 55 #include "container.h" 56 #include "atom_vec_ellipsoid.h" 57 #include <vector> 58 #include <algorithm> 59 60 namespace LAMMPS_NS 61 { 62 63 struct BinBoundary { 64 int xlo; 65 int xhi; 66 int ylo; 67 int yhi; 68 int zlo; 69 int zhi; 70 }; 71 72 struct TriangleNeighlist { 73 std::vector<int> contacts; 74 std::vector<int> bins; 75 BinBoundary boundary; 76 int nchecked; 77 78 TriangleNeighlist() : nchecked(0) {} 79 }; 80 81 class FixNeighlistMesh : public Fix 82 { 83 public: 84 85 FixNeighlistMesh(LAMMPS *lmp, int narg, char **arg); 86 virtual 87 ~FixNeighlistMesh(); 88 virtual int setmask(); 89 virtual void post_create(); 90 virtual void pre_delete(bool unfixflag); 91 92 virtual void initializeNeighlist(); 93 virtual void setup_pre_force(int); 94 virtual void min_setup_pre_force(int); 95 96 virtual void pre_neighbor(); 97 virtual void pre_force(int vflag); 98 virtual void min_pre_force(int vflag); 99 100 virtual void post_run(); 101 102 const std::vector<int> & get_contact_list(int iTri) const { 103 return triangles[iTri].contacts; 104 } 105 106 virtual int getSizeNumContacts(); 107 108 void enableTotalNumContacts(bool enable) 109 { 110 globalNumAllContacts_ = enable; 111 } 112 113 int getTotalNumContacts() { return numAllContacts_; } 114 115 bool contactInList(int iTri, int iAtom) 116 { 117 std::vector<int> & neighbors = triangles[iTri].contacts; 118 return std::find(neighbors.begin(), neighbors.end(), iAtom) != neighbors.end(); 119 } 120 121 inline class FixPropertyAtom* fix_nneighs() 122 { return fix_nneighs_; }; 123 124 // groupbit merged from groupbit of this fix and fix wall/gran (if exists) 125 int groupbit_wall_mesh; 126 127 protected: 128 129 void handleTriangle(int iTri); 130 void getBinBoundariesFromBoundingBox(class BoundingBox &b, int &ixMin,int &ixMax,int &iyMin,int &iyMax,int &izMin,int &izMax); 131 void getBinBoundariesForTriangle(int iTri, int &ixMin,int &ixMax,int &iyMin,int &iyMax,int &izMin,int &izMax); 132 133 class FixMeshSurface *caller_; 134 class TriMesh *mesh_; 135 136 class FixPropertyAtom *fix_nneighs_; 137 char *fix_nneighs_name_; 138 139 bool buildNeighList; 140 141 std::vector<TriangleNeighlist> triangles; 142 143 int numAllContacts_; 144 bool globalNumAllContacts_; 145 146 int mbinx,mbiny,mbinz,maxhead, *bins, *binhead; 147 double skin; 148 149 // max distance from triangle to particle center 150 double distmax; 151 152 double **x, *r; 153 154 bool changingMesh; 155 bool changingDomain; 156 157 bigint last_bin_update; 158 159 void generate_bin_list(size_t nall); 160 161 class AtomVecEllipsoid *avec; 162 163 bool otherList_; 164 private: 165 void checkBin(AtomVecEllipsoid::Bonus *bonus, std::vector<int>& neighbors, int& nchecked, double contactDistanceFactor, int *mask, int nlocal, int iBin, int iTri, bool haveNonSpherical, int *ellipsoid, double *shape); 166 }; 167 168 } /* namespace LAMMPS_NS */ 169 170 #endif /* FIX_MESH_NEIGHLIST_H_ */ 171 #endif /* FIX_CLASS */ 172