黄老板逆天重写
This commit is contained in:
@@ -13,7 +13,7 @@ using namespace std;
|
||||
#include "MPatch.h"
|
||||
#include "Parallel.h"
|
||||
#include "fmisc.h"
|
||||
|
||||
#include "xh_global_interp.h"
|
||||
Patch::Patch(int DIM, int *shapei, double *bboxi, int levi, bool buflog, int Symmetry) : lev(levi)
|
||||
{
|
||||
|
||||
@@ -394,7 +394,6 @@ void Patch::Interp_Points(MyList<var> *VarList,
|
||||
while (notfind && Bp) // run along Blocks
|
||||
{
|
||||
Block *BP = Bp->data;
|
||||
|
||||
bool flag = true;
|
||||
for (int i = 0; i < dim; i++)
|
||||
{
|
||||
@@ -430,8 +429,10 @@ void Patch::Interp_Points(MyList<var> *VarList,
|
||||
int k = 0;
|
||||
while (varl) // run along variables
|
||||
{
|
||||
f_global_interp(BP->shape, BP->X[0], BP->X[1], BP->X[2], BP->fgfs[varl->data->sgfn], Shellf[j * num_var + k],
|
||||
|
||||
xh_global_interp(BP->shape, BP->X[0], BP->X[1], BP->X[2], BP->fgfs[varl->data->sgfn], Shellf[j * num_var + k],
|
||||
pox[0], pox[1], pox[2], ordn, varl->data->SoA, Symmetry);
|
||||
|
||||
varl = varl->next;
|
||||
k++;
|
||||
}
|
||||
@@ -441,6 +442,7 @@ void Patch::Interp_Points(MyList<var> *VarList,
|
||||
break;
|
||||
Bp = Bp->next;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Replace MPI_Allreduce with per-owner MPI_Bcast:
|
||||
@@ -510,7 +512,8 @@ void Patch::Interp_Points(MyList<var> *VarList,
|
||||
int myrank, nprocs;
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
|
||||
|
||||
// printf("here----\n");
|
||||
// int zzz = 0;
|
||||
int ordn = 2 * ghost_width;
|
||||
MyList<var> *varl;
|
||||
int num_var = 0;
|
||||
@@ -529,30 +532,35 @@ void Patch::Interp_Points(MyList<var> *VarList,
|
||||
for (int j = 0; j < NN; j++)
|
||||
owner_rank[j] = -1;
|
||||
|
||||
double DH[dim], llb[dim], uub[dim];
|
||||
double DH[dim];
|
||||
for (int i = 0; i < dim; i++)
|
||||
DH[i] = getdX(i);
|
||||
|
||||
// --- Interpolation phase (identical to original) ---
|
||||
// printf("NN: %d, num_var = %d\n", NN, num_var);
|
||||
#pragma omp parallel
|
||||
{
|
||||
#pragma omp for
|
||||
for (int j = 0; j < NN; j++)
|
||||
{
|
||||
double pox[dim];
|
||||
double pox[dim], llb[dim], uub[dim];
|
||||
MyList<var> *varl1;
|
||||
for (int i = 0; i < dim; i++)
|
||||
{
|
||||
pox[i] = XX[i][j];
|
||||
if (myrank == 0 && (XX[i][j] < bbox[i] + lli[i] * DH[i] || XX[i][j] > bbox[dim + i] - uui[i] * DH[i]))
|
||||
{
|
||||
cout << "Patch::Interp_Points: point (";
|
||||
for (int k = 0; k < dim; k++)
|
||||
{
|
||||
cout << XX[k][j];
|
||||
if (k < dim - 1)
|
||||
cout << ",";
|
||||
else
|
||||
cout << ") is out of current Patch." << endl;
|
||||
}
|
||||
MPI_Abort(MPI_COMM_WORLD, 1);
|
||||
}
|
||||
// if (myrank == 0 && (XX[i][j] < bbox[i] + lli[i] * DH[i] || XX[i][j] > bbox[dim + i] - uui[i] * DH[i]))
|
||||
// {
|
||||
// cout << "Patch::Interp_Points: point (";
|
||||
// for (int k = 0; k < dim; k++)
|
||||
// {
|
||||
// cout << XX[k][j];
|
||||
// if (k < dim - 1)
|
||||
// cout << ",";
|
||||
// else
|
||||
// cout << ") is out of current Patch." << endl;
|
||||
// }
|
||||
// MPI_Abort(MPI_COMM_WORLD, 1);
|
||||
// }
|
||||
}
|
||||
|
||||
MyList<Block> *Bp = blb;
|
||||
@@ -584,21 +592,23 @@ void Patch::Interp_Points(MyList<var> *VarList,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// printf("flag = %d\n", flag);
|
||||
if (flag)
|
||||
{
|
||||
notfind = false;
|
||||
owner_rank[j] = BP->rank;
|
||||
if (myrank == BP->rank)
|
||||
{
|
||||
varl = VarList;
|
||||
varl1 = VarList;
|
||||
int k = 0;
|
||||
while (varl)
|
||||
while (varl1)
|
||||
{
|
||||
f_global_interp(BP->shape, BP->X[0], BP->X[1], BP->X[2], BP->fgfs[varl->data->sgfn], Shellf[j * num_var + k],
|
||||
pox[0], pox[1], pox[2], ordn, varl->data->SoA, Symmetry);
|
||||
varl = varl->next;
|
||||
|
||||
xh_global_interp(BP->shape, BP->X[0], BP->X[1], BP->X[2], BP->fgfs[varl1->data->sgfn], Shellf[j * num_var + k],
|
||||
pox[0], pox[1], pox[2], ordn, varl1->data->SoA, Symmetry);
|
||||
varl1 = varl1->next;
|
||||
k++;
|
||||
// zzz += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -607,7 +617,8 @@ void Patch::Interp_Points(MyList<var> *VarList,
|
||||
Bp = Bp->next;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// printf("Interpolation done, zzz = %d\n", zzz);
|
||||
// --- Error check for unfound points ---
|
||||
for (int j = 0; j < NN; j++)
|
||||
{
|
||||
@@ -773,7 +784,6 @@ void Patch::Interp_Points(MyList<var> *VarList,
|
||||
int myrank, lmyrank;
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
|
||||
MPI_Comm_rank(Comm_here, &lmyrank);
|
||||
|
||||
int ordn = 2 * ghost_width;
|
||||
MyList<var> *varl;
|
||||
int num_var = 0;
|
||||
@@ -863,7 +873,7 @@ void Patch::Interp_Points(MyList<var> *VarList,
|
||||
int k = 0;
|
||||
while (varl) // run along variables
|
||||
{
|
||||
f_global_interp(BP->shape, BP->X[0], BP->X[1], BP->X[2], BP->fgfs[varl->data->sgfn], Shellf[j * num_var + k],
|
||||
xh_global_interp(BP->shape, BP->X[0], BP->X[1], BP->X[2], BP->fgfs[varl->data->sgfn], Shellf[j * num_var + k],
|
||||
pox[0], pox[1], pox[2], ordn, varl->data->SoA, Symmetry);
|
||||
varl = varl->next;
|
||||
k++;
|
||||
@@ -1095,7 +1105,7 @@ bool Patch::Interp_ONE_Point(MyList<var> *VarList, double *XX,
|
||||
{
|
||||
// shellf[j*num_var+k] = Parallel::global_interp(dim,BP->shape,BP->X,BP->fgfs[varl->data->sgfn],
|
||||
// pox,ordn,varl->data->SoA,Symmetry);
|
||||
f_global_interp(BP->shape, BP->X[0], BP->X[1], BP->X[2], BP->fgfs[varl->data->sgfn], shellf[k],
|
||||
xh_global_interp(BP->shape, BP->X[0], BP->X[1], BP->X[2], BP->fgfs[varl->data->sgfn], shellf[k],
|
||||
pox[0], pox[1], pox[2], ordn, varl->data->SoA, Symmetry);
|
||||
varl = varl->next;
|
||||
k++;
|
||||
@@ -1197,7 +1207,7 @@ bool Patch::Interp_ONE_Point(MyList<var> *VarList, double *XX,
|
||||
// NOTE: we do not Synchnize variables here, make sure of that before calling this routine
|
||||
int myrank;
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
|
||||
|
||||
|
||||
int ordn = 2 * ghost_width;
|
||||
MyList<var> *varl;
|
||||
int num_var = 0;
|
||||
@@ -1337,7 +1347,7 @@ bool Patch::Interp_ONE_Point(MyList<var> *VarList, double *XX,
|
||||
{
|
||||
// shellf[j*num_var+k] = Parallel::global_interp(dim,BP->shape,BP->X,BP->fgfs[varl->data->sgfn],
|
||||
// pox,ordn,varl->data->SoA,Symmetry);
|
||||
f_global_interp(BP->shape, BP->X[0], BP->X[1], BP->X[2], BP->fgfs[varl->data->sgfn], shellf[k],
|
||||
xh_global_interp(BP->shape, BP->X[0], BP->X[1], BP->X[2], BP->fgfs[varl->data->sgfn], shellf[k],
|
||||
pox[0], pox[1], pox[2], ordn, varl->data->SoA, Symmetry);
|
||||
varl = varl->next;
|
||||
k++;
|
||||
|
||||
Reference in New Issue
Block a user