www.mooseframework.org
SmoothMesh.C
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 #include "SmoothMesh.h"
11 
12 // MOOSE includes
13 #include "MooseMesh.h"
14 
15 // libMesh includes
16 #include "libmesh/mesh_smoother_laplace.h"
17 #include "libmesh/unstructured_mesh.h"
18 
19 registerMooseObject("MooseApp", SmoothMesh);
20 
21 template <>
24 {
26 
27  params.addClassDescription("Utilizes a simple Laplacian based smoother to attempt to improve "
28  "mesh quality. Will not move boundary nodes or nodes along "
29  "block/subdomain boundaries");
30 
31  params.addParam<unsigned int>("iterations", 1, "The number of smoothing iterations to do.");
32 
33  return params;
34 }
35 
37  : MeshModifier(parameters), _iterations(getParam<unsigned int>("iterations"))
38 {
39 }
40 
41 void
43 {
44  // Check that we have access to the mesh
45  if (!_mesh_ptr)
46  mooseError("_mesh_ptr must be initialized before calling SmoothMesh::modify()");
47 
48  LaplaceMeshSmoother lms(static_cast<UnstructuredMesh &>(_mesh_ptr->getMesh()));
49 
50  lms.smooth(_iterations);
51 }
MeshModifiers are objects that can modify or add to an existing mesh.
Definition: MeshModifier.h:25
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void mooseError(Args &&... args) const
Definition: MooseObject.h:147
SmoothMesh(const InputParameters &parameters)
Definition: SmoothMesh.C:36
MooseMesh * _mesh_ptr
Pointer to the mesh.
Definition: MeshModifier.h:68
MeshModifier for doing mesh smoothing.
Definition: SmoothMesh.h:24
registerMooseObject("MooseApp", SmoothMesh)
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:2567
unsigned int _iterations
The number of smoothing passes to do.
Definition: SmoothMesh.h:33
virtual void modify() override
Pure virtual modify function MUST be overridden by children classes.
Definition: SmoothMesh.C:42
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
InputParameters validParams< SmoothMesh >()
Definition: SmoothMesh.C:23
InputParameters validParams< MeshModifier >()
Definition: MeshModifier.C:15