https://mooseframework.inl.gov
Loading...
Searching...
No Matches
CSGTransformationHelper.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://www.mooseframework.org
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 "MooseTypes.h"
13#include "MooseEnum.h"
14
15#ifdef MOOSE_UNIT_TEST
16#include "gtest/gtest.h"
17#endif
18
19namespace CSG
20{
21
26{
27 TRANSLATION = 0, // Translation in x, y, z directions
28 ROTATION = 1, // Rotation in the form of euler angles (phi, theta, psi)
29 SCALE = 2 // Scaling in x, y, z directions
30};
31
33static const MooseEnum transformation_type_enum{"TRANSLATION=0 ROTATION=1 SCALE=2"};
34
39{
40public:
45
50 const std::vector<std::pair<TransformationType, std::tuple<Real, Real, Real>>> &
52 {
53 return _transformations;
54 }
55
63 const std::tuple<Real, Real, Real> & values);
64
70 static std::string getTransformationTypeString(TransformationType type);
71
76 std::vector<std::pair<std::string, std::tuple<Real, Real, Real>>>
78
79protected:
85 void addTransformation(TransformationType type, const std::tuple<Real, Real, Real> & values);
86
93 Point applyReverseTransformsToPoint(Point p) const;
94
96 std::vector<std::pair<TransformationType, std::tuple<Real, Real, Real>>> _transformations;
97
98 // CSGBase needs to be a friend to access addTransformation
99 friend class CSGBase;
100
101#ifdef MOOSE_UNIT_TEST
104 FRIEND_TEST(CSGSurfaceTest, testHalfspaceWithTransform);
105 FRIEND_TEST(CSGSurfaceTest, testHalfspaceWithNullTransform);
106 FRIEND_TEST(CSGEngUnitTest, testEngUnitEqual);
108#endif
109};
110
111} // namespace CSG
std::array< Real, 2 > values
Definition MortarUtils.C:52
CSGBase creates an internal representation of a Constructive Solid Geometry (CSG) model.
Definition CSGBase.h:54
Class for managing transformations in CSG objects.
const std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > & getTransformations() const
Get the list of transformations.
FRIEND_TEST(CSGEngUnitTest, testEngUnitEqual)
FRIEND_TEST(CSGSurfaceTest, testHalfspaceWithTransform)
Friends for unit testing.
Point applyReverseTransformsToPoint(Point p) const
update the value of point p by applying the inverse of the list of transformations to the point
CSGTransformationHelper()=default
Default constructor.
FRIEND_TEST(CSGSurfaceTest, testHalfspaceWithNullTransform)
static std::string getTransformationTypeString(TransformationType type)
Get the string representation of the transformation type.
void addTransformation(TransformationType type, const std::tuple< Real, Real, Real > &values)
Add a transformation to the list of transformations.
std::vector< std::pair< std::string, std::tuple< Real, Real, Real > > > getTransformationsAsStrings() const
Get the transformations of this object with string representations for types.
static bool isValidTransformationValue(TransformationType type, const std::tuple< Real, Real, Real > &values)
Check if the transformation value is valid for the given type.
std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > _transformations
List of transformations applied to this object.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
static const MooseEnum transformation_type_enum
MooseEnum for transformation types, matching the TransformationType enum values.
TransformationType
Enumeration of transformation types that can be applied to CSG objects.