forked from mohuangrui/ArtraCFD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostprocess.c
67 lines (66 loc) · 2.81 KB
/
postprocess.c
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/****************************************************************************
* ArtraCFD *
* <By Huangrui Mo> *
* Copyright (C) Huangrui Mo <[email protected]> *
* This file is part of ArtraCFD. *
* ArtraCFD is free software: you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
****************************************************************************/
/****************************************************************************
* Required Header Files
****************************************************************************/
#include "postprocess.h"
#include <stdio.h> /* standard library for input and output */
#include <stdlib.h> /* dynamic memory allocation and exit */
#include "commons.h"
/****************************************************************************
* Static Function Declarations
****************************************************************************/
static void ReleaseProgramMemory(Time *, Space *, Model *);
/****************************************************************************
* Function Definitions
****************************************************************************/
int Postprocess(Time *time, Space *space, Model *model)
{
ShowInfo("Postprocessing...\n");
ShowInfo(" releasing memory...\n");
ReleaseProgramMemory(time, space, model);
ShowInfo(" computing finished, successfully exit.\n");
ShowInfo("Session");
return 0;
}
static void ReleaseProgramMemory(Time *time, Space *space, Model *model)
{
/* geometry related */
Geometry *const geo = &(space->geo);
Polyhedron *poly = NULL;
for (int n = geo->sphN; n < geo->totN; ++n) {
poly = geo->poly + n;
RetrieveStorage(poly->f);
RetrieveStorage(poly->Nf);
RetrieveStorage(poly->e);
RetrieveStorage(poly->Ne);
RetrieveStorage(poly->v);
RetrieveStorage(poly->Nv);
}
RetrieveStorage(geo->poly);
RetrieveStorage(geo->col);
/* space related */
Partition *const part = &(space->part);
RetrieveStorage(part->typeBC);
RetrieveStorage(part->N);
RetrieveStorage(part->varBC);
RetrieveStorage(part->typeIC);
RetrieveStorage(part->posIC);
RetrieveStorage(part->varIC);
RetrieveStorage(space->node);
/* time related */
RetrieveStorage(time->lp);
RetrieveStorage(time->pp);
/* model related */
RetrieveStorage(model->mat);
return;
}
/* a good practice: end file with a newline */