deal2lkit: A ToolKit library for Deal.II
ParsedDataOut< dim, spacedim > Class Template Reference

#include <parsed_data_out.h>

Inheritance diagram for ParsedDataOut< dim, spacedim >:
ParameterAcceptor Subscriptor

Public Member Functions

 ParsedDataOut (const std::string &name="", const std::string &output_format="vtu", const unsigned int &subdivisions=1, const std::string &incremental_run_prefix="", const std::string &base_name_input="solution", const std::string &files_to_save="", const MPI_Comm &comm=MPI_COMM_WORLD)
 Optional name for parameter section. More...
 
virtual void declare_parameters (ParameterHandler &prm)
 Initialize the given values for the paramter file. More...
 
virtual void parse_parameters_call_back ()
 Prepare names for output directories. More...
 
void prepare_data_output (const DoFHandler< dim, spacedim > &dh, const std::string &suffix="")
 Prepare to output data on the given file. More...
 
template<typename VECTOR >
void add_data_vector (const VECTOR &data_vector, const std::string &desc)
 Add the given vector to the output file. More...
 
template<typename VECTOR >
void add_data_vector (const VECTOR &data_vector, const DataPostprocessor< spacedim > &postproc)
 Wrapper for the corrisponding function in dealii. More...
 
void write_data_and_clear (const Mapping< dim, spacedim > &mapping=StaticMappingQ1< dim, spacedim >::mapping)
 Actually write the file. More...
 
- Public Member Functions inherited from ParameterAcceptor
 ParameterAcceptor (const std::string section_name="")
 The constructor adds derived classes to the list of acceptors. More...
 
virtual ~ParameterAcceptor ()
 The destructor sets to zero the pointer relative to this index, so that it is safe to destroy the mother class. More...
 
virtual void parse_parameters (ParameterHandler &prm)
 Parse the parameter file. More...
 
std::string get_section_name () const
 Return the section name of this class. More...
 
std::vector< std::string > get_section_path () const
 Travers all registered classes, and figure out what subsections we need to enter. More...
 
template<class T >
void add_parameter (ParameterHandler &prm, T *parameter, const std::string &entry, const std::string &default_value, const Patterns::PatternBase &pattern=Patterns::Anything(), const std::string &documentation=std::string())
 Add a parameter the given parameter list. More...
 
template<class T >
void add_parameter (T &parameter, const std::string &entry, const std::string &documentation=std::string(), ParameterHandler &prm=ParameterAcceptor::prm)
 Add a parameter to the global parameter handler ParameterAcceptor::prm. More...
 
void enter_my_subsection (ParameterHandler &prm)
 Make sure we enter the right subsection of the global parameter file. More...
 
void leave_my_subsection (ParameterHandler &prm)
 This function undoes what the enter_my_subsection() function did. More...
 
template<>
std_cxx11::shared_ptr< Patterns::PatternBaseto_pattern (const double &)
 double More...
 
template<>
std::string to_string (const double &entry)
 
template<>
double to_type (const std::string &parameter)
 
template<>
std_cxx11::shared_ptr< Patterns::PatternBaseto_pattern (const int &)
 int More...
 
template<>
std::string to_string (const int &entry)
 
template<>
int to_type (const std::string &parameter)
 
template<>
std_cxx11::shared_ptr< Patterns::PatternBaseto_pattern (const unsigned int &)
 unsigned int More...
 
template<>
std::string to_string (const unsigned int &entry)
 
template<>
unsigned int to_type (const std::string &parameter)
 
template<>
std_cxx11::shared_ptr< Patterns::PatternBaseto_pattern (const bool &)
 bool More...
 
template<>
std::string to_string (const bool &entry)
 
template<>
bool to_type (const std::string &parameter)
 
- Public Member Functions inherited from Subscriptor
 Subscriptor ()
 
 Subscriptor (const Subscriptor &)
 
 Subscriptor (Subscriptor &&)
 
virtual ~Subscriptor ()
 
Subscriptoroperator= (const Subscriptor &)
 
Subscriptoroperator= (Subscriptor &&)
 
void subscribe (const char *identifier=0) const
 
void unsubscribe (const char *identifier=0) const
 
unsigned int n_subscriptions () const
 
void list_subscribers () const
 
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

bool initialized
 Initialization flag. More...
 
const MPI_Comm & comm
 MPI communicator. More...
 
const unsigned int n_mpi_processes
 Number of processes. More...
 
const unsigned int this_mpi_process
 My mpi process. More...
 
std::string path_solution_dir
 Folder where solutions are stored. More...
 
std::string output_format
 Output format. More...
 
unsigned int subdivisions
 Number of subdivisions. More...
 
