Skip to content
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
62918c4
Kill bogus forward declarations in Lgm_QuadPack*.c
JeffreyBroll Jun 24, 2026
8cd3044
Finish BwFunc prototypes to make SummersDiffCoeff get through newer gcc
JeffreyBroll Jun 24, 2026
d67e6e5
Type error fixed
JeffreyBroll Jun 24, 2026
c8723b8
completed forward declarations in xvgifwr2, look behind the cobwebs
JeffreyBroll Jun 24, 2026
73335cd
fixing same type error as in Tsyg2007
JeffreyBroll Jun 24, 2026
7542f84
gitignore all the coverage thingos
JeffreyBroll Jun 24, 2026
ebca706
praxis declarations
JeffreyBroll Jun 27, 2026
9e72f01
... and now the forward declarations are in a header, like in civilized
JeffreyBroll Jun 27, 2026
ee35163
clang-format only, no substance changes
JeffreyBroll Jun 27, 2026
9dc0bc0
further cleaning up praxis, these unbracketed nested conditionals can't
JeffreyBroll Jun 27, 2026
21839be
autoformatting praxis.h while we're here
JeffreyBroll Jun 27, 2026
1c4a534
Gitignore external build directories with name build*
JeffreyBroll Jun 27, 2026
c207632
Gitignore external build directories with name build*
JeffreyBroll Jun 27, 2026
df33f99
Decarbonited xvgifwr2, now compiles under newer standards
JeffreyBroll Jun 28, 2026
95d8543
New-style declarations in QuadPack
JeffreyBroll Jun 28, 2026
942670a
New-style declarations in QuadPack3
JeffreyBroll Jun 28, 2026
9d6dac3
Merge pull request #1 from JeffreyBroll/newgcc_fixbuild
JeffreyBroll Jun 29, 2026
29e8b3a
Doxygen comments for parameters put in header
JeffreyBroll Jul 11, 2026
8998a85
Praxis braced for legibility
JeffreyBroll Jul 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ libLanlGeoMag/.deps/
*.o
*.lo
*.png
*.gcno
/Makefile
Tools/Makefile
tests/Makefile
libLanlGeoMag/Makefile
libLanlGeoMag/Lgm/Makefile
libLanlGeoMag/EopData/Makefile
libLanlGeoMag/*.gcno
/build-aux/
/autom4te.cache/
configure
Expand Down Expand Up @@ -63,3 +65,4 @@ Python/Makefile
/tests/check_*.log
/tests/check_*.trs
/tests/test-suite.log
_build*
4 changes: 2 additions & 2 deletions libLanlGeoMag/Lgm/Lgm_SummersDiffCoeff.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ typedef struct Lgm_SummersInfo {
double aStarEq; //!< Summer's \f$ \alpha^* \f$ value which is \f$ \Omega_e/\omega^2_{pe} \f$.
// double dB; //!< Value of wave amplitude [nT].
void *BwFuncData; //!< Pointer to data that may be needed by BwFunc()
double (*BwFunc)(); //!< Function to return Bw as a function of latitude.
double (*BwFunc)(double, void *); //!< Function to return Bw as a function of latitude.
double Omega_eEq; //!< Equatorial gyrofrequency of electrons [Hz].
double Omega_SigEq; //!< Equatorial gyrofrequency of species [Hz].
double w1; //!< Lower frequency cutoff [Hz].
Expand Down Expand Up @@ -93,7 +93,7 @@ typedef struct Lgm_SummersInfo {
int Lgm_SummersDxxBounceAvg( int Version, double Alpha0, double Ek, double L, void *BwFuncData, double (*BwFunc)( double, void * ), double n1, double n2, double n3, double aStarEq, int Directions, double w1, double w2, double wm, double dw, int WaveMode, int Species, double MaxWaveLat, double *Daa_ba, double *Dap_ba, double *Dpp_ba);
//int Lgm_GlauertAndHorneDxxBounceAvg( int Version, double Alpha0, double Ek, double L, void *BwFuncData, double (*BwFunc)( double, void * ), double n1, double n2, double n3, double aStarEq, int Directions, double w1, double w2, double wm, double dw, double x1, double x2, int numberOfWaveNormalAngleDistributions, double *xm, double *dx, double *weightsOnWaveNormalAngleDistributions,int WaveMode, int Species, double MaxWaveLat, double *Daa_ba, double *Dap_ba, double *Dpp_ba);
int Lgm_GlauertAndHorneDxxBounceAvg( int Version, double Alpha0, double Ek, double L, void *BwFuncData, double (*BwFunc)( double, void * ), double n1, double n2, double n3, double aStarEq, int Directions, double w1, double w2, double wm, double dw, double x1, double x2, int numberOfWaveNormalAngleDistributions, double *xm, double *dx, double *weightsOnWaveNormalAngleDistributions,int WaveMode, int Species, double MaxWaveLat, int nNw, int nPlasmaParameters, double aStarMin, double aStarMax, double *Nw, double *Daa_ba, double *Dap_ba, double *Dpp_ba);
int Lgm_SummersDxxDerivsBounceAvg( int DerivScheme, double ha, int Version, double Alpha0, double Ek, double L, void *BwFuncData, double (*BwFunc)(), double n1, double n2, double n3, double aStarEq, int Directions, double w1, double w2, double wm, double dw, int WaveMode, int Species, double MaxWaveLat, double *dDaa, double *dDap);
int Lgm_SummersDxxDerivsBounceAvg( int DerivScheme, double ha, int Version, double Alpha0, double Ek, double L, void *BwFuncData, double (*BwFunc)(double, void *), double n1, double n2, double n3, double aStarEq, int Directions, double w1, double w2, double wm, double dw, int WaveMode, int Species, double MaxWaveLat, double *dDaa, double *dDap);
double Lgm_ePlasmaFreq( double Density );
double Lgm_GyroFreq( double q, double B, double m );
double CdipIntegrand_Sb( double Lat, _qpInfo *qpInfo );
Expand Down
43 changes: 43 additions & 0 deletions libLanlGeoMag/Lgm/praxis.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#ifndef LGM_PRAXIS_H
#define LGM_PRAXIS_H

double *allocate_real_vector(int l, int u);
double **allocate_real_matrix(int lr, int ur, int lc, int uc);
void free_real_vector(double *v, int l);
void free_real_matrix(double **m, int lr, int ur, int lc);
void inivec(int l, int u, double *a, double x);
void inimat(int lr, int ur, int lc, int uc, double **a, double x);
void dupvec(int l, int u, int shift, double *a, double *b);
void dupcolvec(int l, int u, int j, double **a, double *b);
void dupmat(int l, int u, int i, int j, double **a, double **b);
double mattam(int l, int u, int i, int j, double **a, double **b);
double matmat(int l, int u, int i, int j, double **a, double **b);
void hshreabid(double **a, int m, int n, double *d, double *b, double *em);
void mulcol(int l, int u, int i, int j, double **a, double **b, double x);
void mulrow(int l, int u, int i, int j, double **a, double **b, double x);
double tammat(int l, int u, int i, int j, double **a, double **b);
double vecvec(int l, int u, int shift, double *a, double *b);
void elmrow(int l, int u, int i, int j, double **a, double **b, double x);
void elmcol(int l, int u, int i, int j, double **a, double **b, double x);
void ichrowcol(int l, int u, int i, int j, double **a);
void elmveccol(int l, int u, int i, double *a, double **b, double x);
int qrisngvaldec(double **a, int m, int n, double *val, double **v, double *em);
int qrisngvaldecbid(double *d, double *b, int m, int n, double **u, double **v,
double *em);
void psttfmmat(double **a, int n, double **v, double *b);
void pretfmmat(double **a, int m, int n, double *d);
void praxismin(int j, int nits, double *d2, double *x1, double *f1, int fk,
int n, double *x, double **v, double *qa, double *qb, double *qc,
double qd0, double qd1, double *q0, double *q1, int *nf, int *nl,
double *fx, double m2, double m4, double dmin, double ldt,
double reltol, double abstol, double small, double h,
double (*funct)(double *, void *data), int *data);
void rotcol(int l, int u, int i, int j, double **a, double c, double s);
double praxisflin(double l, int j, int n, double *x, double **v, double *qa,
double *qb, double *qc, double qd0, double qd1, double *q0,
double *q1, int *nf, double (*f)(double *, void *),
int *data);
void praxis(int n, double *x, int *data, double (*funct)(double *, void *data),
double *in, double *out);

#endif
106 changes: 13 additions & 93 deletions libLanlGeoMag/Lgm_QuadPack.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,13 @@
/*
* QUADPACK DQAGS Routine converted to C
*/
int dqags(f, qpInfo, a, b, epsabs, epsrel, result, abserr, neval, ier, limit, lenw, last, iwork, work, verbosity )
double (*f)( double, _qpInfo *); /* The integrand function -- I.e. the function to integrate */
_qpInfo *qpInfo; /* Auxilliary information to pass to function (to avoid making globals) */
double a; /* Lower Limit of integration. */
double b; /* Upper limit of integration. */
double epsabs; /* Absolute accuracy requested. */
double epsrel; /* Relative accuracy requested. */
double *result; /* The desired result. I.e. integral of f() from a to b */
double *abserr; /* Estimate of the modulus of the absolute error in the result */
int *neval; /* The number of integrand evaluations performed. */
int *ier; /* Error flag. An error occurred if ier > 0. See below. */
Comment on lines -7 to -16

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to preserve the comments somewhere. Doxygen docstring?

