Repository navigation
Expand file tree
/
Copy pathmallocVariables.c
More file actions
34 lines (31 loc) · 1.51 KB
/
Copy pathmallocVariables.c
File metadata and controls
34 lines (31 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "Ce_MPS.h"
void mallocVariables(void){
int i;
Acceleration = (double*)malloc(sizeof(double) * 3 * SIZE_OF_ARRAY);
ParticleType = (int*)malloc(sizeof(int) * SIZE_OF_ARRAY);
Position = (double*)malloc(sizeof(double) * 3 * SIZE_OF_ARRAY);
Velocity = (double*)malloc(sizeof(double) * 3 * SIZE_OF_ARRAY);
Viscosity_x = (double*)malloc(sizeof(double) * SIZE_OF_ARRAY);
Viscosity_y = (double*)malloc(sizeof(double) * SIZE_OF_ARRAY);
Viscosity_z = (double*)malloc(sizeof(double) * SIZE_OF_ARRAY);
Pressure = (double*)malloc(sizeof(double) * SIZE_OF_ARRAY);
NumberDensity = (double*)malloc(sizeof(double) * SIZE_OF_ARRAY);
BoundaryCondition = (int*)malloc(sizeof(int) * SIZE_OF_ARRAY);
SourceTerm = (double*)malloc(sizeof(double) * SIZE_OF_ARRAY);
SourceTerm_vx = (double*)malloc(sizeof(double) * SIZE_OF_ARRAY);
SourceTerm_vy = (double*)malloc(sizeof(double) * SIZE_OF_ARRAY);
SourceTerm_vz = (double*)malloc(sizeof(double) * SIZE_OF_ARRAY);
FlagForCheckingBoundaryCondition = (int*)malloc(sizeof(int) * SIZE_OF_ARRAY);
CoefficientMatrix = (double*)malloc(sizeof(double) * SIZE_OF_ARRAY * SIZE_OF_ARRAY);
MinimumPressure = (double*)malloc(sizeof(double) * SIZE_OF_ARRAY);
isOutOfCell = (int*)malloc(sizeof(int) * SIZE_OF_ARRAY);
adjacentParticle = (int**)malloc(sizeof(int) * SIZE_OF_ARRAY * MAX);
for(i=0; i<SIZE_OF_ARRAY; i++){
adjacentParticle[i] = (int*)malloc(sizeof(int) * MAX);
}
// initialize
for(i=0; i<SIZE_OF_ARRAY; i++){
ParticleType[i] = GHOST;
Pressure[i] = 0.0;
}
}