OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::CartesianToCylinder3D< T, S > Class Template Referencefinal

This class converts Cartesian coordinates of point x to cylindrical coordinates wrote into output field (output[0] = radius, output[1] = phi, output[2] = z). More...

#include <frameChangeF3D.h>

+ Inheritance diagram for olb::CartesianToCylinder3D< T, S >:
+ Collaboration diagram for olb::CartesianToCylinder3D< T, S >:

Public Member Functions

 CartesianToCylinder3D (olb::Vector< T, 3 > cartesianOrigin, T &angle, olb::Vector< T, 3 > orientation={T(1), T(), T()})
 
 CartesianToCylinder3D (olb::Vector< T, 3 > cartesianOrigin, olb::Vector< T, 3 > axisDirection, olb::Vector< T, 3 > orientation={T(1), T(), T()})
 
 CartesianToCylinder3D (T cartesianOriginX, T cartesianOriginY, T cartesianOriginZ, T axisDirectionX, T axisDirectionY, T axisDirectionZ, T orientationX=T(1), T orientationY=T(), T orientationZ=T())
 
bool operator() (T output[], const S x[]) override
 operator writes cylindrical coordinates of Cartesian point x into output field, output[0] = radius ( >= 0), output[1] = phi (in [0, 2Pi)), output[2] = z
 
olb::Vector< T, 3 > const & getAxisDirection () const
 Read only access to _axisDirection.
 
olb::Vector< T, 3 > & getAxisDirection ()
 Read and write access to _axisDirection.
 
olb::Vector< T, 3 > const & getCartesianOrigin () const
 Read only access to _catesianOrigin.
 
olb::Vector< T, 3 > & getCartesianOrigin ()
 Read and write access to _catesianOrigin.
 
void setAngle (T angle)
 Read and write access to _axisDirection using angle.
 
- Public Member Functions inherited from olb::AnalyticalF< D, T, S >
AnalyticalF< D, T, S > & operator- (AnalyticalF< D, T, S > &rhs)
 
AnalyticalF< D, T, S > & operator+ (AnalyticalF< D, T, S > &rhs)
 
AnalyticalF< D, T, S > & operator* (AnalyticalF< D, T, S > &rhs)
 
AnalyticalF< D, T, S > & operator/ (AnalyticalF< D, T, S > &rhs)
 
- Public Member Functions inherited from olb::GenericF< T, S >
virtual ~GenericF ()=default
 
int getSourceDim () const
 read only access to member variable _m
 
int getTargetDim () const
 read only access to member variable _n
 
std::string & getName ()
 read and write access to name
 
std::string const & getName () const
 read only access to name
 
bool operator() (T output[])
 wrapper that call the pure virtual operator() (T output[], const S input[]) from above
 
bool operator() (T output[], S input0)
 
bool operator() (T output[], S input0, S input1)
 
bool operator() (T output[], S input0, S input1, S input2)
 
bool operator() (T output[], S input0, S input1, S input2, S input3)
 

Protected Attributes

olb::Vector< T, 3 > _cartesianOrigin
 origin of the Cartesian coordinate system
 
olb::Vector< T, 3 > _axisDirection
 direction of the axis along which the cylindrical coordinates are calculated
 
olb::Vector< T, 3 > _orientation
 direction to know orientation for math positive to obtain angle phi of Cartesian point x
 

Additional Inherited Members

- Public Types inherited from olb::AnalyticalF< D, T, S >
using identity_functor_type = AnalyticalIdentity<D,T,S>
 
- Public Types inherited from olb::GenericF< T, S >
using targetType = T
 
using sourceType = S
 
- Public Attributes inherited from olb::GenericF< T, S >
std::shared_ptr< GenericF< T, S > > _ptrCalcC
 memory management, frees resouces (calcClass)
 
- Static Public Attributes inherited from olb::AnalyticalF< D, T, S >
static constexpr unsigned dim = D
 
- Protected Member Functions inherited from olb::AnalyticalF< D, T, S >
 AnalyticalF (int n)
 
- Protected Member Functions inherited from olb::GenericF< T, S >
 GenericF (int targetDim, int sourceDim)
 

Detailed Description

template<typename T, typename S>
class olb::CartesianToCylinder3D< T, S >

This class converts Cartesian coordinates of point x to cylindrical coordinates wrote into output field (output[0] = radius, output[1] = phi, output[2] = z).

Initial situation for the cylindrical coordinate system is that angle phi lies in plane perpendicular to the _axisDirection and turns around the _cartesianOrigin. The radius is the distance of point x to the _axisDirection and z the distance to _cartesianOrigin along _axisDirection.

Definition at line 443 of file frameChangeF3D.h.

Constructor & Destructor Documentation

◆ CartesianToCylinder3D() [1/3]

