AdvSimSupport_DS< T > Class Template Reference

#include <TAPsAdvSimSupport_DS.hpp>

List of all members.

Public Member Functions

void AddVertexConnectionModelAndModel (unsigned int modelA, HEVertex< T > *vertexA, enum Enum::AddOn::SimConstraints flagsA, unsigned int modelB, HEVertex< T > *vertexB, enum Enum::AddOn::SimConstraints flagsB, T forceRatio=0.5)
 Add a vertex connection between two models.
void AddVertexConnectionSutureAndModel (unsigned int sutureID, unsigned int vertexIDSuture, DS::SimulationFlags *simFlagsSuture, Vector3< T > *vertexSuture, enum Enum::AddOn::SimConstraints flagsSuture, unsigned int modelID, HEVertex< T > *vertexModel, enum Enum::AddOn::SimConstraints flagsModel, T forceRatio=0.5)
 Add a vertex connection between a suture and a model.
 AdvSimSupport_DS (unsigned int numOfModels, unsigned int numOfSutures)
 Constructors.
void ClearAllConstraints ()
 Enforce all constraints.
void EnforceAllConstraints ()
 Enforce all constraints.
std::vector
< AdvSimSupport_DS_InteractionModelAndModel
< T > > & 
GetInteractionModelAndModel (unsigned int modelA, unsigned int modelB)
 Get model-model interaction.
std::vector
< AdvSimSupport_DS_InteractionSutureAndModel
< T > > & 
GetInteractionSutureAndModel (unsigned int sutureNo, unsigned int modelNo)
 Get suture-model interaction.
unsigned int GetNumOfModels () const
 Get number of models.
unsigned int GetNumOfSutures () const
 Get number of sutures.
std::string StrInfo () const
 Return this object info as a string.
 ~AdvSimSupport_DS ()
 Destructor.

Protected Member Functions

void ClearConstrainModelAndModel (unsigned int modelID_1, unsigned int modelID_2)
 Clear constraints for a model-model interaction.
void ClearConstrainSutureAndModel (unsigned int sutureID, unsigned int modelID)
 Clear constraints for a suture-model interaction.
void ConstrainModelAndModel (unsigned int modelID_1, unsigned int modelID_2)
 Apply constraints for a model-model interaction.
void ConstrainSutureAndModel (unsigned int sutureID, unsigned int modelID)
 Apply constraints for a suture-model interaction.

Protected Attributes

std::vector
< AdvSimSupport_DS_InteractionModelAndModel
< T > > * 
m_InteractionModelAndModel
std::vector
< AdvSimSupport_DS_InteractionSutureAndModel
< T > > * 
m_InteractionSutureAndModel
 model-model interaction data
unsigned int m_uiNumOfModels
 suture-model interaction data
unsigned int m_uiNumOfSutures
 number of sutures

Friends

std::ostream & operator<< (std::ostream &output, AdvSimSupport_DS< T > const &obj)
 Output Operator <<.


Detailed Description

template<typename T>
class AdvSimSupport_DS< T >

Definition at line 178 of file TAPsAdvSimSupport_DS.hpp.


Constructor & Destructor Documentation

template<typename T>
AdvSimSupport_DS< T >::AdvSimSupport_DS ( unsigned int  numOfModels,
unsigned int  numOfSutures 
) [inline]

Constructors.

Constructor.

Destructor

Definition at line 160 of file TAPsAdvSimSupport_DS.cpp.

00162   : m_uiNumOfModels( numOfModels ), m_uiNumOfSutures( numOfSuture )
00163 {
00164     // Model-Model Interaction
00165     unsigned int size = m_uiNumOfModels*m_uiNumOfModels;
00166     m_InteractionModelAndModel = new std::vector< AdvSimSupport_DS_InteractionModelAndModel<T> >[size];
00167     // Suture-Model Interaction
00168     size = m_uiNumOfSutures*m_uiNumOfModels;
00169     m_InteractionSutureAndModel = new std::vector< AdvSimSupport_DS_InteractionSutureAndModel<T> >[size];
00170 }

template<typename T>
AdvSimSupport_DS< T >::~AdvSimSupport_DS (  )  [inline]

Destructor.

