sofa::helper Namespace Reference
[sofa-framework package]

Utility helper classes that we need, but that are not the core of the plateform. More...


Namespaces

namespace  gl
 GL drawing helper classes, no actual visual models.
namespace  io
 Image and Mesh I/O.
namespace  polygon_cube_intersection
namespace  system
 OS-specific classes.

Data Structures

class  ArgumentBase
 Abstract base class for all command line arguments. More...
class  Argument
 Command line argument. More...
class  ArgumentParser
 Command line parser. More...
class  BackTrace
class  BaseCreator
class  Factory
class  Creator
class  CreatorFn
class  fixed_array
class  TypeInfo
class  BasicDispatcher
class  FnDispatcher
class  SingletonFnDispatcher
struct  listElem
struct  listSortAscending
class  LCP
class  LocalBlock33
class  LCPSolver
class  MarchingCubeUtility
class  Quater
struct  STATIC_ASSERTION_FAILURE
struct  STATIC_ASSERTION_FAILURE< true >
struct  static_assert_test
class  vector
 Same as std::vector, + range checking on operator[ ]. More...

Typedefs

typedef std::istringstream istrstream
typedef double FemClipsReal

Functions

ArgumentParser parse (const std::string &helpstr="", char hs='h', const std::string &hl="help")
 Parse a command line.
ArgumentParser parse (std::vector< std::string > *files, const std::string &helpstr="", char hs='h', const std::string &hl="help")
std::string gettypename (const std::type_info &t)
 Decode the type's name to a more readable form if possible.
static std::string & getFactoryLog ()
void logFactoryRegister (std::string baseclass, std::string classname, std::string key, bool multi)
 Log classes registered in the factory.
void printFactoryLog (std::ostream &out)
 Print factory log.
template<class T >
fixed_array< T, 2 > make_array (const T &v0, const T &v1)
template<class T >
fixed_array< T, 3 > make_array (const T &v0, const T &v1, const T &v2)
template<class T >
fixed_array< T, 4 > make_array (const T &v0, const T &v1, const T &v2, const T &v3)
template<class T >
fixed_array< T, 5 > make_array (const T &v0, const T &v1, const T &v2, const T &v3, const T &v4)
template<class T >
fixed_array< T, 6 > make_array (const T &v0, const T &v1, const T &v2, const T &v3, const T &v4, const T &v5)
template<class T >
fixed_array< T, 7 > make_array (const T &v0, const T &v1, const T &v2, const T &v3, const T &v4, const T &v5, const T &v6)
template<class T >
fixed_array< T, 8 > make_array (const T &v0, const T &v1, const T &v2, const T &v3, const T &v4, const T &v5, const T &v6, const T &v7)
template<class T >
fixed_array< T, 9 > make_array (const T &v0, const T &v1, const T &v2, const T &v3, const T &v4, const T &v5, const T &v6, const T &v7, const T &v8)
template<class T >
fixed_array< T, 10 > make_array (const T &v0, const T &v1, const T &v2, const T &v3, const T &v4, const T &v5, const T &v6, const T &v7, const T &v8, const T &v9)
int resoudreLCP (int dim, double *q, double **M, double *res)
void afficheSyst (double *q, double **M, int *base, double **mat, int dim)
int lcp_lexicolemke (int dim, double *q, double **M, double *res)
int lcp_lexicolemke (int dim, double *q, double **M, double **A, double *res)
void afficheLCP (double *q, double **M, int dim)
void afficheLCP (double *q, double **M, double *f, int dim)
int nlcp_gaussseidel (int dim, double *dfree, double **W, double *f, double mu, double tol, int numItMax, bool useInitialF)
int nlcp_gaussseidelTimed (int dim, double *dfree, double **W, double *f, double mu, double tol, int numItMax, bool useInitialF, double timeout)
void gaussSeidelLCP1 (int dim, FemClipsReal *q, FemClipsReal **M, FemClipsReal *res, double tol, int numItMax)
void set3Dof (double *vector, int index, double &vx, double &vy, double &vz)
void add3Dof (double *vector, int index, double &vx, double &vy, double &vz)
double normError (double &f1x, double &f1y, double &f1z, double &f2x, double &f2y, double &f2z)
double absError (double &f1x, double &f1y, double &f1z, double &f2x, double &f2y, double &f2z)
template<class Real >
void adjoint_transpose (const defaulttype::Mat< 3, 3, Real > &M, defaulttype::Mat< 3, 3, Real > &MadjT)
 Set MadjT to transpose of inverse of M times determinant of M.
