ConformTransformationQ1Hexahedron Class Reference

#include <ConformTransformation.hpp>

Collaboration diagram for ConformTransformationQ1Hexahedron:

Collaboration graph
[legend]

List of all members.

Public Types

typedef
ConformTransformationQ1Quadrangle 
BoundaryConformTransformation

Public Member Functions

void dx (const TinyVector< 3, real_t > &X, TinyVector< 3, real_t > &__result) const
void dx (const real_t &x, const real_t &y, const real_t &z, TinyVector< 3, real_t > &__result) const
void dy (const TinyVector< 3, real_t > &X, TinyVector< 3, real_t > &__result) const
void dy (const real_t &x, const real_t &y, const real_t &z, TinyVector< 3, real_t > &__result) const
void dz (const TinyVector< 3, real_t > &X, TinyVector< 3, real_t > &__result) const
void dz (const real_t &x, const real_t &y, const real_t &z, TinyVector< 3, real_t > &__result) const
void value (const TinyVector< 3, real_t > &X, TinyVector< 3, real_t > &__result) const
void value (const real_t &x, const real_t &y, const real_t &z, TinyVector< 3, real_t > &__result) const
bool invertT (const real_t &x, const real_t &y, const real_t &z, TinyVector< 3, real_t > &Xhat) const
 Computes Xhat, the point which transformed is (x,y,z).
bool invertT (const TinyVector< 3, real_t > &X, TinyVector< 3, real_t > &Xhat) const
 Computes Xhat, the point which transformed is X.
real_t integrate (const ScalarFunctionBase &f) const
 ConformTransformationQ1Hexahedron (const Hexahedron &H)

Private Member Functions

bool __inside (const real_t &x, const real_t &y, const real_t &z, TinyVector< 6, bool > &faces) const

Private Attributes

const Hexahedron__H
TinyVector< 3, real_t > & __a
TinyVector< 3, real_t > & __b
TinyVector< 3, real_t > & __c
TinyVector< 3, real_t > & __d
TinyVector< 3, real_t > & __e
TinyVector< 3, real_t > & __f
TinyVector< 3, real_t > & __g
TinyVector< 3, real_t > & __h
TinyVector< 8, TinyVector
< 3, real_t > > 
__vertices

Friends

class ConformTransformationQ1HexahedronJacobian


Detailed Description

Definition at line 375 of file ConformTransformation.hpp.


Member Typedef Documentation

Definition at line 380 of file ConformTransformation.hpp.


Constructor & Destructor Documentation

ConformTransformationQ1Hexahedron::ConformTransformationQ1Hexahedron ( const Hexahedron H  )  [inline]

Definition at line 484 of file ConformTransformation.hpp.

References __vertices.

00485     : __H(H),
00486       __a(__vertices[0]),
00487       __b(__vertices[1]),
00488       __c(__vertices[2]),
00489       __d(__vertices[3]),
00490       __e(__vertices[4]),
00491       __f(__vertices[5]),
00492       __g(__vertices[6]),
00493       __h(__vertices[7])
00494   {
00495     TinyVector<8,TinyVector<3, real_t> > jCoefs;
00496 
00497     jCoefs[0]=H(0);
00498     jCoefs[1]=H(1) - jCoefs[0];
00499     jCoefs[2]=H(3) - jCoefs[0];
00500     jCoefs[3]=H(4) - jCoefs[0];
00501     jCoefs[4]=H(2) + jCoefs[0] - H(1) - H(3);
00502     jCoefs[5]=H(5) + jCoefs[0] - H(1) - H(4);
00503     jCoefs[6]=H(7) + jCoefs[0] - H(3) - H(4);
00504     jCoefs[7]
00505       = H(1) - jCoefs[0] - H(2) + H(3)
00506       + H(4) - H(5)
00507       + H(6) - H(7);
00508 
00509     __vertices = jCoefs;
00510   }


Member Function Documentation

bool ConformTransformationQ1Hexahedron::__inside ( const real_t &  x,
const real_t &  y,
const real_t &  z,
TinyVector< 6, bool > &  faces 
) const [private]

Definition at line 36 of file ConformTransformation.cpp.

References __H, Hexahedron::faces, Shape::inside(), Quadrangle::normal(), Hexahedron::NumberOfFaces, and Quadrangle::NumberOfVertices.

