https://mooseframework.inl.gov
FileOutput.h
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 #pragma once
11 
12 // MOOSE includes
13 #include "PetscOutput.h"
14 
20 class FileOutput : public PetscOutput
21 {
22 public:
24 
29 
34  virtual std::string filename();
35 
41  void setFileBase(const std::string & file_base);
42 
49  void setFileNumber(unsigned int num);
50 
57  unsigned int getFileNumber();
58 
59 protected:
63  virtual bool shouldOutput() override;
64 
70  bool checkFilename();
71 
77  virtual void setFileBaseInternal(const std::string & file_base);
78 
80  unsigned int & _file_num;
81 
83  unsigned int _padding;
84 
86  std::vector<std::string> _output_if_base_contains;
87 
89  std::string _file_base;
90 
91 private:
92  // OutputWarehouse needs access to _file_num for MultiApp ninja wizardry (see
93  // OutputWarehouse::merge)
94  friend class OutputWarehouse;
95 };
virtual void setFileBaseInternal(const std::string &file_base)
Internal function that sets the file_base.
Definition: FileOutput.C:126
virtual bool shouldOutput() override
Checks if the output method should be executed.
Definition: FileOutput.C:80
virtual std::string filename()
The filename for the output file.
Definition: FileOutput.C:113
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
unsigned int getFileNumber()
Return the current file number for this outputter.
Definition: FileOutput.C:180
std::string _file_base
The base filename from the input paramaters.
Definition: FileOutput.h:89
void setFileNumber(unsigned int num)
Sets the file number manually.
Definition: FileOutput.C:174
unsigned int _padding
Number of digits to pad the extensions.
Definition: FileOutput.h:83
void setFileBase(const std::string &file_base)
Sets the file base string if the &#39;file_base&#39; parameter is not set.
Definition: FileOutput.C:119
static InputParameters validParams()
Definition: FileOutput.C:24
Class for storing and utilizing output objects.
std::vector< std::string > _output_if_base_contains
Storage for &#39;output_if_base_contains&#39;.
Definition: FileOutput.h:86
const InputParameters & parameters() const
Get the parameters of the object.
unsigned int & _file_num
A file number counter, initialized to 0 (this must be controlled by the child class, see Exodus)
Definition: FileOutput.h:80
FileOutput(const InputParameters &parameters)
Class constructor.
Definition: FileOutput.C:57
An outputter with filename support.
Definition: FileOutput.h:20
Adds the ability to output on every nonlinear and/or linear residual.
Definition: PetscOutput.h:41
bool checkFilename()
Checks the filename for output Checks the output against the &#39;output_if_base_contians&#39; list...
Definition: FileOutput.C:88