https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ExodusFormatter.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10// MOOSE includes
11#include "ExodusFormatter.h"
12#include "Parser.h"
13#include "MooseApp.h"
14#include "SystemInfo.h"
15#include "CommandLine.h"
16#include "ActionWarehouse.h"
17#include "ConsoleUtils.h"
18
19#include "libmesh/exodusII.h"
20
21// C++
22#include <sstream>
23#include <vector>
24
26
27void
29{
30 _ss << "####################\n"
31 << "# Created by MOOSE #\n"
32 << "####################\n";
33
34 // write Console output header info
36
37 // write input file syntax
38 _ss << "### Input File ###" << std::endl;
40}
41
42void
44{
45 std::string s;
46 _input_file_record.clear();
47
48 while (std::getline(_ss, s))
49 {
50 // MAX_LINE_LENGTH is from ExodusII
51 if (s.length() > MAX_LINE_LENGTH)
52 {
53 const std::string continuation("...");
54 const size_t cont_len = continuation.length();
55 size_t num_lines = s.length() / (MAX_LINE_LENGTH - cont_len) + 1;
56 std::string split_line;
57 for (size_t j = 0, l_begin = 0; j < num_lines; ++j, l_begin += MAX_LINE_LENGTH - cont_len)
58 {
59 size_t l_len = MAX_LINE_LENGTH - cont_len;
60 if (s.length() < l_begin + l_len)
61 l_len = s.length() - l_begin;
62
63 split_line = s.substr(l_begin, l_len);
64
65 if (l_begin + l_len != s.length())
66 split_line += continuation;
67
68 _input_file_record.push_back(split_line);
69 }
70 }
71 else
72 _input_file_record.push_back(s);
73 }
74}
Storage for action instances.
void printInputFile(std::ostream &out)
This method uses the Actions in the warehouse to reproduce the input file.
MooseApp & mooseApp()
void printInputFile(ActionWarehouse &wh)
std::stringstream _ss
std::vector< std::string > _input_file_record
This class produces produces a dump of the InputParameters that appears like the normal input file sy...
std::string outputFrameworkInformation(const MooseApp &app)
Outputs framework information.