template<typename T , typename S >
olb::CartesianToCylinder3D< T, S >::CartesianToCylinder3D ( olb::Vector< T, 3 > cartesianOrigin,
T & angle,
olb::Vector< T, 3 > orientation = {T(1),T(),T()} )

Definition at line 942 of file frameChangeF3D.hh.

945 _cartesianOrigin(cartesianOrigin),
946 _orientation(orientation)
947{
948 // rotation with angle to (0,0,1)
949 std::vector<T> origin(3,T());
950 T e3[3]= {T(),T(),T()};
951 e3[2] = T(1);
952 RotationRoundAxis3D<T, S> rotRAxis(origin, orientation, angle);
953 T tmp[3] = {T(),T(),T()};
954 rotRAxis(tmp, e3);
955
956 std::vector<T> htmp(tmp,tmp+3);
957 _axisDirection = htmp;
958}
olb::Vector< T, 3 > _cartesianOrigin
origin of the Cartesian coordinate system
olb::Vector< T, 3 > _axisDirection
direction of the axis along which the cylindrical coordinates are calculated
olb::Vector< T, 3 > _orientation
direction to know orientation for math positive to obtain angle phi of Cartesian point x
AnalyticalF< 3, T, S > AnalyticalF3D

References olb::CartesianToCylinder3D< T, S >::_axisDirection.

◆ CartesianToCylinder3D() [2/3]

template<typename T , typename S >
olb::CartesianToCylinder3D< T, S >::CartesianToCylinder3D ( olb::Vector< T, 3 > cartesianOrigin,
olb::Vector< T, 3 > axisDirection,
olb::Vector< T, 3 > orientation = {T(1),T(),T()} )

Definition at line 962 of file frameChangeF3D.hh.

966 _cartesianOrigin(cartesianOrigin),
967 _axisDirection(axisDirection),
968 _orientation(orientation)
969{
970 this->getName() = "const";
971}
std::string & getName()
read and write access to name
Definition genericF.hh:51

References olb::GenericF< T, S >::getName().

+ Here is the call graph for this function:

◆ CartesianToCylinder3D() [3/3]

template<typename T , typename S >
olb::CartesianToCylinder3D< T, S >::CartesianToCylinder3D ( T cartesianOriginX,
T cartesianOriginY,
T cartesianOriginZ,
T axisDirectionX,
T axisDirectionY,
T axisDirectionZ,
T orientationX = T(1),
T orientationY = T(),
T orientationZ = T() )

Definition at line 975 of file frameChangeF3D.hh.

980{
981 _cartesianOrigin[0] = cartesianOriginX;
982 _cartesianOrigin[1] = cartesianOriginY;
983 _cartesianOrigin[2] = cartesianOriginZ;
984
985 _axisDirection[0] = axisDirectionX;
986 _axisDirection[1] = axisDirectionY;
987 _axisDirection[2] = axisDirectionZ;
988
989 _orientation[0] = orientationX;
990 _orientation[1] = orientationY;
991 _orientation[2] = orientationZ;
992}

References olb::CartesianToCylinder3D< T, S >::_axisDirection, olb::CartesianToCylinder3D< T, S >::_cartesianOrigin, and olb::CartesianToCylinder3D< T, S >::_orientation.

Member Function Documentation

◆ getAxisDirection() [1/2]

template<typename T , typename S >
olb::Vector< T, 3 > & olb::CartesianToCylinder3D< T, S >::getAxisDirection ( )

Read and write access to _axisDirection.

Definition at line 1053 of file frameChangeF3D.hh.

1054{
1055 return _axisDirection;
1056}

◆ getAxisDirection() [2/2]

template<typename T , typename S >
olb::Vector< T, 3 > const & olb::CartesianToCylinder3D< T, S >::getAxisDirection ( ) const

Read only access to _axisDirection.

Definition at line 1046 of file frameChangeF3D.hh.

1047{
1048 return _axisDirection;
1049}

◆ getCartesianOrigin() [1/2]

template<typename T , typename S >
olb::Vector< T, 3 > & olb::CartesianToCylinder3D< T, S >::getCartesianOrigin ( )

Read and write access to _catesianOrigin.

Definition at line 1067 of file frameChangeF3D.hh.

1068{
1069 return _cartesianOrigin;
1070}

◆ getCartesianOrigin() [2/2]

template<typename T , typename S >
olb::Vector< T, 3 > const & olb::CartesianToCylinder3D< T, S >::getCartesianOrigin ( ) const

Read only access to _catesianOrigin.

Definition at line 1060 of file frameChangeF3D.hh.

1061{
1062 return _cartesianOrigin;
1063}

◆ operator()()

template<typename T , typename S >
bool olb::CartesianToCylinder3D< T, S >::operator() ( T output[],
const S x[] )
overridevirtual

operator writes cylindrical coordinates of Cartesian point x into output field, output[0] = radius ( >= 0), output[1] = phi (in [0, 2Pi)), output[2] = z