template<class Real >
Real norm_inf (const defaulttype::Mat< 3, 3, Real > &M)
 Compute the infinity norm of M.
template<class Real >
Real norm_one (const defaulttype::Mat< 3, 3, Real > &M)
 Compute the 1 norm of M.
template<class Real >
int find_max_col (const defaulttype::Mat< 3, 3, Real > &M)
 Return index of column of M containing maximum abs entry, or -1 if M=0.
template<class Real >
void make_reflector (const defaulttype::Vec< 3, Real > &v, defaulttype::Vec< 3, Real > &u)
 Setup u for Household reflection to zero all v components but first.
template<class Real >
void reflect_cols (defaulttype::Mat< 3, 3, Real > &M, const defaulttype::Vec< 3, Real > &u)
 Apply Householder reflection represented by u to column vectors of M.
template<class Real >
void reflect_rows (defaulttype::Mat< 3, 3, Real > &M, const defaulttype::Vec< 3, Real > &u)
 Apply Householder reflection represented by u to row vectors of M.
template<class Real >
void do_rank1 (defaulttype::Mat< 3, 3, Real > &M, defaulttype::Mat< 3, 3, Real > &Q)
 Find orthogonal factor Q of rank 1 (or less) M.
template<class Real >
void do_rank2 (defaulttype::Mat< 3, 3, Real > &M, defaulttype::Mat< 3, 3, Real > &MadjT, defaulttype::Mat< 3, 3, Real > &Q)
 Find orthogonal factor Q of rank 2 (or less) M using adjoint transpose.
template<class Real >
Real polar_decomp (const defaulttype::Mat< 3, 3, Real > &M, defaulttype::Mat< 3, 3, Real > &Q, defaulttype::Mat< 3, 3, Real > &S)
template<class real >
int rfloor (real r)
template<class real >
int rnear (real r)
int rceil (double r)
template<class real >
real rabs (real r)
template<class real >
real rmin (real r, real s)
template<class real >
real rmax (real r, real s)
template<class T >
T rlerp (const T &a, const T &b, float f)
template<class T >
T rsqrt (const T &a)
double rsqrt (const double &a)
long double rsqrt (const long double &a)
template<class T >
const T SQR (const T &a)
template<class T >
const T SIGN (const T &a, const T &b)
template<class T >
void SWAP (T &a, T &b)
void shft3 (double &a, double &b, double &c, const double d)
void create (VoxelGrid *&obj, simulation::tree::xml::ObjectDescription *arg)
vector class-related methods
template<class T1 , class T2 >
void remove (T1 &v, const T2 &elem)
 Remove the first occurence of a given value.
template<class T1 , class T2 >
void removeValue (T1 &v, const T2 &elem)
 Remove the first occurence of a given value.
template<class T , class TT >
void removeIndex (std::vector< T, TT > &v, size_t index)
 Remove value at given index, replace it by the value at the last index, other values are not changed.

Variables

const int MarchingCubeEdgeTable [256]
const int MarchingCubeTriTable [256][16]
Creator
< simulation::tree::xml::ObjectFactory,
VoxelGrid > 
VoxelGridClass ("VoxelGridDetection")


Detailed Description

Utility helper classes that we need, but that are not the core of the plateform.


Typedef Documentation

Definition at line 103 of file LCPcalc.h.

typedef std::istringstream sofa::helper::istrstream

Definition at line 39 of file ArgumentParser.cpp.


Function Documentation

double sofa::helper::absError ( double &  f1x,
double &  f1y,
double &  f1z,
double &  f2x,
double &  f2y,
double &  f2z 
) [inline]

Definition at line 89 of file LCPcalc.h.

Referenced by nlcp_gaussseidel(), and nlcp_gaussseidelTimed().

void sofa::helper::add3Dof ( double *  vector,
int  index,
double &  vx,
double &  vy,
double &  vz 
) [inline]

Definition at line 83 of file LCPcalc.h.

template<class Real >
void sofa::helper::adjoint_transpose ( const defaulttype::Mat< 3, 3, Real > &  M,
defaulttype::Mat< 3, 3, Real > &  MadjT 
) [inline]

Set MadjT to transpose of inverse of M times determinant of M.

Definition at line 45 of file PolarDecompose.h.

References cross().

Referenced by polar_decomp().

void sofa::helper::afficheLCP ( double *  q,
double **  M,
double *  f,
int  dim 
)

Definition at line 884 of file LCPcalc.cpp.

