Changeset 3302
- Timestamp:
- 02/02/12 19:09:43 (4 months ago)
- Location:
- trunk/xlib/share
- Files:
-
- 2 modified
-
monitor_nd-lib.c (modified) (11 diffs)
-
monitor_nd-lib.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/xlib/share/monitor_nd-lib.c
r3300 r3302 113 113 DEFS->COORD_FIL =4; /* next token is a filename */ 114 114 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 */ 116 116 DEFS->COORD_LOG =64; /* next variable will be in log scale */ 117 117 DEFS->COORD_ABS =128; /* next variable will be in abs scale */ … … 145 145 Vars->Coord_Number = 0; /* total number of variables to monitor, plus intensity (0) */ 146 146 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() */ 148 148 Vars->Buffer_Counter = 0; /* index in Buffer size (for realloc) */ 149 149 Vars->Buffer_Size = 0; … … 275 275 Set_Coord_Mode = DEFS->COORD_VAR; Flag_All = 0; 276 276 } 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 //} 282 282 283 283 /* now look for general option keywords */ … … 374 374 if (!strcmp(token, "kz")) 375 375 { 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; }382 376 if (!strcmp(token, "Ex")) 383 377 { Set_Vars_Coord_Type = DEFS->COORD_EX; strcpy(Set_Vars_Coord_Label,"Ex [1]"); strcpy(Set_Vars_Coord_Var,"Ex"); lmin = -1; lmax = 1; } … … 422 416 { Set_Vars_Coord_Type = DEFS->COORD_PHI; strcpy(Set_Vars_Coord_Label,"Latitude [deg]"); strcpy(Set_Vars_Coord_Var,"ph"); lmin = -180; lmax = 180; } 423 417 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; } 425 419 if (!strcmp(token, "user") || !strcmp(token, "user1") || !strcmp(token, "u1")) 426 420 { 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; } … … 528 522 strcpy(Short_Label[i],"Polarisation"); 529 523 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 else535 524 if ((Set_Vars_Coord_Type == DEFS->COORD_HDIV) 536 525 || (Set_Vars_Coord_Type == DEFS->COORD_VDIV)) … … 762 751 Vars->Buffer_Block = Vars->Buffer_Size; 763 752 Vars->Buffer_Counter = 0; 764 Vars-> Neutron_Counter = 0;753 Vars->Photon_Counter = 0; 765 754 } 766 755 else 767 756 { 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)); 769 758 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; } 772 761 } 773 762 } /* end if Buffer realloc */ … … 832 821 Vars->mean_dy += Vars->cp*fabs(Vars->cky/k); 833 822 } 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));839 823 840 824 for (i = 0; i <= Vars->Coord_Number; i++) … … 860 844 else 861 845 if (Set_Vars_Coord_Type == DEFS->COORD_KZ) XY = Vars->ckz; 862 else863 if (Set_Vars_Coord_Type == DEFS->COORD_SX) XY = Vars->csx;864 else865 if (Set_Vars_Coord_Type == DEFS->COORD_SY) XY = Vars->csy;866 else867 if (Set_Vars_Coord_Type == DEFS->COORD_SZ) XY = Vars->csz;868 846 else 869 847 if (Set_Vars_Coord_Type == DEFS->COORD_PHASE) XY = Vars->cphi; … … 959 937 for (i = 0; i <= Vars->Coord_Number; i++) 960 938 { 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]; 962 940 } 963 941 Vars->Buffer_Counter++; 964 942 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); 965 943 } 966 Vars-> Neutron_Counter++;944 Vars->Photon_Counter++; 967 945 } /* end (Vars->Flag_Auto_Limits != 2) */ 968 946 … … 1173 1151 char *formatName_orig; 1174 1152 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; 1178 1156 strcpy(fname,Vars->Mon_File); 1179 1157 if (strchr(Vars->Mon_File,'.') == NULL) strcat(fname, "_list"); -
trunk/xlib/share/monitor_nd-lib.h
r3300 r3302 41 41 int COORD_T ; 42 42 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 ; 46 46 int COORD_KX ; 47 47 int COORD_KY ;