Definition at line 174 of file TAPsAdvSimSupport_DS.cpp.

00175 {
00176     ClearAllConstraints();
00177     delete [] m_InteractionModelAndModel;
00178     delete [] m_InteractionSutureAndModel;
00179 }


Member Function Documentation

template<typename T>
void AdvSimSupport_DS< T >::AddVertexConnectionModelAndModel ( unsigned int  modelA,
HEVertex< T > *  vertexA,
enum Enum::AddOn::SimConstraints  flagsA,
unsigned int  modelB,
HEVertex< T > *  vertexB,
enum Enum::AddOn::SimConstraints  flagsB,
forceRatio = 0.5 
) [inline]

Add a vertex connection between two models.

Parameters:
modelA  ID of model one
vertexA  vertex of model one
flagsA  setting of simulation flags of vertex of model one
modelB  ID of model two
vertexB  vertex of model two
flagsB  setting of simulation flags of vertex of model two
forceRatio  force ratio

Definition at line 211 of file TAPsAdvSimSupport_DS.cpp.

00220 {
00221     vertexA->SimFlags.SetSimulationConstraints( flagsA );
00222     vertexB->SimFlags.SetSimulationConstraints( flagsB );
00223     GetInteractionModelAndModel( modelA, modelB ).push_back( AdvSimSupport_DS_InteractionModelAndModel<T>( vertexA, vertexB, forceRatio ) );
00224 }

template<typename T>
void AdvSimSupport_DS< T >::AddVertexConnectionSutureAndModel ( unsigned int  sutureID,
unsigned int  vertexIDSuture,
DS::SimulationFlags *  simFlagsSuture,
Vector3< T > *  vertexSuture,
enum Enum::AddOn::SimConstraints  flagsSuture,
unsigned int  modelID,
HEVertex< T > *  vertexModel,
enum Enum::AddOn::SimConstraints  flagsModel,
forceRatio = 0.5 
) [inline]

Add a vertex connection between a suture and a model.

Parameters:
sutureID  ID of suture
vertexIDSuture  vertex ID of suture
simFlagsSuture  simulation flags of suture
vertexSuture  vertex of suture
flagsSuture  setting of simulation flags of vertex of suture
modelID  ID of model
vertexModel  vertex of model
flagsModel  setting of simulation flags of vertex of model
forceRatio  force ratio

Definition at line 228 of file TAPsAdvSimSupport_DS.cpp.

00239 {
00240     simFlagsSuture->SetSimulationConstraints( flagsSuture );
00241     vertexModel->SimFlags.SetSimulationConstraints( flagsModel );
00242     GetInteractionSutureAndModel( sutureID, modelID ).push_back( AdvSimSupport_DS_InteractionSutureAndModel<T>( vertexIDSuture, simFlagsSuture, vertexSuture, vertexModel, forceRatio ) );
00243 }

template<typename T>
void AdvSimSupport_DS< T >::ClearAllConstraints (  )  [inline]

Enforce all constraints.

Clear all constraints.

Definition at line 294 of file TAPsAdvSimSupport_DS.cpp.

00295 {
00296     // Clear model-model interactions
00297     for ( unsigned int i = 0; i < m_uiNumOfModels; ++i ) {
00298         for ( unsigned int j = 0; j < m_uiNumOfModels; ++j ) {
00299             ClearConstrainModelAndModel( i, j );
00300         }
00301     }
00302     for ( unsigned int i = 0; i < static_cast<unsigned int>( m_uiNumOfModels*m_uiNumOfModels ); ++i ) {
00303         m_InteractionModelAndModel[i].clear();
00304     }
00305     // Clear suture-model interactions
00306     for ( unsigned int i = 0; i < m_uiNumOfSutures; ++i ) {
00307         for ( unsigned int j = 0; j < m_uiNumOfModels; ++j ) {
00308             ClearConstrainSutureAndModel( i, j );
00309         }
00310     }
00311     for ( unsigned int i = 0; i < static_cast<unsigned int>( m_uiNumOfSutures*m_uiNumOfModels ); ++i ) {
00312         m_InteractionSutureAndModel[i].clear();
00313     }
00314 }

