1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
include "../lib/daophotdef.h"
include "../lib/peakdef.h"
# DP_PKSETUP -- Initialize the PEAK fitting structure.
procedure dp_pksetup (dao)
pointer dao # pointer to the daophot structure
pointer peak
begin
call malloc (DP_PEAK(dao), LEN_PKSTRUCT, TY_STRUCT)
peak = DP_PEAK(dao)
DP_PKNTERM(peak) = 0
DP_PKCLAMP(peak) = NULL
DP_PKNORMAL(peak) = NULL
DP_PKRESID(peak) = NULL
DP_PKDERIV(peak) = NULL
DP_PKRESULT(peak) = NULL
DP_PKOLDRESULT(peak) = NULL
end
# DP_MEMPK -- Allocate memory for the PEAK fitting arrays.
procedure dp_mempk (dao, nterm)
pointer dao # pointer to the daophot structure
int nterm # the number of terms to be fit
pointer peak
begin
peak = DP_PEAK(dao)
call malloc (DP_PKCLAMP(peak), nterm, TY_REAL)
call malloc (DP_PKNORMAL(peak), nterm * nterm, TY_REAL)
call malloc (DP_PKRESID(peak), nterm * nterm, TY_REAL)
call malloc (DP_PKDERIV(peak), nterm * nterm, TY_REAL)
call malloc (DP_PKRESULT(peak), nterm * nterm, TY_REAL)
call malloc (DP_PKOLDRESULT(peak), nterm * nterm, TY_REAL)
DP_PKNTERM(peak) = nterm
end
# DP_PKCLOSE -- Free the PEAK fitting structure.
procedure dp_pkclose (dao)
pointer dao # pointer to the daophot structure
pointer peak
begin
peak = DP_PEAK(dao)
if (DP_PKCLAMP(peak) != NULL)
call mfree (DP_PKCLAMP(peak), TY_REAL)
if (DP_PKNORMAL(peak) != NULL)
call mfree (DP_PKNORMAL(peak), TY_REAL)
if (DP_PKRESID(peak) != NULL)
call mfree (DP_PKRESID(peak), TY_REAL)
if (DP_PKDERIV(peak) != NULL)
call mfree (DP_PKDERIV(peak), TY_REAL)
if (DP_PKRESULT(peak) != NULL)
call mfree (DP_PKRESULT(peak), TY_REAL)
if (DP_PKOLDRESULT(peak) != NULL)
call mfree (DP_PKOLDRESULT(peak), TY_REAL)
call mfree (peak, TY_STRUCT)
end
|