Users of a Space object may search for the element which contains a point, the list of elements which intersect a line, the list of elements which intersect a plane and the elements contained within a box. Also duplicate node and other node location searches may be made. Parameters may be set to select decomposition resolution, adaptivity level and extent attributes for certain search operations (e.g. finite or infinite lines). The functions associated with a Space object are the following.
*vis_SpaceBegin - create an instance of a Space object vis_SpaceEnd - destroy an instance of a Space object vis_SpaceError - return Space object error flag
vis_SpaceBoxGroup - (thread safe) elements contained in a box. vis_SpaceBoxNodeGroup - find the nodes contained in a box. vis_SpaceDupNodeIdTran - (thread safe) duplicate node search vis_SpaceKernel - generate spatial decomposition kernel. vis_SpaceNodeKernel - generate node spatial decomposition kernel. vis_SpaceLineGroup - (thread safe) elements intersecting a line. vis_SpacePlaneGroup - (thread safe) elements intersecting a plane. vis_SpacePointIdTran - (thread safe) elements containing points. vis_SpacePointNodeIdTran - (thread safe) nodes close to points. vis_SpaceSetObject - set pointers to attribute objects. vis_SpaceSetParam - set parameters for search operations.
Before generating the spatial decomposition kernel the spatial decomposition method and subdivision resolution and depth should be set if the default values are not acceptable. This spatial decomposition method subdivides model space into a set of blocks aligned to the world coordinate axes according to the subdivision resolution for each axis. The entities contained in each block are then determined and stored for each block. When a search or intersection is performed for the mesh only the entities in the blocks which contain the search point or intersect the block, rather than the entire mesh, need be considered. The default subdivision resolution is set to 10 for each coordinate axis. This means that model space will be decomposed into 1000 (10x10x10) blocks used for searching. The block decomposition resolution, depth, etc. may be changed using vis_SpaceSetParami. The actual data structures used to hold the spatial decomposition are private to the Space object. The spatial decomposition kernel must be generated using vis_SpaceKernel before any search queries are performed.
The user performs element searches in a Space object using a suite of functions. These functions fall into two basic categories, (1) query for the elements which contain a set of points, vis_SpacePointIdTran, and (2) query for the elements which intersect a geometrical object (line, plane or box), vis_SpaceLineGroup, vis_SpacePlaneGroup and vis_SpaceBoxGroup. The spatial decomposition kernel must be generated before any query functions are called. The kernel may be built using vis_SpaceKernel.
Node searches are performed using vis_SpacePointNodeIdTran and vis_SpaceDupNodeIdTran. The node spatial decomposition kernel must be generated before these query functions are called. The kernel may be built using vis_SpaceNodeKernel.
The Space object calls the following grid functions set in the GridFun attribute object.
*vis_SpaceBegin - create an instance of a Space object
vis_Space *vis_SpaceBegin ()
None
Destroy an instance of a Space object using
void vis_SpaceEnd (vis_Space *space)
Return the current value of a Space object error flag using
Vint vis_SpaceError (vis_Space *space)
vis_SpaceBoxGroup - (thread safe) elements contained in a box.
void vis_SpaceBoxGroup (vis_Space *space, Vfloat box_pts[8][3], vis_Group *group, vis_Group *groupdst)
space Pointer to Space object. box_pts Array of the world coordinates of points defining a box. group Pointer to Group object of elements. If NULL, then all elements are assumed.
groupdst Pointer to derived Group object of elements.
If the decomposition kernel has not been previously generated, this call will automatically create it by calling vis_SpaceKernel with a NULL group argument.
vis_SpaceBoxNodeGroup - find the nodes contained in a box.
void vis_SpaceBoxNodeGroup (vis_Space *space, Vfloat box_pts[8][3], vis_Group *group, vis_Group *groupdst)
space Pointer to Space object. box_pts Array of the world coordinates of points defining a box. group Pointer to Group object of nodes. If NULL, then all nodes are assumed.
groupdst Pointer to derived Group object of nodes.
If the decomposition kernel has not been previously generated, this call will automatically create it by calling vis_SpaceKernel with a NULL group argument.
vis_SpaceDupNodeIdTran - (thread safe) duplicate node search
void vis_SpaceDupNodeIdTran (vis_Space *space, vis_Group *group, vis_IdTran *idtran)
space Pointer to Space object. group Pointer to Group object of nodes. If NULL, then all nodes are assumed.
idtran Pointer to derived IdTran object of duplicate nodes.
vis_SpaceKernel - generate spatial decomposition kernel.
void vis_SpaceKernel (vis_Space *space, vis_Group *group)
space Pointer to Space object. group Pointer to a Group object of elements.
none
Once the decomposition kernel is created, then space searches may be performed. If this function is called and the decomposition kernel has already been generated, then the function immediately returns without altering the object state.
vis_SpaceNodeKernel - generate node spatial decomposition kernel.
void vis_SpaceNodeKernel (vis_Space *space)
space Pointer to Space object.
none
vis_SpaceLineGroup - (thread safe) elements intersecting a line
void vis_SpaceLineGroup (vis_Space *space, Vfloat line_pts[2][3], vis_Group *group) vis_Group *groupdst)
space Pointer to Space object. line_pts Array of the world coordinates of the two points defining the end points of a line. group Pointer to Group object of elements. If NULL, then all elements are assumed.
groupdst Pointer to derived Group object of elements.
By default element intersections are computed assuming an infinite line whose direction is specified by line_pts. The element intersections can be set to be computed for a finite or infinite line by using the function vis_SpaceSetParami to appropriately set the SPACE_LINE_INFINITE parameter.
If the decomposition kernel has not been previously generated, this call will automatically create it by calling vis_SpaceKernel with a NULL group argument.
vis_SpacePlaneGroup - (thread safe) elements intersecting a plane
void vis_SpacePlaneGroup (vis_Space *space, Vfloat plane_pts[4][3], vis_Group *group, vis_Group *groupdst)
space Pointer to Space object. plane_pts Array of the world coordinates of the four points defining the plane. group Pointer to Group object of elements. If NULL, then all elements are assumed.
groupdst Pointer to derived Group object of elements.
Element intersections are computed assuming a plane specified by the four world coordinate points in plane_pts. The first three points of plane_pts specify the plane. The fourth point is projected to the plane.
Element intersections can be set to be computed for an finite or infinite plane by using the function vis_SpaceSetParami to appropriately set the SPACE_PLANE_INFINITE parameter. For a finite plane the values in plane_pts contain the four points defining the edges of a planar quadrilateral. The four points must be defined on the quadrilateral plane in linear Serendipity element convention.
If the decomposition kernel has not been previously generated, this call will automatically create it by calling vis_SpaceKernel with a NULL group argument.
vis_SpacePointIdTran - (thread safe) elements containing points
void vis_SpacePointIdTran (vis_Space *space, Vint num_pts, Vfloat pts[][3], vis_Group *group, vis_IdTran *idtran, Vfloat r[][3])
space Pointer to Space object. num_pts The number of points to search. pts Array of the world coordinate points of the search points. group Pointer to Group object of elements. If NULL, then all elements are assumed.
idtran Pointer to a IdTran object of elements r Array of the local coordinates of the search points within an element.
The output array r must be defined with a size of num_pts. If a point is contained in an element then the element number is recorded in the idtran object and the local coordinates for the point relative to the element are computed and returned in r. If the point is not contained in an element, a zero is recorded in the idtran object and the local coordinates returned in r are undefined.
vis_SpacePointNodeIdTran - (thread safe) nodes close to points
void vis_SpacePointNodeIdTran (vis_Space *space, Vint num_pts, Vfloat pts[][3], vis_Group *group, vis_IdTran *idtran)
space Pointer to Space object. num_pts The number of points to search. pts Array of the world coordinate points of the search points. group Pointer to Group object of nodes. If NULL, then all nodes are assumed.
idtran Pointer to derived IdTran object of duplicate nodes.
vis_SpaceSetParam - set parameters for search operations.
void vis_SpaceSetParamf (vis_Space *space, Vint ptype, Vfloat fparam) void vis_SpaceSetParami (vis_Space *space, Vint ptype, Vint iparam)
space Pointer to Space object. ptype Parameter type to set. =SPACE_DEPTH Decomposition depth =SPACE_LINE_INFINITE Infinite/finite line intersection =SPACE_PLANE_INFINITE Infinite/finite plane intersection =SPACE_NODE_SEARCH Specify node search type =SPACE_REFINE Specify refinements =SPACE_RESOLUTION Specify zero level decomposition =SPACE_RESOLUTION_ADAPT Specify multi-level decomposition =SPACE_TOLERANCE Specify floating point world coordinate distance tolerance fparam Specifies the float value that ptype will be set to. iparam Specifies the integer value that ptype will be set to. =SPACE_NODE_LOWEST Return node with lowest index. =SPACE_NODE_CLOSEST Return closest node. =SPACE_NODE_ANY Return any node.
none
Specify whether line and plane intersections are performed assuming finite or infinite line and plane extents using SPACE_LINE_INFINITE and SPACE_PLANE_INFINITE respectively. By default SPACE_LINE_INFINITE and SPACE_PLANE_INFINITE are on.
Specify the type of node location to be performed by vis_SpacePointNodeIdTran. If SPACE_NODE_SEARCH is set to SPACE_NODE_LOWEST then the node with the lowest index which satisfies the search constraint is returned; if set to SPACE_NODE_CLOSEST then the node closest to the input point is returned; if set to SPACE_NODE_ANY then any node which satisfies the search constraint is returned. By default SPACE_NODE_SEARCH is set to SPACE_NODE_LOWEST.
Specify the refinement used to subdivide elements for intersection testing with SPACE_REFINE. If used for graphical picking, this refinement should match the refinement visualization context used to draw the entities to be picked. By default SPACE_REFINE is set to 0.
Specify the resolution of the spatial decomposition using SPACE_RESOLUTION and SPACE_RESOLUTION_ADAPT. SPACE_RESOLUTION_ADAPT is only used if SPACE_DEPTH is greater than 0. To obtain an "octtree" decomposition, set both parameters to 2 and SPACE_DEPTH to the desired maximum depth of the octtree. By default SPACE_RESOLUTION is set to 10 and SPACE_RESOLUTION_ADAPT is set to 4.
Specify the distance tolerance to be used in point location and intersection testing using SPACE_TOLERANCE. By default SPACE_TOLERANCE is set to .0001 .
vis_SpaceSetObject - set pointers to attribute objects.
void vis_SpaceSetObject (vis_Space *space, Vint objecttype, Vobject *object)
space Pointer to Space object. objecttype The name of the object type to be set. =VIS_GRIDFUN GridFun object object Pointer to the object to be set.
None
*vis_RangeBegin - create an instance of a Range object vis_RangeEnd - destroy an instance of a Range object vis_RangeError - return Range object error flag
vis_RangeSetObject - set pointers to attribute objects. vis_RangeSetState - set State objects. vis_RangeSurfGroup - find the elements containing a state value.
The Range module uses State objects to define the field quantities used for searching. Each field quantity or state is associated with an integer index between 0 and 15. A Range object can manage up to 16 fields simultaneously. The states are associated with an index using vis_RangeSetState. Once a state has been set, it's associated index may be referenced in a query function such as vis_RangeSurfGroup.
The Range object calls the following grid functions set in the GridFun attribute object.
*vis_RangeBegin - create an instance of a Range object
vis_Range *vis_RangeBegin ()
None
Destroy an instance of a Range object using
void vis_RangeEnd (vis_Range *Range)
Return the current value of a Range object error flag using
Vint vis_RangeError (vis_Range *Range)
vis_RangeSetObject - set pointers to attribute objects.
void vis_RangeSetObject (vis_Range *range, Vint objecttype, Vobject *object)
range Pointer to Range object. objecttype The name of the object type to be set. =VIS_GRIDFUN GridFun object =VIS_SPACE Space object object Pointer to the object to be set.
None
vis_RangeSetState - set State object.
void vis_RangeSetState (vis_Range *range, Vint index, vis_State *state);
range Pointer to Range object. index State index to set 0 <= index <= 15. state Pointer to State object
None
vis_RangeSurfGroup - find the elements containing a state value.
void vis_RangeSurfGroup (vis_Range *range, Vint index, Vfloat value, vis_Group *group, vis_Group *groupdst)
range Pointer to Range object. index State index to search value Value to search for group Pointer to Group object of elements. If NULL, then all elements are assumed.
groupdst Pointer to derived Group object of elements.