https://mooseframework.inl.gov
MeshExtruderGenerator.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "MeshGenerator.h"
13 
14 #include "libmesh/mesh_generation.h"
15 
20 {
21 public:
23 
25 
26  std::unique_ptr<MeshBase> generate() override;
27 
28 protected:
30  std::unique_ptr<MeshBase> & _input;
31 
33  unsigned int _num_layers;
34  std::vector<SubdomainID> _existing_subdomains;
35  std::vector<unsigned int> _layers;
36  std::vector<unsigned int> _new_ids;
37 
42  class QueryElemSubdomainID : public MeshTools::Generation::QueryElemSubdomainIDBase
43  {
44  public:
45  QueryElemSubdomainID(const std::vector<SubdomainID> & existing_subdomains,
46  std::vector<unsigned int> layers,
47  const std::vector<unsigned int> & new_ids,
48  unsigned int num_layers);
49 
51  virtual subdomain_id_type get_subdomain_for_layer(const Elem * old_elem, unsigned int layer);
52 
53  private:
55  std::map<unsigned int, std::map<SubdomainID, unsigned int>> _layer_data;
56 
58  unsigned int _num_layers;
59  };
60 
61 private:
62  void changeID(MeshBase & mesh, const std::vector<BoundaryName> & names, BoundaryID old_id);
63 };
Extrude a 1D or 2D mesh to a 2D or 3D mesh respectively.
QueryElemSubdomainID(const std::vector< SubdomainID > &existing_subdomains, std::vector< unsigned int > layers, const std::vector< unsigned int > &new_ids, unsigned int num_layers)
std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.
virtual subdomain_id_type get_subdomain_for_layer(const Elem *old_elem, unsigned int layer)
The override from the base class for obtaining a new id based on the old (original) element and the s...
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
This class is used during the mesh construction (extrusion) to set element ids as they are created...
static InputParameters validParams()
boundary_id_type BoundaryID
void changeID(MeshBase &mesh, const std::vector< BoundaryName > &names, BoundaryID old_id)
std::vector< unsigned int > _layers
std::unique_ptr< MeshBase > & _input
Mesh that comes from another generator.
std::map< unsigned int, std::map< SubdomainID, unsigned int > > _layer_data
Data structure for holding the old -> new id mapping based on the layer number.
const RealVectorValue _extrusion_vector
std::vector< SubdomainID > _existing_subdomains
const InputParameters & parameters() const
Get the parameters of the object.
MeshExtruderGenerator(const InputParameters &parameters)
MeshGenerators are objects that can modify or add to an existing mesh.
Definition: MeshGenerator.h:32
std::vector< unsigned int > _new_ids
unsigned int _num_layers
The total number of layers in the extrusion.