HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
IBWriteBodySTL.c
Go to the documentation of this file.
1 
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <basic.h>
9 #include <mpivars.h>
10 #include <immersedboundaries.h>
11 
12 
24  Body3D *body,
25  char *filename,
26  void *m,
27  int rank,
28  int *stat
29  )
30 {
31  MPIVariables *mpi = (MPIVariables*) m;
32 
33  if (mpi->rank == rank) {
34  FILE *out;
35  out = fopen(filename,"w");
36  if (!out) {
37  fprintf(stderr,"Error in IBWriteBodySTL(): Unable to open file ");
38  fprintf(stderr,"%s for writing on rank %d.\n",filename,mpi->rank);
39  *stat = 1;
40  } else {
41  fprintf(out,"solid TEST\n");
42  int n;
43  for (n = 0; n < body->nfacets; n++) {
44  fprintf(out," facet normal %1.16e %1.16e %1.16e\n",
45  body->surface[n].nx,body->surface[n].ny,body->surface[n].nz);
46  fprintf(out," outer loop\n");
47  fprintf(out," vertex %1.16e %1.16e %1.16e\n",
48  body->surface[n].x1,body->surface[n].y1,body->surface[n].z1);
49  fprintf(out," vertex %1.16e %1.16e %1.16e\n",
50  body->surface[n].x2,body->surface[n].y2,body->surface[n].z2);
51  fprintf(out," vertex %1.16e %1.16e %1.16e\n",
52  body->surface[n].x3,body->surface[n].y3,body->surface[n].z3);
53  fprintf(out," endloop\n");
54  fprintf(out," endfacet\n");
55  }
56  fprintf(out,"endsolid TEST\n");
57  *stat = 0;
58  }
59  }
60  return(0);
61 }
62 
Structure defining a body.
Structures and function definitions for immersed boundaries.
int IBWriteBodySTL(Body3D *, char *, void *, int, int *)
MPI related function definitions.
Facet3D * surface
Some basic definitions and macros.
Structure of MPI-related variables.