diff --git a/common/lib/share/mccode-r.h.in b/common/lib/share/mccode-r.h.in index ae3aa200f2..1f0552a07b 100644 --- a/common/lib/share/mccode-r.h.in +++ b/common/lib/share/mccode-r.h.in @@ -83,7 +83,7 @@ size_t str_len(const char *s); #ifndef _TIMES_H #define _TIMES_H -#ifdef _WIN32 +#if defined(WIN32) || defined(_WIN32) #include #include #include @@ -159,7 +159,7 @@ clock_t times (struct tms *__buffer) { # define NEED_STAT_H #endif -#ifdef WIN32 +#if defined(WIN32) || defined(_WIN32) # define NEED_STAT_H # define NEED_TYPES_H #endif @@ -173,7 +173,7 @@ clock_t times (struct tms *__buffer) { #endif #ifndef MC_PATHSEP_C -# ifdef WIN32 +#if defined(WIN32) || defined(_WIN32) # define MC_PATHSEP_C '\\' # define MC_PATHSEP_S "\\" # else /* !WIN32 */ @@ -182,12 +182,13 @@ clock_t times (struct tms *__buffer) { # endif /* !WIN32 */ #endif /* MC_PATHSEP_C */ -#ifdef WIN32 +#if defined(WIN32) || defined(_WIN32) #if defined _MSC_VER #include #elif defined __GNUC__ #include #include +#include #endif #define mkdir(a,b) mkdir(a) #define getpid() _getpid() diff --git a/mcxtrace-comps/optics/Lens_parab.comp b/mcxtrace-comps/optics/Lens_parab.comp index cb35b4af45..5f5961e816 100644 --- a/mcxtrace-comps/optics/Lens_parab.comp +++ b/mcxtrace-comps/optics/Lens_parab.comp @@ -63,6 +63,9 @@ SHARE double tx,ty,tz,tnorm,txn,tyn,tzn; double v,w; + /* Ensure initialisation of t-comps */ + tx=ty=tz=0; + for(i=0;i<=2;i++){ result.k[i]=k[i]=a.k[i]; result.coord[i]=p[i]=a.coord[i]; diff --git a/mcxtrace-comps/optics/Lens_simple.comp b/mcxtrace-comps/optics/Lens_simple.comp index 3f4834cdff..b5f1cf11d6 100644 --- a/mcxtrace-comps/optics/Lens_simple.comp +++ b/mcxtrace-comps/optics/Lens_simple.comp @@ -109,10 +109,12 @@ TRACE ABSORB; } + /* Initial calculation of k magnitude */ + k=sqrt(scalar_prod(kx,ky,kz,kx,ky,kz)); + /*change direction towards focal point*/ if(!f){ /*Focal length given by lambda and delta*/ - k=sqrt(scalar_prod(kx,ky,kz,kx,ky,kz)); e=K2E*k; f1=Table_Value(matT,e,1); diff --git a/mcxtrace-comps/sources/Source_flat.comp b/mcxtrace-comps/sources/Source_flat.comp index f3e26cca7c..14021f4457 100644 --- a/mcxtrace-comps/sources/Source_flat.comp +++ b/mcxtrace-comps/sources/Source_flat.comp @@ -158,7 +158,8 @@ TRACE rf = sqrt(dx*dx+dy*dy+dist*dist); /*pdir contains the unnormalized solid angle weighting */ p = pmul*pdir/(4*M_PI); - + /* Initial k-norm fallback-value */ + k=0; if (spectrum_file && strlen(spectrum_file) && strcmp(spectrum_file,"NULL")!=0){ double pp=0; //while (pp<=0){