https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
PeripheralTriangleMeshGenerator Class Reference

This PeripheralTriangleMeshGenerator object adds a circular peripheral region to the input mesh. More...

#include <PeripheralTriangleMeshGenerator.h>

Inheritance diagram for PeripheralTriangleMeshGenerator:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 

Public Member Functions

 PeripheralTriangleMeshGenerator (const InputParameters &parameters)
 
std::unique_ptr< MeshBase > generate () override
 
std::unique_ptr< MeshBase > generateInternal ()
 
const std::set< MeshGeneratorName > & getRequestedMeshGenerators () const
 
const std::set< MeshGeneratorName > & getRequestedMeshGeneratorsForSub () const
 
void addParentMeshGenerator (const MeshGenerator &mg, const AddParentChildKey)
 
void addChildMeshGenerator (const MeshGenerator &mg, const AddParentChildKey)
 
const std::set< const MeshGenerator *, Comparator > & getParentMeshGenerators () const
 
const std::set< const MeshGenerator *, Comparator > & getChildMeshGenerators () const
 
const std::set< const MeshGenerator *, Comparator > & getSubMeshGenerators () const
 
bool isParentMeshGenerator (const MeshGeneratorName &name, const bool direct=true) const
 
bool isChildMeshGenerator (const MeshGeneratorName &name, const bool direct=true) const
 
bool isNullMeshName (const MeshGeneratorName &name) const
 
bool hasSaveMesh () const
 
bool hasOutput () const
 
const std::string & getSavedMeshName () const
 
bool hasGenerateData () const
 
bool isDataOnly () const
 
virtual bool enabled () const
 
std::shared_ptr< MooseObjectgetSharedPtr ()
 
std::shared_ptr< const MooseObjectgetSharedPtr () const
 
MooseAppgetMooseApp () const
 
const std::string & type () const
 
virtual const std::string & name () const
 
std::string typeAndName () const
 
std::string errorPrefix (const std::string &error_type) const
 
void callMooseError (std::string msg, const bool with_prefix) const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
const InputParametersparameters () const
 
MooseObjectName uniqueName () const
 
const T & getParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const T * queryParam (const std::string &name) const
 
const T & getRenamedParam (const std::string &old_name, const std::string &new_name) const
 
getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &nm) const
 
