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;
Base class for simulation and declarations for C functions.
void GetCTGridSizes(const int, std::vector< GridDimensions > &)
int InitializeBarebones(SimulationObject *)
void refineGrid1D(const GridDimensions &, const GridDimensions &, const double *const, double *const, int)
int InitializeBoundaries()
Structure defining a simulation.
Class describing sparse grids simulations.
std::vector< int > GridDimensions
long sum(const std::vector< int > &a_iv)
void CombinationTechnique(SimulationObject *const)
int InitializeSolversBarebones(SimulationObject *)
int InitializeImmersedBoundaries()
int ComputeSGDimsAndCoeffs()
void interpolateGrid(SimulationObject *const, const SimulationObject *const)
void allocateDataArrays(const GridDimensions &a_dim, const int a_nvars, double **const a_u, const int a_ngpt=0)
char aux_op_fname_root[_MAX_STRING_SIZE_]
int InitializePhysicsData()
void WriteErrors(double, double)
void usePetscTS(PetscBool a_flag)
void fillGhostCells(const GridDimensions &, const int, double *const, const int)
std::vector< SGCTElem > m_combination
int ComputeProcessorDistribution(ProcDistribution &, const GridDimensions &)
void allocateGridArrays(const GridDimensions &a_dim, double **const a_x, const int a_ngpt=0)
std::vector< SimulationObject > m_sims_sg
char op_fname_root[_MAX_STRING_SIZE_]
std::vector< bool > m_is_periodic
Contains some vector ops.
void computeError(SimulationObject &, double *const)
Base class for a simulation.
std::vector< int > ProcDistribution
void interpolate(SimulationObject *const, const SimulationObject *const)
int SetSolverParameters(SimulationObject &, const GridDimensions &, const ProcDistribution &, const SimulationObject &, const int, const int)
std::pair< double, GridDimensions > SGCTElem
int CleanupBarebones(SimulationObject *)
double cfunc(int a, int b)
std::vector< ProcDistribution > m_iprocs
int InitializationWrapup()
void coarsenGrid1D(const GridDimensions &, const GridDimensions &, const double *const, double *const, int)
long product(const std::vector< int > &a_iv)
SimulationObject * m_sim_fg
void OutputSolution(double)