Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Pane_communicator.C File Reference

Handles communication of shared nodes across panes. More...

#include <cassert>
#include <cstring>
#include "Pane_communicator.h"
#include "Pane_connectivity.h"
#include "roccom.h"
Include dependency graph for Pane_communicator.C:

Go to the source code of this file.

Functions

template<class T >
void reduce_int (MPI_Op op, T *a, T *b, int size) throw (int)
 Local level implementation of reduce operations. More...
 
template<class T >
void reduce_real (MPI_Op op, T *a, T *b, int size) throw (int)
 Local level implementation of reduce operations. More...
 
template<class T >
void reduce_maxabs (T *a, T *b, int size) throw (int)
 
template<class T >
void reduce_minabs (T *a, T *b, int size) throw (int)
 
template<class T >
void reduce_diff (T *a, T *b, int size) throw (int)
 
template<class T >
void update_value (T *a, T *b, int size) throw (int)
 

Detailed Description

Handles communication of shared nodes across panes.

Definition in file Pane_communicator.C.

Function Documentation

void reduce_diff ( T *  a,
T *  b,
int  size 
)
throw (int
)

Definition at line 478 of file Pane_communicator.C.

References i, and j.

Referenced by Pane_communicator::reduce_diff_on_shared_nodes().

478  {
479  bool isa_nonzero=0;
480 
481  for (int i=0; ; ++i) {
482  if ( a[i]!=0) { isa_nonzero = 1; break; }
483  else if (i==size) return;
484  }
485 
486  bool isb_nonzero=0;
487  for (int i=0; i<size; ++i)
488  if ( b[i]!=0) { isb_nonzero = 1; break; }
489 
490  if ( isb_nonzero)
491  for (int j=0; j<size; ++j) b[j] -= a[j];
492  else
493  for (int j=0; j<size; ++j) b[j] = a[j];
494 }
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6

Here is the caller graph for this function:

void reduce_int ( MPI_Op  op,
T *  a,
T *  b,
int  size 
)
throw (int
)

Local level implementation of reduce operations.

Definition at line 365 of file Pane_communicator.C.

References i, max(), min(), MPI_BOR, MPI_LAND, MPI_LOR, MPI_MAX, MPI_MIN, MPI_PROD, and MPI_SUM.

Referenced by Pane_communicator::reduce_on_shared_nodes().

365  {
366  if (op == MPI_SUM)
367  { for (int i=0; i<size; ++i) b[i] += a[i]; }
368  else if ( op == MPI_PROD)
369  { for (int i=0; i<size; ++i) b[i] *= a[i]; }
370  else if ( op == MPI_MAX)
371  { for (int i=0; i<size; ++i) b[i] = std::max(a[i], b[i]); }
372  else if ( op == MPI_MIN)
373  { for (int i=0; i<size; ++i) b[i] = std::min(a[i], b[i]); }
374  else if ( op == MPI_BOR)
375  { for (int i=0; i<size; ++i) b[i] |= a[i]; }
376  else if ( op == MPI_BAND)
377  { for (int i=0; i<size; ++i) b[i] &= a[i]; }
378  else if ( op == MPI_LOR)
379  { for (int i=0; i<size; ++i) b[i] = a[i] || b[i]; }
380  else if ( op == MPI_LAND)
381  { for (int i=0; i<size; ++i) b[i] = a[i] && b[i]; }
382  else throw(-1);
383 }
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MAX
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MIN
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_BAND INTEGER MPI_BOR
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_LAND
blockLoc i
Definition: read.cpp:79
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_BAND INTEGER MPI_LOR
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_PROD
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_SUM

Here is the call graph for this function:

Here is the caller graph for this function:

void reduce_maxabs ( T *  a,
T *  b,
int  size 
)
throw (int
)

Definition at line 464 of file Pane_communicator.C.

References NTS::abs(), and i.

Referenced by Pane_communicator::reduce_maxabs_on_shared_nodes().

464  {
465  for (int i=0; i<size; ++i) {
466  if ( std::abs( a[i])>std::abs(b[i])) b[i] = a[i];
467  }
468 }
blockLoc i
Definition: read.cpp:79
NT abs(const NT &x)
Definition: number_utils.h:130

Here is the call graph for this function:

Here is the caller graph for this function:

void reduce_minabs ( T *  a,
T *  b,
int  size 
)
throw (int
)

Definition at line 471 of file Pane_communicator.C.

References NTS::abs(), and i.

Referenced by Pane_communicator::reduce_minabs_on_shared_nodes().

471  {
472  for (int i=0; i<size; ++i) {
473  if ( std::abs( a[i])<std::abs(b[i])) b[i] = a[i];
474  }
475 }
blockLoc i
Definition: read.cpp:79
NT abs(const NT &x)
Definition: number_utils.h:130

Here is the call graph for this function:

Here is the caller graph for this function:

void reduce_real ( MPI_Op  op,
T *  a,
T *  b,
int  size 
)
throw (int
)

Local level implementation of reduce operations.

Definition at line 387 of file Pane_communicator.C.

References i, max(), min(), MPI_MAX, MPI_MIN, MPI_PROD, and MPI_SUM.

Referenced by Pane_communicator::reduce_on_shared_nodes().

387  {
388  if (op == MPI_SUM)
389  { for (int i=0; i<size; ++i) b[i] += a[i]; }
390  else if ( op == MPI_PROD)
391  { for (int i=0; i<size; ++i) b[i] *= a[i]; }
392  else if ( op == MPI_MAX)
393  { for (int i=0; i<size; ++i) b[i] = std::max(a[i], b[i]); }
394  else if ( op == MPI_MIN)
395  { for (int i=0; i<size; ++i) b[i] = std::min(a[i], b[i]); }
396  else throw(-1);
397 }
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MAX
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MIN
blockLoc i
Definition: read.cpp:79
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_PROD
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_SUM

Here is the call graph for this function:

Here is the caller graph for this function:

void update_value ( T *  a,
T *  b,
int  size 
)
throw (int
)

Definition at line 686 of file Pane_communicator.C.

References i.

Referenced by Pane_communicator::update_ghost_values().

686  {
687  for (int i=0; i<size; ++i) {
688  b[i] = a[i];
689  }
690 }
blockLoc i
Definition: read.cpp:79

Here is the caller graph for this function: