https://mooseframework.inl.gov
MeshDivision.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 "MooseObject.h"
13 #include "SetupInterface.h"
14 #include "Restartable.h"
15 #include "MeshChangedInterface.h"
16 
17 #include "libmesh/vector_value.h"
18 
19 // libMesh forward declarations
20 namespace libMesh
21 {
22 class Point;
23 }
24 
26 {
29 }
30 
36 {
37 public:
43 
45 
49  virtual ~MeshDivision();
50 
52  virtual unsigned int divisionIndex(const Point & pt) const = 0;
54  virtual unsigned int divisionIndex(const Elem & elem) const = 0;
56  unsigned int getNumDivisions() const { return _num_divs; }
58  bool coversEntireMesh() const { return _mesh_fully_indexed; }
59 
61  virtual void meshChanged() override { initialize(); }
62 
63 protected:
65  void setNumDivisions(const unsigned int ndivs) { _num_divs = ndivs; }
66 
68  virtual void initialize() {}
69 
71  const FEProblemBase * const _fe_problem;
72 
74  const MooseMesh & _mesh;
75 
78 
79 private:
81  unsigned int _num_divs;
82 };
virtual unsigned int divisionIndex(const Point &pt) const =0
Return the index of the division to which the point belongs.
MeshDivision(const InputParameters &parameters)
Definition: MeshDivision.C:23
virtual void initialize()
Set up any data members that would be necessary to obtain the division indices.
Definition: MeshDivision.h:68
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
bool coversEntireMesh() const
Returns whether the entire mesh is covered by the division of the mesh, whether every point and eleme...
Definition: MeshDivision.h:58
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
Base class for MeshDivision objects.
Definition: MeshDivision.h:35
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
const MooseMesh & _mesh
Mesh that is being divided.
Definition: MeshDivision.h:74
auto max(const L &left, const R &right)
virtual ~MeshDivision()
MeshDivision destructor.
Definition: MeshDivision.C:33
Interface for notifications that the mesh has changed.
unsigned int _num_divs
Number of divisions in the division.
Definition: MeshDivision.h:81
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:28
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:88
unsigned int INVALID_DIVISION_INDEX
Invalid subdomain id to return when outside the mesh division.
Definition: MeshDivision.h:28
unsigned int getNumDivisions() const
Return the number of divisions.
Definition: MeshDivision.h:56
bool _mesh_fully_indexed
Whether the mesh is fully covered / indexed, all elements and points have a valid index...
Definition: MeshDivision.h:77
void setNumDivisions(const unsigned int ndivs)
Set the number of divisions.
Definition: MeshDivision.h:65
const FEProblemBase *const _fe_problem
Pointer to the problem, needed to retrieve pointers to various objects.
Definition: MeshDivision.h:71
const InputParameters & parameters() const
Get the parameters of the object.
static InputParameters validParams()
Class constructor.
Definition: MeshDivision.C:14
virtual void meshChanged() override
By default, meshChanged will cause a re-initialization of the necessary data members.
Definition: MeshDivision.h:61