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 (if not contributing author is listed, this file has been contributed 36 by the core developer) 37 38 Copyright 2012- DCS Computing GmbH, Linz 39 Copyright 2009-2012 JKU Linz 40 ------------------------------------------------------------------------- */ 41 42 #ifndef LMP_VOLUME_MESH_H 43 #define LMP_VOLUME_MESH_H 44 45 #include "tracking_mesh.h" 46 #include "container.h" 47 48 namespace LAMMPS_NS{ 49 50 template<int NUM_NODES,int NUM_FACES,int NUM_NODES_PER_FACE> 51 class VolumeMesh : public TrackingMesh<NUM_NODES> 52 { 53 public: 54 55 bool addElement(double **nodeToAdd); 56 57 void move(const double * const vecTotal, const double * const vecIncremental); 58 void move(const double * const vecIncremental); 59 void scale(double factor); 60 61 bool isInside(double *p); 62 63 virtual int generateRandomOwnedGhost(double *pos) = 0; 64 virtual int generateRandomSubbox(double *pos) = 0; 65 virtual int generateRandomSubboxWithin(double *pos,double delta) = 0; 66 67 // public inline access 68 69 // area of total mesh - all elements (all processes) 70 volMeshGlobal()71 inline double volMeshGlobal() 72 { return volMesh_(0);} 73 74 // area of owned elements volMeshOwned()75 inline double volMeshOwned() 76 { return volMesh_(1);} 77 78 // area of ghost elements volMeshGhost()79 inline double volMeshGhost() 80 { return volMesh_(2);} 81 82 // area of owned and ghost elements in my subdomain volMeshSubdomain()83 inline double volMeshSubdomain() 84 { return volMesh_(3);} 85 86 protected: 87 88 VolumeMesh(LAMMPS *lmp); 89 virtual ~VolumeMesh(); 90 91 void deleteElement(int n); 92 93 void buildNeighbours(); 94 95 void refreshOwned(int setupFlag); 96 void refreshGhosts(int setupFlag); 97 98 inline void recalcLocalVolProperties(); 99 inline void recalcGhostVolProperties(); 100 101 void calcVolPropertiesOfNewElement(); 102 103 virtual bool shareFace(int i, int j, int &iFace, int &jFace) = 0; 104 105 virtual bool isInside(int nElem, double *p) = 0; 106 virtual double calcVol(int nElem) = 0; 107 108 int randomOwnedGhostElement(); 109 110 void rotate(const double * const totalQ, const double * const dQ, const double * const totalDispl, const double * const dDispl); 111 void rotate(const double * const dQ, const double * const dDispl); 112 113 // inline access 114 vol(int i)115 inline double& vol(int i) 116 { return (vol_)(i); } 117 volAcc(int i)118 inline double& volAcc(int i) 119 { return (volAcc_)(i); } 120 faceNodes(int i)121 inline double** faceNodes(int i) 122 { return faceNodes_[i]; } 123 124 private: 125 126 void checkOrientation(int n); 127 void calcFaceNormals(int n); 128 129 int searchElementByVolAcc(double vol,int lo, int hi); 130 131 // mesh properties 132 133 ScalarContainer<double>& volMesh_; 134 135 // volume and accumulated volume for each element 136 137 ScalarContainer<double> &vol_; 138 ScalarContainer<double> &volAcc_; 139 140 // faces for each element 141 142 MultiVectorContainer<int,NUM_FACES,NUM_NODES_PER_FACE>& faceNodes_; 143 MultiVectorContainer<double,NUM_FACES,3>& faceNormals_; 144 VectorContainer<bool,NUM_FACES>& isBoundaryFace_; 145 146 // neighbor topology for each element 147 148 ScalarContainer<int>& nNeighs_; 149 VectorContainer<int,NUM_FACES>& neighElems_; 150 }; 151 152 // ************************************* 153 #include "volume_mesh_I.h" 154 // ************************************* 155 156 } /* LAMMPS_NS */ 157 158 #endif /* VOLUMEMESH_H_ */ 159