OSHUN  beta
Arbitrary Order Spherical-Harmonic 1D-3P Vlasov-Fokker-Planck-Maxwell code
Node_ImplicitE_Communications Class Reference

#include <parallel.h>

Public Member Functions

 Node_ImplicitE_Communications ()
 
 ~Node_ImplicitE_Communications ()
 
int BNDX () const
 
void Send_right_X (State1D &Y, int dest)
 
void Recv_from_left_X (State1D &Y, int origin)
 
void Send_left_X (State1D &Y, int dest)
 
void Recv_from_right_X (State1D &Y, int origin)
 
void mirror_bound_Xleft (State1D &Y)
 
void mirror_bound_Xright (State1D &Y)
 
void sameNode_bound_X (State1D &Y)
 

Private Member Functions

void sameNode_periodic_X (State1D &Y)
 
void sameNode_mirror_X (State1D &Y)
 

Private Attributes

int Nbc
 
int bndX
 
int msg_sizeX
 
complex< double > * msg_bufX
 

Detailed Description

Definition at line 37 of file parallel.h.

Constructor & Destructor Documentation

◆ Node_ImplicitE_Communications()

Node_ImplicitE_Communications::Node_ImplicitE_Communications ( )

Definition at line 78 of file parallel.cpp.

References msg_bufX, msg_sizeX, and Nbc.

78  :
79 //--------------------------------------------------------------
80 // Constructor
81 //--------------------------------------------------------------
82  Nbc(Input::List().BoundaryCells), // # of boundary cells
83  bndX(Input::List().bndX) { // Type of boundary in X
84 
85  // 3 components for Bx, By, Bz
86  msg_sizeX = 3;
87 
88  msg_sizeX *= Nbc; //(IN().inp().y.dim()*Nbc);
89  msg_bufX = new complex<double>[msg_sizeX];
90 
91 }
Input_List & List()
Definition: input.cpp:1585
complex< double > * msg_bufX
Definition: parallel.h:68

◆ ~Node_ImplicitE_Communications()

Node_ImplicitE_Communications::~Node_ImplicitE_Communications ( )

Definition at line 95 of file parallel.cpp.

References msg_bufX.

95  {
96 //--------------------------------------------------------------
97 // Destructor
98 //--------------------------------------------------------------
99  delete[] msg_bufX;
100 }
complex< double > * msg_bufX
Definition: parallel.h:68

Member Function Documentation

◆ BNDX()

int Node_ImplicitE_Communications::BNDX ( ) const

Definition at line 104 of file parallel.cpp.

References bndX.

Referenced by sameNode_bound_X().

104 {return bndX;}
Here is the caller graph for this function:

◆ mirror_bound_Xleft()

void Node_ImplicitE_Communications::mirror_bound_Xleft ( State1D Y)

Definition at line 215 of file parallel.cpp.

References EMF1D::Bx(), EMF1D::dim(), State1D::EMF(), State1D::FLD(), Nbc, SHarmonic1D::numx(), and State1D::SH().

Referenced by Parallel_Environment_1D::Neighbor_ImplicitE_Communications().

215  {
216 //-------------------------------------------------------------------------------------
217 // Mirror boundary in the x direction on the left
218 //-------------------------------------------------------------------------------------
219 
220  size_t Nx(Y.SH(0,0,0).numx());
221 
222  // Mirror the fields
223  for(int i(3); i < Y.EMF().dim(); ++i){ // "3" as opposed to "0"
224  for (int c(0); c < Nbc; ++c)
225  Y.FLD(i)(c) = Y.FLD(i)(2*Nbc-c-1);
226  }
227 
228  //Bx
229  for(int c(0); c < Nbc; ++c) {
230  Y.EMF().Bx()(c) *= -1.0; // left boundary
231  }
232 
233 }
size_t dim() const
Definition: state.h:286
size_t numx() const
Definition: state.h:72
Field1D & Bx()
Definition: state.h:293
SHarmonic1D & SH(size_t s, size_t lh, size_t mh)
Definition: state.h:605
Field1D & FLD(size_t ip) const
Definition: state.h:611
EMF1D & EMF() const
Definition: state.h:610
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mirror_bound_Xright()

