Exemple #1
0
int  c_prog(void)
{  
 int result;
    
 catalog=fopen(CATALOG_NAME "2","rb");
 if(catalog)
 { 
   int nin_=nin,nout_=nout, subproc_sq_=subproc_sq;
/*   archiv=fopen(ARCHIV_NAME "2","rb"); */
   diagrq=fopen(DIAGRQ_NAME "2","rb");
   menuq=fopen(MENUQ_NAME "2","rb");
   nin=1; nout=2;
   { char txt[100]; int ndel, ncalc, nrest;
     long recpos;
     for(subproc_sq=0;rd_menu(2,subproc_sq+1,txt,&ndel,&ncalc,&nrest,&recpos); subproc_sq++);
   }   
   outFileOpen("%sresults%cwidth_2.c",pathtouser,f_slash);
   labl();
   writeF("#include<math.h>\n");
   writeF("#include<stdio.h>\n");
   writeF("#include\"extern_2.h\"\n");                  
   writeF("#include\"num_out.h\"\n");
   writeF("#include\"num_in.h\"\n");

   result=c_prog_int(1);
   outFileClose();
   system("cd results; sed  s/_ext/_2/g width_2.c > width2.c; "
          "cat width2.c $CALCHEP/include/width_2+ > width_2.c; rm width2.c; "
          "mv extern.h extern_2.h");
            
   fclose(catalog);
   whichArchive(0,0,0);
   fclose(diagrq);
   fclose(menuq);
   nin=nin_; nout=nout_;
   subproc_sq=subproc_sq_;
 } else if(nin+nout>3) 
 { outFileOpen("%sresults%cwidth_2.c",pathtouser,f_slash);
   writeF("extern double width2_ext(char * pname);\n");
   writeF("double width2_ext(char * pname){return 0.;}\n");
   outFileClose();
 }
 catalog=fopen(CATALOG_NAME,"rb"); 
 diagrq=fopen(DIAGRQ_NAME,"rb");
 menuq=fopen(MENUQ_NAME,"rb");

 result=c_prog_int(0);
 fclose(catalog);
 whichArchive(0,0,0);
 
 fclose(diagrq);
 fclose(menuq);

 return result; 
}
Exemple #2
0
int  c_prog(void)
{  
 int result;

 catalog=fopen(CATALOG_NAME,"rb"); 
 diagrq=fopen(DIAGRQ_NAME,"rb");
 menuq=fopen(MENUQ_NAME,"rb");

 result=c_prog_int();
 fclose(catalog);
 whichArchive(0,0);
 
 fclose(diagrq);
 fclose(menuq);

 return result; 
}
Exemple #3
0
static int  alldiagrams(FILE * fd,  int nsub)
{  
   marktp     bh;
   varptr     totnum, totdenum, rnum;
   long       pos_c1,pos_c2; int deg1,deg2,tmpn1,tmpn2, nC;
   catrec     cr;
   deninforec dendescript;

   mark_(&bh); tmpNameMax=0; initinfo(); initdegnames();

   writeF("{\n");
   writeF("REAL N,D,R; COMPLEX Prop;\n");
   pos_c1= ftell(outFile); writeF("%70s\n","");   
   writeF("if(CalcConst) C%d(C);\n",nsub);

   while(FREAD1(dendescript,fd) == 1)
   {
      fseek(catalog,dendescript.cr_pos,SEEK_SET);
      FREAD1(cr,catalog); ++(diagrcount);
      if(!noPict)writpict(cr.ndiagr_ + inftmp->firstdiagpos - 1);
      whichArchive(cr.nFile,'r');
      fseek(archiv,cr.factpos,SEEK_SET);

      readvardef(archiv);
      readpolynom(&totnum);
      readpolynom(&totdenum);
      clearvardef();
   
      fseek(archiv,cr.rnumpos,SEEK_SET);

      readvardef(archiv);
      readpolynom(&rnum);
      clearvardef();
   
      fortwriter("N",totnum);
      fortwriter("D",totdenum);

      fortwriter("R",rnum);

      writeF("R*=(N/D);\n");
      if(nin+nout>3)
      {  writeF("Prop=1");
         writeDenominators(&dendescript);
         writeF("R*=creal(Prop);\n");
         writeF(" if(R>Fmax) Fmax=R; else if(R<-Fmax) Fmax=-R;\n");
      } else  writeF(";\n");
      if(!noCChain)calcColor(cr.ndiagr_+inftmp->firstdiagpos);
      writeF("ans+=R;\n");
   }   
   whichArchive(0,0);
   writeF("\n}\nreturn ans;\n}\n");

   deg1=cleardegnames();
   tmpn1=tmpNameMax;
   tmpNameMax=0;
   initdegnames();

   writeF("\nstatic void C%d(REAL*C)\n{\n",nsub); 
   writeF("  REAL* V=va_ext;\n");
   pos_c2= ftell(outFile); writeF("%70s\n","");   

   nC=write_const(); 
   if(nC==0) nC=1; 
   writeF("}\n");

   fseek(outFile,pos_c1,SEEK_SET); 
   writeF("static REAL C[%d];",nC); 
   if(deg1) writeF("REAL S[%d];",deg1);
   if(tmpn1) writeF("REAL tmp[%d];",tmpn1); 

 
   fseek(outFile,pos_c2,SEEK_SET);
   deg2=cleardegnames();
   tmpn2=tmpNameMax;
   if(deg2) writeF("REAL S[%d];",deg2) ;
   if(tmpn2) writeF("REAL tmp[%d];",tmpn2 );
   fseek(outFile,0,SEEK_END);

   release_(&bh);
   if( escpressed()) return 1; else return 0;
}
Exemple #4
0
static void  onediagram(deninforec* dendescript)
{  catrec      cr;
   marktp      bh;
   varptr      totnum, totdenum, rnum;
   long pos_c;
   int deg1,nConst;

   mark_(&bh);
   tmpNameMax=0;
   initinfo();
   initdegnames();
   
   fseek(catalog,dendescript->cr_pos,SEEK_SET);
   FREAD1(cr,catalog);
   ++(diagrcount);
   whichArchive(cr.nFile,'r');

   fseek(archiv,cr.factpos,SEEK_SET);
    
   readvardef(archiv);
   readpolynom(&totnum);
   readpolynom(&totdenum);
   clearvardef();
   
   fseek(archiv,cr.rnumpos,SEEK_SET);

   readvardef(archiv);
   readpolynom(&rnum);
   clearvardef();

   {  outFileOpen("%sresults%cf%d.c",pathtouser,f_slash,diagrcount);
      labl();
      writeF("#include\"num_out.h\"\n");
      writeF("#include\"num_in.h\"\n");   
   }
   writeF("extern FNN F%d_ext;\n",diagrcount);
   writeF("static void C%d(REAL * C)\n{\n",diagrcount);
   writeF("REAL* V=va_ext;\n");
   pos_c= ftell(outFile); writeF("%80s\n",""); 
   nConst=write_const();
   deg1=cleardegnames();       
   writeF("}\n"); 

   fseek(outFile,pos_c,SEEK_SET);
   if(deg1) writeF("REAL S[%d];",deg1);
   if(tmpNameMax) writeF("REAL tmp[%d];",tmpNameMax );                                

   fseek(outFile,0,SEEK_END);
   tmpNameMax=0;
   initdegnames();

   writeF("REAL F%d_ext(double GG,REAL*DP,REAL*Q0,COMPLEX*Q1,REAL*Q2)\n{\n",diagrcount);

   if(!noPict) writpict(cr.ndiagr_ + inftmp->firstdiagpos - 1);

   writeF("REAL N,D,R; COMPLEX Prop;\n");
   writeF("REAL * V=va_ext;\n");
   pos_c= ftell(outFile); writeF("%80s\n","");
  
   writeF("if(CalcConst) C%d(C);\n",diagrcount);
   
   fortwriter("N",totnum);
   fortwriter("D",totdenum);
   fortwriter("R",rnum);
   
   writeF("R*=(N/D);\n");
   writeF("Prop=1");
   writeDenominators(dendescript);
   writeF("R*=creal(Prop);\n");
   if(!noCChain)calcColor(cr.ndiagr_+inftmp->firstdiagpos);

   writeF(" return R;\n");  
   writeF("}\n");

   deg1=cleardegnames();
   if(nConst==0) nConst=1;
   fseek(outFile,pos_c,SEEK_SET);
   writeF("static REAL C[%d];",nConst);
   if(deg1) writeF("REAL S[%d];",deg1);
   if(tmpNameMax) writeF("REAL tmp[%d];",tmpNameMax );
   fseek(outFile,0,SEEK_END);
   outFileClose();
   release_(&bh);
}
Exemple #5
0
void  denominatorStatistic(int nsub, 
   int * n_swidth, int *n_twidth, int * n_0width, denlist * allDenominators, 
   FILE * fd)
{ 
   int i;
   catrec    cr;
   denlist    den_, den_tmp;
   deninforec   dendescript={0};
    
   (*n_swidth)  = 0;
   (*n_twidth)  = 0;
   (*n_0width) = 0;

   den_ =NULL;
   
   fseek(catalog,0,SEEK_SET);
   while (FREAD1(cr,catalog))
   {
      
      if (cr.nsub_ == nsub)
      { 
         whichArchive(cr.nFile,'r');
         dendescript.cr_pos = ftell(catalog) - sizeof(cr);

         fseek(archiv,cr.denompos,SEEK_SET);
         readDenominators();
         dendescript.tot_den=denrno; 

         for (i = 0; i < dendescript.tot_den; i++)
         {  
            dendescript.denarr[i].power=denom[i].power;
            dendescript.denarr[i].width=denom[i].width;
            den_tmp = den_;  
            while (den_tmp != NULL &&
              (  strcmp(denom[i].momStr,den_tmp->momStr)
              ||  denom[i].mass!=den_tmp->mass 
              ||  denom[i].width!=den_tmp->width ) ) den_tmp=den_tmp->next;
            if(den_tmp == NULL)
            {  
               den_tmp = (denlist)getmem_((unsigned)sizeof(denlistrec));
               den_tmp->next = den_;
               strcpy(den_tmp->momStr,denom[i].momStr);
               den_tmp->mass=denom[i].mass;
               den_tmp->width=denom[i].width;
               den_tmp->stype= stype(denom[i].momStr);
               den_ = den_tmp;
               if(denom[i].width) 
               { if(den_tmp->stype) den_tmp->order_num= ++(*n_swidth);
                         else       den_tmp->order_num= ++(*n_twidth);
               }  else              den_tmp->order_num= ++(*n_0width);
            }
            dendescript.denarr[i].order_num=den_tmp->order_num;
            dendescript.denarr[i].stype=den_tmp->stype;
         }      
         if(fd) FWRITE1(dendescript,fd);
      }  /* if CR.nsub_ =nsub */
   }
   
/*   if(ArchNum) fclose(archiv);  */
   whichArchive(0,0);
  *allDenominators=den_;
}