Line data Source code
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 : 19 : /** 20 : * Reads one or more 2D mesh files and stitches them together based on 21 : * a provided two-dimensional pattern array. Assigns new boundary 22 : * ids/names to the left, right, top, and bottom boundaries as 23 : * specified by user. The boundary nodes of the read in meshes must 24 : * match up relative to the stitching pattern specified by the user -- 25 : * no new nodes are added in order to generate a conforming grid, and 26 : * non-conforming grids (with nodes in the middle of edges) are not 27 : * allowed. 28 : */ 29 : class PatternedMesh : public MooseMesh 30 : { 31 : public: 32 : static InputParameters validParams(); 33 : 34 : PatternedMesh(const InputParameters & parameters); 35 : PatternedMesh(const PatternedMesh & other_mesh); 36 20 : 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 : };