00001
00002
00008 #if !defined(__geom_SimplexJac_h__)
00009 #define __geom_SimplexJac_h__
00010
00011 #if defined(DEBUG_geom) && !defined(DEBUG_SimplexJac)
00012 #define DEBUG_SimplexJac
00013 #endif
00014
00015 #include "geometry.h"
00016
00017 #include "../../../ads/tensor/SquareMatrix.h"
00018
00019 BEGIN_NAMESPACE_GEOM
00020
00022
00129 template<int N, typename T = double>
00130 class SimplexJac {
00131 public:
00132
00133
00134
00135
00136
00138 typedef T Number;
00139
00141 typedef ads::FixedArray<N,Number> Vertex;
00142
00144 typedef geom::Simplex<N,Vertex,Number> Simplex;
00145
00147 typedef ads::SquareMatrix<N,Number> Matrix;
00148
00149 private:
00150
00151
00152
00153
00154
00155
00156
00157 Matrix _matrix;
00158
00159
00160 Number _determinant;
00161
00162
00163 Vertex _gradientDeterminant;
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178 static Matrix _identityToReference;
00179
00180
00181 static ads::FixedArray<N,Matrix> _gradientMatrix;
00182
00183
00184 static Number _determinantIdentityToReference;
00185
00186
00187 static Number _nFactorial;
00188
00189 public:
00190
00191
00194
00196 SimplexJac() :
00197 _matrix(),
00198 _determinant(),
00199 _gradientDeterminant()
00200 {}
00201
00203 SimplexJac(const SimplexJac& other) :
00204 _matrix(other._matrix),
00205 _determinant(other._determinant),
00206 _gradientDeterminant(other._gradientDeterminant)
00207 {}
00208
00209
00211 SimplexJac(const Simplex& s) {
00212 set(s);
00213 }
00214
00216 SimplexJac&
00217 operator=(const SimplexJac& other) {
00218 if (&other != this) {
00219 _matrix = other._matrix;
00220 _determinant = other._determinant;
00221 _gradientDeterminant = other._gradientDeterminant;
00222 }
00223 return *this;
00224 }
00225
00227 ~SimplexJac()
00228 {}
00229
00231
00234
00236 const Matrix&
00237 getMatrix() const {
00238 return _matrix;
00239 }
00240
00242 const ads::FixedArray<N,Matrix>&
00243 getGradientMatrix() const {
00244 return _gradientMatrix;
00245 }
00246
00248 Number
00249 getDeterminant() const {
00250 return _determinant;
00251 }
00252
00254 const Vertex&
00255 getGradientDeterminant() const {
00256 return _gradientDeterminant;
00257 }
00258
00260 Number
00261 computeContent() const {
00262 return _determinant / _nFactorial / _determinantIdentityToReference;
00263 }
00264
00266 void
00267 computeGradientContent(Vertex* grad) const {
00268 *grad = _gradientDeterminant;
00269 *grad /= (_nFactorial * _determinantIdentityToReference);
00270 }
00271
00273 Vertex
00274 computeGradientContent() const {
00275 Vertex grad;
00276 computeGradientContent(&grad);
00277 return grad;
00278 }
00279
00281
00284
00286 void
00287 setFunction(const Simplex& s);
00288
00290 void
00291 set(const Simplex& s);
00292
00293
00294
00296
00300 void
00301 setFunction(const geom::Simplex<N,ads::FixedArray<N+1,Number>,Number>& s);
00302
00304
00307 void
00308 set(const geom::Simplex<N,ads::FixedArray<N+1,Number>,Number>& s);
00309
00311
00312 };
00313
00314 END_NAMESPACE_GEOM
00315
00316 #define __geom_SimplexJac_ipp__
00317 #include "SimplexJac.ipp"
00318 #undef __geom_SimplexJac_ipp__
00319
00320 #endif