ug4
ug::oct_rules Namespace Reference

Functions

bool IsRegularRefRule (const int edgeMarks)
 returns true if the specified edgeMarks would lead to a regular refinement More...
 
int Refine (int *newIndsOut, int *newEdgeVrts, bool &newCenterOut, vector3 *corners, bool *)
 
void RotateOctahedron (int vrtsOut[NUM_VERTICES], int steps)
 Output are the vertices of a octahedron rotated around its vertical axis. More...
 

Variables

const int BOTTOM_VERTEX = 0
 the octhedrons bottom More...
 
const int EDGE_FROM_VRTS [6][6]
 Associates the index of the connecting edge with each tuple of vertices. More...
 
const int EDGE_VRT_INDS [][2]
 the local vertex indices of the given edge More...
 
const int FACE_CONTAINS_EDGE [][12]
 tells whether the i-th face contains the j-th edge More...
 
const int FACE_EDGE_INDS [8][4]
 returns the j-th edge of the i-th face More...
 
const int FACE_FROM_EDGES [][12]
 given two edges, the table returns the face, which contains both (or -1) More...
 
const int FACE_FROM_VRTS [6][6][6]
 Associates the index of the connecting face with each triple of vertices. More...
 
const int FACE_VRT_INDS [][4]
 the local vertex indices of the given face More...
 
const int MAX_NUM_INDS_OUT = 82
 
const int NUM_EDGES = 12
 
const int NUM_FACES = 8
 
const int NUM_QUADS = 0
 
const int NUM_TRIS = 8
 
const int NUM_VERTICES = 6
 
const int OPPOSED_OBJECT [][NUM_VERTICES] = {{0, 5}, {0, 3}, {0, 4}, {0, 1}, {0, 2}, {0, 0}}
 
const int TOP_VERTEX = 5
 the octhedrons top More...
 

Function Documentation

◆ IsRegularRefRule()

bool ug::oct_rules::IsRegularRefRule ( const int  edgeMarks)

returns true if the specified edgeMarks would lead to a regular refinement

A regular refinement leads to new elements which are all similar to the original element. I.e. which are of the same type and which have similar angles.

Note
this method does not perform refinement. Use 'Refine' with the specified edges instead.
Parameters
edgeMarksIf the i-th edge shall be refined, the expression 'edgeMarks & (1<<i) != 0' has to be true. You can specify multiple refine-edges using or-combinations. E.g., 'edgeMarks = (1<<i) | (1<<j)' would indicate that the i-th and the j-th edge shall be refined.

◆ Refine()

int ug::oct_rules::Refine ( int *  newIndsOut,
int *  newEdgeVrts,
bool &  newCenterOut,
vector3 corners = NULL,
bool *  isSnapPoint = NULL 
)

returns an array of integers, which contains the indices of the objects resulting from the refinement of a octahedron.

Parameters
newIndsOutArray which has to be of size MAX_NUM_INDS_OUT. When the algorithm is done, the array will contain sequences of integers: {{gridObjectID, ind1, ind2, ...}, ...}. gridObjectID is a constant enumerated in GridObjectID and describes the type of the grid-object that is built from the following set of corner indices. Old vertices are referenced by their local index. Vertices created on an edge are indexed by the index of the edge + NUM_VERTICES. If an inner vertex has to be created, it is referenced by NUM_VERTICES + NUM_EDGES + NUM_FACES.
newEdgeVrtsArray of size NUM_EDGES, which has to contain 1 for each edge, which shall be refined and 0 for each edge, which won't be refined.
newCenterOutIf the refinement-rule requires a center vertex, then this parameter will be set to true. If not, it is set to false.
corners(optional) List of the six corner positions of the octahedron. If it is specified, it is used during full refinement (all edges marked), to determine the best (shortest) diagonal along which the octahedrons are implicitly subdivided into tetrahedrons. Corners are only considered during full refinement and are thus irrelevant during recursive refinement of other elements.
isSnapPoint(optional) An array of size NUM_VERTICES. If all entries are set to 'false' the behaviour is the same as if the array wasn't specified. If a corner of a quadrilateral is a snap-point and if edges of that quadrilateral are refined, then only new edges connected to the snap-point are introduced. Note that only special snap-point constellations are supported.
Returns
the number of entries written to newIndsOut or 0, if the refinement could not be performed.