std::string base_name
 Base name for output files. More...
 
std::string incremental_run_prefix
 name of progressive directories. More...
 
std::string files_to_save
 a list of file to save at each run in @ incremental_run_prefix directory. More...
 
std::string solution_names
 Solution names. More...
 
std::string current_name
 Current output name. More...
 
bool output_partitioning
 Output the partitioning of the domain. More...
 
std::ofstream output_file
 Output file. More...
 
shared_ptr< DataOut< dim, DoFHandler< dim, spacedim > > > data_out
 Outputs only the data that refers to this process. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ParameterAcceptor
static void initialize (const std::string filename="", const std::string outfilename="")
 Call declare_all_parameters(), read filename (if it is present as input parameter) and parse_all_parameters() on the static member prm. More...
 
static void clear ()
 Clear class list and global parameter file. More...
 
static void parse_all_parameters (ParameterHandler &prm=ParameterAcceptor::prm)
 Parse the given ParameterHandler. More...
 
static void log_info ()
 Print information about all stored classes. More...
 
static void declare_all_parameters (ParameterHandler &prm=ParameterAcceptor::prm)
 Initialize the ParameterHandler with all derived classes parameters.This function enters the subsection returned by get_section_name() for each derived class, and declares all parameters that were added using add_parameter(). More...
 
template<class T >
static std_cxx11::shared_ptr< Patterns::PatternBaseto_pattern (const T &)
 Given a class T, construct its default pattern to be used when declaring parameters. More...
 
template<class T >
static T to_type (const std::string &)
 Given a string, fill the value of the given parameter. More...
 
template<class T >
static std::string to_string (const T &)
 Given a parameter, return a string containing the given parameter. More...
 
- Static Public Member Functions inherited from Subscriptor
static::ExceptionBase & ExcInUse (int arg1, char *arg2, std::string &arg3)
 
static::ExceptionBase & ExcNoSubscriber (char *arg1, char *arg2)
 
- Static Public Attributes inherited from ParameterAcceptor
static ParameterHandler prm
 Static parameter. More...
 
- Protected Attributes inherited from ParameterAcceptor
const std::string section_name
 The subsection name for this class. More...
 

Detailed Description

template<int dim, int spacedim = dim>
class ParsedDataOut< dim, spacedim >

Definition at line 37 of file parsed_data_out.h.

Constructor & Destructor Documentation

§ ParsedDataOut()

template<int dim, int spacedim>
DEAL_II_DISABLE_EXTRA_DIAGNOSTICS DEAL_II_ENABLE_EXTRA_DIAGNOSTICS ParsedDataOut< dim, spacedim >::ParsedDataOut ( const std::string &  name = "",
const std::string &  output_format = "vtu",
const unsigned int &  subdivisions = 1,
const std::string &  incremental_run_prefix = "",
const std::string &  base_name_input = "solution",
const std::string &  files_to_save = "",
const MPI_Comm &  comm = MPI_COMM_WORLD 
)

Optional name for parameter section.

incremental_run_prefix creates a progressive directories/subdirectories for every run. For istance if incremental_run_prefix = "sol/run" the function will create sol/run001 the first time the code is runned, sol/run002 the second time, and so on.

Definition at line 44 of file parsed_data_out.cc.

Member Function Documentation

§ add_data_vector() [1/2]

template<int dim, int spacedim>
template<typename VECTOR >
void ParsedDataOut< dim, spacedim >::add_data_vector ( const VECTOR &  data_vector,
const std::string &  desc 
)

Add the given vector to the output file.

Prior to calling this method, you have to call the prepare_data_output method. The string can be a comma separated list of components, or a single description. In this latter case, a progressive number per component is added in the end.

Definition at line 155 of file parsed_data_out.h.

§ add_data_vector() [2/2]

template<int dim, int spacedim>
template<typename VECTOR >
void ParsedDataOut< dim, spacedim >::add_data_vector ( const VECTOR &  data_vector,
const DataPostprocessor< spacedim > &  postproc 
)

Wrapper for the corrisponding function in dealii.

Definition at line 201 of file parsed_data_out.h.

§ declare_parameters()

template<int dim, int spacedim>
void ParsedDataOut< dim, spacedim >::declare_parameters ( ParameterHandler prm)
virtual

Initialize the given values for the paramter file.

Reimplemented from ParameterAcceptor.

Definition at line 65 of file parsed_data_out.cc.

§ parse_parameters_call_back()

template<int dim, int spacedim>
void ParsedDataOut< dim, spacedim >::parse_parameters_call_back ( )
virtual

Prepare names for output directories.

Reimplemented from ParameterAcceptor.

Definition at line 88 of file parsed_data_out.cc.

