@@ -245,7 +245,7 @@ void ProcessDiagram(EGraph *eg, void *ti)
245245//
246246// Now get the nodes
247247//
248- if ( ( info->flags & NONODES ) == 0 ) {
248+ if ( ( info->flags & WITHOUTNODES ) == 0 ) {
249249 for ( i = 0 ; i < eg->nNodes ; i++ ) {
250250//
251251// node_(number,coupling,particle_1(momentum_1),...,particle_n(momentum_n))
@@ -395,7 +395,7 @@ void ProcessDiagram(EGraph *eg, void *ti)
395395 startfill[1 ] = fill-startfill;
396396 }
397397 }
398- if ( ( info->flags & WITHONEPI ) == WITHONEPI ) {
398+ if ( ( info->flags & WITHONEPISETS ) == WITHONEPISETS ) {
399399 for ( i = 0 ; i < eg->econn ->nopic ; i++ ) {
400400 startfill = fill;
401401 *fill++ = ONEPI;
@@ -452,8 +452,6 @@ void ProcessDiagram(EGraph *eg, void *ti)
452452 *newterm = fill - newterm;
453453 AT.WorkPointer = fill;
454454
455- // MesPrint("<> %a",newterm[0],newterm);
456-
457455 Generator (BHEAD newterm,info->level );
458456 AT.WorkPointer = oldworkpointer;
459457}
@@ -479,6 +477,9 @@ Bool ProcessTopology(EGraph *eg, void *ti)
479477// return False; skip diagram generation (when asked for).
480478//
481479 TERMINFO *info = (TERMINFO *)ti;
480+
481+ // This seems to work properly. It was disabled before.
482+ #define WITHEARLYVETO
482483#ifdef WITHEARLYVETO
483484 if ( ( ( info->flags & CHECKEXTERN ) == CHECKEXTERN ) && info->currentMODEL != NULL ) {
484485 int i, j;
@@ -500,6 +501,7 @@ Bool ProcessTopology(EGraph *eg, void *ti)
500501 }
501502 }
502503#endif
504+
503505 if ( ( info->flags & TOPOLOGIESONLY ) == 0 ) {
504506 info->numtopo ++;
505507 return True;
@@ -664,7 +666,7 @@ Bool ProcessTopology(EGraph *eg, void *ti)
664666// startfill[1] = fill-startfill;
665667// }
666668 }
667- if ( ( info->flags & WITHONEPI ) == WITHONEPI ) {
669+ if ( ( info->flags & WITHONEPISETS ) == WITHONEPISETS ) {
668670 for ( i = 0 ; i < eg->econn ->nopic ; i++ ) {
669671 startfill = fill;
670672 *fill++ = ONEPI;
@@ -718,15 +720,39 @@ Bool ProcessTopology(EGraph *eg, void *ti)
718720 *newterm = fill - newterm;
719721 AT.WorkPointer = fill;
720722
721- // MesPrint("<> %a",*newterm,newterm);
722-
723723 Generator (BHEAD newterm,info->level );
724724 AT.WorkPointer = oldworkpointer;
725725 info->numtopo ++;
726726 return False;
727727}
728728
729729// #] ProcessTopology :
730+ // #[ SetDualOpts :
731+ void SetDualOpts (int *opt, const WORD num, const int key, const char * key_name,
732+ const int dual, const char * dual_name, const int val, const int dval) {
733+
734+ if ( ( num & key ) == key ) {
735+ if ( ( num & dual ) == dual ) {
736+ MLOCK (ErrorMessageLock);
737+ MesPrint (" &Conflicting diagram filters: %s and %s." , key_name, dual_name);
738+ MUNLOCK (ErrorMessageLock);
739+ Terminate (-1 );
740+ }
741+ else {
742+ *opt = val;
743+ }
744+ }
745+ else {
746+ if ( ( num & dual ) == dual ) {
747+ *opt = dval;
748+ }
749+ else {
750+ // The default value is always 0.
751+ *opt = 0 ;
752+ }
753+ }
754+ }
755+ // #] SetDualOpts :
730756// #[ GenDiagrams :
731757
732758int GenDiagrams (PHEAD WORD *term, WORD level)
@@ -780,48 +806,47 @@ int GenDiagrams(PHEAD WORD *term, WORD level)
780806
781807 opt->setOutAG (ProcessDiagram, &info);
782808 opt->setOutMG (ProcessTopology, &info);
783- // opt->setEndMG(fendMG, &info);
784809
785- opt->values [GRCC_OPT_1PI] = ( optionnumber & ONEPARTICLEIRREDUCIBLE ) == ONEPARTICLEIRREDUCIBLE;
786- opt->values [GRCC_OPT_NoTadpole] = ( optionnumber & NOTADPOLES ) == NOTADPOLES;
787- //
788- // Next are snails:
789- //
790- opt->values [GRCC_OPT_No1PtBlock] = ( optionnumber & NOTADPOLES ) == NOTADPOLES;
791- //
792- if ( ( optionnumber & WITHINSERTIONS ) == WITHINSERTIONS ) {
793- opt->values [GRCC_OPT_No2PtL1PI] = True;
794- opt->values [GRCC_OPT_NoAdj2PtV] = True;
795- opt->values [GRCC_OPT_No2PtL1PI] = True;
796- }
797- else {
798- opt->values [GRCC_OPT_NoAdj2PtV] = True;
799- }
800- opt->values [GRCC_OPT_SymmInitial] = ( optionnumber & WITHSYMMETRIZE ) == WITHSYMMETRIZE;
801- opt->values [GRCC_OPT_SymmFinal] = ( optionnumber & WITHSYMMETRIZE ) == WITHSYMMETRIZE;
802-
803- // opt->values[GRCC_OPT_Block] = ( optionnumber & WITHBLOCKS ) == WITHBLOCKS;
810+ opt->values [GRCC_OPT_SymmInitial] = ( optionnumber & WITHSYMMETRIZEI ) == WITHSYMMETRIZEI;
811+ opt->values [GRCC_OPT_SymmFinal] = ( optionnumber & WITHSYMMETRIZEF ) == WITHSYMMETRIZEF;
812+
813+ // WITHBLOCKS controls output formatting. We could introduce an extra filtering option
814+ // corresponding to GRCC_OPT_Block, which is somewhat like Qgraf "onevi" but not quite
815+ // the same currently.
816+ // opt->values[GRCC_OPT_Block] = ;
817+
818+ // Now the "qgraf-compatible filtering options":
819+ int qgopt[GRCC_QGRAF_OPT_Size];
820+ SetDualOpts (&qgopt[GRCC_QGRAF_OPT_ONEPI], optionnumber,ONEPARTI, " ONEPI_" , ONEPARTR, " ONEPR_" , 1 ,-1 );
821+ SetDualOpts (&qgopt[GRCC_QGRAF_OPT_ONSHELL], optionnumber,ONSHELL, " ONSHELL_" , OFFSHELL, " OFFSHELL_" , 1 ,-1 );
822+ SetDualOpts (&qgopt[GRCC_QGRAF_OPT_NOSIGMA], optionnumber,NOSIGMA, " NOSIGMA_" , SIGMA, " SIGMA_" , 1 ,-1 );
823+ SetDualOpts (&qgopt[GRCC_QGRAF_OPT_NOSNAIL], optionnumber,NOSNAIL, " NOSNAIL_" , SNAIL, " SNAIL_" , 1 ,-1 );
824+ SetDualOpts (&qgopt[GRCC_QGRAF_OPT_NOTADPOLE],optionnumber,NOTADPOLE," NOTADPOLE_" ,TADPOLE , " TADPOLE_" , 1 ,-1 );
825+ SetDualOpts (&qgopt[GRCC_QGRAF_OPT_SIMPLE], optionnumber,SIMPLE, " SIMPLE_" , NOTSIMPLE," NOTSIMPLE_" ,1 ,-1 );
826+ SetDualOpts (&qgopt[GRCC_QGRAF_OPT_BIPART], optionnumber,BIPART, " BIPART_" , NONBIPART," NONBIPART_" ,1 ,-1 );
827+ SetDualOpts (&qgopt[GRCC_QGRAF_OPT_CYCLI], optionnumber,CYCLI, " CYCLI_" , CYCLR, " CYCLR_" , 1 ,-1 );
828+ // Qgraf has a "notfloop" which we could also add, with a small modification to grcc.cc.
829+ qgopt[GRCC_QGRAF_OPT_FLOOP] = ( optionnumber & FLOOP ) == FLOOP;
830+ // Now set the options internally:
831+ opt->setQGrafOpt (qgopt);
804832
805833 opt->setOutputF (False," " );
806834 opt->setOutputP (False," " );
807835 opt->printLevel (babble);
808836
809- // opt->values[GRCC_OPT_Step] = GRCC_AGraph;
810-
811837// Load the various arrays.
812-
813- ninitl = Sets[inset].last - Sets[inset].first ;
814- for ( i = 0 ; i < ninitl; i++ ) {
815- x = SetElements[Sets[inset].first +i];
816- initlPart[i] = ConvertParticle (model,x);
838+ ninitl = Sets[inset].last - Sets[inset].first ;
839+ for ( i = 0 ; i < ninitl; i++ ) {
840+ x = SetElements[Sets[inset].first +i];
841+ initlPart[i] = ConvertParticle (model,x);
817842 info.legcouple [i] = m->vertices [numParticle (m,x)]->couplings ;
818- }
819- nfinal = Sets[outset].last - Sets[outset].first ;
820- for ( i = 0 ; i < nfinal; i++ ) {
821- x = SetElements[Sets[outset].first +i];
822- finalPart[i] = ConvertParticle (model,x);
843+ }
844+ nfinal = Sets[outset].last - Sets[outset].first ;
845+ for ( i = 0 ; i < nfinal; i++ ) {
846+ x = SetElements[Sets[outset].first +i];
847+ finalPart[i] = ConvertParticle (model,x);
823848 info.legcouple [i+ninitl] = m->vertices [numParticle (m,x)]->couplings ;
824- }
849+ }
825850 info.numextern = ninitl + nfinal;
826851 for ( i = 2 ; i <= MAXLEGS; i++ ) {
827852 if ( m->legcouple [i] == 1 ) {
@@ -850,16 +875,14 @@ Go_on:;
850875
851876 if ( ( info.flags & TOPOLOGIESONLY ) == 0 ) {
852877 while ( DistrN (nc,cpl,m->ncouplings ,scratch) ) {
853- proc = new Process (pid, model, opt,
854- ninitl, initlPart, nfinal, finalPart, cpl);
878+ proc = new Process (pid, model, opt, ninitl, initlPart, nfinal, finalPart, cpl);
855879 delete proc;
856880 info.numtopo = 1 ;
857881 }
858882 }
859883 else {
860884 cpl[0 ] = nc;
861- proc = new Process (pid, model, opt,
862- ninitl, initlPart, nfinal, finalPart, cpl);
885+ proc = new Process (pid, model, opt, ninitl, initlPart, nfinal, finalPart, cpl);
863886 delete proc;
864887 }
865888 M_free (scratch," DistrN" );
@@ -892,8 +915,7 @@ Go_on:;
892915/*
893916 And now the generation:
894917*/
895- proc = new Process (pid, model, opt,
896- ninitl, initlPart, nfinal, finalPart, cpl);
918+ proc = new Process (pid, model, opt, ninitl, initlPart, nfinal, finalPart, cpl);
897919 opt->end ();
898920 delete proc;
899921 delete opt;
@@ -1000,22 +1022,23 @@ int GenTopologies(PHEAD WORD *term, WORD level)
10001022
10011023 info.flags |= TOPOLOGIESONLY; // this is the topologies_ function after all.
10021024 if ( t1 < tstop && t1[0 ] == -SNUMBER ) {
1003- if ( ( t1[1 ] & NONODES ) == NONODES ) info.flags |= NONODES ;
1025+ if ( ( t1[1 ] & WITHOUTNODES ) == WITHOUTNODES ) info.flags |= WITHOUTNODES ;
10041026 if ( ( t1[1 ] & WITHEDGES ) == WITHEDGES ) info.flags |= WITHEDGES;
10051027 if ( ( t1[1 ] & WITHBLOCKS ) == WITHBLOCKS ) info.flags |= WITHBLOCKS;
1006- if ( ( t1[1 ] & WITHONEPI ) == WITHONEPI ) info.flags |= WITHONEPI;
1007- opt->values [GRCC_OPT_1PI] = ( t1[1 ] & ONEPARTICLEIRREDUCIBLE ) == ONEPARTICLEIRREDUCIBLE;
1008- // opt->values[GRCC_OPT_NoTadpole] = ( t1[1] & NOTADPOLES ) == NOTADPOLES;
1009- opt->values [GRCC_OPT_NoTadpole] = ( t1[1 ] & NOSNAILS ) == NOSNAILS;
1010- opt->values [GRCC_OPT_No1PtBlock] = ( t1[1 ] & NOTADPOLES ) == NOTADPOLES;
1011- opt->values [GRCC_OPT_NoExtSelf] = ( t1[1 ] & NOEXTSELF ) == NOEXTSELF;
1012-
1013- if ( ( t1[1 ] & WITHINSERTIONS ) == WITHINSERTIONS ) {
1014- opt->values [GRCC_OPT_No2PtL1PI] = True;
1015- opt->values [GRCC_OPT_NoAdj2PtV] = True;
1016- opt->values [GRCC_OPT_No2PtL1PI] = True;
1017- }
1018- opt->values [GRCC_OPT_SymmInitial] = ( t1[1 ] & WITHSYMMETRIZE ) == WITHSYMMETRIZE;
1028+ if ( ( t1[1 ] & WITHONEPISETS ) == WITHONEPISETS ) info.flags |= WITHONEPISETS;
1029+ opt->values [GRCC_OPT_1PI] = ( t1[1 ] & ONEPARTI ) == ONEPARTI;
1030+ // opt->values[GRCC_OPT_NoTadpole] = ( t1[1] & NOTADPOLE ) == NOTADPOLE;
1031+ opt->values [GRCC_OPT_NoTadpole] = ( t1[1 ] & NOSNAIL ) == NOSNAIL;
1032+ opt->values [GRCC_OPT_No1PtBlock] = ( t1[1 ] & NOTADPOLE ) == NOTADPOLE;
1033+ // opt->values[GRCC_OPT_NoExtSelf] = ( t1[1] & NOEXTSELF ) == NOEXTSELF;
1034+
1035+ // if ( ( t1[1] & WITHINSERTIONS ) == WITHINSERTIONS ) {
1036+ // opt->values[GRCC_OPT_No2PtL1PI] = True;
1037+ // opt->values[GRCC_OPT_NoAdj2PtV] = True;
1038+ // opt->values[GRCC_OPT_No2PtL1PI] = True;
1039+ // }
1040+ opt->values [GRCC_OPT_SymmInitial] = ( t1[1 ] & WITHSYMMETRIZEI ) == WITHSYMMETRIZEI;
1041+ opt->values [GRCC_OPT_SymmFinal] = ( t1[1 ] & WITHSYMMETRIZEF ) == WITHSYMMETRIZEF;
10191042 }
10201043
10211044 info.numdia = 0 ;
0 commit comments