Changeset 3301 for branches

Show
Ignore:
Timestamp:
02/02/12 19:08:43 (4 months ago)
Author:
erkn
Message:

found some bugs in porting

Location:
branches/mcxtrace-1.0/xlib/share
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/mcxtrace-1.0/xlib/share/monitor_nd-lib.c

    r3299 r3301  
    113113    DEFS->COORD_FIL    =4;    /* next token is a filename */ 
    114114    DEFS->COORD_EVNT   =5;    /* next token is a buffer size value */ 
    115     DEFS->COORD_3HE    =6;    /* next token is a 3He pressure value */ 
     115    //DEFS->COORD_3HE    =6;    /* next token is a 3He pressure value */ 
    116116    DEFS->COORD_LOG    =64;   /* next variable will be in log scale */ 
    117117    DEFS->COORD_ABS    =128;  /* next variable will be in abs scale */ 
     
    145145    Vars->Coord_Number      = 0;   /* total number of variables to monitor, plus intensity (0) */ 
    146146    Vars->Buffer_Block      = 10000;     /* Buffer size for list or auto limits */ 
    147     Vars->Neutron_Counter   = 0;   /* event counter, simulation total counts is mcget_ncount() */ 
     147    Vars->Photon_Counter   = 0;   /* event counter, simulation total counts is mcget_ncount() */ 
    148148    Vars->Buffer_Counter    = 0;   /* index in Buffer size (for realloc) */ 
    149149    Vars->Buffer_Size       = 0; 
     
    275275          Set_Coord_Mode = DEFS->COORD_VAR; Flag_All = 0; 
    276276        } 
    277         if (Set_Coord_Mode == DEFS->COORD_3HE)  /* pressure=%g */ 
    278         { 
    279             Vars->He3_pressure = atof(token); 
    280             Set_Coord_Mode = DEFS->COORD_VAR; Flag_All = 0; 
    281         } 
     277        //if (Set_Coord_Mode == DEFS->COORD_3HE)  /* pressure=%g */ 
     278        //{ 
     279        //    Vars->He3_pressure = atof(token); 
     280        //    Set_Coord_Mode = DEFS->COORD_VAR; Flag_All = 0; 
     281        //} 
    282282 
    283283        /* now look for general option keywords */ 
     
    374374        if (!strcmp(token, "kz")) 
    375375          { Set_Vars_Coord_Type = DEFS->COORD_KZ; strcpy(Set_Vars_Coord_Label,"kz [Angs-1]"); strcpy(Set_Vars_Coord_Var,"kz"); lmin = -10; lmax = 10; } 
    376         if (!strcmp(token, "sx")) 
    377           { Set_Vars_Coord_Type = DEFS->COORD_SX; strcpy(Set_Vars_Coord_Label,"sx [1]"); strcpy(Set_Vars_Coord_Var,"sx"); lmin = -1; lmax = 1; } 
    378         if (!strcmp(token, "sy")) 
    379           { Set_Vars_Coord_Type = DEFS->COORD_SY; strcpy(Set_Vars_Coord_Label,"sy [1]"); strcpy(Set_Vars_Coord_Var,"sy"); lmin = -1; lmax = 1; } 
    380         if (!strcmp(token, "sz")) 
    381           { Set_Vars_Coord_Type = DEFS->COORD_SZ; strcpy(Set_Vars_Coord_Label,"sz [1]"); strcpy(Set_Vars_Coord_Var,"sz"); lmin = -1; lmax = 1; } 
    382376        if (!strcmp(token, "Ex")) 
    383377          { Set_Vars_Coord_Type = DEFS->COORD_EX; strcpy(Set_Vars_Coord_Label,"Ex [1]"); strcpy(Set_Vars_Coord_Var,"Ex"); lmin = -1; lmax = 1; } 
     
    422416          { Set_Vars_Coord_Type = DEFS->COORD_PHI; strcpy(Set_Vars_Coord_Label,"Latitude [deg]"); strcpy(Set_Vars_Coord_Var,"ph"); lmin = -180; lmax = 180; } 
    423417        if (!strcmp(token, "ncounts") || !strcmp(token, "n")) 
    424           { Set_Vars_Coord_Type = DEFS->COORD_NCOUNT; strcpy(Set_Vars_Coord_Label,"Neutrons [1]"); strcpy(Set_Vars_Coord_Var,"n"); lmin = 0; lmax = 1e10; } 
     418          { Set_Vars_Coord_Type = DEFS->COORD_NCOUNT; strcpy(Set_Vars_Coord_Label,"Photons [1]"); strcpy(Set_Vars_Coord_Var,"n"); lmin = 0; lmax = 1e10; } 
    425419        if (!strcmp(token, "user") || !strcmp(token, "user1") || !strcmp(token, "u1")) 
    426420          { Set_Vars_Coord_Type = DEFS->COORD_USER1; strncpy(Set_Vars_Coord_Label,Vars->UserName1,30); strcpy(Set_Vars_Coord_Var,"U1"); lmin = -1e10; lmax = 1e10; } 
     
    528522        strcpy(Short_Label[i],"Polarisation"); 
    529523      else 
    530       if ((Set_Vars_Coord_Type == DEFS->COORD_SX) 
    531        || (Set_Vars_Coord_Type == DEFS->COORD_SY) 
    532        || (Set_Vars_Coord_Type == DEFS->COORD_SZ)) 
    533        strcpy(Short_Label[i],"Spin"); 
    534       else 
    535524      if ((Set_Vars_Coord_Type == DEFS->COORD_HDIV) 
    536525       || (Set_Vars_Coord_Type == DEFS->COORD_VDIV)) 
     
    762751      Vars->Buffer_Block = Vars->Buffer_Size; 
    763752      Vars->Buffer_Counter  = 0; 
    764       Vars->Neutron_Counter = 0; 
     753      Vars->Photon_Counter = 0; 
    765754    } 
    766755    else 
    767756    { 
    768       Vars->Mon2D_Buffer  = (double *)realloc(Vars->Mon2D_Buffer, (Vars->Coord_Number+1)*(Vars->Neutron_Counter+Vars->Buffer_Block)*sizeof(double)); 
     757      Vars->Mon2D_Buffer  = (double *)realloc(Vars->Mon2D_Buffer, (Vars->Coord_Number+1)*(Vars->Photon_Counter+Vars->Buffer_Block)*sizeof(double)); 
    769758      if (Vars->Mon2D_Buffer == NULL) 
    770             { printf("Monitor_nD: %s cannot reallocate Vars->Mon2D_Buffer[%li] (%li). Skipping.\n", Vars->compcurname, i, (Vars->Neutron_Counter+Vars->Buffer_Block)*sizeof(double)); Vars->Flag_List = 1; } 
    771       else { Vars->Buffer_Counter = 0; Vars->Buffer_Size = Vars->Neutron_Counter+Vars->Buffer_Block; } 
     759            { printf("Monitor_nD: %s cannot reallocate Vars->Mon2D_Buffer[%li] (%li). Skipping.\n", Vars->compcurname, i, (Vars->Photon_Counter+Vars->Buffer_Block)*sizeof(double)); Vars->Flag_List = 1; } 
     760      else { Vars->Buffer_Counter = 0; Vars->Buffer_Size = Vars->Photon_Counter+Vars->Buffer_Block; } 
    772761    } 
    773762  } /* end if Buffer realloc */ 
     
    832821        Vars->mean_dy += Vars->cp*fabs(Vars->cky/k); 
    833822      } 
    834       Vars->area =(Vars->max_x-Vars->min_x) 
    835                        *(Vars->max_y-Vars->min_y)*1E4; /* cm2 */ 
    836       if (Vars->Flag_per_st) 
    837       Vars->steradian = 2*fabs(2*atan(Vars->mean_dx/Vars->mean_p) 
    838                                 *sin(2*atan(Vars->mean_dy/Vars->mean_p)/2)); 
    839823         
    840824      for (i = 0; i <= Vars->Coord_Number; i++) 
     
    860844        else 
    861845        if (Set_Vars_Coord_Type == DEFS->COORD_KZ) XY = Vars->ckz; 
    862         else 
    863         if (Set_Vars_Coord_Type == DEFS->COORD_SX) XY = Vars->csx; 
    864         else 
    865         if (Set_Vars_Coord_Type == DEFS->COORD_SY) XY = Vars->csy; 
    866         else 
    867         if (Set_Vars_Coord_Type == DEFS->COORD_SZ) XY = Vars->csz; 
    868846        else 
    869847        if (Set_Vars_Coord_Type == DEFS->COORD_PHASE) XY = Vars->cphi; 
     
    959937        for (i = 0; i <= Vars->Coord_Number; i++) 
    960938        { 
    961           Vars->Mon2D_Buffer[i + Vars->Neutron_Counter*(Vars->Coord_Number+1)] = Coord[i]; 
     939          Vars->Mon2D_Buffer[i + Vars->Photon_Counter*(Vars->Coord_Number+1)] = Coord[i]; 
    962940        } 
    963941        Vars->Buffer_Counter++; 
    964942        if (Vars->Flag_Verbose && (Vars->Buffer_Counter >= Vars->Buffer_Block) && (Vars->Flag_List == 1)) printf("Monitor_nD: %s %li neutrons stored in List.\n", Vars->compcurname, Vars->Buffer_Counter); 
    965943      } 
    966       Vars->Neutron_Counter++; 
     944      Vars->Photon_Counter++; 
    967945    } /* end (Vars->Flag_Auto_Limits != 2) */ 
    968946 
     
    11731151        char *formatName_orig; 
    11741152 
    1175         if (Vars->Flag_List >= 2) Vars->Buffer_Size = Vars->Neutron_Counter; 
    1176         if (Vars->Buffer_Size >= Vars->Neutron_Counter) 
    1177           Vars->Buffer_Size = Vars->Neutron_Counter; 
     1153        if (Vars->Flag_List >= 2) Vars->Buffer_Size = Vars->Photon_Counter; 
     1154        if (Vars->Buffer_Size >= Vars->Photon_Counter) 
     1155          Vars->Buffer_Size = Vars->Photon_Counter; 
    11781156        strcpy(fname,Vars->Mon_File); 
    11791157        if (strchr(Vars->Mon_File,'.') == NULL) strcat(fname, "_list"); 
  • branches/mcxtrace-1.0/xlib/share/monitor_nd-lib.h

    r3299 r3301  
    4141    int COORD_T     ; 
    4242    int COORD_P     ; 
    43     int COORD_SX    ; 
    44     int COORD_SY    ; 
    45     int COORD_SZ    ; 
     43    int COORD_EX    ; 
     44    int COORD_EY    ; 
     45    int COORD_EZ    ; 
    4646    int COORD_KX    ; 
    4747    int COORD_KY    ;