void Node_ImplicitE_Communications::mirror_bound_Xright ( State1D Y)

Definition at line 237 of file parallel.cpp.

References EMF1D::Bx(), EMF1D::dim(), State1D::EMF(), State1D::FLD(), Nbc, SHarmonic1D::numx(), and State1D::SH().

Referenced by Parallel_Environment_1D::Neighbor_ImplicitE_Communications().

237  {
238 //--------------------------------------------------------------
239 // Mirror boundary in the x direction on the right
240 //--------------------------------------------------------------
241 
242  size_t Nx(Y.SH(0,0,0).numx());
243 
244  // Mirror the fields
245  for(int i(3); i < Y.EMF().dim(); ++i){ // "3" as opposed to "0"
246  for (int c(0); c < Nbc; ++c)
247  Y.FLD(i)(Nx-c-1) = Y.FLD(i)(Nx-2*Nbc+c);
248  }
249 
250  //Bx
251  for(int c(0); c < Nbc; ++c) {
252  Y.EMF().Bx()(Nx-1-c) *= -1.0; // right boundary
253  }
254 
255 }
size_t dim() const
Definition: state.h:286
size_t numx() const
Definition: state.h:72
Field1D & Bx()
Definition: state.h:293
SHarmonic1D & SH(size_t s, size_t lh, size_t mh)
Definition: state.h:605
Field1D & FLD(size_t ip) const
Definition: state.h:611
EMF1D & EMF() const
Definition: state.h:610
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Recv_from_left_X()

void Node_ImplicitE_Communications::Recv_from_left_X ( State1D Y,
int  origin 
)

Definition at line 136 of file parallel.cpp.

References EMF1D::dim(), State1D::EMF(), State1D::FLD(), msg_bufX, msg_sizeX, and Nbc.

Referenced by Parallel_Environment_1D::Neighbor_ImplicitE_Communications().

136  {
137 //--------------------------------------------------------------
138 // X-axis : Receive data from the node on the left and update
139 // the left guard cells
140 //--------------------------------------------------------------
141 
142  static size_t step_f(Nbc);
143  size_t bufind(0);
144  MPI_Status status;
145 
146  // Receive Data
147  MPI_Recv(msg_bufX, msg_sizeX, MPI_DOUBLE_COMPLEX, origin, 0, MPI_COMM_WORLD, &status);
148 
149  // Fields: x0-"---> Left-Guard"
150  for(int i(3); i < Y.EMF().dim(); ++i){ // "3" as opposed to "0"
151  for(int e(0); e < Nbc; e++) {
152  Y.FLD(i)(e) = msg_bufX[bufind + e];
153  }
154  bufind += step_f;
155  }
156 }
size_t dim() const
Definition: state.h:286
Field1D & FLD(size_t ip) const
Definition: state.h:611
complex< double > * msg_bufX
Definition: parallel.h:68
EMF1D & EMF() const
Definition: state.h:610
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Recv_from_right_X()

void Node_ImplicitE_Communications::Recv_from_right_X ( State1D Y,
int  origin 
)

Definition at line 182 of file parallel.cpp.

References EMF1D::dim(), State1D::EMF(), State1D::FLD(), msg_bufX, msg_sizeX, Nbc, and Field1D::numx().

Referenced by Parallel_Environment_1D::Neighbor_ImplicitE_Communications().

