Skip to content

Commit

Permalink
iss CmPA#76: use EMfields::grid and EMfields::vct, as begun in commit 2…
Browse files Browse the repository at this point in the history
  • Loading branch information
alecjohnson committed Oct 15, 2014
1 parent 9e47de6 commit 3537056
Show file tree
Hide file tree
Showing 19 changed files with 551 additions and 508 deletions.
28 changes: 24 additions & 4 deletions bc/BcFields3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ developers : Stefano Markidis, Giovanni Lapenta
#include "BcFields3D.h"

/** set the boundary condition on boundaries */
void BCface(int nx, int ny, int nz, double ***vector, int bcFaceXright, int bcFaceXleft, int bcFaceYright, int bcFaceYleft, int bcFaceZright, int bcFaceZleft, VirtualTopology3D * vct) {
void BCface(int nx, int ny, int nz, double ***vector,
int bcFaceXright, int bcFaceXleft,
int bcFaceYright, int bcFaceYleft,
int bcFaceZright, int bcFaceZleft,
const VirtualTopology3D * vct)
{
// XLEFT
if (vct->getXleft_neighbor() == MPI_PROC_NULL) {
switch (bcFaceXleft) {
Expand Down Expand Up @@ -186,7 +191,12 @@ void BCface(int nx, int ny, int nz, double ***vector, int bcFaceXright, int bcFa

// / particles
/** set the boundary condition on boundaries */
void BCface_P(int nx, int ny, int nz, double ***vector, int bcFaceXright, int bcFaceXleft, int bcFaceYright, int bcFaceYleft, int bcFaceZright, int bcFaceZleft, VirtualTopology3D * vct) {
void BCface_P(int nx, int ny, int nz, double ***vector,
int bcFaceXright, int bcFaceXleft,
int bcFaceYright, int bcFaceYleft,
int bcFaceZright, int bcFaceZleft,
const VirtualTopology3D * vct)
{
// XLEFT
if (vct->getXleft_neighbor_P() == MPI_PROC_NULL) {
switch (bcFaceXleft) {
Expand Down Expand Up @@ -363,7 +373,12 @@ void BCface_P(int nx, int ny, int nz, double ***vector, int bcFaceXright, int bc

// SPECIES
/** set the boundary condition on boundaries */
void BCface(int nx, int ny, int nz, int ns, double ****vector, int bcFaceXright, int bcFaceXleft, int bcFaceYright, int bcFaceYleft, int bcFaceZright, int bcFaceZleft, VirtualTopology3D * vct) {
void BCface(int nx, int ny, int nz, int ns, double ****vector,
int bcFaceXright, int bcFaceXleft,
int bcFaceYright, int bcFaceYleft,
int bcFaceZright, int bcFaceZleft,
const VirtualTopology3D * vct)
{
// XLEFT
if (vct->getXleft_neighbor() == MPI_PROC_NULL) {
switch (bcFaceXleft) {
Expand Down Expand Up @@ -540,7 +555,12 @@ void BCface(int nx, int ny, int nz, int ns, double ****vector, int bcFaceXright,

// SPECIES
/** set the boundary condition on boundaries Particles*/
void BCface_P(int nx, int ny, int nz, int ns, double ****vector, int bcFaceXright, int bcFaceXleft, int bcFaceYright, int bcFaceYleft, int bcFaceZright, int bcFaceZleft, VirtualTopology3D * vct) {
void BCface_P(int nx, int ny, int nz, int ns, double ****vector,
int bcFaceXright, int bcFaceXleft,
int bcFaceYright, int bcFaceYleft,
int bcFaceZright, int bcFaceZleft,
const VirtualTopology3D * vct)
{
// XLEFT
if (vct->getXleft_neighbor_P() == MPI_PROC_NULL) {
switch (bcFaceXleft) {
Expand Down
2 changes: 1 addition & 1 deletion communication/ComInterpNodes3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "VCtopology3D.h"

/** communicate and sum shared ghost cells */
void communicateInterp(int nx, int ny, int nz, double*** vector, VirtualTopology3D * vct)
void communicateInterp(int nx, int ny, int nz, double*** vector, const VirtualTopology3D * vct)
{
const int nxr = nx-2;
const int nyr = ny-2;
Expand Down
67 changes: 56 additions & 11 deletions communication/ComNodes3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
#include "parallel.h"

/** communicate ghost cells (FOR NODES) */
void communicateNode(int nx, int ny, int nz, arr3_double _vector, VirtualTopology3D * vct) {
void communicateNode(int nx, int ny, int nz, arr3_double _vector,
const VirtualTopology3D * vct)
{
timeTasks_set_communicating();
// static int counter=0; if(is_output_thread()) { counter++; dprint(counter); }
double ***vector=_vector.fetch_arr3();
Expand Down Expand Up @@ -118,7 +120,12 @@ void communicateNode(int nx, int ny, int nz, arr3_double _vector, VirtualTopolog
delete[]ghostXleftYrghtZsameEdge;
}
/** communicate ghost cells (FOR NODES) */
void communicateNodeBC(int nx, int ny, int nz, arr3_double _vector, int bcFaceXrght, int bcFaceXleft, int bcFaceYrght, int bcFaceYleft, int bcFaceZrght, int bcFaceZleft, VirtualTopology3D * vct) {
void communicateNodeBC(int nx, int ny, int nz, arr3_double _vector,
int bcFaceXrght, int bcFaceXleft,
int bcFaceYrght, int bcFaceYleft,
int bcFaceZrght, int bcFaceZleft,
const VirtualTopology3D * vct)
{
timeTasks_set_communicating();
// static int counter=0; if(is_output_thread()) { counter++; dprint(counter); }
double ***vector = _vector.fetch_arr3();
Expand Down Expand Up @@ -227,7 +234,12 @@ void communicateNodeBC(int nx, int ny, int nz, arr3_double _vector, int bcFaceXr
delete[]ghostXleftYrghtZsameEdge;
}
/** communicate ghost cells (FOR NODES) with particles BC*/
void communicateNodeBC_P(int nx, int ny, int nz, arr3_double _vector, int bcFaceXrght, int bcFaceXleft, int bcFaceYrght, int bcFaceYleft, int bcFaceZrght, int bcFaceZleft, VirtualTopology3D * vct) {
void communicateNodeBC_P(int nx, int ny, int nz, arr3_double _vector,
int bcFaceXrght, int bcFaceXleft,
int bcFaceYrght, int bcFaceYleft,
int bcFaceZrght, int bcFaceZleft,
const VirtualTopology3D * vct)
{
timeTasks_set_communicating();
// static int counter=0; if(is_output_thread()) { counter++; dprint(counter); }
double ***vector=_vector.fetch_arr3();
Expand Down Expand Up @@ -337,7 +349,8 @@ void communicateNodeBC_P(int nx, int ny, int nz, arr3_double _vector, int bcFace

// PARTICLES
/** SPECIES: communicate ghost cells */
void communicateNode_P(int nx, int ny, int nz, double*** vector, VirtualTopology3D * vct)
void communicateNode_P(int nx, int ny, int nz, double*** vector,
const VirtualTopology3D * vct)
{
timeTasks_set_communicating();
// static int counter=0; if(is_output_thread()) { counter++; dprint(counter); }
Expand Down Expand Up @@ -503,7 +516,9 @@ void communicateNode_P(int nx, int ny, int nz, double*** vector, VirtualTopology

//
/** communicate ghost cells (FOR CENTERS) */
void communicateCenter(int nx, int ny, int nz, arr3_double _vector, VirtualTopology3D * vct) {
void communicateCenter(int nx, int ny, int nz, arr3_double _vector,
const VirtualTopology3D * vct)
{
timeTasks_set_communicating();
// static int counter=0; if(is_output_thread()) { counter++; dprint(counter); }
double ***vector = _vector.fetch_arr3();
Expand Down Expand Up @@ -607,7 +622,12 @@ void communicateCenter(int nx, int ny, int nz, arr3_double _vector, VirtualTopol
delete[]ghostXleftYrghtZsameEdge;
}
/** communicate ghost cells (FOR CENTERS) with BOX stencil*/
void communicateCenterBoxStencilBC(int nx, int ny, int nz, arr3_double _vector, int bcFaceXrght, int bcFaceXleft, int bcFaceYrght, int bcFaceYleft, int bcFaceZrght, int bcFaceZleft, VirtualTopology3D * vct) {
void communicateCenterBoxStencilBC(int nx, int ny, int nz, arr3_double _vector,
int bcFaceXrght, int bcFaceXleft,
int bcFaceYrght, int bcFaceYleft,
int bcFaceZrght, int bcFaceZleft,
const VirtualTopology3D * vct)
{
timeTasks_set_communicating();
// static int counter=0; if(is_output_thread()) { counter++; dprint(counter); }
double ***vector=_vector.fetch_arr3();
Expand Down Expand Up @@ -643,7 +663,12 @@ void communicateCenterBoxStencilBC(int nx, int ny, int nz, arr3_double _vector,
}
// particles
/** communicate ghost cells (FOR CENTERS) with BOX stencil*/
void communicateCenterBoxStencilBC_P(int nx, int ny, int nz, arr3_double _vector, int bcFaceXrght, int bcFaceXleft, int bcFaceYrght, int bcFaceYleft, int bcFaceZrght, int bcFaceZleft, VirtualTopology3D * vct) {
void communicateCenterBoxStencilBC_P(int nx, int ny, int nz, arr3_double _vector,
int bcFaceXrght, int bcFaceXleft,
int bcFaceYrght, int bcFaceYleft,
int bcFaceZrght, int bcFaceZleft,
const VirtualTopology3D * vct)
{
timeTasks_set_communicating();
// static int counter=0; if(is_output_thread()) { counter++; dprint(counter); }
double ***vector=_vector.fetch_arr3();
Expand Down Expand Up @@ -681,7 +706,12 @@ void communicateCenterBoxStencilBC_P(int nx, int ny, int nz, arr3_double _vector
//


void communicateNodeBoxStencilBC(int nx, int ny, int nz, arr3_double _vector, int bcFaceXrght, int bcFaceXleft, int bcFaceYrght, int bcFaceYleft, int bcFaceZrght, int bcFaceZleft, VirtualTopology3D * vct) {
void communicateNodeBoxStencilBC(int nx, int ny, int nz, arr3_double _vector,
int bcFaceXrght, int bcFaceXleft,
int bcFaceYrght, int bcFaceYleft,
int bcFaceZrght, int bcFaceZleft,
const VirtualTopology3D * vct)
{
timeTasks_set_communicating();
// static int counter=0; if(is_output_thread()) { counter++; dprint(counter); }
double ***vector=_vector.fetch_arr3();
Expand Down Expand Up @@ -716,7 +746,12 @@ void communicateNodeBoxStencilBC(int nx, int ny, int nz, arr3_double _vector, in
delete[]ghostZleftFace;
}

void communicateNodeBoxStencilBC_P(int nx, int ny, int nz, arr3_double _vector, int bcFaceXrght, int bcFaceXleft, int bcFaceYrght, int bcFaceYleft, int bcFaceZrght, int bcFaceZleft, VirtualTopology3D * vct) {
void communicateNodeBoxStencilBC_P(int nx, int ny, int nz, arr3_double _vector,
int bcFaceXrght, int bcFaceXleft,
int bcFaceYrght, int bcFaceYleft,
int bcFaceZrght, int bcFaceZleft,
const VirtualTopology3D * vct)
{
timeTasks_set_communicating();
// static int counter=0; if(is_output_thread()) { counter++; dprint(counter); }
double ***vector=_vector.fetch_arr3();
Expand Down Expand Up @@ -753,7 +788,12 @@ void communicateNodeBoxStencilBC_P(int nx, int ny, int nz, arr3_double _vector,


// /////////// communication + BC ////////////////////////////
void communicateCenterBC(int nx, int ny, int nz, arr3_double _vector, int bcFaceXrght, int bcFaceXleft, int bcFaceYrght, int bcFaceYleft, int bcFaceZrght, int bcFaceZleft, VirtualTopology3D * vct) {
void communicateCenterBC(int nx, int ny, int nz, arr3_double _vector,
int bcFaceXrght, int bcFaceXleft,
int bcFaceYrght, int bcFaceYleft,
int bcFaceZrght, int bcFaceZleft,
const VirtualTopology3D * vct)
{
timeTasks_set_communicating();
// static int counter=0; if(is_output_thread()) { counter++; dprint(counter); }
double ***vector=_vector.fetch_arr3();
Expand Down Expand Up @@ -919,7 +959,12 @@ void communicateCenterBC(int nx, int ny, int nz, arr3_double _vector, int bcFace
delete[]ghostXleftYrghtZsameEdge;
}
// /////////// communication + BC ////////////////////////////
void communicateCenterBC_P(int nx, int ny, int nz, arr3_double _vector, int bcFaceXrght, int bcFaceXleft, int bcFaceYrght, int bcFaceYleft, int bcFaceZrght, int bcFaceZleft, VirtualTopology3D * vct) {
void communicateCenterBC_P(int nx, int ny, int nz, arr3_double _vector,
int bcFaceXrght, int bcFaceXleft,
int bcFaceYrght, int bcFaceYleft,
int bcFaceZrght, int bcFaceZleft,
const VirtualTopology3D * vct)
{
timeTasks_set_communicating();
// static int counter=0; if(is_output_thread()) { counter++; dprint(counter); }
double ***vector=_vector.fetch_arr3();
Expand Down
10 changes: 5 additions & 5 deletions communication/ComParser3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ void addFace(int nx, int ny, int nz, double ***vector,
double *ghostXrghtFace, double *ghostXleftFace,
double *ghostYrghtFace, double *ghostYleftFace,
double *ghostZrghtFace, double *ghostZleftFace,
VirtualTopology3D * vct)
const VirtualTopology3D * vct)
{
const int nxr = nx-2;
const int nyr = ny-2;
Expand Down Expand Up @@ -445,7 +445,7 @@ void parseEdgeZ(int nx, int ny, int nz, double ***vector,
void addEdgeZ(int nx, int ny, int nz, double ***vector,
double *ghostXrghtYrghtZsameEdge, double *ghostXleftYleftZsameEdge,
double *ghostXrghtYleftZsameEdge, double *ghostXleftYrghtZsameEdge,
VirtualTopology3D * vct)
const VirtualTopology3D * vct)
{
if (vct->hasXrghtNeighbor() && vct->hasYrghtNeighbor()) {
for (int i = 1; i < (nz - 1); i++)
Expand Down Expand Up @@ -480,7 +480,7 @@ void parseEdgeY(int nx, int ny, int nz, double ***vector,
void addEdgeY(int nx, int ny, int nz, double ***vector,
double *ghostXrghtYsameZrghtEdge, double *ghostXleftYsameZleftEdge,
double *ghostXleftYsameZrghtEdge, double *ghostXrghtYsameZleftEdge,
VirtualTopology3D * vct)
const VirtualTopology3D * vct)
{
if (vct->hasXrghtNeighbor() && vct->hasZrghtNeighbor()) {
for (int i = 1; i < (ny - 1); i++)
Expand Down Expand Up @@ -515,7 +515,7 @@ void parseEdgeX(int nx, int ny, int nz, double ***vector,
void addEdgeX(int nx, int ny, int nz, double ***vector,
double *ghostXsameYrghtZrghtEdge, double *ghostXsameYleftZleftEdge,
double *ghostXsameYleftZrghtEdge, double *ghostXsameYrghtZleftEdge,
VirtualTopology3D * vct)
const VirtualTopology3D * vct)
{
if (vct->hasYrghtNeighbor() && vct->hasZrghtNeighbor()) {
for (int i = 1; i < (nx - 1); i++)
Expand Down Expand Up @@ -562,7 +562,7 @@ void addCorner(int nx, int ny, int nz, double ***vector,
double *ghostXrghtYleftZrghtCorner, double *ghostXleftYleftZrghtCorner,
double *ghostXrghtYrghtZleftCorner, double *ghostXleftYrghtZleftCorner,
double *ghostXrghtYleftZleftCorner, double *ghostXleftYleftZleftCorner,
VirtualTopology3D * vct)
const VirtualTopology3D * vct)
{
if (vct->hasXrghtNeighbor() && vct->hasYrghtNeighbor() && vct->hasZrghtNeighbor())
vector[nx - 2][ny - 2][nz - 2] += *ghostXrghtYrghtZrghtCorner;
Expand Down
Loading

0 comments on commit 3537056

Please sign in to comment.