Init_Points_t Subroutine

public subroutine Init_Points_t(this, nPoints, nDim)

Allocate storage for a point cloud of size nPoints in nDim dimensions. nDim must be 2 or 3.

Arguments

TypeIntentOptionalAttributesName
class(Points_t), intent(out) :: this
integer, intent(in) :: nPoints
integer, intent(in) :: nDim

Contents

Source Code


Source Code

  subroutine Init_Points_t(this,nPoints,nDim)
    !! Allocate storage for a point cloud of size nPoints in nDim dimensions.
    !! nDim must be 2 or 3.
    implicit none
    class(Points_t),intent(out) :: this
    integer,intent(in) :: nPoints
    integer,intent(in) :: nDim

    if(nDim /= 2 .and. nDim /= 3) then
      print*,"SELF_Points_t::Init: nDim must be 2 or 3, got ",nDim
      stop 1
    endif

    this%nPoints = nPoints
    this%nDim = nDim
    allocate(this%x(1:nPoints,1:nDim))
    allocate(this%elements(1:nPoints))
    allocate(this%coordinates(1:nPoints,1:nDim))
    this%x = 0.0_prec
    this%elements = 0
    this%coordinates = 0.0_prec

  endsubroutine Init_Points_t