Commit 12d3de95 authored by Jorn Bruggeman's avatar Jorn Bruggeman
Browse files

fixed indentation of fabm_graph

parent 7896cd6c
......@@ -130,7 +130,7 @@ module fabm_graph
contains
function output_variable_set_add(self, variable) result(output_variable)
function output_variable_set_add(self, variable) result(output_variable)
class (type_output_variable_set), intent(inout) :: self
type (type_internal_variable),target :: variable
......@@ -151,9 +151,9 @@ function output_variable_set_add(self, variable) result(output_variable)
allocate(output_variable)
output_variable%target => variable
call self%add_output_variable(output_variable)
end function output_variable_set_add
end function output_variable_set_add
subroutine output_variable_set_add_output_variable(self, output_variable)
subroutine output_variable_set_add_output_variable(self, output_variable)
class (type_output_variable_set), intent(inout) :: self
type (type_output_variable), target :: output_variable
......@@ -163,9 +163,9 @@ subroutine output_variable_set_add_output_variable(self, output_variable)
node%p => output_variable
node%next => self%first
self%first => node
end subroutine output_variable_set_add_output_variable
end subroutine output_variable_set_add_output_variable
function input_variable_set_add(self, variable) result(input_variable)
function input_variable_set_add(self, variable) result(input_variable)
class (type_input_variable_set), intent(inout) :: self
type (type_internal_variable), target :: variable
......@@ -189,9 +189,9 @@ function input_variable_set_add(self, variable) result(input_variable)
node%p => input_variable
node%next => self%first
self%first => node
end function input_variable_set_add
end function input_variable_set_add
subroutine output_variable_set_finalize(self, owner)
subroutine output_variable_set_finalize(self, owner)
class (type_output_variable_set), intent(inout) :: self
logical, intent(in) :: owner
......@@ -208,9 +208,9 @@ subroutine output_variable_set_finalize(self, owner)
node => next
end do
self%first => null()
end subroutine output_variable_set_finalize
end subroutine output_variable_set_finalize
subroutine input_variable_set_finalize(self)
subroutine input_variable_set_finalize(self)
class (type_input_variable_set), intent(inout) :: self
type (type_input_variable_set_node), pointer :: node, next
......@@ -224,9 +224,9 @@ subroutine input_variable_set_finalize(self)
node => next
end do
self%first => null()
end subroutine input_variable_set_finalize
end subroutine input_variable_set_finalize
subroutine graph_print(self)
subroutine graph_print(self)
class (type_graph), intent(in) :: self
type (type_node_list_member),pointer :: node
......@@ -252,9 +252,9 @@ subroutine graph_print(self)
node => node%next
end do
end subroutine graph_print
end subroutine graph_print
recursive subroutine find_node(self, model, source, graph, node)
recursive subroutine find_node(self, model, source, graph, node)
class (type_graph), intent(inout), target :: self
class (type_base_model), intent(in), target :: model
integer, intent(in) :: source
......@@ -275,9 +275,9 @@ recursive subroutine find_node(self, model, source, graph, node)
end do
graph => null()
end subroutine
end subroutine
recursive function graph_has_descendant(self, graph) result(has_descendant)
recursive function graph_has_descendant(self, graph) result(has_descendant)
class (type_graph), pointer :: self
class (type_graph), pointer :: graph
logical :: has_descendant
......@@ -292,9 +292,9 @@ recursive function graph_has_descendant(self, graph) result(has_descendant)
member => member%next
end do
has_descendant = .false.
end function
end function
recursive function graph_add_call(self, model, source, stack_top) result(node)
recursive function graph_add_call(self, model, source, stack_top) result(node)
class (type_graph), target, intent(inout) :: self
class (type_base_model), target, intent(in) :: model
integer, intent(in) :: source
......@@ -309,8 +309,8 @@ recursive function graph_add_call(self, model, source, stack_top) result(node)
type (type_input_variable), pointer :: input_variable
! Circular dependency check:
! Search the list of outer model calls, i.e., calls that [indirectly] request the current call.
! If the current call is already on this list, it is indirectly calling itself: there is a circular dependency.
! Search the stack, i.e., the list of calls that [indirectly] request the current call.
! If the current call is already on the stack, it is indirectly calling itself: there is a circular dependency.
existing_stack_node => stack_top
do while (associated(existing_stack_node))
if (associated(existing_stack_node%model, model) .and. existing_stack_node%source == source) exit
......@@ -369,8 +369,7 @@ recursive function graph_add_call(self, model, source, stack_top) result(node)
if (target_graph%frozen) call driver%fatal_error('graph_add_call','Target graph is frozen; no calls can be added.')
! First add this call to the list of requesting calls [a list of all calls higher on the call stack]
! This forbids any indirect dependency on this call, as such would be a circular dependency.
! Push this call onto the stack [the list of requesting calls]. This will be used for circular dependency checking.
allocate(stack_node)
stack_node%model => model
stack_node%source = source
......@@ -392,9 +391,9 @@ recursive function graph_add_call(self, model, source, stack_top) result(node)
! Remove node from the list of outer calls and add it to the graph instead.
deallocate(stack_node)
call target_graph%append(node)
end function graph_add_call
end function graph_add_call
recursive subroutine graph_add_variable(self, variable, stack_top, variable_set, copy_to_store, caller)
recursive subroutine graph_add_variable(self, variable, stack_top, variable_set, copy_to_store, caller)
class (type_graph), intent(inout) :: self
type (type_internal_variable), intent(in) :: variable
type (type_call_stack_node), pointer :: stack_top
......@@ -416,7 +415,7 @@ recursive subroutine graph_add_variable(self, variable, stack_top, variable_set,
call add_call(variable)
end if
contains
contains
recursive subroutine add_call(variable)
type (type_internal_variable), intent(in) :: variable
......@@ -437,9 +436,9 @@ contains
call variable_set%add_output_variable(output_variable)
end subroutine add_call
end subroutine graph_add_variable
end subroutine graph_add_variable
function source2operation(source) result(operation)
function source2operation(source) result(operation)
integer,intent(in) :: source
integer :: operation
select case (source)
......@@ -454,9 +453,9 @@ function source2operation(source) result(operation)
case default
call driver%fatal_error('source2operation', 'unknown source value')
end select
end function source2operation
end function source2operation
subroutine graph_connect(self, next)
subroutine graph_connect(self, next)
class (type_graph), intent(inout), target :: self
class (type_graph), intent(inout), target :: next
......@@ -470,9 +469,9 @@ subroutine graph_connect(self, next)
member%p => self
member%next => next%previous%first
next%previous%first => member
end subroutine graph_connect
end subroutine graph_connect
subroutine node_set_add(self, node)
subroutine node_set_add(self, node)
class (type_node_set), intent(inout) :: self
type (type_node), target :: node
......@@ -490,9 +489,9 @@ subroutine node_set_add(self, node)
member%p => node
member%next => self%first
self%first => member
end subroutine node_set_add
end subroutine node_set_add
function node_set_contains(self, node) result(found)
function node_set_contains(self, node) result(found)
class (type_node_set), intent(in) :: self
type (type_node), target :: node
logical :: found
......@@ -507,9 +506,9 @@ function node_set_contains(self, node) result(found)
member => member%next
end do
found = .false.
end function node_set_contains
end function node_set_contains
subroutine node_set_finalize(self)
subroutine node_set_finalize(self)
class (type_node_set), intent(inout) :: self
type (type_node_set_member), pointer :: current, next
......@@ -521,9 +520,9 @@ subroutine node_set_finalize(self)
current => next
end do
self%first => null()
end subroutine node_set_finalize
end subroutine node_set_finalize
subroutine node_list_append(self, node)
subroutine node_list_append(self, node)
class (type_node_list), intent(inout) :: self
type (type_node),target :: node
......@@ -539,9 +538,9 @@ subroutine node_list_append(self, node)
end if
self%last => member
!call self%check()
end subroutine node_list_append
end subroutine node_list_append
subroutine node_list_check(self)
subroutine node_list_check(self)
class (type_node_list), intent(in) :: self
type (type_node_list_member), pointer :: current, previous
......@@ -560,9 +559,9 @@ subroutine node_list_check(self)
previous => current
current => current%next
end do
end subroutine node_list_check
end subroutine node_list_check
subroutine node_list_remove(self, node)
subroutine node_list_remove(self, node)
class (type_node_list), intent(inout) :: self
type (type_node), target :: node
......@@ -584,9 +583,9 @@ subroutine node_list_remove(self, node)
self%first => pnode%next
end if
deallocate(pnode)
end subroutine node_list_remove
end subroutine node_list_remove
subroutine node_list_finalize(self)
subroutine node_list_finalize(self)
class (type_node_list), intent(inout) :: self
type (type_node_list_member), pointer :: current, next
......@@ -599,9 +598,9 @@ subroutine node_list_finalize(self)
end do
self%first => null()
self%last => null()
end subroutine node_list_finalize
end subroutine node_list_finalize
function node_list_find_node(self, model, source) result(pnode)
function node_list_find_node(self, model, source) result(pnode)
class (type_node_list), intent(in) :: self
class (type_base_model),target,intent(in) :: model
integer, intent(in) :: source
......@@ -612,9 +611,9 @@ function node_list_find_node(self, model, source) result(pnode)
if (associated(pnode%p%model, model) .and. pnode%p%source == source) return
pnode => pnode%next
end do
end function node_list_find_node
end function node_list_find_node
function node_list_find(self, model, source) result(node)
function node_list_find(self, model, source) result(node)
class (type_node_list), intent(in) :: self
class (type_base_model),target,intent(in) :: model
integer, intent(in) :: source
......@@ -624,9 +623,9 @@ function node_list_find(self, model, source) result(node)
node => null()
pnode => node_list_find_node(self, model, source)
if (associated(pnode)) node => pnode%p
end function node_list_find
end function node_list_find
subroutine graph_finalize(self)
subroutine graph_finalize(self)
class (type_graph),intent(inout) :: self
type (type_node_list_member), pointer :: current
......@@ -640,9 +639,9 @@ subroutine graph_finalize(self)
current => current%next
end do
call self%type_node_list%finalize()
end subroutine graph_finalize
end subroutine graph_finalize
subroutine graph_save_as_dot(self, unit, subgraph)
subroutine graph_save_as_dot(self, unit, subgraph)
class (type_graph),intent(in) :: self
integer, intent(in) :: unit
character(len=*), optional, intent(in) :: subgraph
......@@ -676,9 +675,9 @@ subroutine graph_save_as_dot(self, unit, subgraph)
end if
node => node%next
end do
end subroutine graph_save_as_dot
end subroutine graph_save_as_dot
function node_as_dot(node) result(string)
function node_as_dot(node) result(string)
class (type_node), intent(in) :: node
character(len=attribute_length) :: string
......@@ -695,14 +694,14 @@ function node_as_dot(node) result(string)
end select
path = node%model%get_path()
string = '"' // trim(node%as_string()) // '" [label="'//trim(path(2:))//'",fillcolor=' // trim(color) // ']'
end function node_as_dot
end function node_as_dot
function node_as_string(node) result(string)
function node_as_string(node) result(string)
class (type_node), intent(in) :: node
character(len=attribute_length) :: string
string = trim(node%model%get_path()) // ':' // trim(source2string(node%source))
end function node_as_string
end function node_as_string
end module fabm_graph
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment