NL3D::CPSForceIntensity Class Reference

#include <ps_force.h>

Inheritance diagram for NL3D::CPSForceIntensity:

NL3D::CPSFluidFriction NL3D::CPSForceIntensityHelper NL3D::CPSTurbul NL3D::CPSBrownianForce NL3D::CPSCentralGravity NL3D::CPSCylindricVortex NL3D::CPSDirectionnalForce NL3D::CPSGravity NL3D::CPSSpring NL3D::CPSMagneticForce

Detailed Description

this is a class to set force instensity (acceleration for gravity, k coefficient for springs...)

Definition at line 160 of file ps_force.h.

Public Member Functions

 CPSForceIntensity ()
float getIntensity (void) const
 get the constant intensity that was set for the force

const CPSAttribMaker< float > * getIntensityScheme (void) const
CPSAttribMaker< float > * getIntensityScheme (void)
 get the attribute maker for a non constant intensity

void serialForceIntensity (NLMISC::IStream &f) throw (NLMISC::EStream)
virtual void setIntensity (float value)
 set a constant intensity for the force. this discard any previous call to setIntensityScheme

virtual void setIntensityScheme (CPSAttribMaker< float > *scheme)
 set a non-constant intensity

virtual void setupFunctor (uint32 indexInLocated)
virtual ~CPSForceIntensity ()

Protected Member Functions

void deleteForceIntensityElement (uint32 index)
virtual CPSLocatedgetForceIntensityOwner (void)=0
 deriver must return the located that own them here

void newForceIntensityElement (CPSLocated *emitterLocated, uint32 emitterIndex)
void resizeForceIntensity (uint32 size)

Protected Attributes

CPSAttribMaker< float > * _IntensityScheme
float _K


Constructor & Destructor Documentation

NL3D::CPSForceIntensity::CPSForceIntensity  )  [inline]
 

Definition at line 165 of file ps_force.h.

References _IntensityScheme.

00165                             : _IntensityScheme(NULL)
00166         {
00167         }

NL3D::CPSForceIntensity::~CPSForceIntensity  )  [virtual]
 

Definition at line 177 of file ps_force.cpp.

References _IntensityScheme.

00178 {
00179         delete _IntensityScheme;
00180 }


Member Function Documentation

void NL3D::CPSForceIntensity::deleteForceIntensityElement uint32  index  )  [inline, protected]
 

Definition at line 203 of file ps_force.h.

References _IntensityScheme, NL3D::CPSAttribMaker< float >::deleteElement(), NL3D::CPSAttribMaker< float >::hasMemory(), index, and uint32.

Referenced by NL3D::CPSTurbul::deleteElement(), NL3D::CPSBrownianForce::deleteElement(), NL3D::CPSFluidFriction::deleteElement(), and NL3D::CPSForceIntensityHelper::deleteElement().

00204         {
00205                 if (_IntensityScheme && _IntensityScheme->hasMemory()) _IntensityScheme->deleteElement(index);
00206         }

virtual CPSLocated* NL3D::CPSForceIntensity::getForceIntensityOwner void   )  [protected, pure virtual]
 

deriver must return the located that own them here

Implemented in NL3D::CPSForceIntensityHelper, NL3D::CPSFluidFriction, NL3D::CPSBrownianForce, NL3D::CPSTurbul, and NL3D::CPSCylindricVortex.

Referenced by resizeForceIntensity(), and setIntensityScheme().

float NL3D::CPSForceIntensity::getIntensity void   )  const [inline]
 

get the constant intensity that was set for the force

Definition at line 173 of file ps_force.h.

References _K.

00173 { return _K; }

const CPSAttribMaker<float>* NL3D::CPSForceIntensity::getIntensityScheme void   )  const [inline]
 

Definition at line 186 of file ps_force.h.

References _IntensityScheme.

00186 { return _IntensityScheme; }

CPSAttribMaker<float>* NL3D::CPSForceIntensity::getIntensityScheme void   )  [inline]
 

get the attribute maker for a non constant intensity

Definition at line 185 of file ps_force.h.

References _IntensityScheme.

00185 { return _IntensityScheme; }

void NL3D::CPSForceIntensity::newForceIntensityElement CPSLocated emitterLocated,
uint32  emitterIndex
[inline, protected]
 

Definition at line 199 of file ps_force.h.

References _IntensityScheme, NL3D::CPSAttribMaker< float >::hasMemory(), NL3D::CPSAttribMaker< float >::newElement(), and uint32.

Referenced by NL3D::CPSTurbul::newElement(), NL3D::CPSBrownianForce::newElement(), NL3D::CPSFluidFriction::newElement(), and NL3D::CPSForceIntensityHelper::newElement().

00200         {
00201                 if (_IntensityScheme && _IntensityScheme->hasMemory()) _IntensityScheme->newElement(emitterLocated, emitterIndex);
00202         }       

void NL3D::CPSForceIntensity::resizeForceIntensity uint32  size  )  [inline, protected]
 

Definition at line 207 of file ps_force.h.

References _IntensityScheme, getForceIntensityOwner(), NL3D::CPSAttribMaker< float >::hasMemory(), NL3D::CPSAttribMaker< float >::resize(), size, and uint32.

Referenced by NL3D::CPSTurbul::resize(), NL3D::CPSBrownianForce::resize(), NL3D::CPSFluidFriction::resize(), and NL3D::CPSForceIntensityHelper::resize().

00208         {
00209                 if (_IntensityScheme && _IntensityScheme->hasMemory()) _IntensityScheme->resize(size, getForceIntensityOwner()->getSize());
00210         }

void NL3D::CPSForceIntensity::serialForceIntensity NLMISC::IStream f  )  throw (NLMISC::EStream)
 

Definition at line 190 of file ps_force.cpp.

Referenced by NL3D::CPSTurbul::NLMISC_DECLARE_CLASS(), and NL3D::CPSFluidFriction::NLMISC_DECLARE_CLASS().

00191 {       
00192         f.serialVersion(1);
00193         if (!f.isReading())
00194         {
00195                 if (_IntensityScheme)
00196                 {
00197                         bool bFalse = false;
00198                         f.serial(bFalse);
00199                         f.serialPolyPtr(_IntensityScheme);
00200                 }
00201                 else
00202                 {
00203                         bool bTrue = true;
00204                         f.serial(bTrue);
00205                         f.serial(_K);
00206                 }
00207         }
00208         else
00209         {
00210                 bool constantIntensity;
00211                 f.serial(constantIntensity);
00212                 if (constantIntensity)
00213                 {
00214                         f.serial(_K);
00215                 }
00216                 else
00217                 {
00218                         f.serialPolyPtr(_IntensityScheme);
00219                 }
00220         }       
00221 }

void NL3D::CPSForceIntensity::setIntensity float  value  )  [virtual]
 

set a constant intensity for the force. this discard any previous call to setIntensityScheme

Reimplemented in NL3D::CPSGravity, and NL3D::CPSBrownianForce.

Definition at line 166 of file ps_force.cpp.

References _IntensityScheme, _K, and value.

Referenced by NL3D::CPSCentralGravity::CPSCentralGravity(), NL3D::CPSCylindricVortex::CPSCylindricVortex(), NL3D::CPSDirectionnalForce::CPSDirectionnalForce(), NL3D::CPSFluidFriction::CPSFluidFriction(), and NL3D::CPSSpring::CPSSpring().

00167 {
00168         if (_IntensityScheme)
00169         {
00170                 delete _IntensityScheme;
00171                 _IntensityScheme = NULL;
00172         }
00173         _K = value;
00174         
00175 }

void NL3D::CPSForceIntensity::setIntensityScheme CPSAttribMaker< float > *  scheme  )  [virtual]
 

set a non-constant intensity

Reimplemented in NL3D::CPSGravity, and NL3D::CPSBrownianForce.

Definition at line 182 of file ps_force.cpp.

References _IntensityScheme, getForceIntensityOwner(), nlassert, and NL3D::CPSAttribMaker< T >::resize().

00183 {
00184         nlassert(scheme);
00185         delete _IntensityScheme;
00186         _IntensityScheme = scheme;
00187         if (getForceIntensityOwner() && scheme->hasMemory()) scheme->resize(getForceIntensityOwner()->getMaxSize(), getForceIntensityOwner()->getSize());
00188 }

virtual void NL3D::CPSForceIntensity::setupFunctor uint32  indexInLocated  )  [inline, virtual]
 

Reimplemented in NL3D::CPSFluidFriction, and NL3D::CPSTurbul.

Definition at line 182 of file ps_force.h.

References uint32.

00182 { }


Field Documentation

CPSAttribMaker<float>* NL3D::CPSForceIntensity::_IntensityScheme [protected]
 

Definition at line 197 of file ps_force.h.

Referenced by CPSForceIntensity(), deleteForceIntensityElement(), getIntensityScheme(), newForceIntensityElement(), resizeForceIntensity(), setIntensity(), setIntensityScheme(), and ~CPSForceIntensity().

float NL3D::CPSForceIntensity::_K [protected]
 

Definition at line 196 of file ps_force.h.

Referenced by getIntensity(), and setIntensity().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 07:14:37 2004 for NeL by doxygen 1.3.6