- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello-
I am having trouble using a Subroutine that takes a Derived Type implemented in a Module. I have checked some references, and my implementation seems to be spec. A search of this forum/site has turned up nothing that seems pertinent.
I believe I am implementing it correctly. As I understand, the Derived Type is declared inside the Module. Following the CONTAINS statement, the SUBROUTINE begins. It includes an INTENT statement, and appropriate INTERFACE in the main program.
If I have made an oversight in syntax, please excuse in advance. The setup below agrees with references I have found. The compiler doesn't mind the variable declarations, but chokes on my first attempt to reference the derived type with 'las_type(k)%attribute'.
"Error 1 Error: This name has not been declared as an array or a function. [LAS_TYPE] E:\Tolowa\BadTile\LAS_ASCII_Thon\GPS_Time_Analyzer\GPS_Time_Analyzer\GPS_Time_Analyzer.f90 78 "
The compiler is trying to make the (already declared) Derived Type variable a function/sub. This seems off.
Cheers- and thanks in advance-
Daryl
MODULE globals_binner
implicit none
!#####################################################
!### Point number ptnum int
!### GPS time gps_time dble
...snip...
!### Point source ID pt_src int
!#####################################################
TYPE lidar_return
integer :: ptnum , ret_num ,num_ret, scan_dir, edge, class ,synthetic, keypoint, withheld,user_data, pt_src
doubleprecision :: gps_time ,x, y , z,intensity, scan_angle
END TYPE lidar_return
Doubleprecision :: deltat
CONTAINS
SUBROUTINE Histogram(range_min, range_max, las_type)
implicit none
!|
!| 0 Declare locals
!|
DOUBLEPRECISION, INTENT(IN) :: range_min ! the lowerbound
DOUBLEPRECISION, INTENT(IN) :: range_max ! the upperbound
TYPE(lidar_return), INTENT(IN) :: las_type
doubleprecision :: delta_bin, epsilon = 1D-6
doubleprecision, dimension(20) :: bin_values
integer, dimension(20) :: bin_kount
integer :: k
...body of sub...
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Two points:
- Because your subroutine Histogram is contained within a module, it's interface is made automatically available to a calling procedure by the USE statement that introduces the module to the calling procedure. As I read your post, you've put an INTERFACE block for Histogram into the calling procedure - you should get rid of that as it's telling the compiler that Histogram is actually from somewhere other than your module.
- I don't see a dimension declared in the specification statements for las_type. If that's the case, the compiler doesn't think that las_type is an array, therefore doesn't understand what you mean by las_type(nnn) and hence complains. You need something like "TYPE(lidar_return), INTENT(IN), DIMENSION(xx) :: las_type" or similar.
IanH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Two points:
- Because your subroutine Histogram is contained within a module, it's interface is made automatically available to a calling procedure by the USE statement that introduces the module to the calling procedure. As I read your post, you've put an INTERFACE block for Histogram into the calling procedure - you should get rid of that as it's telling the compiler that Histogram is actually from somewhere other than your module.
- I don't see a dimension declared in the specification statements for las_type. If that's the case, the compiler doesn't think that las_type is an array, therefore doesn't understand what you mean by las_type(nnn) and hence complains. You need something like "TYPE(lidar_return), INTENT(IN), DIMENSION(xx) :: las_type" or similar.
IanH
Thanks so much, Ian - I appreciate your time.
I removed the INTERFACE block from the declaration statement section in the main program, and dimensioned the TYPE statement in the subroutine. Now it compiles fine.
Now for some histograms...
Thanks Again!
Daryl
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page