ConnectedTriangle Class Reference

#include <connected_triangle.hpp>

Inheritance diagram for ConnectedTriangle:

Inheritance graph
[legend]
Collaboration diagram for ConnectedTriangle:

Collaboration graph
[legend]

List of all members.

Public Types

enum  { NumberOfVertices = 3, NumberOfFaces = 3, NumberOfEdges = 3 }
typedef Edge FaceType
enum  Type {
  hexahedron, cartesianHexahedron, hexahedronByEdge, tetrahedron,
  triangle3d, quadrangle3d
}

Public Member Functions

 ConnectedTriangle ()
 ConnectedTriangle (const PointIndex &s1, const PointIndex &s2, const PointIndex &s3)
 ConnectedTriangle (const PointIndex &s1, const PointIndex &s2, const PointIndex &s3, const TriangleIndex &v1, const TriangleIndex &v2, const TriangleIndex &v3)
 ConnectedTriangle (const ConnectedTriangle &t)
 ~ConnectedTriangle ()
Vertex ** base ()
const TriangleIndexneigh (const unsigned k) const
TriangleIndexneigh (const unsigned k)
void setVertices (const PointIndex &s1, const PointIndex &s2, const PointIndex &s3)
 Modification globale des sommets.
void setNeighs (const TriangleIndex &v1, const TriangleIndex &v2, const TriangleIndex &v3)
 Modification globale des voisins.
unsigned localizeVertex (const PointIndex &P)
 determine le numero associe au sommet P
unsigned localizeNeigh (const ConnectedTriangle *const N) const
 determine le numero associe au voisin N
void getBarycentricCoordinates (const TinyVector< 2, real_t > &X, TinyVector< 3, real_t > &lambda) const
size_t numberOfVertices () const
Cell::Type type () const
const TinyVector< 3, real_t > normal () const
Edge edge (size_t i) const
const Cellmother () const
size_t motherCellFaceNumber () const
void setMother (const Cell *cell, const size_t faceNumber)
bool find (const Vertex *P)
const real_t & volume () const
void replace (Vertex *v0, Vertex *v1)
const bool & isFictitious () const
void setFictitious (const bool &b) const
const size_t & reference () const
size_t & reference ()
Vertexoperator() (const size_t &i)
const Vertexoperator() (const size_t &i) const

Public Attributes

int tag

Static Public Attributes

static const size_t faces [NumberOfEdges][FaceType::NumberOfVertices] = {{1,2},{2,0},{0,1}}
static const size_t edges [NumberOfEdges][Edge::NumberOfVertices] = {{1,2},{2,0},{0,1}}

Protected Attributes

const Cell__motherCell
size_t __motherCellFaceNumber
size_t __reference
 Reference of the Cell.
real_t __volume
 Volume or surface of the cell.
Vertex ** __vertices
 Pointers on vertices of the cell.
bool __isFictitious
 indicates if the cell is to be taken into accounts for computations

Private Member Functions

void __initNeighs ()

Private Attributes

TriangleIndex __neighs [3]


Detailed Description

Definition at line 30 of file connected_triangle.hpp.


Member Typedef Documentation

typedef Edge Triangle::FaceType [inherited]

Definition at line 63 of file Triangle.hpp.


Member Enumeration Documentation

anonymous enum [inherited]

Enumerator:
NumberOfVertices  number of vertices
NumberOfFaces  number of faces
NumberOfEdges  number of edges

Definition at line 57 of file Triangle.hpp.

00057        {
00058     NumberOfVertices = 3,       
00059     NumberOfFaces    = 3,       
00060     NumberOfEdges    = 3        
00061   };

enum Cell::Type [inherited]

Enumerator:
hexahedron 
cartesianHexahedron 
hexahedronByEdge 
tetrahedron 
triangle3d 
quadrangle3d 

Definition at line 40 of file Cell.hpp.

00040             {
00041     hexahedron,
00042     cartesianHexahedron,
00043     hexahedronByEdge,
00044     tetrahedron,
00045     triangle3d,
00046     quadrangle3d
00047   };


Constructor & Destructor Documentation

ConnectedTriangle::ConnectedTriangle (  )  [inline]

Definition at line 42 of file connected_triangle.hpp.

References __initNeighs(), and tag.

