HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
BCCleanup.c File Reference

Function to clean up boundary-conditions related variables. More...

#include <stdlib.h>
#include <arrayfunctions_gpu.h>
#include <boundaryconditions.h>

Go to the source code of this file.

Functions

int BCCleanup (void *b, int flag_gpu)
 

Detailed Description

Function to clean up boundary-conditions related variables.

Author
Debojyoti Ghosh, Youngdae Kim

Definition in file BCCleanup.c.

Function Documentation

◆ BCCleanup()

int BCCleanup ( void *  b,
int  flag_gpu 
)

Cleans up a boundary object of type DomainBoundary

Parameters
bBoundary object of type DomainBoundary
flag_gpuFlag indicating if GPU is being used

Definition at line 12 of file BCCleanup.c.

14 {
15  DomainBoundary *boundary = (DomainBoundary*) b;
16  free(boundary->xmin);
17  free(boundary->xmax);
18  free(boundary->is);
19  free(boundary->ie);
20  if (boundary->DirichletValue) free(boundary->DirichletValue);
21  if (boundary->SpongeValue ) free(boundary->SpongeValue );
22  if (boundary->FlowVelocity ) free(boundary->FlowVelocity );
23 
24  if (boundary->UnsteadyDirichletSize) free(boundary->UnsteadyDirichletSize);
25  if (boundary->UnsteadyDirichletData) free(boundary->UnsteadyDirichletData);
26 
27  if (boundary->UnsteadyTemperatureSize) free(boundary->UnsteadyTemperatureSize);
28  if (boundary->UnsteadyTimeLevels) free(boundary->UnsteadyTimeLevels);
29  if (boundary->UnsteadyTemperatureData) free(boundary->UnsteadyTemperatureData);
30 
31 #if defined(HAVE_CUDA)
32  if (flag_gpu) {
33  gpuFree(boundary->gpu_bounds);
34  gpuFree(boundary->gpu_is);
35  gpuFree(boundary->gpu_ie);
36  if (boundary->FlowVelocity) gpuFree(boundary->gpu_FlowVelocity );
37  }
38 #endif
39 
40  return 0;
41 }
Structure containing the variables and function pointers defining a boundary.
double * UnsteadyDirichletData
double * UnsteadyTimeLevels
double * UnsteadyTemperatureData
void gpuFree(void *)