📄 getdp.y
字号:
} List_Add(Current_WholeQuantity_L, &WholeQuantity_S) ; List_Delete($3); } | tSTRING Quantity_Def { WholeQuantity_S.Type = WQ_OPERATORANDQUANTITY ; WholeQuantity_S.Case.OperatorAndQuantity.NbrArguments = 0 ; WholeQuantity_S.Case.OperatorAndQuantity.TypeQuantity = Get_DefineForString(QuantityFromFS_Type, $1, &FlagError) ; if (FlagError){ vyyerror("Unknown type of discrete Quantity: %s", $1); Get_Valid_SXD(QuantityFromFS_Type) ; } Free($1) ; WholeQuantity_S.Case.OperatorAndQuantity.TypeOperator = $2.Int1 ; WholeQuantity_S.Case.OperatorAndQuantity.Index = $2.Int2 ; switch(WholeQuantity_S.Case.OperatorAndQuantity.TypeQuantity) { case QUANTITY_DOF : if (Current_DofIndexInWholeQuantity == -1) Current_DofIndexInWholeQuantity = List_Nbr(Current_WholeQuantity_L) ; else if (Current_DofIndexInWholeQuantity == -2) vyyerror("Dof{} definition out of context") ; else vyyerror("More than one Dof definition in Expression") ; break ; case QUANTITY_NODOF : if (Current_DofIndexInWholeQuantity == -2) vyyerror("NoDof definition out of context") ; else if (Current_NoDofIndexInWholeQuantity == -1) Current_NoDofIndexInWholeQuantity = List_Nbr(Current_WholeQuantity_L) ; else vyyerror("More than one NoDof definition in Expression") ; break ; } List_Add(Current_WholeQuantity_L, &WholeQuantity_S) ; } | Quantity_Def { WholeQuantity_S.Type = WQ_OPERATORANDQUANTITY ; WholeQuantity_S.Case.OperatorAndQuantity.NbrArguments = 0 ; WholeQuantity_S.Case.OperatorAndQuantity.TypeQuantity = QUANTITY_SIMPLE ; WholeQuantity_S.Case.OperatorAndQuantity.TypeOperator = $1.Int1 ; WholeQuantity_S.Case.OperatorAndQuantity.Index = $1.Int2 ; List_Add(Current_WholeQuantity_L, &WholeQuantity_S) ; } | Quantity_Def ArgumentsForFunction { if($2!=1 && $2!=3 && $2!=4) vyyerror("Wrong number of arguments for discrete quantity evaluation (%d)", $2) ; WholeQuantity_S.Type = WQ_OPERATORANDQUANTITYEVAL ; WholeQuantity_S.Case.OperatorAndQuantity.NbrArguments = $2 ; WholeQuantity_S.Case.OperatorAndQuantity.TypeQuantity = QUANTITY_SIMPLE ; WholeQuantity_S.Case.OperatorAndQuantity.TypeOperator = $1.Int1 ; WholeQuantity_S.Case.OperatorAndQuantity.Index = $1.Int2 ; List_Add(Current_WholeQuantity_L, &WholeQuantity_S) ; } | tDt { Last_DofIndexInWholeQuantity = Current_DofIndexInWholeQuantity ; } '[' WholeQuantityExpression ']' { WholeQuantity_S.Type = WQ_TIMEDERIVATIVE ; WholeQuantity_S.Case.TimeDerivative.WholeQuantity = $4 ; List_Read(ListOfPointer_L, List_Nbr(ListOfPointer_L)-1, &Current_WholeQuantity_L) ; List_Add(Current_WholeQuantity_L, &WholeQuantity_S) ; if (Current_DofIndexInWholeQuantity != Last_DofIndexInWholeQuantity) vyyerror("Dof{} definition out of context") ; } | tAtAnteriorTimeStep { Last_DofIndexInWholeQuantity = Current_DofIndexInWholeQuantity ; } '[' WholeQuantityExpression ',' tINT ']' { WholeQuantity_S.Type = WQ_ATANTERIORTIMESTEP ; WholeQuantity_S.Case.AtAnteriorTimeStep.WholeQuantity = $4 ; WholeQuantity_S.Case.AtAnteriorTimeStep.TimeStep = $6 ; List_Read(ListOfPointer_L, List_Nbr(ListOfPointer_L)-1, &Current_WholeQuantity_L) ; List_Add(Current_WholeQuantity_L, &WholeQuantity_S) ; if (Current_DofIndexInWholeQuantity != Last_DofIndexInWholeQuantity) vyyerror("Dof{} definition out of context") ; } | tMHTransform '[' tSTRING '[' { Last_DofIndexInWholeQuantity = Current_DofIndexInWholeQuantity ; } WholeQuantityExpression ']' ']' '{' FExpr '}' { if ((i = List_ISearchSeq(Problem_S.Expression, $3,fcmp_Expression_Name)) < 0) vyyerror("Undefined function '%s' used in MHTransform", $3) ; if (Current_DofIndexInWholeQuantity != Last_DofIndexInWholeQuantity) vyyerror("Dof{} definition cannot be used in MHTransform") ; WholeQuantity_S.Type = WQ_MHTRANSFORM ; WholeQuantity_S.Case.MHTransform.Index = i ; WholeQuantity_S.Case.MHTransform.WholeQuantity = $6 ; WholeQuantity_S.Case.MHTransform.NbrPoints = (int)$10 ; List_Read(ListOfPointer_L, List_Nbr(ListOfPointer_L)-1, &Current_WholeQuantity_L) ; List_Add(Current_WholeQuantity_L, &WholeQuantity_S) ; } | tMHJacNL '[' tSTRING ']' '{' FExpr ',' FExpr '}' { if ((i = List_ISearchSeq(Problem_S.Expression, $3,fcmp_Expression_Name)) < 0) vyyerror("Undefined function '%s' used in MHJacNL", $3) ; WholeQuantity_S.Type = WQ_MHJACNL ; WholeQuantity_S.Case.MHJacNL.Index = i ; WholeQuantity_S.Case.MHJacNL.NbrPoints = (int)$6 ; WholeQuantity_S.Case.MHJacNL.FreqOffSet = (int)$8 ; List_Read(ListOfPointer_L, List_Nbr(ListOfPointer_L)-1, &Current_WholeQuantity_L) ; List_Add(Current_WholeQuantity_L, &WholeQuantity_S) ; } | tSolidAngle '[' Quantity_Def ']' { WholeQuantity_S.Type = WQ_SOLIDANGLE ; WholeQuantity_S.Case.OperatorAndQuantity.Index = $3.Int2 ; List_Add(Current_WholeQuantity_L, &WholeQuantity_S) ; } | tOrder '[' Quantity_Def ']' { WholeQuantity_S.Type = WQ_ORDER ; WholeQuantity_S.Case.OperatorAndQuantity.Index = $3.Int2 ; List_Add(Current_WholeQuantity_L, &WholeQuantity_S) ; } | tTrace { Last_DofIndexInWholeQuantity = Current_DofIndexInWholeQuantity ; } '[' WholeQuantityExpression ',' GroupRHS ']' { WholeQuantity_S.Type = WQ_TRACE ; WholeQuantity_S.Case.Trace.WholeQuantity = $4 ; WholeQuantity_S.Case.Trace.InIndex = Num_Group(&Group_S, "WQ_Trace_In", $6) ; if(Group_S.Type != ELEMENTLIST || Group_S.SuppListType != SUPPLIST_CONNECTEDTO) vyyerror("Group for Trace should be of Type 'ElementsOf[x, ConnectedTo y]'"); WholeQuantity_S.Case.Trace.DofIndexInWholeQuantity = -1 ; if (Current_DofIndexInWholeQuantity != Last_DofIndexInWholeQuantity){ for(i=0 ; i<List_Nbr($4) ; i++){ WholeQuantity_P = (struct WholeQuantity*)List_Pointer($4, i) ; if(WholeQuantity_P->Type == WQ_OPERATORANDQUANTITY) if(WholeQuantity_P->Case.OperatorAndQuantity.TypeQuantity == QUANTITY_DOF){ WholeQuantity_S.Case.Trace.DofIndexInWholeQuantity = i ; Current_DofIndexInWholeQuantity = -4 ; TypeOperatorDofInTrace = WholeQuantity_P->Case.OperatorAndQuantity.TypeOperator ; DefineQuantityIndexDofInTrace = WholeQuantity_P->Case.OperatorAndQuantity.Index ; } } if(Current_DofIndexInWholeQuantity != -4) vyyerror("Dof{} definition out of context in Trace operator"); } List_Read(ListOfPointer_L, List_Nbr(ListOfPointer_L)-1, &Current_WholeQuantity_L) ; List_Add(Current_WholeQuantity_L, &WholeQuantity_S) ; } | '<' tSTRING '>' '[' WholeQuantityExpression ']' { WholeQuantity_S.Type = WQ_CAST ; WholeQuantity_S.Case.Cast.WholeQuantity = $5 ; if ((i = List_ISearchSeq(Formulation_S.DefineQuantity, $2, fcmp_DefineQuantity_Name)) < 0) { if (!strcmp($2, "Real")) WholeQuantity_S.Case.Cast.NbrHar = 1 ; else if (!strcmp($2, "Complex")) WholeQuantity_S.Case.Cast.NbrHar = 2 ; else vyyerror("Unknown Cast: %s", $2) ; } else { WholeQuantity_S.Case.Cast.NbrHar = 0 ; WholeQuantity_S.Case.Cast.FunctionSpaceIndexForType = ((struct DefineQuantity *)List_Pointer(Formulation_S.DefineQuantity, i)) ->FunctionSpaceIndex ; } Free($2) ; List_Read(ListOfPointer_L, List_Nbr(ListOfPointer_L)-1, &Current_WholeQuantity_L) ; List_Add(Current_WholeQuantity_L, &WholeQuantity_S) ; } | '$' tSTRING { WholeQuantity_S.Type = WQ_CURRENTVALUE ; Get_PointerForString(Current_Value, $2, &FlagError, (void **)&WholeQuantity_S.Case.CurrentValue.Value) ; if (FlagError){ vyyerror("Unknown current value: $%s", $2); Get_Valid_SXP(Current_Value); } Free($2) ; List_Add(Current_WholeQuantity_L, &WholeQuantity_S) ; } /* a changer */ | '$' tTimeStep { WholeQuantity_S.Type = WQ_CURRENTVALUE ; Get_PointerForString(Current_Value, "TimeStep", &FlagError, (void **)&WholeQuantity_S.Case.CurrentValue.Value) ; List_Add(Current_WholeQuantity_L, &WholeQuantity_S) ; } | '$' tDTime { WholeQuantity_S.Type = WQ_CURRENTVALUE ; Get_PointerForString(Current_Value, "DTime", &FlagError, (void **)&WholeQuantity_S.Case.CurrentValue.Value) ; List_Add(Current_WholeQuantity_L, &WholeQuantity_S) ; } | '$' tINT { WholeQuantity_S.Type = WQ_ARGUMENT ; WholeQuantity_S.Case.Argument.Index = $2 ; List_Add(Current_WholeQuantity_L, &WholeQuantity_S) ; } | WholeQuantity_Single '#' tINT { WholeQuantity_S.Type = WQ_SAVEVALUE ; WholeQuantity_S.Case.SaveValue.Index = $3 - 1 ; List_Add(Current_WholeQuantity_L, &WholeQuantity_S) ; } | '#' tINT { WholeQuantity_S.Type = WQ_VALUESAVED ; WholeQuantity_S.Case.ValueSaved.Index = $2 - 1 ; List_Add(Current_WholeQuantity_L, &WholeQuantity_S) ; } | WholeQuantity_Single tSHOW FExpr { WholeQuantity_S.Type = WQ_SHOWVALUE ; WholeQuantity_S.Case.ShowValue.Index = (int)$3 ; List_Add(Current_WholeQuantity_L, &WholeQuantity_S) ; } ;ArgumentsForFunction : '[' '.' ']' { $$ = -1 ; } | '[' ']' { $$ = 0 ; } | '[' RecursiveListOfQuantity ']' { $$ = $2 ; } ;RecursiveListOfQuantity : WholeQuantity { $$ = 1 ; } | RecursiveListOfQuantity ',' WholeQuantity { $$ = $1 + 1 ; } ;ParametersForFunction : /* none */ { $$ = NULL; } | '{' RecursiveListOfFExpr '}' { $$ = $2; } | '{' tRegion '[' GroupRHS ']' '}' { /* Attention: provisoire. Note: Impossible a mettre dans MultiFExpr car conflit avec Affectation dans Group */ $$ = List_Create(2, 1, sizeof(double)) ; d = (double)Num_Group(&Group_S, "PA_Region", $4) ; List_Add($$, &d) ; } ;/* ------------------------------------------------------------------------ *//* J a c o b i a n M e t h o d *//* ------------------------------------------------------------------------ */JacobianMethods : /* none */ { if (!Problem_S.JacobianMethod) Problem_S.JacobianMethod = List_Create(5, 5, sizeof (struct JacobianMethod) ) ; } | JacobianMethods '{' JacobianMethod '}' { List_Add(Problem_S.JacobianMethod, &JacobianMethod_S) ; } ;JacobianMethod : /* none */ { JacobianMethod_S.Name = NULL ; JacobianMethod_S.JacobianCase = NULL ; } | JacobianMethod JacobianMethodTerm ;JacobianMethodTerm : tName tSTRING tEND { Check_NameOfStructNotExist("JacobianMethod", Problem_S.JacobianMethod, $2, fcmp_JacobianMethod_Name) ; JacobianMethod_S.Name = $2 ; } | tCase '{' JacobianCases '}' { JacobianMethod_S.JacobianCase = $3 ; } ;JacobianCases : /* none */ { $$ = List_Create(5, 5, sizeof (struct JacobianCase)) ; } | JacobianCases '{' JacobianCase '}' { List_Add($$ = $1, &JacobianCase_S) ; } ;JacobianCase : /* none */ { JacobianCase_S.RegionIndex = -1 ; JacobianCase_S.TypeJacobian = JACOBIAN_VOL ; } | JacobianCase JacobianCaseTerm ;JacobianCaseTerm : tRegion GroupRHS tEND { JacobianCase_S.RegionIndex = Num_Group(&Group_S, "JA_Region", $2) ; } | tRegion tAll tEND { JacobianCase_S.RegionIndex = -1 ; } | tJacobian tSTRING ParametersForFunction tEND { JacobianCase_S.TypeJacobian = Get_Define1NbrForString(Jacobian_Type, $2, &FlagError, &JacobianCase_S.NbrParameters) ; if (!FlagError) { if (JacobianCase_S.NbrParameters == -2 && (List_Nbr($3))%2 != 0) vyyerror("Wrong number of parameters for Jacobian '%s' (%d is not even)", $2, List_Nbr($3)) ; if (JacobianCase_S.NbrParameters < 0) JacobianCase_S.NbrParameters = List_Nbr($3); if (List_Nbr($3) == JacobianCase_S.NbrParameters) { if (JacobianCase_S.NbrParameters) { JacobianCase_S.Para = (double *)Malloc(JacobianCase_S.NbrParameters * sizeof(double)) ; for (i = 0 ; i < JacobianCase_S.NbrParameters ; i++) List_Read($3, i, &JacobianCase_S.Para[i]) ; } } else vyyerror("Wrong number of parameters for Jacobian '%s' (%d instead of %d)", $2, List_Nbr($3), JacobianCase_S.NbrParameters) ; } else{ vyyerror("Unknown type of Jacobian: %s", $2); Get_Valid_SXD1N(Jacobian_Type); } Free($2); List_Delete($3); } ;/* ------------------------------------------------------------------------ *//* I n t e g r a t i o n M e t h o d *//* ------------------------------------------------------------------------ */IntegrationMethods : /* none */ { if (!Problem_S.IntegrationMethod) Problem_S.IntegrationMethod = List_Create(5, 5, sizeof(struct IntegrationMethod)) ; } | IntegrationMethods '{' IntegrationMethod '}' { List_Add(Problem_S.IntegrationMethod, &IntegrationMethod_S) ; } ;IntegrationMethod : /* none */ { IntegrationMethod_S.Name = NULL ; IntegrationMethod_S.IntegrationCase = NULL ; IntegrationMethod_S.CriterionIndex = -1 ; } | IntegrationMethod IntegrationMethodTerm ;IntegrationMethodTerm : tName tSTRING tEND { Check_NameOfStructNotExist("IntegrationMethod", Problem_S.IntegrationMethod, $2, fcmp_IntegrationMethod_Name) ; IntegrationMethod_S.Name = $2 ; } | tCriterion Expression tEND { IntegrationMethod_S.CriterionIndex = $2 ; } | tCase '{' IntegrationCases '}' { IntegrationMethod_S.IntegrationCase = $3 ; } ;IntegrationCases : /* none */ { $$ = List_Create(5, 5, sizeof (struct IntegrationCase)) ; } | IntegrationCases '{' IntegrationCase '}' { List_Add($$ = $1, &IntegrationCase_S) ; } ;IntegrationCase :
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -