Mesh Oriented datABase  (version 5.5.1)
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

Parameters
parent_connConnectivity of parent entity
parent_typeEntity type of parent entity
sub_dimensionDimension of sub-entity being queried
sub_indexIndex of sub-entity being queried
sub_entity_connConnectivity of sub-entity, based on parent_conn and canonical ordering for parent_type
num_sub_verticesNumber of vertices in 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.
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 772 of file CN.cpp.

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

◆ 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
Returns
rval Returns true if conn1 and conn2 match

Definition at line 901 of file CN.cpp.

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

◆ MBCN_ConnectivityMatchLong()

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

Definition at line 921 of file CN.cpp.

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

◆ 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 911 of file CN.cpp.

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

◆ 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 931 of file CN.cpp.

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

◆ MBCN_ConnectivityMatchVoid()

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

Definition at line 941 of file CN.cpp.

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

◆ 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
Returns
int Returns true if this_type combined with num_nodes indicates mid-edge nodes are likely

Definition at line 956 of file CN.cpp.

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

◆ 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
Returns
int Returns true if this_type combined with num_nodes indicates mid-face nodes are likely

Definition at line 966 of file CN.cpp.

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

◆ 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 987 of file CN.cpp.

988 {
989  return CN::HasMidNodes( (EntityType)this_type, num_verts, mid_nodes );
990 }

◆ 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
Returns
int Returns true if this_type combined with num_nodes indicates mid-region nodes are likely

Definition at line 976 of file CN.cpp.

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

◆ 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
Returns
index Index of sub-entity's higher-order node

Definition at line 1014 of file CN.cpp.

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

◆ 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 1001 of file CN.cpp.

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

◆ 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
child_typeThe type of child element
child_indexThe index of the child element
opposite_indexThe index of the opposite element
Returns
status Returns 0 if successful, -1 if not

Definition at line 884 of file CN.cpp.

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

◆ 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 799 of file CN.cpp.

806 {
807  CN::SideNumber( (EntityType)parent_type, child_conn_indices, child_num_verts, child_dim, *side_no, *sense,
808  *offset );
809 }

◆ 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 811 of file CN.cpp.

819 {
820  moab::side_number( parent_conn, parent_type, child_conn, child_num_verts, child_dim, *side_no, *sense, *offset );
821 }

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 835 of file CN.cpp.

843 {
844  moab::side_number( parent_conn, parent_type, child_conn, child_num_verts, child_dim, *side_no, *sense, *offset );
845 }

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 823 of file CN.cpp.

831 {
832  moab::side_number( parent_conn, parent_type, child_conn, child_num_verts, child_dim, *side_no, *sense, *offset );
833 }

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 847 of file CN.cpp.

855 {
856  moab::side_number( parent_conn, parent_type, child_conn, child_num_verts, child_dim, *side_no, *sense, *offset );
857 }

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 859 of file CN.cpp.

867 {
868  moab::side_number( parent_conn, parent_type, child_conn, child_num_verts, child_dim, *side_no, *sense, *offset );
869 }

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

Definition at line 726 of file CN.cpp.

728 {
729 
730  *rval = CN::SubEntityType( (EntityType)this_type, sub_dimension, index );
731 }

◆ 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 738 of file CN.cpp.

742 {
743  CN::SubEntityVertexIndices( (EntityType)this_type, sub_dimension, sub_index, sub_entity_conn );
744 }

◆ 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 }