Skip to content
9 changes: 5 additions & 4 deletions common/lib/share/mccode-r.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 <sys/timeb.h>
#include <sys/types.h>
#include <winsock2.h>
Expand Down Expand Up @@ -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
Expand All @@ -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 */
Expand All @@ -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 <direct.h>
#elif defined __GNUC__
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#endif
#define mkdir(a,b) mkdir(a)
#define getpid() _getpid()
Expand Down
3 changes: 3 additions & 0 deletions mcxtrace-comps/optics/Lens_parab.comp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
4 changes: 3 additions & 1 deletion mcxtrace-comps/optics/Lens_simple.comp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
3 changes: 2 additions & 1 deletion mcxtrace-comps/sources/Source_flat.comp
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down
Loading