HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
IBComputeBoundingBox.c File Reference

Compute bounding box for an immersed body. More...

Go to the source code of this file.

Functions

int IBComputeBoundingBox (Body3D *b)
 

Detailed Description

Compute bounding box for an immersed body.

Author
Debojyoti Ghosh

Definition in file IBComputeBoundingBox.c.

Function Documentation

int IBComputeBoundingBox ( Body3D b)

Compute the bounding box for a given body.

Parameters
bThe body

Definition at line 9 of file IBComputeBoundingBox.c.

10 {
11  b->xmin = b->xmax = b->surface[0].x1;
12  b->ymin = b->ymax = b->surface[0].y1;
13  b->zmin = b->zmax = b->surface[0].z1;
14 
15  int n;
16  for (n = 0; n < b->nfacets; n++) {
17  if (b->surface[n].x1 < b->xmin) b->xmin = b->surface[n].x1;
18  if (b->surface[n].x2 < b->xmin) b->xmin = b->surface[n].x2;
19  if (b->surface[n].x3 < b->xmin) b->xmin = b->surface[n].x3;
20 
21  if (b->surface[n].y1 < b->ymin) b->ymin = b->surface[n].y1;
22  if (b->surface[n].y2 < b->ymin) b->ymin = b->surface[n].y2;
23  if (b->surface[n].y3 < b->ymin) b->ymin = b->surface[n].y3;
24 
25  if (b->surface[n].z1 < b->zmin) b->zmin = b->surface[n].z1;
26  if (b->surface[n].z2 < b->zmin) b->zmin = b->surface[n].z2;
27  if (b->surface[n].z3 < b->zmin) b->zmin = b->surface[n].z3;
28 
29  if (b->surface[n].x1 > b->xmax) b->xmax = b->surface[n].x1;
30  if (b->surface[n].x2 > b->xmax) b->xmax = b->surface[n].x2;
31  if (b->surface[n].x3 > b->xmax) b->xmax = b->surface[n].x3;
32 
33  if (b->surface[n].y1 > b->ymax) b->ymax = b->surface[n].y1;
34  if (b->surface[n].y2 > b->ymax) b->ymax = b->surface[n].y2;
35  if (b->surface[n].y3 > b->ymax) b->ymax = b->surface[n].y3;
36 
37  if (b->surface[n].z1 > b->zmax) b->zmax = b->surface[n].z1;
38  if (b->surface[n].z2 > b->zmax) b->zmax = b->surface[n].z2;
39  if (b->surface[n].z3 > b->zmax) b->zmax = b->surface[n].z3;
40  }
41  return(0);
42 }
Facet3D * surface