6 #ifndef _SPARSE_GRIDS_SIM_H_
7 #define _SPARSE_GRIDS_SIM_H_
18 #define _SPARSEGRIDS_SIM_INP_FNAME_ "sparse_grids.inp"
22 typedef std::pair<double, GridDimensions>
SGCTElem;
74 printf(
"Error: CleanUp() returned with status %d on process %d.\n",
107 for (
int d=0; d<
m_ndims; d++) {
134 for (
int ns = 0; ns <
m_sims_sg.size(); ns++) {
140 fprintf(stderr,
"Error in SparseGridsSimulation::InitializePhysicsData()\n");
141 fprintf(stderr,
" InitializePhysicsData returned with error code %d on rank %d.\n",
158 strcpy(
m_sims_sg[i].solver.op_fname_root,
"op_sg");
159 strcpy(
m_sims_sg[i].solver.aux_op_fname_root,
"ts0_sg");
183 fprintf(stderr,
"Error in SparseGridsSimulation::mpiCommDup()\n");
184 fprintf(stderr,
" m_sim_fg is not allocated on rank %d!\n",
m_rank);
319 if (x == 0)
return false;
322 if (x%2 != 0)
return false;
338 for (
int i=1; i<=a; i++) retval *= i;
345 const int a_ngpt = 0)
348 for (
int i=0; i<dim_wghosts.size(); i++) {
349 dim_wghosts[i] += (2*a_ngpt);
352 (*a_x) = (
double*) calloc (size_x,
sizeof(
double));
353 for (
int i=0; i<size_x; i++) (*a_x)[i] = 0.0;
361 const int a_ngpt = 0)
364 for (
int i=0; i<dim_wghosts.size(); i++) {
365 dim_wghosts[i] += (2*a_ngpt);
368 (*a_u) = (
double*) calloc (size_u,
sizeof(
double));
369 for (
int i=0; i<size_u; i++) (*a_u)[i] = 0.0;
std::vector< SimulationObject > m_sims_sg
void WriteErrors(double, double)
Class describing sparse grids simulations.
int InitializeBoundaries()
Contains some vector ops.
int InitializeBarebones(SimulationObject *)
void interpolateGrid(SimulationObject *const, const SimulationObject *const)
char aux_op_fname_root[_MAX_STRING_SIZE_]
int ComputeSGDimsAndCoeffs()
int SetSolverParameters(SimulationObject &, const GridDimensions &, const ProcDistribution &, const SimulationObject &, const int, const int)
Base class for simulation and declarations for C functions.
int InitializationWrapup()
int InitializePhysicsData()
void GetCTGridSizes(const int, std::vector< GridDimensions > &)
int ComputeProcessorDistribution(ProcDistribution &, const GridDimensions &)
int InitializeSolversBarebones(SimulationObject *)
std::vector< bool > m_is_periodic
char op_fname_root[_MAX_STRING_SIZE_]
std::pair< double, GridDimensions > SGCTElem
void allocateDataArrays(const GridDimensions &a_dim, const int a_nvars, double **const a_u, const int a_ngpt=0)
SimulationObject * m_sim_fg
long product(const std::vector< int > &a_iv)
void usePetscTS(PetscBool a_flag)
double cfunc(int a, int b)
int InitializeImmersedBoundaries()
long sum(const std::vector< int > &a_iv)
void computeError(SimulationObject &, double *const)
void refineGrid1D(const GridDimensions &, const GridDimensions &, const double *const, double *const, int)
void interpolate(SimulationObject *const, const SimulationObject *const)
void coarsenGrid1D(const GridDimensions &, const GridDimensions &, const double *const, double *const, int)
std::vector< int > ProcDistribution
void allocateGridArrays(const GridDimensions &a_dim, double **const a_x, const int a_ngpt=0)
int CleanupBarebones(SimulationObject *)
Structure defining a simulation.
std::vector< ProcDistribution > m_iprocs
std::vector< SGCTElem > m_combination
void OutputSolution(double)
std::vector< int > GridDimensions
void CombinationTechnique(SimulationObject *const)
void fillGhostCells(const GridDimensions &, const int, double *const, const int)
Base class for a simulation.