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
CartesianIDPatternedMeshGenerator Class Reference

Generates patterned Cartesian meshes with a reporting ID. More...

#include <CartesianIDPatternedMeshGenerator.h>

Inheritance diagram for CartesianIDPatternedMeshGenerator:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 

Public Member Functions

 CartesianIDPatternedMeshGenerator (const InputParameters &parameters)
 
std::unique_ptr< MeshBase > generate () override
 
bool hasGenerateData () const
 
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 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

void mergeSubdomainNameMaps (std::map< subdomain_id_type, std::string > &main_subdomain_map, const std::map< subdomain_id_type, std::string > &increment_subdomain_map)
 
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 std::string _element_id_name
 name of integer ID. More...
 
const ReportingIDGeneratorUtils::AssignType _assign_type
 integer ID assignment type More...
 
const bool _use_exclude_id
 flag to indicate if exclude_id is defined More...
 
std::vector< bool > _exclude_ids
 flag to indicate if exclude_id is used for each input More...
 
std::vector< std::vector< dof_id_type > > _id_pattern
 hold integer ID for each input pattern cell More...
 
const std::vector< MeshGeneratorName > & _input_names
 
const std::vector< std::unique_ptr< MeshBase > *> _mesh_ptrs
 
const std::vector< std::vector< unsigned int > > & _pattern
 
std::vector< std::unique_ptr< ReplicatedMesh > > _meshes
 
std::vector< std::unique_ptr< ReplicatedMesh > > _row_meshes
 
Real _x_width
 
Real _y_width
 
Real _z_width
 
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

Generates patterned Cartesian meshes with a reporting ID.

Definition at line 19 of file CartesianIDPatternedMeshGenerator.h.

Constructor & Destructor Documentation

◆ CartesianIDPatternedMeshGenerator()

CartesianIDPatternedMeshGenerator::CartesianIDPatternedMeshGenerator ( const InputParameters parameters)

Definition at line 33 of file CartesianIDPatternedMeshGenerator.C.

36  _element_id_name(getParam<std::string>("id_name")),
38  getParam<MooseEnum>("assign_type").getEnum<ReportingIDGeneratorUtils::AssignType>()),
39  _use_exclude_id(isParamValid("exclude_id"))
40 {
42  paramError("exclude_id", "works only when \"assign_type\" is equal 'cell'");
44  paramError("id_pattern", "required when \"assign_type\" is equal to 'manual'");
45 
47  _id_pattern = getParam<std::vector<std::vector<dof_id_type>>>("id_pattern");
48  _exclude_ids.resize(_input_names.size());
49  if (_use_exclude_id)
50  {
51  std::vector<MeshGeneratorName> exclude_id_name =
52  getParam<std::vector<MeshGeneratorName>>("exclude_id");
53  for (unsigned int i = 0; i < _input_names.size(); ++i)
54  {
55  _exclude_ids[i] = false;
56  for (auto input_name : exclude_id_name)
57  if (_input_names[i] == input_name)
58  {
59  _exclude_ids[i] = true;
60  break;
61  }
62  }
63  }
64  else
65  for (unsigned int i = 0; i < _input_names.size(); ++i)
66  _exclude_ids[i] = false;
67 }
PatternedMeshGenerator(const InputParameters &parameters)
assign IDs based on user-defined mapping
std::vector< bool > _exclude_ids
flag to indicate if exclude_id is used for each input
bool isParamValid(const std::string &name) const
void paramError(const std::string &param, Args... args) const
assign unique IDs for each tile in the lattice in sequential order
const bool _use_exclude_id
flag to indicate if exclude_id is defined
const ReportingIDGeneratorUtils::AssignType _assign_type
integer ID assignment type
const InputParameters & parameters() const
std::vector< std::vector< dof_id_type > > _id_pattern
hold integer ID for each input pattern cell
const std::string _element_id_name
name of integer ID.
const std::vector< MeshGeneratorName > & _input_names

Member Function Documentation

◆ generate()

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

Reimplemented from PatternedMeshGenerator.

Definition at line 70 of file CartesianIDPatternedMeshGenerator.C.

