OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
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 404 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 916 of file frameChangeF3D.hh.

918 : AnalyticalF3D<T, S>(3),
919 _cartesianOrigin(cartesianOrigin),
920 _orientation(orientation)
921{
922 // rotation with angle to (0,0,1)
923 std::vector<T> origin(3,T());
924 T e3[3]= {T(),T(),T()};
925 e3[2] = T(1);
926 RotationRoundAxis3D<T, S> rotRAxis(origin, orientation, angle);
927 T tmp[3] = {T(),T(),T()};
928 rotRAxis(tmp, e3);
929
930 std::vector<T> htmp(tmp,tmp+3);
931 _axisDirection = htmp;
932}
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

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 936 of file frameChangeF3D.hh.

939 : AnalyticalF3D<T, S>(3),
940 _cartesianOrigin(cartesianOrigin),
941 _axisDirection(axisDirection),
942 _orientation(orientation)
943{
944 this->getName() = "const";
945}
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 949 of file frameChangeF3D.hh.

953 : AnalyticalF3D<T, S>(3)
954{
955 _cartesianOrigin[0] = cartesianOriginX;
956 _cartesianOrigin[1] = cartesianOriginY;
957 _cartesianOrigin[2] = cartesianOriginZ;
958
959 _axisDirection[0] = axisDirectionX;
960 _axisDirection[1] = axisDirectionY;
961 _axisDirection[2] = axisDirectionZ;
962
963 _orientation[0] = orientationX;
964 _orientation[1] = orientationY;
965 _orientation[2] = orientationZ;
966}

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 1027 of file frameChangeF3D.hh.

1028{
1029 return _axisDirection;
1030}

◆ 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 1020 of file frameChangeF3D.hh.

1021{
1022 return _axisDirection;
1023}

◆ 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 1041 of file frameChangeF3D.hh.

1042{
1043 return _cartesianOrigin;
1044}

◆ 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 1034 of file frameChangeF3D.hh.

1035{
1036 return _cartesianOrigin;
1037}

◆ 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 971 of file frameChangeF3D.hh.

972{
973 T x_rot[3] = {T(),T(),T()};
974 x_rot[0] = x[0];
975 x_rot[1] = x[1];
976 x_rot[2] = x[2];
977// T x_rot[3] = {x[0], x[1], x[2]};
978 Vector<T, 3> e3(T(),T(), T(1));
979 Vector<T, 3> axisDirection(_axisDirection);
980 Vector<T, 3> orientation(_orientation);
981
982 Vector<T, 3> normal = crossProduct3D(axisDirection, e3);
983 Vector<T, 3> normalAxisDir(axisDirection);
984 normalAxisDir = normalize(normalAxisDir);
985
986 // if axis has to be rotated
987 if (!( util::nearZero(normalAxisDir[0]) && util::nearZero(normalAxisDir[1]) && util::nearZero(normalAxisDir[2]-1) )) {
988
989 if ( !util::nearZero(norm(orientation)) ) {
990 normal = orientation; // if _orientation = 0,0,0 -> segm. fault
991 }
992 AngleBetweenVectors3D<T,S> angle(util::fromVector3(e3), util::fromVector3(normal));
993 T tmp[3] = {T(),T(),T()};
994 tmp[0] = axisDirection[0];
995 tmp[1] = axisDirection[1];
996 tmp[2] = axisDirection[2];
997 T alpha[1] = {T()};
998 angle(alpha, tmp);
999
1000 // rotation with angle alpha to (0,0,1)
1001 RotationRoundAxis3D<T, S> rotRAxis(_cartesianOrigin, util::fromVector3(normal), -alpha[0]);
1002 rotRAxis(x_rot, x);
1003 }
1004 CartesianToPolar2D<T, S> car2pol(_cartesianOrigin, util::fromVector3(e3), _orientation);
1005 T x_rot_help[2] = {T(),T()};
1006 x_rot_help[0] = x_rot[0];
1007 x_rot_help[1] = x_rot[1];
1008
1009 T output_help[2] = {T(),T()};
1010 car2pol(output_help, x_rot_help);
1011
1012 output[0] = output_help[0];
1013 output[1] = output_help[1];
1014 output[2] = x_rot[2] - _cartesianOrigin[2];
1015 return true; // output[0] = radius, output[1] = phi, output[2] = z
1016}
std::vector< T > fromVector3(const Vector< T, 3 > &vec)
bool nearZero(const ADf< T, DIM > &a)
Definition aDiff.h:1087
constexpr T norm(const ScalarVector< T, D, IMPL > &a)
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:224
constexpr Vector< T, D > normalize(const ScalarVector< T, D, IMPL > &a, T scale=T{1})
Definition vector.h:245

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 1048 of file frameChangeF3D.hh.

1049{
1050 std::vector<T> Null(3,T());
1051 T e3[3] = {T(),T(),T()};
1052 e3[2] = T(1);
1053
1054 RotationRoundAxis3D<T, S> rotRAxis(Null, _orientation, angle);
1055 T tmp[3] = {T(),T(),T()};
1056 rotRAxis(tmp,e3);
1057 for (int i=0; i<3; ++i) {
1058 _axisDirection[i] = tmp[i];
1059 }
1060}

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 409 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 407 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 412 of file frameChangeF3D.h.


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