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 "FunctionParserUtils.h" 14 : 15 : /** 16 : * A base class for mesh generators that Use a parsed expression to assign new subdomain id(s) 17 : */ 18 : class ParsedSubdomainGeneratorBase : public MeshGenerator, public FunctionParserUtils<false> 19 : { 20 : public: 21 : static InputParameters validParams(); 22 : 23 : ParsedSubdomainGeneratorBase(const InputParameters & parameters); 24 : 25 : std::unique_ptr<MeshBase> generate() override; 26 : 27 : protected: 28 : /// mesh to set the subdomains on 29 : std::unique_ptr<MeshBase> & _input; 30 : 31 : /// function expression 32 : const std::string _function; 33 : 34 : /// A list of excluded subdomain ids that will not be changed even if they are in the combinatorial geometry 35 : std::vector<subdomain_id_type> _excluded_ids; 36 : 37 : /// Names of the extra element ids used in the parsed expression 38 : const std::vector<ExtraElementIDName> _eeid_names; 39 : 40 : /// Indices of the extra element ids used in the parsed expression 41 : std::vector<unsigned int> _eeid_indices; 42 : 43 : /// function parser object describing the combinatorial geometry 44 : SymFunctionPtr _func_F; 45 : 46 : usingFunctionParserUtilsMembers(false); 47 : 48 : /** 49 : * Initialize the function parser object 50 : * @param function_expression The expression to parse 51 : */ 52 : void functionInitialize(const std::string & function_expression); 53 : 54 : virtual void assignElemSubdomainID(Elem * elem) = 0; 55 : 56 30 : virtual void setBlockName(std::unique_ptr<MeshBase> &){}; 57 : };