HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ShallowWater1DWriteTopography.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  ShallowWater1D *params = (ShallowWater1D*) 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,mpi,
58  fname_root );
59  }
60 
61 
62  }
63 
64  return(0);
65 }
int * dim_global
Definition: hypar.h:33
Structure containing variables and parameters specific to the 1D Shallow Water equations. This structure contains the physical parameters, variables, and function pointers specific to the 1D ShallowWater equations.
void GetStringFromInteger(int, char *, int)
Function declarations for plotting functions.
void * physics
Definition: hypar.h:266
char plot_solution[_MAX_STRING_SIZE_]
Definition: hypar.h:194
int * dim_local
Definition: hypar.h:37
MPI related function definitions.
Function declarations for file I/O functions.
int ghosts
Definition: hypar.h:52
int nsims
Definition: hypar.h:64
int WriteArray(int, int, int *, int *, int, double *, double *, void *, void *, char *)
Definition: WriteArray.c:27
#define _MAX_STRING_SIZE_
Definition: basic.h:14
int PlotArray(int, int, int *, int *, int, double *, double *, double, void *, void *, char *)
Definition: PlotArray.c:31
Contains structure definition for hypar.
1D Shallow Water Equations
Some basic definitions and macros.
int ndims
Definition: hypar.h:26
Contains macros and function definitions for common array operations.
int my_idx
Definition: hypar.h:61
Structure of MPI-related variables.
double * x
Definition: hypar.h:107
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
int ShallowWater1DWriteTopography(void *, void *, double)
#define _DECLARE_IERR_
Definition: basic.h:17
Some common functions used here and there.