
<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
      --><title>Data Structure: Lowest Order Edge Element</title><meta name="generator" content="MATLAB 7.12"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2012-07-14"><meta name="DC.source" content="dof3edgedoc.m"><style type="text/css">

body {
  background-color: white;
  margin:10px;
}

h1 {
  color: #990000; 
  font-size: x-large;
}

h2 {
  color: #990000;
  font-size: medium;
}

/* Make the text shrink to fit narrow windows, but not stretch too far in 
wide windows. */ 
p,h1,h2,div.content div {
  max-width: 600px;
  /* Hack for IE6 */
  width: auto !important; width: 600px;
}

pre.codeinput {
  background: #EEEEEE;
  padding: 10px;
}
@media print {
  pre.codeinput {word-wrap:break-word; width:100%;}
} 

span.keyword {color: #0000FF}
span.comment {color: #228B22}
span.string {color: #A020F0}
span.untermstring {color: #B20000}
span.syscmd {color: #B28C00}

pre.codeoutput {
  color: #666666;
  padding: 10px;
}

pre.error {
  color: red;
}

p.footer {
  text-align: right;
  font-size: xx-small;
  font-weight: lighter;
  font-style: italic;
  color: gray;
}

  </style></head><body><div class="content"><h1>Data Structure: Lowest Order Edge Element</h1><!--introduction--><p>We explain degree of freedoms for the lowest order edge element on tetrahedrons. The required data structure can be constructured by</p><pre>  [elem2dof,dofSign,edge] = dof3edge(elem)</pre><p>Copyright (C) Long Chen. See COPYRIGHT.txt for details.</p><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#1">Local Labeling of DOFs</a></li><li><a href="#3">Orientation of Edges</a></li><li><a href="#5">An Example</a></li></ul></div><h2>Local Labeling of DOFs<a name="1"></a></h2><pre class="codeinput">dof3edgedocscript1
</pre><img vspace="5" hspace="5" src="dof3edgedoc_01.png" alt=""> <p>The six dofs associated to edges in a tetrahedron is sorted in the ordering [1 2; 1 3; 1 4; 2 3; 2 4; 3 4]. Here [1 2 3 4] are local indices of vertices.</p><p>For a triangulation consisting of several tetrahedrons, all local edges are collected and the duplication is eliminated to form edges of the triangulation. Therefore the global indices of edges is different with the local one. elem2dof(:,1:6) records the mapping from local to global indices.</p><pre class="codeinput">display(elem2dof)
</pre><pre class="codeoutput">
elem2dof =

     1    12     5    20    11     4

</pre><h2>Orientation of Edges<a name="3"></a></h2><pre class="codeinput">dof3edgedocscript2
</pre><img vspace="5" hspace="5" src="dof3edgedoc_02.png" alt=""> <p>The edge [i,j] is orientated in the direction such that i&lt;j, where i,j are <b>global</b> indices. The edges formed by local indices may not be consistent with this orientation. Therefore dofSign is used to indicate the consistency.</p><p>The nodal indices in the left figure is local while that in the right is the global one. The local direction and global direction of edges is also indicated by different edge vectors.</p><pre class="codeinput">display(elem2dof)
display(dofSign)
</pre><pre class="codeoutput">
elem2dof =

     1     2     3     4     5     6


dofSign =

     1     1    -1    -1    -1    -1

</pre><h2>An Example<a name="5"></a></h2><pre class="codeinput">node = [-1,-1,-1; 1,-1,-1; 1,1,-1; -1,1,-1; -1,-1,1; 1,-1,1; 1,1,1; -1,1,1];
elem = [1,2,3,7; 1,6,2,7; 1,5,6,7; 1,8,5,7; 1,4,8,7; 1,3,4,7];
[elem2dof,dofSign,edge] = dof3edge(elem);
figure(1); clf;
showmesh3(node,elem,[],<span class="string">'FaceAlpha'</span>,0.25);
view(-30,10);
findedge3(node,edge);
findelem3(node,elem,[1 3]');
display(elem2dof);
display(dofSign);
</pre><pre class="codeoutput">
elem2dof =

           1           2           6           8          10          12
           5           1           6           9          18          10
           4           5           6          15          16          18
           7           4           6          17          19          16
           3           7           6          14          13          19
           2           3           6          11          12          13


dofSign =

    1    1    1    1    1    1
    1    1    1   -1    1    1
    1    1    1    1    1    1
    1    1    1   -1   -1    1
    1    1    1    1    1   -1
    1    1    1    1    1    1

</pre><img vspace="5" hspace="5" src="dof3edgedoc_03.png" alt=""> <p class="footer"><br>
      Published with MATLAB&reg; 7.12<br></p></div><!--
##### SOURCE BEGIN #####
%% Data Structure: Lowest Order Edge Element
% We explain degree of freedoms for the lowest order edge element on
% tetrahedrons. The required data structure can be constructured by
%
%    [elem2dof,dofSign,edge] = dof3edge(elem)
%
% Copyright (C) Long Chen. See COPYRIGHT.txt for details. 

%% Local Labeling of DOFs
dof3edgedocscript1
%%
% The six dofs associated to edges in a tetrahedron is sorted in the
% ordering [1 2; 1 3; 1 4; 2 3; 2 4; 3 4]. Here [1 2 3 4] are local indices
% of vertices.
%
% For a triangulation consisting of several tetrahedrons, all local edges
% are collected and the duplication is eliminated to form edges of the
% triangulation. Therefore the global indices of edges is different with
% the local one. elem2dof(:,1:6) records the mapping from local to global
% indices.
display(elem2dof)

%% Orientation of Edges
dof3edgedocscript2
%%
% The edge [i,j] is orientated in the direction such that i<j, where i,j
% are *global* indices. The edges formed by local indices may not be
% consistent with this orientation. Therefore dofSign is used to indicate
% the consistency.
%
% The nodal indices in the left figure is local while that in the right is
% the global one. The local direction and global direction of edges is also
% indicated by different edge vectors.
display(elem2dof)
display(dofSign)

%% An Example
node = [-1,-1,-1; 1,-1,-1; 1,1,-1; -1,1,-1; -1,-1,1; 1,-1,1; 1,1,1; -1,1,1]; 
elem = [1,2,3,7; 1,6,2,7; 1,5,6,7; 1,8,5,7; 1,4,8,7; 1,3,4,7];
[elem2dof,dofSign,edge] = dof3edge(elem);
figure(1); clf;
showmesh3(node,elem,[],'FaceAlpha',0.25);
view(-30,10);
findedge3(node,edge);
findelem3(node,elem,[1 3]');
display(elem2dof);
display(dofSign);

##### SOURCE END #####
--></body></html>