# Wrapping polyhedral of a volumetric mesh

How can I calculate and find the wrapping polyhedral of a mesh which is hexahedral? I mean I have to remove inner elements from my mesh and just have the faces and elements that can be seen from outside.

-
Can you explain your question more clearly? I cannot understand what you mean by a "wrapping polyhedral" or what "6 faced elements" are. – Rahul May 9 '12 at 10:27
I added a sentence which I think can help you understand my purpose. I just want to remove nodes and elements that can not be seen from outside of the object. By removing those, we'll have a polyhedral that has wrapped the whole object. if you know an alternative to wrapping polyhedral, please help me clearify it. – Keyhan Asghari May 9 '12 at 10:35
Oh, is this a volumetric mesh? I've always heard the term "hexahedral mesh" used in this context, rather than "6 faced elements". But in that case I don't understand how removing certain nodes and elements would leave you with a polyhedron rather than a smaller collection of volumetric elements. (Perhaps you could include a diagram to show an example mesh and what output you expect to get?) – Rahul May 9 '12 at 10:52
thanks so much, I applied your clarification. – Keyhan Asghari May 9 '12 at 11:07

Here is one subroutine of extracting surface elements information from a tetrahedral mesh:

Suppose you have a tetrahedral triangulation for a simply-connected polyhedral domain in $\mathbb{R}^3$, also in order to make things work, we have to assume that there are no "hanging vertices": $$\mathcal{T} = \text{the sequence of } \{T_{\alpha}: T_{\alpha} \text{ is the convex hull of } V^{\alpha}_1 V^{\alpha}_2 V^{\alpha}_3 V^{\alpha}_4\}$$

Find all the faces(lots of repetitions due to the neighboring of the tetrahedra) of this mesh: $$\mathscr{F} =\text{the sequence of } \{F_{\beta} = V_i V_j V_k: (i,j,k) \text{ is a combination of } (1,2,3,4)\}$$ Preferably we list $\mathscr{F}$ as: first the face opposite to the first vertex(local numbering) $V_2 V_3 V_4$, then the face opposite to the second vertex $V_1 V_3 V_4$, etc.

Now let $\mathcal{F}$ be the sequence of unique faces extracted from $\mathscr{F}$, such that $$\mathcal{F}^{i} = \mathscr{F}^{m_i}, \text{and }\quad \mathscr{F}^{j} = \mathcal{F}^{n_j}$$ where $\{m_i\}$ and $\{n_j\}$ are two auxiliary index sets, $|\{m_i\}|= |\mathcal{F}|$ and the value of $m_i$ ranges from $1$ to $4|\mathcal{T}|$, $|\{n_j\}| = |\mathscr{F}| = 4|\mathcal{T}|$ while the value of $n_j$ only ranges from $1$ to $|\mathcal{F}|$. The $i$-th face in $\mathcal{F}$ is the $m_i$-th face in $\mathscr{F}$, where $\mathscr{F}^{m_i}$ is the first occurrence of $\mathcal{F}^{i}$ in $\mathscr{F}$. Also the $j$-th face in $\mathscr{F}$ is the $n_j$-th face in $\mathcal{F}$. Now we define yet another auxiliary index $l$ such that $$l_{n_j} = j$$ Last step, for $k = 1,\cdots, |\mathcal{F}|$, we have: $$\text{If } \; l_k = m_k, \text{ then } \mathcal{F}^k=\{F_k\} \text{ is a boundary face.}$$ Knowing this $k$, we could trace back to $m_k$, let $r$ be the remainder of $m_k$ divided by $|\mathcal{T}|$, then $\mathcal{T}^r = \{T_r\}$ is a boundary element.

TL;DR: Okay, looks pretty messy and not intuitive, but what this algorithm does is:

To find the faces only appearing once in the array of element-wise listed faces.

If we list faces tetrahedron by tetrahedron, for a face that only appears once in this sequence(array), this face must reside exclusively on just one tetrahedron. If the face is only shared by one tetrahedron, it must be a boundary face, otherwise any inter-tetrahedra face shall be shared by two neighboring tetrahedra. Once we get the boundary faces, find the tetrahedron having these faces, we have what you meant by wrapping polyhedra.

And this algorithm can be pretty easily adapted to hexahedral mesh.

-
thanks for such a big help. Should I implement it by myself or there are some libraries for this algorithm? – Keyhan Asghari May 11 '12 at 10:43
@KeyhanAsghari Check geuz.org/gmsh/doc/texinfo/gmsh.pdf out, it could extract boundary layer from a volumetric mesh. – Shuhao Cao May 11 '12 at 13:17