Layers
Diffusion in heterogeneous environments
Main Page
Related Pages
Data Structures
Files
File List
Globals
3layer
extras.c
Go to the documentation of this file.
1
12
// includes
13
#include "
header.h
"
14
20
void
error
(
char
*errorstring, ...)
21
{
22
va_list ap;
23
24
va_start(ap, errorstring);
25
fprintf(stderr,
"Error: "
);
26
vfprintf(stderr, errorstring, ap);
27
fprintf(stderr,
"\n"
);
28
va_end(ap);
29
30
exit(EXIT_FAILURE);
31
}
32
33
40
void
print_usage
(
char
*program)
41
{
42
fprintf(stderr,
"Usage: %s [options] <input_file> \n\n"
, program);
43
fprintf(stderr,
44
"Reads an input parameter file <input_file> with parameters \n"
45
"from a layered environment (3 layers: SR, SP, and SO of the CA1 \n"
46
"region of the hippocampus) and calculates a diffusion curve.\n"
47
"The input filename extension can be anything, but don't use \".dat\".\n"
48
"The output file has the same name as the input file but with the \n"
49
"extension \".dat\".\n\n"
50
);
51
fprintf(stderr,
"z positions are relative to the source at z=0.\n\n"
);
52
53
fprintf(stderr,
"Options:\n"
54
"\t-h, --help print usage message\n"
55
"\t-v, --verbose be verbose\n"
56
"\t-g, --global_kappa use the same kappa in all layers (= kappa_sp)\n"
57
"\t--nr <nr> specify nr\n"
58
"\t--nz <nr> specify nz\n"
59
"\t--nt <nt> specify nt\n"
60
"\t--nt_scale <factor> specify scale factor for nt\n"
61
"\t--probe_z <probe_z> specify probe_z (in microns)\n"
62
"\t--probe_r <probe_r> specify probe_r (in microns)\n"
63
"\t--ez1 <ez1> specify z-position of bottom of cylinder (<0)\n"
64
"\t--ez2 <ez2> specify z-position of top of cylinder (>0)\n"
65
"\t--alpha_so <alpha_so> specify alpha_so\n"
66
"\t--alpha_sp <alpha_sp> specify alpha_sp\n"
67
"\t--alpha_sr <alpha_sr> specify alpha_sr\n"
68
"\t--theta_so <theta_so> specify theta_so\n"
69
"\t--theta_sp <theta_sp> specify theta_sp\n"
70
"\t--theta_sr <theta_sr> specify theta_sr\n"
71
"\t--kappa_so <kappa_so> specify kappa_so\n"
72
"\t--kappa_sp <kappa_sp> specify kappa_sp\n"
73
"\t--kappa_sr <kappa_sr> specify kappa_sr\n"
74
"\t--kappa_outside <k_out> specify kappa_outside (mutually excl. with -g)\n"
75
"\t--alpha_start <a_start> specify initial guess for apparent alpha\n"
76
"\t--theta_start <t_start> specify initial guess for apparent theta\n"
77
"\t--alpha_step <a_step> specify initial step for apparent alpha\n"
78
"\t--theta_step <t_step> specify initial step for apparent theta\n"
79
"\t--tmax <tmax> specify total duration of experiment\n"
80
"\t--fit_tol <fit_tol> specify stopping criterion (simplex size)\n"
81
"\t--itermax <itermax> specify stopping criterion (max iterations)\n"
82
"\t--outfile <outfile> specify output file (parameters and curves)\n"
83
"\t--pathfile <pathfile> specify simplex path output file (just \n"
84
"\t one vertex of the simplex per iteration)\n"
85
"\t--images <basename> specify basename of output conc images\n"
86
"\t--image_spacing <delta> specify time spacing between output images\n"
87
"\t--additional_sources \"<string>\" specify additional sources\n"
88
"\t <string> = <num_additional_sources> <source_params>\n"
89
"\t <source_params> = <sz1> <sr1> <crnt1> [<sz2> <sr2> <crnt2> ...]\n"
90
);
91
exit(EXIT_FAILURE);
92
}
93
94
105
double
*
create_array
(
int
N,
char
*
string
)
106
{
107
double
*a;
108
int
i;
109
110
a = (
double
*)malloc(
sizeof
(
double
) * N);
111
if
(a == NULL)
112
error
(
"Cannot allocate memory for %s array"
,
string
);
113
114
for
(i=0; i<N; i++)
115
a[i] = 0.0;
116
117
return
a;
118
}
119
header.h
Header file for program 3layer.
error
void error(char *errorstring,...)
Print an error message to stderr and exit with status EXIT_FAILURE.
Definition:
extras.c:20
create_array
double * create_array(int N, char *string)
Create an array of doubles of the specified size.
Definition:
extras.c:105
print_usage
void print_usage(char *program)
Print usage message and exit with status EXIT_FAILURE.
Definition:
extras.c:40
Generated on Sun Aug 6 2017 18:21:12 for Layers by
1.8.11