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 Arno Mayrhofer (DCS Computing GmbH, Linz) 38 39 Copyright 2017- DCS Computing GmbH, Linz 40 ------------------------------------------------------------------------- */ 41 42 #ifdef LAMMPS_VTK 43 44 #ifndef LMP_DUMP_VTK_H 45 #define LMP_DUMP_VTK_H 46 47 #include "lammps.h" 48 #include <vtkSmartPointer.h> 49 #include <vtkXMLWriter.h> 50 #include <vtkDataWriter.h> 51 #include <vtkDataObject.h> 52 #include <vtkAlgorithmOutput.h> 53 #include <vtkMPIController.h> 54 #include <list> 55 #include <string> 56 57 namespace LAMMPS_NS 58 { 59 60 namespace VTK_FILE_FORMATS 61 { 62 // file formats 63 // serial need to come first 64 enum 65 { 66 VTK, 67 VTP, 68 VTU, 69 VTI, 70 VTR, 71 VTM, 72 PVTP, 73 PVTU, 74 PVTI, 75 PVTR, 76 VTK_INVALID 77 }; 78 79 // number of serial vtk file types 80 const int vtk_serial_file_types = 6; 81 }; // namespace VTK_FILE_FORMATS 82 83 class DumpVTK 84 { 85 public: 86 DumpVTK(LAMMPS *lmp); 87 88 int modify_param(int narg, char **arg); 89 90 void setVtkWriterOptions(vtkSmartPointer<vtkXMLWriter> writer); 91 void setVtkWriterOptions(vtkSmartPointer<vtkDataWriter> writer); 92 93 void write_vtp(vtkSmartPointer<vtkDataObject> data, const int vtk_file_format, const char * const filename); 94 void write_vtu(vtkSmartPointer<vtkDataObject> data, const int vtk_file_format, const char * const filename); 95 void write_vti(vtkSmartPointer<vtkAlgorithmOutput> data, const int vtk_file_format, const char * const filename); 96 void write_vtr(vtkSmartPointer<vtkDataObject> data, const int vtk_file_format, const char * const filename); 97 98 void write_vtk_poly(vtkSmartPointer<vtkDataObject> data, const int vtk_file_format, const char * const filename, char * const label = NULL); 99 void write_vtk_unstructured_grid(vtkSmartPointer<vtkDataObject> data, const int vtk_file_format, const char * const filename, char * const label = NULL); 100 void write_vtk_rectilinear_grid(vtkSmartPointer<vtkDataObject> data, const int vtk_file_format, const char * const filename, char * const label = NULL); 101 102 vtkMPIController *getLocalController(); 103 104 void setFileCurrent(char * &filecurrent, char * const filename, const int multifile, const int padflag); 105 int identify_file_type(char * const filename, std::list<int> &allowed_extensions, char * const style, int &multiproc, int &nclusterprocs, int &filewriter, int &fileproc, MPI_Comm &world, MPI_Comm &clustercomm); 106 107 private: 108 109 void type_error(std::string msg, char * const style, std::list<int> &allowed_extensions); 110 111 // compressors 112 enum 113 { 114 VTK_COMP_ZLIB, 115 #if VTK_MAJOR_VERSION >= 8 116 VTK_COMP_LZ4, 117 #endif 118 VTK_COMP_NONE 119 }; 120 121 LAMMPS *lmp_; 122 int vtk_compressor_; 123 bool binary_; 124 125 char * filesuffixes[VTK_FILE_FORMATS::VTK_INVALID]; 126 }; 127 128 }; // namespace 129 130 #endif // LMP_DUMP_VTK_H 131 132 #endif // LAMMPS_VTK 133