182  {
183 //--------------------------------------------------------------
184 // X-axis : Receive data from the node on the right and update
185 // the right guard cells
186 //--------------------------------------------------------------
187 
188  static size_t step_f(Nbc);
189  size_t bufind(0);
190  MPI_Status status;
191 
192  // Receive Data
193  MPI_Recv(msg_bufX, msg_sizeX, MPI_DOUBLE_COMPLEX, origin, 1, MPI_COMM_WORLD, &status);
194 
195  // Fields: x0-"Right-Guard <--- "
196  for(int i(3); i < Y.EMF().dim(); ++i){ // "3" as opposed to "0"
197  for(int e(0); e < Nbc; e++) {
198  Y.FLD(i)(Y.FLD(i).numx()-Nbc+e) = msg_bufX[bufind + e];
199  }
200  bufind += step_f;
201  }
202 }
size_t numx() const
Definition: state.h:197
size_t dim() const
Definition: state.h:286
Field1D & FLD(size_t ip) const
Definition: state.h:611
complex< double > * msg_bufX
Definition: parallel.h:68
EMF1D & EMF() const
Definition: state.h:610
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sameNode_bound_X()

void Node_ImplicitE_Communications::sameNode_bound_X ( State1D Y)

Definition at line 264 of file parallel.cpp.

References BNDX(), sameNode_mirror_X(), and sameNode_periodic_X().

Referenced by Parallel_Environment_1D::Neighbor_ImplicitE_Communications().

264  {
265 //--------------------------------------------------------------
266 // Choose between boundary conditions in the x direction
267 //--------------------------------------------------------------
268  switch (BNDX()) {
269  case 0: // periodic
271 
272  break;
273  case 1: // mirror boundary
275  break;
276  default:
277  cout<<"Not a valid boundary condition." << endl;
278  break;
279  }
280 }
void sameNode_mirror_X(State1D &Y)
Definition: parallel.cpp:305
void sameNode_periodic_X(State1D &Y)
Definition: parallel.cpp:284
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sameNode_mirror_X()

void Node_ImplicitE_Communications::sameNode_mirror_X ( State1D Y)
private

Definition at line 305 of file parallel.cpp.

References EMF1D::Bx(), EMF1D::dim(), State1D::EMF(), State1D::FLD(), Nbc, SHarmonic1D::numx(), and State1D::SH().

Referenced by sameNode_bound_X().

305  {
306 //--------------------------------------------------------------
307 // Mirror boundary in the x direction for 1 node
308 //--------------------------------------------------------------
309 
310  size_t Nx(Y.SH(0,0,0).numx());
311 
312  // Mirror the fields
313  for(int i(3); i < Y.EMF().dim(); ++i){ // "3" as opposed to "0"
314  // right boundary
315  for (int c(0); c < Nbc; ++c)
316  Y.FLD(i)(Nx-c-1) = Y.FLD(i)(Nx-2*Nbc+c);
317  // left boundary
318  for (int c(0); c < Nbc; ++c)
319  Y.FLD(i)(c) = Y.FLD(i)(2*Nbc-c-1);
320  }
321 
322  //Bx
323  for (int c(0); c < Nbc; ++c) {
324  Y.EMF().Bx()(c) *= -1.0; // left boundary
325  Y.EMF().Bx()(Nx-Nbc+c) *= -1.0; // right boundary
326  }
327 
328 }
size_t dim() const
Definition: state.h:286
size_t numx() const
Definition: state.h:72
Field1D & Bx()
Definition: state.h:293
SHarmonic1D & SH(size_t s, size_t lh, size_t mh)
Definition: state.h:605
Field1D & FLD(size_t ip) const
Definition: state.h:611
EMF1D & EMF() const
Definition: state.h:610
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sameNode_periodic_X()

void Node_ImplicitE_Communications::sameNode_periodic_X ( State1D Y)
private

Definition at line 284 of file parallel.cpp.

References EMF1D::dim(), State1D::EMF(), EMF1D::Ex(), State1D::FLD(), Nbc, and Field1D::numx().

Referenced by sameNode_bound_X().

