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 : #include "CutMeshByLevelSetGenerator.h" 11 : 12 : // C++ includes 13 : #include <cmath> 14 : 15 : registerMooseObject("MooseApp", CutMeshByLevelSetGenerator); 16 : 17 : InputParameters 18 14297 : CutMeshByLevelSetGenerator::validParams() 19 : { 20 14297 : InputParameters params = CutMeshByLevelSetGeneratorBase::validParams(); 21 : 22 14297 : params.addRequiredParam<std::string>( 23 : "level_set", "Level set used to cut the mesh as a function of x, y, and z."); 24 14297 : params.addParam<std::vector<std::string>>( 25 : "constant_names", {}, "Vector of constants used in the parsed function"); 26 14297 : 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 14297 : 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 14297 : return params; 38 0 : } 39 : 40 16 : CutMeshByLevelSetGenerator::CutMeshByLevelSetGenerator(const InputParameters & parameters) 41 16 : : CutMeshByLevelSetGeneratorBase(parameters), _level_set(getParam<std::string>("level_set")) 42 : { 43 : // Create parsed function 44 16 : _func_level_set = std::make_shared<SymFunction>(); 45 32 : parsedFunctionSetup(_func_level_set, 46 16 : _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 16 : _func_params.resize(3); 53 16 : }