Parsed grid generator. More...
#include <parsed_grid_generator.h>
Public Member Functions | |
ParsedGridGenerator (const std::string section_name="", const std::string grid_type="rectangle", const std::string input_grid_file="", const std::string opt_point_1="", const std::string opt_point_2="", const std::string opt_colorize="false", const std::string opt_double_1="1.0", const std::string opt_double_2="0.5", const std::string opt_double_3="1.5", const std::string opt_int_1="1", const std::string opt_int_2="2", const std::string opt_vec_of_int="", const std::string mesh_smoothing="none", const std::string output_grid_file="", const std::string opt_manifold_descriptors="") | |
Constructor. More... | |
virtual void | declare_parameters (ParameterHandler &prm) |
Declare all parameters of this class. More... | |
Triangulation< dim, spacedim > * | serial () |
Return a pointer to a newly created serial Triangulation. More... | |
void | create (Triangulation< dim, spacedim > &tria) |
Generate the grid. More... | |
void | write (const Triangulation< dim, spacedim > &tria, const std::string &filename="") const |
Write the given Triangulation to the output file specified in Output file name , or in the optional file name. 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... | |
virtual void | parse_parameters_call_back () |
Parse parameter call back. 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 ¶meter, 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::PatternBase > | to_pattern (const double &) |
double More... | |
template<> | |
std::string | to_string (const double &entry) |
template<> | |
double | to_type (const std::string ¶meter) |
template<> | |
std_cxx11::shared_ptr< Patterns::PatternBase > | to_pattern (const int &) |
int More... | |
template<> | |
std::string | to_string (const int &entry) |
template<> | |
int | to_type (const std::string ¶meter) |
template<> | |
std_cxx11::shared_ptr< Patterns::PatternBase > | to_pattern (const unsigned int &) |
unsigned int More... | |
template<> | |
std::string | to_string (const unsigned int &entry) |
template<> | |
unsigned int | to_type (const std::string ¶meter) |
template<> | |
std_cxx11::shared_ptr< Patterns::PatternBase > | to_pattern (const bool &) |
bool More... | |
template<> | |
std::string | to_string (const bool &entry) |
template<> | |
bool | to_type (const std::string ¶meter) |
Public Member Functions inherited from Subscriptor | |
Subscriptor () | |
Subscriptor (const Subscriptor &) | |
Subscriptor (Subscriptor &&) | |
virtual | ~Subscriptor () |
Subscriptor & | operator= (const Subscriptor &) |
Subscriptor & | operator= (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) |
Static Public Member Functions | |
static std::string | get_grid_names () |
Return a list of implemented grids. More... | |
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::PatternBase > | to_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) |
Private Member Functions | |
Triangulation< dim, spacedim >::MeshSmoothing | get_smoothing () |
Mesh smoothing. More... | |
void | parse_manifold_descriptors (const std::string &str_manifold_descriptors) |
Take str_manifold_descriptors and fill manifold_descriptors with ids and manifolds. More... | |
Private Attributes | |
std::string | mesh_smoothing |
Mesh smoothing to apply to the newly created Triangulation. More... | |
std::string | grid_name |
The grid to generate. More... | |
std::string | optional_manifold_descriptors |
Optional Manifold descriptors. More... | |
std::string | default_manifold_descriptors |
Default Manifold descriptors. More... | |
std::map< types::manifold_id, shared_ptr< Manifold< dim, spacedim > > > | manifold_descriptors |
A map of Manifold associated to the given manifold_ids. More... | |
double | double_option_one |
Optional double argument. More... | |
double | double_option_two |
Optional double argument. More... | |
double | double_option_three |
Optional double argument. More... | |
Point< spacedim > | point_option_one |
Optional Point argument. More... | |
Point< spacedim > | point_option_two |
Optional Point argument. More... | |
unsigned int | un_int_option_one |
Optional int argument. More... | |
unsigned int | un_int_option_two |
Optional int argument. More... | |
bool | colorize |
For all the internally generated meshes that support it, turn on colorizing. More... | |
bool | create_default_manifolds |
Create default manifold descriptors. More... | |
bool | copy_boundary_to_manifold_ids |
Copy boundary ids to manifold ids. More... | |
bool | copy_material_to_manifold_ids |
Copy material ids to manifold ids. More... | |
std::vector< unsigned int > | un_int_vec_option_one |
Optional vector of integers. More... | |
std::string | input_grid_file_name |
Input grid file name. More... | |
std::string | output_grid_file_name |
Output grid file name. More... | |
std::string | str_point_1 |
std::string | str_point_2 |
std::string | str_colorize |
std::string | str_double_1 |
std::string | str_double_2 |
std::string | str_double_3 |
std::string | str_un_int_1 |
std::string | str_un_int_2 |
std::string | str_vec_int |
Friends | |
struct | PGGHelper |
Helper function to create grids. More... | |
Additional Inherited Members | |
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... | |
Parsed grid generator.
Create a grid by reading a parameter file, either using dealii::GridGenerator functions, or by reading it from a file in supported format.
All Triangulations in the GridGenerator Namespace are supported, as well as all file formats supported by GridIn. This class is in all effects a wrapper around the GridGenerator namespace functions, GridIn, GridOut and some Manifold classes of the deal.II
library.
ParsedGridGenerator can be used both in serial and parallel settings, and a typical usage of this class is
Once the function ParameterAcceptor::initialize("file.prm", "no_descriptions.prm") is called, the "no_descriptions.prm" is filled with the following entries:
If the user would then change the parameter file to generate a sphere, or read a file, no change in the code would be necessary, as at run time the new parameters would be used.
Setting the option "Create default manifolds" to true, makes sure that default manifold descritpors for each Triangulation that requires non straigth boundary is also generated together with the Triangulation, and attached to it.
If the option Output grid file name
is set to non-empty, when the user calls ParsedGridGenerator::write(), an output grid would be generated using GridOut, choosing the right format according to the extension of the file.
Support for reading a single face of a NURBS surface into a Triangulationa<2,3> is also available, by specifying an input file name which is in the STEP or IGES format. In this case the OpenCASCADE::read_STEP() or OpenCASCADE::read_IGES() are called, and the resulting OpenCASCADE object is split into its faces. The face can be selected using the "Optional int 1" parameter.
Definition at line 145 of file parsed_grid_generator.h.
ParsedGridGenerator< dim, spacedim >::ParsedGridGenerator | ( | const std::string | section_name = "" , |
const std::string | grid_type = "rectangle" , |
||
const std::string | input_grid_file = "" , |
||
const std::string | opt_point_1 = "" , |
||
const std::string | opt_point_2 = "" , |
||
const std::string | opt_colorize = "false" , |
||
const std::string | opt_double_1 = "1.0" , |
||
const std::string | opt_double_2 = "0.5" , |
||
const std::string | opt_double_3 = "1.5" , |
||
const std::string | opt_int_1 = "1" , |
||
const std::string | opt_int_2 = "2" , |
||
const std::string | opt_vec_of_int = "" , |
||
const std::string | mesh_smoothing = "none" , |
||
const std::string | output_grid_file = "" , |
||
const std::string | opt_manifold_descriptors = "" |
||
) |
Constructor.
Takes a name for the section of the Parameter Handler to use.
This class is derived from ParameterAcceptor. Once you constructed an object of this class, if you call ParameterAcceptor::parse_all_parameters(), also the parameters of this class will be filled with values from the argument ParameterHandler.
This constructor takes optional strings which allow the user to decide what are the default values that will be written on the parameter file. The first optional argument specifies the section name within the parameter file. If the section name is empty, by default it is set to ParsedGridGenerator<x,x> where x,x
is replaced with the actual dim
and spacedim
numbers with which the user instantiated the class.
Since every GridGenerator function takes a different set of arguments, we provide a list of optional arguments that will be used by the class itself.
Definition at line 57 of file parsed_grid_generator.cc.
void ParsedGridGenerator< dim, spacedim >::create | ( | Triangulation< dim, spacedim > & | tria | ) |
Generate the grid.
Fill a user supplied empty Triangulation using the parameter file. If the Triangulation is not empty, an exception is thrown.
The following grids are implemented:
Definition at line 884 of file parsed_grid_generator.cc.
|
virtual |
Declare all parameters of this class.
Reimplemented from ParameterAcceptor.
Definition at line 102 of file parsed_grid_generator.cc.
|
static |
Return a list of implemented grids.
Definition at line 96 of file parsed_grid_generator.cc.
|
private |
Mesh smoothing.
Parse the type of MeshSmoothing for the generated Triangulation.
Definition at line 981 of file parsed_grid_generator.cc.
|
private |
Take str_manifold_descriptors
and fill manifold_descriptors
with ids and manifolds.
The format of the string is the following:
Each couple of id and manifold descriptor string should be separated by ''
The manifold descriptor string can be taken among the following:
Definition at line 911 of file parsed_grid_generator.cc.
Triangulation< dim, spacedim > * ParsedGridGenerator< dim, spacedim >::serial | ( | ) |
Return a pointer to a newly created serial Triangulation.
It will throw an exception if called before any parsing has occured. It is the user's responsability to destroy the created grid once it is no longer needed.
Definition at line 368 of file parsed_grid_generator.cc.
void ParsedGridGenerator< dim, spacedim >::write | ( | const Triangulation< dim, spacedim > & | tria, |
const std::string & | filename = "" |
||
) | const |
Write the given Triangulation to the output file specified in Output file name
, or in the optional file name.
If no Output file name
is given and filename is the empty string, this function does nothing. If an output file name is provided (either in the input file, or as an argument to this function), then this function will call the appropriate GridOut method according to the extension of the file name.
Definition at line 928 of file parsed_grid_generator.cc.
|
friend |
Helper function to create grids.
Definition at line 520 of file parsed_grid_generator.h.
|
private |
For all the internally generated meshes that support it, turn on colorizing.
Definition at line 461 of file parsed_grid_generator.h.
|
private |
Copy boundary ids to manifold ids.
If set to true, boundary ids will be copied over manifold ids on the newly created triangulation.
Definition at line 482 of file parsed_grid_generator.h.
|
private |
Copy material ids to manifold ids.
If set to true, material ids will be copied over manifold ids on the newly created triangulation.
Definition at line 489 of file parsed_grid_generator.h.
|
private |
Create default manifold descriptors.
If set to true, boundary ids will be copied over manifold ids on the newly created triangulation (independently on the value of the variable copy_boundary_to_manifold_ids, and for each triangulation where we know how to create and associate their manifolds, we create them and associate them to the newly created triangulation.
This option produces different associations depending on the colorize parameter. The created manifolds will be compatible with the triangulation and the colorize parameter used.
Definition at line 475 of file parsed_grid_generator.h.
|
private |
Default Manifold descriptors.
This is filled when creating the grid, and is later translated into actual manifolds. See the documentation of the method parse_manifold_descriptors() for an explanation of the format to be used in the parameter file.
Definition at line 415 of file parsed_grid_generator.h.
|
private |
|
private |
|
private |
|
private |
The grid to generate.
Use the name "file" to read from a file.
Definition at line 399 of file parsed_grid_generator.h.
|
private |
Input grid file name.
Definition at line 499 of file parsed_grid_generator.h.
|
private |
A map of Manifold associated to the given manifold_ids.
Definition at line 420 of file parsed_grid_generator.h.
|
private |
Mesh smoothing to apply to the newly created Triangulation.
This variable is only used if the method serial() is called. For the method parallel(), mesh smoothing is not yet supported by deal.II
.
Definition at line 394 of file parsed_grid_generator.h.
|
private |
Optional Manifold descriptors.
These are the ones defined by the parameter option "Manifold descriptors". See the documentation of the method parse_manifold_descriptors() for an explanation of the format to be used in the parameter file.
Definition at line 407 of file parsed_grid_generator.h.
|
private |
Output grid file name.
Definition at line 504 of file parsed_grid_generator.h.
|
private |
|
private |
|
private |
Definition at line 509 of file parsed_grid_generator.h.
|
private |
Definition at line 510 of file parsed_grid_generator.h.
|
private |
Definition at line 511 of file parsed_grid_generator.h.
|
private |
Definition at line 512 of file parsed_grid_generator.h.
|
private |
Definition at line 507 of file parsed_grid_generator.h.
|
private |
Definition at line 508 of file parsed_grid_generator.h.
|
private |
Definition at line 513 of file parsed_grid_generator.h.
|
private |
Definition at line 514 of file parsed_grid_generator.h.
|
private |
Definition at line 515 of file parsed_grid_generator.h.
|
private |
|
private |
|
private |
Optional vector of integers.
Definition at line 494 of file parsed_grid_generator.h.