void sofa::helper::afficheLCP ( double *  q,
double **  M,
int  dim 
)

void sofa::helper::afficheSyst ( double *  q,
double **  M,
int *  base,
double **  mat,
int  dim 
)

Definition at line 284 of file LCPcalc.cpp.

void sofa::helper::create ( VoxelGrid *&  obj,
simulation::tree::xml::ObjectDescription *  arg 
)

template<class Real >
void sofa::helper::do_rank1 ( defaulttype::Mat< 3, 3, Real > &  M,
defaulttype::Mat< 3, 3, Real > &  Q 
) [inline]

Find orthogonal factor Q of rank 1 (or less) M.

Definition at line 128 of file PolarDecompose.h.

References find_max_col(), sofa::defaulttype::Mat< L, C, real >::identity(), make_reflector(), reflect_cols(), and reflect_rows().

Referenced by do_rank2().

template<class Real >
void sofa::helper::do_rank2 ( defaulttype::Mat< 3, 3, Real > &  M,
defaulttype::Mat< 3, 3, Real > &  MadjT,
defaulttype::Mat< 3, 3, Real > &  Q 
) [inline]

Find orthogonal factor Q of rank 2 (or less) M using adjoint transpose.

Definition at line 148 of file PolarDecompose.h.

References cross(), do_rank1(), find_max_col(), make_reflector(), reflect_cols(), and reflect_rows().

Referenced by polar_decomp().

template<class Real >
int sofa::helper::find_max_col ( const defaulttype::Mat< 3, 3, Real > &  M  )  [inline]

Return index of column of M containing maximum abs entry, or -1 if M=0.

Definition at line 80 of file PolarDecompose.h.

Referenced by do_rank1(), and do_rank2().

void sofa::helper::gaussSeidelLCP1 ( int  dim,
FemClipsReal *  q,
FemClipsReal **  M,
FemClipsReal *  res,
double  tol,
int  numItMax 
)

Definition at line 1282 of file LCPcalc.cpp.

References error.

Referenced by sofa::component::odesolver::MasterContactSolver::step().

static std::string& sofa::helper::getFactoryLog (  )  [static]

Definition at line 75 of file Factory.cpp.

Referenced by logFactoryRegister(), and printFactoryLog().

std::string sofa::helper::gettypename ( const std::type_info &  t  ) 

int sofa::helper::lcp_lexicolemke ( int  dim,
double *  q,
double **  M,
double **  A,
double *  res 
)

Definition at line 632 of file LCPcalc.cpp.

int sofa::helper::lcp_lexicolemke ( int  dim,
double *  q,
double **  M,
double *  res 
)

Definition at line 393 of file LCPcalc.cpp.

References afficheLCP().

void sofa::helper::logFactoryRegister ( std::string  baseclass,
std::string  classname,
std::string  key,
bool  multi 
)

Log classes registered in the factory.

Definition at line 82 of file Factory.cpp.

References getFactoryLog().

Referenced by sofa::helper::Factory< TKey, TObject, TArgument >::registerCreator().

template<class T >
fixed_array<T, 10> sofa::helper::make_array ( const T &  v0,
const T &  v1,
const T &  v2,
const T &  v3,
const T &  v4,
const T &  v5,
const T &  v6,
const T &  v7,
const T &  v8,
const T &  v9 
) [inline]

Definition at line 450 of file fixed_array.h.

template<class T >
fixed_array<T, 9> sofa::helper::make_array ( const T &  v0,
const T &  v1,
const T &  v2,
const T &  v3,
const T &  v4,
const T &  v5,
const T &  v6,
const T &  v7,
const T &  v8 
) [inline]

Definition at line 434 of file fixed_array.h.

template<class T >
fixed_array<T, 8> sofa::helper::make_array ( const T &  v0,
const T &  v1,
const T &  v2,
const T &  v3,
const T &  v4,
const T &  v5,
const T &  v6,
const T &  v7 
) [inline]

Definition at line 419 of file fixed_array.h.

template<class T >
fixed_array<T, 7> sofa::helper::make_array ( const T &  v0,
const T &  v1,
const T &  v2,
const T &  v3,
const T &  v4,
const T &  v5,
const T &  v6 
) [inline]

Definition at line 405 of file fixed_array.h.

template<class T >
fixed_array<T, 6> sofa::helper::make_array ( const T &  v0,
const T &  v1,
const T &  v2,
const T &  v3,
const T &  v4,
const T &  v5 
) [inline]

Definition at line 392 of file fixed_array.h.

