Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Oleksii Turkot
CrystFEL
Commits
4aa293b5
Commit
4aa293b5
authored
Nov 26, 2009
by
Thomas White
Browse files
Options processing
parent
c275432a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/pattern_sim.c
View file @
4aa293b5
...
...
@@ -17,6 +17,7 @@
#include
<stdio.h>
#include
<string.h>
#include
<unistd.h>
#include
<getopt.h>
#include
"image.h"
#include
"diffraction.h"
...
...
@@ -30,11 +31,21 @@
#define CRYSTAL_SIZE (500.0e-9)
static
void
main_
show_help
(
const
char
*
s
)
static
void
show_help
(
const
char
*
s
)
{
printf
(
"Syntax: %s <file1.h5> <file2.h5> [...]
\n\n
"
,
s
);
printf
(
"Simulate diffraction patterns
\n\n
"
);
printf
(
" -h Display this help message
\n
"
);
printf
(
"Syntax: %s
\n\n
"
,
s
);
printf
(
"Simulate diffraction patterns from small crystals
\n
"
);
printf
(
" probed with femosecond pulses from a free electron laser
\n\n
"
);
printf
(
" -h, --help Display this help message
\n
"
);
printf
(
" --simulation-details Show details of the simulation
\n
"
);
}
static
void
show_details
(
const
char
*
s
)
{
printf
(
"%s: Simulation Details
\n\n
"
,
s
);
printf
(
"Simulates diffraction patterns from small crystals
\n
"
);
printf
(
"probed with femtosecond pulses from a free electron laser
\n\n
"
);
}
...
...
@@ -44,20 +55,38 @@ int main(int argc, char *argv[])
struct
image
image
;
char
filename
[
1024
];
int
number
=
1
;
int
config_simdetails
=
0
;
const
struct
option
longopts
[]
=
{
{
"help"
,
0
,
NULL
,
'h'
},
{
"simulation-details"
,
0
,
&
config_simdetails
,
1
},
{
0
,
0
,
NULL
,
0
}
};
while
((
c
=
getopt
(
argc
,
argv
,
"h"
))
!=
-
1
)
{
while
((
c
=
getopt
_long
(
argc
,
argv
,
"h"
,
longopts
,
NULL
))
!=
-
1
)
{
switch
(
c
)
{
switch
(
c
)
{
case
'h'
:
{
show_help
(
argv
[
0
]);
return
0
;
}
case
'h'
:
{
main_show_help
(
argv
[
0
]);
return
0
;
}
case
0
:
{
break
;
}
default
:
{
return
1
;
}
}
}
if
(
config_simdetails
)
{
show_details
(
argv
[
0
]);
return
0
;
}
/* Define image parameters */
image
.
width
=
1024
;
image
.
height
=
1024
;
...
...
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