コード例 #1
0
ファイル: math_out.c プロジェクト: cbpark/twoscale_softsusy
static void  emitexpression(catrec*  cr)
{ 
  int       i;

   seekArchiv(cr->factpos);
   readvardef(archiv);
   writeF("totFactor = ((");
   rewritepolynom();
   writeF(")/(");
   rewritepolynom();
   writeF("));"); writeF("\n");
   clearvardef();
   
   seekArchiv(cr->rnumpos);
   
   readvardef(archiv);
   writeF("numerator =(");rewritepolynom();writeF(");\n");
   clearvardef();
   seekArchiv(cr->denompos);
   readDenominators();

   writeF("denominator =");  
   for (i = 0; i < denrno; i++)
   {
      char momStr[20];
      if(i)  writeF("*"); else writeF("(");
      momentToString(denom[i].momStr,momStr);  
      writeF("propDen[%s,%s,%s]",momStr,vararr[denom[i].mass].alias,
                                        vararr[denom[i].width].alias);
      if(denom[i].power >1)  writeF("^%d",denom[i].power);
   }
   if(i) writeF(");\n"); else writeF("1;\n");
}
コード例 #2
0
ファイル: denominators.c プロジェクト: innisfree/superpy
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_;
}