#include <NormalManager.hpp>


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 NormalManager & | instance () |
| 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 |
Definition at line 41 of file NormalManager.hpp.
| 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 }
| 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 }

| void NormalManager::subscribe | ( | const SurfElem * | s | ) | [inline] |
Subscribes the element s for whom the normal may be computed.
| 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] |
Uses a new surface element
| s | the new surface element |
Definition at line 85 of file NormalManager.hpp.
References __normal, __surfElem, and ASSERT.
Referenced by SurfaceMeshOfTriangles::const_iterator::operator++(), SurfaceMeshOfTriangles::iterator::operator++(), SurfaceMeshOfQuadrangles::const_iterator::operator++(), SurfaceMeshOfQuadrangles::iterator::operator++(), SurfaceMeshOfTriangles::const_iterator::operator=(), SurfaceMeshOfTriangles::iterator::operator=(), SurfaceMeshOfQuadrangles::const_iterator::operator=(), and SurfaceMeshOfQuadrangles::iterator::operator=().
00086 { 00087 ASSERT(__surfElem != 0); 00088 __surfElem = s; 00089 __normal = 0; // normal is to recompute 00090 }
| 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
Definition at line 111 of file NormalManager.hpp.
References __buildNormal(), and __normal.
Referenced by ScalarFunctionNormal::operator()().
00112 { 00113 __buildNormal(); 00114 return (*__normal)[0]; 00115 }

| real_t NormalManager::ny | ( | ) | const [inline] |
Access to the second component of the normal
Definition at line 122 of file NormalManager.hpp.
References __buildNormal(), and __normal.
Referenced by ScalarFunctionNormal::operator()().
00123 { 00124 __buildNormal(); 00125 return (*__normal)[1]; 00126 }

| real_t NormalManager::nz | ( | ) | const [inline] |
Access to the third component of the normal
Definition at line 133 of file NormalManager.hpp.
References __buildNormal(), and __normal.
Referenced by ScalarFunctionNormal::operator()().
00134 { 00135 __buildNormal(); 00136 return (*__normal)[2]; 00137 }

| static NormalManager & StaticBase< NormalManager >::instance | ( | ) | [inline, static, inherited] |
Access to auto instanciated static;
Definition at line 46 of file StaticBase.hpp.
Referenced by SurfaceMeshOfTriangles::const_iterator::const_iterator(), SurfaceMeshOfQuadrangles::const_iterator::const_iterator(), SurfaceMeshOfTriangles::iterator::iterator(), SurfaceMeshOfQuadrangles::iterator::iterator(), ScalarFunctionNormal::operator()(), SurfaceMeshOfTriangles::const_iterator::operator++(), SurfaceMeshOfTriangles::iterator::operator++(), SurfaceMeshOfQuadrangles::const_iterator::operator++(), SurfaceMeshOfQuadrangles::iterator::operator++(), SurfaceMeshOfTriangles::const_iterator::operator=(), SurfaceMeshOfTriangles::iterator::operator=(), SurfaceMeshOfQuadrangles::const_iterator::operator=(), SurfaceMeshOfQuadrangles::iterator::operator=(), SurfaceMeshOfTriangles::const_iterator::~const_iterator(), SurfaceMeshOfQuadrangles::const_iterator::~const_iterator(), SurfaceMeshOfTriangles::iterator::~iterator(), and SurfaceMeshOfQuadrangles::iterator::~iterator().
00047 { 00048 return *__pInstance; 00049 }
| 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 }
const SurfElem* NormalManager::__surfElem [private] |
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.
1.5.6