00040 {
00041   bool inside = true;
00042   faces = false;
00043   for (size_t i = 0 ; i<Hexahedron::NumberOfFaces; ++i) {
00044     TinyVector<3, real_t> faceMassCenter(0,0,0);
00045     TinyVector<Hexahedron::FaceType::NumberOfVertices, Vertex*> face;
00046 
00047     for (size_t n=0; n<Hexahedron::FaceType::NumberOfVertices; ++n) {
00048       const Vertex& v = __H(Hexahedron::faces[i][n]);
00049       faceMassCenter += v;
00050       face[n] = const_cast<Vertex*>(&v);
00051     }
00052     Quadrangle Q(face);
00053     faceMassCenter *= (1./Hexahedron::FaceType::NumberOfVertices);
00054     TinyVector<3,real_t> normal = Q.normal();
00055 
00056     TinyVector<3, real_t> X(x,y,z);
00057     X -= faceMassCenter;
00058     if (X*normal > 0) { // must look in that direction
00059       faces[i] = true;
00060       inside = false;
00061     }
00062  }
00063   return inside;
00064 }

Here is the call graph for this function:

void ConformTransformationQ1Hexahedron::dx ( const TinyVector< 3, real_t > &  X,
TinyVector< 3, real_t > &  __result 
) const [inline]

Definition at line 401 of file ConformTransformation.hpp.

Referenced by ConformTransformationQ1HexahedronJacobian::ConformTransformationQ1HexahedronJacobian(), and invertT().

00403   {
00404     dx(X[0], X[1], X[2], __result);
00405   }

void ConformTransformationQ1Hexahedron::dx ( const real_t &  x,
const real_t &  y,
const real_t &  z,
TinyVector< 3, real_t > &  __result 
) const [inline]

Definition at line 407 of file ConformTransformation.hpp.

References __b, __e, __f, and __h.

00409   {
00410     __result = __b;
00411     __result += y*__e;
00412     __result += z*__f;
00413     __result += (y*z)*__h;
00414   }

void ConformTransformationQ1Hexahedron::dy ( const TinyVector< 3, real_t > &  X,
TinyVector< 3, real_t > &  __result 
) const [inline]

Definition at line 416 of file ConformTransformation.hpp.

Referenced by ConformTransformationQ1HexahedronJacobian::ConformTransformationQ1HexahedronJacobian(), and invertT().

00418   {
00419     dy(X[0], X[1], X[2], __result);
00420   }

void ConformTransformationQ1Hexahedron::dy ( const real_t &  x,
const real_t &  y,
const real_t &  z,
TinyVector< 3, real_t > &  __result 
) const [inline]

Definition at line 422 of file ConformTransformation.hpp.

References __c, __e, __g, and __h.

00424   {
00425     __result = __c;
00426     __result += x*__e;
00427     __result += z*__g;
00428     __result += (x*z)*__h;
00429   }

void ConformTransformationQ1Hexahedron::dz ( const TinyVector< 3, real_t > &  X,
TinyVector< 3, real_t > &  __result 
) const [inline]

Definition at line 431 of file ConformTransformation.hpp.

Referenced by ConformTransformationQ1HexahedronJacobian::ConformTransformationQ1HexahedronJacobian(), and invertT().

00433   {
00434     dz(X[0], X[1], X[2], __result);
00435   }

void ConformTransformationQ1Hexahedron::dz ( const real_t &  x,
const real_t &  y,
const real_t &  z,
TinyVector< 3, real_t > &  __result 
) const [inline]

Definition at line 437 of file ConformTransformation.hpp.

References __d, __f, __g, and __h.

00439   {
00440     __result = __d;
00441     __result += x*__f;
00442     __result += y*__g;
00443     __result += (x*y)*__h;
00444   }

void ConformTransformationQ1Hexahedron::value ( const TinyVector< 3, real_t > &  X,
TinyVector< 3, real_t > &  __result 
) const [inline]

Definition at line 446 of file ConformTransformation.hpp.

Referenced by MeshOfHexahedra::buildLocalizationTools(), invertT(), and Convection< MeshOfHexahedra >::operator()().

00448   {
00449     value(X[0],X[1],X[2],__result);
00450   }

void ConformTransformationQ1Hexahedron::value ( const real_t &  x,
const real_t &  y,
const real_t &  z,
TinyVector< 3, real_t > &  __result 
) const [inline]

Definition at line 452 of file ConformTransformation.hpp.

References __a, __b, __c, __d, __e, __f, __g, and __h.

00454   {
00455     __result  = __a;
00456     __result += x*__b;
00457     __result += y*__c;
00458     __result += z*__d;
00459     __result += (x*y)*__e;
00460     __result += (x*z)*__f;
00461     __result += (y*z)*__g;
00462     __result += (x*y*z)*__h;
00463   }

