box_init Function

private function box_init(lengths, optProp, layer, transform) result(out)

Initalising function for Box SDF.

Arguments

Type IntentOptional Attributes Name
type(vector), intent(in) :: lengths

Lengths of each dimension of the box

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


Source Code

    function box_init(lengths, optProp, layer, transform) result(out)
        !! Initalising function for Box SDF.

        type(box) :: out
        
        !> Lengths of each dimension of the box
        type(vector),             intent(IN) :: lengths
        !> 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%lengths = .5_wp*lengths! as only half lengths
        out%layer = layer
        out%transform = t

        out%optProps = optProp

    end function box_init