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

Read in exact solution, if available. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <basic.h>
#include <arrayfunctions.h>
#include <io.h>
#include <mpivars.h>
#include <hypar.h>

Go to the source code of this file.

Functions

int ExactSolution (void *s, void *m, double *uex, char *fname, int *flag)
 

Detailed Description

Read in exact solution, if available.

Author
Debojyoti Ghosh

Definition in file ExactSolution.c.

Function Documentation

int ExactSolution ( void *  s,
void *  m,
double *  uex,
char *  fname,
int *  flag 
)

Read in the exact solution, if available.

Parameters
sSolver object of type HyPar
mMPI object of type MPIVariables
uexArray to hold the exact solution, if available
fnameFilename root from which to read exact solution
flagFlag to indicate if exact solution was available

Definition at line 16 of file ExactSolution.c.

23 {
24  HyPar *solver = (HyPar*) s;
25 
26  int same_size = 1;
27  for (int i=0; i<solver->ndims; i++) {
28  if (solver->dim_global[i] != solver->dim_global_ex[i]) same_size = 0;
29  }
30 
31  if (same_size) {
32  ReadArray( solver->ndims,
33  solver->nvars,
34  solver->dim_global,
35  solver->dim_local,
36  solver->ghosts,
37  solver,
38  m,
39  NULL,
40  uex,
41  fname,
42  flag);
43  } else {
44  ReadArraywInterp( solver->ndims,
45  solver->nvars,
46  solver->dim_global,
47  solver->dim_local,
48  solver->dim_global_ex,
49  solver->ghosts,
50  solver,
51  m,
52  NULL,
53  uex,
54  fname,
55  flag);
56  }
57 
58  return(0);
59 }
int * dim_global
Definition: hypar.h:33
int * dim_global_ex
Definition: hypar.h:75
int * dim_local
Definition: hypar.h:37
int ghosts
Definition: hypar.h:52
int ReadArray(int, int, int *, int *, int, void *, void *, double *, double *, char *, int *)
Definition: ReadArray.c:25
int nvars
Definition: hypar.h:29
int ReadArraywInterp(int, int, int *, int *, int *, int, void *, void *, double *, double *, char *, int *)
int ndims
Definition: hypar.h:26
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23