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 Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
!> @brief Mapping homochoric <-> cubochoric
!
!> References:
!> @details
!> 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.
!> 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
use rotations
use prec, only: &

View File

@ -27,6 +27,11 @@
! 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
use prec, only: &
pReal
@ -112,9 +117,9 @@ end interface log
contains
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
!> constructor for a quaternion from a 4-vector
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
type(quaternion) pure function init__(array)
implicit none
@ -128,9 +133,9 @@ type(quaternion) pure function init__(array)
end function init__
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
!> assing a quaternion
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
elemental subroutine assign_quat__(self,other)
implicit none
@ -145,9 +150,9 @@ elemental subroutine assign_quat__(self,other)
end subroutine assign_quat__
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
!> assing a 4-vector
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
pure subroutine assign_vec__(self,other)
implicit none
@ -162,9 +167,9 @@ pure subroutine assign_vec__(self,other)
end subroutine assign_vec__
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
!> addition of two quaternions
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
type(quaternion) elemental function add__(self,other)
implicit none
@ -178,9 +183,9 @@ type(quaternion) elemental function add__(self,other)
end function add__
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
!> unary positive operator
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
type(quaternion) elemental function pos__(self)
implicit none
@ -194,9 +199,9 @@ type(quaternion) elemental function pos__(self)
end function pos__
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
!> subtraction of two quaternions
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
type(quaternion) elemental function sub__(self,other)
implicit none
@ -210,9 +215,9 @@ type(quaternion) elemental function sub__(self,other)
end function sub__
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
!> unary positive operator
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
type(quaternion) elemental function neg__(self)
implicit none
@ -226,9 +231,9 @@ type(quaternion) elemental function neg__(self)
end function neg__
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
!> multiplication of two quaternions
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
type(quaternion) elemental function mul_quat__(self,other)
implicit none
@ -242,9 +247,9 @@ type(quaternion) elemental function mul_quat__(self,other)
end function mul_quat__
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
!> multiplication of quaternions with scalar
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
type(quaternion) elemental function mul_scal__(self,scal)
implicit none
@ -259,9 +264,9 @@ type(quaternion) elemental function mul_scal__(self,scal)
end function mul_scal__
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
!> division of two quaternions
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
type(quaternion) elemental function div_quat__(self,other)
implicit none
@ -272,9 +277,9 @@ type(quaternion) elemental function div_quat__(self,other)
end function div_quat__
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
!> divisiont of quaternions by scalar
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
type(quaternion) elemental function div_scal__(self,scal)
implicit none
@ -286,9 +291,9 @@ type(quaternion) elemental function div_scal__(self,scal)
end function div_scal__
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
!> equality of two quaternions
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
logical elemental function eq__(self,other)
use prec, only: &
dEq
@ -302,9 +307,9 @@ logical elemental function eq__(self,other)
end function eq__
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
!> inequality of two quaternions
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
logical elemental function neq__(self,other)
implicit none
@ -315,9 +320,9 @@ logical elemental function neq__(self,other)
end function neq__
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
!> quaternion to the power of a scalar
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
type(quaternion) elemental function pow_scal__(self,expon)
implicit none
@ -329,9 +334,9 @@ type(quaternion) elemental function pow_scal__(self,expon)
end function pow_scal__
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
!> quaternion to the power of a quaternion
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
type(quaternion) elemental function pow_quat__(self,expon)
implicit none
@ -343,10 +348,10 @@ type(quaternion) elemental function pow_quat__(self,expon)
end function pow_quat__
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
!> exponential of a quaternion
!> ToDo: Lacks any check for invalid operations
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
type(quaternion) elemental function exp__(self)
implicit none
@ -363,10 +368,10 @@ type(quaternion) elemental function exp__(self)
end function exp__
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
!> logarithm of a quaternion
!> ToDo: Lacks any check for invalid operations
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
type(quaternion) elemental function log__(self)
implicit none
@ -383,9 +388,9 @@ type(quaternion) elemental function log__(self)
end function log__
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
!> norm of a quaternion
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
real(pReal) elemental function abs__(a)
implicit none
@ -396,9 +401,9 @@ real(pReal) elemental function abs__(a)
end function abs__
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
!> dot product of two quaternions
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
real(pReal) elemental function dot_product__(a,b)
implicit none
@ -409,9 +414,9 @@ real(pReal) elemental function dot_product__(a,b)
end function dot_product__
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
!> conjugate complex of a quaternion
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
type(quaternion) elemental function conjg__(a)
implicit none
@ -422,9 +427,9 @@ type(quaternion) elemental function conjg__(a)
end function conjg__
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
!> homomorphed quaternion of a quaternion
!--------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------
type(quaternion) elemental function quat_homomorphed(a)
implicit none

File diff suppressed because it is too large Load Diff