00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef ACLVIS_OPERATIONS_H
00012 #define ACLVIS_OPERATIONS_H
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifdef IPPL_LUX
00024 # include "luxvis.h"
00025 #else
00026 # include "aclvis/aclvis.h"
00027 #endif
00028 #include "AppTypes/Vektor.h"
00029 #include "AppTypes/dcomplex.h"
00030
00031
00033
00034
00035 struct ACLVISToFloat {
00036 template<class T>
00037 float operator()(const T&) { return 0.0; }
00038
00039 float operator()(const char& val) { return static_cast<float>(val); }
00040 float operator()(const short& val) { return static_cast<float>(val); }
00041 float operator()(const int& val) { return static_cast<float>(val); }
00042 float operator()(const long& val) { return static_cast<float>(val); }
00043 float operator()(const float& val) { return static_cast<float>(val); }
00044 float operator()(const double& val) { return static_cast<float>(val); }
00045 float operator()(const dcomplex& val) {
00046 return static_cast<float>(norm(val));
00047 }
00048 };
00049
00050
00052
00053
00054
00055 template<class V, class T>
00056 struct ACLVISTraits {
00057
00058 #ifdef IPPL_LUX
00059 static int getType() { return vizStructuredFieldDataType::LUXVIS_SCALAR; }
00060 #else
00061 static int getType() { return vizStructuredFieldDataType::ACLVIS_SCALAR; }
00062 #endif
00063
00064
00065 static void setPoint(V *vizdata, int indx, const T &val) {
00066 vizdata->GetVizData()->AddScalar(indx, ACLVISToFloat()(val));
00067 }
00068
00069
00070
00071 static void setID(V *vizdata, int indx, int id) {
00072 vizdata->GetVizData()->AddIdInfoVal(indx, id);
00073 }
00074 };
00075
00076
00078
00079 template<class V, class T, unsigned int D>
00080 struct ACLVISTraits<V, Vektor<T,D> > {
00081
00082 #ifdef IPPL_LUX
00083 static int getType() { return vizStructuredFieldDataType::LUXVIS_VECTOR; }
00084 #else
00085 static int getType() { return vizStructuredFieldDataType::ACLVIS_VECTOR; }
00086 #endif
00087
00088
00089 static void setPoint(V *vizdata, int indx, const Vektor<T,D> &val) {
00090 float vect[3];
00091 for (unsigned int d=0; d < 3; ++d)
00092 vect[d] = (d < D ? ACLVISToFloat()(val[d]) : 0.0);
00093 vizdata->GetVizData()->AddVector(indx, vect);
00094 }
00095
00096
00097
00098 static void setCoord(V *vizdata, int indx, const Vektor<T,D> &pos) {
00099 float vect[3];
00100 for (unsigned int d=0; d < 3; ++d)
00101 vect[d] = (d < D ? ACLVISToFloat()(pos[d]) : 0.0);
00102 vizdata->GetVizData()->AddPoint(indx, vect);
00103 }
00104 };
00105
00106
00107 #endif // ACLVIS_OPERATIONS_H
00108
00109
00110
00111
00112
00113