Blockstructured Adaptive Mesh Refinement in object-oriented C++
00001 #ifndef AMROC_VECTOR0_H 00002 #define AMROC_VECTOR0_H 00003 00004 #ifndef VectorName 00005 #define Vector(dim) name2(Vector,dim) 00006 #define VectorName 00007 #endif 00008 00009 #include "CompConf.h" 00010 00011 template <class DataType> class Vector(0); 00012 template <class DataType> ostream& operator << (ostream& s, const Vector(0)<DataType>& c); 00013 00014 template <class DataType> 00015 class Vector(0) { 00016 typedef Vector(0)<DataType> TVector; 00017 00018 public: 00019 typedef DataType InternalDataType; 00020 00021 Vector(0)() {} 00022 Vector(0)(const TVector& x) {} 00023 Vector(0)(const DataType& v) {} 00024 ~Vector(0)() {} 00025 00026 DataType * data() { return (DataType *)0; } 00027 const DataType * data() const { return (DataType *)0; } 00028 int length() const { return 0; } 00029 static int Length() { return 0; } 00030 00031 inline DataType operator()(int i) const { return (DataType)0; } 00032 inline DataType operator[](int i) const { return (DataType)0; } 00033 00034 inline TVector& operator=(const TVector &x) { return *this; } 00035 inline TVector& operator=(const DataType &v) { return *this; } 00036 00037 #define Vector_Vector_Operator(ope,op) \ 00038 inline TVector& operator ope (const TVector &x) \ 00039 { return(*this); } \ 00040 inline TVector operator op (const TVector &x) const \ 00041 { return(*this); } 00042 00043 Vector_Vector_Operator(+=,+) 00044 Vector_Vector_Operator(-=,-) 00045 Vector_Vector_Operator(*=,*) 00046 Vector_Vector_Operator(/=,/) 00047 #undef Vector_Vector_Operator 00048 00049 #define Vector_Scalar_Operator(ope,op) \ 00050 inline TVector& operator ope (const DataType &v) \ 00051 { return(*this); } \ 00052 inline TVector operator op (const DataType &v) const \ 00053 { return(*this); } 00054 00055 Vector_Scalar_Operator(+=,+) 00056 Vector_Scalar_Operator(-=,-) 00057 Vector_Scalar_Operator(*=,*) 00058 Vector_Scalar_Operator(/=,/) 00059 #undef Vector_Scalar_Operator 00060 00061 /* Define the negation operator */ 00062 inline TVector operator - () const 00063 { return(*this); } 00064 00065 #define Vector_Vector_RelOperator(op) \ 00066 inline int operator op (const TVector &x) const \ 00067 { return(0); } 00068 00069 Vector_Vector_RelOperator(==) 00070 Vector_Vector_RelOperator(!=) 00071 Vector_Vector_RelOperator(>) 00072 Vector_Vector_RelOperator(<) 00073 Vector_Vector_RelOperator(>=) 00074 Vector_Vector_RelOperator(<=) 00075 #undef Vector_Vector_RelOperator 00076 00077 #define Vector_Scalar_RelOperator(op) \ 00078 inline int operator op (const DataType &v) const \ 00079 { return(0); } 00080 00081 Vector_Scalar_RelOperator(==) 00082 Vector_Scalar_RelOperator(!=) 00083 Vector_Scalar_RelOperator(>) 00084 Vector_Scalar_RelOperator(<) 00085 Vector_Scalar_RelOperator(>=) 00086 Vector_Scalar_RelOperator(<=) 00087 #undef Vector_Scalar_RelOperator 00088 00089 /* Define elementwise minimum and maximum functions for Vectors */ 00090 inline void min(const TVector &x) {} 00091 inline void max(const TVector &x) {} 00092 inline DataType mincomp() const { return 0.0; } 00093 inline DataType maxcomp() const { return 0.0; } 00094 00095 inline double abs() const { return 0.0; } 00096 00097 inline TVector getmin(const TVector &x) const { return(*this); } 00098 inline TVector getmax(const TVector &x) const { return(*this); } 00099 }; 00100 00101 00102 template <class DataType> 00103 inline ostream& operator << (ostream& os, const Vector(0)<DataType> &v) { 00104 os << "( )"; 00105 return os; 00106 } 00107 00108 template <class DataType> 00109 inline Vector(0)<DataType> Min(const Vector(0)<DataType> &x, const Vector(0)<DataType> &y) 00110 { return(x); } 00111 00112 template <class DataType> 00113 inline Vector(0)<DataType> Max(const Vector(0)<DataType> &x, const Vector(0)<DataType> &y) 00114 { return(x); } 00115 00116 template <class DataType> 00117 inline double abs(const Vector(0)<DataType> &x) 00118 { return(x.abs()); } 00119 00120 template <class DataType> 00121 inline DataType mincomp(const Vector(0)<DataType> &x) 00122 { return(0.0); } 00123 00124 template <class DataType> 00125 inline DataType maxcomp(const Vector(0)<DataType> &x) 00126 { return(0.0); } 00127 00128 00129 #define Global_Vector_Scalar_Operator(op) \ 00130 template <class DataType> \ 00131 inline Vector(0)<DataType> operator op (const DataType &v, \ 00132 const Vector(0)<DataType> &x) \ 00133 { return(x op v); } 00134 00135 Global_Vector_Scalar_Operator(+) 00136 Global_Vector_Scalar_Operator(-) 00137 Global_Vector_Scalar_Operator(*) 00138 Global_Vector_Scalar_Operator(/) 00139 #undef Global_Vector_Scalar_Operator 00140 00141 00142 #define Global_Vector_Function(fct) \ 00143 template <class DataType> \ 00144 inline Vector(0)<DataType> fct(const Vector(0)<DataType> &x) \ 00145 { return(x); } 00146 00147 Global_Vector_Function(fabs) 00148 Global_Vector_Function(sqrt) 00149 #undef Global_Vector_Function 00150 00151 #define Vector_Vector_Functions(NameTo,NameFrom,ope) \ 00152 template <class DataType, class VectorType> \ 00153 inline void NameTo (Vector(0)<DataType> &x, const VectorType &y) {} \ 00154 template <class DataType, class VectorType> \ 00155 inline void NameFrom (VectorType &x, const Vector(0)<DataType> &y) {} 00156 00157 Vector_Vector_Functions(equals_to,equals_from,=) 00158 Vector_Vector_Functions(plus_to,plus_from,+=) 00159 Vector_Vector_Functions(minus_to,minus_from,-=) 00160 Vector_Vector_Functions(multiply_to,multiply_from,*=) 00161 Vector_Vector_Functions(divide_to,divide_from,/=) 00162 #undef Vector_Vector_Functions 00163 00164 00165 #endif
Quickstart Users Guide Programmers Reference Installation Examples Download
AMROC Main Home Contactlast update: 06/01/04