source: sans/Analysis/branches/ajj_23APR07/XOPs/SANSAnalysis/XOP/SANSAnalysis.c @ 102

Last change on this file since 102 was 97, checked in by ajj, 16 years ago

Now committing the code correctly - having relied on XCode's SVN interface which doesn't behave (quelle surprise).

I hope this isn't too screwed up.

File size: 11.1 KB
Line 
1/*
2 *  SANSAnalysis.c
3 *  SANSAnalysis
4 *
5 *  Created by Andrew Jackson on 4/23/07.
6 *  Copyright 2007 __MyCompanyName__. All rights reserved.
7 *
8 */
9
10#pragma XOP_SET_STRUCT_PACKING                  // All structures are 2-byte-aligned.
11
12#include "XOPStandardHeaders.h"                 // Include ANSI headers, Mac headers, IgorXOP.h, XOP.h and XOPSupport.h
13#include "SANSAnalysis.h"
14#include "Cylinder.h"
15#include "Sphere.h"
16#include "TwoPhase.h"
17#include "StructureFactor.h"
18#include "ResolutionSmearing.h"
19
20static long
21RegisterFunction()
22{
23        int funcIndex;
24       
25        funcIndex = GetXOPItem(0);                      // Which function invoked ?
26        switch (funcIndex) {
27                //
28                // Sphere Model Functions
29                //
30                case 0:                                                 // y = MultiShellX(w,x) (curve fitting function).
31                        return((long)MultiShellX);      // This function is called using the direct method.
32                        break;
33                case 1:                                                 // y = PolyMultiShellX(w,x) (curve fitting function).
34                        return((long)PolyMultiShellX);  // This function is called using the direct method.
35                        break;
36                case 2:                                                 // y = SphereFormX(w,x) (curve fitting function).
37                        return((long)SphereFormX);      // This function is called using the direct method.
38                        break;
39                case 3:                                                 // y = CoreShellX(w,x) (curve fitting function).
40                        return((long)CoreShellFormX);   // This function is called using the direct method.
41                        break;
42                case 4:                                                 // y = PolyCoreX(w,x) (curve fitting function).
43                        return((long)PolyCoreFormX);    // This function is called using the direct method.
44                        break;
45                case 5:                                                 // y = PolyCoreShellRatioX(w,x) (curve fitting function).
46                        return((long)PolyCoreShellRatioX);      // This function is called using the direct method.
47                        break;
48                case 6:                                                 // y = Vesicle_ULX(w,x) (curve fitting function).
49                        return((long)VesicleFormX);     // This function is called using the direct method.
50                        break;
51                case 7:                                                 // y = SchulzSpheresX(w,x) (curve fitting function).
52                        return((long)SchulzSpheresX);   // This function is called using the direct method.
53                        break;
54                case 8:                                                 // y = PolyRectSpheresX(w,x) (curve fitting function).
55                        return((long)PolyRectSpheresX); // This function is called using the direct method.
56                        break;
57                case 9:                                                 // y = PolyHardSphereIntensityX(w,x) (curve fitting function).
58                        return((long)PolyHardSphereIntensityX); // This function is called using the direct method.
59                        break;
60                case 10:                                                        // y = BimodalSchulzSpheresX(w,x) (curve fitting function).
61                        return((long)BimodalSchulzSpheresX);    // This function is called using the direct method.
62                        break;
63                case 11:                                                        // y = GaussPolySphereX(w,x) (curve fitting function).
64                        return((long)GaussPolySphereX); // This function is called using the direct method.
65                        break;
66                case 12:                                                        // y = LogNormalPolySphereX(w,x) (curve fitting function).
67                        return((long)LogNormalPolySphereX);     // This function is called using the direct method.
68                        break;
69                case 13:                                                        // y = BinaryHSX(w,x) (curve fitting function).
70                        return((long)BinaryHSX);        // This function is called using the direct method.
71                        break;
72                case 14:                                                        // y = BinaryHS_PSF11X(w,x) (curve fitting function).
73                        return((long)BinaryHS_PSF11X);  // This function is called using the direct method.
74                        break;
75        case 15:                                                        // y = BinaryHS_PSF12X(w,x) (curve fitting function).
76                        return((long)BinaryHS_PSF12X);  // This function is called using the direct method.
77                        break;
78                case 16:                                                        // y = BinaryHS_PSF22X(w,x) (curve fitting function).
79                        return((long)BinaryHS_PSF22X);  // This function is called using the direct method.
80                        break;
81                        //
82                        // Cylinder Model Functions
83                        //
84                case 17:                                                        // y = CylinderFormX(w,x) (curve fitting function).
85                        return((long)CylinderFormX);    // This function is called using the direct method.
86                        break;
87                case 18:                                                        // y = EllipCylFit76X(w,x) (curve fitting function).
88                        return((long)EllipCyl76X);      // This function is called using the direct method.
89                        break;
90                case 19:                                                        // y = EllipCylFit20X(w,x) (curve fitting function).
91                        return((long)EllipCyl20X);      // This function is called using the direct method.
92                        break;
93                case 20:                                                        // y = TriaxialEllipsoidX(w,x) (curve fitting function).
94                        return((long)TriaxialEllipsoidX);       // This function is called using the direct method.
95                        break;
96                case 21:                                                        // y = ParallelepipedX(w,x) (curve fitting function).
97                        return((long)ParallelepipedX);  // This function is called using the direct method.
98                        break;
99                case 22:                                                        // y = HollowCylinderX(w,x) (curve fitting function).
100                        return((long)HollowCylinderX);  // This function is called using the direct method.
101                        break;
102                case 23:                                                        // y = EllipsoidFormX(w,x) (curve fitting function).
103                        return((long)EllipsoidFormX);   // This function is called using the direct method.
104                        break;       
105                case 24:                                                        // y = Cyl_PolyRadiusX(w,x) (curve fitting function).
106                        return((long)Cyl_PolyRadiusX);  // This function is called using the direct method.
107                        break; 
108                case 25:                                                        // y = Cyl_PolyLengthX(w,x) (curve fitting function).
109                        return((long)Cyl_PolyLengthX);  // This function is called using the direct method.
110                        break; 
111                case 26:                                                        // y = CoreShellCylinderX(w,x) (curve fitting function).
112                        return((long)CoreShellCylinderX);       // This function is called using the direct method.
113                        break;
114                case 27:                                        // y = OblateFormX(w,x) (curve fitting function).
115                        return((long)OblateFormX);      // This function is called using the direct method.
116                        break;
117                case 28:                                        // y = ProlateFormX(w,x) (curve fitting function).
118                        return((long)ProlateFormX);     // This function is called using the direct method.
119                        break;
120                case 29:                                        // y = FlexExclVolCylX(w,x) (curve fitting function).
121                        return((long)FlexExclVolCylX);  // This function is called using the direct method.
122                        break;                       
123                case 30:                                        // y = FlexCyl_PolyLenX(w,x) (curve fitting function).
124                        return((long)FlexCyl_PolyLenX); // This function is called using the direct method.
125                        break;
126                case 31:                                        // y = FlexCyl_PolyRadX(w,x) (curve fitting function).
127                        return((long)FlexCyl_PolyRadX); // This function is called using the direct method.
128                        break;
129                case 32:                                        // y = FlexCyl_EllipX(w,x) (curve fitting function).
130                        return((long)FlexCyl_EllipX);   // This function is called using the direct method.
131                        break;
132                case 33:                                        // y = PolyCoShCylinderX(w,x) (curve fitting function).
133                        return((long)PolyCoShCylinderX);        // This function is called using the direct method.
134                        break;
135                case 34:                                        // y = StackedDisksX(w,x) (curve fitting function).
136                        return((long)StackedDiscsX);    // This function is called using the direct method.
137                        break;
138                case 35:                                        // y = LamellarFFX(w,x) (curve fitting function).
139                        return((long)LamellarFFX);      // This function is called using the direct method.
140                        break;
141                case 36:                                        // y = LamellarFF_HGX(w,x) (curve fitting function).
142                        return((long)LamellarFF_HGX);   // This function is called using the direct method.
143                        break;
144                case 37:                                        // y = LamellarPSX(w,x) (curve fitting function).
145                        return((long)LamellarPSX);      // This function is called using the direct method.
146                        break;
147                case 38:                                        // y = LamellarPS_HGX(w,x) (curve fitting function).
148                        return((long)LamellarPS_HGX);   // This function is called using the direct method.
149                        break;
150                        //
151                        // Two Phase Model Functions
152                        //
153                case 39:                                                        // y = TeubnerStreyModelX(w,x) (curve fitting function).
154                        return((long)TeubnerStreyModelX);       // This function is called using the direct method.
155                        break;
156                case 40:                                                        // y = Power_Law_ModelX(w,x) (curve fitting function).
157                        return((long)Power_Law_ModelX); // This function is called using the direct method.
158                        break;
159                case 41:                                                        // y = Peak_Lorentz_ModelX(w,x) (curve fitting function).
160                        return((long)Peak_Lorentz_ModelX);      // This function is called using the direct method.
161                        break;
162                case 42:                                                        // y = Peak_Gauss_ModelX(w,x) (curve fitting function).
163                        return((long)Peak_Gauss_ModelX);        // This function is called using the direct method.
164                        break;
165                case 43:                                                        // y = Lorentz_ModelX(w,x) (curve fitting function).
166                        return((long)Lorentz_ModelX);   // This function is called using the direct method.
167                        break;
168                case 44:                                                        // y = FractalX(w,x) (curve fitting function).
169                        return((long)FractalX); // This function is called using the direct method.
170                        break;
171                case 45:                                                        // y = DAB_ModelX(w,x) (curve fitting function).
172                        return((long)DAB_ModelX);       // This function is called using the direct method.
173                        break;
174                case 46:                                                        // y = OneLevelX(w,x) (curve fitting function).
175                        return((long)OneLevelX);        // This function is called using the direct method.
176                        break;
177                case 47:                                                        // y = TwoLevelX(w,x) (curve fitting function).
178                        return((long)TwoLevelX);        // This function is called using the direct method.
179                        break;
180                case 48:                                                        // y = ThreeLevelX(w,x) (curve fitting function).
181                        return((long)ThreeLevelX);      // This function is called using the direct method.
182                        break;
183                case 49:                                                        // y = FourLevelX(w,x) (curve fitting function).
184                        return((long)FourLevelX);       // This function is called using the direct method.
185                        break;
186                        //
187                        // Structure Factor Functions
188                        //
189                case 50:                                                        // y = HardSphereStructX(w,x) (curve fitting function).
190                        return((long)HardSphereStructX);        // This function is called using the direct method.
191                        break;
192                case 51:                                                        // y = SquareWellStructX(w,x) (curve fitting function).
193                        return((long)SquareWellStructX);        // This function is called using the direct method.
194                        break;
195                case 52:                                                        // y = StickyHS_StructX(w,x) (curve fitting function).
196                        return((long)StickyHS_StructX); // This function is called using the direct method.
197                        break;
198                case 53:                                                        // y = HayterPenfoldMSAX(w,x) (curve fitting function).
199                        return((long)HayterPenfoldMSAX);        // This function is called using the direct method.
200                        break;
201                case 54:                                                        // y = DiamCylX(a,b) (utility).
202                        return((long)DiamCylX);                 // This function is called using the direct method.
203                        break;
204                case 55:                                                        // y = DiamEllipX(a,b) (utility).
205                        return((long)DiamEllipX);                       // This function is called using the direct method.
206                        break;
207                        //
208                        // Resolution Smearing Functions
209                case 56:                                                        // y = Smear_Model_20_X (utility).
210                        return((long)Smear_Model_20_X);                 // This function is called using the direct method.
211                        break;
212                case 57:                                                        // y =Smear_Model_76_X (utility).
213                        return((long)Smear_Model_76_X);                 // This function is called using the direct method.
214                        break; 
215        }
216        return NIL;
217}
218
219/*      XOPEntry()
220
221This is the entry point from the host application to the XOP for all
222messages after the INIT message.
223*/
224static void
225XOPEntry(void)
226{       
227        long result = 0;
228       
229        switch (GetXOPMessage()) {
230                case FUNCADDRS:
231                        result = RegisterFunction();    // This tells Igor the address of our function.
232                        break;
233        }
234        SetXOPResult(result);
235}
236
237/*      main(ioRecHandle)
238
239This is the initial entry point at which the host application calls XOP.
240The message sent by the host must be INIT.
241main() does any necessary initialization and then sets the XOPEntry field of the
242ioRecHandle to the address to be called for future messages.
243*/
244HOST_IMPORT void
245main(IORecHandle ioRecHandle)
246{       
247        XOPInit(ioRecHandle);                                                   // Do standard XOP initialization.
248        SetXOPEntry(XOPEntry);                                                  // Set entry point for future calls.
249       
250        if (igorVersion < 200)
251                SetXOPResult(REQUIRES_IGOR_200);
252        else
253                SetXOPResult(0L);
254}
255
256
257
258#pragma XOP_RESET_STRUCT_PACKING                        // All structures are 2-byte-aligned.
259                                                                                        // All structures are 2-byte-aligned.
260
Note: See TracBrowser for help on using the repository browser.