https://mooseframework.inl.gov
SelfShadowSideUserObject.h
Go to the documentation of this file.
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 "SideUserObject.h"
13 #include <vector>
14 #include "libmesh/data_type.h"
15 
22 {
23 public:
24  using SideIDType = std::pair<dof_id_type, unsigned int>;
25 
27 
29 
30  virtual void initialize() override;
31  virtual void execute() override;
32  virtual void finalize() override;
33 
35  virtual void threadJoin(const UserObject & y) override;
36 
37  // API to check if a QP is illuminated
38  unsigned int illumination(const SideIDType & id) const;
39 
41  bool useDisplacedMesh() const { return getParam<bool>("use_displaced_mesh"); }
42 
43  using Triangle = std::tuple<Point, Point, Point, SideIDType>;
44  using LineSegment = std::tuple<Point, Point, SideIDType>;
45 
46 protected:
48  const unsigned int _dim;
49 
51  std::vector<const PostprocessorValue *> _raw_direction;
52 
55 
57  std::map<SideIDType, unsigned int> & _illumination_status;
58 
60  std::vector<Triangle> _triangles;
61 
63  std::vector<LineSegment> _lines;
64 
66  std::vector<std::pair<SideIDType, MooseArray<Point>>> _local_qps;
67 
68 private:
69  void addLines(const SideIDType & id);
70  void addTriangles(const SideIDType & id);
71  bool check2DIllumination(const Point & qp, const SideIDType & id);
72  bool check3DIllumination(const Point & qp, const SideIDType & id);
73 
75  void rotate(MooseArray<Point> & points);
76  void rotate(Triangle & triangle);
77  void rotate(LineSegment & line);
78 };
static InputParameters validParams()
std::vector< const PostprocessorValue * > _raw_direction
raw illumination vector data (direction the radiation is propagating in)
unsigned int illumination(const SideIDType &id) const
bool check2DIllumination(const Point &qp, const SideIDType &id)
bool useDisplacedMesh() const
API to chek if the UO runs on the displaced mesh.
std::tuple< Point, Point, Point, SideIDType > Triangle
const std::vector< double > y
std::map< SideIDType, unsigned int > & _illumination_status
illumination status data (partition local), we use a bit for each QP
Given a radiation direction vector this user object computes the illumination state of each side QP o...
virtual void threadJoin(const UserObject &y) override
only needed for ElementUserObjects and NodalUseroObjects
TensorValue< Real > RealTensorValue
virtual void initialize() override
std::vector< Triangle > _triangles
global triange data (3D)
void addLines(const SideIDType &id)
RealTensorValue _rotation
matrix that rotates the direction onto the z-axis
virtual void finalize() override
std::pair< dof_id_type, unsigned int > SideIDType
bool check3DIllumination(const Point &qp, const SideIDType &id)
std::vector< LineSegment > _lines
global line segment data (2D)
SelfShadowSideUserObject(const InputParameters &parameters)
const InputParameters & parameters() const
const unsigned int _dim
problem dimension
std::vector< std::pair< SideIDType, MooseArray< Point > > > _local_qps
local QP data
void rotate(MooseArray< Point > &points)
rotate all points in the given container
void addTriangles(const SideIDType &id)
virtual void execute() override