46 MODULE data_point_routines
74 INTERFACE data_points_create_start
75 MODULE PROCEDURE data_points_create_start_region
76 MODULE PROCEDURE data_points_create_start_interface
80 INTERFACE data_points_initialise
81 MODULE PROCEDURE data_points_initialise_region
82 MODULE PROCEDURE data_points_initialise_interface
86 INTERFACE data_points_label_get
87 MODULE PROCEDURE data_points_label_get_c
88 MODULE PROCEDURE data_points_label_get_vs
92 INTERFACE data_points_label_set
93 MODULE PROCEDURE data_points_label_set_c
94 MODULE PROCEDURE data_points_label_set_vs
97 PUBLIC data_point_check_exists
99 PUBLIC data_points_create_finish,data_points_create_start,data_points_destroy
101 PUBLIC data_points_data_projection_get,datapoints_dataprojectionglobalnumberget
103 PUBLIC data_points_global_number_get,data_points_label_get,data_points_label_set
105 PUBLIC data_points_values_get,data_points_values_set
107 PUBLIC data_points_number_of_data_points_get
109 PUBLIC data_points_user_number_get,data_points_user_number_set
111 PUBLIC data_points_weights_get,data_points_weights_set
120 SUBROUTINE data_point_check_exists(DATA_POINTS,USER_NUMBER,DATA_POINT_EXISTS,GLOBAL_NUMBER,ERR,ERROR,*)
124 INTEGER(INTG) :: user_number
125 LOGICAL,
INTENT(OUT) :: data_point_exists
126 INTEGER(INTG),
INTENT(OUT) :: global_number
127 INTEGER(INTG),
INTENT(OUT) :: err
132 enters(
"DATA_POINT_CHECK_EXISTS",err,error,*999)
134 data_point_exists=.false.
136 IF(
ASSOCIATED(data_points))
THEN 138 CALL tree_search(data_points%DATA_POINTS_TREE,user_number,tree_node,err,error,*999)
139 IF(
ASSOCIATED(tree_node))
THEN 140 CALL tree_node_value_get(data_points%DATA_POINTS_TREE,tree_node,global_number,err,error,*999)
141 data_point_exists=.true.
144 CALL flagerror(
"Data points is not associated.",err,error,*999)
147 exits(
"DATA_POINT_CHECK_EXISTS")
149 999 errorsexits(
"DATA_POINT_CHECK_EXISTS",err,error)
152 END SUBROUTINE data_point_check_exists
159 SUBROUTINE data_point_finalise(DATA_POINT,ERR,ERROR,*)
163 INTEGER(INTG),
INTENT(OUT) :: err
167 enters(
"DATA_POINT_FINALISE",err,error,*999)
169 data_point%GLOBAL_NUMBER=0
170 data_point%USER_NUMBER=0
171 IF(
ALLOCATED(data_point%position))
DEALLOCATE(data_point%position)
172 IF(
ALLOCATED(data_point%WEIGHTS))
DEALLOCATE(data_point%WEIGHTS)
174 exits(
"DATA_POINT_FINALISE")
176 999 errorsexits(
"DATA_POINT_FINALISE",err,error)
179 END SUBROUTINE data_point_finalise
186 SUBROUTINE data_points_create_finish(DATA_POINTS,ERR,ERROR,*)
190 INTEGER(INTG),
INTENT(OUT) :: err
193 INTEGER(INTG) :: data_point_idx
195 enters(
"DATA_POINTS_CREATE_FINISH",err,error,*999)
197 IF(
ASSOCIATED(data_points))
THEN 198 IF(data_points%DATA_POINTS_FINISHED)
THEN 199 CALL flagerror(
"Data points have already been finished.",err,error,*999)
201 data_points%DATA_POINTS_FINISHED=.true.
204 CALL flagerror(
"Data points is not associated.",err,error,*999)
209 DO data_point_idx=1,data_points%NUMBER_OF_DATA_POINTS
212 & global_number,err,error,*999)
214 & user_number,err,error,*999)
222 exits(
"DATA_POINTS_CREATE_FINISH")
224 999 errorsexits(
"DATA_POINTS_CREATE_FINISH",err,error)
227 END SUBROUTINE data_points_create_finish
234 SUBROUTINE data_points_create_start_generic(DATA_POINTS,NUMBER_OF_DATA_POINTS,NUMBER_OF_DIMENSIONS, &
239 INTEGER(INTG),
INTENT(IN) :: number_of_data_points
240 INTEGER(INTG),
INTENT(IN) :: number_of_dimensions
241 INTEGER(INTG),
INTENT(OUT) :: err
244 INTEGER(INTG) :: insert_status,data_point_idx,coord_idx
247 enters(
"DATA_POINTS_CREATE_START_GENERIC",err,error,*999)
249 IF(
ASSOCIATED(data_points))
THEN 250 IF(number_of_data_points>0)
THEN 251 ALLOCATE(data_points%DATA_POINTS(number_of_data_points),stat=err)
252 IF(err/=0)
CALL flagerror(
"Could not allocate data points data points.",err,error,*999)
253 data_points%NUMBER_OF_DATA_POINTS=number_of_data_points
254 data_points%NUMBER_OF_DATA_PROJECTIONS=0
255 IF(
ALLOCATED(data_points%DATA_PROJECTIONS))
DEALLOCATE(data_points%DATA_PROJECTIONS)
263 DO data_point_idx=1,data_points%NUMBER_OF_DATA_POINTS
264 data_points%DATA_POINTS(data_point_idx)%GLOBAL_NUMBER=data_point_idx
265 data_points%DATA_POINTS(data_point_idx)%USER_NUMBER=data_point_idx
266 data_points%DATA_POINTS(data_point_idx)%LABEL=
"" 268 ALLOCATE(data_points%DATA_POINTS(data_point_idx)%position(number_of_dimensions),stat=err)
270 & (data_point_idx,
"*",err,error))//
") values.",err,error,*999)
271 ALLOCATE(data_points%DATA_POINTS(data_point_idx)%WEIGHTS(number_of_dimensions),stat=err)
273 & (data_point_idx,
"*",err,error))//
") weights.",err,error,*999)
274 DO coord_idx=1,number_of_dimensions
275 data_points%DATA_POINTS(data_point_idx)%position(coord_idx)=0.0_dp
276 data_points%DATA_POINTS(data_point_idx)%WEIGHTS(coord_idx)=1.0_dp
278 CALL tree_item_insert(data_points%DATA_POINTS_TREE,data_point_idx,data_point_idx,insert_status,err,error,*999)
281 local_error=
"The specified number of data points of "//
trim(
number_to_vstring(number_of_data_points,
"*",err,error))// &
282 &
" is invalid. The number of data points must be > 0." 283 CALL flagerror(local_error,err,error,*999)
286 CALL flagerror(
"Data points is not associated.",err,error,*999)
289 exits(
"DATA_POINTS_CREATE_START_GENERIC")
291 999 errorsexits(
"DATA_POINTS_CREATE_START_GENERIC",err,error)
294 END SUBROUTINE data_points_create_start_generic
301 SUBROUTINE data_points_create_start_interface(INTERFACE,NUMBER_OF_DATA_POINTS,DATA_POINTS,ERR,ERROR,*)
305 INTEGER(INTG),
INTENT(IN) :: number_of_data_points
307 INTEGER(INTG),
INTENT(OUT) :: err
310 INTEGER(INTG) :: dummy_err
313 enters(
"DATA_POINTS_CREATE_START_INTERFACE",err,error,*998)
315 IF(
ASSOCIATED(interface))
THEN 316 IF(
ASSOCIATED(data_points))
THEN 317 CALL flagerror(
"Data points is already associated.",err,error,*999)
319 IF(
ASSOCIATED(interface%DATA_POINTS))
THEN 320 CALL flagerror(
"Interface already has data points associated.",err,error,*998)
323 CALL data_points_initialise(interface,err,error,*999)
325 CALL data_points_create_start_generic(interface%DATA_POINTS,number_of_data_points,interface% &
326 & coordinate_system%NUMBER_OF_DIMENSIONS,err,error,*999)
328 data_points=>interface%DATA_POINTS
332 CALL flagerror(
"Interface is not associated.",err,error,*998)
335 exits(
"DATA_POINTS_CREATE_START_INTERFACE")
337 999
CALL data_points_finalise(interface%DATA_POINTS,dummy_err,dummy_error,*998)
338 998 errorsexits(
"DATA_POINTS_CREATE_START_INTERFACE",err,error)
341 END SUBROUTINE data_points_create_start_interface
348 SUBROUTINE data_points_create_start_region(REGION,NUMBER_OF_DATA_POINTS,DATA_POINTS,ERR,ERROR,*)
352 INTEGER(INTG),
INTENT(IN) :: number_of_data_points
354 INTEGER(INTG),
INTENT(OUT) :: err
357 INTEGER(INTG) :: dummy_err
360 enters(
"DATA_POINTS_CREATE_START_REGION",err,error,*998)
362 IF(
ASSOCIATED(region))
THEN 363 IF(
ASSOCIATED(data_points))
THEN 364 CALL flagerror(
"Data points is already associated.",err,error,*999)
366 IF(
ASSOCIATED(region%DATA_POINTS))
THEN 367 CALL flagerror(
"Region already has data points associated.",err,error,*998)
370 CALL data_points_initialise(region,err,error,*999)
372 CALL data_points_create_start_generic(region%DATA_POINTS,number_of_data_points,region%COORDINATE_SYSTEM% &
373 & number_of_dimensions,err,error,*999)
375 data_points=>region%DATA_POINTS
379 CALL flagerror(
"Region is not associated.",err,error,*998)
382 exits(
"DATA_POINTS_CREATE_START_REGION")
384 999
CALL data_points_finalise(region%DATA_POINTS,dummy_err,dummy_error,*998)
385 998 errorsexits(
"DATA_POINTS_CREATE_START_REGION",err,error)
388 END SUBROUTINE data_points_create_start_region
396 SUBROUTINE data_points_destroy(DATA_POINTS,ERR,ERROR,*)
400 INTEGER(INTG),
INTENT(OUT) :: err
404 enters(
"DATA_POINTS_DESTROY",err,error,*999)
406 IF(
ASSOCIATED(data_points))
THEN 407 IF (
ASSOCIATED(data_points%REGION))
THEN 408 NULLIFY(data_points%REGION%DATA_POINTS)
410 CALL flag_error(
"Data_points region is not associated.",err,error,*999)
412 CALL data_points_finalise(data_points,err,error,*999)
415 exits(
"DATA_POINTS_DESTROY")
417 999 errorsexits(
"DATA_POINTS_DESTROY",err,error)
420 END SUBROUTINE data_points_destroy
427 SUBROUTINE data_points_finalise(DATA_POINTS,ERR,ERROR,*)
431 INTEGER(INTG),
INTENT(OUT) :: err
434 INTEGER(INTG) :: data_point_idx,data_projection_idx
436 enters(
"DATA_POINTS_FINALISE",err,error,*999)
438 IF(
ASSOCIATED(data_points))
THEN 439 IF(
ALLOCATED(data_points%DATA_POINTS))
THEN 440 DO data_point_idx=1,
SIZE(data_points%DATA_POINTS,1)
441 CALL data_point_finalise(data_points%DATA_POINTS(data_point_idx),err,error,*999)
443 DEALLOCATE(data_points%DATA_POINTS)
445 IF(
ASSOCIATED(data_points%DATA_POINTS_TREE))
CALL tree_destroy(data_points%DATA_POINTS_TREE,err,error,*999)
446 data_points%NUMBER_OF_DATA_PROJECTIONS=0
447 IF(
ALLOCATED(data_points%DATA_PROJECTIONS))
THEN 448 DO data_projection_idx=1,
SIZE(data_points%DATA_PROJECTIONS,1)
451 DEALLOCATE(data_points%DATA_PROJECTIONS)
453 IF(
ASSOCIATED(data_points%DATA_PROJECTIONS_TREE))
CALL tree_destroy(data_points%DATA_PROJECTIONS_TREE,err,error,*999)
454 DEALLOCATE(data_points)
457 exits(
"DATA_POINTS_FINALISE")
459 999 errorsexits(
"DATA_POINTS_FINALISE",err,error)
462 END SUBROUTINE data_points_finalise
469 SUBROUTINE data_points_initialise_generic(DATA_POINTS,ERR,ERROR,*)
473 INTEGER(INTG),
INTENT(OUT) :: err
477 enters(
"DATA_POINTS_INITIALISE_GENERIC",err,error,*999)
479 IF(
ASSOCIATED(data_points))
THEN 480 NULLIFY(data_points%REGION)
481 NULLIFY(data_points%INTERFACE)
482 data_points%DATA_POINTS_FINISHED=.false.
483 data_points%NUMBER_OF_DATA_POINTS=0
484 NULLIFY(data_points%DATA_POINTS_TREE)
485 data_points%NUMBER_OF_DATA_PROJECTIONS=0
486 NULLIFY(data_points%DATA_PROJECTIONS_TREE)
488 CALL flagerror(
"Data points is not associated.",err,error,*999)
491 exits(
"DATA_POINTS_INITIALISE_GENERIC")
493 999 errorsexits(
"DATA_POINTS_INITIALISE_GENERIC",err,error)
495 END SUBROUTINE data_points_initialise_generic
502 SUBROUTINE data_points_initialise_interface(INTERFACE,ERR,ERROR,*)
506 INTEGER(INTG),
INTENT(OUT) :: err
510 enters(
"DATA_POINTS_INITIALISE_INTERFACE",err,error,*999)
512 IF(
ASSOCIATED(interface))
THEN 513 IF(
ASSOCIATED(interface%DATA_POINTS))
THEN 514 CALL flagerror(
"Interface already has associated data points.",err,error,*999)
516 ALLOCATE(interface%DATA_POINTS,stat=err)
517 IF(err/=0)
CALL flagerror(
"Could not allocate interface data points.",err,error,*999)
518 CALL data_points_initialise_generic(interface%DATA_POINTS,err,error,*999)
519 interface%DATA_POINTS%INTERFACE=>
INTERFACE 522 CALL flagerror(
"Interface is not associated.",err,error,*999)
525 exits(
"DATA_POINTS_INITIALISE_INTERFACE")
527 999 errorsexits(
"DATA_POINTS_INITIALISE_INTERFACE",err,error)
530 END SUBROUTINE data_points_initialise_interface
537 SUBROUTINE data_points_initialise_region(REGION,ERR,ERROR,*)
541 INTEGER(INTG),
INTENT(OUT) :: err
545 enters(
"DATA_POINTS_INITIALISE_REGION",err,error,*999)
547 IF(
ASSOCIATED(region))
THEN 548 IF(
ASSOCIATED(region%DATA_POINTS))
THEN 549 CALL flagerror(
"Region has associated data points.",err,error,*999)
551 ALLOCATE(region%DATA_POINTS,stat=err)
552 IF(err/=0)
CALL flagerror(
"Could not allocate region data points.",err,error,*999)
553 CALL data_points_initialise_generic(region%DATA_POINTS,err,error,*999)
554 region%DATA_POINTS%REGION=>region
557 CALL flagerror(
"Region is not associated.",err,error,*999)
560 exits(
"DATA_POINTS_INITIALISE_REGION")
562 999 errorsexits(
"DATA_POINTS_INITIALISE_REGION",err,error)
564 END SUBROUTINE data_points_initialise_region
571 SUBROUTINE data_points_global_number_get(DATA_POINTS,USER_NUMBER,GLOBAL_NUMBER,ERR,ERROR,*)
575 INTEGER(INTG),
INTENT(IN) :: user_number
576 INTEGER(INTG),
INTENT(OUT) :: global_number
577 INTEGER(INTG),
INTENT(OUT) :: err
583 enters(
"DATA_POINTS_GLOBAL_NUMBER_GET",err,error,*999)
585 IF(
ASSOCIATED(data_points))
THEN 587 CALL tree_search(data_points%DATA_POINTS_TREE,user_number,tree_node,err,error,*999)
588 IF(
ASSOCIATED(tree_node))
THEN 589 CALL tree_node_value_get(data_points%DATA_POINTS_TREE,tree_node,global_number,err,error,*999)
591 local_error=
"Tree node is not associates (cannot find the user number "//
trim(
number_to_vstring(user_number,
"*",err, &
593 CALL flagerror(local_error,err,error,*999)
596 CALL flagerror(
"Data points is not associated.",err,error,*999)
599 exits(
"DATA_POINTS_GLOBAL_NUMBER_GET")
601 999 errorsexits(
"DATA_POINST_GLOBAL_NUMBER_GET",err,error)
604 END SUBROUTINE data_points_global_number_get
611 SUBROUTINE data_points_label_get_c(DATA_POINTS,GLOBAL_NUMBER,LABEL,ERR,ERROR,*)
615 INTEGER(INTG),
INTENT(IN) :: global_number
616 CHARACTER(LEN=*),
INTENT(OUT) :: label
617 INTEGER(INTG),
INTENT(OUT) :: err
620 INTEGER :: c_length,vs_length
623 enters(
"DATA_POINTS_LABEL_GET_C",err,error,*999)
625 IF(
ASSOCIATED(data_points))
THEN 626 IF(data_points%DATA_POINTS_FINISHED)
THEN 627 IF(global_number>=1.AND.global_number<=data_points%NUMBER_OF_DATA_POINTS)
THEN 629 vs_length=
len_trim(data_points%DATA_POINTS(global_number)%LABEL)
630 IF(c_length>vs_length)
THEN 631 label=
char(
len_trim(data_points%DATA_POINTS(global_number)%LABEL))
633 label=
char(data_points%DATA_POINTS(global_number)%LABEL,c_length)
636 local_error=
"The specified global data point number of "//
trim(
number_to_vstring(global_number,
"*",err,error))// &
637 &
" is invalid. The global data point number should be between 1 and "// &
639 CALL flagerror(local_error,err,error,*999)
642 CALL flagerror(
"Data points have not been finished.",err,error,*999)
645 CALL flagerror(
"Data points is not associated.",err,error,*999)
648 exits(
"DATA_POINTS_LABEL_GET_C")
650 999 errorsexits(
"DATA_POINTS_LABEL_GET_C",err,error)
653 END SUBROUTINE data_points_label_get_c
660 SUBROUTINE data_points_label_get_vs(DATA_POINTS,GLOBAL_NUMBER,LABEL,ERR,ERROR,*)
664 INTEGER(INTG),
INTENT(IN) :: global_number
666 INTEGER(INTG),
INTENT(OUT) :: err
671 enters(
"DATA_POINTS_LABEL_GET_VS",err,error,*999)
673 IF(
ASSOCIATED(data_points))
THEN 674 IF(data_points%DATA_POINTS_FINISHED)
THEN 675 IF(global_number>=1.AND.global_number<=data_points%NUMBER_OF_DATA_POINTS)
THEN 676 label=data_points%DATA_POINTS(global_number)%LABEL
678 local_error=
"The specified global data point number of "//
trim(
number_to_vstring(global_number,
"*",err,error))// &
679 &
" is invalid. The global data point number should be between 1 and "// &
681 CALL flagerror(local_error,err,error,*999)
684 CALL flagerror(
"Data points have not been finished.",err,error,*999)
687 CALL flagerror(
"Data points is not associated.",err,error,*999)
690 exits(
"DATA_POINTS_LABEL_GET_VS")
692 999 errorsexits(
"DATA_POINTS_LABEL_GET_VS",err,error)
695 END SUBROUTINE data_points_label_get_vs
702 SUBROUTINE data_points_label_set_c(DATA_POINTS,GLOBAL_NUMBER,LABEL,ERR,ERROR,*)
706 INTEGER(INTG),
INTENT(IN) :: global_number
707 CHARACTER(LEN=*),
INTENT(IN) :: label
708 INTEGER(INTG),
INTENT(OUT) :: err
713 enters(
"DATA_POINTS_LABEL_SET_C",err,error,*999)
715 IF(
ASSOCIATED(data_points))
THEN 716 IF(data_points%DATA_POINTS_FINISHED)
THEN 717 CALL flagerror(
"Data points have been finished.",err,error,*999)
719 IF(global_number>=1.AND.global_number<=data_points%NUMBER_OF_DATA_POINTS)
THEN 720 data_points%DATA_POINTS(global_number)%LABEL=label
722 local_error=
"The specified global data point number of "//
trim(
number_to_vstring(global_number,
"*",err,error))// &
723 &
" is invalid. The global data point number should be between 1 and "// &
725 CALL flagerror(local_error,err,error,*999)
729 CALL flagerror(
"Data points is not associated.",err,error,*999)
732 exits(
"DATA_POINTS_LABEL_SET_C")
734 999 errorsexits(
"DATA_POINTS_LABEL_SET_C",err,error)
737 END SUBROUTINE data_points_label_set_c
745 SUBROUTINE data_points_label_set_vs(DATA_POINTS,GLOBAL_NUMBER,LABEL,ERR,ERROR,*)
749 INTEGER(INTG),
INTENT(IN) :: global_number
751 INTEGER(INTG),
INTENT(OUT) :: err
756 enters(
"DATA_POINTS_LABEL_SET_VS",err,error,*999)
758 IF(
ASSOCIATED(data_points))
THEN 759 IF(data_points%DATA_POINTS_FINISHED)
THEN 760 CALL flagerror(
"Data points have been finished.",err,error,*999)
762 IF(global_number>=1.AND.global_number<=data_points%NUMBER_OF_DATA_POINTS)
THEN 763 data_points%DATA_POINTS(global_number)%LABEL=label
765 local_error=
"The specified global data point number of "//
trim(
number_to_vstring(global_number,
"*",err,error))// &
766 &
" is invalid. The global data point number should be between 1 and "// &
768 CALL flagerror(local_error,err,error,*999)
772 CALL flagerror(
"Data points is not associated.",err,error,*999)
775 exits(
"DATA_POINTS_LABEL_SET_VS")
777 999 errorsexits(
"DATA_POINTS_LABEL_SET_VS",err,error)
780 END SUBROUTINE data_points_label_set_vs
787 SUBROUTINE data_points_values_get(DATA_POINTS,GLOBAL_NUMBER,VALUES,ERR,ERROR,*)
791 INTEGER(INTG),
INTENT(IN) :: global_number
792 REAL(DP),
INTENT(OUT) :: values(:)
793 INTEGER(INTG),
INTENT(OUT) :: err
798 enters(
"DATA_POINTS_VALUES_GET",err,error,*999)
800 IF(
ASSOCIATED(data_points))
THEN 801 IF(data_points%DATA_POINTS_FINISHED)
THEN 803 IF(global_number>=1.AND.global_number<=data_points%NUMBER_OF_DATA_POINTS)
THEN 804 IF(
SIZE(values,1)==
SIZE(data_points%DATA_POINTS(global_number)%position,1))
THEN 805 values=data_points%DATA_POINTS(global_number)%position
808 &
"but it needs to have size of "// &
810 &
"." ,err,error,*999)
813 local_error=
"The specified global data point number of "//
trim(
number_to_vstring(global_number,
"*",err,error))// &
814 &
" is invalid. The global data point number should be between 1 and "// &
816 CALL flagerror(local_error,err,error,*999)
819 CALL flagerror(
"Data points have not been finished.",err,error,*999)
822 CALL flagerror(
"Data points is not associated.",err,error,*999)
825 exits(
"DATA_POINTS_VALUES_GET")
827 999 errorsexits(
"DATA_POINTS_VALUES_GET",err,error)
830 END SUBROUTINE data_points_values_get
837 SUBROUTINE data_points_values_set(DATA_POINTS,GLOBAL_NUMBER,VALUES,ERR,ERROR,*)
841 INTEGER(INTG),
INTENT(IN) :: global_number
842 REAL(DP),
INTENT(IN) :: values(:)
843 INTEGER(INTG),
INTENT(OUT) :: err
848 enters(
"DATA_POINTS_VALUES_SET",err,error,*999)
850 IF(
ASSOCIATED(data_points))
THEN 851 IF(data_points%DATA_POINTS_FINISHED)
THEN 852 CALL flagerror(
"Data points have been finished.",err,error,*999)
854 IF(global_number>=1.AND.global_number<=data_points%NUMBER_OF_DATA_POINTS)
THEN 855 IF(
SIZE(values,1)==
SIZE(data_points%DATA_POINTS(global_number)%position,1))
THEN 856 data_points%DATA_POINTS(global_number)%position(1:
SIZE(values,1))=values(1:
SIZE(values,1))
861 CALL flagerror(
"The dimension of the input values does not match.",err,error,*999)
864 local_error=
"The specified global data point number of "//
trim(
number_to_vstring(global_number,
"*",err,error))// &
865 &
" is invalid. The global data point number should be between 1 and "// &
867 CALL flagerror(local_error,err,error,*999)
871 CALL flagerror(
"Data points is not associated.",err,error,*999)
874 exits(
"DATA_POINTS_VALUES_SET")
876 999 errorsexits(
"DATA_POINTS_VALUES_SET",err,error)
879 END SUBROUTINE data_points_values_set
886 SUBROUTINE data_points_number_of_data_points_get(DATA_POINTS,NUMBER_OF_DATA_POINTS,ERR,ERROR,*)
890 INTEGER(INTG),
INTENT(OUT) :: number_of_data_points
891 INTEGER(INTG),
INTENT(OUT) :: err
895 enters(
"DATA_POINTS_NUMBER_OF_DATA_POINTS_GET",err,error,*999)
897 IF(
ASSOCIATED(data_points))
THEN 898 IF(data_points%DATA_POINTS_FINISHED)
THEN 899 number_of_data_points=data_points%NUMBER_OF_DATA_POINTS
901 CALL flagerror(
"Data points have not been finished.",err,error,*999)
904 CALL flagerror(
"Data points is not associated.",err,error,*999)
907 exits(
"DATA_POINTS_NUMBER_OF_DATA_POINTS_GET")
909 999 errorsexits(
"DATA_POINTS_NUMBER_OF_DATA_POINTS_GET",err,error)
912 END SUBROUTINE data_points_number_of_data_points_get
919 SUBROUTINE data_points_user_number_get(DATA_POINTS,GLOBAL_NUMBER,USER_NUMBER,ERR,ERROR,*)
923 INTEGER(INTG),
INTENT(IN) :: global_number
924 INTEGER(INTG),
INTENT(OUT) :: user_number
925 INTEGER(INTG),
INTENT(OUT) :: err
930 enters(
"DATA_POINTS_USER_NUMBER_GET",err,error,*999)
932 IF(
ASSOCIATED(data_points))
THEN 933 IF(data_points%DATA_POINTS_FINISHED)
THEN 934 IF(global_number>=1.AND.global_number<=data_points%NUMBER_OF_DATA_POINTS)
THEN 935 user_number=data_points%DATA_POINTS(global_number)%USER_NUMBER
937 local_error=
"The specified global data point number of "//
trim(
number_to_vstring(global_number,
"*",err,error))// &
938 &
" is invalid. The global data point number should be between 1 and "// &
940 CALL flagerror(local_error,err,error,*999)
943 CALL flagerror(
"Data points have not been finished.",err,error,*999)
946 CALL flagerror(
"Data points is not associated.",err,error,*999)
949 exits(
"DATA_POINTS_USER_NUMBER_GET")
951 999 errorsexits(
"DATA_POINTS_USER_NUMBER_GET",err,error)
954 END SUBROUTINE data_points_user_number_get
961 SUBROUTINE data_points_user_number_set(DATA_POINTS,GLOBAL_NUMBER,USER_NUMBER,ERR,ERROR,*)
965 INTEGER(INTG),
INTENT(IN) :: global_number
966 INTEGER(INTG),
INTENT(IN) :: user_number
967 INTEGER(INTG),
INTENT(OUT) :: err
970 INTEGER(INTG) :: insert_status,old_global_number
971 LOGICAL :: data_point_exists
974 enters(
"DATA_POINTS_USER_NUMBER_SET",err,error,*999)
976 IF(
ASSOCIATED(data_points))
THEN 977 IF(data_points%DATA_POINTS_FINISHED)
THEN 978 CALL flagerror(
"Data points have been finished.",err,error,*999)
980 IF(global_number>=1.AND.global_number<=data_points%NUMBER_OF_DATA_POINTS)
THEN 982 CALL data_point_check_exists(data_points,user_number,data_point_exists,old_global_number,err,error,*999)
983 IF(data_point_exists)
THEN 984 IF(old_global_number/=global_number)
THEN 985 local_error=
"The specified data point user number of "//
trim(
number_to_vstring(user_number,
"*",err,error))// &
986 &
" is already used by global data point number "//
trim(
number_to_vstring(old_global_number,
"*",err,error))// &
987 &
". User data point numbers must be unique." 988 CALL flagerror(local_error,err,error,*999)
991 CALL tree_item_delete(data_points%DATA_POINTS_TREE,data_points%DATA_POINTS(global_number)%USER_NUMBER,err,error,*999)
992 CALL tree_item_insert(data_points%DATA_POINTS_TREE,user_number,global_number,insert_status,err,error,*999)
994 data_points%DATA_POINTS(global_number)%USER_NUMBER=user_number
997 local_error=
"The specified global data point number of "//
trim(
number_to_vstring(global_number,
"*",err,error))// &
998 &
" is invalid. The global data point number should be between 1 and "// &
1000 CALL flagerror(local_error,err,error,*999)
1004 CALL flagerror(
"Data points is not associated.",err,error,*999)
1007 exits(
"DATA_POINTS_USER_NUMBER_SET")
1009 999 errorsexits(
"DATA_POINTS_USER_NUMBER_SET",err,error)
1012 END SUBROUTINE data_points_user_number_set
1019 SUBROUTINE data_points_weights_get(DATA_POINTS,GLOBAL_NUMBER,WEIGHTS,ERR,ERROR,*)
1023 INTEGER(INTG),
INTENT(IN) :: global_number
1024 REAL(DP),
INTENT(OUT) :: weights(:)
1025 INTEGER(INTG),
INTENT(OUT) :: err
1030 enters(
"DATA_POINTS_WEIGHTS_GET",err,error,*999)
1032 IF(
ASSOCIATED(data_points))
THEN 1033 IF(data_points%DATA_POINTS_FINISHED)
THEN 1035 IF(global_number>=1.AND.global_number<=data_points%NUMBER_OF_DATA_POINTS)
THEN 1036 IF(
SIZE(weights,1)==
SIZE(data_points%DATA_POINTS(global_number)%WEIGHTS,1))
THEN 1037 weights=data_points%DATA_POINTS(global_number)%WEIGHTS
1040 &
"but it needs to have size of "// &
1042 &
"." ,err,error,*999)
1045 local_error=
"The specified global data point number of "//
trim(
number_to_vstring(global_number,
"*",err,error))// &
1046 &
" is invalid. The global data point number should be between 1 and "// &
1048 CALL flagerror(local_error,err,error,*999)
1051 CALL flagerror(
"Data points have not been finished.",err,error,*999)
1054 CALL flagerror(
"Data points is not associated.",err,error,*999)
1057 exits(
"DATA_POINTS_WEIGHTS_GET")
1059 999 errorsexits(
"DATA_POINTS_WEIGHTS_GET",err,error)
1062 END SUBROUTINE data_points_weights_get
1069 SUBROUTINE data_points_weights_set(DATA_POINTS,GLOBAL_NUMBER,WEIGHTS,ERR,ERROR,*)
1073 INTEGER(INTG),
INTENT(IN) :: global_number
1074 REAL(DP),
INTENT(IN) :: weights(:)
1075 INTEGER(INTG),
INTENT(OUT) :: err
1080 enters(
"DATA_POINTS_WEIGHTS_SET",err,error,*999)
1082 IF(
ASSOCIATED(data_points))
THEN 1083 IF(data_points%DATA_POINTS_FINISHED)
THEN 1084 CALL flagerror(
"Data points have been finished.",err,error,*999)
1086 IF(global_number>=1.AND.global_number<=data_points%NUMBER_OF_DATA_POINTS)
THEN 1087 IF(
SIZE(weights,1)==
SIZE(data_points%DATA_POINTS(global_number)%WEIGHTS,1))
THEN 1088 data_points%DATA_POINTS(global_number)%WEIGHTS(1:
SIZE(weights,1))=weights(1:
SIZE(weights,1))
1090 CALL flagerror(
"The dimension of the input weights does not match.",err,error,*999)
1093 local_error=
"The specified global data point number of "//
trim(
number_to_vstring(global_number,
"*",err,error))// &
1094 &
" is invalid. The global data point number should be between 1 and "// &
1096 CALL flagerror(local_error,err,error,*999)
1100 CALL flagerror(
"Data points is not associated.",err,error,*999)
1103 exits(
"DATA_POINTS_WEIGHTS_SET")
1105 999 errorsexits(
"DATA_POINTS_WEIGHTS_SET",err,error)
1108 END SUBROUTINE data_points_weights_set
1115 SUBROUTINE data_points_data_projection_get(DATA_POINTS,GLOBAL_NUMBER,DATA_PROJECTION,ERR,ERROR,*)
1119 INTEGER(INTG),
INTENT(IN) :: global_number
1121 INTEGER(INTG),
INTENT(OUT) :: err
1124 enters(
"DATA_POINTS_DATA_PROJECTION_GET",err,error,*999)
1126 IF(
ASSOCIATED(data_points))
THEN 1127 IF(data_points%DATA_POINTS_FINISHED)
THEN 1128 IF(
ASSOCIATED(data_projection))
THEN 1129 CALL flagerror(
"Data projection is already associated.",err,error,*999)
1131 data_projection=>data_points%DATA_PROJECTIONS(global_number)%PTR
1133 & global_number,
"*",err,error))//
") ptr is not associated.",err,error,*999)
1136 CALL flagerror(
"Data points has not been finished.",err,error,*999)
1139 CALL flagerror(
"Data points is not associated.",err,error,*999)
1142 exits(
"DATA_POINTS_DATA_PROJECTION_GET")
1144 999 errorsexits(
"DATA_POINTS_DATA_PROJECTION_GET",err,error)
1147 END SUBROUTINE data_points_data_projection_get
1154 SUBROUTINE datapoints_dataprojectionglobalnumberget(DATA_POINTS,USER_NUMBER,GLOBAL_NUMBER,ERR,ERROR,*)
1158 INTEGER(INTG),
INTENT(IN) :: user_number
1159 INTEGER(INTG),
INTENT(OUT) :: global_number
1160 INTEGER(INTG),
INTENT(OUT) :: err
1166 enters(
"DataPoints_DataProjectionGlobalNumberGet",err,error,*999)
1168 IF(
ASSOCIATED(data_points))
THEN 1169 IF(data_points%DATA_POINTS_FINISHED)
THEN 1171 CALL tree_search(data_points%DATA_PROJECTIONS_TREE,user_number,tree_node,err,error,*999)
1172 IF(
ASSOCIATED(tree_node))
THEN 1173 CALL tree_node_value_get(data_points%DATA_PROJECTIONS_TREE,tree_node,global_number,err,error,*999)
1175 local_error=
"Tree node is not associates (cannot find the user number "//
trim(
number_to_vstring(user_number,
"*",err, &
1177 CALL flagerror(local_error,err,error,*999)
1181 CALL flagerror(
"Data points have not been finished.",err,error,*999)
1184 CALL flagerror(
"Data points is not associated.",err,error,*999)
1187 exits(
"DataPoints_DataProjectionGlobalNumberGet")
1189 999 errorsexits(
"DataPoints_DataProjectionGlobalNumberGet",err,error)
1192 END SUBROUTINE datapoints_dataprojectionglobalnumberget
1199 END MODULE data_point_routines
subroutine, public enters(NAME, ERR, ERROR,)
Records the entry into the named procedure and initialises the error code.
subroutine, public tree_insert_type_set(TREE, INSERT_TYPE, ERR, ERROR,)
Sets/changes the insert type for a tree.
This module contains all coordinate transformation and support routines.
Contains information for a region.
Converts a number to its equivalent varying string representation.
Implements trees of base types.
integer(intg), parameter, public tree_node_insert_sucessful
Successful insert status.
Contains information on the data points defined on a region.
subroutine, public tree_search(TREE, KEY, X, ERR, ERROR,)
Searches a tree to see if it contains a key.
This module contains all string manipulation and transformation routines.
Contains information about a data point.
This module provides an iso_varying_string module, conformant to the API specified in ISO/IEC 1539-2:...
subroutine, public tree_output(ID, TREE, ERR, ERROR,)
Outputs a tree to the specified output stream ID.
subroutine, public exits(NAME)
Records the exit out of the named procedure.
This module contains all type definitions in order to avoid cyclic module references.
This module handles all data projection routines.
This module contains all the low-level base routines e.g., all debug, control, and low-level communic...
subroutine, public tree_item_delete(TREE, KEY, ERR, ERROR,)
Deletes a tree node specified by a key from a tree.
subroutine, public tree_create_finish(TREE, ERR, ERROR,)
Finishes the creation of a tree created with TREE_CREATE_START.
This module contains all computational environment variables.
integer(intg), parameter, public tree_no_duplicates_allowed
No duplicate keys allowed tree type.
logical, save, public diagnostics1
.TRUE. if level 1 diagnostic output is active in the current routine
subroutine, public tree_destroy(TREE, ERR, ERROR,)
Destroys a tree.
integer(intg), parameter, public diagnostic_output_type
Diagnostic output type.
subroutine, public tree_item_insert(TREE, KEY, VALUE, INSERT_STATUS, ERR, ERROR,)
Inserts a tree node into a red-black tree.
Contains information for the interface data.
subroutine, public tree_node_value_get(TREE, TREE_NODE, VALUE, ERR, ERROR,)
Gets the value at a specified tree node.
Flags an error condition.
Flags an error condition.
subroutine, public tree_create_start(TREE, ERR, ERROR,)
Starts the creation of a tree and returns a pointer to the created tree.
subroutine, public data_projection_destroy(DATA_PROJECTION, ERR, ERROR,)
Destroys a data projection.
This module contains all kind definitions.