Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HPC_Imaging
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Claudio Gheller
HPC_Imaging
Commits
cfb257da
Commit
cfb257da
authored
3 years ago
by
Nandhana Sakhtivel
Browse files
Options
Downloads
Patches
Plain Diff
Changing the list data structure to array data structure
parent
4bddc68e
No related branches found
No related tags found
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
allvars.c
+2
-1
2 additions, 1 deletion
allvars.c
allvars.h
+2
-5
2 additions, 5 deletions
allvars.h
gridding.c
+35
-52
35 additions, 52 deletions
gridding.c
init.c
+17
-0
17 additions, 0 deletions
init.c
proto.h
+1
-2
1 addition, 2 deletions
proto.h
with
57 additions
and
60 deletions
allvars.c
+
2
−
1
View file @
cfb257da
...
...
@@ -23,10 +23,11 @@ double resolution, dx, dw, w_supporth;
clock_t
start
,
end
,
start0
,
startk
,
endk
;
struct
timespec
begin
,
finish
,
begin0
,
begink
,
finishk
;
struct
sectorlist
**
sectorhead
;
long
*
histo_send
,
size_of_grid
;
double
*
grid
,
*
gridss
,
*
gridss_real
,
*
gridss_img
,
*
gridss_w
;
#ifdef USE_MPI
MPI_Win
slabwin
;
#endif
long
**
sectorarray
;
This diff is collapsed.
Click to expand it.
allvars.h
+
2
−
5
View file @
cfb257da
...
...
@@ -112,11 +112,6 @@ extern struct fileData
float
*
visimg
;
}
data
;
extern
struct
sectorlist
{
long
index
;
struct
sectorlist
*
next
;
}
**
sectorhead
;
extern
char
filename
[
1000
],
buf
[
30
],
num_buf
[
30
];
extern
char
datapath
[
900
];
...
...
@@ -135,3 +130,5 @@ extern double * grid, *gridss, *gridss_real, *gridss_img, *gridss_w;
#ifdef USE_MPI
extern
MPI_Win
slabwin
;
#endif
extern
long
**
sectorarray
;
This diff is collapsed.
Click to expand it.
gridding.c
+
35
−
52
View file @
cfb257da
...
...
@@ -2,12 +2,6 @@
#include
"allvars.h"
#include
"proto.h"
void
Push
(
struct
sectorlist
**
headRef
,
long
data
)
{
struct
sectorlist
*
newNode
=
malloc
(
sizeof
(
struct
sectorlist
));
newNode
->
index
=
data
;
newNode
->
next
=
*
headRef
;
*
headRef
=
newNode
;
}
void
gridding
(){
...
...
@@ -19,7 +13,7 @@ void gridding(){
start
=
clock
();
// Initialize linked list
initialize_
list
();
initialize_
array
();
//Sector and Gridding data
gridding_data
();
...
...
@@ -37,16 +31,7 @@ void gridding(){
}
void
initialize_list
(){
sectorhead
=
(
struct
sectorlist
**
)
malloc
((
nsectors
+
1
)
*
sizeof
(
struct
sectorlist
));
for
(
int
isec
=
0
;
isec
<=
nsectors
;
isec
++
)
{
sectorhead
[
isec
]
=
malloc
(
sizeof
(
struct
sectorlist
));
sectorhead
[
isec
]
->
index
=
-
1
;
sectorhead
[
isec
]
->
next
=
NULL
;
}
void
initialize_array
(){
histo_send
=
(
long
*
)
calloc
(
nsectors
+
1
,
sizeof
(
long
));
int
*
boundary
=
(
int
*
)
calloc
(
metaData
.
Nmeasures
,
sizeof
(
int
));
...
...
@@ -54,29 +39,45 @@ void initialize_list(){
for
(
long
iphi
=
0
;
iphi
<
metaData
.
Nmeasures
;
iphi
++
)
{
boundary
[
iphi
]
=
-
1
;
uuh
=
data
.
uu
[
iphi
];
vvh
=
data
.
vv
[
iphi
];
int
binphi
=
(
int
)(
vvh
*
nsectors
);
vvh
=
data
.
vv
[
iphi
];
//less or equal to 0.6
int
binphi
=
(
int
)(
vvh
*
nsectors
);
//has values expect 0 and nsectors-1. So we use updist and downdist condition
// check if the point influence also neighboring slabs
double
updist
=
(
double
)((
binphi
+
1
)
*
yaxis
)
*
dx
-
vvh
;
double
downdist
=
vvh
-
(
double
)(
binphi
*
yaxis
)
*
dx
;
//
histo_send
[
binphi
]
++
;
Push
(
&
sectorhead
[
binphi
],
iphi
);
if
(
updist
<
w_supporth
&&
updist
>=
0
.
0
)
{
histo_send
[
binphi
+
1
]
++
;
boundary
[
iphi
]
=
binphi
+
1
;
Push
(
&
sectorhead
[
binphi
+
1
],
iphi
);};
if
(
downdist
<
w_supporth
&&
binphi
>
0
&&
downdist
>=
0
.
0
)
{
histo_send
[
binphi
-
1
]
++
;
boundary
[
iphi
]
=
binphi
-
1
;
Push
(
&
sectorhead
[
binphi
-
1
],
iphi
);};
if
(
updist
<
w_supporth
&&
updist
>=
0
.
0
)
{
histo_send
[
binphi
+
1
]
++
;
boundary
[
iphi
]
=
binphi
+
1
;};
if
(
downdist
<
w_supporth
&&
binphi
>
0
&&
downdist
>=
0
.
0
)
{
histo_send
[
binphi
-
1
]
++
;
boundary
[
iphi
]
=
binphi
-
1
;};
}
sectorarray
=
(
long
**
)
malloc
((
nsectors
+
1
)
*
sizeof
(
long
*
));
for
(
int
sec
=
0
;
sec
<
(
nsectors
+
1
);
sec
++
)
{
sectorarray
[
sec
]
=
(
long
*
)
malloc
(
histo_send
[
sec
]
*
sizeof
(
long
));
}
long
*
counter
=
(
long
*
)
calloc
(
nsectors
+
1
,
sizeof
(
long
));
for
(
long
iphi
=
0
;
iphi
<
metaData
.
Nmeasures
;
iphi
++
)
{
vvh
=
data
.
vv
[
iphi
];
int
binphi
=
(
int
)(
vvh
*
nsectors
);
double
updist
=
(
double
)((
binphi
+
1
)
*
yaxis
)
*
dx
-
vvh
;
double
downdist
=
vvh
-
(
double
)(
binphi
*
yaxis
)
*
dx
;
sectorarray
[
binphi
][
counter
[
binphi
]]
=
iphi
;
counter
[
binphi
]
++
;
if
(
updist
<
w_supporth
&&
updist
>=
0
.
0
)
{
sectorarray
[
binphi
+
1
][
counter
[
binphi
+
1
]]
=
iphi
;
counter
[
binphi
+
1
]
++
;};
if
(
downdist
<
w_supporth
&&
binphi
>
0
&&
downdist
>=
0
.
0
)
{
sectorarray
[
binphi
-
1
][
counter
[
binphi
-
1
]]
=
iphi
;
counter
[
binphi
-
1
]
++
;};
}
#ifdef PIPPO
struct
sectorlist
*
current
;
long
iiii
=
0
;
for
(
int
j
=
0
;
j
<
nsectors
;
j
++
)
{
current
=
sectorhead
[
j
];
iiii
=
0
;
while
(
current
->
index
!=
-
1
)
for
(
long
iphi
=
histo_send
[
j
]
-
1
;
iphi
>=
0
;
iphi
--
)
{
printf
(
"%d %d %ld %ld %ld
\n
"
,
rank
,
j
,
iiii
,
histo_send
[
j
],
current
->
index
);
current
=
current
->
next
;
printf
(
"%d %d %ld %ld %ld
\n
"
,
rank
,
j
,
iiii
,
histo_send
[
j
],
sectorarray
[
j
][
iphi
]);
iiii
++
;
}
}
...
...
@@ -89,21 +90,6 @@ void initialize_list(){
void
gridding_data
(){
// Create sector grid
size_of_grid
=
2
*
param
.
num_w_planes
*
xaxis
*
yaxis
;
gridss
=
(
double
*
)
calloc
(
size_of_grid
,
sizeof
(
double
));
gridss_w
=
(
double
*
)
calloc
(
size_of_grid
,
sizeof
(
double
));
gridss_real
=
(
double
*
)
calloc
(
size_of_grid
/
2
,
sizeof
(
double
));
gridss_img
=
(
double
*
)
calloc
(
size_of_grid
/
2
,
sizeof
(
double
));
// Create destination slab
grid
=
(
double
*
)
calloc
(
size_of_grid
,
sizeof
(
double
));
// Create temporary global grid
#ifndef USE_MPI
double
*
gridtot
=
(
double
*
)
calloc
(
2
*
grid_size_x
*
grid_size_y
*
num_w_planes
,
sizeof
(
double
));
#endif
double
shift
=
(
double
)(
dx
*
yaxis
);
// Open the MPI Memory Window for the slab
...
...
@@ -152,12 +138,10 @@ void gridding_data(){
long
icount
=
0
;
long
ip
=
0
;
long
inu
=
0
;
struct
sectorlist
*
current
;
current
=
sectorhead
[
isector
];
while
(
current
->
index
!=
-
1
)
for
(
long
iphi
=
histo_send
[
isector
]
-
1
;
iphi
>=
0
;
iphi
--
)
{
long
ilocal
=
current
->
index
;
long
ilocal
=
sectorarray
[
isector
][
iphi
]
;
//double vvh = data.vv[ilocal];
//int binphi = (int)(vvh*nsectors);
//if (binphi == isector || boundary[ilocal] == isector) {
...
...
@@ -177,7 +161,6 @@ void gridding_data(){
inu
++
;
}
icount
++
;
current
=
current
->
next
;
}
clock_gettime
(
CLOCK_MONOTONIC
,
&
finishk
);
...
...
This diff is collapsed.
Click to expand it.
init.c
+
17
−
0
View file @
cfb257da
...
...
@@ -348,6 +348,23 @@ void allocate_memory() {
data
.
visreal
=
(
float
*
)
calloc
(
metaData
.
Nvis
,
sizeof
(
float
));
data
.
visimg
=
(
float
*
)
calloc
(
metaData
.
Nvis
,
sizeof
(
float
));
// Create sector grid
size_of_grid
=
2
*
param
.
num_w_planes
*
xaxis
*
yaxis
;
gridss
=
(
double
*
)
calloc
(
size_of_grid
,
sizeof
(
double
));
gridss_w
=
(
double
*
)
calloc
(
size_of_grid
,
sizeof
(
double
));
gridss_real
=
(
double
*
)
calloc
(
size_of_grid
/
2
,
sizeof
(
double
));
gridss_img
=
(
double
*
)
calloc
(
size_of_grid
/
2
,
sizeof
(
double
));
// Create destination slab
grid
=
(
double
*
)
calloc
(
size_of_grid
,
sizeof
(
double
));
// Create temporary global grid
#ifndef USE_MPI
double
*
gridtot
=
(
double
*
)
calloc
(
2
*
grid_size_x
*
grid_size_y
*
num_w_planes
,
sizeof
(
double
));
#endif
}
void
readData
()
{
...
...
This diff is collapsed.
Click to expand it.
proto.h
+
1
−
2
View file @
cfb257da
...
...
@@ -16,8 +16,7 @@ void readData();
/* gridding.c */
void
gridding
();
void
Push
(
struct
sectorlist
**
headRef
,
long
data
);
void
initialize_list
();
void
initialize_array
();
void
gridding_data
();
void
write_grided_data
();
...
...
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