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 "GeometricCutUserObject.h" 13 : 14 : class ComboCutUserObject : public GeometricCutUserObject 15 : { 16 : public: 17 : static InputParameters validParams(); 18 : 19 : ComboCutUserObject(const InputParameters & parameters); 20 : 21 : /** 22 : * Loop over all the provided GeometricCutUserObjects, fill the data structures based on each 23 : * cut that wants to cut this 2D element. 24 : * @param elem Pointer to the libMesh element to be considered for cutting 25 : * @param cut_edges Data structure filled with information about edges to be cut 26 : * @param cut_nodes Data structure filled with information about nodes to be cut 27 : * @return bool true if element is to be cut 28 : */ 29 : virtual bool cutElementByGeometry(const Elem * elem, 30 : std::vector<Xfem::CutEdge> & cut_edges, 31 : std::vector<Xfem::CutNode> & cut_nodes) const override; 32 : 33 : /** 34 : * Loop over all the provided GeometricCutUserObjects, fill the data structures based on each 35 : * cut that wants to cut this 3D element. 36 : * @param elem Pointer to the libMesh element to be considered for cutting 37 : * @param cut_edges Data structure filled with information about edges to be cut 38 : * @param cut_nodes Data structure filled with information about nodes to be cut 39 : * @return bool true if element is to be cut 40 : */ 41 : virtual bool cutElementByGeometry(const Elem * elem, 42 : std::vector<Xfem::CutFace> & cut_faces) const override; 43 : 44 : /** 45 : * Loop over all the provided GeometricCutUserObjects, fill the data structures based on each 46 : * cut that wants to cut this fragment of 2D element. 47 : * @param elem Pointer to the libMesh element to be considered for cutting 48 : * @param cut_edges Data structure filled with information about edges to be cut 49 : * @param cut_nodes Data structure filled with information about nodes to be cut 50 : * @return bool true if element is to be cut 51 : */ 52 : virtual bool cutFragmentByGeometry(std::vector<std::vector<Point>> & frag_edges, 53 : std::vector<Xfem::CutEdge> & cut_edges) const override; 54 : 55 : /** 56 : * Loop over all the provided GeometricCutUserObjects, fill the data structures based on each 57 : * cut that wants to cut this fragment of 3D element. 58 : * @param elem Pointer to the libMesh element to be considered for cutting 59 : * @param cut_edges Data structure filled with information about edges to be cut 60 : * @param cut_nodes Data structure filled with information about nodes to be cut 61 : * @return bool true if element is to be cut 62 : */ 63 : virtual bool cutFragmentByGeometry(std::vector<std::vector<Point>> & frag_faces, 64 : std::vector<Xfem::CutFace> & cut_faces) const override; 65 : 66 : /// The ComboCutUserObject shouldn't be used to provided crack front data. 67 0 : virtual const std::vector<Point> getCrackFrontPoints(unsigned int) const override 68 : { 69 0 : mooseError("getCrackFrontPoints() is not implemented for this object."); 70 : } 71 : 72 0 : virtual const std::vector<RealVectorValue> getCrackPlaneNormals(unsigned int) const override 73 : { 74 0 : mooseError("getCrackPlaneNormals() is not implemented for this object."); 75 : } 76 : 77 : // Get the CutSubdomainID for each provided geometric cut, then lookup the resulting 78 : // combo CutSubdomainID in the user-specified dictionary. 79 : virtual CutSubdomainID getCutSubdomainID(const Node * node) const override; 80 : 81 : protected: 82 : private: 83 : /// Helper function to build the dictionary for composite CutSubdomainID look-up 84 : void buildMap(); 85 : 86 : /// Vector of names of GeometricCutUserObjects to be combined 87 : const std::vector<UserObjectName> _cut_names; 88 : 89 : /// Number of geometric cuts to be combined 90 : unsigned int _num_cuts; 91 : 92 : /// Vector of points to the GeometricCutUserObjects to be combined 93 : std::vector<const GeometricCutUserObject *> _cuts; 94 : 95 : /// Keys read from the input file, to be parsed by buildMap() 96 : const std::vector<std::vector<CutSubdomainID>> _keys; 97 : 98 : /// Values read from the input file, to be parsed by buildMap() 99 : const std::vector<CutSubdomainID> _vals; 100 : 101 : /** 102 : * The dictionary for composite CutSubdomainID look-up. Keys are combinations of the 103 : * CutSubdomainIDs, values are the composite CutSubdomainIDs. 104 : */ 105 : std::map<std::vector<CutSubdomainID>, CutSubdomainID> _combo_ids; 106 : };