sphere_init Function

private function sphere_init(radius, optProp, layer, transform) result(out)

Initalising function for Sphere SDF.

Arguments

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

radius of the Sphere

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(sphere)


Source Code

    function sphere_init(radius, optProp, layer, transform) result(out)
        !! Initalising function for Sphere SDF.

        type(sphere) :: out
        
        !> radius of the Sphere
        real(kind=wp),            intent(IN) :: radius
        !> 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%radius = radius
        out%layer = layer

        out%transform = t

        out%optProps = optProp

    end function sphere_init