get/set the number of subcomponents within one Node_Data component
int FLDget_node_data_veclen (
OMobj_id field,
int comp,
int *veclen);
int FLDset_node_data_veclen (
OMobj_id field,
int comp,
int veclen);
These routines set and get the veclen (number of subcomponents) within a single Node_Data Data_Array component. For example, an RGB image's veclen would be 3.
This veclen can be used to calculate the second index into the values[nvals][veclen] data array.
Note: Do not use this for Grids. Use FLDget_nspace instead.
Note: veclens are often set as part of the omnibus FLDset_node_data_comp routine rather than with FLDset_node_data_veclen.
This example, a fragment from modules/stream.c, shows streamlines retrieving the veclen from its input field object, then checking to see that it is at least two long:
int FUNCstream (in, probe, order, forward, nseg, max_seg, min_vel,
stream_comp, ribbons, rib_width, rib_angle, out)
OMobj_id in, probe, out;
float min_vel;
int order, forward, nseg, max_seg, stream_comp, ribbons;
float rib_width, rib_angle;
...
{
...
int ndim, size, veclen, n, nprobes, i;
...
if (FLDget_node_data_veclen(in, stream_comp, &veclen)!= 1) {
ERR_RETURN("Error getting veclen");
}
if (veclen < 2) {
ERR_RETURN("cannot create streamlines for scalar");
}
...
This example, a fragment from modules/rd_geom.c shows read geometry (which reads an AVS.geom format file) setting the output veclens of the normals, colors, uv, and uvw components:
FUNCread_geom(filename, out)
char *filename;
OMobj_id out;
{
...
int
geoms_to_field(num_geoms, geom, out)
int num_geoms;
GEOMobj *geom[];
OMobj_id out;
{
...
int normal_comp = -1;
int color_comp = -1;
int uv_comp = -1, uvw_comp = -1;
int ncomps= 0;
...
if (normal_comp!= -1)
{
if (FLDset_node_data_id(out, normal_comp, GD_NORMAL_NODE_DATA_ID)!= 1)
ERR_RETURN("Error setting comp id");
if (FLDset_node_data_veclen(out, normal_comp, 3)!= 1)
ERR_RETURN("Error setting comp veclen");
}
if (color_comp!= -1)
{
if (FLDset_node_data_id(out, color_comp, GD_COLOR_NODE_DATA_ID)!=1)
ERR_RETURN("Error setting comp id");
if (FLDset_node_data_veclen(out, color_comp, 3)!= 1)
ERR_RETURN("Error setting comp veclen");
}
if (uv_comp!= -1)
{
if (FLDset_node_data_id(out, uv_comp, GD_UV_NODE_DATA_ID)!= 1)
ERR_RETURN("Error setting comp id");
if (FLDset_node_data_veclen(out, uv_comp, 2)!= 1)
ERR_RETURN("Error setting comp veclen");
}
else if (uvw_comp!= -1)
{
if (FLDset_node_data_id(out, uvw_comp, GD_UV_NODE_DATA_ID)!= 1)
ERR_RETURN("Error setting comp id");
if (FLDset_node_data_veclen(out, uvw_comp, 3)!= 1)
ERR_RETURN("Error setting comp veclen");
}
...