|
Chemical Data Processing Library C++ API - Version 1.1.1
|
Go to the documentation of this file.
27 #ifndef CDPL_MATH_GRIDEXPRESSION_HPP
28 #define CDPL_MATH_GRIDEXPRESSION_HPP
30 #include <type_traits>
49 template <
typename E,
typename F>
54 typedef F FunctorType;
55 typedef E ExpressionType;
56 typedef typename E::ConstClosureType ExpressionClosureType;
72 return expr.getSize1();
77 return expr.getSize2();
82 return expr.getSize3();
87 return FunctorType::apply(expr(i, j, k));
91 ExpressionClosureType expr;
94 template <
typename E,
typename F>
102 template <
typename E1,
typename E2,
typename F>
107 typedef F FunctorType;
108 typedef E1 Expression1Type;
109 typedef E2 Expression2Type;
110 typedef typename E1::ConstClosureType Expression1ClosureType;
111 typedef typename E2::ConstClosureType Expression2ClosureType;
122 GridBinary1(
const Expression1Type& e1,
const Expression2Type& e2):
123 expr1(e1), expr2(e2) {}
142 return FunctorType::apply(expr1(i, j, k), expr2(i, j, k));
146 Expression1ClosureType expr1;
147 Expression2ClosureType expr2;
150 template <
typename E1,
typename E2,
typename F>
158 template <
typename E1,
typename E2,
typename F>
163 typedef F FunctorType;
164 typedef E1 Expression1Type;
165 typedef E2 Expression2Type;
166 typedef const E1 Expression1ClosureType;
167 typedef typename E2::ConstClosureType Expression2ClosureType;
179 expr1(e1), expr2(e2) {}
183 return expr2.getSize1();
188 return expr2.getSize2();
193 return expr2.getSize3();
198 return FunctorType::apply(expr1, expr2(i, j, k));
202 Expression1ClosureType expr1;
203 Expression2ClosureType expr2;
206 template <
typename E1,
typename E2,
typename F>
214 template <
typename E1,
typename E2,
typename F>
219 typedef F FunctorType;
220 typedef E1 Expression1Type;
221 typedef E2 Expression2Type;
222 typedef typename E1::ConstClosureType Expression1ClosureType;
223 typedef const E2 Expression2ClosureType;
235 expr1(e1), expr2(e2) {}
239 return expr1.getSize1();
244 return expr1.getSize2();
249 return expr1.getSize3();
254 return FunctorType::apply(expr1(i, j, k), expr2);
258 Expression1ClosureType expr1;
259 Expression2ClosureType expr2;
262 template <
typename E1,
typename E2,
typename F>
270 template <
typename E>
276 return ExpressionType(e());
279 template <
typename E>
287 template <
typename E1,
typename E2>
288 typename GridBinary1Traits<E1, E2, ScalarAddition<typename E1::ValueType, typename E2::ValueType> >::ResultType
294 return ExpressionType(e1(), e2());
297 template <
typename E1,
typename E2>
298 typename GridBinary1Traits<E1, E2, ScalarSubtraction<typename E1::ValueType, typename E2::ValueType> >::ResultType
304 return ExpressionType(e1(), e2());
307 template <
typename E,
typename T>
308 typename std::enable_if<IsScalar<T>::value,
typename Scalar2GridBinaryTraits<E, T, ScalarMultiplication<typename E::ValueType, T> >::ResultType>::type
314 return ExpressionType(e(), t);
317 template <
typename T,
typename E>
318 typename std::enable_if<IsScalar<T>::value,
typename Scalar1GridBinaryTraits<T, E, ScalarMultiplication<T, typename E::ValueType> >::ResultType>::type
324 return ExpressionType(t, e());
327 template <
typename E,
typename T>
328 typename std::enable_if<IsScalar<T>::value,
typename Scalar2GridBinaryTraits<E, T, ScalarDivision<typename E::ValueType, T> >::ResultType>::type
334 return ExpressionType(e(), t);
337 template <
typename E1,
typename E2>
344 template <
typename E1,
typename E2>
351 template <
typename E1,
typename E2,
typename T>
358 template <
typename E>
359 typename GridUnaryTraits<E, ScalarConjugation<typename E::ValueType> >::ResultType
364 return ExpressionType(e());
367 template <
typename E>
368 typename GridUnaryTraits<E, ScalarConjugation<typename E::ValueType> >::ResultType
373 return ExpressionType(e());
376 template <
typename E>
377 typename GridUnaryTraits<E, ScalarReal<typename E::ValueType> >::ResultType
382 return ExpressionType(e());
385 template <
typename E>
386 typename GridUnaryTraits<E, ScalarImaginary<typename E::ValueType> >::ResultType
391 return ExpressionType(e());
394 template <
typename E1,
typename E2>
395 typename GridBinary1Traits<E1, E2, ScalarDivision<typename E1::ValueType, typename E2::ValueType> >::ResultType
401 return ExpressionType(e1(), e2());
404 template <
typename E1,
typename E2>
405 typename GridBinary1Traits<E1, E2, ScalarMultiplication<typename E1::ValueType, typename E2::ValueType> >::ResultType
411 return ExpressionType(e1(), e2());
414 template <
typename E>
423 #endif // CDPL_MATH_GRIDEXPRESSION_HPP
SizeType getSize1() const
Definition: GridExpression.hpp:181
Definition: GridExpression.hpp:96
static ResultType apply(const GridExpression< G1 > &e1, const GridExpression< G2 > &e2, Argument3Type epsilon)
Definition: Functional.hpp:1543
F::ResultType ValueType
Definition: GridExpression.hpp:170
GridEquality< E1, E2 >::ResultType operator!=(const GridExpression< E1 > &e1, const GridExpression< E2 > &e2)
Definition: GridExpression.hpp:346
#define CDPL_MATH_CHECK_SIZE_EQUALITY(size1, size2, e)
Definition: Check.hpp:62
const unsigned int E
Specifies that the stereocenter has E configuration.
Definition: CIPDescriptor.hpp:96
std::common_type< T1, T2 >::type Type
Definition: CommonType.hpp:43
SelfType ClosureType
Definition: GridExpression.hpp:174
SizeType getSize2() const
Definition: GridExpression.hpp:130
std::enable_if< IsScalar< T >::value, typename Scalar2GridBinaryTraits< E, T, ScalarMultiplication< typename E::ValueType, T > >::ResultType >::type operator*(const GridExpression< E > &e, const T &t)
Definition: GridExpression.hpp:309
Definition: GridExpression.hpp:104
GridEquality< E1, E2 >::ResultType operator==(const GridExpression< E1 > &e1, const GridExpression< E2 > &e2)
Definition: GridExpression.hpp:339
Definition: GridExpression.hpp:208
SelfType ClosureType
Definition: GridExpression.hpp:230
F::ResultType ValueType
Definition: GridExpression.hpp:59
GridUnaryTraits< E, ScalarConjugation< typename E::ValueType > >::ResultType herm(const GridExpression< E > &e)
Definition: GridExpression.hpp:369
CommonType< typename E1::DifferenceType, typename E2::DifferenceType >::Type DifferenceType
Definition: GridExpression.hpp:120
CommonType< typename E1::SizeType, typename E2::SizeType >::Type SizeType
Definition: GridExpression.hpp:119
GridUnaryTraits< E, ScalarReal< typename E::ValueType > >::ResultType real(const GridExpression< E > &e)
Definition: GridExpression.hpp:378
ExpressionType ResultType
Definition: GridExpression.hpp:267
SizeType getSize3() const
Definition: GridExpression.hpp:80
Scalar1GridBinary< E1, E2, F > ExpressionType
Definition: GridExpression.hpp:210
GridUnaryTraits< E, ScalarNegation< typename E::ValueType > >::ResultType operator-(const GridExpression< E > &e)
Definition: GridExpression.hpp:272
Definition: Functional.hpp:239
Definition: GridExpression.hpp:216
static ResultType apply(const GridExpression< G > &e)
Definition: Functional.hpp:1581
ConstReference operator()(SizeType i, SizeType j, SizeType k) const
Definition: GridExpression.hpp:85
Definition: Functional.hpp:211
ConstReference operator()(SizeType i, SizeType j, SizeType k) const
Definition: GridExpression.hpp:252
ConstReference operator()(SizeType i, SizeType j, SizeType k) const
Definition: GridExpression.hpp:140
Definition: Functional.hpp:253
const ValueType Reference
Definition: GridExpression.hpp:228
const SelfType ConstClosureType
Definition: GridExpression.hpp:117
SizeType getSize1() const
Definition: GridExpression.hpp:125
GridBinary1Traits< E1, E2, ScalarDivision< typename E1::ValueType, typename E2::ValueType > >::ResultType elemDiv(const GridExpression< E1 > &e1, const GridExpression< E2 > &e2)
Definition: GridExpression.hpp:396
GridElementSum< E >::ResultType sum(const GridExpression< E > &e)
Definition: GridExpression.hpp:416
GridBinary1< E1, E2, F > ExpressionType
Definition: GridExpression.hpp:154
Thrown to indicate that the size of a (multidimensional) array is not correct.
Definition: Base/Exceptions.hpp:133
static ResultType apply(const GridExpression< G1 > &e1, const GridExpression< G2 > &e2)
Definition: Functional.hpp:1503
Definition of type traits.
SizeType getSize3() const
Definition: GridExpression.hpp:247
Definition: Functional.hpp:225
E::DifferenceType DifferenceType
Definition: GridExpression.hpp:65
const E & operator+(const GridExpression< E > &e)
Definition: GridExpression.hpp:282
const ValueType ConstReference
Definition: GridExpression.hpp:115
const ValueType ConstReference
Definition: GridExpression.hpp:227
SizeType getSize1() const
Definition: GridExpression.hpp:237
const ValueType Reference
Definition: GridExpression.hpp:116
GridBooleanBinaryFunctor< G1, G2 >::ResultType ResultType
Definition: Functional.hpp:1501
GridUnary< E, F > ExpressionType
Definition: GridExpression.hpp:98
Definition of various functors.
GridUnaryTraits< E, ScalarConjugation< typename E::ValueType > >::ResultType conj(const GridExpression< E > &e)
Definition: GridExpression.hpp:360
ExpressionType ResultType
Definition: GridExpression.hpp:155
Scalar2GridBinary< E1, E2, F > ExpressionType
Definition: GridExpression.hpp:266
const unsigned int T
Specifies Hydrogen (Tritium).
Definition: AtomType.hpp:67
SizeType getSize1() const
Definition: GridExpression.hpp:70
SizeType getSize3() const
Definition: GridExpression.hpp:135
GridBinary1Traits< E1, E2, ScalarMultiplication< typename E1::ValueType, typename E2::ValueType > >::ResultType elemProd(const GridExpression< E1 > &e1, const GridExpression< E2 > &e2)
Definition: GridExpression.hpp:406
Definition of exception classes.
GridScalarUnaryFunctor< G >::ResultType ResultType
Definition: Functional.hpp:1579
E1::DifferenceType DifferenceType
Definition: GridExpression.hpp:232
Definition: Expression.hpp:120
F::ResultType ValueType
Definition: GridExpression.hpp:114
SelfType ClosureType
Definition: GridExpression.hpp:63
Definition: GridExpression.hpp:160
The namespace of the Chemical Data Processing Library.
ConstReference operator()(SizeType i, SizeType j, SizeType k) const
Definition: GridExpression.hpp:196
E2::DifferenceType DifferenceType
Definition: GridExpression.hpp:176
const ValueType ConstReference
Definition: GridExpression.hpp:60
SizeType getSize3() const
Definition: GridExpression.hpp:191
std::enable_if< IsScalar< T >::value, typename Scalar2GridBinaryTraits< E, T, ScalarDivision< typename E::ValueType, T > >::ResultType >::type operator/(const GridExpression< E > &e, const T &t)
Definition: GridExpression.hpp:329
E1::SizeType SizeType
Definition: GridExpression.hpp:231
SizeType getSize2() const
Definition: GridExpression.hpp:75
GridUnary(const ExpressionType &e)
Definition: GridExpression.hpp:67
const ValueType Reference
Definition: GridExpression.hpp:61
Definition: GridExpression.hpp:51
GridBinary1(const Expression1Type &e1, const Expression2Type &e2)
Definition: GridExpression.hpp:122
Scalar2GridBinary(const Expression1Type &e1, const Expression2Type &e2)
Definition: GridExpression.hpp:234
GridUnaryTraits< E, ScalarImaginary< typename E::ValueType > >::ResultType imag(const GridExpression< E > &e)
Definition: GridExpression.hpp:387
E::SizeType SizeType
Definition: GridExpression.hpp:64
std::enable_if< std::is_arithmetic< T >::value, typename GridToleranceEquality< E1, E2, T >::ResultType >::type equals(const GridExpression< E1 > &e1, const GridExpression< E2 > &e2, const T &eps)
Definition: GridExpression.hpp:353
ExpressionType ResultType
Definition: GridExpression.hpp:99
const SelfType ConstClosureType
Definition: GridExpression.hpp:62
Scalar1GridBinary(const Expression1Type &e1, const Expression2Type &e2)
Definition: GridExpression.hpp:178
SizeType getSize2() const
Definition: GridExpression.hpp:242
const ValueType Reference
Definition: GridExpression.hpp:172
Definition: GridExpression.hpp:264
E2::SizeType SizeType
Definition: GridExpression.hpp:175
Definition of various preprocessor macros for error checking.
SizeType getSize2() const
Definition: GridExpression.hpp:186
ExpressionType ResultType
Definition: GridExpression.hpp:211
Definition of basic expression types.
const SelfType ConstClosureType
Definition: GridExpression.hpp:173
const SelfType ConstClosureType
Definition: GridExpression.hpp:229
Scalar3GridBooleanTernaryFunctor< G1, G2, T >::ResultType ResultType
Definition: Functional.hpp:1540
Definition: GridExpression.hpp:152
F::ResultType ValueType
Definition: GridExpression.hpp:226
const unsigned int F
Specifies Fluorine.
Definition: AtomType.hpp:107
SelfType ClosureType
Definition: GridExpression.hpp:118
const ValueType ConstReference
Definition: GridExpression.hpp:171