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_CFD_DATACOUPLING_H
43 #define LMP_CFD_DATACOUPLING_H
44 
45 #include "pointers.h"
46 
47 namespace LAMMPS_NS {
48 
49 class CfdDatacoupling : protected Pointers {
50  public:
51 
52   CfdDatacoupling(class LAMMPS *lmp, int jarg, int narg, char **arg, class FixCfdCoupling* fc);
53   ~CfdDatacoupling();
54 
get_iarg()55   int get_iarg() {return iarg_;}
56 
57   void add_pull_property(const char*, const char*);
58   void add_push_property(const char*, const char*);
59 
60   virtual void pull(const char *name, const char *type, void *&ptr, const char *datatype);
61   virtual void push(const char *name, const char *type, void *&ptr, const char *datatype);
62 
63   virtual void allocate_external(int    **&data, int len2,int len1,int    initvalue);
64   virtual void allocate_external(double **&data, int len2,int len1,double initvalue);
65   virtual void allocate_external(int    **&data, int len2,const char *keyword,int initvalue);
66   virtual void allocate_external(double **&data, int len2,const char *keyword,double initvalue);
67 
68   void init();
post_create()69   virtual void post_create() {}
70 
error_push()71   virtual bool error_push()
72   { return true;}
73 
74   // exchange data with OF
75   // does nothing in case of MPI coupling
76   // for the MPI case, this is done withing the OF solver
77   virtual void exchange() = 0;
78   void check_datatransfer();
79 
80  protected:
81 
82   void grow_();
83 
84   // used to find properties
85   virtual void* find_pull_property(const char *name, const char *type, int &len1, int &len2);
86   virtual void* find_push_property(const char *name, const char *type, int &len1, int &len2);
87 
88   // data members
89 
90   bool liggghts_is_active;
91   bool is_parallel;
92 
93   // max # of values stored in pull/push lists
94   int nvalues_max_;
95 
96   // ------------------------------------
97   // per atom or global values stored inchar
98   // property fixes used in this fix
99   // they are pulled from OF each coupling ts
100   // ------------------------------------
101 
102   // number of values stored/used in this fix
103   int npull_;
104   // types can be scalar, vector
105   char **pullnames_;
106   char **pulltypes_;
107   // flag used to check if transfer invoked - only if liggghts is not active
108   int *pullinvoked_;
109 
110   // ------------------------------------
111   // values stored in atom or a fix property
112   // that are pushed to OF each coupling ts
113   // ------------------------------------
114 
115   int npush_;
116   char **pushnames_;
117   char **pushtypes_;
118   // flag used to check if transfer invoked - only if liggghts is not active
119   int *pushinvoked_;
120 
121   int iarg_;
122   class FixCfdCoupling *fc_;
123 
124   // reference to Properties class in PairGran
125   class Properties *properties_;
126 };
127 
128 }
129 
130 #endif
131