§ prepare_data_output()

template<int dim, int spacedim>
void ParsedDataOut< dim, spacedim >::prepare_data_output ( const DoFHandler< dim, spacedim > &  dh,
const std::string &  suffix = "" 
)

Prepare to output data on the given file.

This will initialize the data_out object and a file with a filename that is the combination of the base_name, the optional suffix, eventually a processor number and the output suffix.

Definition at line 112 of file parsed_data_out.cc.

§ write_data_and_clear()

template<int dim, int spacedim>
void ParsedDataOut< dim, spacedim >::write_data_and_clear ( const Mapping< dim, spacedim > &  mapping = StaticMappingQ1<dim,spacedim>::mapping)

Actually write the file.

Once the data_out has been prepared, vectors have been added, the data can be written to a file. This is done in this class. At the end of this function call, data_out and output_file are in a pristine situation, and the process can be started again. used_files is an optional variable that takes a list of useful files (ex. "parameter.prm time.dat") and copies these files in the incremental_run_prefix of the costructor function.

Definition at line 166 of file parsed_data_out.cc.

Member Data Documentation

§ base_name

template<int dim, int spacedim = dim>
std::string ParsedDataOut< dim, spacedim >::base_name
private

Base name for output files.

This base is used to generate all filenames.

Definition at line 116 of file parsed_data_out.h.

§ comm

template<int dim, int spacedim = dim>
const MPI_Comm& ParsedDataOut< dim, spacedim >::comm
private

MPI communicator.

Definition at line 97 of file parsed_data_out.h.

§ current_name

template<int dim, int spacedim = dim>
std::string ParsedDataOut< dim, spacedim >::current_name
private

Current output name.

When preparing data_out, this name will contain the base for the current output. This allows the user to use a different output name in different part of the program.

Definition at line 136 of file parsed_data_out.h.

§ data_out

template<int dim, int spacedim = dim>
shared_ptr<DataOut<dim, DoFHandler<dim, spacedim> > > ParsedDataOut< dim, spacedim >::data_out
private

Outputs only the data that refers to this process.

Definition at line 145 of file parsed_data_out.h.

§ files_to_save

template<int dim, int spacedim = dim>
std::string ParsedDataOut< dim, spacedim >::files_to_save
private

a list of file to save at each run in @ incremental_run_prefix directory.

This list should be separated usign '', e.g.: file1.txt % file2.dat % etc..

Definition at line 128 of file parsed_data_out.h.

§ incremental_run_prefix

template<int dim, int spacedim = dim>
std::string ParsedDataOut< dim, spacedim >::incremental_run_prefix
private

name of progressive directories.

One for every run. For example sol/run will produces sol/run001 for the first run, sol/run002 for the second, and so on.

Definition at line 121 of file parsed_data_out.h.

§ initialized

template<int dim, int spacedim = dim>
bool ParsedDataOut< dim, spacedim >::initialized
private

Initialization flag.

Definition at line 94 of file parsed_data_out.h.

§ n_mpi_processes

template<int dim, int spacedim = dim>
const unsigned int ParsedDataOut< dim, spacedim >::n_mpi_processes
private

Number of processes.

Definition at line 100 of file parsed_data_out.h.

§ output_file

template<int dim, int spacedim = dim>
std::ofstream ParsedDataOut< dim, spacedim >::output_file
private

Output file.

Definition at line 142 of file parsed_data_out.h.

§ output_format

template<int dim, int spacedim = dim>
std::string ParsedDataOut< dim, spacedim >::output_format
private

Output format.

Definition at line 109 of file parsed_data_out.h.

§ output_partitioning

template<int dim, int spacedim = dim>
bool ParsedDataOut< dim, spacedim >::output_partitioning
private

Output the partitioning of the domain.

Definition at line 139 of file parsed_data_out.h.

§ path_solution_dir

template<int dim, int spacedim = dim>
std::string ParsedDataOut< dim, spacedim >::path_solution_dir
private

Folder where solutions are stored.

Definition at line 106 of file parsed_data_out.h.

§ solution_names

template<int dim, int spacedim = dim>
std::string ParsedDataOut< dim, spacedim >::solution_names
private

Solution names.

Definition at line 131 of file parsed_data_out.h.

§ subdivisions

template<int dim, int spacedim = dim>
unsigned int ParsedDataOut< dim, spacedim >::subdivisions
private

Number of subdivisions.

Definition at line 112 of file parsed_data_out.h.

§ this_mpi_process

template<int dim, int spacedim = dim>
const unsigned int ParsedDataOut< dim, spacedim >::this_mpi_process
private

My mpi process.

Definition at line 103 of file parsed_data_out.h.


The documentation for this class was generated from the following files: