Geant4 Cross Reference |
1 /* 1 2 # <<BEGIN-copyright>> 3 # <<END-copyright>> 4 */ 5 6 #ifndef ptwXY_h_included 7 #define ptwXY_h_included 8 9 #include <stdio.h> 10 #include <stdint.h> 11 12 #include <nf_utilities.h> 13 #include <ptwX.h> 14 15 #if defined __cplusplus 16 extern "C" { 17 namespace GIDI { 18 #endif 19 20 #define ptwXY_minimumSize 10 /* Thi 21 #define ptwXY_minimumOverflowSize 4 /* Thi 22 #define ptwXY_maxBiSectionMax 20 23 #define ptwXY_minAccuracy 1e-14 24 #define ptwXY_sectionSubdivideMax 1 << 16 25 #define ClosestAllowXFactor 10 26 27 typedef enum ptwXY_dataFrom_e { ptwXY_dataFrom 28 typedef enum ptwXY_group_normType_e { ptwXY_gr 29 30 /* The next macro are used in the routine ptwX 31 #define ptwXY_union_fill 1 /* If 32 #define ptwXY_union_trim 2 /* If 33 #define ptwXY_union_mergeClosePoints 4 /* If 34 typedef enum ptwXY_sigma_e { ptwXY_sigma_none, 35 typedef enum ptwXY_interpolation_e { ptwXY_int 36 ptwXY_interpolationFlat, ptwXY_interpolati 37 38 /* 39 * The function ptwXY_getPointsAroundX determi 40 * 41 * if ( some point's x == x ) 42 * lessThanEqualXPoint is set to point's i 43 * greaterThanXPoint is set to a overflowH 44 * return( ptwXY_lessEqualGreaterX_equal ) 45 * else if ( x < first point's x ) 46 * lessThanEqualXPoint is set to overflow 47 * greaterThanXPoint is set to first poin 48 * and greaterThanXPoint.prior points to 49 * else if ( x > last point's x ) 50 * lessThanEqualXPoint is set to last poi 51 * greaterThanXPoint is set to a overflow 52 * and lessThanEqualXPoint.prior points t 53 * else 54 * lessThanEqualXPoint is set to point's 55 * greaterThanXPoint is set to point's in 56 */ 57 typedef enum ptwXY_lessEqualGreaterX_e { ptwXY 58 ptwXY_lessEqualGreaterX_between, ptwXY_les 59 60 typedef 61 struct ptwXYPoint_s { 62 double x, y; 63 } ptwXYPoint; 64 65 typedef nfu_status (*ptwXY_createFromFunction_ 66 typedef nfu_status (*ptwXY_applyFunction_callb 67 typedef nfu_status (*ptwXY_getValue_callback)( 68 69 typedef struct { 70 char const *interpolationString; 71 ptwXY_getValue_callback getValueFunc; 72 void *argList; 73 } ptwXY_interpolationOtherInfo; 74 75 typedef 76 struct ptwXYOverflowPoint_s { 77 struct ptwXYOverflowPoint_s *prior; 78 struct ptwXYOverflowPoint_s *next; 79 int64_t index; 80 ptwXYPoint point; 81 } ptwXYOverflowPoint; 82 83 typedef 84 struct ptwXYPoints_s { 85 nfu_status status; 86 ptwXY_sigma typeX, typeY; 87 ptwXY_interpolation interpolation; 88 ptwXY_interpolationOtherInfo interpola 89 int userFlag; 90 double biSectionMax; 91 double accuracy; 92 double minFractional_dx; 93 int64_t length; 94 int64_t allocatedSize; 95 int64_t overflowLength; 96 int64_t overflowAllocatedSize; 97 int64_t mallocFailedSize; 98 ptwXYOverflowPoint overflowHeader; 99 ptwXYPoint *points; 100 ptwXYOverflowPoint *overflowPoints; 101 } ptwXYPoints; 102 103 /* 104 * Routines in ptwXY_core.c 105 */ 106 ptwXYPoints *ptwXY_new( ptwXY_interpolation in 107 double accuracy, int64_t primarySize, int6 108 nfu_status ptwXY_setup( ptwXYPoints *ptwXY, pt 109 double biSectionMax, double accuracy, int6 110 ptwXYPoints *ptwXY_create( ptwXY_interpolation 111 double biSectionMax, double accuracy, int6 112 nfu_status *status, int userFlag ); 113 ptwXYPoints *ptwXY_createFrom_Xs_Ys( ptwXY_int 114 double biSectionMax, double accuracy, int6 115 double const *Ys, nfu_status *status, int 116 117 nfu_status ptwXY_copy( ptwXYPoints *dest, ptwX 118 ptwXYPoints *ptwXY_clone( ptwXYPoints *ptwXY, 119 ptwXYPoints *ptwXY_cloneToInterpolation( ptwXY 120 ptwXYPoints *ptwXY_slice( ptwXYPoints *ptwXY, 121 ptwXYPoints *ptwXY_xSlice( ptwXYPoints *ptwXY, 122 ptwXYPoints *ptwXY_xMinSlice( ptwXYPoints *ptw 123 ptwXYPoints *ptwXY_xMaxSlice( ptwXYPoints *ptw 124 125 ptwXY_interpolation ptwXY_getInterpolation( pt 126 char const *ptwXY_getInterpolationString( ptwX 127 nfu_status ptwXY_getStatus( ptwXYPoints *ptwXY 128 int ptwXY_getUserFlag( ptwXYPoints *ptwXY ); 129 void ptwXY_setUserFlag( ptwXYPoints *ptwXY, in 130 double ptwXY_getAccuracy( ptwXYPoints *ptwXY ) 131 double ptwXY_setAccuracy( ptwXYPoints *ptwXY, 132 double ptwXY_getBiSectionMax( ptwXYPoints *ptw 133 double ptwXY_setBiSectionMax( ptwXYPoints *ptw 134 135 nfu_status ptwXY_reallocatePoints( ptwXYPoints 136 nfu_status ptwXY_reallocateOverflowPoints( ptw 137 nfu_status ptwXY_coalescePoints( ptwXYPoints * 138 nfu_status ptwXY_simpleCoalescePoints( ptwXYPo 139 140 nfu_status ptwXY_clear( ptwXYPoints *ptwXY ); 141 nfu_status ptwXY_release( ptwXYPoints *ptwXY ) 142 ptwXYPoints *ptwXY_free( ptwXYPoints *ptwXY ); 143 144 int64_t ptwXY_length( ptwXYPoints *ptwXY ); 145 int64_t ptwXY_getNonOverflowLength( ptwXYPoint 146 147 nfu_status ptwXY_setXYData( ptwXYPoints *ptwXY 148 nfu_status ptwXY_setXYDataFromXsAndYs( ptwXYPo 149 nfu_status ptwXY_deletePoints( ptwXYPoints *pt 150 ptwXYPoint *ptwXY_getPointAtIndex( ptwXYPoints 151 ptwXYPoint *ptwXY_getPointAtIndex_Unsafely( pt 152 nfu_status ptwXY_getXYPairAtIndex( ptwXYPoints 153 ptwXY_lessEqualGreaterX ptwXY_getPointsAroundX 154 ptwXY_lessEqualGreaterX ptwXY_getPointsAroundX 155 ptwXYOverflowPoint *greaterThanXPoint, 156 nfu_status ptwXY_getValueAtX( ptwXYPoints *ptw 157 nfu_status ptwXY_setValueAtX( ptwXYPoints *ptw 158 nfu_status ptwXY_setValueAtX_overrideIfClose( 159 nfu_status ptwXY_mergeFromXsAndYs( ptwXYPoints 160 nfu_status ptwXY_mergeFromXYs( ptwXYPoints *pt 161 nfu_status ptwXY_appendXY( ptwXYPoints *ptwXY, 162 nfu_status ptwXY_setXYPairAtIndex( ptwXYPoints 163 164 nfu_status ptwXY_getSlopeAtX( ptwXYPoints *ptw 165 166 double ptwXY_getXMinAndFrom( ptwXYPoints *ptwX 167 double ptwXY_getXMin( ptwXYPoints *ptwXY ); 168 double ptwXY_getXMaxAndFrom( ptwXYPoints *ptwX 169 double ptwXY_getXMax( ptwXYPoints *ptwXY ); 170 double ptwXY_getYMin( ptwXYPoints *ptwXY ); 171 double ptwXY_getYMax( ptwXYPoints *ptwXY ); 172 173 /* 174 * Methods in ptwXY_methods.c 175 */ 176 nfu_status ptwXY_clip( ptwXYPoints *ptwXY1, do 177 nfu_status ptwXY_thicken( ptwXYPoints *ptwXY1, 178 ptwXYPoints *ptwXY_thin( ptwXYPoints *ptwXY1, 179 nfu_status ptwXY_trim( ptwXYPoints *ptwXY ); 180 181 ptwXYPoints *ptwXY_union( ptwXYPoints *ptwXY1, 182 183 nfu_status ptwXY_scaleOffsetXAndY( ptwXYPoints 184 185 /* 186 * Functions in ptwXY_unitaryOperators.c 187 */ 188 nfu_status ptwXY_abs( ptwXYPoints *ptwXY ); 189 nfu_status ptwXY_neg( ptwXYPoints *ptwXY ); 190 191 /* 192 * Functions in ptwXY_binaryOperators.c 193 */ 194 nfu_status ptwXY_slopeOffset( ptwXYPoints *ptw 195 nfu_status ptwXY_add_double( ptwXYPoints *ptwX 196 nfu_status ptwXY_sub_doubleFrom( ptwXYPoints * 197 nfu_status ptwXY_sub_fromDouble( ptwXYPoints * 198 nfu_status ptwXY_mul_double( ptwXYPoints *ptwX 199 nfu_status ptwXY_div_doubleFrom( ptwXYPoints * 200 nfu_status ptwXY_div_fromDouble( ptwXYPoints * 201 nfu_status ptwXY_mod( ptwXYPoints *ptwXY, doub 202 203 ptwXYPoints *ptwXY_binary_ptwXY( ptwXYPoints * 204 ptwXYPoints *ptwXY_add_ptwXY( ptwXYPoints *ptw 205 ptwXYPoints *ptwXY_sub_ptwXY( ptwXYPoints *ptw 206 ptwXYPoints *ptwXY_mul_ptwXY( ptwXYPoints *ptw 207 ptwXYPoints *ptwXY_mul2_ptwXY( ptwXYPoints *pt 208 ptwXYPoints *ptwXY_div_ptwXY( ptwXYPoints *ptw 209 210 /* 211 * Functions in ptwXY_functions.c 212 */ 213 nfu_status ptwXY_pow( ptwXYPoints *ptwXY, doub 214 nfu_status ptwXY_exp( ptwXYPoints *ptwXY, doub 215 ptwXYPoints *ptwXY_convolution( ptwXYPoints *p 216 217 /* 218 * Functions in ptwXY_interpolation.c 219 */ 220 nfu_status ptwXY_interpolatePoint( ptwXY_inter 221 ptwXYPoints *ptwXY_flatInterpolationToLinear( 222 ptwXYPoints *ptwXY_toOtherInterpolation( ptwXY 223 ptwXYPoints *ptwXY_unitbaseInterpolate( double 224 ptwXYPoints *ptwXY_toUnitbase( ptwXYPoints *pt 225 ptwXYPoints *ptwXY_fromUnitbase( ptwXYPoints * 226 227 /* 228 * Functions in ptwXY_convenient.c 229 */ 230 ptwXPoints *ptwXY_getXArray( ptwXYPoints *ptwX 231 nfu_status ptwXY_dullEdges( ptwXYPoints *ptwXY 232 nfu_status ptwXY_mergeClosePoints( ptwXYPoints 233 ptwXYPoints *ptwXY_intersectionWith_ptwX( ptwX 234 nfu_status ptwXY_areDomainsMutual( ptwXYPoints 235 nfu_status ptwXY_tweakDomainsToMutualify( ptwX 236 nfu_status ptwXY_mutualifyDomains( ptwXYPoints 237 ptwX 238 nfu_status ptwXY_copyToC_XY( ptwXYPoints *ptwX 239 nfu_status ptwXY_valueTo_ptwXAndY( ptwXYPoints 240 ptwXYPoints *ptwXY_valueTo_ptwXY( double x1, d 241 ptwXYPoints *ptwXY_createGaussianCenteredSigma 242 ptwXYPoints *ptwXY_createGaussian( double accu 243 double dullEps, nfu_status *status ); 244 245 /* 246 * Functions in ptwXY_misc.c 247 */ 248 void ptwXY_update_biSectionMax( ptwXYPoints *p 249 ptwXYPoints *ptwXY_createFromFunction( int n, 250 int biSectionMax, nfu_status *status ); 251 ptwXYPoints *ptwXY_createFromFunction2( ptwXPo 252 int biSectionMax, nfu_status *status ); 253 nfu_status ptwXY_applyFunction( ptwXYPoints *p 254 ptwXYPoints *ptwXY_fromString( char const *str 255 double biSectionMax, double accuracy, char 256 257 void ptwXY_showInteralStructure( ptwXYPoints * 258 void ptwXY_simpleWrite( ptwXYPoints *ptwXY, FI 259 void ptwXY_simplePrint( ptwXYPoints *ptwXY, ch 260 261 /* 262 * Functions in ptwXY_integration.c 263 */ 264 nfu_status ptwXY_f_integrate( ptwXY_interpolat 265 double ptwXY_integrate( ptwXYPoints *ptwXY, do 266 double ptwXY_integrateDomain( ptwXYPoints *ptw 267 nfu_status ptwXY_normalize( ptwXYPoints *ptwXY 268 double ptwXY_integrateDomainWithWeight_x( ptwX 269 double ptwXY_integrateWithWeight_x( ptwXYPoint 270 double ptwXY_integrateDomainWithWeight_sqrt_x( 271 double ptwXY_integrateWithWeight_sqrt_x( ptwXY 272 ptwXPoints *ptwXY_groupOneFunction( ptwXYPoint 273 ptwXPoints *ptwXY_groupTwoFunctions( ptwXYPoin 274 ptwXPoints *ptwX_norm, nfu_status *sta 275 ptwXPoints *ptwXY_groupThreeFunctions( ptwXYPo 276 ptwXY_group_normType normType, ptwXPoi 277 ptwXPoints *ptwXY_runningIntegral( ptwXYPoints 278 double ptwXY_integrateWithFunction( ptwXYPoint 279 double xMin, double xMax, int degree, 280 281 #if defined __cplusplus 282 } 283 } 284 #endif 285 286 #endif /* End of ptwXY_h_included. */ 287