1 /* ----------------------------------------------------------------------
2    SPARTA - Stochastic PArallel Rarefied-gas Time-accurate Analyzer
3    http://sparta.sandia.gov
4    Steve Plimpton, sjplimp@sandia.gov, Michael Gallis, magalli@sandia.gov
5    Sandia National Laboratories
6 
7    Copyright (2014) Sandia Corporation.  Under the terms of Contract
8    DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
9    certain rights in this software.  This software is distributed under
10    the GNU General Public License.
11 
12    See the README file in the top-level SPARTA directory.
13 ------------------------------------------------------------------------- */
14 
15 #ifdef COMMAND_CLASS
16 
17 CommandStyle(write_restart,WriteRestart)
18 
19 #else
20 
21 #ifndef SPARTA_WRITE_RESTART_H
22 #define SPARTA_WRITE_RESTART_H
23 
24 #include "stdio.h"
25 #include "pointers.h"
26 
27 namespace SPARTA_NS {
28 
29 class WriteRestart : protected Pointers {
30  public:
31   WriteRestart(class SPARTA *);
32   void command(int, char **);
33   void multiproc_options(int, int, char **);
34   void write(char *);
35   void write_less_memory(char *);
36 
37  private:
38   int me,nprocs;
39   FILE *fp;
40 
41   int multiproc;             // 0 = proc 0 writes for all
42                              // else # of procs writing files
43   int nclusterprocs;         // # of procs in my cluster that write to one file
44   int filewriter;            // 1 if this proc writes a file, else 0
45   int fileproc;              // ID of proc in my cluster who writes to file
46   int icluster;              // which cluster I am in
47 
48   void header();
49   void box_params();
50   void particle_params();
51   void grid_params();
52   void surf_params();
53   void file_layout(int);
54 
55   void magic_string();
56   void endian();
57   void version_numeric();
58 
59   void write_int(int, int);
60   void write_bigint(int, bigint);
61   void write_double(int, double);
62   void write_string(int, char *);
63   void write_int_vec(int, int, int *);
64   void write_double_vec(int, int, double *);
65   void write_char_vec(int, bigint, char *);
66   void write_char_vec(int, bigint, int, char *);
67   void write_char_vec(int, char *);
68 };
69 
70 }
71 
72 #endif
73 #endif
74 
75 /* ERROR/WARNING messages:
76 
77 E: Cannot write restart file before grid is defined
78 
79 Self-explanatory.
80 
81 E: Illegal ... command
82 
83 Self-explanatory.  Check the input script syntax and compare to the
84 documentation for the command.  You can use -echo screen as a
85 command-line option when running SPARTA to see the offending line.
86 
87 E: Cannot use write_restart fileper without % in restart file name
88 
89 Self-explanatory.
90 
91 E: Cannot use write_restart nfile without % in restart file name
92 
93 Self-explanatory.
94 
95 E: Cannot open restart file %s
96 
97 The specified file cannot be opened.  Check that the path and name are
98 correct.  If the file is a compressed file, also check that the gzip
99 executable can be found and run.
100 
101 */
102