Skip to content

Commit e501efc

Browse files
committed
Some devops things to remove compiler warnings; disable NumPy deprecated API warning which comes from Cython. Fix unused function warning which results from precompilation of a header file in Cython but which needs to be built into the library
1 parent f5f35a6 commit e501efc

File tree

5 files changed

+229
-221
lines changed

5 files changed

+229
-221
lines changed

fidimag/common/dipolar/demag_oommf.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,10 @@ double SelfDemagNx(double x,double y,double z)
131131
// Note: egcs-2.91.57 on Linux/x86 with -O1 mangles this
132132
// function (produces NaN's) unless we manually group terms.
133133

134-
if(x<=0.0 || y<=0.0 || z<=0.0) return 0.0;
135-
if(x==y && y==z) return 1./3.; // Special case: cube
134+
if(x<=0.0 || y<=0.0 || z<=0.0)
135+
return 0.0;
136+
if (x==y && y==z)
137+
return 1./3.; // Special case: cube
136138

137139
double xsq=x*x,ysq=y*y,zsq=z*z;
138140
double diag=sqrt(xsq+ysq+zsq);
@@ -283,14 +285,19 @@ Newell_g(double x,double y,double z)
283285
// handle if t=y/x (for example) as x -> 0.
284286

285287
double result_sign=1.0;
286-
if(x<0.0) result_sign *= -1.0; if(y<0.0) result_sign *= -1.0;
288+
if(x<0.0)
289+
result_sign *= -1.0;
290+
if(y<0.0)
291+
result_sign *= -1.0;
287292
x=fabs(x); y=fabs(y); z=fabs(z); // This function is even in z and
288293
/// odd in x and y. The fabs()'s simplify special case handling.
289294

290295
double xsq=x*x,ysq=y*y,zsq=z*z;
291296
double R=xsq+ysq+zsq;
292-
if(R<=0.0) return 0.0;
293-
else R=sqrt(R);
297+
if(R<=0.0)
298+
return 0.0;
299+
else
300+
R=sqrt(R);
294301

295302
// g(x,y,z)
296303
double piece[7];
@@ -320,8 +327,7 @@ Newell_g(double x,double y,double z)
320327
return result_sign*AccurateSum(piececount,piece)/6.;
321328
}
322329

323-
double
324-
CalculateSDA01(double x,double y,double z,
330+
double CalculateSDA01(double x,double y,double z,
325331
double l,double h,double e)
326332
{ // This is Nxy*(4*PI*tau) in Newell's paper.
327333

fidimag/common/dipolar/demagcoef.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ double DemagNxzAsymptotic(double x, double y, double z,
129129
double DemagNyzAsymptotic(double x, double y, double z,
130130
double dx,double dy,double dz);
131131

132+
133+
132134
////////////////////////////////////////////////////////////////////////////
133135
// Routines to do accurate summation
134136

@@ -143,7 +145,7 @@ static int AS_Compare(const void* px,const void* py)
143145
}
144146

145147

146-
static double
148+
static double
147149
AccurateSum(int n,double *arr)
148150
{
149151
// Order by decreasing magnitude

0 commit comments

Comments
 (0)