19#ifndef LIBMESH_PARALLEL_ALGEBRA_H
20#define LIBMESH_PARALLEL_ALGEBRA_H
24#include "libmesh/libmesh_config.h"
25#include "libmesh/point.h"
26#include "libmesh/tensor_value.h"
27#include "libmesh/vector_value.h"
57#ifdef LIBMESH_HAVE_MPI
58 static void vector_max (
void * invec,
void * inoutvec,
int * len, MPI_Datatype *)
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));
67 static void vector_min (
void * invec,
void * inoutvec,
int * len, MPI_Datatype *)
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));
76 static void vector_sum (
void * invec,
void * inoutvec,
int * len, MPI_Datatype *)
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);
89 static MPI_Op _static_op;
90 static bool _is_initialized =
false;
97 _is_initialized =
true;
106 static MPI_Op _static_op;
107 static bool _is_initialized =
false;
108 if (!_is_initialized)
114 _is_initialized =
true;
123 static MPI_Op _static_op;
124 static bool _is_initialized =
false;
125 if (!_is_initialized)
131 _is_initialized =
true;
146 for (
int d=0; d != LIBMESH_DIM; ++d)
150 for (
int d=0; d != LIBMESH_DIM; ++d)
178 std::unique_ptr<TypeVector<T>> temp;
180 ex =
const_cast<TypeVector<T> *
>(example);
183 temp = std::make_unique<TypeVector<T>>();
187#ifdef LIBMESH_HAVE_MPI
191 int blocklength = LIBMESH_DIM;
192 MPI_Aint displs, start;
193 MPI_Datatype tmptype, type = T_type;
196 (MPI_Get_address (ex, &start));
198 (MPI_Get_address (&((*ex)(0)), &displs));
205 (MPI_Type_create_struct (1, &blocklength, &displs, &type,
208 (MPI_Type_commit (&tmptype));
212 (MPI_Type_create_resized (tmptype, 0,
sizeof(TypeVector<T>),
216 (MPI_Type_commit (&_datatype));
219 (MPI_Type_free (&tmptype));
226 timpi_call_mpi (MPI_Type_dup (t._datatype, &_datatype));
247 std::unique_ptr<VectorValue<T>> temp;
249 ex =
const_cast<VectorValue<T> *
>(example);
252 temp = std::make_unique<VectorValue<T>>();
256#ifdef LIBMESH_HAVE_MPI
259 int blocklength = LIBMESH_DIM;
260 MPI_Aint displs, start;
261 MPI_Datatype tmptype, type = T_type;
264 (MPI_Get_address (ex, &start));
266 (MPI_Get_address (&((*ex)(0)), &displs));
273 (MPI_Type_create_struct (1, &blocklength, &displs, &type,
276 (MPI_Type_commit (&tmptype));
280 (MPI_Type_create_resized (tmptype, 0,
281 sizeof(VectorValue<T>),
285 (MPI_Type_commit (&_datatype));
288 (MPI_Type_free (&tmptype));
295#ifdef LIBMESH_HAVE_MPI
296 timpi_call_mpi (MPI_Type_dup (t._datatype, &_datatype));
315 libmesh_ignore(example);
317#ifdef LIBMESH_HAVE_MPI
322 std::unique_ptr<Point> temp;
324 ex =
const_cast<Point *
>(example);
327 temp = std::make_unique<Point>();
333 int blocklength = LIBMESH_DIM;
334 MPI_Aint displs, start;
335 MPI_Datatype tmptype, type = T_type;
338 (MPI_Get_address (ex, &start));
340 (MPI_Get_address (&((*ex)(0)), &displs));
347 (MPI_Type_create_struct (1, &blocklength, &displs, &type,
350 (MPI_Type_commit (&tmptype));
354 (MPI_Type_create_resized (tmptype, 0,
sizeof(Point),
358 (MPI_Type_commit (&_datatype));
361 (MPI_Type_free (&tmptype));
368 timpi_call_mpi (MPI_Type_dup (t._datatype, &_datatype));
static const bool is_fixed_type
StandardType(const libMesh::Point *example=nullptr)
StandardType(const StandardType< libMesh::Point > &timpi_mpi_var(t))
StandardType(const libMesh::TensorValue< T > *example=nullptr)
StandardType(const libMesh::TypeTensor< T > *example=nullptr)
StandardType(const StandardType< libMesh::TypeVector< T > > &timpi_mpi_var(t))
StandardType(const libMesh::TypeVector< T > *example=nullptr)
StandardType(const libMesh::VectorValue< T > *example=nullptr)
StandardType(const StandardType< libMesh::VectorValue< T > > &timpi_mpi_var(t))
A Point defines a location in LIBMESH_DIM dimensional Real space.
This class defines a tensor in LIBMESH_DIM dimensional Real or Complex space.
This class defines a tensor in LIBMESH_DIM dimensional space of type T.
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 void vector_max(void *invec, void *inoutvec, int *len, MPI_Datatype *)
This class defines a vector in LIBMESH_DIM dimensional space of type T.
This class defines a vector in LIBMESH_DIM dimensional Real or Complex space.
The libMesh namespace provides an interface to certain functionality in the library.
static void set_highest(V &x)
static void set_lowest(V &x)
static const bool has_min_max