References EDGE_VRT_INDS, FACE_EDGE_INDS, FACE_VRT_INDS, ug::GOID_OCTAHEDRON, ug::GOID_TETRAHEDRON, NUM_EDGES, NUM_FACES, NUM_VERTICES, and ug::shared_rules::RecursiveRefine().

◆ RotateOctahedron()

void ug::oct_rules::RotateOctahedron ( int  vrtsOut[NUM_VERTICES],
int  steps 
)

Output are the vertices of a octahedron rotated around its vertical axis.

Variable Documentation

◆ BOTTOM_VERTEX

const int ug::oct_rules::BOTTOM_VERTEX = 0

the octhedrons bottom

◆ EDGE_FROM_VRTS

const int ug::oct_rules::EDGE_FROM_VRTS[6][6]
Initial value:
= { {-1, 0, 1, 2, 3, -1}, {0, -1, 4, -1, 7, 8}, {1, 4, -1, 5, -1, 9},
{2, -1, 5, -1, 6, 10}, {3, 7, -1, 6, -1, 11}, {-1, 8, 9, 10, 11, -1}}

Associates the index of the connecting edge with each tuple of vertices.

Use two vertex indices to index into this table to retrieve the index of their connecting edge.

◆ EDGE_VRT_INDS

const int ug::oct_rules::EDGE_VRT_INDS[][2]
Initial value:
= { {0, 1}, {0, 2}, {0, 3}, {0, 4},
{1, 2}, {2, 3}, {3, 4}, {4, 1},
{1, 5}, {2, 5}, {3, 5}, {4, 5}}

the local vertex indices of the given edge

Referenced by Refine().

◆ FACE_CONTAINS_EDGE

const int ug::oct_rules::FACE_CONTAINS_EDGE[][12]
Initial value:
= { {1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0},
{0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0},
{0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0},
{1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0},
{0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1},
{0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1}}

tells whether the i-th face contains the j-th edge

◆ FACE_EDGE_INDS

const int ug::oct_rules::FACE_EDGE_INDS[8][4]
Initial value:
= { {0, 4, 1, -1}, {1, 5, 2, -1}, {2, 6, 3, -1}, {3, 7, 0, -1},
{8, 9, 4, -1}, {9, 10, 5, -1}, {10, 11, 6, -1}, {11, 8, 7, -1}}

returns the j-th edge of the i-th face

Referenced by Refine().

◆ FACE_FROM_EDGES

const int ug::oct_rules::FACE_FROM_EDGES[][12]
Initial value:
= { {0, 0, -1, 3, 0, -1, -1, 3, -1, -1, -1, -1}, {0, 0, 1, -1, 0, 1, -1, -1, -1, -1, -1, -1},
{-1, 1, 1, 2, -1, 1, 2, -1, -1, -1, -1, -1}, {3, -1, 2, 2, -1, -1, 2, 3, -1, -1, -1, -1},
{0, 0, -1, -1, 0, -1, -1, -1, 4, 4, -1, -1}, {-1, 1, 1, -1, -1, 1, -1, -1, -1, 5, 5, -1},
{-1, -1, 2, 2, -1, -1, 2, -1, -1, -1, 6, 6}, {3, -1, -1, 3, -1, -1, -1, 3, 7, -1, -1, 7},
{-1, -1, -1, -1, 4, -1, -1, 7, 4, 4, -1, 7}, {-1, -1, -1, -1, 4, 5, -1, -1, 4, 4, 5, -1},
{-1, -1, -1, -1, -1, 5, 6, -1, -1, 5, 5, 6}, {-1, -1, -1, -1, -1, -1, 6, 7, 7, -1, 6, 6}}

