Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
GPIAG-Software
IFOS2D
Commits
744ec46b
Commit
744ec46b
authored
Dec 02, 2015
by
Florian Wittkamp
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed order of NX and NY loops
parent
584deaa7
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
149 additions
and
215 deletions
+149
-215
contrib/aff/Makefile
contrib/aff/Makefile
+1
-1
contrib/fourier/Makefile
contrib/fourier/Makefile
+1
-1
contrib/stfinv/Makefile
contrib/stfinv/Makefile
+1
-1
par/in_and_out/toy_example/toy_example_INV_SH.json
par/in_and_out/toy_example/toy_example_INV_SH.json
+1
-1
par/run_toy_example_SH.sh
par/run_toy_example_SH.sh
+1
-1
src/calc_mat_change_test.c
src/calc_mat_change_test.c
+6
-6
src/denise.c
src/denise.c
+80
-145
src/eprecond.c
src/eprecond.c
+4
-4
src/eprecond1.c
src/eprecond1.c
+6
-6
src/joint_inversion.c
src/joint_inversion.c
+9
-9
src/matrix_operations.c
src/matrix_operations.c
+6
-7
src/max_grad.c
src/max_grad.c
+8
-8
src/writemod.c
src/writemod.c
+25
-25
No files found.
contrib/aff/Makefile
View file @
744ec46b
...
...
@@ -180,7 +180,7 @@ $(call CHECKVAR,INCINSTALLPATH)
$(INCINSTALLPATH)/%.h
:
%.h
@
mkdir
-vp
$(
dir
$@
)
-
@rm
-fv
$@
@
/bin/cp
-vp
d
$<
$@
@
/bin/cp
-vp
$<
$@
# install header files
.PHONY
:
install-include
...
...
contrib/fourier/Makefile
View file @
744ec46b
...
...
@@ -209,7 +209,7 @@ include $(patsubst %.cc,%.d,$(SRC))
$(INCINSTALLPATH)/%.h
:
%.h
@
mkdir
-vp
$(
dir
$@
)
-
@rm
-fv
$@
@
/bin/cp
-vp
d
$<
$@
@
/bin/cp
-vp
$<
$@
# install header files
.PHONY
:
install-include
...
...
contrib/stfinv/Makefile
View file @
744ec46b
...
...
@@ -183,7 +183,7 @@ libstfinv.a: $(patsubst %.cc,%.o,$(LIBCCSRC)) \
$(INCINSTALLPATH)/%.h
:
%.h
mkdir
-p
$(INCINSTALLPATH)
-
rm
-fv
$@
/bin/cp
-vp
d
$<
$@
/bin/cp
-vp
$<
$@
.PHONY
:
install-include
install-include
:
$(INSTHEADER)
...
...
par/in_and_out/toy_example/toy_example_INV_SH.json
View file @
744ec46b
...
...
@@ -112,7 +112,7 @@
"EPRECOND_ITER"
:
"0"
,
"Workflow"
:
"comment"
,
"USE_WORKFLOW"
:
"
1
"
,
"USE_WORKFLOW"
:
"
0
"
,
"FILE_WORKFLOW"
:
"workflow.txt"
,
"Inversion for density"
:
"comment"
,
...
...
par/run_toy_example_SH.sh
View file @
744ec46b
...
...
@@ -35,4 +35,4 @@ make denise MODEL=../genmod/toy_example_start.c
# starting DENISE
#lamboot
mpirun
-np
4 ../bin/denise in_and_out/toy_example/toy_example_INV.json |
tee
in_and_out/toy_example/toy_example_INV.out
mpirun
-np
4 ../bin/denise in_and_out/toy_example/toy_example_INV
_SH
.json |
tee
in_and_out/toy_example/toy_example_INV
_SH
.out
src/calc_mat_change_test.c
View file @
744ec46b
...
...
@@ -83,8 +83,8 @@ void calc_mat_change_test(float ** waveconv, float ** waveconv_rho, float *
pimax
=
0
.
0
;
gradmax
=
0
.
0
;
for
(
i
=
1
;
i
<=
N
X
;
i
++
){
for
(
j
=
1
;
j
<=
N
Y
;
j
++
){
for
(
j
=
1
;
j
<=
N
Y
;
j
++
){
for
(
i
=
1
;
i
<=
N
X
;
i
++
){
Zp
=
pi
[
j
][
i
];
...
...
@@ -105,8 +105,8 @@ void calc_mat_change_test(float ** waveconv, float ** waveconv_rho, float *
umax
=
0
.
0
;
gradmax_u
=
0
.
0
;
for
(
i
=
1
;
i
<=
N
X
;
i
++
){
for
(
j
=
1
;
j
<=
N
Y
;
j
++
){
for
(
j
=
1
;
j
<=
N
Y
;
j
++
){
for
(
i
=
1
;
i
<=
N
X
;
i
++
){
Zs
=
u
[
j
][
i
];
...
...
@@ -127,8 +127,8 @@ void calc_mat_change_test(float ** waveconv, float ** waveconv_rho, float *
rhomax
=
0
.
0
;
gradmax_rho
=
0
.
0
;
for
(
i
=
1
;
i
<=
N
X
;
i
++
){
for
(
j
=
1
;
j
<=
N
Y
;
j
++
){
for
(
j
=
1
;
j
<=
N
Y
;
j
++
){
for
(
i
=
1
;
i
<=
N
X
;
i
++
){
if
(
rho
[
j
][
i
]
>
rhomax
){
rhomax
=
rho
[
j
][
i
];}
...
...
src/denise.c
View file @
744ec46b
This diff is collapsed.
Click to expand it.
src/eprecond.c
View file @
744ec46b
...
...
@@ -6,8 +6,8 @@ void eprecond(float ** W, float ** vx, float ** vy){
extern
int
NX
,
NY
,
IDX
,
IDY
;
int
i
,
j
;
for
(
i
=
1
;
i
<=
N
X
;
i
=
i
+
ID
X
){
for
(
j
=
1
;
j
<=
N
Y
;
j
=
j
+
ID
Y
){
for
(
j
=
1
;
j
<=
N
Y
;
j
=
j
+
ID
Y
){
for
(
i
=
1
;
i
<=
N
X
;
i
=
i
+
ID
X
){
W
[
j
][
i
]
+=
((
vx
[
j
][
i
]
*
vx
[
j
][
i
])
+
(
vy
[
j
][
i
]
*
vy
[
j
][
i
]));
...
...
@@ -21,8 +21,8 @@ void eprecond_SH(float ** W, float ** vz){
extern
int
NX
,
NY
,
IDX
,
IDY
;
int
i
,
j
;
for
(
i
=
1
;
i
<=
N
X
;
i
=
i
+
ID
X
){
for
(
j
=
1
;
j
<=
N
Y
;
j
=
j
+
ID
Y
){
for
(
j
=
1
;
j
<=
N
Y
;
j
=
j
+
ID
Y
){
for
(
i
=
1
;
i
<=
N
X
;
i
=
i
+
ID
X
){
W
[
j
][
i
]
+=
((
vz
[
j
][
i
]
*
vz
[
j
][
i
]));
...
...
src/eprecond1.c
View file @
744ec46b
...
...
@@ -17,8 +17,8 @@ void eprecond1(float ** We, float ** Ws, float ** Wr){
if
(
EPRECOND
==
1
){
/* calculate energy weighting */
for
(
i
=
1
;
i
<=
N
X
;
i
=
i
+
ID
X
){
for
(
j
=
1
;
j
<=
N
Y
;
j
=
j
+
ID
Y
){
for
(
j
=
1
;
j
<=
N
Y
;
j
=
j
+
ID
Y
){
for
(
i
=
1
;
i
<=
N
X
;
i
=
i
+
ID
X
){
We
[
j
][
i
]
=
sqrt
(
Ws
[
j
][
i
]
*
Wr
[
j
][
i
]);
/* energy weighted source and receiver contribution */
...
...
@@ -33,8 +33,8 @@ void eprecond1(float ** We, float ** Ws, float ** Wr){
if
(
EPRECOND
==
3
){
/* Forward wavefield + approximation of the receiver Greens function (Plessix and Mulder, 2004) */
for
(
i
=
1
;
i
<=
N
X
;
i
=
i
+
ID
X
){
for
(
j
=
1
;
j
<=
N
Y
;
j
=
j
+
ID
Y
){
for
(
j
=
1
;
j
<=
N
Y
;
j
=
j
+
ID
Y
){
for
(
i
=
1
;
i
<=
N
X
;
i
=
i
+
ID
X
){
/* calculate global coordinates */
ii
=
i
+
POS
[
1
]
*
NX
;
...
...
@@ -57,8 +57,8 @@ void eprecond1(float ** We, float ** Ws, float ** Wr){
/* estimate maximum of We */
MPI_Allreduce
(
&
maxWetmp
,
&
maxWe
,
1
,
MPI_FLOAT
,
MPI_MAX
,
MPI_COMM_WORLD
);
/* regularize energy weighting to avoid divison by zero */
for
(
i
=
1
;
i
<=
N
X
;
i
=
i
+
ID
X
){
for
(
j
=
1
;
j
<=
N
Y
;
j
=
j
+
ID
Y
){
for
(
j
=
1
;
j
<=
N
Y
;
j
=
j
+
ID
Y
){
for
(
i
=
1
;
i
<=
N
X
;
i
=
i
+
ID
X
){
We
[
j
][
i
]
=
We
[
j
][
i
]
+
(
EPSILON_WE
*
maxWe
);
...
...
src/joint_inversion.c
View file @
744ec46b
...
...
@@ -48,19 +48,19 @@ float ** joint_inversion_grad ( float ** gradiant_1,float ** gradiant_2, float a
extern
int
NPROCX
,
NPROCY
,
MYID
;
extern
FILE
*
FP
;
switch
(
joint_type
)
{
case
1
:
/* joint_type=1: Normalize both and take the arithmetic mean */
max1
=
global_maximum
(
gradiant_1
);
max2
=
global_maximum
(
gradiant_2
);
for
(
i
=
1
;
i
<=
NX
;
i
++
){
/* joint_type=1: Normalize both and take the arithmetic mean */
max1
=
global_maximum
(
gradiant_1
);
max2
=
global_maximum
(
gradiant_2
);
for
(
j
=
1
;
j
<=
NY
;
j
++
){
gradiant_1
[
j
][
i
]
=
((
1
-
alpha
)
*
gradiant_1
[
j
][
i
]
/
max1
+
alpha
*
gradiant_2
[
j
][
i
]
/
max2
);
for
(
i
=
1
;
i
<=
NX
;
i
++
){
gradiant_1
[
j
][
i
]
=
((
1
-
alpha
)
*
gradiant_1
[
j
][
i
]
/
max1
+
alpha
*
gradiant_2
[
j
][
i
]
/
max2
);
}
}
}
joint_gradiant
=
gradiant_1
;
break
;
joint_gradiant
=
gradiant_1
;
break
;
}
return
joint_gradiant
;
};
...
...
src/matrix_operations.c
View file @
744ec46b
...
...
@@ -55,9 +55,8 @@ float global_maximum(float ** gradiant_1) {
int
i
,
j
;
float
max
=
0
.
0
,
max1
=
0
.
0
;
extern
int
NX
,
NY
;
for
(
i
=
1
;
i
<=
NX
;
i
++
){
for
(
j
=
1
;
j
<=
NY
;
j
++
){
for
(
j
=
1
;
j
<=
NY
;
j
++
){
for
(
i
=
1
;
i
<=
NX
;
i
++
){
if
((
i
*
j
==
1
)
||
(
max
==
0
.
0
))
{
max
=
fabs
(
gradiant_1
[
j
][
i
]);
}
else
{
...
...
@@ -84,8 +83,8 @@ float average_matrix(float ** matrix){
float
buf1
=
0
,
buf2
=
0
;
float
average
;
for
(
i
=
1
;
i
<=
N
X
;
i
=
i
+
ID
X
){
for
(
j
=
1
;
j
<=
N
Y
;
j
=
j
+
ID
Y
){
for
(
j
=
1
;
j
<=
N
Y
;
j
=
j
+
ID
Y
){
for
(
i
=
1
;
i
<=
N
X
;
i
=
i
+
ID
X
){
local_sum
+=
matrix
[
j
][
i
];
}
}
...
...
@@ -111,8 +110,8 @@ float matrix_product(float ** matrix1, float **matrix2) {
float
buf1
=
0
,
buf2
=
0
;
int
i
,
j
;
for
(
i
=
1
;
i
<=
N
X
;
i
=
i
+
ID
X
){
for
(
j
=
1
;
j
<=
N
Y
;
j
=
j
+
ID
Y
){
for
(
j
=
1
;
j
<=
N
Y
;
j
=
j
+
ID
Y
){
for
(
i
=
1
;
i
<=
N
X
;
i
=
i
+
ID
X
){
local_sum
+=
(
matrix1
[
j
][
i
]
*
matrix2
[
j
][
i
]);
}
}
...
...
src/max_grad.c
View file @
744ec46b
...
...
@@ -51,9 +51,9 @@ void max_grad(float ** waveconv, float ** waveconv_rho, float ** waveconv_
/* find maximum of Zp and gradient waveconv */
pimax
=
0
.
0
;
gradmax
=
0
.
0
;
for
(
j
=
1
;
j
<=
NY
;
j
++
){
for
(
i
=
1
;
i
<=
NX
;
i
++
){
for
(
j
=
1
;
j
<=
NY
;
j
++
){
Zp
=
sqrt
((
pi
[
j
][
i
]
+
2
.
0
*
u
[
j
][
i
])
*
rho
[
j
][
i
]);
...
...
@@ -75,8 +75,8 @@ void max_grad(float ** waveconv, float ** waveconv_rho, float ** waveconv_
umax
=
0
.
0
;
gradmax_u
=
0
.
0
;
for
(
i
=
1
;
i
<=
N
X
;
i
++
){
for
(
j
=
1
;
j
<=
N
Y
;
j
++
){
for
(
j
=
1
;
j
<=
N
Y
;
j
++
){
for
(
i
=
1
;
i
<=
N
X
;
i
++
){
Zs
=
sqrt
(
u
[
j
][
i
]
*
rho
[
j
][
i
]);
...
...
@@ -101,8 +101,8 @@ void max_grad(float ** waveconv, float ** waveconv_rho, float ** waveconv_
rhomax
=
0
.
0
;
gradmax_rho
=
0
.
0
;
for
(
i
=
1
;
i
<=
N
X
;
i
++
){
for
(
j
=
1
;
j
<=
N
Y
;
j
++
){
for
(
j
=
1
;
j
<=
N
Y
;
j
++
){
for
(
i
=
1
;
i
<=
N
X
;
i
++
){
if
(
rho
[
j
][
i
]
>
rhomax
){
rhomax
=
rho
[
j
][
i
];}
...
...
@@ -165,8 +165,8 @@ void max_grad(float ** waveconv, float ** waveconv_rho, float ** waveconv_
/* apply scaling factors */
/* --------------------- */
for
(
i
=
1
;
i
<=
N
X
;
i
++
){
for
(
j
=
1
;
j
<=
N
Y
;
j
++
){
for
(
j
=
1
;
j
<=
N
Y
;
j
++
){
for
(
i
=
1
;
i
<=
N
X
;
i
++
){
waveconv
[
j
][
i
]
=
EPSILON
*
waveconv
[
j
][
i
];
waveconv_u
[
j
][
i
]
=
EPSILON_u
*
waveconv_u
[
j
][
i
];
...
...
src/writemod.c
View file @
744ec46b
...
...
@@ -2,22 +2,22 @@
* Copyright (C) 2013 For the list of authors, see file AUTHORS.
*
* This file is part of DENISE.
*
*
* DENISE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2.0 of the License only.
*
*
* DENISE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with DENISE. See file COPYING and/or <http://www.gnu.org/licenses/gpl-2.0.html>.
-----------------------------------------------------------------------------------------*/
-----------------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------
* write local model to file
* write local model to file
* last update 16/02/02 T. Bohlen
*
* ----------------------------------------------------------------------*/
...
...
@@ -26,28 +26,28 @@
void
writemod
(
char
modfile
[
STRING_SIZE
],
float
**
array
,
int
format
){
/* extern variables */
extern
int
MYID
,
NX
,
NY
,
POS
[
3
],
IDX
,
IDY
,
VERBOSE
;
extern
FILE
*
FP
;
/* extern variables */
extern
int
MYID
,
NX
,
NY
,
POS
[
3
],
IDX
,
IDY
,
VERBOSE
;
extern
FILE
*
FP
;
extern
int
VERBOSE
;
int
i
,
j
;
FILE
*
fpmod
;
char
file
[
STRING_SIZE
];
if
(
VERBOSE
)
fprintf
(
FP
,
"
\n\n
PE %d is writing model to
\n
"
,
MYID
);
sprintf
(
file
,
"%s.%i.%i"
,
modfile
,
POS
[
1
],
POS
[
2
]);
if
(
VERBOSE
)
fprintf
(
FP
,
"
\t
%s
\n\n
"
,
file
);
fpmod
=
fopen
(
file
,
"w"
);
for
(
i
=
1
;
i
<=
NX
;
i
+=
IDX
)
for
(
j
=
1
;
j
<=
NY
;
j
+=
IDY
)
writedsk
(
fpmod
,
array
[
j
][
i
],
format
);
int
i
,
j
;
FILE
*
fpmod
;
char
file
[
STRING_SIZE
];
if
(
VERBOSE
)
fprintf
(
FP
,
"
\n\n
PE %d is writing model to
\n
"
,
MYID
);
sprintf
(
file
,
"%s.%i.%i"
,
modfile
,
POS
[
1
],
POS
[
2
]);
if
(
VERBOSE
)
fprintf
(
FP
,
"
\t
%s
\n\n
"
,
file
);
fpmod
=
fopen
(
file
,
"w"
);
for
(
i
=
1
;
i
<=
NX
;
i
+=
IDX
)
for
(
j
=
1
;
j
<=
NY
;
j
+=
IDY
)
writedsk
(
fpmod
,
array
[
j
][
i
],
format
);
fclose
(
fpmod
);
fclose
(
fpmod
);
}
Florian Wittkamp
@wittkamp_old
mentioned in issue
#10 (closed)
·
Dec 02, 2015
mentioned in issue
#10 (closed)
mentioned in issue #10
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment