178 |
kaklik |
1 |
#if !defined(__MIMASINTERNALARRAYFUNC) |
|
|
2 |
# error "Do not include this file directly." |
|
|
3 |
#endif |
|
|
4 |
#if !defined(__MIMASEXTERNALARRAYFUNC) |
|
|
5 |
# error "Do not include this file directly." |
|
|
6 |
#endif |
|
|
7 |
#if !defined(__MIMASFUNCTIONOBJECT) |
|
|
8 |
# error "Do not include this file directly." |
|
|
9 |
#endif |
|
|
10 |
|
|
|
11 |
namespace mimas { |
|
|
12 |
|
|
|
13 |
/** @addtogroup arrayOp |
|
|
14 |
@{ */ |
|
|
15 |
/// |
|
|
16 |
template < |
|
|
17 |
template< typename, size_t, typename > class MultiArray1, |
|
|
18 |
template< typename, size_t, typename > class MultiArray2, |
|
|
19 |
typename T, size_t NumDims, typename Allocator |
|
|
20 |
> |
|
|
21 |
boost::multi_array< T, NumDims, Allocator > __MIMASEXTERNALARRAYFUNC |
|
|
22 |
( const MultiArray1< T, NumDims, Allocator > &a, |
|
|
23 |
const MultiArray2< T, NumDims, Allocator > &b ) |
|
|
24 |
{ |
|
|
25 |
return multi_func< T >( a, b, __MIMASFUNCTIONOBJECT< T >() ); |
|
|
26 |
}; |
|
|
27 |
|
|
|
28 |
/// |
|
|
29 |
template < |
|
|
30 |
template< typename, size_t, typename > class MultiArray, |
|
|
31 |
typename T, size_t NumDims, typename Allocator |
|
|
32 |
> |
|
|
33 |
boost::multi_array< T, NumDims, Allocator > __MIMASEXTERNALARRAYFUNC |
|
|
34 |
( const MultiArray< T, NumDims, Allocator > &a, |
|
|
35 |
const T &b ) |
|
|
36 |
{ |
|
|
37 |
return multi_func< T >( a, std::bind2nd( __MIMASFUNCTIONOBJECT< T >(), b ) ); |
|
|
38 |
}; |
|
|
39 |
|
|
|
40 |
/// |
|
|
41 |
template < |
|
|
42 |
template< typename, size_t, typename > class MultiArray, |
|
|
43 |
typename T, size_t NumDims, typename Allocator |
|
|
44 |
> |
|
|
45 |
boost::multi_array< T, NumDims, Allocator > __MIMASEXTERNALARRAYFUNC |
|
|
46 |
( const T &a, |
|
|
47 |
const MultiArray< T, NumDims, Allocator > &b ) |
|
|
48 |
{ |
|
|
49 |
return multi_func< T >( b, std::bind1st( __MIMASFUNCTIONOBJECT< T >(), a ) ); |
|
|
50 |
}; |
|
|
51 |
|
|
|
52 |
/// |
|
|
53 |
template < |
|
|
54 |
template< typename, size_t, typename > class MultiArray2, |
|
|
55 |
typename T, size_t NumDims, typename Allocator |
|
|
56 |
> |
|
|
57 |
boost::detail::multi_array::sub_array< T, NumDims > __MIMASINTERNALARRAYFUNC |
|
|
58 |
( boost::detail::multi_array::sub_array< T, NumDims > a, |
|
|
59 |
const MultiArray2< T, NumDims, Allocator > &b ) |
|
|
60 |
{ |
|
|
61 |
return multi_apply( a, a, b, |
|
|
62 |
_multi_help2< T, T, T, __MIMASFUNCTIONOBJECT< T > > |
|
|
63 |
( __MIMASFUNCTIONOBJECT< T >() ) ); |
|
|
64 |
}; |
|
|
65 |
|
|
|
66 |
/// |
|
|
67 |
template < |
|
|
68 |
template< typename, size_t, typename > class MultiArray1, |
|
|
69 |
template< typename, size_t, typename > class MultiArray2, |
|
|
70 |
typename T, size_t NumDims, typename Allocator |
|
|
71 |
> |
|
|
72 |
MultiArray1< T, NumDims, Allocator > &__MIMASINTERNALARRAYFUNC |
|
|
73 |
( MultiArray1< T, NumDims, Allocator > &a, |
|
|
74 |
const MultiArray2< T, NumDims, Allocator > &b ) |
|
|
75 |
{ |
|
|
76 |
return multi_apply( a, a, b, |
|
|
77 |
_multi_help2< T, T, T, __MIMASFUNCTIONOBJECT< T > > |
|
|
78 |
( __MIMASFUNCTIONOBJECT< T >() ) ); |
|
|
79 |
}; |
|
|
80 |
|
|
|
81 |
/// |
|
|
82 |
template < |
|
|
83 |
typename T, size_t NumDims |
|
|
84 |
> |
|
|
85 |
boost::detail::multi_array::sub_array< T, NumDims > __MIMASINTERNALARRAYFUNC |
|
|
86 |
( boost::detail::multi_array::sub_array< T, NumDims > a, |
|
|
87 |
const T &b ) |
|
|
88 |
{ |
|
|
89 |
return multi_apply( a, a, |
|
|
90 |
_multi_help1< T, T, |
|
|
91 |
std::binder2nd< __MIMASFUNCTIONOBJECT< T > > > |
|
|
92 |
( std::bind2nd( __MIMASFUNCTIONOBJECT< T >(), b ) ) ); |
|
|
93 |
}; |
|
|
94 |
|
|
|
95 |
/// |
|
|
96 |
template < |
|
|
97 |
template< typename, size_t, typename > class MultiArray, |
|
|
98 |
typename T, size_t NumDims, typename Allocator |
|
|
99 |
> |
|
|
100 |
MultiArray< T, NumDims, Allocator > &__MIMASINTERNALARRAYFUNC |
|
|
101 |
( MultiArray< T, NumDims, Allocator > &a, |
|
|
102 |
const T &b ) |
|
|
103 |
{ |
|
|
104 |
return multi_apply( a, a, |
|
|
105 |
_multi_help1< T, T, |
|
|
106 |
std::binder2nd< __MIMASFUNCTIONOBJECT< T > > > |
|
|
107 |
( std::bind2nd( __MIMASFUNCTIONOBJECT< T >(), b ) ) ); |
|
|
108 |
}; |
|
|
109 |
///@} |
|
|
110 |
|
|
|
111 |
} |
|
|
112 |
|
|
|
113 |
#undef __MIMASINTERNALARRAYFUNC |
|
|
114 |
#undef __MIMASEXTERNALARRAYFUNC |
|
|
115 |
#undef __MIMASFUNCTIONOBJECT |