template<class T >
fixed_array<T, 5> sofa::helper::make_array ( const T &  v0,
const T &  v1,
const T &  v2,
const T &  v3,
const T &  v4 
) [inline]

Definition at line 380 of file fixed_array.h.

template<class T >
fixed_array<T, 4> sofa::helper::make_array ( const T &  v0,
const T &  v1,
const T &  v2,
const T &  v3 
) [inline]

Definition at line 369 of file fixed_array.h.

template<class T >
fixed_array<T, 3> sofa::helper::make_array ( const T &  v0,
const T &  v1,
const T &  v2 
) [inline]

Definition at line 359 of file fixed_array.h.

template<class T >
fixed_array<T, 2> sofa::helper::make_array ( const T &  v0,
const T &  v1 
) [inline]

template<class Real >
void sofa::helper::make_reflector ( const defaulttype::Vec< 3, Real > &  v,
defaulttype::Vec< 3, Real > &  u 
) [inline]

Setup u for Household reflection to zero all v components but first.

Definition at line 94 of file PolarDecompose.h.

References dot().

Referenced by do_rank1(), and do_rank2().

int sofa::helper::nlcp_gaussseidel ( int  dim,
double *  dfree,
double **  W,
double *  f,
double  mu,
double  tol,
int  numItMax,
bool  useInitialF 
)

int sofa::helper::nlcp_gaussseidelTimed ( int  dim,
double *  dfree,
double **  W,
double *  f,
double  mu,
double  tol,
int  numItMax,
bool  useInitialF,
double  timeout 
)

template<class Real >
Real sofa::helper::norm_inf ( const defaulttype::Mat< 3, 3, Real > &  M  )  [inline]

Compute the infinity norm of M.

Definition at line 54 of file PolarDecompose.h.

Referenced by polar_decomp().

template<class Real >
Real sofa::helper::norm_one ( const defaulttype::Mat< 3, 3, Real > &  M  )  [inline]

Compute the 1 norm of M.

Definition at line 67 of file PolarDecompose.h.

Referenced by polar_decomp().

double sofa::helper::normError ( double &  f1x,
double &  f1y,
double &  f1z,
double &  f2x,
double &  f2y,
double &  f2z 
) [inline]

Definition at line 85 of file LCPcalc.h.

Referenced by sofa::helper::LocalBlock33::slipState().

ArgumentParser sofa::helper::parse ( std::vector< std::string > *  files,
const std::string &  helpstr = "",
char  hs = 'h',
const std::string &  hl = "help" 
) [inline]

Definition at line 360 of file ArgumentParser.h.

ArgumentParser sofa::helper::parse ( const std::string &  helpstr = "",
char  hs = 'h',
const std::string &  hl = "help" 
) [inline]

Parse a command line.

Parameters:
helpstr General help message
hs short name for help
hl long name for help This method frees the programmer from explicitly creating an ArgumentParser, which makes the program (hopefully) more readable. Using this method, the ArgumentParser is transparently created, it receives and processes the arguments, then it is destroyed.

Definition at line 356 of file ArgumentParser.h.

Referenced by main().

template<class Real >
Real sofa::helper::polar_decomp ( const defaulttype::Mat< 3, 3, Real > &  M,
defaulttype::Mat< 3, 3, Real > &  Q,
defaulttype::Mat< 3, 3, Real > &  S 
) [inline]

void sofa::helper::printFactoryLog ( std::ostream &  out  ) 

Print factory log.

Definition at line 89 of file Factory.cpp.

References getFactoryLog().

Referenced by main().

template<class real >
real sofa::helper::rabs ( real  r  )  [inline]

int sofa::helper::rceil ( double  r  )  [inline]

template<class Real >
void sofa::helper::reflect_cols ( defaulttype::Mat< 3, 3, Real > &  M,
const defaulttype::Vec< 3, Real > &  u 
) [inline]

Apply Householder reflection represented by u to column vectors of M.

Definition at line 105 of file PolarDecompose.h.

Referenced by do_rank1(), and do_rank2().

template<class Real >
void sofa::helper::reflect_rows ( defaulttype::Mat< 3, 3, Real > &  M,
const defaulttype::Vec< 3, Real > &  u 
) [inline]

Apply Householder reflection represented by u to row vectors of M.

Definition at line 116 of file PolarDecompose.h.

References dot().

Referenced by do_rank1(), and do_rank2().

template<class T1 , class T2 >
void sofa::helper::remove ( T1 &  v,
const T2 &  elem 
) [inline]

Remove the first occurence of a given value.

The remaining values are shifted.

