Пример #1
0
int initStrFun(int mode )
{
  int l,i;
  int returnCode=0;

  if(nin_int!=2) return returnCode;
   
  if(mode<=0||mode>2)
  {
    sf_alpha=NULL;
    if(initStrFun(1)||initStrFun(2)) returnCode=2; 
    return returnCode;   
  }

  i=mode-1;
  l=sf_num[i];  
  if(l)
  {  long N;
     pinf_int(Nsub,i+1,NULL,&N); 
     l--;
     if(!strFun[l].myParticle(allInP(i+1))
         ||!strFun[l].init(i+1,sf_be+i,sf_mass+i))
     {  char txt[60];
        sprintf(txt,"%d-th Stucture function is switched OFF",i+1);
        sf_num[i]=0;
        messanykey(10,15,txt); 
        returnCode=2;
      }
  } else sf_be[i]=0;
    
  return returnCode;  
}
Пример #2
0
int loadStrFun(char *  name1, char*name2)
{ 
  int l, i,err=0;
  char *sf_txt[2];

  sf_txt[0]=name1;
  sf_txt[1]=name2;
  
  for(i=0;i<2;i++) sf_num[i]=0;
  for(i=0;i<2;i++)
  { int N; 
    pinf_int(Nsub,i+1,NULL,&N);
    for(l=0;l<MAXFUN;l++)
    if(strFun[l].myParticle(allInP(i+1))  && strFun[l].readName(i+1,sf_txt[i]))
    { sf_num[i] = l+1; 
      break; 
    }
  }
  
  for(i=0;i<2;i++) if(strcmp(sf_txt[i],"OFF") && sf_num[i]==0) err++;   
  err+=initStrFun(0);
  if(err) 
  { printf("ERROR in strfun\n");
    if(blind) exit(2);
  }  
  return 0;                                                                       
}
Пример #3
0
int initStrFun(int i1)
{
  int l,i=i1-1;
  
  nnan[i]=0;
  sf_be[i]=1;

  if(nin_int!=2) {sf_alpha[0]=NULL; sf_alpha[1]=NULL; return 0;}
   
  if(i1<=0|| i1>2)
  {
    sf_alpha[0]=NULL; sf_alpha[1]=NULL;
    return  initStrFun(1)||initStrFun(2);
  }

  i=i1-1;
  l=sf_num[i];  
  if(l)
  {
     l--;
     if(!strFun[l].myParticle(allInP(i+1))
         ||!strFun[l].init(i+1,sf_be+i,sf_mass+i))
     {  char txt[60];
        sprintf(txt,"%d-th Stucture function is switched OFF",i+1);
        sf_num[i]=0;
        messanykey(10,15,txt); 
        return 2;
      } 
  }
  return 0;  
}
Пример #4
0
int sf_menu(int i)
{
    int  k;
    char name[STRSIZ];
    int  nfun[MAXFUN];
    long N;
    char strmen[2+MAXFUN*(FUNLEN+1)];

    void * pscr =NULL;
    int mode,l;

    strmen[0]=FUNLEN+1;

    pinf_int(Nsub,i,NULL,&N);
    
    sprintf(strmen+1," %-*.*s",FUNLEN,FUNLEN,"OFF");

    k = 0;          
    for(l=0;l<MAXFUN;l++)
    {    
       if ( strFun[l].myParticle(allInP(i))  ) 
       {  
          nfun[k++] = l;
          strFun[l].fullName(i, name); 
	  sprintf(strmen+1+(FUNLEN+1)*k," %-*.*s",FUNLEN,FUNLEN,name);
       }
    }
    if(!k) 
    { messanykey(15,15,"Structure functions for this particle\n"
                       "are not known\n");
      return 0;
    }

    menu1(77-FUNLEN,7,"",strmen, "n_strfun", &pscr, &mode);
    if (mode == 0) return 0;
    put_text(&pscr);
    if (mode == 1) sf_num[i-1]=0;
    else
    {  int ok=strFun[nfun[mode - 2]].menu(i,allInP(i));
       if(ok) sf_num[i-1]=nfun[mode -2]+1; else{ sf_num[i-1]=0; return 0;}
    }
    return 1;
} /* sf_menu__ */
Пример #5
0
int loadStrFun(char *  name1, char*name2)
{ 
  int l, i;
  char *sf_txt[2];

  sf_txt[0]=name1;
  sf_txt[1]=name2;
  
  for(i=0;i<2;i++) sf_num[i]=0;
  for(i=0;i<2;i++)
  { long N; 
    pinf_int(Nsub,i+1,NULL,&N);
    for(l=0;l<MAXFUN;l++)
    if(strFun[l].myParticle(allInP(i+1))  && strFun[l].readName(i+1,sf_txt[i]))
    { sf_num[i] = l+1; 
      break; 
    }
  }
  initStrFun(0);
  return 0;                                                                       
}