given two edges, the table returns the face, which contains both (or -1)

◆ FACE_FROM_VRTS

const int ug::oct_rules::FACE_FROM_VRTS[6][6][6]
Initial value:
= { {{-1, -1, -1, -1, -1, -1}, {-1, -1, 0, -1, 3, -1}, {-1, 0, -1, 1, -1, -1}, {-1, -1, 1, -1, 2, -1}, {-1, 3, -1, 2, -1, -1}, {-1, -1, -1, -1, -1, -1}},
{{-1, -1, 0, -1, 3, -1}, {-1, -1, -1, -1, -1, -1}, {0, -1, -1, -1, -1, 4}, {-1, -1, -1, -1, -1, -1}, {3, -1, -1, -1, -1, 7}, {-1, -1, 4, -1, 7, -1}},
{{-1, 0, -1, 1, -1, -1}, {0, -1, -1, -1, -1, 4}, {-1, -1, -1, -1, -1, -1}, {1, -1, -1, -1, -1, 5}, {-1, -1, -1, -1, -1, -1}, {-1, 4, -1, 5, -1, -1}},
{{-1, -1, 1, -1, 2, -1}, {-1, -1, -1, -1, -1, -1}, {1, -1, -1, -1, -1, 5}, {-1, -1, -1, -1, -1, -1}, {2, -1, -1, -1, -1, 6}, {-1, -1, 5, -1, 6, -1}},
{{-1, 3, -1, 2, -1, -1}, {3, -1, -1, -1, -1, 7}, {-1, -1, -1, -1, -1, -1}, {2, -1, -1, -1, -1, 6}, {-1, -1, -1, -1, -1, -1}, {-1, 7, -1, 6, -1, -1}},
{{-1, -1, -1, -1, -1, -1}, {-1, -1, 4, -1, 7, -1}, {-1, 4, -1, 5, -1, -1}, {-1, -1, 5, -1, 6, -1}, {-1, 7, -1, 6, -1, -1}, {-1, -1, -1, -1, -1, -1}}}

Associates the index of the connecting face with each triple of vertices.

Use three vertex indices to index into this table to retrieve the index of their connecting face.

◆ FACE_VRT_INDS

const int ug::oct_rules::FACE_VRT_INDS[][4]
Initial value:
= { {0, 1, 2, -1}, {0, 2, 3, -1}, {0, 3, 4, -1}, {0, 4, 1, -1},
{1, 5, 2, -1}, {2, 5, 3, -1}, {3, 5, 4, -1}, {4, 5, 1, -1}}

the local vertex indices of the given face

Referenced by Refine().

◆ MAX_NUM_INDS_OUT

const int ug::oct_rules::MAX_NUM_INDS_OUT = 82

◆ NUM_EDGES

const int ug::oct_rules::NUM_EDGES = 12

Referenced by Refine().

◆ NUM_FACES

const int ug::oct_rules::NUM_FACES = 8

Referenced by Refine().

◆ NUM_QUADS

const int ug::oct_rules::NUM_QUADS = 0

◆ NUM_TRIS

const int ug::oct_rules::NUM_TRIS = 8

◆ NUM_VERTICES

const int ug::oct_rules::NUM_VERTICES = 6

Referenced by Refine().

◆ OPPOSED_OBJECT

const int ug::oct_rules::OPPOSED_OBJECT[][NUM_VERTICES] = {{0, 5}, {0, 3}, {0, 4}, {0, 1}, {0, 2}, {0, 0}}

for each vertex, a pair containing the object type (0: vrt, 1: edge, 2: face) and an index into the associated array, which describe the object which lies on the opposite side of the tetrahedron, to a given vertex.

◆ TOP_VERTEX

const int ug::oct_rules::TOP_VERTEX = 5

the octhedrons top