Mesh Oriented datABase  (version 5.6.0)
An array-based unstructured mesh library
CN.cpp File Reference
#include "moab/CN.hpp"
#include "MBCNArrays.hpp"
#include "MBCN.h"
#include <cassert>
#include <cstring>
#include <iterator>
+ Include dependency graph for CN.cpp:

Go to the source code of this file.

Namespaces

 moab
 Class representing axis-aligned bounding box.
 

Macros

#define MUC   CN::mUpConnMap[this_type][source_dim][target_dim]
 

Functions

template<typename T >
static short int moab::side_number (const T *parent_conn, const EntityType parent_type, const T *child_conn, const int child_num_verts, const int child_dim, int &side_no, int &sense, int &offset)
 
template<typename T >
bool moab::connectivity_match (const T *conn1_i, const T *conn2_i, const int num_vertices, int &direct, int &offset)
 
void MBCN_GetBasis (int *rval)
 get the basis of the numbering system More...
 
void MBCN_SetBasis (const int in_basis)
 set the basis of the numbering system More...
 
void MBCN_EntityTypeName (const int this_type, char *rval, int rval_len)
 return the string type name for this type More...
 
void MBCN_EntityTypeFromName (const char *name, int *rval)
 given a name, find the corresponding entity type More...
 
void MBCN_Dimension (const int t, int *rval)
 return the topological entity dimension More...
 
void MBCN_VerticesPerEntity (const int t, int *rval)
 return the number of (corner) vertices contained in the specified type. More...
 
void MBCN_NumSubEntities (const int t, const int d, int *rval)
 return the number of sub-entities bounding the entity. More...
 
void MBCN_SubEntityType (const int this_type, const int sub_dimension, const int index, int *rval)
 return the type of a particular sub-entity. More...
 
void MBCN_SubEntityVertexIndices (const int this_type, const int sub_dimension, const int sub_index, int sub_entity_conn[])
 return the vertex indices of the specified sub-entity. More...
 
void MBCN_AdjacentSubEntities (const int this_type, const int *source_indices, const int num_source_indices, const int source_dim, const int target_dim, int *index_list, int *num_indices, const int operation_type, int *rval)
 return the vertices of the specified sub entity More...
 
void MBCN_SideNumber (const int parent_type, const int *child_conn_indices, const int child_num_verts, const int child_dim, int *side_no, int *sense, int *offset)
 return the side index represented in the input sub-entity connectivity More...
 
void MBCN_SideNumberInt (const int *parent_conn, const EntityType parent_type, const int *child_conn, const int child_num_verts, const int child_dim, int *side_no, int *sense, int *offset)
 
void MBCN_SideNumberUint (const unsigned int *parent_conn, const EntityType parent_type, const unsigned int *child_conn, const int child_num_verts, const int child_dim, int *side_no, int *sense, int *offset)
 
void MBCN_SideNumberLong (const long *parent_conn, const EntityType parent_type, const long *child_conn, const int child_num_verts, const int child_dim, int *side_no, int *sense, int *offset)
 
void MBCN_SideNumberUlong (const unsigned long *parent_conn, const EntityType parent_type, const unsigned long *child_conn, const int child_num_verts, const int child_dim, int *side_no, int *sense, int *offset)
 
void MBCN_SideNumberVoid (void *const *parent_conn, const EntityType parent_type, void *const *child_conn, const int child_num_verts, const int child_dim, int *side_no, int *sense, int *offset)
 
void MBCN_OppositeSide (const int parent_type, const int child_index, const int child_dim, int *opposite_index, int *opposite_dim, int *rval)
 return the dimension and index of the opposite side, given parent entity type and child dimension and index. This function is only defined for certain types of parent/child types: (Parent, Child dim->Opposite dim): (Tri, 1->0), (Tri, 0->1), (Quad, 1->1), (Quad, 0->0), (Tet, 2->0), (Tet, 1->1), (Tet, 0->2), (Hex, 2->2), (Hex, 1->1)(diagonally across element), (Hex, 0->0) (diagonally across element) All other parent types and child dimensions return an error. More...
 
void MBCN_ConnectivityMatchInt (const int *conn1, const int *conn2, const int num_vertices, int *direct, int *offset, int *rval)
 given two connectivity arrays, determine whether or not they represent the same entity. More...
 
void MBCN_ConnectivityMatchUint (const unsigned int *conn1, const unsigned int *conn2, const int num_vertices, int *direct, int *offset, int *rval)
 
void MBCN_ConnectivityMatchLong (const long *conn1, const long *conn2, const int num_vertices, int *direct, int *offset, int *rval)
 
