HyPar
1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
|
Functions to interpolate from one grid to another. More...
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <arrayfunctions.h>
#include <mathfunctions.h>
Go to the source code of this file.
Functions | |
static int | isPowerOfTwo (int x) |
static int | coarsen1D (const int *const a_dim_src, const int *const a_dim_dst, const double *const a_u_src, double *const a_u_dst, const int a_dir, const int a_nvars, const int a_ngpt, const int a_ndims) |
static int | refine1D (const int *const a_dim_src, const int *const a_dim_dst, const double *const a_u_src, double *const a_u_dst, const int a_dir, const int a_nvars, const int a_ngpt, const int a_ndims) |
int | InterpolateGlobalnDVar (const int *const a_dim_dst, double **const a_u_dst, const int *const a_dim_src, double *const a_u_src, const int a_nvars, const int a_ghosts, const int a_ndims, const int *const a_periodic) |
Functions to interpolate from one grid to another.
Definition in file InterpolateGlobalnDVar.c.
|
static |
Is the input number an integer power of 2?
Definition at line 13 of file InterpolateGlobalnDVar.c.
|
static |
Coarsen along a given dimension - the source and destination must have the same sizes along all other dimensions.
Note that the arrays must not have any ghost points!
Currently this function can only handle coarsening factors that are integer powers of 2.
a_dim_src | Grid size of source data |
a_dim_dst | Grid size of destination data |
a_u_src | Source solution |
a_u_dst | Destination solution |
a_dir | Dimension along which to coarsen |
a_nvars | Number of vector components of the solution |
a_ngpt | Number of ghost points |
a_ndims | Number of spatial dimensions |
Definition at line 32 of file InterpolateGlobalnDVar.c.
|
static |
Refine along a given dimension - the source and destination must have the same sizes along all other dimensions.
Note that the arrays must not have any ghost points!
Currently this function can only handle refinement factors that are integer powers of 2.
a_dim_src | Grid size of source data |
a_dim_dst | Grid size of destination data |
a_u_src | Source solution |
a_u_dst | Destination solution |
a_dir | Dimension along which to coarsen |
a_nvars | Number of vector components of the solution |
a_ngpt | Number of ghost points |
a_ndims | Number of spatial dimensions |
Definition at line 163 of file InterpolateGlobalnDVar.c.
int InterpolateGlobalnDVar | ( | const int *const | a_dim_dst, |
double **const | a_u_dst, | ||
const int *const | a_dim_src, | ||
double *const | a_u_src, | ||
const int | a_nvars, | ||
const int | a_ghosts, | ||
const int | a_ndims, | ||
const int *const | a_periodic | ||
) |
Interpolate n-dimensional data from one grid to another of a desired resolution. Note that along each dimension, the ratio of the number of grid points in the source grid and that in the destination grid must be an integer power of 2 (negative or positive).
The source data must be global. It will get deallocated at the end of this function. It must have the appropriate number of ghost points.
The incoming pointer for destination data must be NULL. After this function is executed, it will point to a chunk of memory with the interpolated solution. This is the global solution. It will have the specified number of ghost points appropriately filled.
a_dim_dst | grid dimensions to interpolate to |
a_u_dst | pointer to array containing interpolated data |
a_dim_src | grid dimensions to interpolate from |
a_u_src | pointer to array containing data to interpolate from |
a_nvars | Number of vector components of the solution |
a_ghosts | Number of ghost points |
a_ndims | Number of spatial dimensions |
a_periodic | Is the domain periodic or not along each dimension |
Definition at line 317 of file InterpolateGlobalnDVar.c.