25template<
typename Type>
27 : std::binary_function<Type,Type,Type>
29 Type operator()(
const Type& t1,
const Type& t2)
const
31 return std::min(t1,t2);
35template<
typename Type>
37 : std::binary_function<Type,Type,Type>
39 Type operator()(
const Type& t1,
const Type& t2)
const
41 return std::max(t1,t2);
47template<
typename Type,
typename BinaryFunction>
56 op = memory::shared_ptr<MPI_Op>(
new MPI_Op);
57 MPI_Op_create((
void (*)(
void*,
void*,
int*, MPI_Datatype*))&operation,
true,op.get());
62 static void operation (Type *in, Type *inout,
int *len, MPI_Datatype*)
66 for (
int i=0; i< *len; ++i, ++in, ++inout) {
68 temp = func(*in, *inout);
73 Generic_MPI_Op (
const Generic_MPI_Op& ) {}
74 static memory::shared_ptr<MPI_Op> op;
78template<
typename Type,
typename BinaryFunction>
79memory::shared_ptr<MPI_Op> Generic_MPI_Op<Type,BinaryFunction>::op = memory::shared_ptr<MPI_Op>(
static_cast<MPI_Op*
>(0));
81#define ComposeMPIOp(type,func,op) \
83 class Generic_MPI_Op<type, func<type> >{ \
85 static MPI_Op get(){ \
89 Generic_MPI_Op () {} \
90 Generic_MPI_Op (const Generic_MPI_Op & ) {} \
94ComposeMPIOp(
char, std::plus, MPI_SUM);
95ComposeMPIOp(
unsigned char, std::plus, MPI_SUM);
96ComposeMPIOp(
short, std::plus, MPI_SUM);
97ComposeMPIOp(
unsigned short, std::plus, MPI_SUM);
98ComposeMPIOp(
int, std::plus, MPI_SUM);
99ComposeMPIOp(
unsigned int, std::plus, MPI_SUM);
100ComposeMPIOp(
long, std::plus, MPI_SUM);
101ComposeMPIOp(
unsigned long, std::plus, MPI_SUM);
102ComposeMPIOp(
float, std::plus, MPI_SUM);
103ComposeMPIOp(
double, std::plus, MPI_SUM);
104ComposeMPIOp(
long double, std::plus, MPI_SUM);
106ComposeMPIOp(
char, std::multiplies, MPI_PROD);
107ComposeMPIOp(
unsigned char, std::multiplies, MPI_PROD);
108ComposeMPIOp(
short, std::multiplies, MPI_PROD);
109ComposeMPIOp(
unsigned short, std::multiplies, MPI_PROD);
110ComposeMPIOp(
int, std::multiplies, MPI_PROD);
111ComposeMPIOp(
unsigned int, std::multiplies, MPI_PROD);
112ComposeMPIOp(
long, std::multiplies, MPI_PROD);
113ComposeMPIOp(
unsigned long, std::multiplies, MPI_PROD);
114ComposeMPIOp(
float, std::multiplies, MPI_PROD);
115ComposeMPIOp(
double, std::multiplies, MPI_PROD);
116ComposeMPIOp(
long double, std::multiplies, MPI_PROD);
118ComposeMPIOp(
char, Min, MPI_MIN);
119ComposeMPIOp(
unsigned char, Min, MPI_MIN);
120ComposeMPIOp(
short, Min, MPI_MIN);
121ComposeMPIOp(
unsigned short, Min, MPI_MIN);
122ComposeMPIOp(
int, Min, MPI_MIN);
123ComposeMPIOp(
unsigned int, Min, MPI_MIN);
124ComposeMPIOp(
long, Min, MPI_MIN);
125ComposeMPIOp(
unsigned long, Min, MPI_MIN);
126ComposeMPIOp(
float, Min, MPI_MIN);
127ComposeMPIOp(
double, Min, MPI_MIN);
128ComposeMPIOp(
long double, Min, MPI_MIN);
130ComposeMPIOp(
char, Max, MPI_MAX);
131ComposeMPIOp(
unsigned char, Max, MPI_MAX);
132ComposeMPIOp(
short, Max, MPI_MAX);
133ComposeMPIOp(
unsigned short, Max, MPI_MAX);
134ComposeMPIOp(
int, Max, MPI_MAX);
135ComposeMPIOp(
unsigned int, Max, MPI_MAX);
136ComposeMPIOp(
long, Max, MPI_MAX);
137ComposeMPIOp(
unsigned long, Max, MPI_MAX);
138ComposeMPIOp(
float, Max, MPI_MAX);
139ComposeMPIOp(
double, Max, MPI_MAX);
140ComposeMPIOp(
long double, Max, MPI_MAX);
The G+Smo namespace, containing all definitions for the library.