Using Tools > Working with User Code > User Function Interface Reference (C) > Template User Function (C)

Your Ad Here




Template User Function (C)

The generic purpose of a user function is to populate a result array with values obtained by operating on args, as shown in the examples, using this template:

#include "Real.h"

void name(result, int size, args ...);

name: the function name. This is arbitrary: STAR-CCM+ does not impose particular function names for particular functionality. There are, however, some protected names which must be avoided: ucarg, ucfunc, ucfunction, uclib, ufarg, uffunc, uflib.

result: the array of values returned by the user function. It should be declared as

Real *result

for a scalar function, or

Real (*result)[3]

for a vector function. Each element of the result array represents a cell or face, depending on the type of the user function.

size: the number of elements in the result array.

args: the arguments which STAR-CCM+ should pass to the function, chosen from the list of available variables and requested through ucarg. The form of declaration for a variable arg of type T is given in the table below.

Argument Type
(StoredVariable< T >)
    
Declaration

int

 

int *arg

Real

 

Real *arg

unsigned int

 

int *arg

Vector< 2, unsigned int >

 

int (*arg)[2]

Vector< 3, CoordReal >

 

CoordReal (*arg)[3]

Vector< 3, Real >

 

Real (*arg)[3]

For example,

CoordReal (*centroid)[3], Real *temperature

would declare centroid position and temperature as arguments.

The Real and CoordReal types define the precision of floating-point variables in Real.h.

Return to CD-adapco STAR-CCM+ Index


Your Ad Here