📄 pos_print.c
字号:
NULL, 0., 0., 0., &Value) ; Current.z = Value.Val[0]; Normal[0] = Current.a ; Normal[1] = Current.b ; Normal[2] = Current.c ; LETS_PRINT_THE_RESULT ; } if(List_Nbr(PSO_P->Case.OnParamGrid.ParameterValue[2])>1 && !Flag_BIN) fprintf(PostStream, "\n"); } if(List_Nbr(PSO_P->Case.OnParamGrid.ParameterValue[1])>1 && !Flag_BIN) fprintf(PostStream, "\n\n"); /* two blanks lines for -index in gnuplot */ } break; } Destroy_PostElement(PE) ; Format_PostFooter(PSO_P, 0); if(CPQ_P) Free(CumulativeValues); GetDP_End ;}#undef LETS_PRINT_THE_RESULT#undef LETS_STORE_THE_RESULT#undef ARRAY/* ------------------------------------------------------------------------ *//* P o s _ P r i n t O n R e g i o n *//* ------------------------------------------------------------------------ */void Pos_PrintOnRegion(struct PostQuantity *NCPQ_P, struct PostQuantity *CPQ_P, int Order, struct DefineQuantity *DefineQuantity_P0, struct QuantityStorage *QuantityStorage_P0, struct PostSubOperation *PostSubOperation_P) { struct Element Element ; struct Value Value, ValueSummed ; struct PostQuantity *PQ_P ; struct Group * Group_P ; List_T *Region_L, *Support_L ; int i, iTime, NbrTimeStep ; int Nbr_Region=0, Num_Region, Group_FunctionType ; int Flag_Summation=0, Type_Evaluation=0; double u, v, w; GetDP_Begin("Pos_PrintOnRegion"); NbrTimeStep = Pos_InitTimeSteps(PostSubOperation_P); if (CPQ_P && NCPQ_P) Msg(GERROR, "Only one PostProcessing Quantity allowed in PostOperation") ; if (CPQ_P) { PQ_P = CPQ_P ; Support_L = /* for e.g. PQ[ Support ] ... */ ((struct Group *) List_Pointer(Problem_S.Group, PostSubOperation_P->PostQuantitySupport[Order]))->InitialList ; } else { PQ_P = NCPQ_P ; Support_L = NULL ; } Format_PostHeader(PostSubOperation_P->Format, PostSubOperation_P->Iso, NbrTimeStep, PostSubOperation_P->HarmonicToTime, PostSubOperation_P->CombinationType, Order, NCPQ_P?NCPQ_P->Name:NULL, CPQ_P?CPQ_P->Name:NULL); Group_P = (PostSubOperation_P->Case.OnRegion.RegionIndex < 0)? NULL : (struct Group *) List_Pointer(Problem_S.Group, PostSubOperation_P->Case.OnRegion.RegionIndex); Region_L = Group_P? Group_P->InitialList : NULL ; Group_FunctionType = Group_P? Group_P->FunctionType : REGION; if (!Support_L && List_Nbr(NCPQ_P->PostQuantityTerm) && ( ((struct PostQuantityTerm *)List_Pointer(NCPQ_P->PostQuantityTerm, 0)) ->Type == LOCALQUANTITY && ((struct PostQuantityTerm *)List_Pointer(NCPQ_P->PostQuantityTerm, 0)) ->EvaluationType == LOCAL) ) { if (Group_FunctionType == REGION) Msg(GERROR, "Print OnRegion not valid for PostProcessing Quantity '%s'", NCPQ_P->Name); else Type_Evaluation = LOCAL; } else Type_Evaluation = GLOBAL; if (Region_L) { if (Group_P->FunctionType == REGION) { List_Sort(Region_L, fcmp_int) ; Nbr_Region = List_Nbr(Region_L) ; if (PostSubOperation_P->Format != FORMAT_SPACE_TABLE) { fprintf(PostStream, "# %s on", PQ_P->Name) ; for(i = 0 ; i < Nbr_Region ; i++) { List_Read(Region_L, i, &Num_Region) ; fprintf(PostStream, " %d", Num_Region) ; } fprintf(PostStream, "\n") ; } } else if (Group_P->FunctionType == NODESOF) { if (!Group_P->ExtendedList) Generate_ExtendedGroup(Group_P) ; Region_L = Group_P->ExtendedList ; /* Attention: new Region_L */ Nbr_Region = List_Nbr(Region_L) ; if (PostSubOperation_P->Comma) /* Provisoire */ Flag_Summation = 1; } else { Msg(GERROR, "Function type (%d) not allowed for PrintOnRegion", Group_P->FunctionType) ; } } else Nbr_Region = 1 ; if (Type_Evaluation == LOCAL) Init_SearchGrid(&Current.GeoData->Grid) ; for (iTime = 0 ; iTime < NbrTimeStep ; iTime++) { Pos_InitAllSolutions(PostSubOperation_P->TimeStep_L, iTime) ; if (Flag_Summation) { Cal_ZeroValue(&ValueSummed) ; } for(i = 0 ; i < Nbr_Region ; i++) { if (Region_L) List_Read(Region_L, i, &Num_Region) ; else Num_Region = NO_REGION ; Current.SubRegion = Num_Region ; /* Region being a GlobalQuantity Entity no */ Current.NumEntity = Num_Region ; /* for OnRegion NodesOf */ Element.GeoElement = NULL ; Element.Num = NO_ELEMENT ; Element.Type = -1 ; Current.Region = Element.Region = Num_Region ; Current.x = Current.y = Current.z = 0. ; if (Type_Evaluation == GLOBAL) { Cal_PostQuantity(PQ_P, DefineQuantity_P0, QuantityStorage_P0, Support_L, &Element, 0., 0., 0., &Value) ; } else { if (Group_FunctionType == NODESOF) Geo_GetNodesCoordinates(1, &Num_Region, &Current.x, &Current.y, &Current.z) ; InWhichElement(Current.GeoData->Grid, NULL, &Element, PostSubOperation_P->Dimension, Current.x, Current.y, Current.z, &u, &v, &w) ; Cal_PostQuantity(PQ_P, DefineQuantity_P0, QuantityStorage_P0, Support_L, &Element, u, v, w, &Value) ; } if (PostSubOperation_P->StoreInRegister >= 0) Cal_StoreInRegister(&Value, PostSubOperation_P->StoreInRegister) ; Format_PostValue(PostSubOperation_P->Format, PostSubOperation_P->Comma, Group_FunctionType, Current.Time, i, Current.NumEntity, Nbr_Region, Current.NbrHar, PostSubOperation_P->HarmonicToTime, PostSubOperation_P->NoNewLine, &Value) ; if (Flag_Summation) { ValueSummed.Type = Value.Type ; Cal_AddValue(&ValueSummed, &Value, &ValueSummed); } } if (Flag_Summation && PostSubOperation_P->Format == FORMAT_REGION_TABLE) { fprintf(PostStream, "#Sum: ") ; Print_Value(&ValueSummed); fprintf(PostStream, "\n") ; } } Format_PostFooter(PostSubOperation_P, 0); GetDP_End ;}/* ------------------------------------------------------------------------ *//* P o s _ P r i n t W i t h A r g u m e n t *//* ------------------------------------------------------------------------ */void Pos_PrintWithArgument(struct PostQuantity *NCPQ_P, struct PostQuantity *CPQ_P, int Order, struct DefineQuantity *DefineQuantity_P0, struct QuantityStorage *QuantityStorage_P0, struct PostSubOperation *PostSubOperation_P) { struct Element Element ; struct Value Value ; struct Expression * Expression_P ; List_T *Region_L ; int i, N, Num_Region ; double X[2], S, x ; GetDP_Begin("Pos_PrintWithArgument"); if(CPQ_P) Msg(GERROR, "Cumulative PostProcessing Quantity in PrintWithArgument not done") ; X[0] = PostSubOperation_P->Case.WithArgument.x[0] ; X[1] = PostSubOperation_P->Case.WithArgument.x[1] ; N = PostSubOperation_P->Case.WithArgument.n ; Expression_P = (struct Expression *) List_Pointer(Problem_S.Expression, PostSubOperation_P->Case.WithArgument.ArgumentIndex) ; Region_L = ((struct Group *) List_Pointer(Problem_S.Group, PostSubOperation_P->Case.WithArgument.RegionIndex)) ->InitialList ; if (List_Nbr(Region_L)) List_Read(Region_L, 0, &Num_Region) ; else Num_Region = NO_REGION ; for (i = 0 ; i <= N ; i++) { S = (double)i / (double)(N ? N : 1) ; x = X[0] + (X[1] - X[0]) * S ; Expression_P->Case.Constant = x ; Element.GeoElement = NULL ; Element.Num = NO_ELEMENT ; Element.Type = -1 ; Current.Region = Element.Region = Num_Region ; Current.x = Current.y = Current.z = 0. ; Cal_PostQuantity(NCPQ_P, DefineQuantity_P0, QuantityStorage_P0, NULL, &Element, 0., 0., 0., &Value) ; Format_PostValue(PostSubOperation_P->Format, PostSubOperation_P->Comma, REGION, x, 0, 0, 1, Current.NbrHar, PostSubOperation_P->HarmonicToTime, PostSubOperation_P->NoNewLine, &Value) ; } GetDP_End ;}/* ------------------------------------------------------------------------ *//* P o s _ P r i n t E x p r e s s i o n *//* ------------------------------------------------------------------------ */void Pos_PrintExpression(struct PostSubOperation *PostSubOperation_P){ int NbrTimeStep, iTime; struct Value Value; char *str = PostSubOperation_P->Case.Expression.String; char *str2 = PostSubOperation_P->Case.Expression.String2; int expr = PostSubOperation_P->Case.Expression.ExpressionIndex; GetDP_Begin("Pos_PrintExpression"); NbrTimeStep = Pos_InitTimeSteps(PostSubOperation_P); for(iTime = 0; iTime < NbrTimeStep; iTime++){ Pos_InitAllSolutions(PostSubOperation_P->TimeStep_L, iTime) ; if(expr >= 0){ Get_ValueOfExpressionByIndex(expr, NULL, 0., 0., 0., &Value) ; if(str) fprintf(PostStream, "%s", str); Print_Value(&Value); fprintf(PostStream, "\n") ; } else if(str2){ if(str) fprintf(PostStream, "%s", str); fprintf(PostStream, "%s\n", str2); } else if(str){ fprintf(PostStream, "%s\n", str); } } GetDP_End;}/* ------------------------------------------------------------------------ *//* P o s _ P r i n t G r o u p *//* ------------------------------------------------------------------------ */void Pos_PrintGroup(struct PostSubOperation *PostSubOperation_P) { struct Group *Group_P; struct Geo_Element *GeoElement; struct PostElement *SL; List_T *Region_L; int i, NbrGeo, iGeo, *NumNodes; double x [NBR_MAX_NODES_IN_ELEMENT] ; double y [NBR_MAX_NODES_IN_ELEMENT] ; double z [NBR_MAX_NODES_IN_ELEMENT] ; GetDP_Begin("Pos_PrintGroup"); NbrGeo = Geo_GetNbrGeoElements() ; Format_PostHeader(PostSubOperation_P->Format, PostSubOperation_P->Iso, 1, PostSubOperation_P->HarmonicToTime, PostSubOperation_P->CombinationType, 0, NULL, NULL); Region_L = ((struct Group *) List_Pointer(Problem_S.Group, PostSubOperation_P->Case.Group.GroupIndex))->InitialList ; Group_P = (struct Group *) List_Pointer(Problem_S.Group, PostSubOperation_P->Case.Group.ExtendedGroupIndex); SL = Create_PostElement(0, LINE, 2, 1) ; if(!Group_P->ExtendedList) Generate_ExtendedGroup(Group_P) ; for(iGeo = 0 ; iGeo < NbrGeo ; iGeo++) { if(InteractiveInterrupt) break; Progress(iGeo, NbrGeo, "Compute: ") ; GeoElement = Geo_GetGeoElement(iGeo) ; if(List_Search(Region_L, &GeoElement->Region, fcmp_int)){ Geo_GetNodesCoordinates (GeoElement->NbrNodes, GeoElement->NumNodes, x, y, z) ; switch (Group_P->FunctionType) { case EDGESOFTREEIN : if(!GeoElement->NbrEdges) Geo_CreateEdgesOfElement(GeoElement) ; for(i=0 ; i<GeoElement->NbrEdges ; i++){ if(List_Search(Group_P->ExtendedList, &GeoElement->NumEdges[i], fcmp_absint)){ NumNodes = Geo_GetNodesOfEdgeInElement(GeoElement, i) ; SL->Index = iGeo; SL->x[0] = x[abs(NumNodes[0])-1]; SL->x[1] = x[abs(NumNodes[1])-1]; SL->y[0] = y[abs(NumNodes[0])-1]; SL->y[1] = y[abs(NumNodes[1])-1]; SL->z[0] = z[abs(NumNodes[0])-1]; SL->z[1] = z[abs(NumNodes[1])-1]; SL->Value[0].Type = SL->Value[1].Type = SCALAR ; SL->Value[0].Val[0] = SL->Value[1].Val[0] = GeoElement->NumEdges[i]; Format_PostElement(PostSubOperation_P->Format, PostSubOperation_P->Iso, 0, 0, 0, 1, 1, 1, NULL, SL, PostSubOperation_P->ChangeOfCoordinates, PostSubOperation_P->ChangeOfValues); } } break ; default : Msg(GERROR, "Print function not implemented for this kind of Group"); break ; } } } Destroy_PostElement(SL) ; Format_PostFooter(PostSubOperation_P, 0); GetDP_End ;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -