Ignore:
Timestamp:
Nov 18, 2008 3:24:51 PM (14 years ago)
Author:
srkline
Message:

Changes to the XOP code to use the newly added functions (2008 models).

XOPs have been verified against the Igor version of the code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/XOP_Dev/SANSAnalysis/XOP/TwoPhase.c

    r188 r452  
    360360} 
    361361 
     362int 
     363BroadPeakX(FitParamsPtr p) 
     364{ 
     365        double *dp;                             // Pointer to double precision wave data. 
     366        float *fp;                              // Pointer to single precision wave data. 
     367        double q; 
     368         
     369        if (p->waveHandle == NIL) { 
     370                SetNaN64(&p->result); 
     371                return NON_EXISTENT_WAVE; 
     372        } 
     373         
     374        q= p->x; 
     375         
     376        switch(WaveType(p->waveHandle)){                        // We can handle single and double precision coefficient waves. 
     377                case NT_FP32: 
     378                        fp= WaveData(p->waveHandle); 
     379                        SetNaN64(&p->result); 
     380                        return REQUIRES_SP_OR_DP_WAVE; //not quite true, but good enough for now AJJ 4/23/07                     
     381                case NT_FP64: 
     382                        dp= WaveData(p->waveHandle); 
     383                        p->result = BroadPeak(dp,q); 
     384                        return 0; 
     385                default:                                                                // We can't handle this wave data type. 
     386                        SetNaN64(&p->result); 
     387                        return REQUIRES_SP_OR_DP_WAVE; 
     388        } 
     389         
     390        return 0; 
     391} 
     392 
     393int 
     394CorrLengthX(FitParamsPtr p) 
     395{ 
     396        double *dp;                             // Pointer to double precision wave data. 
     397        float *fp;                              // Pointer to single precision wave data. 
     398        double q; 
     399         
     400        if (p->waveHandle == NIL) { 
     401                SetNaN64(&p->result); 
     402                return NON_EXISTENT_WAVE; 
     403        } 
     404         
     405        q= p->x; 
     406         
     407        switch(WaveType(p->waveHandle)){                        // We can handle single and double precision coefficient waves. 
     408                case NT_FP32: 
     409                        fp= WaveData(p->waveHandle); 
     410                        SetNaN64(&p->result); 
     411                        return REQUIRES_SP_OR_DP_WAVE; //not quite true, but good enough for now AJJ 4/23/07                     
     412                case NT_FP64: 
     413                        dp= WaveData(p->waveHandle); 
     414                        p->result = CorrLength(dp,q); 
     415                        return 0; 
     416                default:                                                                // We can't handle this wave data type. 
     417                        SetNaN64(&p->result); 
     418                        return REQUIRES_SP_OR_DP_WAVE; 
     419        } 
     420         
     421        return 0; 
     422} 
     423 
     424int 
     425TwoLorentzianX(FitParamsPtr p) 
     426{ 
     427        double *dp;                             // Pointer to double precision wave data. 
     428        float *fp;                              // Pointer to single precision wave data. 
     429        double q; 
     430         
     431        if (p->waveHandle == NIL) { 
     432                SetNaN64(&p->result); 
     433                return NON_EXISTENT_WAVE; 
     434        } 
     435         
     436        q= p->x; 
     437         
     438        switch(WaveType(p->waveHandle)){                        // We can handle single and double precision coefficient waves. 
     439                case NT_FP32: 
     440                        fp= WaveData(p->waveHandle); 
     441                        SetNaN64(&p->result); 
     442                        return REQUIRES_SP_OR_DP_WAVE; //not quite true, but good enough for now AJJ 4/23/07                     
     443                case NT_FP64: 
     444                        dp= WaveData(p->waveHandle); 
     445                        p->result = TwoLorentzian(dp,q); 
     446                        return 0; 
     447                default:                                                                // We can't handle this wave data type. 
     448                        SetNaN64(&p->result); 
     449                        return REQUIRES_SP_OR_DP_WAVE; 
     450        } 
     451         
     452        return 0; 
     453} 
     454 
     455int 
     456TwoPowerLawX(FitParamsPtr p) 
     457{ 
     458        double *dp;                             // Pointer to double precision wave data. 
     459        float *fp;                              // Pointer to single precision wave data. 
     460        double q; 
     461         
     462        if (p->waveHandle == NIL) { 
     463                SetNaN64(&p->result); 
     464                return NON_EXISTENT_WAVE; 
     465        } 
     466         
     467        q= p->x; 
     468         
     469        switch(WaveType(p->waveHandle)){                        // We can handle single and double precision coefficient waves. 
     470                case NT_FP32: 
     471                        fp= WaveData(p->waveHandle); 
     472                        SetNaN64(&p->result); 
     473                        return REQUIRES_SP_OR_DP_WAVE; //not quite true, but good enough for now AJJ 4/23/07                     
     474                case NT_FP64: 
     475                        dp= WaveData(p->waveHandle); 
     476                        p->result = TwoPowerLaw(dp,q); 
     477                        return 0; 
     478                default:                                                                // We can't handle this wave data type. 
     479                        SetNaN64(&p->result); 
     480                        return REQUIRES_SP_OR_DP_WAVE; 
     481        } 
     482         
     483        return 0; 
     484} 
     485 
     486int 
     487PolyGaussCoilX(FitParamsPtr p) 
     488{ 
     489        double *dp;                             // Pointer to double precision wave data. 
     490        float *fp;                              // Pointer to single precision wave data. 
     491        double q; 
     492         
     493        if (p->waveHandle == NIL) { 
     494                SetNaN64(&p->result); 
     495                return NON_EXISTENT_WAVE; 
     496        } 
     497         
     498        q= p->x; 
     499         
     500        switch(WaveType(p->waveHandle)){                        // We can handle single and double precision coefficient waves. 
     501                case NT_FP32: 
     502                        fp= WaveData(p->waveHandle); 
     503                        SetNaN64(&p->result); 
     504                        return REQUIRES_SP_OR_DP_WAVE; //not quite true, but good enough for now AJJ 4/23/07                     
     505                case NT_FP64: 
     506                        dp= WaveData(p->waveHandle); 
     507                        p->result = PolyGaussCoil(dp,q); 
     508                        return 0; 
     509                default:                                                                // We can't handle this wave data type. 
     510                        SetNaN64(&p->result); 
     511                        return REQUIRES_SP_OR_DP_WAVE; 
     512        } 
     513         
     514        return 0; 
     515} 
     516 
     517int 
     518GaussLorentzGelX(FitParamsPtr p) 
     519{ 
     520        double *dp;                             // Pointer to double precision wave data. 
     521        float *fp;                              // Pointer to single precision wave data. 
     522        double q; 
     523         
     524        if (p->waveHandle == NIL) { 
     525                SetNaN64(&p->result); 
     526                return NON_EXISTENT_WAVE; 
     527        } 
     528         
     529        q= p->x; 
     530         
     531        switch(WaveType(p->waveHandle)){                        // We can handle single and double precision coefficient waves. 
     532                case NT_FP32: 
     533                        fp= WaveData(p->waveHandle); 
     534                        SetNaN64(&p->result); 
     535                        return REQUIRES_SP_OR_DP_WAVE; //not quite true, but good enough for now AJJ 4/23/07                     
     536                case NT_FP64: 
     537                        dp= WaveData(p->waveHandle); 
     538                        p->result = GaussLorentzGel(dp,q); 
     539                        return 0; 
     540                default:                                                                // We can't handle this wave data type. 
     541                        SetNaN64(&p->result); 
     542                        return REQUIRES_SP_OR_DP_WAVE; 
     543        } 
     544         
     545        return 0; 
     546} 
     547 
     548int 
     549GaussianShellX(FitParamsPtr p) 
     550{ 
     551        double *dp;                             // Pointer to double precision wave data. 
     552        float *fp;                              // Pointer to single precision wave data. 
     553        double q; 
     554         
     555        if (p->waveHandle == NIL) { 
     556                SetNaN64(&p->result); 
     557                return NON_EXISTENT_WAVE; 
     558        } 
     559         
     560        q= p->x; 
     561         
     562        switch(WaveType(p->waveHandle)){                        // We can handle single and double precision coefficient waves. 
     563                case NT_FP32: 
     564                        fp= WaveData(p->waveHandle); 
     565                        SetNaN64(&p->result); 
     566                        return REQUIRES_SP_OR_DP_WAVE; //not quite true, but good enough for now AJJ 4/23/07                     
     567                case NT_FP64: 
     568                        dp= WaveData(p->waveHandle); 
     569                        p->result = GaussianShell(dp,q); 
     570                        return 0; 
     571                default:                                                                // We can't handle this wave data type. 
     572                        SetNaN64(&p->result); 
     573                        return REQUIRES_SP_OR_DP_WAVE; 
     574        } 
     575         
     576        return 0; 
     577} 
    362578 
    363579///////////end of XOP 
Note: See TracChangeset for help on using the changeset viewer.