cleaned and documented

This commit is contained in:
Martin Diehl 2019-02-01 10:01:54 +01:00
parent 17a682e883
commit 53a95ea84f
4 changed files with 413 additions and 300 deletions

View File

@ -29,10 +29,10 @@
!-------------------------------------------------------------------------- !--------------------------------------------------------------------------
!> @author Marc De Graef, Carnegie Mellon University !> @author Marc De Graef, Carnegie Mellon University
! !> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
!> @brief Mapping homochoric <-> cubochoric !> @brief Mapping homochoric <-> cubochoric
! !
!> References: !> @details
!> D. Rosca, A. Morawiec, and M. De Graef. A new method of constructing a grid !> D. Rosca, A. Morawiec, and M. De Graef. A new method of constructing a grid
!> in the space of 3D rotations and its applications to texture analysis. !> in the space of 3D rotations and its applications to texture analysis.
!> Modeling and Simulations in Materials Science and Engineering 22, 075013 (2014). !> Modeling and Simulations in Materials Science and Engineering 22, 075013 (2014).

View File

@ -1,3 +1,9 @@
!---------------------------------------------------------------------------------------------------
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
!> @brief orientation storage
!> @details: orientation = rotation + symmetry
!---------------------------------------------------------------------------------------------------
module orientations module orientations
use rotations use rotations
use prec, only: & use prec, only: &

View File

