00001 // -*- C++ -*- 00002 00008 #if !defined(__geom_SimplexModMeanRatio_h__) 00009 #define __geom_SimplexModMeanRatio_h__ 00010 00011 #if defined(DEBUG_geom) && !defined(DEBUG_SimplexModMeanRatio) 00012 #define DEBUG_SimplexModMeanRatio 00013 #endif 00014 00015 #include "SimplexMeanRatio.h" 00016 #include "SimplexModDet.h" 00017 00018 BEGIN_NAMESPACE_GEOM 00019 00021 00044 template <int N, typename T = double> 00045 class SimplexModMeanRatio : 00046 public SimplexMeanRatio<N,T> { 00047 private: 00048 00049 typedef SimplexMeanRatio<N,T> Base; 00050 00051 public: 00052 00053 // 00054 // Public types. 00055 // 00056 00058 typedef T Number; 00059 00061 typedef typename Base::Vertex Vertex; 00062 00064 typedef typename Base::Simplex Simplex; 00065 00067 typedef typename Base::Matrix Matrix; 00068 00069 public: 00070 00071 //-------------------------------------------------------------------------- 00074 00076 SimplexModMeanRatio() : 00077 Base() 00078 {} 00079 00081 SimplexModMeanRatio(const SimplexModMeanRatio& other) : 00082 Base(other) 00083 {} 00084 00085 00087 SimplexModMeanRatio(const Simplex& s) : 00088 Base(s) 00089 {} 00090 00092 SimplexModMeanRatio& 00093 operator=(const SimplexModMeanRatio& other) { 00094 if (&other != this) { 00095 Base::operator=(other); 00096 } 00097 return *this; 00098 } 00099 00101 ~SimplexModMeanRatio() 00102 {} 00103 00105 //-------------------------------------------------------------------------- 00109 00110 00112 using Base::getMatrix; 00113 00115 using Base::getGradientMatrix; 00116 00118 using Base::getDeterminant; 00119 00121 using Base::getGradientDeterminant; 00122 00124 using Base::computeContent; 00125 00127 using Base::computeGradientContent; 00128 00130 using Base::getDimension; 00131 00133 //-------------------------------------------------------------------------- 00136 00138 00146 Number 00147 operator()() const { 00148 return operator()(getDeterminant()); 00149 } 00150 00152 00160 Number 00161 operator()(const Simplex& simplex) const { 00162 setFunction(simplex); 00163 return operator()(getDeterminant()); 00164 } 00165 00167 00188 Number 00189 operator()(Number minDeterminant) const; 00190 00192 00200 void 00201 computeGradient(Vertex* gradient) const { 00202 return computeGradient(getDeterminant(), gradient); 00203 } 00204 00206 00226 void 00227 computeGradient(Number minDeterminant, Vertex* gradient) const; 00228 00230 00231 protected: 00232 00234 Number 00235 computeFunctionGivenS2(const Number s2) const { 00236 return computeFunctionGivenS2(getDeterminant(), s2); 00237 } 00238 00240 Number 00241 computeFunctionGivenS2(Number minDeterminant, Number s2) const; 00242 00243 private: 00244 00245 Number 00246 getH(const Number minDeterminant) const { 00247 return SimplexModDet<T>::getH(getDeterminant(), minDeterminant); 00248 } 00249 00250 }; 00251 00252 END_NAMESPACE_GEOM 00253 00254 #define __geom_SimplexModMeanRatio_ipp__ 00255 #include "SimplexModMeanRatio.ipp" 00256 #undef __geom_SimplexModMeanRatio_ipp__ 00257 00258 #endif