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 "GeneratedMeshComponent.h" 13 : #include "Component1DConnection.h" 14 : 15 : /** 16 : * Base class for 1D components 17 : */ 18 : class Component1D : public GeneratedMeshComponent 19 : { 20 : public: 21 : Component1D(const InputParameters & parameters); 22 : 23 : /// Structure for storing connection data 24 : struct Connection 25 : { 26 : /// Physical position of the connecting point 27 : Point _position; 28 : /// Boundary element 29 : const Elem * const _elem; 30 : /// Boundary side 31 : unsigned short int _side; 32 : /// Boundary node of connection (used by other components for connecting) 33 : const Node * const _node; 34 : /// Boundary id of this connection 35 : unsigned int _boundary_id; 36 : /// Outward norm (either 1 or -1) on boundaries 37 : Real _normal; 38 : 39 : Connection(const Point & pt, 40 : const Elem * elem, 41 : unsigned short int side, 42 : boundary_id_type bc_id, 43 : Real normal) 44 8378 : : _position(pt), 45 8378 : _elem(elem), 46 8378 : _side(side), 47 8378 : _node(_elem->node_ptr(side)), 48 8378 : _boundary_id(bc_id), 49 8378 : _normal(normal) 50 : { 51 : } 52 : }; 53 : 54 : virtual void buildMesh() override; 55 : 56 : /** 57 : * Gets the 1D component nodeset ID 58 : */ 59 : unsigned int getNodesetID() const; 60 : 61 : /** 62 : * Gets the 1D component nodeset name 63 : */ 64 : const BoundaryName & getNodesetName() const; 65 : 66 : /** 67 : * Gets the vector of connections of an end type for this component 68 : * 69 : * @param[in] end_type end type for the connections to get 70 : */ 71 : virtual const std::vector<Connection> & 72 : getConnections(Component1DConnection::EEndType end_type) const; 73 : 74 : protected: 75 : virtual bool usingSecondOrderMesh() const override; 76 : 77 : /// Map of end type to a list of connections 78 : std::map<Component1DConnection::EEndType, std::vector<Connection>> _connections; 79 : 80 : private: 81 : virtual void buildMeshNodes(); 82 : 83 : /// Nodeset ID for all 1D component nodes 84 : BoundaryID _nodeset_id; 85 : /// Nodeset name for all 1D component nodes 86 : BoundaryName _nodeset_name; 87 : 88 : public: 89 : static InputParameters validParams(); 90 : };