torus_init Function

private function torus_init(oradius, iradius, optProp, layer, transform) result(out)

Initalising function for Torus SDF.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: oradius

Outer radius of Torus

real(kind=wp), intent(in) :: iradius

Inner radius of Torus

type(opticalProp_t), intent(in) :: optProp

Optical properties of the SDF

integer, intent(in) :: layer

ID number of sdf

real(kind=wp), intent(in), optional :: transform(4,4)

Optional transform to apply to SDF

Return Value type(torus)


Source Code

    function torus_init(oradius, iradius, optProp, layer, transform) result(out)
        !! Initalising function for Torus SDF.

        type(torus) :: out
        !> Outer radius of Torus
        real(kind=wp),           intent(IN) :: oradius
        !> Inner radius of Torus
        real(kind=wp),           intent(IN) :: iradius
        !> ID number of sdf
        integer,                  intent(IN) :: layer
        !> Optional transform to apply to SDF
        real(kind=wp),  optional, intent(IN) :: transform(4, 4)
        !> Optical properties of the SDF
        type(opticalProp_t),      intent(in) :: optProp

        real(kind=wp) :: t(4, 4)

        if(present(transform))then
            t = transform
        else
            t = identity()
        end if

        out%oradius = oradius
        out%iradius = iradius
        out%layer = layer
        out%transform = t

        out%optProps = optProp

    end function torus_init