Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GPIAG-Software
IFOS2D
Commits
6c502b25
Commit
6c502b25
authored
Dec 02, 2015
by
Florian Wittkamp
Browse files
Workflow now includes a header
Workflow file now includes a header.
parent
b48e692b
Changes
5
Hide whitespace changes
Inline
Side-by-side
par/workflow.txt
View file @
6c502b25
# VS VP RHO PRO FIL FC WT J J EPRE EPSI
1 1 0 0 0.01 0 0 2 0 0 0 0.005
2 1 0 0 0.01 0 0 2 0 0 0 0.005
3 1 0 0 0.01 0 0 2 0 0 0 0.005
...
...
src/apply_workflow.c
View file @
6c502b25
...
...
@@ -24,7 +24,7 @@
#include
"fd.h"
void
apply_workflow
(
float
**
workflow
,
int
workflow_lines
,
int
workflow_line_current
,
int
*
iter
,
float
*
FC
,
int
wavetype_start
,
int
*
change_wavetype_iter
,
int
*
LBFGS_iter_start
){
void
apply_workflow
(
float
**
workflow
,
int
workflow_lines
,
char
workflow_header
[
STRING_SIZE
],
int
workflow_line_current
,
int
*
iter
,
float
*
FC
,
int
wavetype_start
,
int
*
change_wavetype_iter
,
int
*
LBFGS_iter_start
){
/* local variables */
int
x
;
...
...
@@ -47,7 +47,7 @@ void apply_workflow(float ** workflow,int workflow_lines,int workflow_line_curre
/* Print current workflow */
if
(
MYID
==
0
){
printf
(
"
\n
---------- Applying Workflow -----------
\n
"
);
printf
(
"
ITER
\t
INV_VS
\t
INV_VP
\t
INV_RHO
\t
PRO
\t
TI_FILT
\t
FC
\t
WT
\n
"
);
printf
(
"
%s "
,
workflow_header
);
for
(
x
=
1
;
x
<=
WORKFLOW_MAX_VAR
;
x
++
){
printf
(
"%.2f
\t
"
,
workflow
[
workflow_line_current
][
x
]);
}
...
...
src/denise.c
View file @
6c502b25
...
...
@@ -156,6 +156,7 @@ int main(int argc, char **argv){
float
**
workflow
=
NULL
;
int
workflow_line_current
=
1
;
int
workflow_lines
;
char
workflow_header
[
STRING_SIZE
];
int
change_wavetype_iter
=-
10
;
/* Have to be inialized negative */
int
wavetype_start
;
/* We need this due to MPI Comm */
...
...
@@ -896,7 +897,7 @@ int main(int argc, char **argv){
nsrc_glob
=
nsrc
;
if
(
INVMAT
==
0
&&
USE_WORKFLOW
){
read_workflow
(
FILE_WORKFLOW
,
&
workflow
,
&
workflow_lines
);
read_workflow
(
FILE_WORKFLOW
,
&
workflow
,
&
workflow_lines
,
workflow_header
);
}
/* create model grids */
...
...
@@ -980,7 +981,7 @@ int main(int argc, char **argv){
// At each iteration the workflow is applied
if
(
USE_WORKFLOW
&&
(
INVMAT
==
0
)){
apply_workflow
(
workflow
,
workflow_lines
,
workflow_line_current
,
&
iter
,
&
FC
,
wavetype_start
,
&
change_wavetype_iter
,
&
LBFGS_iter_start
);
apply_workflow
(
workflow
,
workflow_lines
,
workflow_
header
,
workflow_
line_current
,
&
iter
,
&
FC
,
wavetype_start
,
&
change_wavetype_iter
,
&
LBFGS_iter_start
);
}
...
...
src/fd.h
View file @
6c502b25
...
...
@@ -522,11 +522,11 @@ void exchange_p(float ** sp, float ** bufferlef_to_rig, float ** bufferrig_to_le
MPI_Request
*
req_send
,
MPI_Request
*
req_rec
);
void
read_workflow
(
char
file_in
[
STRING_SIZE
],
float
***
workflow
,
int
*
workflow_lines
);
void
read_workflow
(
char
file_in
[
STRING_SIZE
],
float
***
workflow
,
int
*
workflow_lines
,
char
header
[
STRING_SIZE
]
);
float
**
joint_inversion_grad
(
float
**
gradiant_1
,
float
**
gradiant_2
,
float
alpha
,
int
joint_type
);
void
snap_SH
(
FILE
*
fp
,
int
nt
,
int
nsnap
,
float
**
vz
,
float
**
u
,
float
**
pi
,
float
*
hc
,
int
ishot
);
void
apply_workflow
(
float
**
workflow
,
int
workflow_lines
,
int
workflow_line_current
,
int
*
iter
,
float
*
FC
,
int
wavetype_start
,
int
*
change_wavetype_iter
,
int
*
LBFGS_iter_start
);
void
apply_workflow
(
float
**
workflow
,
int
workflow_lines
,
char
workflow_header
[
STRING_SIZE
],
int
workflow_line_current
,
int
*
iter
,
float
*
FC
,
int
wavetype_start
,
int
*
change_wavetype_iter
,
int
*
LBFGS_iter_start
);
void
eprecond
(
float
**
W
,
float
**
vx
,
float
**
vy
);
void
eprecond_SH
(
float
**
W
,
float
**
vz
);
...
...
src/read_workflow.c
View file @
6c502b25
...
...
@@ -28,13 +28,14 @@
#include
"fd.h"
void
read_workflow
(
char
file_in
[
STRING_SIZE
],
float
***
workflow
,
int
*
workflow_lines
){
void
read_workflow
(
char
file_in
[
STRING_SIZE
],
float
***
workflow
,
int
*
workflow_lines
,
char
header
[
STRING_SIZE
]
){
/* workflow is a pointer to a pointer, keep care... */
/* intern variables */
int
i
,
c
;
int
nw
=
0
,
x
,
y
;
FILE
*
fwork
;
/* extern variables */
extern
FILE
*
FP
;
...
...
@@ -47,11 +48,13 @@ void read_workflow(char file_in[STRING_SIZE],float *** workflow, int *workflow_l
if
(
fwork
==
NULL
)
err
(
" Workflow file could no be opened !"
);
/* Count how many lines the work flow file has */
fgets
(
header
,
200
,
fwork
);
/* Read header */
while
(
!
feof
(
fwork
))
{
c
=
fgetc
(
fwork
);
if
(
c
==
'\n'
){
nw
++
;}
}
fseek
(
fwork
,
SEEK_SET
,
0
);
fseek
(
fwork
,
SEEK_SET
,
0
);
/* Reset */
fgets
(
header
,
200
,
fwork
);
/* Read header */
fprintf
(
FP
,
" Number of lines in workflow file: %i
\n
"
,
nw
);
...
...
@@ -60,7 +63,7 @@ void read_workflow(char file_in[STRING_SIZE],float *** workflow, int *workflow_l
if
((
*
workflow
)
==
NULL
)
err
(
" Was not able to allocate memory for workflow file !"
);
/* Read workflow */
fprintf
(
FP
,
"
ITER
\t
INV_VS
\t
INV_VP
\t
INV_RHO
\t
PRO
\t
TIME_FILT
\t
FC
\t
FREE
\n
"
);
fprintf
(
FP
,
"
\n
%s"
,
header
);
fprintf
(
FP
,
" "
);
for
(
y
=
1
;
y
<=
nw
;
y
++
){
for
(
x
=
1
;
x
<=
WORKFLOW_MAX_VAR
;
x
++
){
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment