Simulation Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CPathGeneration.f90 2.0 KiB

1 year ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. module CPathGeneration
  2. use CPathGenerationVariables
  3. implicit none
  4. public
  5. contains
  6. integer function SetPathGeneration(count, array)
  7. !DEC$ ATTRIBUTES DLLEXPORT::SetPathGeneration
  8. !DEC$ ATTRIBUTES ALIAS: 'SetPathGeneration' :: SetPathGeneration
  9. implicit none
  10. integer, intent(in) :: count
  11. integer :: i
  12. type(CPathGenerationItem), intent(inout), target :: array(count)
  13. type(CPathGenerationItem), pointer :: item
  14. PathGenerationCount = count
  15. if(size(PathGenerations) > 0) then
  16. deallocate(PathGenerations)
  17. end if
  18. if(count > 0) then
  19. allocate(PathGenerations(count))
  20. do i = 1, count
  21. item => array(i)
  22. PathGenerations(i)%HoleType = item%HoleType
  23. PathGenerations(i)%Angle = item%Angle
  24. PathGenerations(i)%Length = item%Length
  25. PathGenerations(i)%FinalAngle = item%FinalAngle
  26. PathGenerations(i)%TotalLength = item%TotalLength
  27. PathGenerations(i)%MeasuredDepth = item%MeasuredDepth
  28. PathGenerations(i)%TotalVerticalDepth = item%TotalVerticalDepth
  29. end do
  30. end if
  31. SetPathGeneration = 0
  32. end function SetPathGeneration
  33. integer function SetPathGenerationDataPoints(count, array)
  34. !DEC$ ATTRIBUTES DLLEXPORT::SetPathGenerationDataPoints
  35. !DEC$ ATTRIBUTES ALIAS: 'SetPathGenerationDataPoints' :: SetPathGenerationDataPoints
  36. implicit none
  37. integer, intent(in) :: count
  38. integer :: i
  39. type(CDataPointItem), intent(inout), target :: array(count)
  40. type(CDataPointItem), pointer :: item
  41. PathGenerationDataPointsCount = count
  42. if(size(PathGenerationDataPoints) > 0) then
  43. deallocate(PathGenerationDataPoints)
  44. end if
  45. if(count > 0) then
  46. allocate(PathGenerationDataPoints(count))
  47. do i = 1, count
  48. item => array(i)
  49. PathGenerationDataPoints(i)%X = item%X
  50. PathGenerationDataPoints(i)%Y = item%Y
  51. end do
  52. end if
  53. SetPathGenerationDataPoints = 0
  54. end function SetPathGenerationDataPoints
  55. end module CPathGeneration