Changeset 3228

Show
Ignore:
Timestamp:
12/15/11 17:03:34 (5 months ago)
Author:
erkn
Message:

checks for mcxtrace or mcstas

The calcualtion block of code now checks for the existance of
RESTORE_NEUTRON or RESTORE_XRAY. They are mutually exclusive and
available at compile time, so can be used as a flag for mcstas/mcxtrace.
This to avoid code duplication

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/share/monitor_nd-lib.c

    r3226 r3228  
    798798    } 
    799799    if (Vars->Flag_Auto_Limits != 2 || !Vars->Coord_Number) /* Vars->Flag_Auto_Limits == 0 (no auto limits/list) or 1 (store events into Buffer) */ 
    800 #if MCCODE_PARTICULE==neutron 
    801     {/*{{{*/ 
     800    { 
     801#if defined ( RESTORE_NEUTRON ) 
     802    /*{{{*/ 
    802803      /* automatically compute area and steradian solid angle when in AUTO mode */ 
    803804      /* compute the steradian solid angle incoming on the monitor */ 
     
    926927      } /* end for i */ 
    927928      While_End = 1; 
    928     }/* end else if Vars->Flag_Auto_Limits == 2 *//*}}}*/ 
    929 #elif MCCODE_PARTICULE==Xray 
     929      /*}}}*/     
     930#elif defined ( RESTORE_XRAY ) 
    930931      /* compute values - this is somewhat different for xrays in some cases.*/ 
    931     {/*{{{*/ 
     932      /*{{{*/ 
    932933      /* automatically compute area and steradian solid angle when in AUTO mode */ 
    933934      /* compute the steradian solid angle incoming on the monitor */ 
     
    941942      if (Vars->max_y < Vars->cy) Vars->max_y = Vars->cy; 
    942943      Vars->mean_p  += Vars->cp; 
    943       if (v) { 
    944         Vars->mean_dx += Vars->cp*fabs(Vars->cvx/v); 
    945         Vars->mean_dy += Vars->cp*fabs(Vars->cvy/v); 
     944      if (k) { 
     945        Vars->mean_dx += Vars->cp*fabs(Vars->ckx/k); 
     946        Vars->mean_dy += Vars->cp*fabs(Vars->cky/k); 
    946947      } 
    947948      Vars->area =(Vars->max_x-Vars->min_x) 
     
    10601061        } /* else will get Index later from Buffer when Flag_Auto_Limits == 2 */ 
    10611062      } /* end for i */ 
     1063      /*}}}*/ 
    10621064      While_End = 1; 
    1063     }/* end else if Vars->Flag_Auto_Limits == 2 *//*}}}*/ 
    10641065#endif 
     1066    }/* end else if Vars->Flag_Auto_Limits == 2 */ 
    10651067 
    10661068    if (Vars->Flag_Auto_Limits != 2) /* not when reading auto limits Buffer */