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 FIX_CLASS
43 
44 FixStyle(property/atom,FixPropertyAtom)
45 
46 #else
47 
48 #ifndef LMP_FIX_PROPERTY_ATOM_H
49 #define LMP_FIX_PROPERTY_ATOM_H
50 
51 #include "fix.h"
52 #include "input.h"
53 
54 namespace LAMMPS_NS {
55 
56 enum
57 {
58    FIXPROPERTY_ATOM_SCALAR = 0,
59    FIXPROPERTY_ATOM_VECTOR = 1,
60    FIXPROPERTY_ATOM_VECTOR2D = 2,
61    FIXPROPERTY_ATOM_QUATERNION = 3
62 };
63 
64 class FixPropertyAtom : public Fix {
65  friend class Set;
66  friend class FixPropertyAtomUpdateFix;
67  friend class FixPropertyAtomRandom;
68  public:
69   FixPropertyAtom(class LAMMPS *, int, char **,bool parse = true);
70   ~FixPropertyAtom();
71   virtual int setmask();
72 
73   void do_forward_comm();
74   void do_reverse_comm();
75 
76   Fix* check_fix(const char *varname,const char *svmstyle,int len1,int len2,const char *caller,bool errflag);
77 
78   double memory_usage();
79   void grow_arrays(int);
80   void copy_arrays(int, int,int);
81   void pre_set_arrays();
82   virtual void set_arrays(int);
83 
84   void set_all(double value,bool ghost = true);
85 
86   void write_restart(FILE *);
87   virtual void restart(char *);
88 
89   int pack_exchange(int, double *);
90   int unpack_exchange(int, double *);
91   int pack_restart(int, double *);
92   void unpack_restart(int, int);
93   int size_restart(int);
94   int maxsize_restart();
95   int pack_comm(int, int *, double *, int, int *);
96   void unpack_comm(int, int, double *);
97   int pack_reverse_comm(int, int, double *);
98   void unpack_reverse_comm(int, int *, double *);
99   virtual double compute_vector(int n);
100 
101   virtual void mark_tracers(int ilo, int ihi) { UNUSED(ilo); UNUSED(ihi); }
102 
103   inline void set_internal()
104   { internal = true; }
105 
106   inline bool get_internal()
107   { return internal; }
108 
109   inline int get_nvalues()
110   { return nvalues; }
111 
112  protected:
113   void parse_args(int narg, char **arg);
114 
115  private:
116   char *variablename;   // name of the variable (used for identification by other fixes)
117   int data_style;       // 0 if a scalar is registered, 1 if vector
118   int commGhost;        // 1 if communicated to ghost particles (via pack_comm/unpack_comm), 0 if not
119   int commGhostRev;     // 1 if rev communicated from ghost particles (via pack_comm_rev/unpack_comm_rev), 0 if not
120   int nvalues;
121   int nmaxGrown_;
122   double *defaultvalues; // default values at particle creation
123 
124   // in case of initialization from property - name of property
125   char *propertyname;
126   double *property;
127 
128   double extra_value;
129 
130   // switch for auto-output
131   bool internal;
132 }; //end class
133 
134 }
135 #endif
136 #endif
137