1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
/*
This file is part of LPIC++, a particle-in-cell code for
simulating the interaction of laser light with plasma.
Copyright (C) 1994-1997 Roland Lichters
LPIC++ is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//////////////////////////////////////////////////////////////////////////////////////////
//
// postprocessor for lpic++
//
//////////////////////////////////////////////////////////////////////////////////////////
#include <parameter.h>
parameter::parameter(int argc, char **argv)
: rf()
{
my_name = argv[0];
errname = new char [filename_size];
read_filename = new char [filename_size];
save_filename = new char [filename_size];
output_path = new char [filename_size];
save_path_name = new char [filename_size];
file_path = new char [filename_size];
if (argc<3) { // check commandline parameters
printf( "\n two arguments required: input and output path\n\n");
exit(0);
}
else {
strcpy( file_path, argv[1] );
strcpy( output_path, argv[2] );
}
sprintf( errname, "%s/error", output_path );
static error_handler bob("parameter::Constructor", errname );
bob.message( "sizeof(unsigned char)=",sizeof(unsigned char));
bob.message( "sizeof(int)=",sizeof(int));
bob.message("reading lpi data files from ", file_path);
bob.message("writing post files to ", output_path);
bob.message("reading further input from input.post");
cout << endl;
cout << "reading lpi data files from " << file_path << endl;
cout << "writing post-lpi files to " << output_path << endl;
cout << "reading further input from input.post" << endl << endl;
strcpy(read_filename,"input.post");
strcpy(save_filename,"output.post");
sprintf(save_path_name, "%s/%s", output_path, save_filename);
// read(read_filename);
save(save_path_name);
};
//////////////////////////////////////////////////////////////////////////////////////////
/*
void parameter::read(char *fname)
{
static error_handler bob("parameter::read", errname);
rf.openinput(fname);
rf.closeinput();
}
*/
//////////////////////////////////////////////////////////////////////////////////////////
void parameter::save(char *fname)
{
static error_handler bob("parameter::save", errname);
ofstream outfile(fname);
if (!outfile)
bob.error("Cannot open outfile: ", fname);
outfile << "postprocessor parameters:" << endl << endl;
outfile << "Input File Path" << endl;
outfile << "--------------------------------------------------" << endl;
outfile << "input file path: " << file_path << endl << endl;
outfile << "Output File Path" << endl;
outfile << "--------------------------------------------------" << endl;
outfile << "output path: " << output_path << endl << endl;
outfile.close();
}
//////////////////////////////////////////////////////////////////////////////////////////
//EOF
|