Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
FORCES
Manage
Activity
Members
Labels
Plan
Issues
14
Issue boards
Milestones
Code
Merge requests
4
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CHS
FORCES
Commits
9bec1f8c
Commit
9bec1f8c
authored
2 months ago
by
Maren Kaluza
Committed by
Sebastian Müller
2 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Set procedures in sim_data_t to private/public, +minor changes
parent
20fc5c1c
No related branches found
No related tags found
1 merge request
!81
Rework optimization routines
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mo_optimization_types.f90
+19
-16
19 additions, 16 deletions
src/mo_optimization_types.f90
with
19 additions
and
16 deletions
src/mo_optimization_types.f90
+
19
−
16
View file @
9bec1f8c
...
@@ -41,18 +41,21 @@ MODULE mo_optimization_types
...
@@ -41,18 +41,21 @@ MODULE mo_optimization_types
type
sim_data_t
type
sim_data_t
type
(
sim_var_t
),
dimension
(:),
allocatable
::
variables
type
(
sim_var_t
),
dimension
(:),
allocatable
::
variables
contains
contains
procedure
::
has
=>
sim_data_has
procedure
,
public
::
has
=>
sim_data_has
procedure
::
add
=>
sim_data_add
procedure
,
public
::
add
=>
sim_data_add
procedure
::
get_id
=>
sim_data_
get_id
procedure
,
public
::
allocate
=>
sim_data_
allocate
! ToDo only interface public, other private
! ToDo only interface public, other private
procedure
::
allocate
=>
sim_data_allocate
procedure
,
private
::
get_id
=>
sim_data_get_id
procedure
::
sim_data_set_pointer_1d
! One could create these similar procedures
procedure
::
sim_data_set_pointer_2d
! with fypp, for example if more dimensions are needed.
procedure
::
sim_data_set_pointer_3d
! Or you could read about 'assumed rank'.
procedure
::
sim_data_set_pointer_4d
procedure
,
private
::
sim_data_set_pointer_1d
procedure
::
sim_data_set_pointer_5d
procedure
,
private
::
sim_data_set_pointer_2d
procedure
,
private
::
sim_data_set_pointer_3d
procedure
,
private
::
sim_data_set_pointer_4d
procedure
,
private
::
sim_data_set_pointer_5d
! ToDo: destructor
! ToDo: destructor
generic
::
set_pointer
=>
sim_data_set_pointer_1d
,
sim_data_set_pointer_2d
,
&
generic
,
public
::
set_pointer
=>
sim_data_set_pointer_1d
,
sim_data_set_pointer_2d
,
&
sim_data_set_pointer_3d
,
sim_data_set_pointer_4d
,
sim_data_set_pointer_5d
sim_data_set_pointer_3d
,
sim_data_set_pointer_4d
,
sim_data_set_pointer_5d
end
type
sim_data_t
end
type
sim_data_t
...
@@ -117,17 +120,17 @@ MODULE mo_optimization_types
...
@@ -117,17 +120,17 @@ MODULE mo_optimization_types
end
do
end
do
end
function
sim_data_has
end
function
sim_data_has
subroutine
sim_data_add
(
this
,
name
,
dim
,
time_avg_selector
)
subroutine
sim_data_add
(
this
,
name
,
n
dim
,
time_avg_selector
)
class
(
sim_data_t
),
intent
(
inout
)
::
this
class
(
sim_data_t
),
intent
(
inout
)
::
this
character
(
*
),
intent
(
in
)
::
name
character
(
*
),
intent
(
in
)
::
name
integer
(
i4
),
intent
(
in
)
::
dim
integer
(
i4
),
intent
(
in
)
::
n
dim
integer
(
i4
),
optional
,
intent
(
in
)
::
time_avg_selector
integer
(
i4
),
optional
,
intent
(
in
)
::
time_avg_selector
type
(
sim_var_t
)
::
add_data
type
(
sim_var_t
)
::
add_data
! ToDo: Why name in type 256 and in input var *?
! ToDo: Why name in type 256 and in input var *?
add_data
%
name
=
trim
(
name
)
add_data
%
name
=
trim
(
name
)
add_data
%
ndim
=
dim
add_data
%
ndim
=
n
dim
if
(
present
(
time_avg_selector
))
add_data
%
time_avg_selector
=
time_avg_selector
if
(
present
(
time_avg_selector
))
add_data
%
time_avg_selector
=
time_avg_selector
! ToDo: is the if case needed?
! ToDo: is the if case needed?
! Tested: the else case works
! Tested: the else case works
...
@@ -140,6 +143,7 @@ MODULE mo_optimization_types
...
@@ -140,6 +143,7 @@ MODULE mo_optimization_types
end
subroutine
sim_data_add
end
subroutine
sim_data_add
! ToDo: rename ndim -> data_shape
subroutine
sim_data_allocate
(
this
,
name
,
ndim
)
subroutine
sim_data_allocate
(
this
,
name
,
ndim
)
class
(
sim_data_t
),
target
,
intent
(
inout
)
::
this
class
(
sim_data_t
),
target
,
intent
(
inout
)
::
this
character
(
*
),
intent
(
in
)
::
name
character
(
*
),
intent
(
in
)
::
name
...
@@ -174,7 +178,7 @@ MODULE mo_optimization_types
...
@@ -174,7 +178,7 @@ MODULE mo_optimization_types
integer
(
i4
)
::
i
integer
(
i4
)
::
i
sim_data_get_id
=
-
999
sim_data_get_id
=
-
1
do
i
=
1
,
size
(
this
%
variables
)
do
i
=
1
,
size
(
this
%
variables
)
if
(
this
%
variables
(
i
)
%
name
==
name
)
then
if
(
this
%
variables
(
i
)
%
name
==
name
)
then
sim_data_get_id
=
i
sim_data_get_id
=
i
...
@@ -182,11 +186,10 @@ MODULE mo_optimization_types
...
@@ -182,11 +186,10 @@ MODULE mo_optimization_types
end
if
end
if
end
do
end
do
if
(
sim_data_get_id
==
-
999
)
stop
(
'sim_data_get_id: The simulated variable name does not exist.'
)
if
(
sim_data_get_id
==
-
1
)
stop
(
'sim_data_get_id: The simulated variable name does not exist.'
)
end
function
sim_data_get_id
end
function
sim_data_get_id
! ToDo: generate with fypp
subroutine
sim_data_set_pointer_1d
(
this
,
name
,
ptr
)
subroutine
sim_data_set_pointer_1d
(
this
,
name
,
ptr
)
class
(
sim_data_t
),
target
,
intent
(
in
)
::
this
class
(
sim_data_t
),
target
,
intent
(
in
)
::
this
character
(
*
),
intent
(
in
)
::
name
character
(
*
),
intent
(
in
)
::
name
...
...
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