XMLIOSERVER 0.4
Serveur d'Entrées/Sorties parallèles
|
00001 /* ************************************************************************** * 00002 * Copyright © IPSL/LSCE, XMLIOServer, Avril 2010 - Octobre 2011 * 00003 * ************************************************************************** */ 00004 00005 #ifndef __ARRAY_UTIL_HPP__ 00006 #define __ARRAY_UTIL_HPP__ 00007 00016 #ifndef __XIOS_NO_EXTERN 00017 00018 // boost Headers 00019 #include <boost/multi_array.hpp> 00020 00021 #endif // __XIOS_NO_EXTERN 00022 00023 // /////////////////////////////// Définitions ////////////////////////////// // 00024 00025 namespace xmlioserver 00026 { 00032 class CArrayUtil 00033 { 00034 public : // Conversion de tableau typé 00035 00055 template <typename ODataType, typename IDataType, std::size_t Size> 00056 static inline void Convert 00057 (const boost::multi_array<IDataType, Size> & _array_in, 00058 boost::multi_array<ODataType, Size> & _array_out); 00059 00060 public : // Opérations sur les tableaux 00061 00080 template <typename DataType, std::size_t Size> 00081 static inline void Apply1(const boost::multi_array<DataType, Size> & _input_array1, 00082 const boost::multi_array<DataType, Size> & _input_array2, 00083 boost::multi_array<DataType, Size> & _output_array, 00084 DataType (*_function) (DataType, DataType)); 00085 00104 template <typename DataType, typename ScalDataType, std::size_t Size> 00105 static inline void Apply2(const boost::multi_array<DataType, Size> & _input_array, 00106 boost::multi_array<DataType, Size> & _output_array, 00107 ScalDataType _scalar, 00108 DataType (*_function) (DataType, ScalDataType)); 00109 00110 public : // Autres méthodes 00111 00121 template <typename ODataType, typename IDataType, std::size_t Size> 00122 static inline void SameShape 00123 (const boost::multi_array<IDataType, Size> & _array_in, 00124 boost::multi_array<ODataType, Size> & _array_out); 00125 00126 }; // CArrayUtil 00127 00129 template <typename DataType, typename ScalDataType> 00130 DataType AUSum (DataType _value_1, ScalDataType _value_2); 00131 00132 } // namespace xmlioserver 00133 00134 #endif // __ARRAY_UTIL_HPP__