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 "MeshGenerator.h" 13 : #include "libmesh/replicated_mesh.h" 14 : 15 : // Forward declarations 16 : 17 : /** 18 : * Subdivides a sidesets into smaller patches each of which is going 19 : * to be a new patch 20 : */ 21 : class PatchSidesetGenerator : public MeshGenerator 22 : { 23 : public: 24 : static InputParameters validParams(); 25 : 26 : PatchSidesetGenerator(const InputParameters & parameters); 27 : 28 : std::unique_ptr<MeshBase> generate() override; 29 : 30 7436 : unsigned int nPatches() const { return _n_patches; } 31 : 32 : protected: 33 : /// returns the name of the _n_patches subdivisions derived from _sideset 34 : std::vector<BoundaryName> sidesetNameHelper(const std::string & base_name) const; 35 : 36 : Elem * boundaryElementHelper(MeshBase & mesh, libMesh::ElemType type) const; 37 : 38 : /// a function for implementing custom partitioning 39 : void partition(MeshBase & mesh); 40 : 41 : /** 42 : * Checks partitions and makes sure every partition has at least one elem. 43 : * If a partition is empty, it's removed and the remaining ones are "renamed" 44 : */ 45 : void checkPartitionAndCompress(MeshBase & mesh); 46 : 47 : std::unique_ptr<MeshBase> & _input; 48 : 49 : /// dimensionality of the sidesets to partition 50 : unsigned int _dim; 51 : 52 : /// the number of patches that this sideset generator divides _sideset into 53 : unsigned int _n_patches; 54 : 55 : /// The sideset that will be subdivided 56 : const BoundaryName & _sideset_name; 57 : 58 : /// the name of the partitioner being used 59 : MooseEnum _partitioner_name; 60 : 61 : /// The sideset that will be subdivided 62 : subdomain_id_type _sideset; 63 : 64 : /// number of elements of the boundary mesh 65 : dof_id_type _n_boundary_mesh_elems; 66 : };