00042 { __initNeighs(); tag=0; }

Here is the call graph for this function:

ConnectedTriangle::ConnectedTriangle ( const PointIndex s1,
const PointIndex s2,
const PointIndex s3 
) [inline]

Definition at line 44 of file connected_triangle.hpp.

References __initNeighs(), and tag.

00044                                                                                        : Triangle(*s1,*s2,*s3) { 
00045     __initNeighs(); 
00046     tag=0; 
00047   }

Here is the call graph for this function:

ConnectedTriangle::ConnectedTriangle ( const PointIndex s1,
const PointIndex s2,
const PointIndex s3,
const TriangleIndex v1,
const TriangleIndex v2,
const TriangleIndex v3 
) [inline]

Definition at line 49 of file connected_triangle.hpp.

References __neighs, and tag.

00050                                                                                                 : Triangle(*s1,*s2,*s3) {
00051     __neighs[0] = v1;
00052     __neighs[1] = v2;
00053     __neighs[2] = v3;
00054     tag = 0;
00055   }

ConnectedTriangle::ConnectedTriangle ( const ConnectedTriangle t  )  [inline]

Definition at line 57 of file connected_triangle.hpp.

References __neighs, and tag.

00057                                                  : Triangle(t) {
00058     __neighs[0] = t.__neighs[0];
00059     __neighs[1] = t.__neighs[1];
00060     __neighs[2] = t.__neighs[2];
00061     tag = t.tag;
00062   }

ConnectedTriangle::~ConnectedTriangle (  )  [inline]

Pas de désallocation car sinon perte du trgle pointé

Definition at line 65 of file connected_triangle.hpp.

00065 { }


Member Function Documentation

void ConnectedTriangle::__initNeighs (  )  [inline, private]

Definition at line 34 of file connected_triangle.hpp.

References __neighs, and NULL.

Referenced by ConnectedTriangle().

00034                              {
00035     __neighs[0] = NULL;
00036     __neighs[1] = NULL;
00037     __neighs[2] = NULL;
00038   }

Vertex** ConnectedTriangle::base (  )  [inline]

const TriangleIndex& ConnectedTriangle::neigh ( const unsigned  k  )  const [inline]

TriangleIndex& ConnectedTriangle::neigh ( const unsigned  k  )  [inline]

Definition at line 73 of file connected_triangle.hpp.

References __neighs, and ASSERT.

00073 { ASSERT(k < 3); return __neighs[k]; }

void ConnectedTriangle::setVertices ( const PointIndex s1,
const PointIndex s2,
const PointIndex s3 
) [inline]

Modification globale des sommets.

Definition at line 76 of file connected_triangle.hpp.

References Cell::__vertices, and ASSERT.

Referenced by Triangulation::__permutation().

00076                                                                                    {
00077     ASSERT(s1 != s2 & s2 != s3 & s3 !=s1); // A remettre pour un bon debug de insert_point.    
00078     __vertices[0]=s1; __vertices[1]=s2; __vertices[2]=s3; 
00079   }

void ConnectedTriangle::setNeighs ( const TriangleIndex v1,
const TriangleIndex v2,
const TriangleIndex v3 
) [inline]

Modification globale des voisins.

Definition at line 82 of file connected_triangle.hpp.

References __neighs.

Referenced by Triangulation::__permutation().

00082                                                                                           {
00083     __neighs[0]=v1; __neighs[1]=v2; __neighs[2]=v3;
00084   }

unsigned ConnectedTriangle::localizeVertex ( const PointIndex P  )  [inline]

determine le numero associe au sommet P

Definition at line 87 of file connected_triangle.hpp.

References ASSERT, and base().

00087                                                  {
00088     unsigned local = 0;
00089     while(base()[local] != P) {
00090       ++local;
00091       ASSERT(local < 3);
00092     }
00093     return local;
00094   }

Here is the call graph for this function:

unsigned ConnectedTriangle::localizeNeigh ( const ConnectedTriangle *const   N  )  const [inline]

determine le numero associe au voisin N

Definition at line 97 of file connected_triangle.hpp.

References __neighs, and ASSERT.

Referenced by Triangulation::__checkAll(), Triangulation::__checkLine(), Triangulation::__insertPoint(), Triangulation::__permutation(), and Triangulation::__scanNeigh().

