Line data Source code
1 : /********************************************************************/ 2 : /* SOFTWARE COPYRIGHT NOTIFICATION */ 3 : /* Cardinal */ 4 : /* */ 5 : /* (c) 2021 UChicago Argonne, LLC */ 6 : /* ALL RIGHTS RESERVED */ 7 : /* */ 8 : /* Prepared by UChicago Argonne, LLC */ 9 : /* Under Contract No. DE-AC02-06CH11357 */ 10 : /* With the U. S. Department of Energy */ 11 : /* */ 12 : /* Prepared by Battelle Energy Alliance, LLC */ 13 : /* Under Contract No. DE-AC07-05ID14517 */ 14 : /* With the U. S. Department of Energy */ 15 : /* */ 16 : /* See LICENSE for full restrictions */ 17 : /********************************************************************/ 18 : 19 : #pragma once 20 : 21 : #include "ThreadedGeneralUserObject.h" 22 : 23 : /** 24 : * Class that maps from a point (x, y, z) to a new point that is 25 : * either rotationally symmetry or mirrored. The origin for reflection 26 : * and rotation is (0, 0, 0). 27 : */ 28 : class SymmetryPointGenerator : public ThreadedGeneralUserObject 29 : { 30 : public: 31 : static InputParameters validParams(); 32 : 33 : SymmetryPointGenerator(const InputParameters & parameters); 34 : 35 40 : virtual void initialize() {} 36 40 : virtual void finalize() {} 37 40 : virtual void execute() {} 38 : 39 : /** 40 : * Whether point is on the positive side of a plane; points exactly on plane return false 41 : * @param[in] p point 42 : * @param[in] normal unit normal defining the plane 43 : * @return whether on positive side of plane 44 : */ 45 : bool onPositiveSideOfPlane(const Point & p, const Point & normal) const; 46 : 47 : /** 48 : * Reflect point across a plane 49 : * @param[in] p point 50 : * @param[in] normal unit normal defining the plane 51 : * @return reflected point 52 : */ 53 : Point reflectPointAcrossPlane(const Point & p, const Point & normal) const; 54 : 55 : /** 56 : * Transform point coordinates according to class settings 57 : * @param[in] p point 58 : * @return transformed point 59 : */ 60 : Point transformPoint(const Point & p) const; 61 : 62 : /** 63 : * Sector of point 64 : * @param[in] p point 65 : * @return sector 66 : */ 67 : int sector(const Point & p) const; 68 : 69 : protected: 70 : /// Whether rotational symmetry is applied; otherwise, the domain is mirror-symmetric 71 : const bool _rotational_symmetry; 72 : 73 : /// Normal defining the first symmetry plane 74 : Point _normal; 75 : 76 : /// Axis of angular rotation symmetry 77 : Point _rotational_axis; 78 : 79 : /// Rotation angle 80 : Real _angle; 81 : 82 : /// Line defining the "zero-theta" line for rotational symmetry 83 : Point _zero_theta; 84 : 85 : /// Normal defining the reflection plane, for odd-numbered sectors 86 : Point _reflection_normal; 87 : };