template<typename T>
void AdvSimSupport_DS< T >::ClearConstrainModelAndModel ( unsigned int  modelID_1,
unsigned int  modelID_2 
) [inline, protected]

Clear constraints for a model-model interaction.

Parameters:
modelID_1  model ID 1
modelID_2  model ID 2

Definition at line 318 of file TAPsAdvSimSupport_DS.cpp.

00322 {
00323     int idx = modelID_1*m_uiNumOfModels + modelID_2;
00324     for ( int n = 0; n < static_cast<int>( m_InteractionModelAndModel[idx].size() ); ++n ) {
00325         m_InteractionModelAndModel[idx][n].ClearConstraint();
00326     }
00327 }

template<typename T>
void AdvSimSupport_DS< T >::ClearConstrainSutureAndModel ( unsigned int  sutureID,
unsigned int  modelID 
) [inline, protected]

Clear constraints for a suture-model interaction.

Parameters:
sutureID  suture ID
modelID  model ID

Definition at line 331 of file TAPsAdvSimSupport_DS.cpp.

00335 {
00336     int idx = sutureID*m_uiNumOfSutures + modelID;
00337     for ( int n = 0; n < static_cast<int>( m_InteractionSutureAndModel[idx].size() ); ++n ) {
00338         m_InteractionSutureAndModel[idx][n].ClearConstraint();
00339     }
00340 }

template<typename T>
void AdvSimSupport_DS< T >::ConstrainModelAndModel ( unsigned int  modelID_1,
unsigned int  modelID_2 
) [inline, protected]

Apply constraints for a model-model interaction.

Parameters:
modelID_1  model ID 1
modelID_2  model ID 2

Definition at line 268 of file TAPsAdvSimSupport_DS.cpp.

00272 {
00273     int idx = modelID_1*m_uiNumOfModels + modelID_2;
00274     for ( int n = 0; n < static_cast<int>( m_InteractionModelAndModel[idx].size() ); ++n ) {
00275         m_InteractionModelAndModel[idx][n].EnforceConstraint();
00276     }
00277 }

template<typename T>
void AdvSimSupport_DS< T >::ConstrainSutureAndModel ( unsigned int  sutureID,
unsigned int  modelID 
) [inline, protected]

Apply constraints for a suture-model interaction.

Parameters:
sutureID  suture ID
modelID  model ID

Definition at line 281 of file TAPsAdvSimSupport_DS.cpp.

00285 {
00286     int idx = sutureID*m_uiNumOfSutures + modelID;
00287     for ( int n = 0; n < static_cast<int>( m_InteractionSutureAndModel[idx].size() ); ++n ) {
00288         m_InteractionSutureAndModel[idx][n].EnforceConstraint();
00289     }
00290 }

template<typename T>
void AdvSimSupport_DS< T >::EnforceAllConstraints (  )  [inline]

Enforce all constraints.

Definition at line 247 of file TAPsAdvSimSupport_DS.cpp.

00248 {
00249     // Iteratation for Model-Model Interaction
00250     //std::cout << __FILE__ << " " << __LINE__ << " -- ";
00251     //std::cout << "ApplyConstraints for Model-Model Interaction is not IMPLEMENTED YET!!!\n";
00252     for ( unsigned int i = 0; i < m_uiNumOfModels; ++i ) {
00253         for ( unsigned int j = 0; j < m_uiNumOfModels; ++j ) {
00254             ConstrainModelAndModel( i, j );
00255         }
00256     }
00257 
00258     // Iteratation for Suture-Model Interaction
00259     for ( unsigned int i = 0; i < m_uiNumOfSutures; ++i ) {
00260         for ( unsigned int j = 0; j < m_uiNumOfModels; ++j ) {
00261             ConstrainSutureAndModel( i, j );
00262         }
00263     }
00264 }

template<typename T>
std::vector< AdvSimSupport_DS_InteractionModelAndModel<T> >& AdvSimSupport_DS< T >::GetInteractionModelAndModel ( unsigned int  modelA,
unsigned int  modelB 
) [inline]

Get model-model interaction.

Definition at line 239 of file TAPsAdvSimSupport_DS.hpp.

