Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DOUAR WSMP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
HUGG
DOUAR WSMP
Commits
097a6c7c
Commit
097a6c7c
authored
15 years ago
by
Douglas Guptill
Browse files
Options
Downloads
Patches
Plain Diff
shrink pointer array
parent
6b0cc694
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
shrink_dp_pointer_array.f90
+51
-0
51 additions, 0 deletions
shrink_dp_pointer_array.f90
with
51 additions
and
0 deletions
shrink_dp_pointer_array.f90
0 → 100644
+
51
−
0
View file @
097a6c7c
subroutine
shrink_dp_pointer_array
(
threadinfo
,
x
,
new_size
)
! resize the input array.
! Author: Douglas Guptill
! Copyright (c) 2009 Douglas Guptill. All rights reserved.
! 2009-07-14: new
use
threads
use
definitions
implicit
none
! parameters, in
integer
new_size
type
(
thread
)
threadinfo
! parameters, in/out
double precision
,
dimension
(:),
pointer
::
x
! local variables
integer
i
double precision
,
dimension
(:),
pointer
::
t
! make a temporary array
allocate
(
t
(
new_size
),
stat
=
threadinfo
%
err
)
call
heap
(
threadinfo
,
't'
,
'shrink_dp_pointer_array...'
,
size
(
t
),
'dp'
,
+1
)
! transfer the input data to it
do
i
=
1
,
new_size
t
(
i
)
=
x
(
i
)
enddo
! delete the input array
call
heap
(
threadinfo
,
'x'
,
'shrink_dp_pointer_array...'
,
size
(
x
),
'dp'
,
-1
)
deallocate
(
x
)
! re-create the input array, with a new size
allocate
(
x
(
new_size
),
stat
=
threadinfo
%
err
)
call
heap
(
threadinfo
,
'x'
,
'shrink_dp_pointer_array...'
,
size
(
x
),
'dp'
,
+1
)
! transfer the data from the temporary array to the new input aray
do
i
=
1
,
new_size
x
(
i
)
=
t
(
i
)
enddo
! delete the temporary array
call
heap
(
threadinfo
,
't'
,
'shrink_dp_pointer_array...'
,
size
(
t
),
'dp'
,
-1
)
deallocate
(
t
)
return
end
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