bool ConformTransformationQ1Hexahedron::invertT ( const real_t &  x,
const real_t &  y,
const real_t &  z,
TinyVector< 3, real_t > &  Xhat 
) const

Computes Xhat, the point which transformed is (x,y,z).

Computes Xhat, the point which transformed is (x,y,z) returns false if no Xhat is found...

Computing F(Xhat) - (x,y,z).

Definition at line 68 of file ConformTransformation.cpp.

References dx(), dy(), dz(), TinyVector< N, T >::size(), and value().

Referenced by MeshOfHexahedra::find(), invertT(), and Convection< MeshOfHexahedra >::operator()().

00072 {
00073   // initialization
00074   for(size_t i=0; i<3; ++i)
00075     Xhat[i] = 0.5;
00076 
00077   TinyVector<3,real_t> X;
00078   TinyVector<3,real_t> f;
00079   TinyVector<3,real_t> delta;
00080   const size_t maxiter = 100;
00081   size_t niter = 0;
00082 
00083   do {
00084     niter++;
00085 
00087     value(Xhat,f);
00088     f[0] -= x;
00089     f[1] -= y;
00090     f[2] -= z;
00091 
00092     // Evaluation of the Jacobian 
00093     TinyMatrix<3,3,real_t> J;
00094     dx(Xhat,X);
00095     for (size_t i=0; i<3; ++i)
00096       J(i,0) = X[i];
00097 
00098     dy(Xhat,X);
00099     for (size_t i=0; i<3; ++i)
00100       J(i,1) = X[i];
00101 
00102     dz(Xhat,X);
00103     for (size_t i=0; i<3; ++i)
00104       J(i,2) = X[i];
00105 
00106     delta = f/J;
00107 
00108     // Uses relaxation to help convergence (the functional is not convexe)
00109     Xhat -= delta;
00110     
00111     if (niter>maxiter) { // or(Norm(f)>10)) {
00112       return false;
00113     }
00114 
00115   } while(Norm(f)>1E-3);
00116 
00117   for (size_t i = 0; i<Xhat.size(); ++i) {
00118     if ((Xhat[i]<1E-3) or (Xhat[i]>1.001)) {
00119       return false;
00120     }
00121   }
00122 
00123   return true;
00124 }

Here is the call graph for this function:

bool ConformTransformationQ1Hexahedron::invertT ( const TinyVector< 3, real_t > &  X,
TinyVector< 3, real_t > &  Xhat 
) const [inline]

Computes Xhat, the point which transformed is X.

Definition at line 472 of file ConformTransformation.hpp.

References invertT().

00474   {
00475     return invertT(X[0],X[1],X[2], Xhat);
00476   }

Here is the call graph for this function:

real_t ConformTransformationQ1Hexahedron::integrate ( const ScalarFunctionBase f  )  const

Computes the integrale of the function f on an element using the reference element

Definition at line 26 of file ConformTransformation.cpp.

References ErrorHandler::unexpected.

00027 {
00028   throw ErrorHandler(__FILE__,__LINE__,
00029                      "not implemented",
00030                      ErrorHandler::unexpected);
00031   return 0;
00032 }


Friends And Related Function Documentation

Definition at line 378 of file ConformTransformation.hpp.


Member Data Documentation

Definition at line 383 of file ConformTransformation.hpp.

Referenced by __inside().

Definition at line 385 of file ConformTransformation.hpp.

Referenced by value().

Definition at line 386 of file ConformTransformation.hpp.

Referenced by dx(), and value().

Definition at line 387 of file ConformTransformation.hpp.

Referenced by dy(), and value().

Definition at line 388 of file ConformTransformation.hpp.

Referenced by dz(), and value().

Definition at line 389 of file ConformTransformation.hpp.

Referenced by dx(), dy(), and value().

Definition at line 390 of file ConformTransformation.hpp.

Referenced by dx(), dz(), and value().

Definition at line 391 of file ConformTransformation.hpp.

Referenced by dy(), dz(), and value().

Definition at line 392 of file ConformTransformation.hpp.

Referenced by dx(), dy(), dz(), and value().

Definition at line 394 of file ConformTransformation.hpp.

Referenced by ConformTransformationQ1Hexahedron().


The documentation for this class was generated from the following files:

Generated on Wed Nov 19 00:05:05 2008 for FreeFEM3D (aka ff3d) by  doxygen 1.5.6