Tissue Forge C 0.2.1
Interactive, particle-based physics, chemistry and biology modeling and simulation environment
Loading...
Searching...
No Matches
tfC_util.h File Reference
#include "tf_port_c.h"
Include dependency graph for tfC_util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  tfPointsTypeHandle
 

Functions

HRESULT tfPointsType_init (struct tfPointsTypeHandle *handle)
 Initialize an instance.
 
HRESULT tfGetSeed (unsigned int *seed)
 Get the current seed for the pseudo-random number generator.
 
HRESULT tfSetSeed (unsigned int seed)
 Set the current seed for the pseudo-random number generator.
 
HRESULT tfColor3Names (char ***names, unsigned int *numNames)
 Get the names of all available colors.
 
HRESULT tfPlaneEquationFPN (tfFloatP_t *point, tfFloatP_t *normal, tfFloatP_t **planeEq)
 Calculate the coefficients of a plane equation from a point and normal of the plane.
 
HRESULT tfPlaneEquationTPN (tfFloatP_t *planeEq, tfFloatP_t **point, tfFloatP_t **normal)
 Calculate a point and normal of a plane equation.
 
HRESULT tfRandomPoint (unsigned int kind, tfFloatP_t dr, tfFloatP_t phi0, tfFloatP_t phi1, tfFloatP_t *x, tfFloatP_t *y, tfFloatP_t *z)
 Get the coordinates of a random point in a kind of shape.
 
HRESULT tfRandomPoints (unsigned int kind, int n, tfFloatP_t dr, tfFloatP_t phi0, tfFloatP_t phi1, tfFloatP_t **x)
 Get the coordinates of random points in a kind of shape.
 
HRESULT tfPoints (unsigned int kind, int n, tfFloatP_t **x)
 Get the coordinates of uniform points in a kind of shape.
 
HRESULT tfFilledCubeUniform (tfFloatP_t *corner1, tfFloatP_t *corner2, unsigned int nParticlesX, unsigned int nParticlesY, unsigned int nParticlesZ, tfFloatP_t **x)
 Get the coordinates of a uniformly filled cube.
 
HRESULT tfFilledCubeRandom (tfFloatP_t *corner1, tfFloatP_t *corner2, int nParticles, tfFloatP_t **x)
 Get the coordinates of a randomly filled cube.
 
HRESULT tfIcosphere (unsigned int subdivisions, tfFloatP_t phi0, tfFloatP_t phi1, tfFloatP_t **verts, unsigned int *numVerts, int **inds, unsigned int *numInds)
 Get the coordinates of an icosphere.
 
HRESULT tfRandomVector (tfFloatP_t mean, tfFloatP_t std, tfFloatP_t *x, tfFloatP_t *y, tfFloatP_t *z)
 Generates a randomly oriented vector with random magnitude with given mean and standard deviation according to a normal distribution.
 
HRESULT tfRandomUnitVector (tfFloatP_t *x, tfFloatP_t *y, tfFloatP_t *z)
 Generates a randomly oriented unit vector.
 
HRESULT tfUtilGetFeaturesMap (char ***names, bool **flags, unsigned int *numFeatures)
 Get the compiler features names and flags.
 
HRESULT tfUtilWallTime (double *wtime)
 Get the current wall time.
 
HRESULT tfUtilCPUTime (double *cputime)
 Get the current CPU time.
 

Function Documentation

◆ tfColor3Names()

HRESULT tfColor3Names ( char *** names,
unsigned int * numNames )

Get the names of all available colors.

Returns
S_OK on success

◆ tfFilledCubeRandom()

HRESULT tfFilledCubeRandom ( tfFloatP_t * corner1,
tfFloatP_t * corner2,
int nParticles,
tfFloatP_t ** x )

Get the coordinates of a randomly filled cube.

Parameters
corner1first corner of cube
corner2second corner of cube
nParticlesnumber of points in the cube
xcoordinates of points
Returns
S_OK on success

◆ tfFilledCubeUniform()

HRESULT tfFilledCubeUniform ( tfFloatP_t * corner1,
tfFloatP_t * corner2,
unsigned int nParticlesX,
unsigned int nParticlesY,
unsigned int nParticlesZ,
tfFloatP_t ** x )

Get the coordinates of a uniformly filled cube.

Parameters
corner1first corner of cube
corner2second corner of cube
nParticlesXnumber of particles along x-direction of filling axes (>=2)
nParticlesYnumber of particles along y-direction of filling axes (>=2)
nParticlesZnumber of particles along z-direction of filling axes (>=2)
xcoordinates of points
Returns
S_OK on success

◆ tfIcosphere()