void MBCN_ConnectivityMatchUlong (const unsigned long *conn1, const unsigned long *conn2, const int num_vertices, int *direct, int *offset, int *rval)
 
void MBCN_ConnectivityMatchVoid (void *const *conn1, void *const *conn2, const int num_vertices, int *direct, int *offset, int *rval)
 
void MBCN_HasMidEdgeNodes (const int this_type, const int num_verts, int *rval)
 true if entities of a given type and number of nodes indicates mid edge nodes are present. More...
 
void MBCN_HasMidFaceNodes (const int this_type, const int num_verts, int *rval)
 true if entities of a given type and number of nodes indicates mid face nodes are present. More...
 
void MBCN_HasMidRegionNodes (const int this_type, const int num_verts, int *rval)
 true if entities of a given type and number of nodes indicates mid region nodes are present. More...
 
void MBCN_HasMidNodes (const int this_type, const int num_verts, int mid_nodes[4])
 true if entities of a given type and number of nodes indicates mid edge/face/region nodes are present. More...
 
void MBCN_HONodeParent (int elem_type, int num_nodes, int ho_node_index, int *parent_dim, int *parent_index)
 given data about an element and a vertex in that element, return the dimension and index of the sub-entity that the vertex resolves. If it does not resolve a sub-entity, either because it's a corner node or it's not in the element, -1 is returned in both return values. More...
 
void MBCN_HONodeIndex (const int this_type, const int num_verts, const int subfacet_dim, const int subfacet_index, int *rval)
 for an entity of this type with num_verts vertices, and a specified subfacet (dimension and index), return the index of the higher order node for that entity in this entity's connectivity array More...
 
template<typename T >
int moab::permute_this (EntityType t, const int dim, T *conn, const int indices_per_ent, const int num_entries)
 
template<typename T >
int moab::rev_permute_this (EntityType t, const int dim, T *conn, const int indices_per_ent, const int num_entries)
 

Macro Definition Documentation

◆ MUC

#define MUC   CN::mUpConnMap[this_type][source_dim][target_dim]

Function Documentation

◆ MBCN_AdjacentSubEntities()

void MBCN_AdjacentSubEntities ( const int  this_type,
const int *  source_indices,
const int  num_source_indices,
const int  source_dim,
const int  target_dim,
int *  index_list,
int *  num_indices,
const int  operation_type,
int *  rval 
)

return the vertices of the specified sub entity

For a specified set of sides of given dimension, return the intersection or union of all sides of specified target dimension adjacent to those sides.

Parameters
this_typeType of entity for which sub-entity connectivity is being queried
source_indicesIndices of sides being queried
num_source_indicesNumber of entries in source_indices
source_dimDimension of source entity
target_dimDimension of target entity
index_listIndices of target entities (returned)
num_indicesNumber of indices of target entities (returned)
operation_typeSpecify either CN::INTERSECT (0) or CN::UNION (1) to get intersection or union of target entity lists over source entities
rvalError code indicating success or failure (returned)

Definition at line 768 of file CN.cpp.

777 {
778  std::vector< int > tmp_index_list;
779  *rval = CN::AdjacentSubEntities( (EntityType)this_type, source_indices, num_source_indices, source_dim, target_dim,
780  tmp_index_list, operation_type );
781  std::copy( tmp_index_list.begin(), tmp_index_list.end(), index_list );
782  *num_indices = tmp_index_list.size();
783 }

◆ MBCN_ConnectivityMatchInt()

void MBCN_ConnectivityMatchInt ( const int *  conn1,
const int *  conn2,
const int  num_vertices,
int *  direct,
int *  offset,
int *  rval 
)

given two connectivity arrays, determine whether or not they represent the same entity.

Parameters
conn1Connectivity array of first entity
conn2Connectivity array of second entity
num_verticesNumber of entries in conn1 and conn2
directIf positive, entities have the same sense (returned)
offsetOffset of conn2's first vertex in conn1
rvalReturns true if conn1 and conn2 match

Definition at line 899 of file CN.cpp.

905 {
906  *rval = CN::ConnectivityMatch( conn1, conn2, num_vertices, *direct, *offset );
907 }

◆ MBCN_ConnectivityMatchLong()

void MBCN_ConnectivityMatchLong ( const long *  conn1,
const long *  conn2,
const int  num_vertices,
int *  direct,
int *  offset,
int *  rval 
)

Definition at line 919 of file CN.cpp.

925 {
926  *rval = CN::ConnectivityMatch( conn1, conn2, num_vertices, *direct, *offset );
927 }