00241     { return m_InteractionModelAndModel[modelA*m_uiNumOfModels + modelB]; }

template<typename T>
std::vector< AdvSimSupport_DS_InteractionSutureAndModel<T> >& AdvSimSupport_DS< T >::GetInteractionSutureAndModel ( unsigned int  sutureNo,
unsigned int  modelNo 
) [inline]

Get suture-model interaction.

Definition at line 244 of file TAPsAdvSimSupport_DS.hpp.

00246     { return m_InteractionSutureAndModel[sutureNo*m_uiNumOfSutures + modelNo]; }

template<typename T>
unsigned int AdvSimSupport_DS< T >::GetNumOfModels (  )  const [inline]

Get number of models.

Definition at line 233 of file TAPsAdvSimSupport_DS.hpp.

00233 { return m_uiNumOfModels; }

template<typename T>
unsigned int AdvSimSupport_DS< T >::GetNumOfSutures (  )  const [inline]

Get number of sutures.

Definition at line 236 of file TAPsAdvSimSupport_DS.hpp.

00236 { return m_uiNumOfSutures; }

template<typename T>
std::string AdvSimSupport_DS< T >::StrInfo (  )  const [inline]

Return this object info as a string.

Definition at line 183 of file TAPsAdvSimSupport_DS.cpp.

00184 {
00185     std::stringstream ss;
00186     ss << "Model-Model Interaction size is " << m_uiNumOfModels << "-by-" << m_uiNumOfModels << "\n";
00187     for ( unsigned int i = 0; i < m_uiNumOfModels; ++i ) {
00188         unsigned int idx = i * m_uiNumOfModels;
00189         for ( unsigned int j = 0; j < m_uiNumOfModels; ++j ) {
00190             std::cout << "["<<i<<","<<j<<"]:\n";
00191             for ( int n = 0; n < static_cast<int>( m_InteractionModelAndModel[idx+j].size() ); ++n ) {
00192                 std::cout << m_InteractionModelAndModel[idx+j][n];
00193             }
00194         }
00195     }
00196     ss << "Suture-Model Interaction size is " << m_uiNumOfSutures << "-by-" << m_uiNumOfModels << "\n";
00197     for ( unsigned int i = 0; i < m_uiNumOfSutures; ++i ) {
00198         unsigned int idx = i * m_uiNumOfSutures;
00199         for ( unsigned int j = 0; j < m_uiNumOfModels; ++j ) {
00200             std::cout << "["<<i<<","<<j<<"]:\n";
00201             for ( int n = 0; n < static_cast<int>( m_InteractionSutureAndModel[idx+j].size() ); ++n ) {
00202                 std::cout << m_InteractionSutureAndModel[idx+j][n];
00203             }
00204         }
00205     }
00206     return ss.str();
00207 }


Friends And Related Function Documentation

template<typename T>
std::ostream& operator<< ( std::ostream &  output,
AdvSimSupport_DS< T > const &  obj 
) [friend]

Output Operator <<.

Definition at line 183 of file TAPsAdvSimSupport_DS.hpp.

00184     {
00185         output << obj.StrInfo();
00186         return output;
00187     }


Member Data Documentation

template<typename T>
std::vector< AdvSimSupport_DS_InteractionModelAndModel<T> >* AdvSimSupport_DS< T >::m_InteractionModelAndModel [protected]

Definition at line 274 of file TAPsAdvSimSupport_DS.hpp.

template<typename T>
std::vector< AdvSimSupport_DS_InteractionSutureAndModel<T> >* AdvSimSupport_DS< T >::m_InteractionSutureAndModel [protected]

model-model interaction data

Definition at line 275 of file TAPsAdvSimSupport_DS.hpp.

template<typename T>
unsigned int AdvSimSupport_DS< T >::m_uiNumOfModels [protected]

suture-model interaction data

number of models

Definition at line 276 of file TAPsAdvSimSupport_DS.hpp.

template<typename T>
unsigned int AdvSimSupport_DS< T >::m_uiNumOfSutures [protected]

number of sutures

Definition at line 277 of file TAPsAdvSimSupport_DS.hpp.


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

Generated on Mon Oct 13 11:43:58 2008 for TAPs by  doxygen 1.5.6