int limit;
int lenw;
int *last;
int *iwork;
double *work;
int verbosity;
{



int dqags(double (*f)( double, _qpInfo *), _qpInfo *qpInfo, double a, double b,
double epsabs, double epsrel, double *result, double *abserr, int *neval,
int *ier, int limit, int lenw, int *last, int *iwork, double *work, int verbosity ) {

/*
*
* Begin prologue: dqags
Expand Down Expand Up @@ -248,34 +234,13 @@ int TMPiwork[600];

}




/*
* QUADPACK DQAGSE Routine converted to C
*/
int dqagse(f, qpInfo, a, b, epsabs, epsrel, limit, result, abserr, neval, ier, alist, blist, rlist, elist, iord, last)
double (*f)( double, _qpInfo *); /* The integrand function -- I.e. the function to integrate */
_qpInfo *qpInfo; /* Auxilliary information to pass to function (to avoid making globals) */
double a; /* Lower Limit of integration. */
double b; /* Upper limit of integration. */
double epsabs; /* Absolute accuracy requested. */
double epsrel; /* Relative accuracy requested. */
int limit;
double *result; /* The desired result. I.e. integral of f() from a to b */
double *abserr; /* Estimate of the modulus of the absolute error in the result */
int *neval; /* The number of integrand evaluations performed. */
int *ier; /* Error flag. An error occurred if ier > 0. See below. */
Comment on lines -258 to -268

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, comments need preserving. Doxygen docstring seems like a good spot.

double *alist;
double *blist;
double *rlist;
double *elist;
int *iord;
int *last;
{



int dqagse(double (*f)( double, _qpInfo *), _qpInfo *qpInfo, double a, double b,
double epsabs, double epsrel, int limit, double *result, double *abserr,
int *neval, int *ier, double *alist, double *blist, double *rlist,
double *elist, int *iord, int *last) {

/*
*
Expand Down Expand Up @@ -429,7 +394,7 @@ int *last;


double area, abseps, area1, area12, area2, a1;
double a2, b1, b2, correc=0.0, defabs, defab1, defab2, d1mach();
double a2, b1, b2, correc=0.0, defabs, defab1, defab2;
double dres, epmach, erlarg=0.0, erlast, errbnd, errmax;
double error1, error2, erro12, errsum, ertest=0.0, oflow, resabs, reseps;
double res3la[4], rlist2[53], small=0.0, uflow;
Expand Down Expand Up @@ -863,10 +828,6 @@ int *last;

}





/*
* QUADPACK DQELG Routine converted to C
*/
Expand Down Expand Up @@ -928,7 +889,7 @@ int dqelg(int n, double epstab[], double *result, double *abserr, double res3la[



double delta1, delta2, delta3, d1mach();
double delta1, delta2, delta3;
double epmach, epsinf, error, err1, err2, err3, e0, e1, e1abs, e2, e3;
double oflow, res, ss, tol1, tol2, tol3;
int i, ib, ib2, ie, indx, k1, k2, k3, limexp, newelm, num;
Expand Down Expand Up @@ -1125,26 +1086,11 @@ int dqelg(int n, double epstab[], double *result, double *abserr, double res3la[

}





/*
* QUADPACK DQK21 Routine converted to C
*/
int dqk21(f, qpInfo, a, b, result, abserr, resabs, resasc)
double (*f)( double, _qpInfo *); /* The integrand function -- I.e. the function to integrate */
_qpInfo *qpInfo; /* Auxilliary information to pass to function (to avoid making globals) */
double a; /* Lower Limit of integration. */
double b; /* Upper limit of integration. */
double *result; /* The desired result. I.e. integral of f() from a to b */
double *abserr; /* Estimate of the modulus of the absolute error in the result */
Comment on lines -1136 to -1141

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And one more on comments to be preserved

double *resabs; /* */
double *resasc; /* */
{



int dqk21(double (*f)( double, _qpInfo *), _qpInfo* qpInfo, double a, double b,
double* result, double* abserr, double* resabs, double* resasc) {

/*
*
Expand Down Expand Up @@ -1200,18 +1146,11 @@ double *resasc; /* */
* end prologue dqk21
*/




double absc, centr, dhlgth, d1mach();
double absc, centr, dhlgth;
double epmach, fc, fsum, fval1, fval2, fv1[11], fv2[11], hlgth;
double resg, resk, reskh, uflow;
int j, jtw, jtwm1;





/*
* the abscissae and weights are given for the interval (-1,1).
* because of symmetry only the positive abscissae and their
Expand All @@ -1233,8 +1172,6 @@ double *resasc; /* */
* bell labs, nov. 1981.
*/



double wg[] = { 0.0,
0.066671344308688137593568809893332,
0.149451349150580593145776339657697,
Expand Down Expand Up @@ -1268,8 +1205,6 @@ double *resasc; /* */
0.147739104901338491374841515972068,
0.149445554002916905664936468389821 };



/*
*
* list of major variables
Expand All @@ -1292,9 +1227,6 @@ double *resasc; /* */
* uflow is the smallest positive magnitude.
*/




/*
* first executable statement dqk21
*/
Expand All @@ -1305,7 +1237,6 @@ double *resasc; /* */
hlgth = 0.5*(b-a);
dhlgth = fabs(hlgth);


/*
* compute the 21-point kronrod approximation to
* the integral, and estimate the absolute error.
Expand All @@ -1328,8 +1259,6 @@ double *resasc; /* */
*resabs += wgk[jtw]*(fabs(fval1)+fabs(fval2));
}



for (j = 1; j<=5; ++j) {
jtwm1 = 2*j-1;
absc = hlgth*xgk[jtwm1];
Expand All @@ -1342,8 +1271,6 @@ double *resasc; /* */
*resabs += wgk[jtwm1]*(fabs(fval1)+fabs(fval2));
}



reskh = resk*0.5;
*resasc = wgk[11]*fabs(fc-reskh);

Expand All @@ -1358,14 +1285,7 @@ double *resasc; /* */

if ( *resabs > uflow/(50.0*epmach) ) *abserr = dmax1( (epmach*50.0)*(*resabs), *abserr );




return(1);




}


Expand Down
2 changes: 1 addition & 1 deletion libLanlGeoMag/Lgm_QuadPack2.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ int *last;


double area, abseps, area1, area12, area2, a1;
double a2, b1, b2, correc=0.0, defabs, defab1, defab2, d1mach();
double a2, b1, b2, correc=0.0, defabs, defab1, defab2;
double dres, epmach, erlarg=0.0, erlast, errbnd, errmax;
double error1, error2, erro12, errsum, ertest=0.0, oflow, resabs, reseps;
double res3la[4], rlist2[53], small=0.0, uflow;
Expand Down
57 changes: 12 additions & 45 deletions libLanlGeoMag/Lgm_QuadPack3.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,13 @@
/*
* QUADPACK DQAGP Routine converted to C
*/
int dqagp(f, qpInfo, a, b, npts2, points, epsabs, epsrel, result, abserr, neval, ier, leniw, lenw, last, iwork, work, verbosity )
double (*f)( double, _qpInfo *); /* The integrand function -- I.e. the function to integrate */
_qpInfo *qpInfo; /* Auxilliary information to pass to function (to avoid making globals) */
double a; /* Lower Limit of integration. */
double b; /* Upper limit of integration. */
int npts2;
double *points;
double epsabs; /* Absolute accuracy requested. */
double epsrel; /* Relative accuracy requested. */
double *result; /* The desired result. I.e. integral of f() from a to b */
double *abserr; /* Estimate of the modulus of the absolute error in the result */
int *neval; /* The number of integrand evaluations performed. */
int *ier; /* Error flag. An error occurred if ier > 0. See below. */
Comment on lines -7 to -18

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments need preserving. Maybe doxygen docstring?

int leniw;
int lenw;
int *last;
int *iwork;
double *work;
int verbosity;
{


int dqagp(double (*f)( double, _qpInfo *), _qpInfo *qpInfo, double a, double b,
int npts2, double *points, double epsabs, double epsrel, double *result,
double *abserr, int *neval, int *ier, int leniw, int lenw, int *last,
int *iwork, double *work, int verbosity) {

/* BEGIN PROLOGUE DQAGP
* PURPOSE The routine calculates an approximation result to a given
* definite integral I = Integral of F over (A,B),
Expand Down Expand Up @@ -292,32 +277,14 @@ int verbosity;
/*
* QUADPACK DQAGPE Routine converted to C
*/
int dqagpe(f, qpInfo, a, b, npts2, points, epsabs, epsrel, limit, result, abserr, neval, ier, alist, blist, rlist, elist, pts, iord, level, ndin, last)
double (*f)( double, _qpInfo *); /* The integrand function -- I.e. the function to integrate */
_qpInfo *qpInfo; /* Auxilliary information to pass to function (to avoid making globals) */
double a; /* Lower Limit of integration. */
double b; /* Upper limit of integration. */
int npts2;
double *points;
double epsabs; /* Absolute accuracy requested. */
double epsrel; /* Relative accuracy requested. */
int limit;
double *result; /* The desired result. I.e. integral of f() from a to b */
double *abserr; /* Estimate of the modulus of the absolute error in the result */
int *neval; /* The number of integrand evaluations performed. */
int *ier; /* Error flag. An error occurred if ier > 0. See below. */
double *alist;
Comment on lines -296 to -309

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment preservation society.

double *blist;
double *rlist;
double *elist;
double *pts;
int *iord;
int *level;
int *ndin;
int *last;
{


int dqagpe(double (*f)( double, _qpInfo *), _qpInfo *qpInfo, double a, double b,
int npts2, double *points, double epsabs, double epsrel, int limit,
double *result, double *abserr, int *neval, int *ier, double *alist,
double *blist, double *rlist, double *elist, double *pts, int *iord,
int *level, int *ndin, int *last) {

/* BEGIN PROLOGUE DQAGPE
* PURPOSE Approximate a given definite integral I = Integral of F
* over (A,B), hopefully satisfying the accuracy claim:
Expand Down Expand Up @@ -522,7 +489,7 @@ int *last;


double area, abseps, area1, area12, area2, a1;
double a2, b1, b2, correc=0.0, defabs, defab1, defab2, d1mach();
double a2, b1, b2, correc=0.0, defabs, defab1, defab2;
double dres, epmach, erlarg=0.0, erlast, errbnd, errmax;
double error1, error2, erro12, errsum, ertest=0.0, oflow, resabs, reseps;
double res3la[4], rlist2[53], uflow;
Expand Down
Loading
Loading