Entry point of the FSI-suite programs. More...
#include <mesh_handler.h>
Public Member Functions | |
MeshHandler () | |
Construct a new Mesh Handler object. More... | |
void | run () |
Run the actual MeshHandler application. More... | |
![]() | |
ParameterAcceptor (const std::string §ion_name="") | |
unsigned int | get_acceptor_id () const |
virtual | ~ParameterAcceptor () override |
virtual void | declare_parameters (ParameterHandler &prm) |
virtual void | parse_parameters (ParameterHandler &prm) |
std::string | get_section_name () const |
std::vector< std::string > | get_section_path () const |
void | add_parameter (const std::string &entry, ParameterType ¶meter, const std::string &documentation="", ParameterHandler &prm_=prm, const Patterns::PatternBase &pattern=*Patterns::Tools::Convert< ParameterType >::to_pattern()) |
void | enter_subsection (const std::string &subsection) |
void | leave_subsection () |
void | enter_my_subsection (ParameterHandler &prm) |
void | leave_my_subsection (ParameterHandler &prm) |
void | serialize (Archive &ar, const unsigned int version) |
void | subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
void | unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
unsigned int | n_subscriptions () const |
void | list_subscribers (StreamType &stream) const |
void | list_subscribers () const |
void | subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
void | unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
unsigned int | n_subscriptions () const |
void | list_subscribers (StreamType &stream) const |
void | list_subscribers () const |
![]() | |
Subscriptor () | |
Subscriptor (const Subscriptor &) | |
Subscriptor (Subscriptor &&) noexcept | |
virtual | ~Subscriptor () |
Subscriptor & | operator= (const Subscriptor &) |
Subscriptor & | operator= (Subscriptor &&) noexcept |
void | serialize (Archive &ar, const unsigned int version) |
void | subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
void | unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
unsigned int | n_subscriptions () const |
void | list_subscribers (StreamType &stream) const |
void | list_subscribers () const |
void | subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
void | unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
unsigned int | n_subscriptions () const |
void | list_subscribers (StreamType &stream) const |
void | list_subscribers () const |
Private Attributes | |
unsigned int | verbosity = 2 |
Verbosity to use in the LogStream class. More... | |
ParsedTools::GridGenerator< dim, spacedim > | pgg |
The actual ParsedTools::GridGenerator object. More... | |
Additional Inherited Members | |
![]() | |
static void | initialize (const std::string &filename="", const std::string &output_filename="", const ParameterHandler::OutputStyle output_style_for_output_filename=ParameterHandler::Short, ParameterHandler &prm=ParameterAcceptor::prm, const ParameterHandler::OutputStyle output_style_for_filename=ParameterHandler::DefaultStyle) |
static void | initialize (std::istream &input_stream, ParameterHandler &prm=ParameterAcceptor::prm) |
static void | clear () |
static void | parse_all_parameters (ParameterHandler &prm=ParameterAcceptor::prm) |
static void | declare_all_parameters (ParameterHandler &prm=ParameterAcceptor::prm) |
static ::ExceptionBase & | ExcInUse (int arg1, std::string arg2, std::string arg3) |
static ::ExceptionBase & | ExcNoSubscriber (std::string arg1, std::string arg2) |
![]() | |
static ::ExceptionBase & | ExcInUse (int arg1, std::string arg2, std::string arg3) |
static ::ExceptionBase & | ExcNoSubscriber (std::string arg1, std::string arg2) |
![]() | |
boost::signals2::signal< void()> | declare_parameters_call_back |
boost::signals2::signal< void()> | parse_parameters_call_back |
![]() | |
static ParameterHandler | prm |
![]() | |
const std::string | section_name |
std::vector< std::string > | subsections |
Entry point of the FSI-suite programs.
In general individual programs are as small as possible, and as clean as possible. Each code solves a single problem. A lot of duplication is unavoidable, but this has the advantage that it is easy to make incremental steps, and understand the most difficult parts of the FSI suite by walking through examples that increase in complexity, pretty much like it is done in the deal.II tutorial programs.
The structure of the FSI suite programs follows very closely deal.II tutorial programs. In each program, I try to point the reader to the steps that are required to understand what is going on. This program, for example, is the FSI-suite equivalent of the deal.II tutorial program step-1.
We show here how to run any of the FSI-suite programs, and how the wrappers of the ParsedTools namespace are designed.
In general each program is split in three parts: a header file, containing the main class declaration (in the directory include), a source file (in the directory include) containing the implementation of the main class, and a main application file (in the directory apps), containing only the main function.
This particular case is a bit different, since we only have one single function in the class declaration, and we do not split it into a header and a source file, but keep everything here.
Each class is derived from ParameterAcceptor, and has a public constructor that takes no arguments (or only arguments for which a default is specified). The user entry point for each class is the method run(). The main functions in the apps folder (see the mesh_handler.cc file) take care of parsing the command line, deducing from the command line (or from the name of the paramter file) in what dimension and space dimension you want to run the code, and then they instantiate the specific class for the specific dimension and spacedimension combination, read parameters from the parameter file, and execute the run()
method of the class.
The interface to all programs is uniform. Running any of the programs with an -h
or --help
argument will return something like the following:
followed by a list of parameters that you can change from the command line, or from within a parameter file.
For this class, we have the following options, which are printed after the more general section described above:
Every program in the FSI-suite can be executed by calling it with arguments specifying the dimension and space dimension, or can deduce these numbers from the naming scheme of your parameter file. For example:
will run the poisson problem in dimension 2 with spacedimension 3, reading options from the input.prm
file in the current directory, and writing all used options in the output.prm
file in the current directory.
The same effect can be obtained by naming your parameter file in such a way that the filename contains the combination of dimension and spacedimension, or just one if they are the same. For example, the above example could have been achieved similarly by executing it as:
and an equivalent example running in two dimensions
Notice how you can specify the input paramter file also as the first positional arguement to the program, i.e., these are equivalent ways to run the program with the same parameters:
1d_2d
, and use -d 2
and -s 2
, or make sure that they are consistent: Notice that input.prm
does not need to exist prior to executing the program. If it does not exist, the program will create it for you, print an error message, and exit. If you run again the program with the same parameters, without changing the input file, it will run using all the default values for the parameters.
The file input.prm
may be empty, or may specify just the parameters that you want to change from their default value. If you specify a parameter in the command line, it will override the value specified in the parameter file.
The output file output.prm
will contain all the parameters that were used during the execution of the program, so that you can reproduce the results of the last simulation by simply re-running the program with the file that was just generated.
Any parameter that you can change from the parameter files, can be changed also from the command line. The opposite is also true, with the exception of the dimension (-d
or -dim
), space dimension ('-s' or -spacedim
), and the input and output parameter files (-i
and -o
), which do not have, in general, a correspondending entry in the parameter file itself.
For parameters with spaces in their names and sections, you can surround the option and/or the values by quotes.
The MeshHandler class does the following things, in order:
Input name
and Arguments
. This parameters are passed as they are to the deal.II function GridGenerator::generate_from_name_and_argument(). If this process fails, the Input name
is interpreted as a grid file name, which the ParsedTools::GridGenerator tries to open using one of the file readers available in the library. In this case, the Arguments
is interpreted as a map from a manifold id to a CAD file in IGES or STEP format, which is read into a OpenCascade::TopoDS_Shape objects, and used to describe the geometry of the grid.Initial grid refinement
Output name
, in a format which is deduced from the filename extension.Let's see a couple of examples for the mesh_handler
application. For example, running with the following command line:
will generate the file shell.prm
:
and the file hyper_shell.vtk
, which looks like:
and will print the following output to the screen:
dim | |
spacedim |
Definition at line 251 of file mesh_handler.h.
|
inline |
Construct a new Mesh Handler object.
The only role of this constructor is to initialize correctly all member classes that are derived from ParameterAcceptor, in this case only the ParsedTools::GridGenerator class.
Definition at line 261 of file mesh_handler.h.
References ParameterAcceptor::add_parameter(), and MeshHandler< dim, spacedim >::verbosity.
|
inline |
Run the actual MeshHandler application.
This function does the following things, in order:
Input name
and Arguments
. This parameters are passed as they are to the deal.II function GridGenerator::generate_from_name_and_argument(). If this process fails, the Input name
is interpreted as a grid file name, which the ParsedTools::GridGenerator tries to open using one of the file readers available in the library. In this case, the Arguments
is interpreted as a map from a manifold id to a CAD file in IGES or STEP format, which is read into a OpenCascade::TopoDS_Shape objects, and used to describe the geometry of the grid.Initial grid refinement
Output name
, in a format which is deduced from the filename extension.Definition at line 291 of file mesh_handler.h.
References deallog, LogStream::depth_console(), ParameterHandler::log_parameters(), MeshHandler< dim, spacedim >::pgg, ParsedTools::GridInfo::print_info(), ParameterAcceptor::prm, and MeshHandler< dim, spacedim >::verbosity.
|
private |
Verbosity to use in the LogStream class.
Definition at line 313 of file mesh_handler.h.
Referenced by MeshHandler< dim, spacedim >::MeshHandler(), and MeshHandler< dim, spacedim >::run().
|
private |
The actual ParsedTools::GridGenerator object.
Definition at line 318 of file mesh_handler.h.
Referenced by MeshHandler< dim, spacedim >::run().