SundanceVertexSort.hpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 
00003 /* @HEADER@ */
00004 
00005 #ifndef SUNDANCE_VERTEX_SORT_H
00006 #define SUNDANCE_VERTEX_SORT_H
00007 
00008 
00009 #include "SundanceDefs.hpp"
00010 #include "Teuchos_Array.hpp"
00011 
00012 
00013 namespace Sundance
00014 {
00015 using Teuchos::Array;
00016 
00017 /** */
00018 template <class T> inline
00019 void insertionSort(Teuchos::Array<T>& A)
00020 {
00021   int N = A.size();
00022   for (int i=1; i<N; i++)
00023   {
00024     T val = A[i];
00025     int j = i-1;
00026     bool done = false;
00027     while ( !done )
00028     {
00029       if (A[j] > val)
00030       {
00031         A[j+1]=A[j];
00032         j=j-1;
00033         if ( j<0 ) done = true;
00034       }
00035       else done = true;
00036       A[j+1]=val;
00037     }
00038   }
00039 }
00040  
00041 /* Sort, returning the key associated with the permutation */
00042 void vertexSort(Array<int>& verts, int* key);
00043 
00044 /** Return the permutation that produces the specified key */
00045 void getKeyedPerm(int key, Array<int>& digits);
00046 
00047 /** Compute base^N */
00048 int iPow(int base, int n);
00049 
00050 /** */
00051 int exFacetIndexToUFCFacetIndex(int meshDim, int permKey,
00052   int exFacetID);
00053 
00054 /** */
00055 int ufcFacetIndexToExFacetIndex(int meshDim, int ufcFacetID);
00056 
00057 /** */
00058 int exVertPosToUFCVertPos(int meshDim, int permKey, int exVertPos);
00059 
00060 /** */
00061 int mapExSideToMissingVertex(int dim, int exFaceID);
00062 
00063 /** */
00064 Array<int> exSideVertPos(int dim, int f);
00065 /** */
00066 Array<int> ufcSideVertPos(int dim, int f);
00067 
00068 /** */
00069 Array<int> ufcSide(int f, const Array<int>& verts);
00070 
00071 /** */
00072 Array<int> exSide(int f, const Array<int>& verts);
00073 
00074 
00075 }
00076 
00077 
00078 #endif

Site Contact