50 USE data_point_routines
53 USE generated_mesh_routines
55 USE interface_routines
119 INTEGER(INTG),
INTENT(OUT) :: ERR
123 enters(
"REGION_COORDINATE_SYSTEM_GET",err,error,*999)
125 IF(
ASSOCIATED(region))
THEN 126 IF(region%REGION_FINISHED)
THEN 127 IF(
ASSOCIATED(coordinate_system))
THEN 128 CALL flagerror(
"Coordinate system is already associated.",err,error,*999)
130 coordinate_system=>region%COORDINATE_SYSTEM
133 CALL flagerror(
"Region has not been finished.",err,error,*999)
136 CALL flagerror(
"Region is not associated.",err,error,*999)
139 exits(
"REGION_COORDINATE_SYSTEM_GET")
141 999 errorsexits(
"REGION_COORDINATE_SYSTEM_GET",err,error)
155 INTEGER(INTG),
INTENT(OUT) :: ERR
159 enters(
"REGION_COORDINATE_SYSTEM_SET",err,error,*999)
161 IF(
ASSOCIATED(region))
THEN 162 IF(region%REGION_FINISHED)
THEN 163 CALL flagerror(
"Region has been finished.",err,error,*999)
165 IF(
ASSOCIATED(coordinate_system))
THEN 166 IF(coordinate_system%COORDINATE_SYSTEM_FINISHED)
THEN 167 region%COORDINATE_SYSTEM=>coordinate_system
169 CALL flagerror(
"Coordinate system has not been finished.",err,error,*999)
172 CALL flagerror(
"Coordinate system is not associated.",err,error,*999)
176 CALL flagerror(
"Region is not associated.",err,error,*999)
179 exits(
"REGION_COORDINATE_SYSTEM_SET")
181 999 errorsexits(
"REGION_COORDINATE_SYSTEM_SET",err,error)
194 INTEGER(INTG),
INTENT(OUT) :: ERR
198 enters(
"REGION_CREATE_FINISH",err,error,*999)
200 IF(
ASSOCIATED(region))
THEN 201 IF(region%REGION_FINISHED)
THEN 202 CALL flagerror(
"Region has already been finished.",err,error,*999)
204 region%REGION_FINISHED=.true.
207 CALL flagerror(
"Region is not associated.",err,error,*999)
213 IF(
ASSOCIATED(region%PARENT_REGION))
THEN 221 exits(
"REGION_CREATE_FINISH")
223 999 errorsexits(
"REGION_CREATE_FINISH",err,error)
246 INTEGER(INTG),
INTENT(IN) :: USER_NUMBER
249 INTEGER(INTG),
INTENT(OUT) :: ERR
252 INTEGER(INTG) :: DUMMY_ERR,region_idx
258 NULLIFY(new_sub_regions)
260 enters(
"REGION_CREATE_START",err,error,*997)
263 IF(
ASSOCIATED(new_region))
THEN 265 &
" has already been created." 266 CALL flagerror(local_error,err,error,*997)
268 IF(
ASSOCIATED(region))
THEN 269 CALL flagerror(
"Region is already associated.",err,error,*997)
272 IF(
ASSOCIATED(parent_region))
THEN 273 IF(parent_region%REGION_FINISHED)
THEN 274 IF(
ASSOCIATED(parent_region%COORDINATE_SYSTEM))
THEN 278 region%USER_NUMBER=user_number
282 region%LABEL=
char(local_string)
284 region%COORDINATE_SYSTEM=>parent_region%COORDINATE_SYSTEM
286 ALLOCATE(new_sub_regions(parent_region%NUMBER_OF_SUB_REGIONS+1),stat=err)
287 IF(err/=0)
CALL flagerror(
"Could not allocate new sub-regions.",err,error,*999)
288 DO region_idx=1,parent_region%NUMBER_OF_SUB_REGIONS
289 new_sub_regions(region_idx)%PTR=>parent_region%SUB_REGIONS(region_idx)%PTR
291 parent_region%NUMBER_OF_SUB_REGIONS=parent_region%NUMBER_OF_SUB_REGIONS+1
292 new_sub_regions(parent_region%NUMBER_OF_SUB_REGIONS)%PTR=>region
293 IF(
ASSOCIATED(parent_region%SUB_REGIONS))
DEALLOCATE(parent_region%SUB_REGIONS)
294 parent_region%SUB_REGIONS=>new_sub_regions
296 region%PARENT_REGION=>parent_region
298 CALL flagerror(
"Parent region does not have an associated coordinate system.",err,error,*997)
301 CALL flagerror(
"Parent region has not been finished.",err,error,*997)
304 CALL flagerror(
"Parent region is not associated.",err,error,*997)
309 exits(
"REGION_CREATE_START")
312 998
IF(
ASSOCIATED(new_sub_regions))
DEALLOCATE(new_sub_regions)
313 997 errorsexits(
"REGION_CREATE_START",err,error)
327 INTEGER(INTG),
INTENT(OUT) :: ERR
331 enters(
"REGION_DATA_POINTS_GET",err,error,*998)
333 IF(
ASSOCIATED(region))
THEN 334 IF(region%REGION_FINISHED)
THEN 335 IF(
ASSOCIATED(data_points))
THEN 336 CALL flagerror(
"Data points is already associated.",err,error,*998)
338 data_points=>region%DATA_POINTS
339 IF(.NOT.
ASSOCIATED(data_points))
CALL flagerror(
"Data points is not associated.",err,error,*999)
342 CALL flagerror(
"Region has not been finished.",err,error,*998)
345 CALL flagerror(
"Region is not associated.",err,error,*998)
348 exits(
"REGION_DATA_POINTS_GET")
350 999
NULLIFY(data_points)
351 998 errorsexits(
"REGION_DATA_POINTS_GET",err,error)
365 INTEGER(INTG),
INTENT(IN) :: USER_NUMBER
366 INTEGER(INTG),
INTENT(OUT) :: ERR
369 INTEGER(INTG) :: count,nr
373 enters(
"REGION_DESTROY_NUMBER",err,error,*999)
377 IF(
ASSOCIATED(region))
THEN 384 IF(region%NUMBER_OF_SUB_REGIONS==0)
THEN 386 IF(
ASSOCIATED(region%PARENT_REGION))
THEN 387 NULLIFY(new_sub_regions)
388 IF(region%PARENT_REGION%NUMBER_OF_SUB_REGIONS>1)
THEN 390 ALLOCATE(new_sub_regions(region%PARENT_REGION%NUMBER_OF_SUB_REGIONS-1),stat=err)
391 IF(err/=0)
CALL flagerror(
"Could not allocate new sub-regions.",err,error,*999)
393 DO nr=1,region%PARENT_REGION%NUMBER_OF_SUB_REGIONS
394 IF(region%PARENT_REGION%SUB_REGIONS(nr)%PTR%USER_NUMBER/=region%USER_NUMBER)
THEN 396 new_sub_regions(count)%PTR=>region%PARENT_REGION%SUB_REGIONS(nr)%PTR
400 region%PARENT_REGION%NUMBER_OF_SUB_REGIONS=region%PARENT_REGION%NUMBER_OF_SUB_REGIONS-1
401 IF(
ASSOCIATED(region%PARENT_REGION%SUB_REGIONS))
DEALLOCATE(region%PARENT_REGION%SUB_REGIONS)
402 region%PARENT_REGION%SUB_REGIONS=>new_sub_regions
406 CALL flagerror(
"Parent region is not associated.",err,error,*999)
410 DO WHILE(region%NUMBER_OF_SUB_REGIONS>0)
417 CALL flagerror(
"Region number does not exist.",err,error,*999)
420 exits(
"REGION_DESTROY_NUMBER")
422 999 errorsexits(
"REGION_DESTROY_NUMBER",err,error)
435 INTEGER(INTG),
INTENT(OUT) :: ERR
438 INTEGER(INTG) :: USER_NUMBER
440 enters(
"REGION_DESTROY",err,error,*999)
442 IF(
ASSOCIATED(region))
THEN 443 user_number=region%USER_NUMBER
446 CALL flagerror(
"Region is not associated.",err,error,*999)
449 exits(
"REGION_DESTROY")
451 999 errorsexits(
"REGION_DESTROY",err,error)
464 INTEGER(INTG),
INTENT(OUT) :: ERR
468 enters(
"REGION_FINALISE",err,error,*999)
470 IF(
ASSOCIATED(region))
THEN 474 CALL fields_finalise(region%FIELDS,err,error,*999)
475 CALL meshes_finalise(region%MESHES,err,error,*999)
476 IF(
ASSOCIATED(region%DATA_POINTS))
CALL data_points_destroy(region%DATA_POINTS,err,error,*999)
477 IF(
ASSOCIATED(region%NODES))
CALL nodes_destroy(region%NODES,err,error,*999)
478 IF(
ASSOCIATED(region%SUB_REGIONS))
DEALLOCATE(region%SUB_REGIONS)
479 IF(
ASSOCIATED(region%INTERFACES))
CALL interfaces_finalise(region%INTERFACES,err,error,*999)
480 IF(
ASSOCIATED(region%GENERATED_MESHES))
CALL generated_meshes_finalise(region%GENERATED_MESHES,err,error,*999)
484 exits(
"REGION_FINALISE")
486 999 errorsexits(
"REGION_FINALISE",err,error)
499 INTEGER(INTG),
INTENT(OUT) :: ERR
502 INTEGER(INTG) :: DUMMY_ERR
505 enters(
"REGION_INITIALISE",err,error,*998)
507 IF(
ASSOCIATED(region))
THEN 508 CALL flagerror(
"Region is already associated.",err,error,*998)
510 ALLOCATE(region,stat=err)
511 IF(err/=0)
CALL flagerror(
"Could not allocate region.",err,error,*999)
513 region%REGION_FINISHED=.false.
515 NULLIFY(region%COORDINATE_SYSTEM)
516 NULLIFY(region%DATA_POINTS)
517 NULLIFY(region%NODES)
518 NULLIFY(region%MESHES)
519 NULLIFY(region%GENERATED_MESHES)
520 NULLIFY(region%FIELDS)
521 NULLIFY(region%EQUATIONS_SETS)
522 NULLIFY(region%CELLML_ENVIRONMENTS)
523 NULLIFY(region%PARENT_REGION)
524 region%NUMBER_OF_SUB_REGIONS=0
525 NULLIFY(region%SUB_REGIONS)
526 NULLIFY(region%INTERFACES)
527 CALL meshes_initialise(region,err,error,*999)
528 CALL generated_meshes_initialise(region,err,error,*999)
529 CALL fields_initialise(region,err,error,*999)
532 CALL interfaces_initialise(region,err,error,*999)
535 exits(
"REGION_INITIALISE")
538 998 errorsexits(
"REGION_INITIALISE",err,error)
552 CHARACTER(LEN=*),
INTENT(OUT) :: LABEL
553 INTEGER(INTG),
INTENT(OUT) :: ERR
556 INTEGER(INTG) :: C_LENGTH,VS_LENGTH
558 enters(
"REGION_LABEL_GET_C",err,error,*999)
560 IF(
ASSOCIATED(region))
THEN 563 IF(c_length>vs_length)
THEN 564 label=
char(region%LABEL,vs_length)
566 label=
char(region%LABEL,c_length)
569 CALL flagerror(
"Region is not associated.",err,error,*999)
572 exits(
"REGION_LABEL_GET_C")
574 999 errorsexits(
"REGION_LABEL_GET_C",err,error)
589 INTEGER(INTG),
INTENT(OUT) :: ERR
593 enters(
"REGION_LABEL_GET_VS",err,error,*999)
595 IF(
ASSOCIATED(region))
THEN 599 CALL flagerror(
"Region is not associated.",err,error,*999)
602 exits(
"REGION_LABEL_GET_VS")
604 999 errorsexits(
"REGION_LABEL_GET_VS",err,error)
618 CHARACTER(LEN=*),
INTENT(IN) :: LABEL
619 INTEGER(INTG),
INTENT(OUT) :: ERR
623 enters(
"REGION_LABEL_SET_C",err,error,*999)
625 IF(
ASSOCIATED(region))
THEN 626 IF(region%REGION_FINISHED)
THEN 627 CALL flagerror(
"Region has been finished.",err,error,*999)
632 CALL flagerror(
"Region is not associated.",err,error,*999)
635 exits(
"REGION_LABEL_SET_C")
637 999 errorsexits(
"REGION_LABEL_SET_C",err,error)
651 INTEGER(INTG),
INTENT(OUT) :: ERR
655 enters(
"REGION_LABEL_SET_VS",err,error,*999)
657 IF(
ASSOCIATED(region))
THEN 658 IF(region%REGION_FINISHED)
THEN 659 CALL flagerror(
"Region has been finished.",err,error,*999)
664 CALL flagerror(
"Region is not associated.",err,error,*999)
667 exits(
"REGION_LABEL_SET_VS")
669 999 errorsexits(
"REGION_LABEL_SET_VS",err,error)
683 INTEGER(INTG),
INTENT(OUT) :: ERR
687 enters(
"REGION_NODES_GET",err,error,*998)
689 IF(
ASSOCIATED(region))
THEN 690 IF(region%REGION_FINISHED)
THEN 691 IF(
ASSOCIATED(nodes))
THEN 692 CALL flagerror(
"Nodes is already associated.",err,error,*998)
695 IF(.NOT.
ASSOCIATED(nodes))
CALL flagerror(
"Nodes is not associated.",err,error,*999)
698 CALL flagerror(
"Region has not been finished.",err,error,*998)
701 CALL flagerror(
"Region is not associated.",err,error,*998)
704 exits(
"REGION_NODES_GET")
707 998 errorsexits(
"REGION_NODES_GET",err,error)
721 INTEGER(INTG),
INTENT(IN) :: USER_NUMBER
723 INTEGER(INTG),
INTENT(OUT) :: ERR
729 enters(
"REGION_USER_NUMBER_FIND",err,error,*999)
731 IF(
ASSOCIATED(region))
THEN 732 CALL flagerror(
"Region is already associated.",err,error,*999)
735 world_region=>
regions%WORLD_REGION
736 IF(
ASSOCIATED(world_region))
THEN 737 IF(user_number==0)
THEN 741 DO WHILE(nr<=world_region%NUMBER_OF_SUB_REGIONS.AND..NOT.
ASSOCIATED(region))
743 IF(.NOT.
ASSOCIATED(region)) nr=nr+1
747 CALL flagerror(
"World region is not associated.",err,error,*999)
751 exits(
"REGION_USER_NUMBER_FIND")
753 999 errorsexits(
"REGION_USER_NUMBER_FIND",err,error)
767 INTEGER(INTG),
INTENT(IN) :: USER_NUMBER
770 INTEGER(INTG),
INTENT(OUT) :: ERR
775 enters(
"REGION_USER_NUMBER_FIND_PTR",err,error,*999)
778 IF(
ASSOCIATED(start_region))
THEN 779 IF(start_region%USER_NUMBER==user_number)
THEN 783 DO WHILE(nr<=start_region%NUMBER_OF_SUB_REGIONS.AND..NOT.
ASSOCIATED(region))
785 IF(.NOT.
ASSOCIATED(region)) nr=nr+1
789 CALL flagerror(
"Start region is not associated",err,error,*999)
792 exits(
"REGION_USER_NUMBER_FIND_PTR")
794 999 errorsexits(
"REGION_USER_NUMBER_FIND_PTR",err,error)
806 INTEGER(INTG),
INTENT(OUT) :: ERR
810 enters(
"REGIONS_FINALISE",err,error,*999)
812 IF(
ASSOCIATED(
regions%WORLD_REGION))
THEN 814 DO WHILE(
regions%WORLD_REGION%NUMBER_OF_SUB_REGIONS>0)
822 exits(
"REGIONS_FINALISE")
824 999 errorsexits(
"REGIONS_FINALISE",err,error)
837 INTEGER(INTG),
INTENT(OUT) :: ERR
842 NULLIFY(world_coordinate_system)
844 enters(
"REGIONS_INITIALISE",err,error,*999)
846 IF(
ASSOCIATED(world_region))
THEN 847 CALL flagerror(
"World region is already associated.",err,error,*999)
850 IF(
ASSOCIATED(world_coordinate_system))
THEN 852 regions%WORLD_REGION%USER_NUMBER=0
853 regions%WORLD_REGION%LABEL=
"World Region" 854 regions%WORLD_REGION%COORDINATE_SYSTEM=>world_coordinate_system
855 regions%WORLD_REGION%REGION_FINISHED=.true.
857 world_region=>
regions%WORLD_REGION
859 CALL flagerror(
"World coordinate system has not been created.",err,error,*999)
863 exits(
"REGIONS_INITIALISE")
865 999 errorsexits(
"REGIONS_INITIALISE",err,error)
876 INTEGER(INTG),
INTENT(IN) :: USER_NUMBER
878 INTEGER(INTG),
INTENT(OUT) :: ERR
884 enters(
"REGION_USER_NUMBER_TO_REGION", err, error, *999 )
888 IF( .NOT.
ASSOCIATED( region ) )
THEN 889 local_error =
"A region with an user number of "//
trim(
number_to_vstring(user_number,
"*", err, error ) )//
" does not exist." 890 CALL flagerror( local_error, err, error, *999 )
893 exits(
"REGION_USER_NUMBER_TO_REGION" )
895 999 errorsexits(
"REGION_USER_NUMBER_TO_REGION", err, error )
subroutine, public enters(NAME, ERR, ERROR,)
Records the entry into the named procedure and initialises the error code.
This module contains all coordinate transformation and support routines.
subroutine, public region_user_number_to_region(USER_NUMBER, REGION, ERR, ERROR,)
Find the region with the given user number, or throw an error if it does not exist.
Contains information for a region.
Converts a number to its equivalent varying string representation.
This module contains all region routines.
A buffer type to allow for an array of pointers to a REGION_TYPE.
subroutine, public region_data_points_get(REGION, DATA_POINTS, ERR, ERROR,)
Returns a pointer to the data points for a region.
recursive subroutine region_destroy_number(USER_NUMBER, ERR, ERROR,)
Destroys a region given by USER_NUMBER and all sub-regions under it.
Contains information on the data points defined on a region.
This module contains all string manipulation and transformation routines.
subroutine, public region_coordinate_system_set(REGION, COORDINATE_SYSTEM, ERR, ERROR,)
Sets the coordinate system of region.
subroutine, public region_finalise(REGION, ERR, ERROR,)
Finalises a region and deallocates all memory.
subroutine, public coordinate_system_user_number_find(USER_NUMBER, COORDINATE_SYSTEM, ERR, ERROR,)
Returns a pointer to the coordinate system identified by USER_NUMBER. If a coordinate system with tha...
subroutine, public region_nodes_get(REGION, NODES, ERR, ERROR,)
Returns a pointer to the nodes for a region.
subroutine, public cellml_environments_finalise(CELLML_ENVIRONMENTS, ERR, ERROR,)
Finalises the CellML environments and deallocates all memory.
This module provides an iso_varying_string module, conformant to the API specified in ISO/IEC 1539-2:...
Contains information on a coordinate system.
Contains information about the regions.
subroutine, public exits(NAME)
Records the exit out of the named procedure.
subroutine, public region_initialise(REGION, ERR, ERROR,)
Initialises a region.
This module contains all type definitions in order to avoid cyclic module references.
This module contains all the low-level base routines e.g., all debug, control, and low-level communic...
type(regions_type) regions
subroutine, public region_destroy(REGION, ERR, ERROR,)
Destroys a region identified by a pointer and all sub-regions under it.
subroutine, public region_create_start(USER_NUMBER, PARENT_REGION, REGION, ERR, ERROR,)
Starts the creation a new region number USER_NUMBER as a sub region to the given PARENT_REGION, initialises all variables and inherits the PARENT_REGIONS coordinate system.
subroutine, public cellml_environments_initialise(REGION, ERR, ERROR,)
Initialises the CellML environments.
logical, save, public diagnostics1
.TRUE. if level 1 diagnostic output is active in the current routine
This module is a OpenCMISS(cm) buffer module to OpenCMISS(cellml).
subroutine, public regions_finalise(ERR, ERROR,)
Finalises the regions and destroys any current regions.
recursive subroutine region_user_number_find_ptr(USER_NUMBER, START_REGION, REGION, ERR, ERROR,)
Finds and returns in REGION a pointer to the region with the number given in USER_NUMBER starting fro...
integer(intg), parameter, public diagnostic_output_type
Diagnostic output type.
subroutine, public regions_initialise(WORLD_REGION, ERR, ERROR,)
Initialises the regions and creates the global world region.
Contains information on the nodes defined on a region.
subroutine, public region_user_number_find(USER_NUMBER, REGION, ERR, ERROR,)
Finds and returns in REGION a pointer to the region with the number given in USER_NUMBER. If no region with that number exits REGION is left nullified.
subroutine region_label_get_vs(REGION, LABEL, ERR, ERROR,)
Returns the label of a region.
subroutine, public region_create_finish(REGION, ERR, ERROR,)
Finishes the creation of a region.
subroutine region_label_get_c(REGION, LABEL, ERR, ERROR,)
Returns the label of a region.
subroutine, public equations_sets_finalise(REGION, ERR, ERROR,)
Finalises all equations sets on a region and deallocates all memory.
subroutine region_label_set_vs(REGION, LABEL, ERR, ERROR,)
Sets the label of a region.
This module handles all equations set routines.
subroutine region_label_set_c(REGION, LABEL, ERR, ERROR,)
Sets the label of a region.
Flags an error condition.
subroutine, public equations_sets_initialise(REGION, ERR, ERROR,)
Intialises all equations sets on a region.
subroutine, public region_coordinate_system_get(REGION, COORDINATE_SYSTEM, ERR, ERROR,)
Returns the coordinate system of region.
This module contains all kind definitions.