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/global,FixPropertyGlobal)
45 FixStyle(custom_property/global,FixPropertyGlobal)
46 FixStyle(property/atomtype,FixPropertyGlobal)
47 FixStyle(property/atomtypepair,FixPropertyGlobal)
48 
49 #else
50 
51 #ifndef LMP_FIX_PROPERTYGLOBAL_H
52 #define LMP_FIX_PROPERTYGLOBAL_H
53 #include "fix.h"
54 #include "input.h"
55 
56 namespace LAMMPS_NS {
57 
58 enum
59 {
60         FIXPROPERTY_GLOBAL_SCALAR = 0,
61         FIXPROPERTY_GLOBAL_VECTOR = 1,
62         FIXPROPERTY_GLOBAL_MATRIX = 2
63 };
64 
65 class FixPropertyGlobal : public Fix {
66  friend class CfdDatacouplingFile;
67  friend class FixSph;
68  friend class PairSph;
69  friend class Properties;
70  friend class FixTempFromFile;
71 
72  public:
73   FixPropertyGlobal(class LAMMPS *, int, char **);
74   ~FixPropertyGlobal();
75   int setmask();
76   void init();
77   void pre_delete(bool unfixflag);
78 
79   Fix* check_fix(const char *varname,const char *svmstyle,int len1,int len2,const char *caller,bool errflag);
80 
81   double memory_usage();
82   double compute_scalar();
83   double compute_vector(int);
84   double compute_vector_modified(int);
85   double compute_array(int,int);
86   double compute_array_modified(int,int);
87   void vector_modify(int,double);
88   void array_modify(int,int,double);
89   void new_array(int l1,int l2);
90   int modify_param(int narg, char **arg);
91 
92   //bool checkCorrectness(int,char*,int,int);
93 
94   const double* get_values() {return values;}
95   const double* get_values_modified() {return values_recomputed;}
96   double const* const* get_array() {return array;}
97   double const* const* get_array_modified() {return array_recomputed;}
98 
99   void grow(int,int);
100 
101   void write();
102 
103  private:
104 
105   char *variablename;        // name of the variable (used for identification by other fixes)
106   int data_style;            // 0 if a scalar is registered, 1 if vector, 2 if 2d array (matrix)
107   int nvalues;
108   int nvalues_new_array;
109 
110   bool is_symmetric;         // flag if values must be symmetric (only applicable for matrix)
111   bool is_atomtype_bound;    // flag if # values is bound to # atom types
112   double *values;            // original values to be stored in this fix
113   double *values_recomputed; // values to be stored in this fix, recomputed by eg another fix
114   double **array;
115   double **array_recomputed;
116 
117   char *filename;
118   char *grpname;
119   int me;
120 
121 }; //end class
122 
123 }
124 #endif
125 #endif
126