EDA Querying
From DocR21
EDA Mesh provides the means to query the mesh topology and the associations between elements/nodes in the mesh and ACIS topology. This information is useful to applications wanting to extract adjacency properties of the finite element mesh, and interact with the ACIS model.
These are not, by any means, the only methods available for querying the finite element mesh. The mesh connectivity can also be queried via the VKI library direct access methods (for 3D Mesh licensees). See VKI documentation on Connect.
Contents |
Mesh Topology Queries
Unlike regular grids or structured meshes, unstructured meshes require a list of the finite element connectivity. EDA Mesh provides the means to manage some of these connectivities and generate information which is dependent upon the adjacency properties of the finite element mesh.
Some of the basic queries available are related to the topology of the mesh, the amount of elements and nodes for the entire mesh, and information on specific elements.
Mesh Element Data Extraction
- See also: EDA Mesh Topology
In general mesh modeling terms, the data available to a finite element mesh are:
- Element type - Mesh elements can come in different types, whether a surface or tetrahedral mesh. EDA Mesh lists some of these type using the VA_ELEMENT_TYPE enum.
- Faces, Edges and Nodes (quantity) - Together with the type of element, the total of faces, edges and nodes can be used for visualization of the mesh or the results after analysis. This information can be extracted per element (api_va_get_element_data) or as an overall property of the mesh (api_va_get_element_count or api_va_get_node_count).
- Node indices - Nodes or vertices in a finite element mesh can be extracted for all sorts of reasons: application of loads, heat input, or node displacement. An element can be queried for its node quantity and indices. These indices can then be used to extract geometrical information of the nodes, such as node positions (refer to api_va_get_node_positions).
Interface
| C++ | Scheme | Description |
|---|---|---|
| api_va_get_element_data | eda:element-data | Extract general element data, such as element type, number of faces, edges, nodes and node indices |
| api_va_get_element_data | eda:element-edge-count | Get count of edges in given mesh element |
| api_va_get_edge_nodes | eda:edge-nodes | Get count of nodes in given edge for a mesh element |
| api_va_get_element_data | eda:element-face-count | Get count of faces in given mesh element |
| api_va_get_face_nodes | eda:face-nodes | Get count of nodes in given face for a mesh element |
| api_va_get_element_data | eda:element-nodes | Get count of nodes on a given a mesh element |
| api_va_get_element_count | eda:mesh-element-count | Get overall count of elements in a mesh |
| api_va_get_node_count | eda:mesh-node-count | Get overall count of nodes in a mesh |
| api_va_get_node_positions | eda:node-positions | Get geometric positions of mesh nodes |
Example
| Example. Extract information from an element in finite mesh |
|---|
va_mesh *p_mesh = // get pointer to an instance of the mesh to be queried. int element_index = 5; // get index of element of interest int face_count = 0, edge_count = 0, node_count = 0; VA_ELEMENT_TYPE elem_type; int node_array[10]; AcisOptions *ao = NULL; outcome res = api_va_get_element_data( p_mesh, element_index, elem_type, face_count, edge_count, node_count, node_array, ao); check_outcome( res ); SPAposition node_position[10]; res = api_va_get_node_positions( p_mesh, node_count, node_array, node_position, ao); |
Example. Surface Mesh
(define c (solid:cylinder 0 0 0 0 0 1 0.5)) (define mopts (eda:surface-mesh-options "order" 3)) (define msh (eda:generate-surface-mesh c mopts)) (define f (list-ref (entity:faces c) 2)) (define elems (eda:entity-elements msh f)) (define elem (list-ref elems 2)) (define elem_nods (list-ref (eda:element-data msh elem) 2)) ;; (1 (1 3 6) (21 22 3 228 181 227)) ;; 1 = VA_SURFACE_TRI_PARABOLIC ;; 1 - Faces ;; 3 - Edges ;; 6 - Nodes ;; Node indices (eda:node-positions msh elem_nods) |
Example. Tet Mesh
(define c (solid:cylinder 0 0 0 0 0 1 0.5)) (define mopts (eda:surface-mesh-options "order" 3)) (define msh (eda:generate-tet-mesh c mopts)) (define f (list-ref (entity:faces c) 2)) (define elems (eda:entity-elements msh f)) (define elem (list-ref elems 2)) (define elem_nods (list-ref (eda:element-data msh elem) 2)) ;; (7 (4 6 10) (3 49 22 234 220 182 181 252 294 253)) ;; 7 = VA_TET_PARABOLIC ;; 4 - Faces ;; 6 - Edges ;; 10 - Nodes ;; Node indices - Used to extract positions (eda:node-positions msh elem_nods) ;;(#[ position 0.122774302959442 -0.202338054776192 1 ] ;; #[ position -0.11543121188879 -0.486482203006744 1 ] ;; #[ position -0.218589082360268 -0.0975851714611053 1 ] ;; #[ position 0.00673722382634878 -0.182258009910584 0.758795082569122 ] ;; #[ position 0.00367154437117279 -0.344410121440887 1 ] ;; #[ position -0.167010143399239 -0.292033702135086 1 ] ;; #[ position -0.047907393425703 -0.149961620569229 1 ] ;; #[ position 0.0647557601332664 -0.192298024892807 0.879397511482239 ] ;; #[ position -0.0543469935655594 -0.334370106458664 0.879397511482239 ] ;; #[ position -0.105925932526588 -0.139921590685844 0.879397511482239 ] ) |
Mesh Topology Query Limitations
EDA Mesh provides a few of the most frequently used queries. For a much more in-depth exploration, you must extract a handle to the underlying VKI mesher, which provides a rich set of functions of other type of queries. (3D Mesh licensees, refer to the VKI documentation, 3D Mesh and api_va_get_vki_handles). (See below for a workaround.)
ACIS Entities and Mesh Association Queries
EDA Mesh provides the means to extract associations between the mesh and the underlying ACIS model. For instance, selecting a face in a model, you can query for all the mesh nodes on that face, or the elements related to that face. The reverse is also possible. You can extract the entities associated with a node or the entity associated with a particular element.
The usefulness of these access methods becomes evident when you want to select a collection of elements for mesh refinement or the nodes on a FACE/EDGE and then use them for FEA purposes (loads, heat source, node displacement). It is simply a convenient way of mapping the ACIS model to the mesher and back.
Extract elements associated with an EDGE. In this case, do a mesh refinement on those |
Extract elements associated with a list of FACEs. In this case, do a mesh refinement on those elements |
Interface
| C++ | Scheme | Description |
|---|---|---|
| api_va_get_entity | eda:element-entities | Given an element extract the face, edge or vertex entity associated with it. |
| api_va_get_elements | eda:entity-elements | Given an entity, extract the elements associated with it. |
| api_va_get_node_entities | eda:node-entities | Given a node, extract the entities associated with it. |
| api_va_get_nodes | eda:entity-nodes | Given an entity, extract the nodes associated with it. |
Example
| Listing. ACIS ENTITY Associations | |
|---|---|
| Listing. Get ACIS FACE associated with face on element mesh | Listing. Get mesh nodes associated with ACIS FACE |
va_surfmesh *p_mesh = // get pointer to an instance of the mesh to be queried. int element_index = // get index of element of interest int face_on_mesh_elem_id = // get index of face on mesh element. See api_va_get_element_data(); AcisOptions *ao = NULL; FACE *return_face = NULL; // Output ACIS FACE outcome res = api_va_get_entity(p_mesh, element_index, face_on_mesh_elem_id, return_face, ao); check_outcome( res ); |
va_surfmesh *p_mesh = // get pointer to an instance of the mesh to be queried. FACE *face = // Select FACE of interest AcisOptions *ao = NULL; int node_count = 0; // Return value. Unknown at compile time int* node_array = 0; // Array will be allocated by API, user must deallocate it outcome res = api_va_get_nodes(p_mesh, face, node_count, node_array, ao); check_outcome( res ); SPAposition node_pos_ary = ACIS_NEW SPAposition[node_count]; res = api_va_get_node_positions( p_mesh, node_count, node_array, node_pos_ary, ao); // Do something with nodes // Delete nodes, positions if ( NULL != node_array ) { ACIS_DELETE [] STD_CAST node_array; node_array = 0; } if ( NULL != node_positions ) { ACIS_DELETE [] STD_CAST node_pos_ary; node_pos_ary = 0; } |
ACIS Association Query Limitations
EDA Mesh is limited to the extraction of mesh-element-data to ACIS-Entity association of similar "type". In other words, given an element, you can extract the EDGEs associated with a mesh element edge, but not the FACEs. Similarly for the extraction of EDGEs given a mesh element face. It is possible, and the associations can be extracted, but it would be necessary to have the full VKI 3D Mesh handles available. (Refer to 3D Mesh and api_va_get_vki_handles.)
| Example. Limitation overcome - Extracting FACE associated with edge on mesh element |
|---|
AcisOptions *ao = NULL; ENTITY_LIST e_list = // list of ACIS bodies to mesh. Application code // Mesh the entities va_surfmesh* p_mesh = NULL; outcome res = api_va_generate_surface_mesh(e_list, p_mesh, ao); check_outcome(res); // ... int element_index = // Select an element // Extract element information VA_ELEMENT_TYPE elem_type; int node_array[10]; res = api_va_get_element_data( p_mesh, element_index, elem_type, face_count, edge_count, node_count, node_array, ao); check_outcome(res); // Get VKI handles to interact with underlying mesher vis_SurfMesh* p_surfmesh = NULL; vis_Connect* p_connect = NULL; res = api_va_get_vki_handles( p_mesh, p_connect, p_surfmesh); check_outcome( res); int aid = 0; // Association identifier FACE *ret_face = NULL; for (int ee = 1; ee <= edge_count; ++ee ) { vis_ConnectElemEntAssoc( p_connect, VIS_GEOFACE, // VKI's define. Extract Geometric FACE associated with this element's edge SYS_EDGE, // VKI's define. element_index, // Element identifier ee, // Edge id on the element. 1 based &aid ); // Return value. Id for association. if ( aid ) { ent_id = aid - 1; // Correct index offset. printf( " geometry element edge= %d, FACE entity tag= %d\n", ee, ent_id ); // With this id, extract the associated entity ENTITY *ent = NULL; api_get_entity_from_id( ent_id, ent ); if ( is_FACE( ent ) ) { ret_face = (FACE*)ent; } } } |
