12 #if defined(HAVE_CUDA) 30 int n, flag, d, i, offset, ierr;
32 for (n = 0; n < nsims; n++) {
40 strcat(fname_root,
"_");
41 strcat(fname_root, index);
56 fprintf(stderr,
"Error in InitialSolution() on rank %d.\n",
61 fprintf(stderr,
"Error: initial solution file not found.\n");
79 = 2.0 / (simobj[n].
solver.
x[i+1+offset+ghosts]-simobj[n].
solver.
x[i-1+offset+ghosts]);
88 &(simobj[n].solver.dxinv[offset]),
94 fprintf(stderr,
"Error in InitialSolution() on rank %d.\n",
106 if (simobj[n].mpi.ip[d] == 0) {
108 for (i = 0; i < ghosts; i++) dxinv[i] = dxinv[ghosts];
110 if (simobj[n].mpi.ip[d] == simobj[n].
mpi.
iproc[d]-1) {
112 for (i = dim[d]+ghosts; i < dim[d]+2*ghosts; i++) dxinv[i] = dxinv[dim[d]+ghosts-1];
114 offset += (dim[d] + 2*ghosts);
123 fprintf(stderr,
"Error in InitialSolution() on rank %d.\n",
127 if (!simobj[n].mpi.rank) {
128 if (nsims > 1) printf(
"Volume integral of the initial solution on domain %d:\n", n);
129 else printf(
"Volume integral of the initial solution:\n");
131 printf(
"%2d: %1.16E\n",d,simobj[n].solver.VolumeIntegralInitial[d]);
139 #if defined(HAVE_CUDA) 140 if (simobj[0].solver.use_gpu) {
141 for (
int n = 0; n < nsims; n++) {
153 #ifdef CUDA_VAR_ORDERDING_AOS 159 double *h_u = (
double *) malloc(simobj[n].solver.ndof_cells_wghosts*
sizeof(
double));
160 for (
int i=0; i<npoints_local_wghosts; i++) {
161 for (
int v=0; v<nvars; v++) {
162 h_u[i+v*npoints_local_wghosts] = simobj[n].
solver.
u[i*nvars+v];
Some common functions used here and there.
MPI related function definitions.
Contains function definitions for common array operations on GPU.
Structure defining a simulation.
int MPIExchangeBoundariesnD(int, int, int *, int, void *, double *)
Some basic definitions and macros.
int MPIExchangeBoundaries1D(void *, double *, int, int, int, int)
int InitialSolution(void *s, int nsims)
#define _MAX_STRING_SIZE_
void GetStringFromInteger(int, char *, int)
#define _ArraySetValue_(x, size, value)
void gpuMemcpy(void *, const void *, size_t, enum gpuMemcpyKind)
int VolumeIntegral(double *, double *, void *, void *)
int ReadArray(int, int, int *, int *, int, void *, void *, double *, double *, char *, int *)
int npoints_local_wghosts
Function declarations for file I/O functions.
Contains macros and function definitions for common array operations.