◆ MBCN_ConnectivityMatchUint()

void MBCN_ConnectivityMatchUint ( const unsigned int *  conn1,
const unsigned int *  conn2,
const int  num_vertices,
int *  direct,
int *  offset,
int *  rval 
)

Definition at line 909 of file CN.cpp.

915 {
916  *rval = CN::ConnectivityMatch( conn1, conn2, num_vertices, *direct, *offset );
917 }

◆ MBCN_ConnectivityMatchUlong()

void MBCN_ConnectivityMatchUlong ( const unsigned long *  conn1,
const unsigned long *  conn2,
const int  num_vertices,
int *  direct,
int *  offset,
int *  rval 
)

Definition at line 929 of file CN.cpp.

935 {
936  *rval = CN::ConnectivityMatch( conn1, conn2, num_vertices, *direct, *offset );
937 }

◆ MBCN_ConnectivityMatchVoid()

void MBCN_ConnectivityMatchVoid ( void *const *  conn1,
void *const *  conn2,
const int  num_vertices,
int *  direct,
int *  offset,
int *  rval 
)

Definition at line 939 of file CN.cpp.

945 {
946  *rval = CN::ConnectivityMatch( conn1, conn2, num_vertices, *direct, *offset );
947 }

◆ MBCN_Dimension()

void MBCN_Dimension ( const int  t,
int *  rval 
)

return the topological entity dimension

Definition at line 704 of file CN.cpp.

705 {
706  *rval = CN::Dimension( (EntityType)t );
707 }

◆ MBCN_EntityTypeFromName()

void MBCN_EntityTypeFromName ( const char *  name,
int *  rval 
)

given a name, find the corresponding entity type

Definition at line 698 of file CN.cpp.

699 {
700  *rval = CN::EntityTypeFromName( name );
701 }

◆ MBCN_EntityTypeName()

void MBCN_EntityTypeName ( const int  this_type,
char *  rval,
int  rval_len 
)

return the string type name for this type

Definition at line 689 of file CN.cpp.

690 {
691  const char* rval_tmp = CN::EntityTypeName( (EntityType)this_type );
692  int rval_len_tmp = strlen( rval_tmp );
693  rval_len_tmp = ( rval_len_tmp < rval_len ? rval_len_tmp : rval_len );
694  strncpy( rval, rval_tmp, rval_len_tmp );
695 }

◆ MBCN_GetBasis()

void MBCN_GetBasis ( int *  rval)

get the basis of the numbering system

Definition at line 677 of file CN.cpp.

678 {
679  *rval = CN::GetBasis();
680 }

◆ MBCN_HasMidEdgeNodes()

void MBCN_HasMidEdgeNodes ( const int  this_type,
const int  num_verts,
int *  rval 
)

true if entities of a given type and number of nodes indicates mid edge nodes are present.

Parameters
this_typeType of entity for which sub-entity connectivity is being queried
num_vertsNumber of nodes defining entity
rvalReturns true if this_type combined with num_nodes indicates mid-edge nodes are likely

Definition at line 954 of file CN.cpp.

955 {
956  *rval = CN::HasMidEdgeNodes( (EntityType)this_type, num_verts );
957 }

◆ MBCN_HasMidFaceNodes()

void MBCN_HasMidFaceNodes ( const int  this_type,
const int  num_verts,
int *  rval 
)

true if entities of a given type and number of nodes indicates mid face nodes are present.

Parameters
this_typeType of entity for which sub-entity connectivity is being queried
num_vertsNumber of nodes defining entity
rvalReturns true if this_type combined with num_nodes indicates mid-face nodes are likely

Definition at line 964 of file CN.cpp.

965 {
966  *rval = CN::HasMidFaceNodes( (EntityType)this_type, num_verts );
967 }

◆ MBCN_HasMidNodes()

void MBCN_HasMidNodes ( const int  this_type,
const int  num_verts,
int  mid_nodes[4] 
)

true if entities of a given type and number of nodes indicates mid edge/face/region nodes are present.

Parameters
this_typeType of entity for which sub-entity connectivity is being queried
num_vertsNumber of nodes defining entity
mid_nodesIf mid_nodes[i], i=1..3 is true, indicates that mid-edge (i=1), mid-face (i=2), and/or mid-region (i=3) nodes are likely

Definition at line 985 of file CN.cpp.

986 {
987  return CN::HasMidNodes( (EntityType)this_type, num_verts, mid_nodes );
988 }

◆ MBCN_HasMidRegionNodes()

