27 uex = (
double*) calloc (size,
sizeof(
double));
59 std::vector<int> periodic_arr(
m_ndims);
69 uex2 = (
double*) calloc(size,
sizeof(
double));
87 double *uex_global_fg = NULL;
105 double *uex_global_sg = NULL;
114 periodic_arr.data() );
116 fprintf(stderr,
"InterpolateGlobalnDVar() returned with error!\n");
123 *
m_sims_sg[n].solver.npoints_local_wghosts;
124 double* uex_sg = (
double*) calloc(size,
sizeof(
double));
129 (
m_rank ? NULL : uex_global_sg),
137 if (!
m_rank) free(uex_global_sg);
156 double*
const a_uex )
158 static const double tolerance = 1e-15;
164 fprintf(stderr,
"Error in SparseGrids::computeError() -\n");
165 fprintf(stderr,
" exact solution pointer in NULL.\n");
170 double sum, global_sum;
171 double solution_norm[3] = {0.0,0.0,0.0};
181 solution_norm[1] = sqrt(global_sum/((
double)solver->
npoints_global));
186 solution_norm[2] = global_sum;
208 solver->
error[2] = global_sum;
214 if ( (solution_norm[0] > tolerance)
215 && (solution_norm[1] > tolerance)
216 && (solution_norm[2] > tolerance) ) {
217 solver->
error[0] /= solution_norm[0];
218 solver->
error[1] /= solution_norm[1];
219 solver->
error[2] /= solution_norm[2];
int MPIPartitionArraynDwGhosts(int, void *, double *, double *, int *, int *, int, int)
Structure defining a simulation.
int MPISum_double(double *, double *, int, void *)
Contains function definitions for common mathematical functions for C++ code.
std::vector< int > GridDimensions
long sum(const std::vector< int > &a_iv)
void allocateDataArrays(const GridDimensions &a_dim, const int a_nvars, double **const a_u, const int a_ngpt=0)
int MPIGatherArraynDwGhosts(int, void *, double *, double *, int *, int *, int, int)
INLINE double ArraySumAbsnD(int, int, int *, int, int *, double *)
Structure containing all solver-specific variables and functions.
#define _MAX_STRING_SIZE_
int InterpolateGlobalnDVar(const int *const, double **const, const int *const, double *const, const int, const int, const int, const int *const)
int MPIMax_double(double *, double *, int, void *)
#define _ArrayAXPY_(x, a, y, size)
std::vector< SimulationObject > m_sims_sg
std::vector< bool > m_is_periodic
Contains some vector ops.
void computeError(SimulationObject &, double *const)
int ExactSolution(void *, void *, double *, char *, int *)
INLINE double ArrayMaxnD(int, int, int *, int, int *, double *)
Structure of MPI-related variables.
int npoints_local_wghosts
SimulationObject * m_sim_fg
INLINE double ArraySumSquarenD(int, int, int *, int, int *, double *)
#define _ArrayCopy1D_(x, y, size)
Contains macros and function definitions for common array operations.
void copyFrom(std::vector< int > &a_iv, const int *const a_iv_carr, int a_n)