DofData.h (getdp-3.4.0-source.tgz) | : | DofData.h (getdp-3.5.0-source.tgz) | ||
---|---|---|---|---|
// GetDP - Copyright (C) 1997-2021 P. Dular and C. Geuzaine, University of Liege | // GetDP - Copyright (C) 1997-2022 P. Dular and C. Geuzaine, University of Liege | |||
// | // | |||
// See the LICENSE.txt file for license information. Please report all | // See the LICENSE.txt file for license information. Please report all | |||
// issues on https://gitlab.onelab.info/getdp/getdp/issues. | // issues on https://gitlab.onelab.info/getdp/getdp/issues. | |||
#ifndef DOFDATA_H | #ifndef DOFDATA_H | |||
#define DOFDATA_H | #define DOFDATA_H | |||
#include <vector> | #include <vector> | |||
#include "ListUtils.h" | #include "ListUtils.h" | |||
#include "TreeUtils.h" | #include "TreeUtils.h" | |||
#include "LinAlg.h" | #include "LinAlg.h" | |||
#define DOF_PRE 1 | #define DOF_PRE 1 | |||
#define DOF_RES 2 | #define DOF_RES 2 | |||
#define DOF_TMP 3 | #define DOF_TMP 3 | |||
struct Solution { | struct Solution { | |||
int TimeStep ; /* Must be first member of struct (for | int TimeStep; /* Must be first member of struct (for | |||
searching purposes) */ | searching purposes) */ | |||
double Time, TimeImag ; | double Time, TimeImag; | |||
int SolutionExist ; | int SolutionExist; | |||
double * TimeFunctionValues, ExplicitTimeFunctionValue ; | double *TimeFunctionValues, ExplicitTimeFunctionValue; | |||
gVector x ; | gVector x; | |||
} ; | }; | |||
struct Dof { | struct Dof { | |||
int NumType ; /* Key 1 */ | int NumType; /* Key 1 */ | |||
int Entity ; /* Key 2 */ | int Entity; /* Key 2 */ | |||
int Harmonic ; /* Key 3 */ | int Harmonic; /* Key 3 */ | |||
int Type ; | int Type; | |||
/* Val must be out of the union (a member with constructor (gScalar with | /* Val must be out of the union (a member with constructor (gScalar with | |||
PETSc) is not allowed in a union); Val holds the init value for | PETSc) is not allowed in a union); Val holds the init value for | |||
Type==Unknown, and the assigned value for Type==FixedAssociate. Val is not | Type==Unknown, and the assigned value for Type==FixedAssociate. Val is not | |||
used for Type==Link. Val2 potentially holds a second init value for | used for Type==Link. Val2 potentially holds a second init value for | |||
Type==Unknown */ | Type==Unknown */ | |||
gScalar Val, Val2 ; | gScalar Val, Val2; | |||
union { | union { | |||
struct { | struct { | |||
int NumDof ; /* Equation number - 1st position */ | int NumDof; /* Equation number - 1st position */ | |||
bool NonLocal ; /* Set to true if equation is non-local */ | bool NonLocal; /* Set to true if equation is non-local */ | |||
} Unknown ; | } Unknown; | |||
struct { | struct { | |||
int NumDof ; /* Equation number (Associate) - 1st position */ | int NumDof; /* Equation number (Associate) - 1st position */ | |||
int TimeFunctionIndex ; | int TimeFunctionIndex; | |||
} FixedAssociate ; | } FixedAssociate; | |||
struct { | struct { | |||
int EntityRef ; | int EntityRef; | |||
double Coef, Coef2 ; | double Coef, Coef2; | |||
struct Dof * Dof ; | struct Dof *Dof; | |||
} Link ; | } Link; | |||
} Case ; | } Case; | |||
} ; | }; | |||
/* Dof.Type */ | /* Dof.Type */ | |||
/* definitive in preprocessing and processing */ | /* definitive in preprocessing and processing */ | |||
#define DOF_UNKNOWN 1 /* unknown */ | #define DOF_UNKNOWN 1 /* unknown */ | |||
#define DOF_FIXED 2 /* spatial fixed */ | #define DOF_FIXED 2 /* spatial fixed */ | |||
#define DOF_FIXEDWITHASSOCIATE 3 /* associate */ | #define DOF_FIXEDWITHASSOCIATE 3 /* associate */ | |||
#define DOF_LINK 7 /* link */ | #define DOF_LINK 7 /* link */ | |||
#define DOF_LINKCPLX 8 /* linkcplx */ | #define DOF_LINKCPLX 8 /* linkcplx */ | |||
/* definitive in a preprocessing */ | /* definitive in a preprocessing */ | |||
#define DOF_UNKNOWN_INIT 5 /* initial condition */ | #define DOF_UNKNOWN_INIT 5 /* initial condition */ | |||
/* temporary */ | /* temporary */ | |||
#define DOF_FIXED_SOLVE 4 /* waiting to be fixed by a resolution | #define DOF_FIXED_SOLVE 4 /* waiting to be fixed by a resolution */ | |||
*/ | #define DOF_FIXEDWITHASSOCIATE_SOLVE \ | |||
#define DOF_FIXEDWITHASSOCIATE_SOLVE 6 /* waiting to be fixed by a resolution | 6 /* waiting to be fixed by a resolution \ | |||
*/ | */ | |||
struct CorrectionSolutions { | struct CorrectionSolutions { | |||
List_T * Solutions ; | List_T *Solutions; | |||
} ; | }; | |||
struct DofData { | struct DofData { | |||
int Num ; | int Num; | |||
int ResolutionIndex, SystemIndex ; | int ResolutionIndex, SystemIndex; | |||
int GeoDataIndex ; | int GeoDataIndex; | |||
List_T * FunctionSpaceIndex ; | List_T *FunctionSpaceIndex; | |||
List_T * TimeFunctionIndex ; | List_T *TimeFunctionIndex; | |||
List_T * Pulsation ; | List_T *Pulsation; | |||
int NbrHar ; | int NbrHar; | |||
double * Val_Pulsation ; | double *Val_Pulsation; | |||
int NbrAnyDof, NbrDof ; | int NbrAnyDof, NbrDof; | |||
Tree_T * DofTree ; | Tree_T *DofTree; | |||
List_T * DofList ; | List_T *DofList; | |||
int * DummyDof ; | int *DummyDof; | |||
char * SolverDataFileName ; | char *SolverDataFileName; | |||
List_T * Solutions ; | List_T *Solutions; | |||
struct Solution * CurrentSolution ; | struct Solution *CurrentSolution; | |||
struct Solution * Save_CurrentSolution ; | struct Solution *Save_CurrentSolution; | |||
struct { | struct { | |||
int Flag ; | int Flag; | |||
List_T * Save_FullSolutions ; | List_T *Save_FullSolutions; | |||
struct Solution * Save_CurrentFullSolution ; | struct Solution *Save_CurrentFullSolution; | |||
List_T * AllSolutions ; | List_T *AllSolutions; | |||
} CorrectionSolutions ; | } CorrectionSolutions; | |||
int Flag_RHS ; // only assemble RHS | int Flag_RHS; // only assemble RHS | |||
int Flag_ListOfRHS ; // only assemble list of RHS | int Flag_ListOfRHS; // only assemble list of RHS | |||
int Flag_Init[8] ; | int Flag_Init[8]; | |||
int Flag_Only ; | int Flag_Only; | |||
int Flag_InitOnly[3] ; | int Flag_InitOnly[3]; | |||
// For recalculating only the matrices that are required | // For recalculating only the matrices that are required | |||
List_T *OnlyTheseMatrices ; | List_T *OnlyTheseMatrices; | |||
// Flag_Init[0] == 1 || Flag_Init[0] == 2 | // Flag_Init[0] == 1 || Flag_Init[0] == 2 | |||
gMatrix A; | gMatrix A; | |||
gVector b; | gVector b; | |||
gSolver Solver; | gSolver Solver; | |||
// Flag_Init[0] == 2 | // Flag_Init[0] == 2 | |||
gMatrix Jac ; | gMatrix Jac; | |||
gVector res, dx ; | gVector res, dx; | |||
// Flag_Init[0] == 3 //kj+++ | // Flag_Init[0] == 3 | |||
gVector df; | gVector df; | |||
// Flag_Init[1,2,3,4,5,6,7] == 1 | // Flag_Init[1,2,3,4,5,6,7] == 1 | |||
gMatrix M1, M2, M3, M4, M5, M6, M7; | gMatrix M1, M2, M3, M4, M5, M6, M7; | |||
gVector m1, m2, m3, m4, m5, m6, m7; | gVector m1, m2, m3, m4, m5, m6, m7; | |||
List_T *m1s, *m2s, *m3s, *m4s, *m5s, *m6s, *m7s; | List_T *m1s, *m2s, *m3s, *m4s, *m5s, *m6s, *m7s; | |||
// Flag_Only and Flag_InitOnly[0,1,2] | // Flag_Only and Flag_InitOnly[0,1,2] | |||
gMatrix A1, A2, A3 ; | gMatrix A1, A2, A3; | |||
gVector b1, b2, b3 ; | gVector b1, b2, b3; | |||
// Flag_ListOfRHS | // Flag_ListOfRHS | |||
std::vector<gVector> ListOfRHS ; | std::vector<gVector> ListOfRHS; | |||
int CounterOfRHS, TotalNumberOfRHS ; | int CounterOfRHS, TotalNumberOfRHS; | |||
gMatrix A_MH_moving ; | gMatrix A_MH_moving; | |||
gVector b_MH_moving ; | gVector b_MH_moving; | |||
std::vector<int> NonLocalEquations; | std::vector<int> NonLocalEquations; | |||
} ; | }; | |||
int fcmp_Dof(const void * a, const void * b) ; | int fcmp_Dof(const void *a, const void *b); | |||
void Dof_InitDofData(struct DofData * DofData_P, int Num, | void Dof_InitDofData(struct DofData *DofData_P, int Num, int ResolutionIndex, | |||
int ResolutionIndex, int SystemIndex, | int SystemIndex, char *Name_SolverDataFile); | |||
char * Name_SolverDataFile) ; | void Dof_FreeDofData(struct DofData *DofData_P); | |||
void Dof_FreeDofData(struct DofData * DofData_P) ; | ||||
void Dof_SetCurrentDofData(struct DofData *DofData_P); | ||||
void Dof_SetCurrentDofData(struct DofData * DofData_P) ; | ||||
void Dof_OpenFile(int Type, char *Name, const char *Mode); | ||||
void Dof_OpenFile(int Type, char * Name, const char * Mode) ; | void Dof_CloseFile(int Type); | |||
void Dof_CloseFile(int Type) ; | void Dof_FlushFile(int Type); | |||
void Dof_FlushFile(int Type) ; | ||||
void Dof_WriteFilePRE0(int Num_Resolution, char *Name_Resolution, | ||||
void Dof_WriteFilePRE0(int Num_Resolution, char * Name_Resolution, int Nbr_DofD | int Nbr_DofData); | |||
ata) ; | void Dof_ReadFilePRE0(int *Num_Resolution, int *Nbr_DofData); | |||
void Dof_ReadFilePRE0(int * Num_Resolution, int * Nbr_DofData) ; | void Dof_WriteFilePRE(struct DofData *DofData_P); | |||
void Dof_WriteFilePRE(struct DofData * DofData_P) ; | void Dof_WriteDofPRE(void *a, void *b); | |||
void Dof_WriteDofPRE(void * a, void * b) ; | void Dof_ReadFilePRE(struct DofData *DofData_P); | |||
void Dof_ReadFilePRE(struct DofData * DofData_P) ; | ||||
void Dof_WriteFileRES0(char *Name_File, int Format); | ||||
void Dof_WriteFileRES0(char * Name_File, int Format) ; | void Dof_ReadFileRES0(void); | |||
void Dof_ReadFileRES0(void) ; | void Dof_WriteFileRES(char *Name_File, struct DofData *DofData_P, int Format, | |||
void Dof_WriteFileRES(char * Name_File, struct DofData * DofData_P, int Format, | double Val_Time, double Val_TimeImag, int Val_TimeStep); | |||
double Val_Time, double Val_TimeImag, int Val_TimeStep) ; | void Dof_ReadFileRES(List_T *DofData_L, struct DofData *Read_DofData_P, | |||
void Dof_ReadFileRES(List_T * DofData_L, struct DofData * Read_DofData_P, | int Read_DofData, double *Time, double *TimeImag, | |||
int Read_DofData, double *Time, double *TimeImag, | double *TimeStep); | |||
double *TimeStep) ; | void Dof_WriteFileRES_ExtendMH(char *Name_File, struct DofData *DofData_P, | |||
void Dof_WriteFileRES_ExtendMH(char * Name_File, struct DofData * DofData_P, in | int Format, int NbrH); | |||
t Format, | void Dof_WriteFileRES_MHtoTime(char *Name_File, struct DofData *DofData_P, | |||
int NbrH); | int Format, List_T *Time_L); | |||
void Dof_WriteFileRES_MHtoTime(char * Name_File, struct DofData * DofData_P, | void Dof_WriteFileRES_WithEntityNum(char *Name_File, struct DofData *DofData_P, | |||
int Format, List_T * Time_L); | struct GeoData *GeoData_P0, | |||
void Dof_WriteFileRES_WithEntityNum(char * Name_File, struct DofData * DofData_ | struct Group *Group_P, bool saveFixed); | |||
P, | ||||
struct GeoData * GeoData_P0, struct Group * | void Dof_TransferDofTreeToList(struct DofData *DofData_P); | |||
Group_P, | void Dof_InitDofType(struct DofData *DofData_P); | |||
bool saveFixed); | void Dof_DeleteDofTree(struct DofData *DofData_P); | |||
void Dof_TransferDofTreeToList(struct DofData * DofData_P) ; | void Dof_AddFunctionSpaceIndex(int Index_FunctionSpace); | |||
void Dof_InitDofType(struct DofData * DofData_P) ; | void Dof_AddTimeFunctionIndex(int Index_TimeFunction); | |||
void Dof_DeleteDofTree(struct DofData * DofData_P) ; | void Dof_AddPulsation(struct DofData *DofData_P, double Val_Pulsation); | |||
void Dof_AddFunctionSpaceIndex(int Index_FunctionSpace) ; | void Dof_DefineAssignFixedDof(int D1, int D2, int NbrHar, double *Val, | |||
void Dof_AddTimeFunctionIndex(int Index_TimeFunction) ; | int Index_TimeFunction); | |||
void Dof_AddPulsation(struct DofData * DofData_P, double Val_Pulsation) ; | void Dof_DefineInitFixedDof(int D1, int D2, int NbrHar, double *Val, | |||
double *Val2, bool NonLocal = false); | ||||
void Dof_DefineAssignFixedDof(int D1, int D2, int NbrHar, double * Val, | void Dof_DefineAssignSolveDof(int D1, int D2, int NbrHar, | |||
int Index_TimeFunction) ; | int Index_TimeFunction); | |||
void Dof_DefineInitFixedDof(int D1, int D2, int NbrHar, double * Val, | void Dof_DefineInitSolveDof(int D1, int D2, int NbrHar); | |||
double *Val2, bool NonLocal=false) ; | void Dof_DefineLinkDof(int D1, int D2, int NbrHar, double Value[], int D2_Link); | |||
void Dof_DefineAssignSolveDof(int D1, int D2, int NbrHar, int Index_TimeFunctio | void Dof_DefineLinkCplxDof(int D1, int D2, int NbrHar, double Value[], | |||
n) ; | int D2_Link); | |||
void Dof_DefineInitSolveDof(int D1, int D2, int NbrHar) ; | void Dof_DefineUnknownDof(int D1, int D2, int NbrHar, bool NonLocal = false); | |||
void Dof_DefineLinkDof(int D1, int D2, int NbrHar, double Value[], int D2_Link) | void Dof_DefineAssociateDof(int E1, int E2, int D1, int D2, int NbrHar, | |||
; | int init, double *Val); | |||
void Dof_DefineLinkCplxDof(int D1, int D2, int NbrHar, double Value[], int D2_L | void Dof_DefineUnknownDofFromSolveOrInitDof(struct DofData **DofData_P); | |||
ink) ; | ||||
void Dof_DefineUnknownDof(int D1, int D2, int NbrHar, bool NonLocal=false) ; | void Dof_NumberUnknownDof(void); | |||
void Dof_DefineAssociateDof(int E1, int E2, int D1, int D2, int NbrHar, int ini | ||||
t, | void Dof_UpdateAssignFixedDof(int D1, int D2, int NbrHar, double *Val, | |||
double * Val) ; | double *Val2); | |||
void Dof_DefineUnknownDofFromSolveOrInitDof(struct DofData ** DofData_P) ; | void Dof_UpdateLinkDof(int D1, int D2, int NbrHar, double Value[], int D2_Link); | |||
void Dof_NumberUnknownDof(void) ; | void Dof_AssembleInMat(struct Dof *Equ_P, struct Dof *Dof_P, int NbrHar, | |||
double *Val, gMatrix *Mat, gVector *Vec, | ||||
void Dof_UpdateAssignFixedDof(int D1, int D2, int NbrHar, double *Val, double * | List_T *Vecs = 0); | |||
Val2) ; | void Dof_AssembleInVec(struct Dof *Equ_P, struct Dof *Dof_P, int NbrHar, | |||
void Dof_UpdateLinkDof(int D1, int D2, int NbrHar, double Value[], int D2_Link) | double *Val, struct Solution *OtherSolution, | |||
; | gVector *Vec0, gVector *Vec); | |||
void Dof_AssembleInMat(struct Dof * Equ_P, struct Dof * Dof_P, int NbrHar, doub | void Dof_TransferSolutionToConstraint(struct DofData *DofData_P); | |||
le * Val, | void Dof_TransferDof(struct DofData *DofData1_P, struct DofData **DofData2_P); | |||
gMatrix * Mat, gVector * Vec, List_T *Vecs=0) ; | ||||
void Dof_AssembleInVec(struct Dof * Equ_P, struct Dof * Dof_P, int NbrHar, doub | struct Dof *Dof_GetDofStruct(struct DofData *DofData_P, int D1, int D2, int D3); | |||
le * Val, | gScalar Dof_GetDofValue(struct DofData *DofData_P, struct Dof *Dof_P); | |||
struct Solution * OtherSolution, gVector * Vec0, gVector | void Dof_GetRealDofValue(struct DofData *DofData_P, struct Dof *Dof_P, | |||
* Vec) ; | double *d); | |||
void Dof_GetComplexDofValue(struct DofData *DofData_P, struct Dof *Dof_P, | ||||
void Dof_TransferSolutionToConstraint(struct DofData * DofData_P) ; | double *d1, double *d2); | |||
void Dof_TransferDof(struct DofData * DofData1_P, struct DofData ** DofData2_P) | ||||
; | void Dof_GetDummies(struct DefineSystem *DefineSystem_P, | |||
struct DofData *DofData_P); | ||||
struct Dof * Dof_GetDofStruct(struct DofData * DofData_P, int D1, int D2, int D | void Dof_InitDofForNoDof(struct Dof *DofForNoDof, int NbrHar); | |||
3) ; | ||||
gScalar Dof_GetDofValue(struct DofData * DofData_P, struct Dof * Dof_P) ; | ||||
void Dof_GetRealDofValue(struct DofData * DofData_P, struct Dof * Dof_P, doub | ||||
le *d) ; | ||||
void Dof_GetComplexDofValue(struct DofData * DofData_P, struct Dof * Dof_P, | ||||
double *d1, double *d2) ; | ||||
void Dof_GetDummies(struct DefineSystem * DefineSystem_P, struct DofData * DofDa | void Print_DofNumber(struct Dof *Dof_P); | |||
ta_P) ; | ||||
void Dof_InitDofForNoDof(struct Dof * DofForNoDof, int NbrHar) ; | ||||
void Print_DofNumber(struct Dof *Dof_P) ; | ||||
#endif | #endif | |||
End of changes. 28 change blocks. | ||||
182 lines changed or deleted | 172 lines changed or added |