From d8721bab06da520d9edb0a52af91b95e98b00a48 Mon Sep 17 00:00:00 2001 From: Maxim Yurkin Date: Mon, 25 Nov 2024 15:42:36 +0100 Subject: [PATCH] - spelling and formatting corrections throughout the code - replaces a few UTF-8 symbols --- src/calculator.c | 8 ++++---- src/chebyshev.c | 6 +++--- src/crosssec.c | 2 +- src/fft.c | 2 +- src/igt_so.c | 2 +- src/interaction.c | 2 +- src/iterative.c | 2 +- src/make_particle.c | 6 +++--- src/param.c | 2 +- src/sinint.c | 4 ++-- src/somnec.c | 35 +++++++++++------------------------ 11 files changed, 29 insertions(+), 42 deletions(-) diff --git a/src/calculator.c b/src/calculator.c index f130a4fa..cc9ced1d 100644 --- a/src/calculator.c +++ b/src/calculator.c @@ -480,13 +480,13 @@ static void CoupleConstant(doublecomplex *mrel,const enum incpol which,doublecom for (l=0; l < 3; l++) draineSum+=prop[l]*prop[l]*draine_precalc_data_array[draine_precalc_data_index].R3[R3_INDEX(i,l)]; - // L is obtaned in Eq.(62) + // L is obtained in Eq.(62) L=c1+mrel[0]*mrel[0]*c2*(1-3*prop[i]*prop[i])-mrel[0]*mrel[0]*c3*prop[i]*prop[i]-FOUR_PI*PI*I*nu/3- draine_precalc_data_array[draine_precalc_data_index].R1- (mrel[0]*mrel[0]-1)*draine_precalc_data_array[draine_precalc_data_index].R2[i]- 8*mrel[0]*mrel[0]*prop[i]*prop[i]* draine_precalc_data_array[draine_precalc_data_index].R3[R3_INDEX(i,i)]+4*mrel[0]*mrel[0]*draineSum; - // K is obtaned in Eq.(63) + // K is obtained in Eq.(63) K=c3+draine_precalc_data_array[draine_precalc_data_index].R1- 4*draine_precalc_data_array[draine_precalc_data_index].R2[i]+ 8*draine_precalc_data_array[draine_precalc_data_index].R3[R3_INDEX(i,i)]; @@ -541,8 +541,8 @@ static void CoupleConstant(doublecomplex *mrel,const enum incpol which,doublecom case POL_NLOC: // !!! additionally dynamic part should be added (if needed) /* Here the polarizability is derived from the condition that V_d*sum(G_h(ri))=-4pi/3, where sum is * taken over the whole lattice. Then M=4pi/3+V_d*Gh(0)=V_d*sum(G_h(ri),i!=0) - * Moreover, the regular part (in limit Rp->0) of Green's tensor automatically sums to zero, so only the - * irregular part need to be considered -h(r)*4pi/3, where h(r) is a normalized Gaussian + * Moreover, the regular part (in limit Rp->0) of Green's tensor automatically sums to zero, so only + * the irregular part need to be considered -h(r)*4pi/3, where h(r) is a normalized Gaussian */ if (polNlocRp==0) res[i]=polCM(mrel[i]); else res[i]=polM(FOUR_PI_OVER_THREE*ellTheta(SQRT1_2PI*gridspace/polNlocRp),mrel[i]); diff --git a/src/chebyshev.c b/src/chebyshev.c index fdd872ce..2444742b 100644 --- a/src/chebyshev.c +++ b/src/chebyshev.c @@ -110,7 +110,7 @@ static double Zmax(double e) tmp=e*(n2+1); if (tmp>=-1) res=1+e; /* two special cases for small n are based on direct solution of f'(x)=0; the formulae are self-derived but agree - * (for n=2) with A. Mugnai and W.J. Wiscombe, “Scattering of radiation by moderately nonspherical particles,” + * (for n=2) with A. Mugnai and W.J. Wiscombe, "Scattering of radiation by moderately nonspherical particles," * J. Atmos. Sci. 37, 1291-1307 (1980). */ else if (n==1) res=-1/(4*e); @@ -169,8 +169,8 @@ void ChebyshevParams(double eps_in,int n_in,double *dx,double *dz,double *sz,dou *dz=zmax-zmin; *sz=(zmax+zmin)/2; *dx=2*xmax; - /* determine volume fraction; the formula is self-derived but agrees with A. Mugnai and W.J. Wiscombe, “Scattering - * of radiation by moderately nonspherical particles,” J. Atmos. Sci. 37, 1291-1307 (1980). + /* determine volume fraction; the formula is self-derived but agrees with A. Mugnai and W.J. Wiscombe, "Scattering + * of radiation by moderately nonspherical particles," J. Atmos. Sci. 37, 1291-1307 (1980). */ tmp1=eps*eps/4; tmp2=1+6*tmp1*(4*n2-2)/(4*n2-1); diff --git a/src/crosssec.c b/src/crosssec.c index b496c226..e312a87d 100644 --- a/src/crosssec.c +++ b/src/crosssec.c @@ -216,7 +216,7 @@ static inline void ScanString(FILE * restrict file,const char * restrict fname,c */ { ReadLineStart(file,fname,buf,buf_size,start); - if (sscanf(buf+strlen(start),"%s",res)!=1) + if (sscanf(buf+strlen(start),"%s",res)!=1) // @suppress("Format String Vulnerability") LogError(ONE_POS,"Error reading value after '%s' in file '%s'",start,fname); /* More secure would be to put field width in format string above (like "%.Ns"), however this field width is * defined by the variable buf_size. The latter can only be implemented by a preliminary printf to get a format diff --git a/src/fft.c b/src/fft.c index a9a06437..93d69495 100644 --- a/src/fft.c +++ b/src/fft.c @@ -334,7 +334,7 @@ void TransposeYZ(const int direction) size_t enqtglobalzy[3]={gridZ,gridY,3*local_gridX}; size_t enqtglobalyz[3]={gridY,gridZ,3*local_gridX}; - //if the grid is not dividable by blocksize, extend it. Kernel takes care of borders + // if the grid is not divisible by blocksize, extend it. Kernel takes care of borders size_t tgridZ = (gridZ%blocksize==0) ? gridZ : (gridZ/blocksize+1)*blocksize; size_t tgridY = (gridY%blocksize==0) ? gridY : (gridY/blocksize+1)*blocksize; enqtglobalzy[0]=tgridZ; diff --git a/src/igt_so.c b/src/igt_so.c index 577460f0..70304902 100644 --- a/src/igt_so.c +++ b/src/igt_so.c @@ -160,7 +160,7 @@ static inline void InitIGTvars(const double rvec[static restrict 3],double qmunu doublecomplex_t result[static restrict 6],const double wave_num,const double ds_x,const double ds_y, const double ds_z,double *rr,double *invr3,double *kr,double *kr2,double *D,double *u,double *invvol,double *ds_x2, double *ds_y2,double *ds_z2,double *halfk2,double *invr,doublecomplex_t *expval,doublecomplex_t *ksi) -// initialize common variables, inluding point value of G +// initialize common variables, including point value of G { double qvec[3]; // scaled unit directional vector {rx,ry,rz}/r *invvol=1.0/ds_x/ds_y/ds_z; diff --git a/src/interaction.c b/src/interaction.c index a76f351d..50f728da 100644 --- a/src/interaction.c +++ b/src/interaction.c @@ -59,7 +59,7 @@ void (*ReflTerm_real)(const double qvec[static restrict 3],doublecomplex result[ extern const double ZsumShift; // defined and initialized in param.c extern const double igt_lim,igt_eps,nloc_Rp; -extern const bool InteractionRealArgs; +// extern const bool InteractionRealArgs; // used in fft.c int local_Nz_Rm; // number of local layers in Rmatrix, not greater than 2*boxZ-1 (also used in SPARSE) diff --git a/src/iterative.c b/src/iterative.c index 70244fa6..999dea61 100644 --- a/src/iterative.c +++ b/src/iterative.c @@ -183,7 +183,7 @@ static const char *Print_clBLAS_Errstring(clblasStatus err) static void Check_clBLAS_Err(const clblasStatus err,ERR_LOC_DECL) /* Checks error code for clBLAS calls and prints error if necessary. First searches among clBLAS specific errors. If not - * found, uses general error processing for CL calls (since clBLAS error codes can take standard cl values as well). + * found, uses general error processing for CL calls (since clBLAS error codes can take standard CL values as well). */ { if (err != clblasSuccess) { diff --git a/src/make_particle.c b/src/make_particle.c index 4eaac336..1b953999 100644 --- a/src/make_particle.c +++ b/src/make_particle.c @@ -1622,8 +1622,8 @@ void InitShape(void) /* determined by equation: (a/r)^2=1+nu*cos(theta)-(1-eps)cos^2(theta) or equivalently: * a^2=r^2+nu*r*z-(1-eps)z^2. Parameters must be 016) ib=1; @@ -902,20 +906,3 @@ static void test(double f1r,double f2r,double *tr,double f1i,double f2i,double * return; } - -//====================================================================================================================== - -static void abort_on_error(int why) -// print error and abort -// TODO: remove this function and move the code to the callers -{ - switch (why) { - case -6: - fprintf(stderr,"No convergence in gshank() - aborting. Try to increase MAXH in somnec.c and recompile\n"); - break; - case -7: - fprintf(stderr,"somnec.c: hankel not valid for z=0 - aborting\n"); - break; - } - exit(why); -}