25 fprintf(stderr,
"Error in SparseGridsSimulation::fillGhostCells() -\n");
26 fprintf(stderr,
"m_is_periodic.size() != m_ndims \n");
30 for (
int d = 0; d <
m_ndims; d++) {
54 index_gpt[d] -= a_ngpt;
59 index_int[d] += (a_dim[d]-a_ngpt);
62 _ArrayCopy1D_((a_u+a_nvars*p_int), (a_u+a_nvars*p_gpt), a_nvars);
73 index_gpt[d] += a_dim[d];
80 _ArrayCopy1D_((a_u+a_nvars*p_int), (a_u+a_nvars*p_gpt), a_nvars);
105 index_gpt[d] -= a_ngpt;
120 double alpha = - (double) (a_ngpt - index[d]);
121 double c0 = -((-2.0 + alpha)*(-1.0 + alpha)*alpha)/6.0;
122 double c1 = ((-2.0 + alpha)*(-1.0 + alpha)*(1.0 + alpha))/2.0;
123 double c2 = (alpha*(2.0 + alpha - alpha*alpha))/2.0;
124 double c3 = (alpha*(-1.0 + alpha*alpha))/6.0;
126 for (
int v = 0; v < a_nvars; v++) {
128 a_u[p_gpt*a_nvars+v] = c0 * a_u[p_int_0*a_nvars+v]
129 + c1 * a_u[p_int_1*a_nvars+v]
130 + c2 * a_u[p_int_2*a_nvars+v]
131 + c3 * a_u[p_int_3*a_nvars+v];
148 index_gpt[d] += a_dim[d];
154 index_int[d] = a_dim[d]-1;
163 double alpha = - (double) (index[d]+1);
164 double c0 = -((-2.0 + alpha)*(-1.0 + alpha)*alpha)/6.0;
165 double c1 = ((-2.0 + alpha)*(-1.0 + alpha)*(1.0 + alpha))/2.0;
166 double c2 = (alpha*(2.0 + alpha - alpha*alpha))/2.0;
167 double c3 = (alpha*(-1.0 + alpha*alpha))/6.0;
169 for (
int v = 0; v < a_nvars; v++) {
171 a_u[p_gpt*a_nvars+v] = c0 * a_u[p_int_0*a_nvars+v]
172 + c1 * a_u[p_int_1*a_nvars+v]
173 + c2 * a_u[p_int_2*a_nvars+v]
174 + c3 * a_u[p_int_3*a_nvars+v];
std::vector< int > GridDimensions
void fillGhostCells(const GridDimensions &, const int, double *const, const int)
#define _ArrayIndex1D_(N, imax, i, ghost, index)
std::vector< bool > m_is_periodic
#define _ArraySetValue_(x, size, value)
#define _ArrayIncrementIndex_(N, imax, i, done)
#define _ArrayCopy1D_(x, y, size)
Contains macros and function definitions for common array operations.