Definition at line 283 of file vector.h.

Referenced by sofa::component::topology::EdgeSetTopologyModifier::removeEdgesProcess().

template<class T , class TT >
void sofa::helper::removeIndex ( std::vector< T, TT > &  v,
size_t  index 
) [inline]

Remove value at given index, replace it by the value at the last index, other values are not changed.

Definition at line 311 of file vector.h.

template<class T1 , class T2 >
void sofa::helper::removeValue ( T1 &  v,
const T2 &  elem 
) [inline]

int sofa::helper::resoudreLCP ( int  dim,
double *  q,
double **  M,
double *  res 
)

Definition at line 129 of file LCPcalc.cpp.

References afficheLCP(), EPSILON_LCP, and MAX_BOU.

template<class real >
int sofa::helper::rfloor ( real  r  )  [inline]

Definition at line 77 of file rmath.h.

Referenced by sofa::component::container::SpatialGrid< DataTypes >::add(), sofa::component::mapping::CurveMapping< BasicMapping >::advanceAbscissa(), sofa::component::mapping::ImplicitSurfaceMapping< In, Out >::apply(), sofa::component::mapping::CurveMapping< BasicMapping >::apply(), sofa::component::mapping::BeamLinearMapping< BasicMapping >::apply(), sofa::component::mapping::CurveMapping< BasicMapping >::applyJ(), sofa::component::mapping::BeamLinearMapping< BasicMapping >::applyJ(), sofa::component::mapping::CurveMapping< BasicMapping >::applyJT(), sofa::component::mapping::BeamLinearMapping< BasicMapping >::applyJT(), sofa::component::container::SpatialGrid< DataTypes >::getCell(), sofa::component::behaviormodel::eulerianfluid::Grid3D::getlevelset(), sofa::component::behaviormodel::eulerianfluid::Grid2D::getlevelset(), sofa::component::behaviormodel::eulerianfluid::Grid3D::getpressure(), sofa::component::behaviormodel::eulerianfluid::Grid2D::getpressure(), sofa::component::behaviormodel::eulerianfluid::Grid3D::impulse(), sofa::component::behaviormodel::eulerianfluid::Grid2D::impulse(), sofa::gpu::cuda::CudaDistanceGrid::index(), sofa::component::collision::DistanceGrid::index(), sofa::component::behaviormodel::eulerianfluid::Grid3D::interp(), sofa::component::behaviormodel::eulerianfluid::Grid2D::interp(), sofa::gpu::cuda::CudaDistanceGrid::ix(), sofa::component::collision::DistanceGrid::ix(), sofa::gpu::cuda::CudaDistanceGrid::iy(), sofa::component::collision::DistanceGrid::iy(), sofa::gpu::cuda::CudaDistanceGrid::iz(), sofa::component::collision::DistanceGrid::iz(), and rceil().

template<class T >
T sofa::helper::rlerp ( const T &  a,
const T &  b,
float  f 
) [inline]

Definition at line 122 of file rmath.h.

template<class real >
real sofa::helper::rmax ( real  r,
real  s 
) [inline]

template<class real >
real sofa::helper::rmin ( real  r,
real  s 
) [inline]

Definition at line 110 of file rmath.h.

template<class real >
int sofa::helper::rnear ( real  r  )  [inline]

long double sofa::helper::rsqrt ( const long double &  a  )  [inline]

double sofa::helper::rsqrt ( const double &  a  )  [inline]

Definition at line 133 of file rmath.h.

template<class T >
T sofa::helper::rsqrt ( const T &  a  )  [inline]

Definition at line 128 of file rmath.h.

void sofa::helper::set3Dof ( double *  vector,
int  index,
double &  vx,
double &  vy,
double &  vz 
) [inline]

Definition at line 81 of file LCPcalc.h.

Referenced by nlcp_gaussseidel(), and nlcp_gaussseidelTimed().

void sofa::helper::shft3 ( double &  a,
double &  b,
double &  c,
const double  d 
) [inline]

Definition at line 171 of file rmath.h.

template<class T >
const T sofa::helper::SIGN ( const T &  a,
const T &  b 
) [inline]

Definition at line 158 of file rmath.h.

template<class T >
const T sofa::helper::SQR ( const T &  a  )  [inline]

template<class T >
void sofa::helper::SWAP ( T &  a,
T &  b 
) [inline]

Definition at line 164 of file rmath.h.


Variable Documentation


Generated on Sun Nov 23 04:24:14 2008 for Sofa by  doxygen 1.5.7.1