www.mooseframework.org
MeshExtruder.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "MeshModifier.h"
13 #include "libmesh/mesh_generation.h"
14 
15 class MeshExtruder;
16 
17 template <>
19 
20 class MeshExtruder : public MeshModifier
21 {
22 public:
24 
25 protected:
26  virtual void modify() override;
27 
29  unsigned int _num_layers;
30  std::vector<SubdomainID> _existing_subdomains;
31  std::vector<unsigned int> _layers;
32  std::vector<unsigned int> _new_ids;
33 
38  class QueryElemSubdomainID : public MeshTools::Generation::QueryElemSubdomainIDBase
39  {
40  public:
41  QueryElemSubdomainID(std::vector<SubdomainID> existing_subdomains,
42  std::vector<unsigned int> layers,
43  std::vector<unsigned int> new_ids,
44  unsigned int num_layers);
45 
47  virtual subdomain_id_type get_subdomain_for_layer(const Elem * old_elem, unsigned int layer);
48 
49  private:
51  std::map<unsigned int, std::map<SubdomainID, unsigned int>> _layer_data;
52 
55 #ifndef NDEBUG
56  unsigned int _num_layers;
57 #endif
58  };
59 
60 private:
61  void changeID(const std::vector<BoundaryName> & names, BoundaryID old_id);
62 };
63 
VectorValue< Real > RealVectorValue
Definition: Assembly.h:31
MeshModifiers are objects that can modify or add to an existing mesh.
Definition: MeshModifier.h:25
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...
void changeID(const std::vector< BoundaryName > &names, BoundaryID old_id)
Definition: MeshExtruder.C:117
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.
Definition: MeshExtruder.h:51
std::vector< SubdomainID > _existing_subdomains
Definition: MeshExtruder.h:30
const RealVectorValue _extrusion_vector
Definition: MeshExtruder.h:28
InputParameters validParams< MeshExtruder >()
Definition: MeshExtruder.C:22
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:65
std::vector< unsigned int > _layers
Definition: MeshExtruder.h:31
boundary_id_type BoundaryID
unsigned int _num_layers
The total number of layers in the extrusion.
Definition: MeshExtruder.h:56
This class is used during the mesh construction (extrusion) to set element ids as they are created...
Definition: MeshExtruder.h:38
virtual void modify() override
Pure virtual modify function MUST be overridden by children classes.
Definition: MeshExtruder.C:67
std::vector< unsigned int > _new_ids
Definition: MeshExtruder.h:32
QueryElemSubdomainID(std::vector< SubdomainID > existing_subdomains, std::vector< unsigned int > layers, std::vector< unsigned int > new_ids, unsigned int num_layers)
Definition: MeshExtruder.C:131
unsigned int _num_layers
Definition: MeshExtruder.h:29
MeshExtruder(const InputParameters &parameters)
Definition: MeshExtruder.C:51