Exodus 7.10

Functions
ex_cvt_nodes_to_sides.c File Reference
`#include "exodusII.h"`
`#include "exodusII_int.h"`
`#include <ctype.h>`
`#include <inttypes.h>`
`#include <stddef.h>`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <sys/types.h>`

## Functions
static int64_t | get_node (void_int *connect, size_t index, size_t int_size)
static void | put_side (void_int *side_list, size_t index, size_t value, size_t int_size)
int | ex_cvt_nodes_to_sides (int exoid, void_int *num_elem_per_set, void_int *num_nodes_per_set, void_int *side_sets_elem_index, void_int *side_sets_node_index, void_int *side_sets_elem_list, void_int *side_sets_node_list, void_int *side_sets_side_list)

## Function Documentation

## ◆ ex_cvt_nodes_to_sides()

int ex_cvt_nodes_to_sides | ( | int | exoid,
|  | void_int * | num_elem_per_set,
|  | void_int * | num_nodes_per_set,
|  | void_int * | side_sets_elem_index,
|  | void_int * | side_sets_node_index,
|  | void_int * | side_sets_elem_list,
|  | void_int * | side_sets_node_list,
|  | void_int * | side_sets_side_list
| ) |  |

The function ex_cvt_nodes_to_sides() is used to convert a side set node list to a side set side list. This routine is provided for application programs that utilize side sets defined by nodes (as was done previous to release 2.0) rather than local faces or edges. The application program must allocate memory for the returned array of sides. The length of this array is the same as the length of the concatenated side sets element list, which can be determined with a call to ex_inquire() or ex_inquire_int().

Returns
  In case of an error, ex_cvt_nodes_to_sides() returns a negative number; a warning will return a positive number. Possible causes of errors include:
  - a warning value is returned if no side sets are stored in the file.
  - because the faces of a wedge require a different number of nodes to describe them (quadrilateral vs. triangular faces), the function will abort with a fatal return code if a wedge is encountered in the side set element list.

Parameters

  [in] | exoid | exodus file ID returned from a previous call to ex_create() or ex_open().
  [in] | num_elem_per_set | Array containing the number of sides for each set. The number of sides is equal to the number of elements for each set.
  [in] | num_nodes_per_set | Array containing the number of nodes for each set.
  [in] | side_sets_elem_index | Array containing indices into the `side_sets_elem_list` which are the locations of the first element for each set. These indices are 0-based. Unused.
  [in] | side_sets_node_index | Array containing indices into the `side_sets_node_list` which are the locations of the first node for each set. These indices are 0-based. Unused.
  [in] | side_sets_elem_list | Array containing the elements for all side sets. Internal element IDs are used in this list (see Section LocalElementIds).
  [in] | side_sets_node_list | Array containing the nodes for all side sets. Internal node IDs are used in this list (see Section LocalNodeIds).
  [out] | side_sets_side_list | Returned array containing the sides for all side sets.

The following code segment will convert side sets described by nodes to side sets described by local side numbers:

int error, exoid, ids[2], num_side_per_set[2],
num_nodes_per_set[2], elem_ind[2], node_ind[2],
elem_list[4], node_list[8], el_lst_len, *side_list;
ids[0] = 30 ; ids[1] = 31;
num_side_per_set[0] = 2; num_side_per_set[1] = 2;
num_nodes_per_set[0] = 4; num_nodes_per_set[1] = 4;
elem_ind[0] = 0; elem_ind[1] = 2;
node_ind[0] = 0; node_ind[1] = 4;
/* side set #1 */
elem_list[0] = 2; elem_list[1] = 2;
node_list[0] = 8; node_list[1] = 5;
node_list[2] = 6; node_list[3] = 7;
/* side set #2 */
elem_list[2] = 1; elem_list[3] = 2;
node_list[4] = 2; node_list[5] = 3;
node_list[6] = 7; node_list[7] = 8;
el_lst_len = ex_inquire_int(exoid, EX_INQ_SS_ELEM_LEN);
/* side set element list is same length as side list */
side_list = (int *) calloc (el_lst_len, sizeof(int));
ex_cvt_nodes_to_sides(exoid, num_side_per_set, num_nodes_per_set,
elem_ind, node_ind, elem_list,
node_list, side_list);

Algorithm:

      Read elem_block_ids --> elem_blk_id[array]

      Read element block parameters --> elem_blk_parms[array]

      Determine total number of elements in side set by summing num_elem_per_set

      Build side set element to side set node list index --> ss_elem_node_ndx[array]

      For each element in the side_set_elem_list  {
        If Jth element is not in current element block (e.g. J>elem_ctr) {
          get element block parameters (num_elem_in_blk, ...)
          elem_ctr += num_elem_in_blk

          free old connectity array space
          allocate connectivity array: size=num_elem_in_blk*num_nodes_per_elem
          get connectivity array
        }

        If Jth element is in current element block (e.g. J<=elem_ctr) {
          For each node in element (linear search of up to num_nodes_per_elem) {
            If side set element node[1] == element node[i] {
              Case element type = Hex {
                If side set element node[2] == element node[Hex_table[i,1]]
                  Jth side = Hex_table[i,2]

                 break
              }
              Case element type = Wedge {
                If side set element node[2] == element node[Wedge_table[i,1]]
                  Jth side = Wedge_table[i,2]

                break
              }
            }
          }
        }
      }

## ◆ get_node()

static int64_t get_node | ( | void_int * | connect,
|  | size_t | index,
|  | size_t | int_size
| ) |  |
| static

## ◆ put_side()

static void put_side | ( | void_int * | side_list,
|  | size_t | index,
|  | size_t | value,
|  | size_t | int_size
| ) |  |
| static