void MBCN_HasMidRegionNodes ( const int  this_type,
const int  num_verts,
int *  rval 
)

true if entities of a given type and number of nodes indicates mid region nodes are present.

Parameters
this_typeType of entity for which sub-entity connectivity is being queried
num_vertsNumber of nodes defining entity
rvalReturns true if this_type combined with num_nodes indicates mid-region nodes are likely

Definition at line 974 of file CN.cpp.

975 {
976  *rval = CN::HasMidRegionNodes( (EntityType)this_type, num_verts );
977 }

◆ MBCN_HONodeIndex()

void MBCN_HONodeIndex ( const int  this_type,
const int  num_verts,
const int  subfacet_dim,
const int  subfacet_index,
int *  rval 
)

for an entity of this type with num_verts vertices, and a specified subfacet (dimension and index), return the index of the higher order node for that entity in this entity's connectivity array

Parameters
this_typeType of entity being queried
num_vertsNumber of vertices for the entity being queried
subfacet_dimDimension of sub-entity being queried
subfacet_indexIndex of sub-entity being queried
rvalIndex of sub-entity's higher-order node

Definition at line 1012 of file CN.cpp.

1018 {
1019 
1020  *rval = CN::HONodeIndex( (EntityType)this_type, num_verts, subfacet_dim, subfacet_index );
1021 }

◆ MBCN_HONodeParent()

void MBCN_HONodeParent ( int  elem_type,
int  num_nodes,
int  ho_node_index,
int *  parent_dim,
int *  parent_index 
)

given data about an element and a vertex in that element, return the dimension and index of the sub-entity that the vertex resolves. If it does not resolve a sub-entity, either because it's a corner node or it's not in the element, -1 is returned in both return values.

Parameters
elem_typeType of entity being queried
num_nodesThe number of nodes in the element connectivity
ho_node_indexThe position of the HO node in the connectivity list (zero based)
parent_dimDimension of sub-entity high-order node resolves (returned)
parent_indexIndex of sub-entity high-order node resolves (returned)

Definition at line 999 of file CN.cpp.

1000 {
1001  return CN::HONodeParent( (EntityType)elem_type, num_nodes, ho_node_index, *parent_dim, *parent_index );
1002 }

◆ MBCN_NumSubEntities()

void MBCN_NumSubEntities ( const int  t,
const int  d,
int *  rval 
)

return the number of sub-entities bounding the entity.

Definition at line 716 of file CN.cpp.

717 {
718  *rval = CN::NumSubEntities( (EntityType)t, d );
719 }

◆ MBCN_OppositeSide()

void MBCN_OppositeSide ( const int  parent_type,
const int  child_index,
const int  child_dim,
int *  opposite_index,
int *  opposite_dim,
int *  rval 
)

return the dimension and index of the opposite side, given parent entity type and child dimension and index. This function is only defined for certain types of parent/child types: (Parent, Child dim->Opposite dim): (Tri, 1->0), (Tri, 0->1), (Quad, 1->1), (Quad, 0->0), (Tet, 2->0), (Tet, 1->1), (Tet, 0->2), (Hex, 2->2), (Hex, 1->1)(diagonally across element), (Hex, 0->0) (diagonally across element) All other parent types and child dimensions return an error.

Parameters
parent_typeThe type of parent element
parent_typeThe type of parent element
child_indexThe index of the child element
child_dimThe dimension of the child element
opposite_indexThe index of the opposite element
opposite_dimThe dimension of the opposite element
rvalReturns 0 if successful, -1 if not

Definition at line 882 of file CN.cpp.

888 {
889  *rval = CN::OppositeSide( (EntityType)parent_type, child_index, child_dim, *opposite_index, *opposite_dim );
890 }

◆ MBCN_SetBasis()

void MBCN_SetBasis ( const int  in_basis)

set the basis of the numbering system

Definition at line 683 of file CN.cpp.

684 {
685  CN::SetBasis( in_basis );
686 }

◆ MBCN_SideNumber()

void MBCN_SideNumber ( const int  parent_type,
const int *  child_conn_indices,
const int  child_num_verts,
const int  child_dim,
int *  side_no,
int *  sense,
int *  offset 
)

return the side index represented in the input sub-entity connectivity

Parameters
parent_typeEntity type of parent entity
child_conn_indicesChild connectivity to query, specified as indices into the connectivity list of the parent.
child_num_vertsNumber of values in child_conn_indices
child_dimDimension of child entity being queried
side_noSide number of child entity (returned)
senseSense of child entity with respect to order in child_conn (returned)
offsetOffset of child_conn with respect to canonical ordering data (returned)
Returns
status Returns zero if successful, -1 if not