284  {
285 //--------------------------------------------------------------
286 // Periodic boundary in the x direction for 1 node
287 //--------------------------------------------------------------
288 
289  // Fields: x0 "Right-Bound ---> Left-Guard"
290  for(int i(3); i < Y.EMF().dim(); ++i) // "3" as opposed to "0"
291  for(int c(0); c < Nbc; c++) {
292  Y.FLD(i)(c) = Y.FLD(i)(Y.EMF().Ex().numx()-2*Nbc+c);
293  }
294 
295  // Fields: x0 "Left-Bound ---> Right-Guard"
296  for(int i(3); i < Y.EMF().dim(); ++i) // "3" as opposed to "0"
297  for(int c(0); c < Nbc; c++) {
298  Y.FLD(i)(Y.EMF().Ex().numx()-Nbc+c) = Y.FLD(i)(Nbc+c);
299  }
300 
301 }
size_t numx() const
Definition: state.h:197
size_t dim() const
Definition: state.h:286
Field1D & Ex()
Definition: state.h:290
Field1D & FLD(size_t ip) const
Definition: state.h:611
EMF1D & EMF() const
Definition: state.h:610
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Send_left_X()

void Node_ImplicitE_Communications::Send_left_X ( State1D Y,
int  dest 
)

Definition at line 160 of file parallel.cpp.

References EMF1D::dim(), State1D::EMF(), State1D::FLD(), msg_bufX, msg_sizeX, and Nbc.

Referenced by Parallel_Environment_1D::Neighbor_ImplicitE_Communications().

160  {
161 //--------------------------------------------------------------
162 // X-axis : Read data from the left boundary and send them
163 // to the node on the left
164 //--------------------------------------------------------------
165 
166  static size_t step_f(Nbc);
167  size_t bufind(0);
168 
169  // Fields: x0 " <--- Left-Bound "
170  for(int i(3); i < Y.EMF().dim(); ++i){ // "3" as opposed to "0"
171  for(int e(0); e < Nbc; e++) {
172  msg_bufX[bufind + e] = Y.FLD(i)(Nbc+e);
173  }
174  bufind += step_f;
175  }
176 
177  MPI_Send(msg_bufX, msg_sizeX, MPI_DOUBLE_COMPLEX, dest, 1, MPI_COMM_WORLD);
178 }
size_t dim() const
Definition: state.h:286
Field1D & FLD(size_t ip) const
Definition: state.h:611
complex< double > * msg_bufX
Definition: parallel.h:68
EMF1D & EMF() const
Definition: state.h:610
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Send_right_X()

void Node_ImplicitE_Communications::Send_right_X ( State1D Y,
int  dest 
)

Definition at line 114 of file parallel.cpp.

References EMF1D::dim(), State1D::EMF(), State1D::FLD(), msg_bufX, msg_sizeX, Nbc, and Field1D::numx().

Referenced by Parallel_Environment_1D::Neighbor_ImplicitE_Communications().

114  {
115 //--------------------------------------------------------------
116 // X-axis : Read data from the right boundary and send them
117 // to the node on the right
118 //--------------------------------------------------------------
119 
120  static size_t step_f(Nbc);
121  size_t bufind(0);
122 
123  // Fields: x0 "Right-Bound --> "
124  for(size_t i(3); i < Y.EMF().dim(); ++i){ // "3" as opposed to "0"
125  for(int e(0); e < Nbc; e++) {
126  msg_bufX[bufind + e] = Y.FLD(i)(Y.FLD(i).numx()-2*Nbc+e);
127  }
128  bufind += step_f;
129  }
130 
131  MPI_Send(msg_bufX, msg_sizeX, MPI_DOUBLE_COMPLEX, dest, 0, MPI_COMM_WORLD);
132 }
size_t numx() const
Definition: state.h:197
size_t dim() const
Definition: state.h:286
Field1D & FLD(size_t ip) const
Definition: state.h:611
complex< double > * msg_bufX
Definition: parallel.h:68
EMF1D & EMF() const
Definition: state.h:610
Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ bndX

int Node_ImplicitE_Communications::bndX
private

Definition at line 64 of file parallel.h.

Referenced by BNDX().

◆ msg_bufX

complex<double>* Node_ImplicitE_Communications::msg_bufX
private

◆ msg_sizeX

int Node_ImplicitE_Communications::msg_sizeX
private

◆ Nbc


The documentation for this class was generated from the following files: