Instead of broadcasting all interpolated point data to every MPI rank, the new overload sends each point only to the one rank that needs it for integration, reducing communication volume by ~nprocs times. The consumer rank is computed deterministically using the same Nmin/Nmax work distribution formula used by surface_integral callers. Two active call sites (surf_Wave and surf_MassPAng with MPI_COMM_WORLD) now use the new overload. Other callers (ShellPatch, Comm_here variants, etc.) remain unchanged. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
56 lines
1.7 KiB
C++
56 lines
1.7 KiB
C++
|
|
#ifndef PATCH_H
|
|
#define PATCH_H
|
|
|
|
#include <mpi.h>
|
|
#include "MyList.h"
|
|
#include "Block.h"
|
|
#include "var.h"
|
|
#include "macrodef.h" //need dim here; Vertex or Cell; ghost_width
|
|
|
|
class Patch
|
|
{
|
|
|
|
public:
|
|
int lev;
|
|
int shape[dim];
|
|
double bbox[2 * dim]; // this bbox includes buffer points
|
|
MyList<Block> *blb, *ble;
|
|
int lli[dim], uui[dim]; // denote the buffer points on each boundary
|
|
|
|
public:
|
|
Patch() {};
|
|
Patch(int DIM, int *shapei, double *bboxi, int levi, bool buflog, int Symmetry);
|
|
|
|
~Patch();
|
|
|
|
void checkPatch(bool buflog);
|
|
void checkPatch(bool buflog, const int out_rank);
|
|
void checkBlock();
|
|
void Interp_Points(MyList<var> *VarList,
|
|
int NN, double **XX,
|
|
double *Shellf, int Symmetry);
|
|
bool Interp_ONE_Point(MyList<var> *VarList, double *XX,
|
|
double *Shellf, int Symmetry);
|
|
double getdX(int dir);
|
|
|
|
void Find_Maximum(MyList<var> *VarList, double *XX,
|
|
double *Shellf);
|
|
|
|
bool Find_Point(double *XX);
|
|
|
|
void Interp_Points(MyList<var> *VarList,
|
|
int NN, double **XX,
|
|
double *Shellf, int Symmetry,
|
|
int Nmin_consumer, int Nmax_consumer);
|
|
void Interp_Points(MyList<var> *VarList,
|
|
int NN, double **XX,
|
|
double *Shellf, int Symmetry, MPI_Comm Comm_here);
|
|
bool Interp_ONE_Point(MyList<var> *VarList, double *XX,
|
|
double *Shellf, int Symmetry, MPI_Comm Comm_here);
|
|
void Find_Maximum(MyList<var> *VarList, double *XX,
|
|
double *Shellf, MPI_Comm Comm_here);
|
|
};
|
|
|
|
#endif /* PATCH_H */
|