https://mooseframework.inl.gov
PatternedMesh.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 "MooseMesh.h"
13 
14 namespace libMesh
15 {
16 class ReplicatedMesh;
17 }
18 
29 class PatternedMesh : public MooseMesh
30 {
31 public:
33 
35  PatternedMesh(const PatternedMesh & other_mesh);
36  virtual ~PatternedMesh() = default;
37 
38  virtual std::unique_ptr<MooseMesh> safeClone() const override;
39 
40  virtual void buildMesh() override;
41 
42 protected:
43  // The mesh files to read
44  const std::vector<MeshFileName> & _files;
45 
46  // The pattern, starting with the upper left corner
47  const std::vector<std::vector<unsigned int>> & _pattern;
48 
49  // Pointer to the original "row" mesh to be repeated and stitched
50  ReplicatedMesh * _original_mesh;
51 
52  // Holds the pointers to the meshes
53  std::vector<std::unique_ptr<ReplicatedMesh>> _meshes;
54 
55  // Holds a mesh for each row, these will be stitched together in the end
56  std::vector<std::unique_ptr<ReplicatedMesh>> _row_meshes;
57 
58  const Real _x_width;
59  const Real _y_width;
60  const Real _z_width;
61 };
std::vector< std::unique_ptr< ReplicatedMesh > > _meshes
Definition: PatternedMesh.h:53
const Real _y_width
Definition: PatternedMesh.h:59
virtual std::unique_ptr< MooseMesh > safeClone() const override
A safer version of the clone() method that hands back an allocated object wrapped in a smart pointer...
Definition: PatternedMesh.C:81
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
static InputParameters validParams()
Definition: PatternedMesh.C:22
PatternedMesh(const InputParameters &parameters)
Definition: PatternedMesh.C:56
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
const Real _z_width
Definition: PatternedMesh.h:60
const std::vector< MeshFileName > & _files
Definition: PatternedMesh.h:44
virtual ~PatternedMesh()=default
Reads one or more 2D mesh files and stitches them together based on a provided two-dimensional patter...
Definition: PatternedMesh.h:29
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:88
const Real _x_width
Definition: PatternedMesh.h:58
const std::vector< std::vector< unsigned int > > & _pattern
Definition: PatternedMesh.h:47
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< std::unique_ptr< ReplicatedMesh > > _row_meshes
Definition: PatternedMesh.h:56
ReplicatedMesh * _original_mesh
Definition: PatternedMesh.h:50
const InputParameters & parameters() const
Get the parameters of the object.
virtual void buildMesh() override
Must be overridden by child classes.
Definition: PatternedMesh.C:87