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     This file is from LAMMPS
36     LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
37     http://lammps.sandia.gov, Sandia National Laboratories
38     Steve Plimpton, sjplimp@sandia.gov
39 
40     Copyright (2003) Sandia Corporation.  Under the terms of Contract
41     DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
42     certain rights in this software.  This software is distributed under
43     the GNU General Public License.
44 ------------------------------------------------------------------------- */
45 
46 #ifndef LMP_ATOM_VEC_H
47 #define LMP_ATOM_VEC_H
48 
49 #include <stdio.h>
50 #include "pointers.h"
51 
52 namespace LAMMPS_NS {
53 
54 class AtomVec : protected Pointers {
55  public:
56   int molecular;                       // 0 = atomic, 1 = molecular system
57   int bonds_allow,angles_allow;        // 1 if bonds, angles are used
58   int dihedrals_allow,impropers_allow; // 1 if dihedrals, impropers used
59   int mass_type;                       // 1 if per-type masses
60   int dipole_type;                     // 1 if per-type dipole moments
61   int forceclearflag;                  // 1 if has forceclear() method
62 
63   int comm_x_only;                     // 1 if only exchange x in forward comm
64   int comm_f_only;                     // 1 if only exchange f in reverse comm
65 
66   int size_forward;                    // # of values per atom in comm
67   int size_reverse;                    // # in reverse comm
68   int size_border;                     // # in border comm
69   int size_velocity;                   // # of velocity based quantities
70   int size_data_atom;                  // number of values in Atom line
71   int size_data_vel;                   // number of values in Velocity line
72   int size_data_bonus;                 // number of values in Bonus line
73   int xcol_data;                       // column (1-N) where x is in Atom line
74 
75   int cudable;                         // 1 if atom style is CUDA-enabled
76   int *maxsend;                        // CUDA-specific variable
77 
78   AtomVec(class LAMMPS *);
~AtomVec()79   virtual ~AtomVec() {}
80   virtual void settings(int, char **);
81   virtual void init();
82 
83   virtual void grow(int) = 0;
84   virtual void grow_reset() = 0;
85   virtual void copy(int, int, int) = 0;
clear_bonus()86   virtual void clear_bonus() {}
87 
88   virtual int pack_comm(int, int *, double *, int, int *) = 0;
89   virtual int pack_comm_vel(int, int *, double *, int, int *) = 0;
pack_comm_hybrid(int,int *,double *)90   virtual int pack_comm_hybrid(int, int *, double *) {return 0;}
91   virtual void unpack_comm(int, int, double *) = 0;
92   virtual void unpack_comm_vel(int, int, double *) = 0;
unpack_comm_hybrid(int,int,double *)93   virtual int unpack_comm_hybrid(int, int, double *) {return 0;}
94 
95   virtual int pack_reverse(int, int, double *) = 0;
pack_reverse_hybrid(int,int,double *)96   virtual int pack_reverse_hybrid(int, int, double *) {return 0;}
97   virtual void unpack_reverse(int, int *, double *) = 0;
unpack_reverse_hybrid(int,int *,double *)98   virtual int unpack_reverse_hybrid(int, int *, double *) {return 0;}
99 
100   virtual int pack_border(int, int *, double *, int, int *) = 0;
101   virtual int pack_border_vel(int, int *, double *, int, int *) = 0;
pack_border_hybrid(int,int *,double *)102   virtual int pack_border_hybrid(int, int *, double *) {return 0;}
103   virtual void unpack_border(int, int, double *) = 0;
104   virtual void unpack_border_vel(int, int, double *) = 0;
unpack_border_hybrid(int,int,double *)105   virtual int unpack_border_hybrid(int, int, double *) {return 0;}
106 
107   virtual int pack_exchange(int, double *) = 0;
108   virtual int unpack_exchange(double *) = 0;
109 
110   virtual int size_restart() = 0;
111   virtual int pack_restart(int, double *) = 0;
112   virtual int unpack_restart(double *) = 0;
113 
write_restart_settings(FILE *)114   virtual void write_restart_settings(FILE *) {}
read_restart_settings(FILE *)115   virtual void read_restart_settings(FILE *) {}
116 
117   virtual void create_atom(int, double *) = 0;
118 
119   virtual void data_atom(double *, tagint, char **) = 0;
data_atom_bonus(int,char **)120   virtual void data_atom_bonus(int, char **) {}
data_atom_hybrid(int,char **)121   virtual int data_atom_hybrid(int, char **) {return 0;}
122   virtual void data_vel(int, char **);
data_vel_hybrid(int,char **)123   virtual int data_vel_hybrid(int, char **) {return 0;}
124 
125   virtual void pack_data(double **) = 0;
pack_data(double ** buf,int tag_offset)126   virtual void pack_data(double **buf,int tag_offset) { pack_data(buf); }
pack_data_hybrid(int,double *)127   virtual int pack_data_hybrid(int, double *) {return 0;}
128   virtual void write_data(FILE *, int, double **) = 0;
write_data_hybrid(FILE *,double *)129   virtual int write_data_hybrid(FILE *, double *) {return 0;}
130   virtual void pack_vel(double **);
pack_vel(double ** buf,int tag_offset)131   virtual void pack_vel(double **buf,int tag_offset) { pack_vel(buf); }
pack_vel_hybrid(int,double *)132   virtual int pack_vel_hybrid(int, double *) {return 0;}
133   virtual void write_vel(FILE *, int, double **);
write_vel_hybrid(FILE *,double *)134   virtual int write_vel_hybrid(FILE *, double *) {return 0;}
135 
136   int pack_bond(int **);
137   void write_bond(FILE *, int, int **, int);
138   int pack_angle(int **);
139   void write_angle(FILE *, int, int **, int);
140   void pack_dihedral(int **);
141   void write_dihedral(FILE *, int, int **, int);
142   void pack_improper(int **);
143   void write_improper(FILE *, int, int **, int);
144 
145   virtual bigint memory_usage() = 0;
146 
147  protected:
148   int nmax;                             // local copy of atom->nmax
149   int deform_vremap;                    // local copy of domain properties
150   int deform_groupbit;
151   double *h_rate;
152 
153   // union data struct for packing 32-bit and 64-bit ints into double bufs
154   // this avoids aliasing issues by having 2 pointers (double,int)
155   //   to same buf memory
156   // constructor for 32-bit int prevents compiler
157   //   from possibly calling the double constructor when passed an int
158   // copy to a double *buf:
159   //   buf[m++] = ubuf(foo).d, where foo is a 32-bit or 64-bit int
160   // copy from a double *buf:
161   //   foo = (int) ubuf(buf[m++]).i;, where (int) or (tagint) match foo
162   //   the cast prevents compiler warnings about possible truncation
163 
164   union ubuf {
165     double   d;
166     int64_t  i;
ubuf(double arg)167     ubuf(double arg) : d(arg) {}
ubuf(int64_t arg)168     ubuf(int64_t arg) : i(arg) {}
ubuf(int arg)169     ubuf(int arg) : i(arg) {}
170   };
171   void grow_nmax();
172   int grow_nmax_bonus(int);
173 };
174 
175 }
176 
177 #endif
178 
179 /* ERROR/WARNING messages:
180 
181 E: Invalid atom_style command
182 
183 Self-explanatory.
184 
185 E: USER-CUDA package requires a cuda enabled atom_style
186 
187 Self-explanatory.
188 
189 */
190