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     Anton Gladky(TU Bergakademie Freiberg), gladky.anton@gmail.com
36 ------------------------------------------------------------------------- */
37 
38 #if defined(LAMMPS_VTK)
39 #ifdef DUMP_CLASS
40 
41 DumpStyle(atom/vtk,DumpATOMVTK)
42 
43 #else
44 
45 #ifndef LMP_DUMP_ATOM_VTK_H
46 #define LMP_DUMP_ATOM_VTK_H
47 
48 #include "dump.h"
49 #include "dump_vtk.h"
50 #include <iostream>
51 #include <vector>
52 #include <fstream>
53 #include "update.h"
54 
55 namespace LAMMPS_NS {
56 
57 class DumpATOMVTK : public Dump
58 {
59  public:
60   DumpATOMVTK(class LAMMPS *, int, char**);
61   int modify_param(int narg, char **arg);
62 
63  private:
64   void init_style();
65   void write_header(bigint);
66   int count();
67   void pack(int *);
68   void write_data(int, double *);
69 
70   int n_calls_;
71   char * filecurrent;
72   void setFileCurrent();
73 
74   class V3 {
75     public:
76       V3() {v[0]=v[1]=v[2]=0.0;}
77       V3(double x, double y, double z) {v[0]=x;v[1]=y;v[2]=z;}
78       double& operator[](int idx) {return v[idx];}
79       const double& operator[](int idx) const {return v[idx];}
80       double v[3];
81   };
82 
83   typedef DumpATOMVTK::V3 V3;
84 
85   class DataVTK {
86     public:
87       V3 _Pos;
88       double _Rad;
89       double _Mass;
90       int _Id;
91       int _Type;
92       V3 _VelL;
93       V3 _VelA;
94       V3 _Force;
95       int _proc;
96       DataVTK(V3, double, double, int, int, V3, V3, V3, int);
97       std::string serialize();
98   };
99 
100   class vtkExportData : public DumpVTK
101   {
102     private:
103       std::vector<DumpATOMVTK::DataVTK> vtkData;
104       std::ofstream fileVTK;
105       const char * _fileName;
106       bool _setFileName;
107     public:
108       vtkExportData(LAMMPS *lmp);
109       void add(DumpATOMVTK::DataVTK &);
110       int size();
111       void writeSER();
112       void setFileName(const char *);
113       void show();
114       void clear();
115       int modify_param(int narg, char **arg);
116   };
117 
118   vtkExportData tmpEXP;
119 
120 };
121 
122 }
123 
124 #endif
125 #endif
126 #endif
127