93VPUBLIC int Vpmgp_ctor2(Vpmgp *thee,MGparm *mgparm) {
95 /* Specified parameters */
96 thee->nx = mgparm->dime[0];
97 thee->ny = mgparm->dime[1];
98 thee->nz = mgparm->dime[2];
99 thee->hx = mgparm->grid[0];
100 thee->hy = mgparm->grid[1];
101 thee->hzed = mgparm->grid[2];
102 thee->xlen = ((
double)(mgparm->dime[0]-1))*mgparm->grid[0];
103 thee->ylen = ((
double)(mgparm->dime[1]-1))*mgparm->grid[1];
104 thee->zlen = ((
double)(mgparm->dime[2]-1))*mgparm->grid[2];
105 thee->nlev = mgparm->nlev;
107 thee->nonlin = mgparm->nonlintype;
108 thee->meth = mgparm->method;
110#ifdef DEBUG_MAC_OSX_OCL
111#include "mach_chud.h"
116 if (thee->nonlin == NONLIN_LPBE) thee->ipkey =
IPKEY_LPBE;
117 else if(thee->nonlin == NONLIN_SMPBE) thee->ipkey =
IPKEY_SMPBE;
121 if (mgparm->setetol) {
122 thee->errtol = mgparm->etol;
123 Vnm_print(1,
" Error tolerance (etol) is now set to user-defined \
124value: %g \n", thee->errtol);
125 Vnm_print(0,
"Error tolerance (etol) is now set to user-defined \
126value: %g \n", thee->errtol);
127 }
else thee->errtol = 1.0e-6;
144 thee->omegal = 19.4e-1;
145 thee->omegan = 9.0e-1;
154 if (thee->nonlin == NONLIN_NPBE || thee->nonlin == NONLIN_SMPBE) {
156 Vnm_print(0,
"Vpmp_ctor2: Using meth = 1, mgsolv = 0\n");
160 Vnm_print(0,
"Vpmp_ctor2: Using meth = 2, mgsolv = 1\n");
168 if(mgparm->useAqua == 1) thee->mgsolv = 0;
196VPUBLIC void Vpmgp_size(
204 int nxf, nyf, nzf, level, num_nf_oper, num_narrc_oper, n_band, nc_band, num_band, iretot;
206 thee->nf = thee->nx * thee->ny * thee->nz;
207 thee->narr = thee->nf;
211 thee->nxc = thee->nx;
212 thee->nyc = thee->ny;
213 thee->nzc = thee->nz;
215 for (level=2; level<=thee->nlev; level++) {
216 Vpmgp_makeCoarse(1, nxf, nyf, nzf, &(thee->nxc), &(thee->nyc), &(thee->nzc)); /* NAB TO-DO -- implement this function and check which variables need to be passed by reference... */
220 thee->narr = thee->narr + (nxf * nyf * nzf);
223 thee->nc = thee->nxc * thee->nyc * thee->nzc;
224 thee->narrc = thee->narr - thee->nf;
227 switch (thee->mgdisc) {
235 Vnm_print(2,
"Vpmgp_size: Invalid mgdisc value (%d)!\n", thee->mgdisc);
240 switch (thee->mgcoar) {
242 if (thee->mgdisc != 0) {
243 Vnm_print(2,
"Vpmgp_size: Invalid mgcoar value (%d); must be used with mgdisc 0!\n", thee->mgcoar);
249 if (thee->mgdisc != 0) {
250 Vnm_print(2,
"Vpmgp_size: Invalid mgcoar value (%d); must be used with mgdisc 0!\n", thee->mgcoar);
259 Vnm_print(2,
"Vpmgp_size: Invalid mgcoar value (%d)!\n", thee->mgcoar);
264 switch (thee->mgsolv) {
269 if ( ( (thee->mgcoar == 0) || (thee->mgcoar == 1)) && (thee->mgdisc == 0) ) {
270 num_band = 1 + (thee->nxc-2)*(thee->nyc-2);
272 num_band = 1 + (thee->nxc-2)*(thee->nyc-2) + (thee->nxc-2) + 1;
274 nc_band = (thee->nxc-2)*(thee->nyc-2)*(thee->nzc-2);
275 n_band = nc_band * num_band;
278 Vnm_print(2,
"Vpmgp_size: Invalid mgsolv value (%d)!\n", thee->mgsolv);
283 thee->n_rpc = 100*(thee->nlev+1);
286 thee->nrwk = num_narr*thee->narr + (size_t)(num_nf + num_nf_oper)*thee->nf + (size_t)(num_narrc + num_narrc_oper)*thee->narrc + n_band + thee->n_rpc;
289 thee->n_iz = 50*(thee->nlev+1);
290 thee->n_ipc = 100*(thee->nlev+1);
291 thee->niwk = thee->n_iz + thee->n_ipc;
322 int nxtmp, nytmp, nztmp, iLevel;
324 for (iLevel=0; iLevel<numLevel; iLevel++) {
328 *nxNew = coarsenThis(nxtmp);
329 *nyNew = coarsenThis(nytmp);
330 *nzNew = coarsenThis(nztmp);
VPUBLIC void Vpmgp_makeCoarse(int numLevel, int nxOld, int nyOld, int nzOld, int *nxNew, int *nyNew, int *nzNew)
Coarsen the grid by the desired number of levels and determine the resulting numbers of grid points.