Implements olb::GenericF< T, S >.

Definition at line 997 of file frameChangeF3D.hh.

998{
999 T x_rot[3] = {T(),T(),T()};
1000 x_rot[0] = x[0];
1001 x_rot[1] = x[1];
1002 x_rot[2] = x[2];
1003// T x_rot[3] = {x[0], x[1], x[2]};
1004 Vector<T, 3> e3(T(),T(), T(1));
1005 Vector<T, 3> axisDirection(_axisDirection);
1006 Vector<T, 3> orientation(_orientation);
1007
1008 Vector<T, 3> normal = crossProduct3D(axisDirection, e3);
1009 Vector<T, 3> normalAxisDir(axisDirection);
1010 normalAxisDir = normalize(normalAxisDir);
1011
1012 // if axis has to be rotated
1013 if (!( util::nearZero(normalAxisDir[0]) && util::nearZero(normalAxisDir[1]) && util::nearZero(normalAxisDir[2]-1) )) {
1014
1015 if ( !util::nearZero(norm(orientation)) ) {
1016 normal = orientation; // if _orientation = 0,0,0 -> segm. fault
1017 }
1018 AngleBetweenVectors3D<T,S> angle(util::fromVector3(e3), util::fromVector3(normal));
1019 T tmp[3] = {T(),T(),T()};
1020 tmp[0] = axisDirection[0];
1021 tmp[1] = axisDirection[1];
1022 tmp[2] = axisDirection[2];
1023 T alpha[1] = {T()};
1024 angle(alpha, tmp);
1025
1026 // rotation with angle alpha to (0,0,1)
1027 RotationRoundAxis3D<T, S> rotRAxis(_cartesianOrigin, util::fromVector3(normal), -alpha[0]);
1028 rotRAxis(x_rot, x);
1029 }
1030 CartesianToPolar2D<T, S> car2pol(_cartesianOrigin, util::fromVector3(e3), _orientation);
1031 T x_rot_help[2] = {T(),T()};
1032 x_rot_help[0] = x_rot[0];
1033 x_rot_help[1] = x_rot[1];
1034
1035 T output_help[2] = {T(),T()};
1036 car2pol(output_help, x_rot_help);
1037
1038 output[0] = output_help[0];
1039 output[1] = output_help[1];
1040 output[2] = x_rot[2] - _cartesianOrigin[2];
1041 return true; // output[0] = radius, output[1] = phi, output[2] = z
1042}
Distribution< T > normal(T mean, T stddev)
std::vector< T > fromVector3(const Vector< T, 3 > &vec)
bool nearZero(T a) any_platform
return true if a is close to zero
Definition util.h:402
constexpr T norm(const ScalarVector< T, D, IMPL > &a) any_platform
Euclidean vector norm.
constexpr Vector< T, 3 > crossProduct3D(const ScalarVector< T, 3, IMPL > &a, const ScalarVector< T, 3, IMPL_ > &b) any_platform
Definition vector.h:263
constexpr Vector< T, D > normalize(const ScalarVector< T, D, IMPL > &a, T scale=T{1})
Definition vector.h:284

References olb::crossProduct3D(), olb::util::fromVector3(), olb::util::nearZero(), olb::norm(), and olb::normalize().

+ Here is the call graph for this function:

◆ setAngle()

template<typename T , typename S >
void olb::CartesianToCylinder3D< T, S >::setAngle ( T angle)

Read and write access to _axisDirection using angle.

Definition at line 1074 of file frameChangeF3D.hh.

1075{
1076 std::vector<T> Null(3,T());
1077 T e3[3] = {T(),T(),T()};
1078 e3[2] = T(1);
1079
1080 RotationRoundAxis3D<T, S> rotRAxis(Null, _orientation, angle);
1081 T tmp[3] = {T(),T(),T()};
1082 rotRAxis(tmp,e3);
1083 for (int i=0; i<3; ++i) {
1084 _axisDirection[i] = tmp[i];
1085 }
1086}

Member Data Documentation

◆ _axisDirection

template<typename T , typename S >
olb::Vector<T, 3> olb::CartesianToCylinder3D< T, S >::_axisDirection
protected

direction of the axis along which the cylindrical coordinates are calculated

Definition at line 448 of file frameChangeF3D.h.

◆ _cartesianOrigin

template<typename T , typename S >
olb::Vector<T, 3> olb::CartesianToCylinder3D< T, S >::_cartesianOrigin
protected

origin of the Cartesian coordinate system

Definition at line 446 of file frameChangeF3D.h.

◆ _orientation

template<typename T , typename S >
olb::Vector<T, 3> olb::CartesianToCylinder3D< T, S >::_orientation
protected

direction to know orientation for math positive to obtain angle phi of Cartesian point x

Definition at line 451 of file frameChangeF3D.h.


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