LAMA
/home/brandes/workspace/LAMA/src/lama/openmp/OpenMPUtils.hpp
Go to the documentation of this file.
00001 
00033 #ifndef LAMA_OPENMP_UTILS_HPP_
00034 #define LAMA_OPENMP_UTILS_HPP_
00035 
00036 // for dll_import
00037 #include <lama/config.hpp>
00038 
00039 // others
00040 #include <lama/LAMATypes.hpp>
00041 
00042 // assert
00043 #include <lama/exception/LAMAAssert.hpp>
00044 
00045 // logging
00046 #include <logging/logging.hpp>
00047 
00048 namespace lama
00049 {
00050 
00053 class LAMA_DLL_IMPORTEXPORT OpenMPUtils
00054 {
00055 public:
00058     template<typename ValueType, typename OtherValueType>
00059     static void scale ( ValueType mValues[],
00060                         const IndexType n,
00061                         const OtherValueType value );
00062 
00063     /*  This method is an implementation of UtilsInterface::validIndexes */
00064 
00065     static bool validIndexes( const IndexType array[], const IndexType n, const IndexType size );
00066 
00069     template<typename ValueType> 
00070     static ValueType sum( const ValueType array[], const IndexType n );
00071 
00074     template<typename ValueType> 
00075     static void setVal( ValueType array[], const IndexType n, const ValueType val );
00076 
00077     template<typename ValueType> 
00078     static void scaleVal( ValueType array[], const IndexType n, const ValueType val );
00079 
00082     template<typename ValueType> 
00083     static void setOrder( ValueType array[], const IndexType n );
00084 
00085     template<typename ValueType>
00086     static ValueType getValue( const ValueType* array, const IndexType i );
00087 
00088     template<typename ValueType>
00089     static ValueType maxval( const ValueType array[], const IndexType n );
00090 
00093     template<typename ValueType>
00094     static ValueType absMaxVal( const ValueType array[], const IndexType n );
00095 
00098     template<typename ValueType>
00099     static ValueType absMaxDiffVal( const ValueType array1[], const ValueType array2[], const IndexType n );
00100 
00101     template<typename ValueType1, typename ValueType2>
00102     static void set( ValueType1 out[], const ValueType2 in[], const IndexType n );
00103 
00106     template<typename ValueType1, typename ValueType2>
00107     static void setGather( ValueType1 out[], 
00108                            const ValueType2 in[],
00109                            const IndexType indexes[], 
00110                            const IndexType n );
00111 
00114     template<typename ValueType1, typename ValueType2>
00115     static void setScatter( ValueType1 out[], 
00116                             const IndexType indexes[], 
00117                             const ValueType2 in[],
00118                             const IndexType n );
00119 
00122     template<typename ValueType>
00123     static void invert( ValueType array[], const IndexType n );
00124 
00127     template<typename ValueType>
00128     static void scale( ValueType array[], const IndexType n, const ValueType val );
00129 
00135     static void setInterface( struct UtilsInterface& Utils );
00136 
00137 private:
00138 
00139     LAMA_LOG_DECL_STATIC_LOGGER(logger);
00140 };
00141 
00142 }  // namespace lama
00143 
00144 #endif //  LAMA_OPENMP_UTILS_HPP_