📄 getdp.y
字号:
{ Help("Help"); } | tHelp tSTRING tEND { Help($2); } | tCpu tEND { Msg(RESOURCES, ""); } | tCheck tEND { Print_ProblemStructure(&Problem_S); } | tCheck tGroup tEND { Print_Group(&Problem_S); } | tCheck tFunction tEND { Print_Expression(&Problem_S); } | tCheck tConstraint tEND { Print_Constraint(&Problem_S); } | tCheck tJacobian tEND { Print_Jacobian(&Problem_S); } | tCheck tIntegration tEND { Print_Integration(&Problem_S); } | tCheck tFunctionSpace tEND { Print_FunctionSpace(&Problem_S); } | tCheck tFormulation tEND { Print_Formulation(&Problem_S); } | tCheck tResolution tEND { Print_Resolution(&Problem_S); } | tCheck tPostProcessing tEND { Print_PostProcessing(&Problem_S); } | tCheck tPostOperation tEND { Print_PostOperation(&Problem_S); } | tCheck tINT tEND { Print_Object($2, &Problem_S); } | { PostOperation_S.Name = NULL ; PostOperation_S.AppendString = NULL ; PostOperation_S.Format = FORMAT_GMSH ; PostOperation_S.PostProcessingIndex = -1 ; PostSubOperation_S.Format = -1 ; } PostSubOperation { if(PostSubOperation_S.Format<0) PostSubOperation_S.Format = PostOperation_S.Format ; InteractivePostSubOperation_S = PostSubOperation_S ; InteractiveCompute = 1; } ;/* ------------------------------------------------------------------------ *//* G r o u p *//* ------------------------------------------------------------------------ */Groups : /* none */ | Groups Group ;Group : String__Index tDEF ReducedGroupRHS tEND { Add_Group(&Group_S, $1, 0, 0) ; } | tSTRING Index tDEF ReducedGroupRHS tEND { Add_Group(&Group_S, $1, 2, $2) ; }/* Patrick, temporary for compatibility with 'String__Index' syntax (19/01/2004) | String__Index DefineDimension tDEF*/ | tSTRING DefineDimension tDEF ReducedGroupRHS tEND { yyerror("Multi-fields {#.} are not used anymore. Use Loops For ... EndFor"); Add_Group(&Group_S, $1, 0, 0) ; } | tDefineGroup '[' DefineGroups ']' tEND | MovingBand2DGroup | String__Index '+' tDEF ReducedGroupRHS tEND { Add_Group_2(&Group_S, $1, 1, 0, 0, 0) ; } | Affectation | Loop ;MovingBand2DGroup : String__Index '[' FExpr ']' tDEF tMovingBand2D { Group_S.InitialList = List_Create( 1, 1, sizeof(int)) ; i = (int)$3 ; List_Add(Group_S.InitialList, &i) ; Group_S.Type = MOVINGBAND2D ; Group_S.FunctionType = REGION ; Group_S.InitialSuppList = NULL ; Group_S.SuppListType = SUPPLIST_NONE ; } '[' '#' ListOfRegion { Group_S.MovingBand2D = (struct MovingBand2D *)Malloc(sizeof(struct MovingBand2D)) ; Group_S.MovingBand2D->InitialList1 = $10 ; Group_S.MovingBand2D->ExtendedList1 = NULL ; Group_S.MovingBand2D->PhysNum = (int)$3 ; } ',' '#' ListOfRegion ',' FExpr ']' tEND { Group_S.MovingBand2D->InitialList2 = $14 ; Add_Group(&Group_S, $1, 0, 0) ; Group_S.MovingBand2D->Period2 = (int)$16 ; } ;ReducedGroupRHS : FunctionForGroup '[' ListOfRegionOrAll { Group_S.FunctionType = $1 ; switch (Group_S.FunctionType) { case ELEMENTSOF : Group_S.Type = ELEMENTLIST ; break ; default : Group_S.Type = REGIONLIST ; break ; } Group_S.InitialList = $3 ; } SuppListOfRegion ']' { Group_S.SuppListType = Type_SuppList ; Group_S.InitialSuppList = $5 ; $$ = -1 ; } /* shortcut: #list == Region[ list ] */ | '#' ListOfRegion { Group_S.FunctionType = REGION ; Group_S.Type = REGIONLIST ; Group_S.InitialList = $2 ; Group_S.SuppListType = SUPPLIST_NONE ; Group_S.InitialSuppList = NULL ; $$ = -1 ; } ;GroupRHS : ReducedGroupRHS { $$ = $1 ; } | String__Index { if ( !strcmp($1, "All") ) { $$ = -3; } else if ( (i = List_ISearchSeq(Problem_S.Group, $1, fcmp_Group_Name)) >= 0 ) { List_Read(Problem_S.Group, i, &Group_S) ; $$ = i ; } else { $$ = -2 ; vyyerror("Unknown Group: %s", $1) ; } Free($1) ; } ;GroupRHS_MultipleIndex : String__Index MultipleIndex { if (!Flag_MultipleIndex) { if ( (i = List_ISearchSeq(Problem_S.Group, $1, fcmp_Group_Name)) >= 0 ) List_Read(Problem_S.Group, i, &Group_S) ; $$ = i ; } else { List_Reset(ListOfInt_L) ; /* For list of multiple region */ for (k = 0 ; k < Nbr_Index ; k++) { sprintf(tmpstr, "%s_%d", $1, k+1) ; if ( (i = List_ISearchSeq(Problem_S.Group, tmpstr, fcmp_Group_Name)) < 0 ) { $$ = -2 ; vyyerror("Unknown Group: %s {%d}", $1, k+1) ; } else { if (k == 0) { List_Read(Problem_S.Group, i, &Group_S) ; $$ = i ; } } List_Add(ListOfInt_L, &i) ; } } Free($1) ; } ;FunctionForGroup : tRegion { $$ = REGION ; } | tSTRING { $$ = Get_DefineForString(FunctionForGroup_Type, $1, &FlagError) ; if (FlagError){ vyyerror("Unknown type of Function for Group: %s", $1); Get_Valid_SXD(FunctionForGroup_Type); } Free($1) ; } ;ListOfRegionOrAll : ListOfRegion { $$ = $1 ; } | tAll { $$ = NULL ; } ;SuppListOfRegion : /* none */ { Type_SuppList = SUPPLIST_NONE ; $$ = NULL ; } | Comma SuppListTypeForGroup ListOfRegion { Type_SuppList = $2 ; $$ = $3 ; } | Comma tInSupport String__Index { Type_SuppList = SUPPLIST_INSUPPORT ; if ( (i = List_ISearchSeq(Problem_S.Group, $3, fcmp_Group_Name)) >= 0 ) { if ( ((struct Group *)List_Pointer(Problem_S.Group, i))->Type == ELEMENTLIST ) { $$ = List_Create( 1, 5, sizeof(int)) ; List_Add($$, &i) ; } else vyyerror("Not a Support of Element Type: %s", $3) ; } else vyyerror("Unknown Region for Support: %s", $3) ; Free($3) ; } ;SuppListTypeForGroup : tSTRING { $$ = Get_DefineForString(FunctionForGroup_SuppList, $1, &FlagError) ; if (FlagError){ vyyerror("Unknown type of Supplementary Region: %s", $1); Get_Valid_SXD(FunctionForGroup_SuppList); } Free($1) ; } ;ListOfRegion : IRegion { $$ = List_Create(((List_Nbr($1) > 0)? List_Nbr($1) : 1), 5, sizeof(int)) ; for (i = 0 ; i < List_Nbr($1) ; i++) List_Add($$, (int *)List_Pointer($1, i) ) ; } | '{' RecursiveListOfRegion '}' { $$ = $2 ; } ;RecursiveListOfRegion : /* none */ { $$ = List_Create( 5, 5, sizeof(int)) ; } | RecursiveListOfRegion Comma IRegion { $$ = $1 ; for (i = 0 ; i < List_Nbr($3) ; i++) List_Add($$, (int *)List_Pointer($3, i) ) ; } | RecursiveListOfRegion Comma '-' IRegion { $$ = $1 ; for (i = 0 ; i < List_Nbr($4) ; i++) List_Suppress($$, (int *)List_Pointer($4, i), fcmp_int ) ; } ;IRegion : tINT { List_Reset(ListOfInt_L) ; List_Add($$ = ListOfInt_L, &($1)) ; } /* Add (.) to avoid conflicts */ | '(' FExpr ')' { i = (int)$2 ; List_Reset(ListOfInt_L) ; List_Add($$ = ListOfInt_L, &i) ; } | '@' RecursiveListOfFExpr '@' { List_Reset(ListOfInt_L) ; for(i=0 ; i<List_Nbr($2) ; i++) { List_Read($2, i, &d) ; j = (int)d ; List_Add(ListOfInt_L, &j) ; } $$ = ListOfInt_L; } | tINT tDOTS FExpr { List_Reset(ListOfInt_L) ; for(j=$1 ; ($1<$3)?(j<=$3):(j>=$3) ; ($1<$3)?j++:j--) List_Add(ListOfInt_L, &j) ; $$ = ListOfInt_L ; } /* Add (.) to avoid conflicts */ | '(' FExpr ')' tDOTS FExpr { List_Reset(ListOfInt_L) ; for(j=(int)$2 ; ($2<$5)?(j<=$5):(j>=$5) ; ($2<$5)?j++:j--) List_Add(ListOfInt_L, &j) ; $$ = ListOfInt_L ; } | tINT tDOTS FExpr tDOTS FExpr { List_Reset(ListOfInt_L) ; if(!(int)$5 || ($1<(int)$3 && (int)$5<0) || ($1>(int)$3 && (int)$5>0)){ vyyerror("Wrong increment in '%d : %d : %d'", $1, (int)$3, (int)$5) ; List_Add(ListOfInt_L, &($1)) ; } else for(j=$1 ; ((int)$5>0)?(j<=$3):(j>=$3) ; j+=(int)$5) List_Add(ListOfInt_L, &j) ; $$ = ListOfInt_L ; } /* Add (.) to avoid conflicts */ | '(' FExpr ')' tDOTS FExpr tDOTS FExpr { List_Reset(ListOfInt_L) ; if(!(int)$7 || ((int)$2<(int)$5 && (int)$7<0) || ((int)$2>(int)$5 && (int)$7>0)){ vyyerror("Wrong increment in '%d : %d : %d'", (int)$2, (int)$5, (int)$7) ; i = (int)$2 ; List_Add(ListOfInt_L, &i) ; } else for(j=(int)$2 ; ((int)$7>0)?(j<=(int)$5):(j>=(int)$5) ; j+=(int)$7) List_Add(ListOfInt_L, &j) ; $$ = ListOfInt_L ; } | String__Index { if ( (i = List_ISearchSeq(Problem_S.Group, $1, fcmp_Group_Name)) < 0 ) { /* Si ce n'est pas un nom de groupe, est-ce un nom de constante ? : */ Constant_S.Name = $1 ; if (!List_Query(ConstantTable_L, &Constant_S, fcmp_Constant)) { vyyerror("Unknown Constant: %s", $1) ; i = 0 ; List_Reset(ListOfInt_L) ; List_Add($$ = ListOfInt_L, &i) ; } else if (Constant_S.Type == VAR_FLOAT) { i = (int)Constant_S.Value.Float ; List_Reset(ListOfInt_L) ; List_Add($$ = ListOfInt_L, &i) ; } else if (Constant_S.Type == VAR_LISTOFFLOAT) { List_Reset($$ = ListOfInt_L) ; for(i=0 ; i<List_Nbr(Constant_S.Value.ListOfFloat) ; i++) { List_Read(Constant_S.Value.ListOfFloat, i, &d) ; j = (int)d ; List_Add(ListOfInt_L, &j) ; } } else { vyyerror("Unknown type of Constant: %s", $1) ; i = 0 ; List_Reset(ListOfInt_L) ; List_Add($$ = ListOfInt_L, &i) ; } } else /* Si c'est un nom de groupe : */ $$ = ((struct Group *)List_Pointer(Problem_S.Group, i))->InitialList ; Free($1) ; } ;DefineGroups : /* none */ | DefineGroups Comma tSTRING { if ( (i = List_ISearchSeq(Problem_S.Group, $3, fcmp_Group_Name)) < 0 ) { Group_S.Type = REGIONLIST ; Group_S.FunctionType = REGION ; Group_S.InitialList = ListDummy_L ; Group_S.SuppListType = SUPPLIST_NONE ; Group_S.InitialSuppList = NULL ; i = Add_Group(&Group_S, $3, 0, 0) ; } else Free($3) ; } | DefineGroups Comma tSTRING '{' FExpr '}' { for (k = 0 ; k < (int)$5 ; k++) { sprintf(tmpstr, "%s_%d", $3, k+1) ; if ( (i = List_ISearchSeq(Problem_S.Group, tmpstr, fcmp_Group_Name)) < 0 ) { Group_S.Type = REGIONLIST ; Group_S.FunctionType = REGION ; Group_S.SuppListType = SUPPLIST_NONE ; Group_S.InitialSuppList = NULL ; Group_S.InitialList = ListDummy_L ; Add_Group(&Group_S, $3, 2, k+1) ; } } Free($3) ; } ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -