libMesh
Static Public Member Functions | List of all members
libMesh::TypeVectorOpFunction< V > Class Template Reference

#include <parallel_algebra.h>

Static Public Member Functions

static void vector_max (void *invec, void *inoutvec, int *len, MPI_Datatype *)
 
static void vector_min (void *invec, void *inoutvec, int *len, MPI_Datatype *)
 
static void vector_sum (void *invec, void *inoutvec, int *len, MPI_Datatype *)
 
static MPI_Op max ()
 
static MPI_Op min ()
 
static MPI_Op sum ()
 

Detailed Description

template<typename V>
class libMesh::TypeVectorOpFunction< V >

Definition at line 54 of file parallel_algebra.h.

Member Function Documentation

◆ max()

template<typename V>
static MPI_Op libMesh::TypeVectorOpFunction< V >::max ( )
inlinestatic

Definition at line 85 of file parallel_algebra.h.

86  {
87  // _static_op never gets freed, but it only gets committed once
88  // per T, so it's not a *huge* memory leak...
89  static MPI_Op _static_op;
90  static bool _is_initialized = false;
91  if (!_is_initialized)
92  {
93  timpi_call_mpi
94  (MPI_Op_create (vector_max, /*commute=*/ true,
95  &_static_op));
96 
97  _is_initialized = true;
98  }
99 
100  return _static_op;
101  }
bool _is_initialized
Flag that tells if init() has been called.
Definition: libmesh.C:257
static void vector_max(void *invec, void *inoutvec, int *len, MPI_Datatype *)

◆ min()

template<typename V>
static MPI_Op libMesh::TypeVectorOpFunction< V >::min ( )
inlinestatic

Definition at line 102 of file parallel_algebra.h.

103  {
104  // _static_op never gets freed, but it only gets committed once
105  // per T, so it's not a *huge* memory leak...
106  static MPI_Op _static_op;
107  static bool _is_initialized = false;
108  if (!_is_initialized)
109  {
110  timpi_call_mpi
111  (MPI_Op_create (vector_min, /*commute=*/ true,
112  &_static_op));
113 
114  _is_initialized = true;
115  }
116 
117  return _static_op;
118  }
static void vector_min(void *invec, void *inoutvec, int *len, MPI_Datatype *)
bool _is_initialized
Flag that tells if init() has been called.
Definition: libmesh.C:257

◆ sum()

template<typename V>
static MPI_Op libMesh::TypeVectorOpFunction< V >::sum ( )
inlinestatic

Definition at line 119 of file parallel_algebra.h.

120  {
121  // _static_op never gets freed, but it only gets committed once
122  // per T, so it's not a *huge* memory leak...
123  static MPI_Op _static_op;
124  static bool _is_initialized = false;
125  if (!_is_initialized)
126  {
127  timpi_call_mpi
128  (MPI_Op_create (vector_sum, /*commute=*/ true,
129  &_static_op));
130 
131  _is_initialized = true;
132  }
133 
134  return _static_op;
135  }
static void vector_sum(void *invec, void *inoutvec, int *len, MPI_Datatype *)
bool _is_initialized
Flag that tells if init() has been called.
Definition: libmesh.C:257

◆ vector_max()

template<typename V>
static void libMesh::TypeVectorOpFunction< V >::vector_max ( void *  invec,
void *  inoutvec,
int len,
MPI_Datatype *   
)
inlinestatic

Definition at line 58 of file parallel_algebra.h.

Referenced by libMesh::TypeVectorOpFunction< libMesh::VectorValue< T > >::max().

59  {
60  V *in = static_cast<V *>(invec);
61  V *inout = static_cast<V *>(inoutvec);
62  for (int i=0; i != *len; ++i)
63  for (int d=0; d != LIBMESH_DIM; ++d)
64  inout[i](d) = std::max(in[i](d), inout[i](d));
65  }

◆ vector_min()

template<typename V>
static void libMesh::TypeVectorOpFunction< V >::vector_min ( void *  invec,
void *  inoutvec,
int len,
MPI_Datatype *   
)
inlinestatic

Definition at line 67 of file parallel_algebra.h.

Referenced by libMesh::TypeVectorOpFunction< libMesh::VectorValue< T > >::min().

68  {
69  V *in = static_cast<V *>(invec);
70  V *inout = static_cast<V *>(inoutvec);
71  for (int i=0; i != *len; ++i)
72  for (int d=0; d != LIBMESH_DIM; ++d)
73  inout[i](d) = std::min(in[i](d), inout[i](d));
74  }

◆ vector_sum()

template<typename V>
static void libMesh::TypeVectorOpFunction< V >::vector_sum ( void *  invec,
void *  inoutvec,
int len,
MPI_Datatype *   
)
inlinestatic

Definition at line 76 of file parallel_algebra.h.

Referenced by libMesh::TypeVectorOpFunction< libMesh::VectorValue< T > >::sum().

77  {
78  V *in = static_cast<V *>(invec);
79  V *inout = static_cast<V *>(inoutvec);
80  for (int i=0; i != *len; ++i)
81  for (int d=0; d != LIBMESH_DIM; ++d)
82  inout[i](d) += in[i](d);
83  }

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