HRESULT tfIcosphere ( unsigned int subdivisions,
tfFloatP_t phi0,
tfFloatP_t phi1,
tfFloatP_t ** verts,
unsigned int * numVerts,
int ** inds,
unsigned int * numInds )

Get the coordinates of an icosphere.

Parameters
subdivisionsnumber of subdivisions
phi0angle lower bound
phi1angle upper bound
vertsreturned vertices
numVertsnumber of vertices
indsreturned indices
numIndsnumber of indices
Returns
S_OK on success

◆ tfPlaneEquationFPN()

HRESULT tfPlaneEquationFPN ( tfFloatP_t * point,
tfFloatP_t * normal,
tfFloatP_t ** planeEq )

Calculate the coefficients of a plane equation from a point and normal of the plane.

Parameters
pointpoint on the plane
normalnormal of the plane
planeEqplane equation coefficients
Returns
S_OK on success

◆ tfPlaneEquationTPN()

HRESULT tfPlaneEquationTPN ( tfFloatP_t * planeEq,
tfFloatP_t ** point,
tfFloatP_t ** normal )

Calculate a point and normal of a plane equation.

Parameters
planeEqcoefficients of the plane equation
pointpoint on the plane
normalnormal of the plane
Returns
S_OK on success

◆ tfPoints()

HRESULT tfPoints ( unsigned int kind,
int n,
tfFloatP_t ** x )

Get the coordinates of uniform points in a kind of shape.

Currently supports ring and sphere.

Parameters
kindkind of shape
nnumber of points
xcoordinates of points
Returns
S_OK on success

◆ tfPointsType_init()

HRESULT tfPointsType_init ( struct tfPointsTypeHandle * handle)

Initialize an instance.

Parameters
handlehandle to populate
Returns
S_OK on success

◆ tfRandomPoint()

HRESULT tfRandomPoint ( unsigned int kind,
tfFloatP_t dr,
tfFloatP_t phi0,
tfFloatP_t phi1,
tfFloatP_t * x,
tfFloatP_t * y,
tfFloatP_t * z )

Get the coordinates of a random point in a kind of shape.

Currently supports sphere, disk, solid cube and solid sphere.

Parameters
kindkind of shape
drthickness parameter; only applicable to solid sphere kind
phi0angle lower bound; only applicable to solid sphere kind
phi1angle upper bound; only applicable to solid sphere kind
xx-coordinate of random point
yy-coordinate of random point
zz-coordinate of random point
Returns
S_OK on success

◆ tfRandomPoints()

HRESULT tfRandomPoints ( unsigned int kind,
int n,
tfFloatP_t dr,
tfFloatP_t phi0,
tfFloatP_t phi1,
tfFloatP_t ** x )

Get the coordinates of random points in a kind of shape.

Currently supports sphere, disk, solid cube and solid sphere.

Parameters
kindkind of shape
nnumber of points
drthickness parameter; only applicable to solid sphere kind
phi0angle lower bound; only applicable to solid sphere kind
phi1angle upper bound; only applicable to solid sphere kind
xcoordinates of random points
Returns
S_OK on success

◆ tfRandomUnitVector()

HRESULT tfRandomUnitVector ( tfFloatP_t * x,
tfFloatP_t * y,
tfFloatP_t * z )

Generates a randomly oriented unit vector.

Parameters
xx-component of vector
yy-component of vector
zz-component of vector
Returns
S_OK on success

◆ tfRandomVector()

HRESULT tfRandomVector ( tfFloatP_t mean,
tfFloatP_t std,
tfFloatP_t * x,
tfFloatP_t * y,
tfFloatP_t * z )

Generates a randomly oriented vector with random magnitude with given mean and standard deviation according to a normal distribution.

Parameters
meanmagnitude mean
stdmagnitude standard deviation
xx-component of vector
yy-component of vector
zz-component of vector
Returns
S_OK on success

◆ tfSetSeed()

HRESULT tfSetSeed ( unsigned int seed)

Set the current seed for the pseudo-random number generator.

Parameters
seednew seed value
Returns
S_OK on success

◆ tfUtilCPUTime()

HRESULT tfUtilCPUTime ( double * cputime)

Get the current CPU time.

Parameters
cputimeCPU time
Returns
S_OK on success

◆ tfUtilGetFeaturesMap()

HRESULT tfUtilGetFeaturesMap ( char *** names,
bool ** flags,
unsigned int * numFeatures )

Get the compiler features names and flags.

Parameters
namesfeature names
flagsfeature flags
numFeaturesnumber of features
Returns
S_OK on success

◆ tfUtilWallTime()

HRESULT tfUtilWallTime ( double * wtime)

Get the current wall time.

Parameters
wtimewall time
Returns
S_OK on success