OpenLB 1.7
Searching...
No Matches
olb::Hyperplane2D< T > Struct Template Reference

Definition of a analytical line embedded in 2D space. More...

`#include <hyperplane2D.h>`

Collaboration diagram for olb::Hyperplane2D< T >:

## Public Member Functions

Hyperplane2D ()=default

Hyperplane2DoriginAt (const Vector< T, 2 > &origin)
Center the line at the given origin vector.

Hyperplane2DcenteredIn (const Cuboid2D< T > &cuboid)
Center the line relative to the given cuboid.

Hyperplane2DparallelTo (const Vector< T, 2 > &direction)
Set the direction of the line parallel to a vector.

Hyperplane2DnormalTo (const Vector< T, 2 > &normal)
Calculate the direction vector of the line to be orthogonal to the given normal.

bool isParallelToX () const

bool isParallelToY () const

## Public Attributes

Vector< T, 2 > origin

Vector< T, 2 > u

Vector< T, 2 > normal

## Detailed Description

template<typename T>
struct olb::Hyperplane2D< T >

Definition of a analytical line embedded in 2D space.

Hyperplane2D defines a line using its origin and a direction vector.

Definition at line 37 of file hyperplane2D.h.

## ◆ Hyperplane2D()

template<typename T >
 olb::Hyperplane2D< T >::Hyperplane2D ( )
default

## ◆ centeredIn()

template<typename T >
 Hyperplane2D< T > & olb::Hyperplane2D< T >::centeredIn ( const Cuboid2D< T > & cuboid )

Center the line relative to the given cuboid.

Returns
Hyperplane2D reference for further construction

Definition at line 44 of file hyperplane2D.hh.

45{
46 const Vector<T,2>& cuboidOrigin = cuboid.getOrigin();
47 const Vector<int,2>& extend = cuboid.getExtent();
48 const T deltaR = cuboid.getDeltaR();
49
50 origin[0] = (cuboidOrigin[0] + 0.5 * deltaR * extend[0]);
51 origin[1] = (cuboidOrigin[1] + 0.5 * deltaR * extend[1]);
52 origin[0] -= 2*std::numeric_limits<T>::epsilon()*util::fabs(origin[0]);
53 origin[1] -= 2*std::numeric_limits<T>::epsilon()*util::fabs(origin[1]);
54
55 return *this;
56}
cpu::simd::Pack< T > fabs(cpu::simd::Pack< T > value)
Definition pack.h:106
Vector< T, 2 > origin
Here is the call graph for this function:

## ◆ isParallelToX()

template<typename T >
 bool olb::Hyperplane2D< T >::isParallelToX ( ) const
Returns
true iff normal is orthogonal to X axis

Definition at line 95 of file hyperplane2D.hh.

96{
98}
bool nearZero(const ADf< T, DIM > &a)
T dotProduct2D(const Vector< T, 2 > &a, const Vector< T, 2 > &b)
dot product, only valid in 2d
Vector< T, 2 > normal

References olb::util::dotProduct2D(), and olb::util::nearZero().

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ isParallelToY()

template<typename T >
 bool olb::Hyperplane2D< T >::isParallelToY ( ) const
Returns
true iff normal is orthogonal to Y axis

Definition at line 101 of file hyperplane2D.hh.

102{
104}

References olb::util::dotProduct2D(), and olb::util::nearZero().

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ normalTo()

template<typename T >
 Hyperplane2D< T > & olb::Hyperplane2D< T >::normalTo ( const Vector< T, 2 > & normal )

Calculate the direction vector of the line to be orthogonal to the given normal.

Returns
Hyperplane2D reference for further construction

Definition at line 70 of file hyperplane2D.hh.

71{
72 normal = n;
73
74 if ( util::nearZero(normal[0]*normal[1]) ) {
75 if ( util::nearZero(normal[0]) ) {
76 u = {T(1), T()};
77 }
78 else if ( util::nearZero(normal[1]) ) {
79 u = {T(), T(1)};
80 }
81 }
82 else {
83 u = {normal[1], -normal[0]};
84 }
85
86 u = normalize(u);
88
90
91 return *this;
92}
constexpr Vector< T, D > normalize(const ScalarVector< T, D, IMPL > &a, T scale=T{1})
Definition vector.h:245
#define OLB_POSTCONDITION(COND)
Definition olbDebug.h:47
Vector< T, 2 > u
Here is the call graph for this function:

## ◆ originAt()

template<typename T >
 Hyperplane2D< T > & olb::Hyperplane2D< T >::originAt ( const Vector< T, 2 > & origin )

Center the line at the given origin vector.

Returns
Hyperplane2D reference for further construction

Definition at line 35 of file hyperplane2D.hh.

36{
37 origin[0] = o[0] - 2*std::numeric_limits<T>::epsilon()*util::fabs(o[0]);
38 origin[1] = o[1] - 2*std::numeric_limits<T>::epsilon()*util::fabs(o[1]);
39
40 return *this;
41}

References olb::util::fabs().

Here is the call graph for this function:

## ◆ parallelTo()

template<typename T >
 Hyperplane2D< T > & olb::Hyperplane2D< T >::parallelTo ( const Vector< T, 2 > & direction )

Set the direction of the line parallel to a vector.

Returns
Hyperplane2D reference for further construction

Definition at line 59 of file hyperplane2D.hh.

60{
61 u = direction;
62 normal = normalize(Vector<T,2>({ u[1], -u[0] }));
63
65
66 return *this;
67}
Here is the call graph for this function:

## ◆ normal

template<typename T >
 Vector olb::Hyperplane2D< T >::normal

Definition at line 40 of file hyperplane2D.h.

## ◆ origin

template<typename T >
 Vector olb::Hyperplane2D< T >::origin

Definition at line 38 of file hyperplane2D.h.

## ◆ u

template<typename T >
 Vector olb::Hyperplane2D< T >::u

Definition at line 39 of file hyperplane2D.h.

The documentation for this struct was generated from the following files: