27 extern CkVec <CProxy_FFTcache> UfftCacheProxy;
36 RhoRealSlab::~RhoRealSlab(){
53 void initRhoRealSlab(
RhoRealSlab *rho_rs,
int xdim,
int ydim,
int zdim,
54 int xdimA,
int ydimA,
int myIndexX,
int myIndexY,
60 rho_rs->rhoRsubplanes = rhoRsubplanes;
65 rho_rs->size = (rho_rs->sizeX+2) * (rho_rs->sizeY);
66 rho_rs->trueSize = (rho_rs->sizeX) * (rho_rs->sizeY);
68 int sizenow = rho_rs->size;
69 int csizenow = sizenow/2;
74 rho_rs->Vks =
reinterpret_cast<double*
> (dummy);
77 rho_rs->densityC = dummy;
78 rho_rs->density =
reinterpret_cast<double*
> (dummy);
81 rho_rs->rhoIRXC = dummy;
82 rho_rs->rhoIRX =
reinterpret_cast<double*
> (dummy);
85 rho_rs->rhoIRYC = dummy;
86 rho_rs->rhoIRY =
reinterpret_cast<double*
> (dummy);
89 rho_rs->rhoIRZC = dummy;
90 rho_rs->rhoIRZ =
reinterpret_cast<double*
> (dummy);
93 rho_rs->VksHartC = dummy;
94 rho_rs->VksHart =
reinterpret_cast<double*
> (dummy);
100 rho_rs->rsizeInt = 0;
103 csizenow = xdimA*ydimA;
104 rho_rs->csizeInt = csizenow;
105 rho_rs->rsizeInt = 2*csizenow;
108 rho_rs->rhoIRXCint = dummy;
109 rho_rs->rhoIRXint =
reinterpret_cast<double*
> (dummy);
112 rho_rs->rhoIRYCint = dummy;
113 rho_rs->rhoIRYint =
reinterpret_cast<double*
> (dummy);
116 rho_rs->rhoIRZCint = dummy;
117 rho_rs->rhoIRZint =
reinterpret_cast<double*
> (dummy);
120 rho_rs->VksHartCint = dummy;
121 rho_rs->VksHartint =
reinterpret_cast<double*
> (dummy);
133 RhoGSlab::~RhoGSlab(){
135 if(Rho !=NULL)fftw_free(Rho);
136 if(divRhoX !=NULL)fftw_free(divRhoX);
137 if(divRhoY !=NULL)fftw_free(divRhoY);
138 if(divRhoZ !=NULL)fftw_free(divRhoZ);
139 if(packedRho!=NULL)fftw_free(packedRho);
140 if(packedVks!=NULL)fftw_free(packedVks);
142 if(runs!=NULL)
delete [] runs;
143 if(k_x !=NULL) fftw_free(k_x);
144 if(k_y !=NULL) fftw_free(k_y);
145 if(k_z !=NULL) fftw_free(k_z);
146 if(perdCorr!=NULL)fftw_free(perdCorr);
154 void RhoGSlab::pup(PUP::er &p) {
172 bool divRhoXMake =
false;
173 bool divRhoYMake =
false;
174 bool divRhoZMake =
false;
175 bool packedRhoMake=
false;
176 bool packedVksMake=
false;
178 if(!p.isUnpacking()){
179 RhoMake = (Rho !=NULL) ?
true :
false;
180 divRhoXMake = (divRhoX !=NULL) ?
true :
false;
181 divRhoYMake = (divRhoY !=NULL) ?
true :
false;
182 divRhoZMake = (divRhoZ !=NULL) ?
true :
false;
183 packedRhoMake = (packedRho!=NULL) ?
true :
false;
184 packedVksMake = (packedVks!=NULL) ?
true :
false;
185 VksMake = (Vks !=NULL) ?
true :
false;
226 k_x = (
int *)fftw_malloc(numPoints*
sizeof(
int));
227 k_y = (
int *)fftw_malloc(numPoints*
sizeof(
int));
228 k_z = (
int *)fftw_malloc(numPoints*
sizeof(
int));
230 if(iperd!=3){perdCorr = (
double *)fftw_malloc(numPoints*
sizeof(
double));}
233 if(RhoMake) PUParray(p,Rho,numFull);
234 if(divRhoXMake) PUParray(p,divRhoX,numFull);
235 if(divRhoYMake) PUParray(p,divRhoY,numFull);
236 if(divRhoZMake) PUParray(p,divRhoZ,numFull);
237 if(packedRhoMake) PUParray(p,packedRho,nPacked);
238 if(packedVksMake) PUParray(p,packedVks,nPacked);
239 if(VksMake) PUParray(p,Vks,numFull);
241 PUParray(p,runs,numRuns);
242 PUParray(p,k_x,numPoints);
243 PUParray(p,k_y,numPoints);
244 PUParray(p,k_z,numPoints);
245 if(iperd!=3){PUParray(p,perdCorr,numPoints);}
267 bzero(divRhoX,
sizeof(
complex)*numFull);
268 bzero(divRhoY,
sizeof(
complex)*numFull);
269 bzero(divRhoZ,
sizeof(
complex)*numFull);
273 for (
int r = 0,l=0; r < numRuns; r+=2,l++) {
275 int joff = l*nfftz + runs[r].z;
276 for (
int i=0,j=joff,k=koff; i<runs[r].length; i++,j++,k++) {
277 gx = tpi*(k_x[k]*hmati[1] + k_y[k]*hmati[2] + k_z[k]*hmati[3]);
278 gy = tpi*(k_x[k]*hmati[4] + k_y[k]*hmati[5] + k_z[k]*hmati[6]);
279 gz = tpi*(k_x[k]*hmati[7] + k_y[k]*hmati[8] + k_z[k]*hmati[9]);
280 complex tmp = (tmpRho[k].multiplyByi())*(-1.0);
285 koff += runs[r].length;
288 joff = l*nfftz + runs[r1].z;
289 for (
int i=0,j=joff,k=koff; i<runs[r1].length; i++,j++,k++) {
290 gx = tpi*(k_x[k]*hmati[1] + k_y[k]*hmati[2] + k_z[k]*hmati[3]);
291 gy = tpi*(k_x[k]*hmati[4] + k_y[k]*hmati[5] + k_z[k]*hmati[6]);
292 gz = tpi*(k_x[k]*hmati[7] + k_y[k]*hmati[8] + k_z[k]*hmati[9]);
293 complex tmp = (tmpRho[k].multiplyByi())*(-1.0);
298 koff += runs[r1].length;
302 CkAssert(numPoints == koff);
328 for (
int r = 0,l=0; r < numRuns; r+=2,l++) {
330 int joff1 = l*nfftz + runs[r].z;
331 for (
int i=0,j=joff1,k=koff; i<runs[r].length; i++,j++,k++) {
332 gx = tpi*(k_x[k]*hmati[1] + k_y[k]*hmati[2] + k_z[k]*hmati[3]);
333 gy = tpi*(k_x[k]*hmati[4] + k_y[k]*hmati[5] + k_z[k]*hmati[6]);
334 gz = tpi*(k_x[k]*hmati[7] + k_y[k]*hmati[8] + k_z[k]*hmati[9]);
335 tmp = divRhoX[j]*gx + divRhoY[j]*gy + divRhoZ[j]*gz;
336 whitebyrd[j] = tmp.multiplyByi()*(-1.0);
338 koff += runs[r].length;
341 int joff2 = l*nfftz + runs[r1].z;
342 for (
int i=0,j=joff2,k=koff; i<runs[r1].length; i++,j++,k++) {
343 gx = tpi*(k_x[k]*hmati[1] + k_y[k]*hmati[2] + k_z[k]*hmati[3]);
344 gy = tpi*(k_x[k]*hmati[4] + k_y[k]*hmati[5] + k_z[k]*hmati[6]);
345 gz = tpi*(k_x[k]*hmati[7] + k_y[k]*hmati[8] + k_z[k]*hmati[9]);
346 tmp = divRhoX[j]*gx + divRhoY[j]*gy + divRhoZ[j]*gz;
347 whitebyrd[j] = tmp.multiplyByi()*(-1.0);
349 koff += runs[r1].length;
351 int joff3 = joff2+runs[r1].length;
352 for(
int j=joff3;j<joff1;j++){whitebyrd[j]=0.0;}
356 CkAssert(numPoints == koff);
376 k_x = (
int *)fftw_malloc(numPoints*
sizeof(
int));
377 k_y = (
int *)fftw_malloc(numPoints*
sizeof(
int));
378 k_z = (
int *)fftw_malloc(numPoints*
sizeof(
int));
380 int r, i, dataCovered = 0;
382 for (r = 0; r < numRuns; r++) {
384 if (x > sizeX/2) x -= sizeX;
386 if (y > sizeY/2) y -= sizeY;
388 if (z > sizeZ/2) z -= sizeZ;
390 for (i = 0; i < runs[r].length; i++) {
391 k_x[dataCovered] = x;
392 k_y[dataCovered] = y;
393 k_z[dataCovered] = (z+i);
398 CkAssert(dataCovered == numPoints);
412 void RhoRealSlab::pup(PUP::er &p) {
429 Vks =
reinterpret_cast<double*
> (VksC);
431 density =
reinterpret_cast<double*
> (densityC);
433 rhoIRX =
reinterpret_cast<double*
> (rhoIRXC);
435 rhoIRY =
reinterpret_cast<double*
> (rhoIRYC);
437 rhoIRZ =
reinterpret_cast<double*
> (rhoIRZC);
439 VksHart =
reinterpret_cast<double*
> (VksHartC);
442 rhoIRXint =
reinterpret_cast<double*
> (rhoIRXCint);
444 rhoIRYint =
reinterpret_cast<double*
> (rhoIRYCint);
446 rhoIRZint =
reinterpret_cast<double*
> (rhoIRZCint);
448 VksHartint =
reinterpret_cast<double*
> (VksHartCint);
451 PUParray(p,Vks, size);
452 PUParray(p,density,size);
453 PUParray(p,rhoIRX, size);
454 PUParray(p,rhoIRY, size);
455 PUParray(p,rhoIRZ, size);
456 PUParray(p,VksHart,size);
458 if(rhoRsubplanes==1){
459 PUParray(p,rhoIRXint, rsizeInt);
460 PUParray(p,rhoIRYint, rsizeInt);
461 PUParray(p,rhoIRZint, rsizeInt);
462 PUParray(p,VksHartint,rsizeInt);
472 void RhoRealSlab::uPackScale(
double *uPackData,
double *PackData,
double scale){
474 for(
int i=0;i<size;i++){uPackData[i] = PackData[i]*scale;}
483 void RhoRealSlab::scale(
double *uPackData,
double scale){
485 for(
int i=0;i<size;i++){uPackData[i] *= scale;}
493 void RhoRealSlab::uPackScaleShrink(
double *uPackData,
double *PackData,
double scale){
495 for(
int i=0,i2=0;i<sizeY;i++,i2+=2){
496 for(
int j=i*sizeX;j<(i+1)*sizeX;j++){
497 uPackData[j] =PackData[(j+i2)]*scale;
508 void RhoRealSlab::uPackShrink(
double *uPackData,
double *PackData){
510 for(
int i=0,i2=0;i<sizeY;i++,i2+=2){
511 for(
int j=i*sizeX;j<(i+1)*sizeX;j++){
512 uPackData[j] =PackData[(j+i2)];
522 void RhoRealSlab::uPackScaleGrow(
double *uPackData,
double *PackData,
double scale){
523 for(
int i=0,i2=0;i<sizeY;i++,i2+=2){
524 for(
int j=i*sizeX;j<(i+1)*sizeX;j++){
525 uPackData[(j+i2)] =PackData[j]*scale;
527 int k = (i+1)*sizeX+i2;
529 uPackData[(k+1)]=0.0;
Add type declarations for simulationConstants class (readonly vars) and once class for each type of o...
void createWhiteByrd(double *, double)
= packed g-space of size numPoints is expanded to numFull =numRuns/2*nfftz
== Index logic for lines of constant x,y in gspace.
Some basic data structures and the array map classes are defined here.
void divRhoGdot(double *, double, complex *)
= packed g-space of size numPoints is expanded to numFull =numRuns/2*nfftz