00097                                                                   {
00098     unsigned local = 0;
00099     while(__neighs[local] != N) {
00100       ++local; 
00101       ASSERT(local < 3); 
00102     }
00103     return local;
00104   }

void Triangle::getBarycentricCoordinates ( const TinyVector< 2, real_t > &  X,
TinyVector< 3, real_t > &  lambda 
) const [inline, inherited]

computes barycentric coordinates in the current triangle related to a given X position.

Parameters:
X Cartesian coordinates
lambda barycentric coordinates
Todo:
This could be optimized
Warning:
this function can only be caught in the planar case

Definition at line 78 of file Triangle.hpp.

Referenced by MeshOfTriangles::find().

00080   {
00081     TinyVector<3, real_t> X2;
00082     X2[0] = X[0];
00083     X2[1] = X[1];
00084     X2[2] = 1;
00085 
00086     TinyMatrix<3, 3, real_t> M = 0;
00087     for (size_t i=0; i<3; ++i) {
00088       const Vertex& V = (*this)(i);
00089       for (size_t j=0; j<2; ++j) {
00090         M(j, i) = V[j];
00091       }
00092     }
00093 
00094     for (size_t i=0; i<3; ++i) {
00095       M(2,i) = 1;
00096     }
00097 
00098     lambda = X2/M;
00099   }

size_t Triangle::numberOfVertices (  )  const [inline, virtual, inherited]

The number of vertices of a triangle

Returns:
the number of vertices

Implements Cell.

Definition at line 106 of file Triangle.hpp.

References Triangle::NumberOfVertices.

00107   {
00108     return NumberOfVertices;
00109   }

Cell::Type Triangle::type (  )  const [inline, virtual, inherited]

Access to the type of this cell

Returns:
Cell::triangle3d

Implements Cell.

Definition at line 116 of file Triangle.hpp.

References Cell::triangle3d.

00117   {
00118     return Cell::triangle3d;
00119   }

const TinyVector<3,real_t> Triangle::normal (  )  const [inline, virtual, inherited]

Returns the normal to the face.

Returns:
normal

Implements SurfElem.

Definition at line 127 of file Triangle.hpp.

References Cell::__vertices.

00128   {
00129     const TinyVector<3>& v0 = *(__vertices[0]);
00130     const TinyVector<3>& v1 = *(__vertices[1]);
00131     const TinyVector<3>& v2 = *(__vertices[2]);
00132 
00133     const TinyVector<3> A(v1-v0);
00134     const TinyVector<3> B(v2-v0);
00135     TinyVector<3> N(A^B);
00136     const real_t n = Norm(N);
00137     N/=n;
00138     return N;
00139   }

Edge Triangle::edge ( size_t  i  )  const [inline, inherited]

Access to the ith edge of the triangle

Parameters:
i the number of the Edge
Returns:
the ith edge of the triangle

Definition at line 148 of file Triangle.hpp.

References Cell::__vertices, ASSERT, and Triangle::NumberOfVertices.

Referenced by MeshSimplifier::__proceed().

00149   {
00150     ASSERT(i<NumberOfVertices);
00151     return Edge(*__vertices[(i+1)%3], *__vertices[(i+2)%3]);
00152   }

const Cell& SurfElem::mother (  )  const [inline, inherited]

size_t SurfElem::motherCellFaceNumber (  )  const [inline, inherited]

Access to the mother cell face number

Definition at line 65 of file SurfElem.hpp.

References SurfElem::__motherCell, SurfElem::__motherCellFaceNumber, and ASSERT.

00066   {
00067     ASSERT(__motherCell!=0);
00068     return __motherCellFaceNumber;
00069   }

void SurfElem::setMother ( const Cell cell,
const size_t  faceNumber 
) [inline, inherited]

bool Cell::find ( const Vertex P  )  [inline, inherited]

Find the vertex P in the cell

Returns:
bool

Definition at line 69 of file Cell.hpp.

References Cell::__vertices, and Cell::numberOfVertices().

Referenced by Triangulation::__checkLine().

00069                                      {
00070     for(size_t i=0 ; i<numberOfVertices() ; ++i) {
00071       if(__vertices[i]==P) {
00072         return true;
00073       }
00074     }
00075     return false;
00076   }

Here is the call graph for this function:

const real_t& Cell::volume (  )  const [inline, inherited]

void Cell::replace ( Vertex v0,
Vertex v1 
) [inline, inherited]

Replaces a vertex by another

Parameters:
v0 the vertex to replace
v1 the new vertex

Definition at line 94 of file Cell.hpp.

References Cell::__vertices, Cell::numberOfVertices(), stringify(), and ErrorHandler::unexpected.

00095   {
00096     for (size_t i = 0; i<numberOfVertices(); ++i) {
00097       if (__vertices[i] == v0) {
00098         __vertices[i] = v1;
00099         return;
00100       }
00101     }
00102 
00103     const std::string errorMsg
00104       = "vertex "+stringify(v0)+" was not found while replacing "+stringify(v1);
00105 
00106     throw ErrorHandler(__FILE__,__LINE__,
00107                        errorMsg,
00108                        ErrorHandler::unexpected);
00109   }

Here is the call graph for this function:

const bool& Cell::isFictitious (  )  const [inline, inherited]

Read-only access to the fictitious state of the cell

Returns:
true if the cell is fictitious

Definition at line 116 of file Cell.hpp.

References Cell::__isFictitious.

Referenced by FEMDiscretization< Structured3DMesh, TypeOfDiscretization >::assembleSecondMember().

00117   {
00118     return __isFictitious;
00119   }

void Cell::setFictitious ( const bool &  b  )  const [inline, inherited]

Sets fictitious state of the cell

Note:
method is const since this does not change the cell. Fictitious state is a mutable member!

Definition at line 127 of file Cell.hpp.

References Cell::__isFictitious.

Referenced by FictitiousDomainMethod::Compute().

00128   {
00129     __isFictitious = b;
00130   }

const size_t& Cell::reference (  )  const [inline, inherited]

size_t& Cell::reference (  )  [inline, inherited]

Access to the reference of the Cell.

Returns:
a reference to the reference

Definition at line 161 of file Cell.hpp.

References Cell::__reference.

00162   {
00163     return __reference;
00164   }

Vertex& Cell::operator() ( const size_t &  i  )  [inline, inherited]

Access to the ith Vertex of the Cell.

Parameters:
i the local number of the vertex
Returns:
a reference to a the vertex

Definition at line 173 of file Cell.hpp.

References Cell::__vertices, ASSERT, and Cell::numberOfVertices().

00174   {
00175     ASSERT (i<numberOfVertices());
00176     return *__vertices[i];
00177   }

Here is the call graph for this function:

const Vertex& Cell::operator() ( const size_t &  i  )  const [inline, inherited]

Read-only access to the ith Vertex of the Cell.

Parameters:
i the local number of the vertex
Returns:
a const reference to a the vertex

Definition at line 186 of file Cell.hpp.

References Cell::__vertices, ASSERT, and Cell::numberOfVertices().

00187   {
00188     ASSERT (i<numberOfVertices());
00189     return *(__vertices[i]);
00190   }

Here is the call graph for this function:


Member Data Documentation

const size_t Triangle::faces = {{1,2},{2,0},{0,1}} [static, inherited]

Definition at line 65 of file Triangle.hpp.

const size_t Triangle::edges = {{1,2},{2,0},{0,1}} [static, inherited]

Definition at line 66 of file Triangle.hpp.

const Cell* SurfElem::__motherCell [protected, inherited]

The mother cell (ie: a 3d element which interacts with the triangle)

Definition at line 47 of file SurfElem.hpp.

Referenced by SurfElem::mother(), SurfElem::motherCellFaceNumber(), SurfElem::operator=(), and SurfElem::setMother().

size_t SurfElem::__motherCellFaceNumber [protected, inherited]

size_t Cell::__reference [protected, inherited]

Reference of the Cell.

Definition at line 51 of file Cell.hpp.

Referenced by Cell::operator=(), and Cell::reference().

real_t Cell::__volume [protected, inherited]

Vertex** Cell::__vertices [protected, inherited]

bool Cell::__isFictitious [mutable, protected, inherited]

indicates if the cell is to be taken into accounts for computations

Definition at line 60 of file Cell.hpp.

Referenced by Cell::isFictitious(), and Cell::setFictitious().


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

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