HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
ShallowWater2DWriteTopography.c
Go to the documentation of this file.
1 
5 #include <stdlib.h>
6 #include <string.h>
7 #include <basic.h>
8 #include <common.h>
9 #include <arrayfunctions.h>
10 #include <io.h>
11 #include <plotfuncs.h>
12 #include <mpivars.h>
13 #include <hypar.h>
15 
18  void* m,
19  double a_t )
20 {
21  HyPar *solver = (HyPar*) s;
22  MPIVariables *mpi = (MPIVariables*) m;
23  ShallowWater2D *params = (ShallowWater2D*) solver->physics;
25 
26  if (params->topo_flag) {
27 
28  char fname_root[_MAX_STRING_SIZE_] = "topography";
29  if (solver->nsims > 1) {
30  char index[_MAX_STRING_SIZE_];
31  GetStringFromInteger(solver->my_idx, index, (int)log10(solver->nsims)+1);
32  strcat(fname_root, "_");
33  strcat(fname_root, index);
34  strcat(fname_root, "_");
35  }
36 
37  WriteArray( solver->ndims,
38  1,
39  solver->dim_global,
40  solver->dim_local,
41  solver->ghosts,
42  solver->x,
43  params->b,
44  solver,
45  mpi,
46  fname_root );
47 
48  if (!strcmp(solver->plot_solution, "yes")) {
49  PlotArray( solver->ndims,
50  1,
51  solver->dim_global,
52  solver->dim_local,
53  solver->ghosts,
54  solver->x,
55  params->b,
56  a_t,
57  solver,
58  mpi,
59  fname_root );
60  }
61 
62  }
63 
64  return(0);
65 }
Some common functions used here and there.
char plot_solution[_MAX_STRING_SIZE_]
Definition: hypar.h:194
MPI related function definitions.
int PlotArray(int, int, int *, int *, int, double *, double *, double, void *, void *, char *)
Definition: PlotArray.c:31
int nsims
Definition: hypar.h:64
Some basic definitions and macros.
double * x
Definition: hypar.h:107
2D Shallow Water Equations
int ndims
Definition: hypar.h:26
Structure containing variables and parameters specific to the 2D Shallow Water equations. This structure contains the physical parameters, variables, and function pointers specific to the 2D ShallowWater equations.
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
Function declarations for plotting functions.
#define _MAX_STRING_SIZE_
Definition: basic.h:14
int ShallowWater2DWriteTopography(void *s, void *m, double a_t)
Contains structure definition for hypar.
int WriteArray(int, int, int *, int *, int, double *, double *, void *, void *, char *)
Definition: WriteArray.c:27
void GetStringFromInteger(int, char *, int)
int my_idx
Definition: hypar.h:61
int * dim_local
Definition: hypar.h:37
void * physics
Definition: hypar.h:266
int ghosts
Definition: hypar.h:52
Structure of MPI-related variables.
#define _DECLARE_IERR_
Definition: basic.h:17
Function declarations for file I/O functions.
Contains macros and function definitions for common array operations.
int * dim_global
Definition: hypar.h:33