📄 solvinganalyse.c
字号:
Current.NbrSystem = Nbr_DefineSystem ; /* Attention: init for Dt[] */ Current.DofData_P0 = DofData_P0 ; i = 0 ; while(PostProcessing_P[i]){ Treatment_PostOperation(Resolution_P, DofData_P0, DefineSystem_P0, GeoData_P0, PostProcessing_P[i], PostOperation_P[i]) ; i++ ; } Msg(SUMMARY, ""); Msg(DIRECT, "E n d P o s t - P r o c e s s i n g"); } List_Delete(DofData_L) ; GetDP_End ;}/* ------------------------------------------------------------------------ *//* T r e a t m e n t _ R e s o l u t i o n *//* ------------------------------------------------------------------------ *//*! For each DefineSystem: Init the associated DofData */void Treatment_Resolution(int ResolutionIndex, int * Nbr_DefineSystem, int * Nbr_OtherSystem, struct Resolution ** Resolution_P, struct DefineSystem ** DefineSystem_P0, struct DofData ** DofData_P0, List_T ** DofData_L, List_T * GeoData_L, struct GeoData ** GeoData_P0) { struct DefineSystem * DefineSystem_P ; struct DofData DofData_S ; int i ; GetDP_Begin("Treatment_Resolution"); *Resolution_P = (struct Resolution*)List_Pointer(Problem_S.Resolution, ResolutionIndex) ; Msg(INFO, "Selected Resolution '%s'", (*Resolution_P)->Name) ; *Nbr_DefineSystem = List_Nbr((*Resolution_P)->DefineSystem) ; if (!*Nbr_DefineSystem) Msg(GERROR, "No System exists for Resolution '%s'", (*Resolution_P)->Name) ; if (*Nbr_OtherSystem) *Nbr_OtherSystem -= *Nbr_DefineSystem ; *DofData_L = List_Create(*Nbr_DefineSystem + *Nbr_OtherSystem, 6, sizeof(struct DofData)) ; *DefineSystem_P0 = (struct DefineSystem*) List_Pointer((*Resolution_P)->DefineSystem, 0) ; DofData_S.NbrPart = 1; for (i = 0 ; i < *Nbr_DefineSystem ; i++) { DefineSystem_P = *DefineSystem_P0 + i ; Dof_InitDofData(&DofData_S, i, ResolutionIndex, i, DefineSystem_P->SolverDataFileName) ; DofData_S.GeoDataIndex = Geo_AddGeoData(GeoData_L, DefineSystem_P->MeshName, Name_MshFile, DefineSystem_P->AdaptName, Name_AdaptFile) ; Init_HarInDofData(DefineSystem_P, &DofData_S) ; List_Add(*DofData_L, &DofData_S) ; } for (i = 0 ; i < *Nbr_OtherSystem ; i++) { Dof_InitDofData(&DofData_S, i + *Nbr_DefineSystem, -1, -1, NULL) ; List_Add(*DofData_L, &DofData_S) ; } *DofData_P0 = (struct DofData*)List_Pointer(*DofData_L, 0) ; *GeoData_P0 = (struct GeoData*)List_Pointer(GeoData_L, 0) ; GetDP_End ;}/* ------------------------------------------------------------------------ *//* I n i t _ H a r I n D o f D a t a *//* ------------------------------------------------------------------------ *//*! For a DefineSystem: Fill harmonic data in the associated DofData */void Init_HarInDofData(struct DefineSystem * DefineSystem_P, struct DofData * DofData_P) { int j ; GetDP_Begin("Init_HarInDofData"); if (DefineSystem_P->Type == VAL_COMPLEX){ if(!DefineSystem_P->FrequencyValue) Dof_AddPulsation(DofData_P,0.0) ; else for (j = 0 ; j < List_Nbr(DefineSystem_P->FrequencyValue) ; j++) Dof_AddPulsation (DofData_P, *((double *)List_Pointer(DefineSystem_P->FrequencyValue, j)) * TWO_PI) ; } if (!List_Nbr(DofData_P->Pulsation)){ DofData_P->NbrHar = 1 ; } else { DofData_P->NbrHar = 2 * List_Nbr(DofData_P->Pulsation) ; DofData_P->Val_Pulsation = (double*)List_Pointer(DofData_P->Pulsation, 0) ; } if (DofData_P->NbrHar > NBR_MAX_HARMONIC) Msg(GERROR, "Too many harmonics to generate system (%d > %d)", DofData_P->NbrHar/2, NBR_MAX_HARMONIC/2) ; if (DofData_P->NbrHar > 1) { for (j = 0 ; j < DofData_P->NbrHar/2 ; j++) Msg(INFO, "System '%s' : Complex, Frequency = %.8g Hz", DefineSystem_P->Name, DofData_P->Val_Pulsation[j]/TWO_PI) ; } else{ Msg(INFO, "System '%s' : Real", DefineSystem_P->Name) ; } GetDP_End ;}/* ------------------------------------------------------------------------ *//* I n i t _ P a r t I n D o f D a t a *//* ------------------------------------------------------------------------ *//*! ... */void Init_PartInDofData(struct DofData * DofData_P, int NbrPart) { int i ; GetDP_Begin("Init_PartInDofData"); if(!DofData_P->Nnz) DofData_P->Nnz = (int*)Malloc(DofData_P->NbrDof * sizeof(int)) ; for(i = 0 ; i < DofData_P->NbrDof ; i++) DofData_P->Nnz[i] = 50 ; DofData_P->NbrPart = 1; DofData_P->Part[0] = 1; DofData_P->Part[1] = DofData_P->NbrDof+1; GetDP_End ;}/* ------------------------------------------------------------------------ *//* G e t _ T i m e F u n c t i o n V a l u e s *//* ------------------------------------------------------------------------ *//*! For a DofData: Fill the vector of the considered time function values */double * Get_TimeFunctionValues(struct DofData * DofData_P) { int Nbr_Expression, Nbr_TimeFunction, i, Index ; double * Values ; struct Value Val_Expression ; GetDP_Begin("Get_TimeFunctionValues"); Nbr_Expression = List_Nbr(Problem_S.Expression) ; Values = (double *)Malloc((Nbr_Expression + 1) * sizeof(double)) ; Nbr_TimeFunction = List_Nbr(DofData_P->TimeFunctionIndex) ; for (i = 0 ; i < Nbr_TimeFunction ; i++) { List_Read(DofData_P->TimeFunctionIndex, i, &Index) ; if ((DofData_P->NbrHar == 1) && (Index > 0)) { Get_ValueOfExpressionByIndex(Index - 1, NULL, 0., 0., 0., &Val_Expression) ; Values[Index] = Val_Expression.Val[0] ; } else Values[Index] = 1. ; } GetDP_Return(Values) ;}/* ------------------------------------------------------------------------ *//* I n i t _ D o f D a t a I n D e f i n e Q u a n t i t y *//* ------------------------------------------------------------------------ *//*! For setting the DofData of a DefineQuantity if explicitly specified */void Init_DofDataInDefineQuantity(struct DefineSystem *DefineSystem_P, struct DofData *DofData_P0, struct Formulation *Formulation_P) { struct DefineQuantity *DefineQuantity_P; int i, j ; GetDP_Begin("Init_DofDataInDefineQuantity"); for(i = 0 ; i < List_Nbr(Formulation_P->DefineQuantity) ; i++){ DefineQuantity_P = (struct DefineQuantity *) List_Pointer(Formulation_P->DefineQuantity, i); if(DefineQuantity_P->DofDataIndex >= 0){ if(DefineQuantity_P->DofDataIndex >= List_Nbr(DefineSystem_P->OriginSystemIndex)) Msg(GERROR, "Invalid System index (%d) in discrete Quantity (%s)", DefineQuantity_P->DofDataIndex, DefineQuantity_P->Name); List_Read(DefineSystem_P->OriginSystemIndex, DefineQuantity_P->DofDataIndex, &j) ; DefineQuantity_P->DofData = DofData_P0 + j ; } else DefineQuantity_P->DofData = NULL ; } GetDP_End ;}/* ------------------------------------------------------------------------ *//* I n i t _ D o f D a t a I n F u n c t i o n S p a c e *//* ------------------------------------------------------------------------ *//*! Links between FunctionSpace's and DofData's (one-to-one mapping) */void Init_DofDataInFunctionSpace(int Nbr_DefineSystem, struct DofData *DofData_P0) { struct DofData * DofData_P ; struct FunctionSpace * FunctionSpace_P ; int i, j ; GetDP_Begin("Init_DofDataInFunctionSpace"); for (i = 0 ; i < Nbr_DefineSystem ; i++) { DofData_P = DofData_P0 + i ; for (j = 0 ; j < List_Nbr(DofData_P->FunctionSpaceIndex) ; j++){ FunctionSpace_P = (struct FunctionSpace *) List_Pointer(Problem_S.FunctionSpace, *((int *)List_Pointer(DofData_P->FunctionSpaceIndex, j))) ; FunctionSpace_P->DofData = FunctionSpace_P->MainDofData = DofData_P ; } } GetDP_End ;}/* ------------------------------------------------------------------------ *//* T r e a t m e n t _ P r e p r o c e s s i n g *//* ------------------------------------------------------------------------ *//*! For each DefineSystem: For each Formulation: Definition of Dof's in associated DofData */void Treatment_Preprocessing(int Nbr_DefineSystem, struct DofData * DofData_P0, struct DefineSystem * DefineSystem_P0, struct GeoData * GeoData_P0) { struct DefineSystem * DefineSystem_P ; struct DofData * DofData_P ; struct Formulation * Formulation_P ; int i, k, Nbr_Formulation, Index_Formulation; GetDP_Begin("Treatment_Preprocessing"); for (i = 0 ; i < Nbr_DefineSystem ; i++) { DefineSystem_P = DefineSystem_P0 + i ; DofData_P = DofData_P0 + i ; Dof_SetCurrentDofData(Current.DofData = DofData_P) ; Geo_SetCurrentGeoData(Current.GeoData = GeoData_P0 + DofData_P->GeoDataIndex) ; Current.NbrHar = Current.DofData->NbrHar ; Nbr_Formulation = List_Nbr(DefineSystem_P->FormulationIndex) ; for (k = 0 ; k < Nbr_Formulation ; k++) { List_Read(DefineSystem_P->FormulationIndex, k, &Index_Formulation) ; Formulation_P = (struct Formulation*) List_Pointer(Problem_S.Formulation, Index_Formulation) ; Msg(OPERATION, "Treatment Formulation '%s'", Formulation_P->Name) ; Init_DofDataInDefineQuantity(DefineSystem_P, DofData_P0, Formulation_P) ; Treatment_Formulation(Formulation_P) ; } Dof_NumberUnknownDof() ; } GetDP_End ;}/* ------------------------------------------------------------------------ *//* T r e a t m e n t _ P o s t O p e r a t i o n *//* ------------------------------------------------------------------------ *//*! Prepare the treatment of a PostOperation. Then does it outside */void Treatment_PostOperation(struct Resolution * Resolution_P, struct DofData * DofData_P0, struct DefineSystem * DefineSystem_P0, struct GeoData * GeoData_P0, struct PostProcessing * PostProcessing_P, struct PostOperation * PostOperation_P) { struct PostSubOperation * PostSubOperation_P ; struct Formulation * Formulation_P ; struct DefineSystem * DefineSystem_P ; int Nbr_PostSubOperation, i_POP, i ; GetDP_Begin("Treatment_PostOperation"); if (!List_Nbr(PostProcessing_P->PostQuantity)) Msg(GERROR, "No Quantity available for PostProcessing '%s'", PostProcessing_P->Name) ; Formulation_P = (struct Formulation *) List_Pointer(Problem_S.Formulation, PostProcessing_P->FormulationIndex) ; if (!List_Nbr(Formulation_P->DefineQuantity)) Msg(GERROR, "No discrete Quantity in Formulation '%s'", Formulation_P->Name); /* Choice of Current DofData */ if(PostProcessing_P->NameOfSystem){ if ((i = List_ISearchSeq(Resolution_P->DefineSystem, PostProcessing_P->NameOfSystem, fcmp_DefineSystem_Name)) < 0) Msg(GERROR, "Unknown System name (%s) in PostProcessing (%s)", PostProcessing_P->NameOfSystem, PostProcessing_P->Name) ; Current.DofData = DofData_P0 + i; /* (Re)creation des liens entre FunctionSpace et DofData: seuls les FS n'intervenant pas dans le DD courant peuvent pointer vers un autre DD */ Init_DofDataInFunctionSpace(1, Current.DofData) ; } else{ for(i = 0 ; i < List_Nbr(Formulation_P->DefineQuantity) ; i++){ Current.DofData = ((struct FunctionSpace *) List_Pointer(Problem_S.FunctionSpace, ((struct DefineQuantity *) List_Pointer(Formulation_P->DefineQuantity, i)) ->FunctionSpaceIndex)) ->DofData ; if(Current.DofData) break; } } if(!Current.DofData) Msg(GERROR, "PostProcessing not compatible with Resolution"); DefineSystem_P = DefineSystem_P0 + Current.DofData->Num ; Current.NbrHar = Current.DofData->NbrHar ; Geo_SetCurrentGeoData(Current.GeoData = GeoData_P0 + Current.DofData->GeoDataIndex) ; Msg(INFO, "Selected PostProcessing '%s'", PostProcessing_P->Name); /* Msg(INFO, "Selected System '%s'", DefineSystem_P->Name) ; */ Msg(INFO, "Selected Mesh '%s'", Current.GeoData->Name); Init_DofDataInDefineQuantity(DefineSystem_P,DofData_P0,Formulation_P); if(Flag_IPOS){ Pos_Interactive(Formulation_P, PostProcessing_P); } else{ Nbr_PostSubOperation = List_Nbr(PostOperation_P->PostSubOperation) ; for (i_POP = 0 ; i_POP < Nbr_PostSubOperation ; i_POP++) { Msg(OPERATION, "PostOperation %d/%d ", i_POP+1, Nbr_PostSubOperation) ; PostSubOperation_P = (struct PostSubOperation*) List_Pointer(PostOperation_P->PostSubOperation, i_POP) ; Pos_Formulation(Formulation_P, PostProcessing_P, PostSubOperation_P) ; } } GetDP_End ;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -