NormalManager Class Reference

#include <NormalManager.hpp>

Inheritance diagram for NormalManager:

Inheritance graph
[legend]
Collaboration diagram for NormalManager:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void subscribe (const SurfElem *s)
void update (const SurfElem *s)
void unsubscribe ()
real_t nx () const
real_t ny () const
real_t nz () const
 NormalManager ()
 ~NormalManager ()

Static Public Member Functions

static NormalManagerinstance ()
static void create ()
static void destroy ()

Static Protected Attributes

static NormalManager__pInstance

Private Member Functions

void __buildNormal () const

Private Attributes

const SurfElem__surfElem
size_t __counter
ReferenceCounting< TinyVector
< 3, real_t > > 
__normal


Detailed Description

Definition at line 41 of file NormalManager.hpp.


Constructor & Destructor Documentation

NormalManager::NormalManager (  )  [inline, explicit]

Default constructor

Definition at line 143 of file NormalManager.hpp.

00144     : __surfElem(0),
00145       __counter(0),
00146       __normal(0)
00147   {
00148     ;
00149   }

NormalManager::~NormalManager (  )  [inline]

Destructor

Definition at line 155 of file NormalManager.hpp.

References __counter, __normal, __surfElem, and ASSERT.

00156   {
00157     ASSERT(__counter  == 0);
00158     ASSERT(__surfElem == 0);
00159     ASSERT(__normal   == 0);
00160   }


Member Function Documentation

void NormalManager::__buildNormal (  )  const [inline, private]

Builds the normal vector if it is not built

Definition at line 56 of file NormalManager.hpp.

References __normal, __surfElem, SurfElem::normal(), and ErrorHandler::unexpected.

Referenced by nx(), ny(), and nz().

00057   {
00058     if (__surfElem == 0) {
00059       throw ErrorHandler(__FILE__,__LINE__,
00060                          "Cannot evaluate normal, no surface is defined",
00061                          ErrorHandler::unexpected);
00062     }
00063     if (__normal == 0) {
00064       __normal = new TinyVector<3, real_t>(__surfElem->normal());
00065     }
00066   }

Here is the call graph for this function:

void NormalManager::subscribe ( const SurfElem s  )  [inline]

Subscribes the element s for whom the normal may be computed.

Parameters:
s the element to subscribe

Definition at line 74 of file NormalManager.hpp.

References __counter, and __surfElem.

Referenced by SurfaceMeshOfTriangles::const_iterator::const_iterator(), SurfaceMeshOfQuadrangles::const_iterator::const_iterator(), SurfaceMeshOfTriangles::iterator::iterator(), and SurfaceMeshOfQuadrangles::iterator::iterator().

00075   {
00076     __counter++;
00077     __surfElem = s;
00078   }

void NormalManager::update ( const SurfElem s  )  [inline]

void NormalManager::unsubscribe (  )  [inline]

This is called to inform the NormalManager that the surface have been iterated, this avoid the use of wrong normal value

Definition at line 96 of file NormalManager.hpp.

References __counter, __normal, __surfElem, and ASSERT.

Referenced by SurfaceMeshOfTriangles::const_iterator::~const_iterator(), SurfaceMeshOfQuadrangles::const_iterator::~const_iterator(), SurfaceMeshOfTriangles::iterator::~iterator(), and SurfaceMeshOfQuadrangles::iterator::~iterator().

00097   {
00098     ASSERT(__counter != 0);
00099     __counter--;
00100     if (__counter == 0) {
00101       __surfElem = 0;
00102       __normal = 0;
00103     }
00104   }

real_t NormalManager::nx (  )  const [inline]

Access to the first component of the normal

Returns:
$ n_x $

Definition at line 111 of file NormalManager.hpp.

References __buildNormal(), and __normal.

Referenced by ScalarFunctionNormal::operator()().

00112   {
00113     __buildNormal();
00114     return (*__normal)[0];
00115   }

Here is the call graph for this function:

real_t NormalManager::ny (  )  const [inline]

Access to the second component of the normal

Returns:
$ n_y $

Definition at line 122 of file NormalManager.hpp.

References __buildNormal(), and __normal.

Referenced by ScalarFunctionNormal::operator()().

00123   {
00124     __buildNormal();
00125     return (*__normal)[1];
00126   }

Here is the call graph for this function:

real_t NormalManager::nz (  )  const [inline]

Access to the third component of the normal

Returns:
$ n_z $

Definition at line 133 of file NormalManager.hpp.

References __buildNormal(), and __normal.

Referenced by ScalarFunctionNormal::operator()().

00134   {
00135     __buildNormal();
00136     return (*__normal)[2];
00137   }

Here is the call graph for this function:

static NormalManager & StaticBase< NormalManager >::instance (  )  [inline, static, inherited]

static void StaticBase< NormalManager >::create (  )  [inline, static, inherited]

Creates __pInstance in Embedding class.

Definition at line 55 of file StaticBase.hpp.

Referenced by ThreadStaticCenter::ThreadStaticCenter().

00056   {
00057     __pInstance = new EmbeddingClass();
00058   }

static void StaticBase< NormalManager >::destroy (  )  [inline, static, inherited]

Destroyes __autoInstanciated in Embedding class.

Definition at line 64 of file StaticBase.hpp.

Referenced by ThreadStaticCenter::~ThreadStaticCenter().

00065   {
00066     delete __pInstance;
00067   }


Member Data Documentation

The current surface element

Definition at line 45 of file NormalManager.hpp.

Referenced by __buildNormal(), subscribe(), unsubscribe(), update(), and ~NormalManager().

size_t NormalManager::__counter [private]

counts the current number of subscriptions

Definition at line 47 of file NormalManager.hpp.

Referenced by subscribe(), unsubscribe(), and ~NormalManager().

ReferenceCounting<TinyVector<3, real_t> > NormalManager::__normal [mutable, private]

This vector contains the normal vector

Definition at line 50 of file NormalManager.hpp.

Referenced by __buildNormal(), nx(), ny(), nz(), unsubscribe(), update(), and ~NormalManager().

NormalManager * StaticBase< NormalManager >::__pInstance [static, protected, inherited]

The static variable

Definition at line 37 of file StaticBase.hpp.


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

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