Definition at line 795 of file CN.cpp.

802 {
803  CN::SideNumber( (EntityType)parent_type, child_conn_indices, child_num_verts, child_dim, *side_no, *sense,
804  *offset );
805 }

◆ MBCN_SideNumberInt()

void MBCN_SideNumberInt ( const int *  parent_conn,
const EntityType  parent_type,
const int *  child_conn,
const int  child_num_verts,
const int  child_dim,
int *  side_no,
int *  sense,
int *  offset 
)

Definition at line 807 of file CN.cpp.

815 {
816  moab::side_number( parent_conn, parent_type, child_conn, child_num_verts, child_dim, *side_no, *sense, *offset );
817 }

References moab::side_number().

◆ MBCN_SideNumberLong()

void MBCN_SideNumberLong ( const long *  parent_conn,
const EntityType  parent_type,
const long *  child_conn,
const int  child_num_verts,
const int  child_dim,
int *  side_no,
int *  sense,
int *  offset 
)

Definition at line 831 of file CN.cpp.

839 {
840  moab::side_number( parent_conn, parent_type, child_conn, child_num_verts, child_dim, *side_no, *sense, *offset );
841 }

References moab::side_number().

◆ MBCN_SideNumberUint()

void MBCN_SideNumberUint ( const unsigned int *  parent_conn,
const EntityType  parent_type,
const unsigned int *  child_conn,
const int  child_num_verts,
const int  child_dim,
int *  side_no,
int *  sense,
int *  offset 
)

Definition at line 819 of file CN.cpp.

827 {
828  moab::side_number( parent_conn, parent_type, child_conn, child_num_verts, child_dim, *side_no, *sense, *offset );
829 }

References moab::side_number().

◆ MBCN_SideNumberUlong()

void MBCN_SideNumberUlong ( const unsigned long *  parent_conn,
const EntityType  parent_type,
const unsigned long *  child_conn,
const int  child_num_verts,
const int  child_dim,
int *  side_no,
int *  sense,
int *  offset 
)

Definition at line 843 of file CN.cpp.

851 {
852  moab::side_number( parent_conn, parent_type, child_conn, child_num_verts, child_dim, *side_no, *sense, *offset );
853 }

References moab::side_number().

◆ MBCN_SideNumberVoid()

void MBCN_SideNumberVoid ( void *const *  parent_conn,
const EntityType  parent_type,
void *const *  child_conn,
const int  child_num_verts,
const int  child_dim,
int *  side_no,
int *  sense,
int *  offset 
)

Definition at line 855 of file CN.cpp.

863 {
864  moab::side_number( parent_conn, parent_type, child_conn, child_num_verts, child_dim, *side_no, *sense, *offset );
865 }

References moab::side_number().

◆ MBCN_SubEntityType()

void MBCN_SubEntityType ( const int  this_type,
const int  sub_dimension,
const int  index,
int *  rval 
)

return the type of a particular sub-entity.

Parameters
this_typeType of entity for which sub-entity type is being queried
sub_dimensionTopological dimension of sub-entity whose type is being queried
indexIndex of sub-entity whose type is being queried
Returns
type Entity type of sub-entity with specified dimension and index
Parameters
this_typeType of entity being queried
sub_dimensionDimension of sub-entity being queried
indexIndex of sub-entity being queried
rvalType of sub-entity

Definition at line 730 of file CN.cpp.

731 {
732 
733  *rval = CN::SubEntityType( (EntityType)this_type, sub_dimension, index );
734 }

References moab::index.

◆ MBCN_SubEntityVertexIndices()

void MBCN_SubEntityVertexIndices ( const int  this_type,
const int  sub_dimension,
const int  sub_index,
int  sub_entity_conn[] 
)

return the vertex indices of the specified sub-entity.

Parameters
this_typeType of entity for which sub-entity connectivity is being queried
sub_dimensionDimension of sub-entity
sub_indexIndex of sub-entity
sub_entity_connConnectivity of sub-entity (returned to calling function)

Definition at line 741 of file CN.cpp.

745 {
746  CN::SubEntityVertexIndices( (EntityType)this_type, sub_dimension, sub_index, sub_entity_conn );
747 }

◆ MBCN_VerticesPerEntity()

void MBCN_VerticesPerEntity ( const int  t,
int *  rval 
)

return the number of (corner) vertices contained in the specified type.

Definition at line 710 of file CN.cpp.

711 {
712  *rval = CN::VerticesPerEntity( (EntityType)t );
713 }