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