https://mooseframework.inl.gov
CutMeshByLevelSetGenerator.C
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 
11 
12 // C++ includes
13 #include <cmath>
14 
16 
19 {
21 
22  params.addRequiredParam<std::string>(
23  "level_set", "Level set used to cut the mesh as a function of x, y, and z.");
24  params.addParam<std::vector<std::string>>(
25  "constant_names", {}, "Vector of constants used in the parsed function");
26  params.addParam<std::vector<std::string>>(
27  "constant_expressions",
28  {},
29  "Vector of values for the constants in constant_names (can be an FParser expression)");
30 
31  params.addClassDescription(
32  "This CutMeshByLevelSetGenerator object is designed to trim the input mesh by removing all "
33  "the elements on outside the give level set with special processing on the elements crossed "
34  "by the cutting surface to ensure a smooth cross-section. The output mesh only consists of "
35  "TET4 elements.");
36 
37  return params;
38 }
39 
41  : CutMeshByLevelSetGeneratorBase(parameters), _level_set(getParam<std::string>("level_set"))
42 {
43  // Create parsed function
44  _func_level_set = std::make_shared<SymFunction>();
46  _level_set,
47  "x,y,z",
48  getParam<std::vector<std::string>>("constant_names"),
49  getParam<std::vector<std::string>>("constant_expressions"),
50  comm());
51 
52  _func_params.resize(3);
53 }
static InputParameters validParams()
registerMooseObject("MooseApp", CutMeshByLevelSetGenerator)
CutMeshByLevelSetGenerator(const InputParameters &parameters)
This CutMeshByLevelSetGeneratorBase object is designed to be the base class of mesh generator that cu...
SymFunctionPtr _func_level_set
function parser object describing the level set
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const Parallel::Communicator & comm() const
This CutMeshByLevelSetGenerator object is designed to trim the input mesh by removing all the element...
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
const std::string _level_set
The analytic level set function in the form of a string that can be parsed by FParser.
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
void parsedFunctionSetup(SymFunctionPtr &function, const std::string &expression, const std::string &variables, const std::vector< std::string > &constant_names, const std::vector< std::string > &constant_expressions, const libMesh::Parallel::Communicator &comm) const
Performs setup steps on a SymFunction.
std::vector< GenericReal< is_ad > > _func_params
Array to stage the parameters passed to the functions when calling Eval.
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 optional parameter and a documentation string to the InputParameters object...