@ -27,6 +27,11 @@
! USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ! USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
! ################################################################### ! ###################################################################
!---------------------------------------------------------------------------------------------------
!> @author Marc De Graef, Carnegie Mellon University
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
!> @brief general quaternion math, not limited to unit quaternions
!---------------------------------------------------------------------------------------------------
module quaternions module quaternions
use prec, only: & use prec, only: &
pReal pReal
@ -112,9 +117,9 @@ end interface log
contains contains
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
!> constructor for a quaternion from a 4-vector !> constructor for a quaternion from a 4-vector
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
type(quaternion) pure function init__(array) type(quaternion) pure function init__(array)
implicit none implicit none
@ -128,9 +133,9 @@ type(quaternion) pure function init__(array)
end function init__ end function init__
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
!> assing a quaternion !> assing a quaternion
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
elemental subroutine assign_quat__(self,other) elemental subroutine assign_quat__(self,other)
implicit none implicit none
@ -145,9 +150,9 @@ elemental subroutine assign_quat__(self,other)
end subroutine assign_quat__ end subroutine assign_quat__
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
!> assing a 4-vector !> assing a 4-vector
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
pure subroutine assign_vec__(self,other) pure subroutine assign_vec__(self,other)
implicit none implicit none
@ -162,9 +167,9 @@ pure subroutine assign_vec__(self,other)
end subroutine assign_vec__ end subroutine assign_vec__
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
!> addition of two quaternions !> addition of two quaternions
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
type(quaternion) elemental function add__(self,other) type(quaternion) elemental function add__(self,other)
implicit none implicit none
@ -178,9 +183,9 @@ type(quaternion) elemental function add__(self,other)
end function add__ end function add__
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
!> unary positive operator !> unary positive operator
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
type(quaternion) elemental function pos__(self) type(quaternion) elemental function pos__(self)
implicit none implicit none
@ -194,9 +199,9 @@ type(quaternion) elemental function pos__(self)
end function pos__ end function pos__
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
!> subtraction of two quaternions !> subtraction of two quaternions
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
type(quaternion) elemental function sub__(self,other) type(quaternion) elemental function sub__(self,other)
implicit none implicit none
@ -210,9 +215,9 @@ type(quaternion) elemental function sub__(self,other)
end function sub__ end function sub__
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
!> unary positive operator !> unary positive operator
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
type(quaternion) elemental function neg__(self) type(quaternion) elemental function neg__(self)
implicit none implicit none
@ -226,9 +231,9 @@ type(quaternion) elemental function neg__(self)
end function neg__ end function neg__
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
!> multiplication of two quaternions !> multiplication of two quaternions
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
type(quaternion) elemental function mul_quat__(self,other) type(quaternion) elemental function mul_quat__(self,other)
implicit none implicit none
@ -242,9 +247,9 @@ type(quaternion) elemental function mul_quat__(self,other)
end function mul_quat__ end function mul_quat__
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
!> multiplication of quaternions with scalar !> multiplication of quaternions with scalar
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
type(quaternion) elemental function mul_scal__(self,scal) type(quaternion) elemental function mul_scal__(self,scal)
implicit none implicit none
@ -259,9 +264,9 @@ type(quaternion) elemental function mul_scal__(self,scal)
end function mul_scal__ end function mul_scal__
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
!> division of two quaternions !> division of two quaternions
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
type(quaternion) elemental function div_quat__(self,other) type(quaternion) elemental function div_quat__(self,other)
implicit none implicit none
@ -272,9 +277,9 @@ type(quaternion) elemental function div_quat__(self,other)
end function div_quat__ end function div_quat__
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
!> divisiont of quaternions by scalar !> divisiont of quaternions by scalar
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
type(quaternion) elemental function div_scal__(self,scal) type(quaternion) elemental function div_scal__(self,scal)
implicit none implicit none
@ -286,9 +291,9 @@ type(quaternion) elemental function div_scal__(self,scal)
end function div_scal__ end function div_scal__
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
!> equality of two quaternions !> equality of two quaternions
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
logical elemental function eq__(self,other) logical elemental function eq__(self,other)
use prec, only: & use prec, only: &
dEq dEq
@ -302,9 +307,9 @@ logical elemental function eq__(self,other)
end function eq__ end function eq__
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
!> inequality of two quaternions !> inequality of two quaternions
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
logical elemental function neq__(self,other) logical elemental function neq__(self,other)
implicit none implicit none
@ -315,9 +320,9 @@ logical elemental function neq__(self,other)
end function neq__ end function neq__
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
!> quaternion to the power of a scalar !> quaternion to the power of a scalar
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
type(quaternion) elemental function pow_scal__(self,expon) type(quaternion) elemental function pow_scal__(self,expon)
implicit none implicit none
@ -329,9 +334,9 @@ type(quaternion) elemental function pow_scal__(self,expon)
end function pow_scal__ end function pow_scal__
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
!> quaternion to the power of a quaternion !> quaternion to the power of a quaternion
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
type(quaternion) elemental function pow_quat__(self,expon) type(quaternion) elemental function pow_quat__(self,expon)
implicit none implicit none
@ -343,10 +348,10 @@ type(quaternion) elemental function pow_quat__(self,expon)
end function pow_quat__ end function pow_quat__
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
!> exponential of a quaternion !> exponential of a quaternion
!> ToDo: Lacks any check for invalid operations !> ToDo: Lacks any check for invalid operations
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
type(quaternion) elemental function exp__(self) type(quaternion) elemental function exp__(self)
implicit none implicit none
@ -363,10 +368,10 @@ type(quaternion) elemental function exp__(self)
end function exp__ end function exp__
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
!> logarithm of a quaternion !> logarithm of a quaternion
!> ToDo: Lacks any check for invalid operations !> ToDo: Lacks any check for invalid operations
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
type(quaternion) elemental function log__(self) type(quaternion) elemental function log__(self)
implicit none implicit none
@ -383,9 +388,9 @@ type(quaternion) elemental function log__(self)
end function log__ end function log__
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
!> norm of a quaternion !> norm of a quaternion
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
real(pReal) elemental function abs__(a) real(pReal) elemental function abs__(a)
implicit none implicit none
@ -396,9 +401,9 @@ real(pReal) elemental function abs__(a)
end function abs__ end function abs__
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
!> dot product of two quaternions !> dot product of two quaternions
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
real(pReal) elemental function dot_product__(a,b) real(pReal) elemental function dot_product__(a,b)
implicit none implicit none
@ -409,9 +414,9 @@ real(pReal) elemental function dot_product__(a,b)
end function dot_product__ end function dot_product__
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
!> conjugate complex of a quaternion !> conjugate complex of a quaternion
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
type(quaternion) elemental function conjg__(a) type(quaternion) elemental function conjg__(a)
implicit none implicit none
@ -422,9 +427,9 @@ type(quaternion) elemental function conjg__(a)
end function conjg__ end function conjg__
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
!> homomorphed quaternion of a quaternion !> homomorphed quaternion of a quaternion
!-------------------------------------------------------------------------- !---------------------------------------------------------------------------------------------------
type(quaternion) elemental function quat_homomorphed(a) type(quaternion) elemental function quat_homomorphed(a)
implicit none implicit none

File diff suppressed because it is too large Load Diff