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 #ifdef REGION_CLASS
43 
44 RegionStyle(mesh/tet,RegTetMesh)
45 
46 #else
47 
48 #ifndef LMP_REGION_TET_MESH_H
49 #define LMP_REGION_TET_MESH_H
50 
51 #include "random_park.h"
52 #include "region.h"
53 #include "region_neighbor_list.h"
54 
55 namespace LAMMPS_NS {
56 
57 class RegTetMesh : public Region {
58 
59  friend class InputMeshTet;
60 
61  public:
62 
63   RegTetMesh(class LAMMPS *, int, char **);
64   ~RegTetMesh();
65   int inside(double, double, double);
66   int surface_interior(double *, double);
67   int surface_exterior(double *, double);
68 
69   void generate_random(double *pos,bool subdomain_flag);
70   void generate_random_shrinkby_cut(double *pos,double cut,bool subdomain_flag);
71 
72   // volume calculation based on MC
73   void volume_mc(int n_test,bool cutflag,double cut,double &vol_global,double &vol_local);
74 
75   void add_tet(double **n);
76   int n_tet();
77   double total_vol();
78   double tet_vol(int i);
79   double tet_acc_vol(int i);
80 
81   class TriMesh *get_tri_mesh()
82   { return &tri_mesh; }
83 
84  protected:
85 
86    int is_inside_tet(int iTet,double *pos);
87    bool nodesAreEqual(double *nodeToCheck1,double *nodeToCheck2,double precision);
88 
89    void grow_arrays();
90    void set_extent_region();
91    void set_extent_mesh();
92    void build_neighs();
93    void build_surface();
94    double volume_of_tet(double* v0, double* v1, double* v2, double* v3);
95    double volume_of_tet(int iTet);
96 
97    int mesh_randpos(double *pos);
98    int  tet_rand_tri();
99 
100    char *filename;
101    double scale_fact;
102    double off_fact[3], rot_angle[3];
103 
104    int nTet,nTetMax;
105    double ***node;
106    double **center;
107    double *rbound, rbound_max;
108 
109    int *n_face_neighs;
110    int **face_neighs;
111 
112    int **n_face_neighs_node;
113 
114    int *n_node_neighs;
115    int **node_neighs;
116 
117    int *n_surfaces;
118    int **surfaces;
119 
120    double total_volume;
121    double *volume;
122    double *acc_volume;
123 
124    class BoundingBox &bounding_box_mesh;
125 
126    class RegionNeighborList<interpolate_no> &neighList;
127 
128    class TriMesh &tri_mesh;
129 
130    #include "region_mesh_tet_I.h"
131 };
132 
133 }
134 
135 #endif
136 #endif
137