Type Defined Function Pointers


 
The following type defined function pointers are used in conjunction with the UF_FORGEO_register_surface routine.
 
typedef int (*UF_FOREGEO_create_surface_f_t Create Surface
char  *char_data, 
int  num_ints, 
int  *int_array, 
int  num_doubles, 
double  *double_array, 
int  num_data, 
double  *fg_data 

 
The arguments have the following descriptions
 
Parameter  I/O  Description 
char_data  Character string for surface 
num_ints  Number of integers defining surface 
int_array  Array of integers defining surface 
num_doubles  Number of doubles defining surface 
double_array  Array of doubles defining surface 
num_data  Size of fg_data array 
fg_data  I/O  Foreign Geometry data array 
return  0 = No error 
not 0 = Error code 

 
This function creates and initializes a foreign surface.This function is called when a foreign surface is created. This occurs either during new surface creations or during load of existing models. NX will ask you to prepare to process this surface. You need to prepare to evaluate this surface and return whether or not evaluation is possible. If evaluation is not possible, you will return the error code UF_FORGEO_EVALUATOR_MISSING.
 
The fg_data array can be used any way you wish. You may want to store information to make the evaluation faster or you could store the address of the evaluation function for this surface if multiple surface types are supported and you want to remove a switch between surface types during each evaluation.
 
 
 
typedef void (*UF_FOREGEO_ask_surface_params_f_t Ask Surface
int  *int_array, 
double  *double_array, 
double  *fg_data, 
double  *uvbox, 
int  period[2] 

 
The arguments have the following descriptions.
 
Parameter  I/O  Description 
int_array  Array of integers defining surface 
double_array  Array of doubles defining surface 
fg_data  Foreign Geometry data array 
uvbox  UV parameter box for surface 
period  u and v periodicity flags for surface. 
 
[0] = u 
[1] = v 
 
UF_MODL_NON_PERIODIC or 
 
UF_MODL_PERIODIC (not yet sup ported) 
 
 
 
 
 
typedef int (*UF_FOREGEO_evaluate_surface_f_t)  Evaluate Surface
int  *int_array, 
double  *double_array, 
double  *fg_data 
double  u, 
double  v, 
int  num_derivs_in_u, 
int  num_derivs_in_v, 
int  triang, 
double  *results 

 
The arguments have the following descriptions
 
Parameter  I/O  Description 
int_array  Array of integers defining surface 
double_array  Array of doubles defining surface 
fg_data  Foreign Geometry data array 
u parameter value at which to evaluate 
v parameter value at which to evaluate 
num_derivs_in_u  number of derivatives in u direction 
num_derivs_in_v  number of derivatives in v direction 
triang  Request for triangular array of derivatives. 
 
UF_MODL_RECTANGULAR or 
UF_MODL_TRIANGULAR 
results  Evaluation results 
return  0 = No error 
not 0 = Error code 

 
Evaluates a foreign surface.This function is called when evaluation of the foreign surface is needed. You need to support up to second derivatives. Your evaluation results must be returned in the units of the display part.
 
The results array should be considered as an array of vectors each of which is stored in three successive locations in the array. For example, if six results are required then the results array will be 18 doubles long.
 
The num_derivs_in_u, num_derivs_in_v and triang arguments specify the derivatives required and their positions in the results array as follows:
 
If "triang" is UF_FORGEO_RECTANGULAR. In this case a rectangular array of derivatives is required. num_derivs_in_u specifies the highest derivative of form dnP/dun that is required. num_derivs_in_v specifies the highest derivative of form dnP/dvn that is required. Other entries are according to the pattern "each successive column is a higher derivative in u and each successive row is a higher derivative in v". Thus, for example if num_derivs_in_u = 2, num_derivs_in_v = 1 and triang = UF_FORGEO_RECTANGULAR then the results array is filled:
 
 
dP/du  d2P/du2 
dP/dv  d2P/dudv  d3P/du2dv 

 
These positions/derivatives are then stored in the results array in row order. For example, counting from position 0:
 
dP/du is stored in elements 3 - 5 of the results array.
 
d2P/dudv is stored in elements 12 - 14 of the results array.
 
If a derivative is NOT available then the corresponding array elements should be returned unmodified. For example, if your evaluator can not return d3p/du2dv in the above specification then you should not modify elements 15 - 17 of results and return UF_FORGEO_INCOMPLETE as the status of the evaluation.
 
The triang argument may only take the value UF_FORGEO_TRIANGULAR when num_derivs_in_u = num_derivs_in_v. In this case the array pattern is triangular and returned in row order. For example, if num_derivs_in_u = num_derivs_in_v = 2 and triang = UF_FORGEO_TRIANGULAR the pattern of the results array is:
 
 
dP/du  d2P/du2 
dP/dv  d2P/dudv 
d2P/dv2 
With d2P/du2 stored in elements 6 - 8 of the results array and d2P/dv2 stored in elements 15 - 17.
 
 
NOTE: It is not possible for NX to validate the function pointers you pass in. However, if any of them are NULL, then an error code of UF_FORGEO_FUNCTION_MISSING is returned.