Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
lib4neuro
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MolDyn
lib4neuro
Commits
a2796e64
Commit
a2796e64
authored
6 years ago
by
Martin Beseda
Browse files
Options
Downloads
Patches
Plain Diff
NEW: Added classes abstract_base_t and container_t.
parent
a0a42f2a
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/CMakeLists.txt
+13
-12
13 additions, 12 deletions
src/CMakeLists.txt
src/abstract_base_m.f90
+25
-0
25 additions, 0 deletions
src/abstract_base_m.f90
src/container_m.f90
+149
-0
149 additions, 0 deletions
src/container_m.f90
with
187 additions
and
12 deletions
src/CMakeLists.txt
+
13
−
12
View file @
a2796e64
project
(
Modules
)
project
(
Modules
)
enable_language
(
Fortran
)
enable_language
(
Fortran
)
set_property
(
GLOBAL PROPERTY LINKER_LANGUAGE Fortran
)
add_library
(
abstract_base_m SHARED abstract_base_m.f90
)
add_library
(
normal_m SHARED normal_m.f90
)
add_library
(
normal_m SHARED normal_m.f90
)
set_target_properties
(
normal_m PROPERTIES LINKER_LANGUAGE Fortran
)
add_library
(
data_kinds_4neuro_m SHARED data_kinds_4neuro_m.f90
)
add_library
(
data_kinds_4neuro_m SHARED data_kinds_4neuro_m.f90
)
set_target_properties
(
data_kinds_4neuro_m PROPERTIES LINKER_LANGUAGE Fortran
)
add_library
(
container_m SHARED container_m.f90
)
target_link_libraries
(
container_m abstract_base_m data_kinds_4neuro_m
)
add_library
(
time_measurement_m SHARED time_measurement_m.f90
)
add_library
(
time_measurement_m SHARED time_measurement_m.f90
)
set_target_properties
(
time_measurement_m PROPERTIES LINKER_LANGUAGE Fortran
)
target_link_libraries
(
time_measurement_m data_kinds_4neuro_m abstract_base_m
)
target_link_libraries
(
time_measurement_m data_kinds_4neuro_m
)
add_library
(
neuron_m SHARED neuron_m.f90
)
add_library
(
neuron_m SHARED neuron_m.f90
)
set_target_properties
(
neuron_m PROPERTIES LINKER_LANGUAGE Fortran
)
target_link_libraries
(
neuron_m time_measurement_m normal_m abstract_base_m
)
target_link_libraries
(
neuron_m time_measurement_m normal_m
)
add_library
(
connection_m SHARED connection_m.f90
)
add_library
(
connection_m SHARED connection_m.f90
)
set_target_properties
(
connection_m PROPERTIES LINKER_LANGUAGE Fortran
)
target_link_libraries
(
connection_m neuron_m time_measurement_m normal_m abstract_base_m
)
target_link_libraries
(
connection_m neuron_m time_measurement_m normal_m
)
add_library
(
interconnection_m SHARED net_m.f90
)
add_library
(
interconnection_m SHARED net_m.f90
)
set_target_properties
(
interconnection_m PROPERTIES LINKER_LANGUAGE Fortran
)
target_link_libraries
(
interconnection_m data_kinds_4neuro_m time_measurement_m abstract_base_m
)
target_link_libraries
(
interconnection_m data_kinds_4neuro_m time_measurement_m
)
add_library
(
net_m SHARED net_m.f90
)
add_library
(
net_m SHARED net_m.f90
)
set_target_properties
(
net_m PROPERTIES LINKER_LANGUAGE Fortran
)
target_link_libraries
(
net_m interconnection_m data_kinds_4neuro_m time_measurement_m neuron_m connection_m abstract_base_m
)
target_link_libraries
(
net_m interconnection_m data_kinds_4neuro_m time_measurement_m neuron_m connection_m
)
This diff is collapsed.
Click to expand it.
src/abstract_base_m.f90
0 → 100644
+
25
−
0
View file @
a2796e64
!> Module containing a class abstract_base_t, which is a parental
!! class for all other classes in 4neuro. It makes creating a
!! common container for all classes possible.
!!
!! @author Martin Beseda
!! @date 2018
module
abstract_base_m
implicit
none
public
!------------------!-----------------------------------------
! Type definitions !
!------------------!
!-----------------------!------------------------------------
! class abstract_base_t !
!-----------------------!
!> Abstract class covering all the other classes in 4neuro
type
,
abstract
::
abstract_base_t
end
type
end
module
abstract_base_m
This diff is collapsed.
Click to expand it.
src/container_m.f90
0 → 100644
+
149
−
0
View file @
a2796e64
!> Module containing declaration of a container type 'container_t'.
!! This class "wraps" pointers, so it's possible to store them
!! into arrays.
!!
!! @author Martin Beseda
!! @date 2018
module
container_m
use
abstract_base_m
use
data_kinds_4neuro_m
implicit
none
public
!> Represents a container for a single container_t pointer
type
::
container_t
private
class
(
abstract_base_t
),
pointer
::
content
contains
!> Getter for the private 'content' component
!! @return Pointer to the contained container (type container_t, pointer)
procedure
::
get_content
=>
get_content_container_impl
!> Setter for the private 'content' component
!! @param[in] content Pointer to the container (type container_t, pointer)
procedure
::
set_content
=>
set_content_container_impl
!> Scalar desctructor for single instances of the class container_t
final
::
destroy_container
!> Array desctructor for arrays of instances of the class container_t
final
::
destroy_container_array
end
type
container_t
interface
container_t
!> Constructor of container_t class
!! @return Instance of the class container_t with nullified content
module
procedure
::
new_container_empty
!> Constructor of container_t class
!! @param[in] content_in container to be contained (pointer)
!! @return Pointer to the instance of the class container_t with assigned content
module
procedure
::
new_container_assigned
end
interface
container_t
contains
!--------------!------------------------------------------------------------------------
! Constructors !
!--------------!
!> Constructor of container_t class
!! @return Instance of the class container_t with nullified content
function
new_container_empty
()
result
(
new_obj
)
type
(
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_container_empty'
)
#endif
end
function
new_container_empty
!> Constructor of container_t class
!! @param[in] content_in connection to be contained (pointer)
!! @return Pointer to the instance of the class connection_t with assigned content
function
new_container_assigned
(
content_in
)
result
(
new_obj
)
class
(
abstract_base_t
),
pointer
,
intent
(
in
)
::
content_in
type
(
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_container_assigned'
)
#endif
end
function
new_container_assigned
!--------------!------------------------------------------------------------------------
! Destructors !
!--------------!
!> Scalar desctructor for single instances of the class container_t
subroutine
destroy_container
(
this
)
type
(
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_container'
)
#endif
end
subroutine
destroy_container
!> Array desctructor for arrays of instances of the class container_t
subroutine
destroy_container_array
(
this
)
type
(
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_container_array'
)
#endif
end
subroutine
destroy_container_array
!-------------------!------------------------------------------------------------------
! Getters & Setters !
!-------------------!
!> Getter for the private 'content' component
!! @return Pointer to the contained connection (type connection_t, pointer)
function
get_content_container_impl
(
this
)
result
(
content
)
class
(
container_t
),
intent
(
in
)
::
this
class
(
abstract_base_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_container_impl'
)
#endif
end
function
get_content_container_impl
!> Setter for the private 'content' component
!! @param[in] content Pointer to the connection (type connection_t, pointer)
subroutine
set_content_container_impl
(
this
,
content
)
class
(
container_t
),
intent
(
inout
)
::
this
class
(
abstract_base_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_container_impl'
)
#endif
end
subroutine
set_content_container_impl
end
module
container_m
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment