Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

PxArithTypes.h

Go to the documentation of this file.
00001 /*
00002  *  Copyright (c) 2003-2004, University of Amsterdam, The Netherlands.
00003  *  All rights reserved.
00004  *
00005  *  Author(s):
00006  *  Frank Seinstra <fjseins@wins.uva.nl>
00007  */
00008 
00009 #ifndef __PxArithTypes_h_
00010 #define __PxArithTypes_h_
00011 
00012 
00013 #include "Core/Array/Element/ArithTypes.h"
00014 #include "mpi.h"
00015 
00016 namespace Impala
00017 {
00018 namespace Core
00019 {
00020 namespace Array
00021 {
00022 namespace Pattern
00023 {
00024 
00025 
00026 /**********************************************************************
00027  *** Horus ArithType to MPI_Datatype conversions                    ***
00028  **********************************************************************/
00029 
00030 template <class Type>
00031 inline MPI_Datatype
00032 PxArithType(Type v)
00033 {
00034     /*** This template function should never be compiled.  If this ***/
00035     /*** still happens the compiler will halt as the function-call ***/
00036     /*** in the body of this template is undeclared.  This implies ***/
00037     /*** that a template specialization for at least 1 pre-defined ***/
00038     /*** Horus ArithType is unavailable and should be added in the ***/
00039     /*** list of template specializations below.                   ***/
00040 
00041     if_compiler_gets_here_a_template_specialization_is_missing_below();
00042     return MPI_BYTE;
00043 }
00044 
00045 
00046 template <class Type>
00047 inline int
00048 PxArithTypeDim(Type v)
00049 {
00050     /*** This template function should never be compiled.  If this ***/
00051     /*** still happens the compiler will halt as the function-call ***/
00052     /*** in the body of this template is undeclared.  This implies ***/
00053     /*** that a template specialization for at least 1 pre-defined ***/
00054     /*** Horus ArithType is unavailable and should be added in the ***/
00055     /*** list of template specializations below.                   ***/
00056 
00057     if_compiler_gets_here_a_template_specialization_is_missing_below();
00058     return (sizeof(Type) / sizeof(MPI_BYTE));
00059 }
00060 
00061 
00062 /**********************************************************************
00063  *** template specializations                                       ***
00064  **********************************************************************/
00065 
00066 template <>
00067 inline MPI_Datatype
00068 PxArithType<CxUInt8>(CxUInt8 v)
00069 {
00070     return MPI_UNSIGNED_CHAR;
00071 }
00072 
00073 
00074 template <>
00075 inline int
00076 PxArithTypeDim<CxUInt8>(CxUInt8 v)
00077 {
00078     return 1;
00079 }
00080 
00081 
00082 /**********/
00083 
00084 template <>
00085 inline MPI_Datatype
00086 PxArithType<CxUInt16>(CxUInt16 v)
00087 {
00088     return MPI_UNSIGNED_SHORT;
00089 }
00090 
00091 
00092 template <>
00093 inline int
00094 PxArithTypeDim<CxUInt16>(CxUInt16 v)
00095 {
00096     return 1;
00097 }
00098 
00099 
00100 /**********/
00101 
00102 template <>
00103 inline MPI_Datatype
00104 PxArithType<CxUInt32>(CxUInt32 v)
00105 {
00106     return MPI_UNSIGNED;
00107 }
00108 
00109 
00110 template <>
00111 inline int
00112 PxArithTypeDim<CxUInt32>(CxUInt32 v)
00113 {
00114     return 1;
00115 }
00116 
00117 
00118 /**********/
00119 
00120 template <>
00121 inline MPI_Datatype
00122 PxArithType<CxInt8>(CxInt8 v)
00123 {
00124     return MPI_CHAR;
00125 }
00126 
00127 
00128 template <>
00129 inline int
00130 PxArithTypeDim<CxInt8>(CxInt8 v)
00131 {
00132     return 1;
00133 }
00134 
00135 
00136 /**********/
00137 
00138 template <>
00139 inline MPI_Datatype
00140 PxArithType<CxInt16>(CxInt16 v)
00141 {
00142     return MPI_SHORT;
00143 }
00144 
00145 
00146 template <>
00147 inline int
00148 PxArithTypeDim<CxInt16>(CxInt16 v)
00149 {
00150     return 1;
00151 }
00152 
00153 
00154 /**********/
00155 
00156 template <>
00157 inline MPI_Datatype
00158 PxArithType<CxInt32>(CxInt32 v)
00159 {
00160     return MPI_INT;
00161 }
00162 
00163 
00164 template <>
00165 inline int
00166 PxArithTypeDim<CxInt32>(CxInt32 v)
00167 {
00168     return 1;
00169 }
00170 
00171 
00172 /**********/
00173 
00174 template <>
00175 inline MPI_Datatype
00176 PxArithType<CxReal32>(CxReal32 v)
00177 {
00178     return MPI_FLOAT;
00179 }
00180 
00181 
00182 template <>
00183 inline int
00184 PxArithTypeDim<CxReal32>(CxReal32 v)
00185 {
00186     return 1;
00187 }
00188 
00189 
00190 /**********/
00191 
00192 template <>
00193 inline MPI_Datatype
00194 PxArithType<CxReal64>(CxReal64 v)
00195 {
00196     return MPI_DOUBLE;
00197 }
00198 
00199 
00200 template <>
00201 inline int
00202 PxArithTypeDim<CxReal64>(CxReal64 v)
00203 {
00204     return 1;
00205 }
00206 
00207 
00208 /**********/
00209 
00210 template <>
00211 inline MPI_Datatype
00212 PxArithType<CxVec3Int32>(CxVec3Int32 v)
00213 {
00214     return MPI_INT;
00215 }
00216 
00217 
00218 template <>
00219 inline int
00220 PxArithTypeDim<CxVec3Int32>(CxVec3Int32 v)
00221 {
00222     return 3;
00223 }
00224 
00225 
00226 /**********/
00227 
00228 template <>
00229 inline MPI_Datatype
00230 PxArithType<CxVec3Real64>(CxVec3Real64 v)
00231 {
00232     return MPI_DOUBLE;
00233 }
00234 
00235 
00236 template <>
00237 inline int
00238 PxArithTypeDim<CxVec3Real64>(CxVec3Real64 v)
00239 {
00240     return 3;
00241 }
00242 
00243 
00244 /**********/
00245 
00246 template <>
00247 inline MPI_Datatype
00248 PxArithType<CxComplex64>(CxComplex64 v)
00249 {
00250     return MPI_DOUBLE;
00251 }
00252 
00253 
00254 template <>
00255 inline int
00256 PxArithTypeDim<CxComplex64>(CxComplex64 v)
00257 {
00258     return 2;
00259 }
00260 
00261 
00262 } // namespace Pattern
00263 } // namespace Array
00264 } // namespace Core
00265 } // namespace Impala
00266 
00267 #endif /* __PxArithTypes_h_ */

Generated on Fri Mar 19 09:30:51 2010 for ImpalaSrc by  doxygen 1.5.1