Skip to content
Snippets Groups Projects
Commit 93e8ea55 authored by Martin Beseda's avatar Martin Beseda
Browse files

ENH: Removed type-specific container classes.

parent 3abc8ed1
No related branches found
No related tags found
No related merge requests found
...@@ -87,39 +87,6 @@ module connection_m ...@@ -87,39 +87,6 @@ module connection_m
module procedure :: new_connection_3 module procedure :: new_connection_3
end interface connection_t end interface connection_t
!> Represents a container for a single connection_t pointer
type :: connection_container_t
private
class(connection_t), pointer :: content
contains
!> Getter for the private 'content' component
!! @return Pointer to the contained connection (type connection_t, pointer)
procedure :: get_content => get_content_connection_container_impl
!> Setter for the private 'content' component
!! @param[in] content Pointer to the connection (type connection_t, pointer)
procedure :: set_content => set_content_connection_container_impl
!> Scalar desctructor for single instances of the class connection_container_t
final :: destroy_connection_container
!> Array desctructor for arrays of instances of the class connection_container_t
final :: destroy_connection_container_array
end type connection_container_t
interface connection_container_t
!> Constructor of connection_container_t class
!! @return Instance of the class connection_container_t with nullified content
module procedure :: new_connection_container_empty
!> Constructor of connection_container_t class
!! @param[in] content_in connection to be contained (type connection_t, pointer)
!! @return Pointer to the instance of the class connection_t with assigned content
module procedure :: new_connection_container_assigned
end interface connection_container_t
!> Represents a connection between two neurons. !> Represents a connection between two neurons.
!! Able to pass a signal from an input neuron to !! Able to pass a signal from an input neuron to
!! an output one. !! an output one.
...@@ -373,112 +340,6 @@ module connection_m ...@@ -373,112 +340,6 @@ module connection_m
#endif #endif
end subroutine pass_signal_impl end subroutine pass_signal_impl
!------------------------------!
! class connection_container_t !
!------------------------------!
!--------------!------------------------------------------------------------------------
! Constructors !
!--------------!
!> Constructor of connection_container_t class
!! @return Instance of the class connection_container_t with nullified content
function new_connection_container_empty() result(new_obj)
type(connection_container_t) :: new_obj
#ifdef TIME_PROFILING
real :: start_time
call time_profiling_start(start_time)
#endif
new_obj%content => null()
#ifdef TIME_PROFILING
call time_profiling_stop(start_time, 'new_connection_container_empty')
#endif
end function new_connection_container_empty
!> Constructor of connection_container_t class
!! @param[in] content_in connection to be contained (type connection_t, pointer)
!! @return Pointer to the instance of the class connection_t with assigned content
function new_connection_container_assigned(content_in) result(new_obj)
class(connection_t), pointer, intent(in) :: content_in
type(connection_container_t) :: new_obj
#ifdef TIME_PROFILING
real :: start_time
call time_profiling_start(start_time)
#endif
new_obj%content => content_in
#ifdef TIME_PROFILING
call time_profiling_stop(start_time, 'new_connection_container_assigned')
#endif
end function new_connection_container_assigned
!--------------!------------------------------------------------------------------------
! Destructors !
!--------------!
!> Scalar desctructor for single instances of the class connection_container_t
subroutine destroy_connection_container(this)
type(connection_container_t), intent(inout) :: this
#ifdef TIME_PROFILING
real :: start_time
call time_profiling_start(start_time)
#endif
nullify(this%content)
#ifdef TIME_PROFILING
call time_profiling_stop(start_time, 'destroy_connection_container')
#endif
end subroutine destroy_connection_container
!> Array desctructor for arrays of instances of the class connection_container_t
subroutine destroy_connection_container_array(this)
type(connection_container_t), intent(inout) :: this(:)
integer :: i
#ifdef TIME_PROFILING
real :: start_time
call time_profiling_start(start_time)
#endif
do i = 1, size(this)
nullify(this(i)%content)
end do
#ifdef TIME_PROFILING
call time_profiling_stop(start_time, 'destroy_connection_container_array')
#endif
end subroutine destroy_connection_container_array
!-------------------!------------------------------------------------------------------
! Getters & Setters !
!-------------------!
!> Getter for the private 'content' component
!! @return Pointer to the contained connection (type connection_t, pointer)
function get_content_connection_container_impl(this) result(content)
class(connection_container_t), intent(in) :: this
class(connection_t), pointer:: content
#ifdef TIME_PROFILING
real :: start_time
call time_profiling_start(start_time)
#endif
content => this%content
#ifdef TIME_PROFILING
call time_profiling_stop(start_time,'get_content_connection_container_impl')
#endif
end function get_content_connection_container_impl
!> Setter for the private 'content' component
!! @param[in] content Pointer to the connection (type connection_t, pointer)
subroutine set_content_connection_container_impl(this, content)
class(connection_container_t), intent(inout) :: this
class(connection_t), pointer, intent(in) :: content
#ifdef TIME_PROFILING
real :: start_time
call time_profiling_start(start_time)
#endif
this%content => content
#ifdef TIME_PROFILING
call time_profiling_stop(start_time,'set_content_connection_container_impl')
#endif
end subroutine set_content_connection_container_impl
!----------------!--------------------------------------------------------------------- !----------------!---------------------------------------------------------------------
! Common methods ! ! Common methods !
!----------------! !----------------!
......
...@@ -10,6 +10,7 @@ module neuron_m ...@@ -10,6 +10,7 @@ module neuron_m
use time_measurement_m use time_measurement_m
use normal_m use normal_m
use data_kinds_4neuro_m use data_kinds_4neuro_m
use abstract_base_m
implicit none implicit none
...@@ -20,7 +21,7 @@ module neuron_m ...@@ -20,7 +21,7 @@ module neuron_m
!----------------! !----------------!
!> Abstract class representing a general neuron !> Abstract class representing a general neuron
type, abstract :: neuron_t type, abstract, extends(abstract_base_t) :: neuron_t
private private
real(kind=real_4neuro) :: potential !< Neuron inner potential real(kind=real_4neuro) :: potential !< Neuron inner potential
...@@ -338,9 +339,9 @@ module neuron_m ...@@ -338,9 +339,9 @@ module neuron_m
!> Constructor of mock_neuron_t class !> Constructor of mock_neuron_t class
!! @return Returns pointer to the instance of the class mock_neuron_t !! @return Returns pointer to the instance of the class mock_neuron_t
function new_mock_neuron() result(new_obj) function new_mock_neuron() result(new_obj)
type(mock_neuron_t), pointer :: new_obj class(mock_neuron_t), pointer :: new_obj
#ifdef TIME_PROFILING #ifdef TIME_PROFILING
real :: start_time real :: start_time
call time_profiling_start(start_time) call time_profiling_start(start_time)
#endif #endif
allocate(new_obj) allocate(new_obj)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment