libMesh
Loading...
Searching...
No Matches
getpot_parse.C
Go to the documentation of this file.
1// The libMesh Finite Element Library.
2// Copyright (C) 2002-2026 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18
19
20// Open the getpot input file given by the input file name; write out
21// all GetPot object data to the output file name
22#include "libmesh/libmesh_config.h"
23#include "libmesh/getpot.h"
24
25#include <fstream>
26
27int main(int argc, char ** argv)
28{
29 using namespace libMesh;
30
31 libmesh_error_msg_if(argc < 2, "Usage: " << argv[0] << " inputconfigfile [outputconfigfile]");
32
33 GetPot gp(argv[1]);
34
35 std::ostream *my_out;
36 std::ofstream fout;
37 fout.exceptions ( std::ofstream::failbit | std::ofstream::badbit );
38
39 if (argc < 3)
40 my_out = &std::cout;
41 else
42 {
43 fout.open(argv[2]);
44 my_out = &fout;
45 }
46
47 gp.print("", *my_out, 1);
48}
The libMesh namespace provides an interface to certain functionality in the library.
int main()