71 {
73 
74  unsigned int extra_id_index;
75  if (!mesh->has_elem_integer(_element_id_name))
76  extra_id_index = mesh->add_elem_integer(_element_id_name);
77  else
78  {
79  extra_id_index = mesh->get_elem_integer_index(_element_id_name);
81  "id_name", "An element integer with the name '", _element_id_name, "' already exists");
82  }
83 
84  // patternedMeshGenerator for Carterisan lattice does not support duct structures
85  const bool has_assembly_duct = false;
86  const std::set<subdomain_id_type> duct_block_ids;
87  // asssign reporting IDs to individual elements
89  extra_id_index,
93  has_assembly_duct,
94  duct_block_ids,
95  _meshes,
96  _pattern,
97  _id_pattern);
98 
99  return mesh;
100 }
std::vector< std::unique_ptr< ReplicatedMesh > > _meshes
void assignReportingIDs(MeshBase &mesh, const unsigned int extra_id_index, const ReportingIDGeneratorUtils::AssignType assign_type, const bool use_exclude_id, const std::vector< bool > &exclude_ids, const bool has_assembly_boundary, const std::set< subdomain_id_type > background_block_ids, const std::vector< std::unique_ptr< libMesh::ReplicatedMesh >> &input_meshes, const std::vector< std::vector< unsigned int >> &pattern, const std::vector< std::vector< dof_id_type >> &id_pattern)
assign the reporting IDs to the output mesh from the cartesian or hexagonal patterned mesh generator ...
const std::vector< std::vector< unsigned int > > & _pattern
std::vector< bool > _exclude_ids
flag to indicate if exclude_id is used for each input
MeshBase & mesh
std::unique_ptr< MeshBase > generate() override
const bool _use_exclude_id
flag to indicate if exclude_id is defined
const ReportingIDGeneratorUtils::AssignType _assign_type
integer ID assignment type
void paramWarning(const std::string &param, Args... args) const
std::vector< std::vector< dof_id_type > > _id_pattern
hold integer ID for each input pattern cell
const std::string _element_id_name
name of integer ID.

◆ validParams()

InputParameters CartesianIDPatternedMeshGenerator::validParams ( )
static

Definition at line 16 of file CartesianIDPatternedMeshGenerator.C.

17 {
19  params.addRequiredParam<std::string>("id_name", "Name of integer ID set");
20  params.addParam<std::vector<MeshGeneratorName>>(
21  "exclude_id", "Name of input meshes to be excluded in ID generation");
22  MooseEnum option("cell pattern manual", "cell");
23  params.addParam<MooseEnum>("assign_type", option, "Type of integer ID assignment");
24  params.addParam<std::vector<std::vector<dof_id_type>>>(
25  "id_pattern",
26  "User-defined element IDs. A double-indexed array starting with the upper-left corner");
27  params.addClassDescription("Generate Certesian lattice meshes with reporting ID assignment that "
28  "indentifies individual components of lattice.");
29 
30  return params;
31 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)

Member Data Documentation

◆ _assign_type

const ReportingIDGeneratorUtils::AssignType CartesianIDPatternedMeshGenerator::_assign_type
protected

integer ID assignment type

Definition at line 32 of file CartesianIDPatternedMeshGenerator.h.

Referenced by CartesianIDPatternedMeshGenerator(), and generate().

◆ _element_id_name

const std::string CartesianIDPatternedMeshGenerator::_element_id_name
protected

name of integer ID.

Definition at line 30 of file CartesianIDPatternedMeshGenerator.h.

Referenced by generate().

◆ _exclude_ids

std::vector<bool> CartesianIDPatternedMeshGenerator::_exclude_ids
protected

flag to indicate if exclude_id is used for each input

Definition at line 36 of file CartesianIDPatternedMeshGenerator.h.

Referenced by CartesianIDPatternedMeshGenerator(), and generate().

◆ _id_pattern

std::vector<std::vector<dof_id_type> > CartesianIDPatternedMeshGenerator::_id_pattern
protected

hold integer ID for each input pattern cell

Definition at line 38 of file CartesianIDPatternedMeshGenerator.h.

Referenced by CartesianIDPatternedMeshGenerator(), and generate().

◆ _use_exclude_id

const bool CartesianIDPatternedMeshGenerator::_use_exclude_id
protected

flag to indicate if exclude_id is defined

Definition at line 34 of file CartesianIDPatternedMeshGenerator.h.

Referenced by CartesianIDPatternedMeshGenerator(), and generate().


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