void paramError (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramInfo (const std::string &param, Args... args) const
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void mooseError (Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseInfo (Args &&... args) const
 
std::string getDataFileName (const std::string &param) const
 
std::string getDataFileNameByName (const std::string &relative_path) const
 
std::string getDataFilePath (const std::string &relative_path) const
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Static Public Member Functions

static InputParameters validParams ()
 
static bool hasGenerateData (const InputParameters &params)
 
static void setHasGenerateData (InputParameters &params)
 

Public Attributes

const ConsoleStream _console
 

Static Public Attributes

static const std::string data_only_param
 
static constexpr auto SYSTEM
 
static constexpr auto NAME
 

Protected Member Functions

virtual void generateData ()
 
T & copyMeshProperty (const std::string &target_data_name, const std::string &source_data_name, const std::string &source_mesh)
 
T & copyMeshProperty (const std::string &source_data_name, const std::string &source_mesh)
 
std::unique_ptr< MeshBase > & getMesh (const std::string &param_name, const bool allow_invalid=false)
 
std::vector< std::unique_ptr< MeshBase > *> getMeshes (const std::string &param_name)
 
std::unique_ptr< MeshBase > & getMeshByName (const MeshGeneratorName &mesh_generator_name)
 
std::vector< std::unique_ptr< MeshBase > *> getMeshesByName (const std::vector< MeshGeneratorName > &mesh_generator_names)
 
void declareMeshForSub (const std::string &param_name)
 
void declareMeshesForSub (const std::string &param_name)
 
void declareMeshForSubByName (const MeshGeneratorName &mesh_generator_name)
 
void declareMeshesForSubByName (const std::vector< MeshGeneratorName > &mesh_generator_names)
 
std::unique_ptr< MeshBase > buildMeshBaseObject (unsigned int dim=libMesh::invalid_uint)
 
std::unique_ptr< ReplicatedMesh > buildReplicatedMesh (unsigned int dim=libMesh::invalid_uint)
 
std::unique_ptr< DistributedMesh > buildDistributedMesh (unsigned int dim=libMesh::invalid_uint)
 
void addMeshSubgenerator (const std::string &type, const std::string &name, Ts... extra_input_parameters)
 
void addMeshSubgenerator (const std::string &type, const std::string &name, InputParameters params)
 
void declareNullMeshName (const MeshGeneratorName &name)
 
const T & getMeshProperty (const std::string &data_name, const std::string &prefix)
 
const T & getMeshProperty (const std::string &data_name)
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name) const
 
bool hasMeshProperty (const std::string &data_name) const
 
std::string meshPropertyName (const std::string &data_name) const
 
T & declareMeshProperty (const std::string &data_name, Args &&... args)
 
T & declareMeshProperty (const std::string &data_name, const T &data_value)
 
T & declareMeshProperty (const std::string &data_name, Args &&... args)
 
T & declareMeshProperty (const std::string &data_name, const T &data_value)
 
T & setMeshProperty (const std::string &data_name, Args &&... args)
 
T & setMeshProperty (const std::string &data_name, const T &data_value)
 
T & setMeshProperty (const std::string &data_name, Args &&... args)
 
T & setMeshProperty (const std::string &data_name, const T &data_value)
 

Static Protected Member Functions

static std::string meshPropertyName (const std::string &data_name, const std::string &prefix)
 

Protected Attributes

const MeshGeneratorName _input_name
 Name of the mesh generator to get the input mesh. More...
 
const Real _peripheral_ring_radius
 Radius of the peripheral region's outer circular boundary. More...
 
const unsigned int _peripheral_ring_num_segments
 Number of segments in the peripheral region's outer circular boundary. More...
 
const Real _desired_area
 Desired (maximum) triangle area. More...
 
std::string _desired_area_func
 Desired area as a function of (x,y) More...
 
std::unique_ptr< MeshBase > * _build_mesh
 The final mesh that is generated by the subgenerators;. More...
 
MooseMesh *const _mesh
 
const bool & _enabled
 
MooseApp_app
 
const std::string _type
 
const std::string _name
 
const InputParameters_pars
 
Factory_factory
 
ActionFactory_action_factory
 
const Parallel::Communicator & _communicator
 

Detailed Description

This PeripheralTriangleMeshGenerator object adds a circular peripheral region to the input mesh.

Definition at line 16 of file PeripheralTriangleMeshGenerator.h.

Constructor & Destructor Documentation

◆ PeripheralTriangleMeshGenerator()

PeripheralTriangleMeshGenerator::PeripheralTriangleMeshGenerator ( const InputParameters parameters)

Definition at line 79 of file PeripheralTriangleMeshGenerator.C.

81  _input_name(getParam<MeshGeneratorName>("input")),
82  _peripheral_ring_radius(getParam<Real>("peripheral_ring_radius")),
83  _peripheral_ring_num_segments(getParam<unsigned int>("peripheral_ring_num_segments")),
84  _desired_area(getParam<Real>("desired_area")),
85  _desired_area_func(getParam<std::string>("desired_area_func"))
86 {
87  // Calculate outer boundary points
88 
89  std::vector<libMesh::Point> outer_polyline;
90  // radial spacing
91  Real d_theta = 2.0 * M_PI / _peripheral_ring_num_segments;
92  for (unsigned int i = 0; i < _peripheral_ring_num_segments; i++)
93  {
94  // rotation angle
95  Real theta = i * d_theta;
96  // calculate (x, y) coords
97  Real x = _peripheral_ring_radius * std::cos(theta);
98  Real y = _peripheral_ring_radius * std::sin(theta);
99 
100  // add to outer boundary list
101  outer_polyline.emplace_back(x, y, 0);
102  }
103 
104  // Generate outer boundary polyline
105  {
106  auto params = _app.getFactory().getValidParams("PolyLineMeshGenerator");
107  params.set<std::vector<Point>>("points") = outer_polyline;
108  params.set<unsigned int>("num_edges_between_points") = 1;
109  params.set<bool>("loop") = true;
110  addMeshSubgenerator("PolyLineMeshGenerator", _input_name + "_periphery_polyline", params);
111  }
112 
113  // Generate periphery region
114  {
115  declareMeshForSub("input");
116  auto params = _app.getFactory().getValidParams("XYDelaunayGenerator");
117  params.set<MeshGeneratorName>("boundary") =
118  (MeshGeneratorName)_input_name + "_periphery_polyline";
119  params.set<std::vector<MeshGeneratorName>>("holes") =
120  std::vector<MeshGeneratorName>{_input_name};
121  params.set<unsigned int>("add_nodes_per_boundary_segment") = 0;
122  params.set<Real>("desired_area") = _desired_area;
123  params.set<std::string>("desired_area_func") = _desired_area_func;
124  params.set<bool>("use_auto_area_func") = getParam<bool>("use_auto_area_func");
125  if (isParamSetByUser("auto_area_func_default_size"))
126  params.set<Real>("auto_area_func_default_size") =
127  getParam<Real>("auto_area_func_default_size");
128  if (isParamSetByUser("auto_area_func_default_size_dist"))
129  params.set<Real>("auto_area_func_default_size_dist") =
130  getParam<Real>("auto_area_func_default_size_dist");
131  if (isParamSetByUser("auto_area_function_num_points"))
132  params.set<unsigned int>("auto_area_function_num_points") =
133  getParam<unsigned int>("auto_area_function_num_points");
134  if (isParamSetByUser("auto_area_function_power"))
135  params.set<Real>("auto_area_function_power") = getParam<Real>("auto_area_function_power");
136  params.set<bool>("refine_boundary") = false;
137  params.set<std::vector<bool>>("refine_holes") = std::vector<bool>{false};
138  params.set<std::vector<bool>>("stitch_holes") = std::vector<bool>{true};
139  if (isParamValid("external_boundary_name"))
140  params.set<BoundaryName>("output_boundary") =
141  getParam<BoundaryName>("external_boundary_name");
142  params.set<SubdomainName>("output_subdomain_name") =
143  getParam<SubdomainName>("peripheral_ring_block_name");
144  params.set<MooseEnum>("tri_element_type") = getParam<MooseEnum>("tri_element_type");
145  params.set<bool>("verbose_stitching") = false;
146  addMeshSubgenerator("XYDelaunayGenerator", _input_name + "_periphery", params);
147  _build_mesh = &getMeshByName(_input_name + "_periphery");
148  }
149 }
const Real _peripheral_ring_radius
Radius of the peripheral region&#39;s outer circular boundary.
std::unique_ptr< MeshBase > & getMeshByName(const MeshGeneratorName &mesh_generator_name)
const unsigned int _peripheral_ring_num_segments
Number of segments in the peripheral region&#39;s outer circular boundary.
T & set(const std::string &name, bool quiet_mode=false)
InputParameters getValidParams(const std::string &name) const
MeshGenerator(const InputParameters &parameters)
const std::vector< double > y
Factory & getFactory()
void declareMeshForSub(const std::string &param_name)
bool isParamValid(const std::string &name) const
const std::vector< double > x
void addMeshSubgenerator(const std::string &type, const std::string &name, Ts... extra_input_parameters)
std::string _desired_area_func
Desired area as a function of (x,y)
const Real _desired_area
Desired (maximum) triangle area.
std::unique_ptr< MeshBase > * _build_mesh
The final mesh that is generated by the subgenerators;.
bool isParamSetByUser(const std::string &nm) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
MooseApp & _app
const MeshGeneratorName _input_name
Name of the mesh generator to get the input mesh.
const InputParameters & parameters() const

Member Function Documentation

◆ generate()

std::unique_ptr< MeshBase > PeripheralTriangleMeshGenerator::generate ( )
overridevirtual

Implements MeshGenerator.

Definition at line 152 of file PeripheralTriangleMeshGenerator.C.

153 {
154  (*_build_mesh)->find_neighbors();
155  return std::move(*_build_mesh);
156 }
std::unique_ptr< MeshBase > * _build_mesh
The final mesh that is generated by the subgenerators;.

◆ validParams()

InputParameters PeripheralTriangleMeshGenerator::validParams ( )
static

Definition at line 21 of file PeripheralTriangleMeshGenerator.C.

22 {
24  params.addRequiredParam<MeshGeneratorName>("input", "The input mesh to be modified.");
25  params.addRequiredRangeCheckedParam<Real>("peripheral_ring_radius",
26  "peripheral_ring_radius>0",
27  "Radius of the peripheral ring to be added.");
28  params.addRequiredRangeCheckedParam<unsigned int>("peripheral_ring_num_segments",
29  "peripheral_ring_num_segments>0",
30  "Number of segments of the peripheral ring.");
31  params.addRangeCheckedParam<Real>(
32  "desired_area",
33  0,
34  "desired_area>=0",
35  "Desired (maximum) triangle area, or 0 to skip uniform refinement");
36  params.addParam<std::string>(
37  "desired_area_func",
38  std::string(),
39  "Desired area as a function of x,y; omit to skip non-uniform refinement");
40 
41  params.addParam<bool>(
42  "use_auto_area_func", false, "Use the automatic area function in the peripheral region.");
43  params.addParam<Real>(
44  "auto_area_func_default_size",
45  0,
46  "Background size for automatic area function, or 0 to use non background size");
47  params.addParam<Real>("auto_area_func_default_size_dist",
48  -1.0,
49  "Effective distance of background size for automatic area "
50  "function, or negative to use non background size");
51  params.addParam<unsigned int>("auto_area_function_num_points",
52  10,
53  "Maximum number of nearest points used for the inverse distance "
54  "interpolation algorithm for automatic area function calculation.");
55  params.addRangeCheckedParam<Real>(
56  "auto_area_function_power",
57  1.0,
58  "auto_area_function_power>0",
59  "Polynomial power of the inverse distance interpolation algorithm for automatic area "
60  "function calculation.");
61 
62  params.addParam<SubdomainName>(
63  "peripheral_ring_block_name", "", "The block name assigned to the created peripheral layer.");
64  params.addParam<BoundaryName>("external_boundary_name",
65  "Optional customized external boundary name.");
66  MooseEnum tri_elem_type("TRI3 TRI6 TRI7 DEFAULT", "DEFAULT");
67  params.addParam<MooseEnum>(
68  "tri_element_type", tri_elem_type, "Type of the triangular elements to be generated.");
69  params.addClassDescription("This PeripheralTriangleMeshGenerator object is designed to generate "
70  "a triangulated mesh between a generated outer circle boundary "
71  "and a provided inner mesh.");
72  params.addParamNamesToGroup("desired_area desired_area_func use_auto_area_func "
73  "auto_area_func_default_size auto_area_func_default_size_dist "
74  "auto_area_function_num_points auto_area_function_power",
75  "Peripheral Area Delaunay");
76  return params;
77 }
void addRequiredRangeCheckedParam(const std::string &name, const std::string &parsed_function, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)

Member Data Documentation

◆ _build_mesh

std::unique_ptr<MeshBase>* PeripheralTriangleMeshGenerator::_build_mesh
protected

The final mesh that is generated by the subgenerators;.

Definition at line 37 of file PeripheralTriangleMeshGenerator.h.

Referenced by generate(), and PeripheralTriangleMeshGenerator().

◆ _desired_area

const Real PeripheralTriangleMeshGenerator::_desired_area
protected

Desired (maximum) triangle area.

Definition at line 33 of file PeripheralTriangleMeshGenerator.h.

Referenced by PeripheralTriangleMeshGenerator().

◆ _desired_area_func

std::string PeripheralTriangleMeshGenerator::_desired_area_func
protected

Desired area as a function of (x,y)

Definition at line 35 of file PeripheralTriangleMeshGenerator.h.

Referenced by PeripheralTriangleMeshGenerator().

◆ _input_name

const MeshGeneratorName PeripheralTriangleMeshGenerator::_input_name
protected

Name of the mesh generator to get the input mesh.

Definition at line 27 of file PeripheralTriangleMeshGenerator.h.

Referenced by PeripheralTriangleMeshGenerator().

◆ _peripheral_ring_num_segments

const unsigned int PeripheralTriangleMeshGenerator::_peripheral_ring_num_segments
protected

Number of segments in the peripheral region's outer circular boundary.

Definition at line 31 of file PeripheralTriangleMeshGenerator.h.

Referenced by PeripheralTriangleMeshGenerator().

◆ _peripheral_ring_radius

const Real PeripheralTriangleMeshGenerator::_peripheral_ring_radius
protected

Radius of the peripheral region's outer circular boundary.

Definition at line 29 of file PeripheralTriangleMeshGenerator.h.

Referenced by PeripheralTriangleMeshGenerator().


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