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 "ElementUserObject.h" 13 : #include "NonlinearSystemBase.h" 14 : #include "AuxiliarySystem.h" 15 : 16 : class ActivateElementsUserObjectBase : public ElementUserObject 17 : { 18 : public: 19 : static InputParameters validParams(); 20 : 21 : ActivateElementsUserObjectBase(const InputParameters & parameters); 22 : 23 : const std::set<dof_id_type> & getNewlyActivatedElements() const { return _newly_activated_elem; }; 24 : 25 0 : BoundaryID getExpandedBoundaryID() 26 : { 27 : mooseAssert(!_boundary_ids.empty(), "Boundary ID is empty"); 28 0 : return _boundary_ids[0]; 29 : } 30 : 31 : virtual bool isElementActivated() = 0; 32 : 33 0 : void initialize() override{}; 34 : void execute() override; 35 0 : void threadJoin(const UserObject & /*uo*/) override{}; 36 : void finalize() override; 37 : 38 : protected: 39 : void setNewBoundayName(); 40 : 41 : void updateBoundaryInfo(MooseMesh & mesh); 42 : 43 : void push_boundary_side_info( 44 : MooseMesh & mesh, 45 : std::unordered_map<processor_id_type, std::vector<std::pair<dof_id_type, unsigned int>>> & 46 : elems_to_push); 47 : 48 : void push_boundary_node_info( 49 : MooseMesh & mesh, 50 : std::unordered_map<processor_id_type, std::vector<dof_id_type>> & nodes_to_push); 51 : /** 52 : * Initialize solutions for the nodes 53 : */ 54 : void initSolutions(ConstElemRange & elem_range, ConstBndNodeRange & bnd_node_range); 55 : /** 56 : * Returns true if all the connected elements are in the _newly_activated_elem 57 : */ 58 : bool isNewlyActivated(const Node * node); 59 : 60 : void getNodesToRemoveFromBnd(std::set<dof_id_type> & remove_set, std::set<dof_id_type> & add_set); 61 : 62 : void insertNodeIdsOnSide(const Elem * ele, 63 : const unsigned short int side, 64 : std::set<dof_id_type> & node_ids); 65 : 66 : /** 67 : * Get ranges for use with threading. 68 : */ 69 : ConstElemRange * getNewlyActivatedElementRange(); 70 : ConstBndNodeRange * getNewlyActivatedBndNodeRange(); 71 : ConstNodeRange * getNewlyActivatedNodeRange(); 72 : 73 : std::set<dof_id_type> _newly_activated_elem; 74 : std::set<dof_id_type> _newly_activated_node; 75 : /** 76 : * Somes nodes are to be removed from the boundary 77 : * when adding/removing sides 78 : */ 79 : std::set<dof_id_type> _node_to_remove_from_bnd; 80 : 81 : /** 82 : * Ranges for use with threading. 83 : */ 84 : std::unique_ptr<ConstElemRange> _activated_elem_range; 85 : std::unique_ptr<ConstBndNodeRange> _activated_bnd_node_range; 86 : std::unique_ptr<ConstNodeRange> _activated_node_range; 87 : 88 : /// activate subdomain ID 89 : const subdomain_id_type _active_subdomain_id; 90 : /// inactivate subdomain ID (the subdomain that you want to keep the same) 91 : const subdomain_id_type _inactive_subdomain_id; 92 : /// expanded boundary name 93 : const std::vector<BoundaryName> _expand_boundary_name; 94 : /// expanded boundary IDs 95 : std::vector<BoundaryID> _boundary_ids, _disp_boundary_ids; 96 : };