Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Typedefs | Enumerations | Functions | Variables
Nektar::Utilities Namespace Reference

Classes

struct  cmpop
 
struct  DerivUtil
 
struct  EdgeInfo
 
struct  ElmtConfigHash
 
class  ElUtil
 
class  ElUtilJob
 
class  InputGmsh
 
class  InputMCF
 
class  InputNek
 
class  InputNek5000
 
class  InputNekpp
 
class  InputPly
 Converter for Ply files. More...
 
class  InputSem
 
class  InputStar
 Converter for VTK files. More...
 
class  InputSwan
 Converter for Swansea mesh format. More...
 
class  InputTec
 Converter for VTK files. More...
 
class  InputVtk
 Converter for VTK files. More...
 
class  NodalUtilTriMonomial
 
struct  NodeComparator
 
class  NodeOpti
 
class  NodeOpti1D3D
 
class  NodeOpti2D2D
 
class  NodeOpti2D3D
 
class  NodeOpti3D3D
 
class  NodeOptiJob
 
class  OutputGmsh
 Converter for Gmsh files. More...
 
class  OutputNekpp
 Converter for Gmsh files. More...
 
class  OutputSTL
 
class  OutputVtk
 Converter for Gmsh files. More...
 
class  ProcessBL
 This processing module calculates the Jacobian of elements using SpatialDomains::GeomFactors and the Element::GetGeom method. For now it simply prints a list of elements which have negative Jacobian. More...
 
class  ProcessCurve
 
class  ProcessCurvedEdges
 
class  ProcessCyl
 
class  ProcessDetectSurf
 This processing module calculates the Jacobian of elements using SpatialDomains::GeomFactors and the Element::GetGeom method. For now it simply prints a list of elements which have negative Jacobian. More...
 
class  ProcessExtractSurf
 This processing module calculates the Jacobian of elements using SpatialDomains::GeomFactors and the Element::GetGeom method. For now it simply prints a list of elements which have negative Jacobian. More...
 
class  ProcessExtractTetPrismInterface
 Module to extract interface between prismatic and tetrahedral elements. More...
 
class  ProcessExtrude
 This processing module extrudes a 2d mesh in the z direction. More...
 
class  ProcessInsertSurface
 This processing module calculates the Jacobian of elements using SpatialDomains::GeomFactors and the Element::GetGeom method. For now it simply prints a list of elements which have negative Jacobian. More...
 
class  ProcessJac
 This processing module calculates the Jacobian of elements using SpatialDomains::GeomFactors and the Element::GetGeom method. For now it simply prints a list of elements which have negative Jacobian. More...
 
class  ProcessLinear
 This processing module removes all the high-order information from the mesh leaving just the linear elements. More...
 
class  ProcessLinkCheck
 This processing module calculates the Jacobian of elements using SpatialDomains::GeomFactors and the Element::GetGeom method. For now it simply prints a list of elements which have negative Jacobian. More...
 
class  ProcessOptiExtract
 
class  ProcessPerAlign
 
class  ProcessScalar
 This processing module calculates the Jacobian of elements using SpatialDomains::GeomFactors and the Element::GetGeom method. For now it simply prints a list of elements which have negative Jacobian. More...
 
class  ProcessSpherigon
 
class  ProcessTetSplit
 This processing module calculates the Jacobian of elements using SpatialDomains::GeomFactors and the Element::GetGeom method. For now it simply prints a list of elements which have negative Jacobian. More...
 
class  ProcessVarOpti
 
struct  Residual
 
struct  SplitEdgeHelper
 
struct  SplitMapHelper
 

Typedefs

typedef boost::tuple< int, int,
int > 
Mode
 
typedef boost::shared_ptr
< InputPly
InputPlySharedPtr
 
typedef std::pair< int, int > ipair
 
typedef boost::shared_ptr
< DerivUtil
DerivUtilSharedPtr
 
typedef boost::shared_ptr
< Residual
ResidualSharedPtr
 
typedef boost::shared_ptr< ElUtilElUtilSharedPtr
 
typedef boost::shared_ptr
< NodeOpti
NodeOptiSharedPtr
 
typedef
LibUtilities::NekFactory< int,
NodeOpti, NodeSharedPtr,
std::vector< ElUtilSharedPtr >
, ResidualSharedPtr, std::map
< LibUtilities::ShapeType,
DerivUtilSharedPtr >, optiType
NodeOptiFactory
 

Enumerations

enum  NekCurve { eFile, eRecon }
 
enum  optiType { eLinEl, eWins, eRoca, eHypEl }
 

Functions

std::vector< int > quadTensorNodeOrdering (const std::vector< int > &nodes, int n)
 Reorder Gmsh nodes so that they appear in a tensor product format suitable for the interior of a Nektar++ quadrilateral. More...
 
std::vector< int > triTensorNodeOrdering (const std::vector< int > &nodes, int n)
 Reorder Gmsh nodes so that they appear in a "tensor product" format suitable for the interior of a Nektar++ triangle. More...
 
std::vector< int > tetTensorNodeOrdering (const std::vector< int > &nodes, int n)
 Reorder Gmsh nodes so that they appear in a "tensor product" format suitable for the interior of a Nektar++ tetrahedron. More...
 
std::vector< int > prismTensorNodeOrdering (const std::vector< int > &nodes, int n)
 Reorder Gmsh nodes so that they appear in a "tensor product" format suitable for the interior of a Nektar++ prism. This routine is specifically designed for interior Gmsh nodes only. More...
 
std::vector< int > hexTensorNodeOrdering (const std::vector< int > &nodes, int n)
 Reorder Gmsh nodes so that they appear in a "tensor product" format suitable for the interior of a Nektar++ hexahedron. More...
 
static void PrismLineFaces (int prismid, map< int, int > &facelist, vector< vector< int > > &FacesToPrisms, vector< vector< int > > &PrismsToFaces, vector< bool > &PrismDone)
 
static void PrismLineFaces (int prismid, map< int, int > &facelist, vector< vector< int > > &FacesToPrisms, vector< vector< int > > &PrismsToFaces, vector< bool > &PrismDone)
 
bool operator== (NekMeshUtils::ElmtConfig const &p1, NekMeshUtils::ElmtConfig const &p2)
 
template<typename T >
void TestElmts (SpatialDomains::MeshGraphSharedPtr &graph)
 
int ** helper2d (int lda, int arr[][2])
 
int ** helper2d (int lda, int arr[][4])
 
template<int DIM>
NekDouble Determinant (NekDouble jac[][DIM])
 Calculate determinant of input matrix. More...
 
template<>
NekDouble Determinant< 2 > (NekDouble jac[][2])
 
template<>
NekDouble Determinant< 3 > (NekDouble jac[][3])
 
template<int DIM>
void InvTrans (NekDouble in[][DIM], NekDouble out[][DIM])
 Calculate inverse transpose of input matrix. More...
 
template<>
void InvTrans< 2 > (NekDouble in[][2], NekDouble out[][2])
 
template<>
void InvTrans< 3 > (NekDouble in[][3], NekDouble out[][3])
 
template<int DIM>
NekDouble ScalarProd (NekDouble(&in1)[DIM], NekDouble(&in2)[DIM])
 Calculate Scalar product of input vectors. More...
 
template<>
NekDouble ScalarProd< 2 > (NekDouble(&in1)[2], NekDouble(&in2)[2])
 
template<>
NekDouble ScalarProd< 3 > (NekDouble(&in1)[3], NekDouble(&in2)[3])
 
template<int DIM>
void EMatrix (NekDouble in[][DIM], NekDouble out[][DIM])
 Calculate $ E = F^\top F - I $ tensor used in derivation of linear elasticity gradients. More...
 
template<>
void EMatrix< 2 > (NekDouble in[][2], NekDouble out[][2])
 
template<>
void EMatrix< 3 > (NekDouble in[][3], NekDouble out[][3])
 
template<int DIM>
NekDouble FrobProd (NekDouble in1[][DIM], NekDouble in2[][DIM])
 Calculate Frobenius inner product of input matrices. More...
 
template<>
NekDouble FrobProd< 2 > (NekDouble in1[][2], NekDouble in2[][2])
 
template<>
NekDouble FrobProd< 3 > (NekDouble in1[][3], NekDouble in2[][3])
 
template<int DIM>
NekDouble FrobeniusNorm (NekDouble inarray[][DIM])
 Calculate Frobenius norm $ \| A \|_f ^2 $ of a matrix $ A $. More...
 
template<>
NekDouble FrobeniusNorm< 2 > (NekDouble inarray[][2])
 
template<>
NekDouble FrobeniusNorm< 3 > (NekDouble inarray[][3])
 
NodeOptiFactoryGetNodeOptiFactory ()
 

Variables

boost::mutex mtx2
 
boost::mutex mtx
 

Typedef Documentation

typedef boost::shared_ptr< DerivUtil > Nektar::Utilities::DerivUtilSharedPtr

Definition at line 51 of file ElUtil.h.

typedef boost::shared_ptr<ElUtil> Nektar::Utilities::ElUtilSharedPtr

Definition at line 114 of file ElUtil.h.

typedef boost::shared_ptr<InputPly> Nektar::Utilities::InputPlySharedPtr

Definition at line 68 of file InputPly.h.

typedef std::pair<int, int> Nektar::Utilities::ipair

Definition at line 55 of file ProcessTetSplit.cpp.

typedef boost::tuple<int, int, int> Nektar::Utilities::Mode

Definition at line 221 of file InputGmsh.cpp.

Definition at line 140 of file NodeOpti.h.

typedef boost::shared_ptr<NodeOpti> Nektar::Utilities::NodeOptiSharedPtr

Definition at line 135 of file NodeOpti.h.

typedef boost::shared_ptr< Residual > Nektar::Utilities::ResidualSharedPtr

Definition at line 54 of file ElUtil.h.

Enumeration Type Documentation

Enumerator
eFile 
eRecon 

Definition at line 51 of file InputNek.h.

Enumerator
eLinEl 
eWins 
eRoca 
eHypEl 

Definition at line 61 of file ProcessVarOpti.h.

Function Documentation

template<int DIM>
NekDouble Nektar::Utilities::Determinant ( NekDouble  jac[][DIM])
inline

Calculate determinant of input matrix.

Specialised versions of this function exist only for 2x2 and 3x3 matrices.

Parameters
jacInput matrix
Returns
Jacobian of jac.

Definition at line 55 of file Evaluator.hxx.

Referenced by Nektar::Utilities::NodeOpti::GetFunctional().

56 {
57  return 0.0;
58 }
template<>
NekDouble Nektar::Utilities::Determinant< 2 > ( NekDouble  jac[][2])
inline

Definition at line 60 of file Evaluator.hxx.

Referenced by InvTrans< 2 >().

61 {
62  return jac[0][0] * jac[1][1] - jac[0][1] * jac[1][0];
63 }
template<>
NekDouble Nektar::Utilities::Determinant< 3 > ( NekDouble  jac[][3])
inline

Definition at line 65 of file Evaluator.hxx.

Referenced by InvTrans< 3 >(), and Nektar::Utilities::NodeOpti::MinEigen().

66 {
67  return jac[0][0] * (jac[1][1] * jac[2][2] - jac[2][1] * jac[1][2]) -
68  jac[0][1] * (jac[1][0] * jac[2][2] - jac[1][2] * jac[2][0]) +
69  jac[0][2] * (jac[1][0] * jac[2][1] - jac[1][1] * jac[2][0]);
70 }
template<int DIM>
void Nektar::Utilities::EMatrix ( NekDouble  in[][DIM],
NekDouble  out[][DIM] 
)
inline

Calculate $ E = F^\top F - I $ tensor used in derivation of linear elasticity gradients.

Specialised versions of this function exist only for 2x2 and 3x3 matrices.

Parameters
inInput matrix $ F $
outOutput matrix $ F^\top F - I $

Definition at line 162 of file Evaluator.hxx.

163 {
164 }
template<>
void Nektar::Utilities::EMatrix< 2 > ( NekDouble  in[][2],
NekDouble  out[][2] 
)
inline

Definition at line 166 of file Evaluator.hxx.

167 {
168  out[0][0] = 0.5 * (in[0][0] * in[0][0] + in[1][0] * in[1][0] - 1.0);
169  out[1][0] = 0.5 * (in[0][0] * in[0][1] + in[1][0] * in[1][1]);
170  out[0][1] = 0.5 * (in[0][0] * in[0][1] + in[1][0] * in[1][1]);
171  out[1][1] = 0.5 * (in[1][1] * in[1][1] + in[0][1] * in[0][1] - 1.0);
172 }
template<>
void Nektar::Utilities::EMatrix< 3 > ( NekDouble  in[][3],
NekDouble  out[][3] 
)
inline

Definition at line 174 of file Evaluator.hxx.

175 {
176  out[0][0] = 0.5 * (in[0][0] * in[0][0] + in[1][0] * in[1][0] +
177  in[2][0] * in[2][0] - 1.0);
178  out[1][0] = 0.5 * (in[0][0] * in[1][0] + in[1][0] * in[1][1] +
179  in[2][0] * in[2][1]);
180  out[0][1] = out[1][0];
181  out[2][0] = 0.5 * (in[0][0] * in[0][2] + in[1][0] * in[1][2] +
182  in[2][0] * in[2][2]);
183  out[0][2] = out[2][0];
184  out[1][1] = 0.5 * (in[0][1] * in[0][1] + in[1][1] * in[1][1] +
185  in[2][1] * in[2][1] - 1.0);
186  out[1][2] = 0.5 * (in[0][1] * in[0][2] + in[1][1] * in[1][2] +
187  in[2][1] * in[2][2]);
188  out[2][1] = out[1][2];
189  out[2][2] = 0.5 * (in[0][2] * in[0][2] + in[1][2] * in[1][2] +
190  in[2][2] * in[2][2] - 1.0);
191 }
template<int DIM>
NekDouble Nektar::Utilities::FrobeniusNorm ( NekDouble  inarray[][DIM])
inline

Calculate Frobenius norm $ \| A \|_f ^2 $ of a matrix $ A $.

Parameters
inarrayInput matrix $ A $

Definition at line 234 of file Evaluator.hxx.

Referenced by Nektar::Utilities::NodeOpti::GetFunctional().

235 {
236  return 0.0;
237 }
template<>
NekDouble Nektar::Utilities::FrobeniusNorm< 2 > ( NekDouble  inarray[][2])
inline

Definition at line 240 of file Evaluator.hxx.

241 {
242  return inarray[0][0] * inarray[0][0]
243  + inarray[0][1] * inarray[0][1]
244  + inarray[1][0] * inarray[1][0]
245  + inarray[1][1] * inarray[1][1] ;
246 }
template<>
NekDouble Nektar::Utilities::FrobeniusNorm< 3 > ( NekDouble  inarray[][3])
inline

Definition at line 249 of file Evaluator.hxx.

250 {
251  return inarray[0][0] * inarray[0][0]
252  + inarray[0][1] * inarray[0][1]
253  + inarray[0][2] * inarray[0][2]
254  + inarray[1][0] * inarray[1][0]
255  + inarray[1][1] * inarray[1][1]
256  + inarray[1][2] * inarray[1][2]
257  + inarray[2][0] * inarray[2][0]
258  + inarray[2][1] * inarray[2][1]
259  + inarray[2][2] * inarray[2][2] ;
260 }
template<int DIM>
NekDouble Nektar::Utilities::FrobProd ( NekDouble  in1[][DIM],
NekDouble  in2[][DIM] 
)
inline

Calculate Frobenius inner product of input matrices.

Definition at line 199 of file Evaluator.hxx.

201 {
202  return 0.0;
203 }
template<>
NekDouble Nektar::Utilities::FrobProd< 2 > ( NekDouble  in1[][2],
NekDouble  in2[][2] 
)
inline

Definition at line 206 of file Evaluator.hxx.

207 {
208  return in1[0][0] * in2[0][0]
209  + in1[0][1] * in2[0][1]
210  + in1[1][0] * in2[1][0]
211  + in1[1][1] * in2[1][1] ;
212 }
template<>
NekDouble Nektar::Utilities::FrobProd< 3 > ( NekDouble  in1[][3],
NekDouble  in2[][3] 
)
inline

Definition at line 215 of file Evaluator.hxx.

216 {
217  return in1[0][0] * in2[0][0]
218  + in1[0][1] * in2[0][1]
219  + in1[0][2] * in2[0][2]
220  + in1[1][0] * in2[1][0]
221  + in1[1][1] * in2[1][1]
222  + in1[1][2] * in2[1][2]
223  + in1[2][0] * in2[2][0]
224  + in1[2][1] * in2[2][1]
225  + in1[2][2] * in2[2][2] ;
226 }
NodeOptiFactory & Nektar::Utilities::GetNodeOptiFactory ( )

Definition at line 52 of file NodeOpti.cpp.

Referenced by Nektar::Utilities::ProcessVarOpti::Analytics(), and Nektar::Utilities::ProcessVarOpti::Process().

53 {
54  static NodeOptiFactory asd;
55  return asd;
56 }
LibUtilities::NekFactory< int, NodeOpti, NodeSharedPtr, std::vector< ElUtilSharedPtr >, ResidualSharedPtr, std::map< LibUtilities::ShapeType, DerivUtilSharedPtr >, optiType > NodeOptiFactory
Definition: NodeOpti.h:140
int** Nektar::Utilities::helper2d ( int  lda,
int  arr[][2] 
)

Definition at line 62 of file ProcessBL.cpp.

Referenced by Nektar::Utilities::ProcessBL::BoundaryLayer3D().

63 {
64  int **ret = new int *[lda];
65  for (int i = 0; i < lda; ++i)
66  {
67  ret[i] = new int[2];
68  ret[i][0] = arr[i][0];
69  ret[i][1] = arr[i][1];
70  }
71  return ret;
72 }
int** Nektar::Utilities::helper2d ( int  lda,
int  arr[][4] 
)

Definition at line 74 of file ProcessBL.cpp.

75 {
76  int **ret = new int *[lda];
77  for (int i = 0; i < lda; ++i)
78  {
79  ret[i] = new int[4];
80  ret[i][0] = arr[i][0];
81  ret[i][1] = arr[i][1];
82  ret[i][2] = arr[i][2];
83  ret[i][3] = arr[i][3];
84  }
85  return ret;
86 }
std::vector<int> Nektar::Utilities::hexTensorNodeOrdering ( const std::vector< int > &  nodes,
int  n 
)

Reorder Gmsh nodes so that they appear in a "tensor product" format suitable for the interior of a Nektar++ hexahedron.

For an example, consider a second order hexahedron. This routine will produce a permutation map that applies the following permutation:

``` 3-—13-—2 6-—7--—8 |\ |\ |\ |\ |15 24 | 14 |15 16 | 18 9 \ 20 11 \ 3 \ 4 5 \ | 7-—19+—6 | 24—25+—26 |22 | 26 | 23| |12 | 13 | 14| 0—+-8-—1 | 0—+-1-—2 | \ 17 25 \ 18 \ 21 22 \ 23 10 | 21 12| 9 | 10 11| | | | | 4-—16-—5 18—19-—20

Gmsh tensor-product ```

We assume that Gmsh uses a recursive ordering system, so that interior nodes are reordered by calling this function recursively.

Parameters
nodesThe integer IDs of the nodes to be reordered, in Gmsh format.
nThe number of nodes in one coordinate direction. If this is zero we assume no reordering needs to be done and return the identity permutation.
Returns
The nodes vector in tensor-product ordering.

Definition at line 540 of file InputGmsh.cpp.

References Nektar::StdRegions::eDir1BwdDir1_Dir2FwdDir2, Nektar::StdRegions::eDir1FwdDir1_Dir2FwdDir2, Nektar::StdRegions::eDir1FwdDir2_Dir2FwdDir1, and quadTensorNodeOrdering().

Referenced by Nektar::Utilities::InputGmsh::HexReordering().

541 {
542  int i, j, k;
543  std::vector<int> nodeList;
544 
545  nodeList.resize(nodes.size());
546  nodeList[0] = nodes[0];
547 
548  if (n == 1)
549  {
550  return nodeList;
551  }
552 
553  // Vertices: same order as Nektar++
554  nodeList[n - 1] = nodes[1];
555  nodeList[n*n -1] = nodes[2];
556  nodeList[n*(n-1)] = nodes[3];
557  nodeList[n*n*(n-1)] = nodes[4];
558  nodeList[n - 1 + n*n*(n-1)] = nodes[5];
559  nodeList[n*n -1 + n*n*(n-1)] = nodes[6];
560  nodeList[n*(n-1) + n*n*(n-1)] = nodes[7];
561 
562  if (n == 2)
563  {
564  return nodeList;
565  }
566 
567  int hexEdges[12][2] = {
568  { 0, 1 }, { n-1, n }, { n*n-1, -1 }, { n*(n-1), -n },
569  { 0, n*n }, { n-1, n*n }, { n*n - 1, n*n }, { n*(n-1), n*n },
570  { n*n*(n-1), 1 }, { n*n*(n-1) + n-1, n }, { n*n*n-1, -1 },
571  { n*n*(n-1) + n*(n-1), -n }
572  };
573  int hexFaces[6][3] = {
574  { 0, 1, n }, { 0, 1, n*n }, { n-1, n, n*n },
575  { n*(n-1), 1, n*n }, { 0, n, n*n }, { n*n*(n-1), 1, n }
576  };
577  int gmshToNekEdge[12] = {0, -3, 4, 1, 5, 2, 6, 7, 8, -11, 9, 10};
578 
579  // Edges
580  int offset = 8;
581  for (int i = 0; i < 12; ++i)
582  {
583  int e = abs(gmshToNekEdge[i]);
584 
585  if (gmshToNekEdge[i] >= 0)
586  {
587  for (int j = 1; j < n-1; ++j)
588  {
589  nodeList[hexEdges[e][0] + j*hexEdges[e][1]] = nodes[offset++];
590  }
591  }
592  else
593  {
594  for (int j = 1; j < n-1; ++j)
595  {
596  nodeList[hexEdges[e][0] + (n-j-1)*hexEdges[e][1]] = nodes[offset++];
597  }
598  }
599  }
600 
601  // Faces
602  int gmsh2NekFace[6] = {0, 1, 4, 2, 3, 5};
603 
604  // Map which defines orientation between Gmsh and Nektar++ faces.
605  StdRegions::Orientation faceOrient[6] = {
611  StdRegions::eDir1FwdDir1_Dir2FwdDir2};
612 
613  for (i = 0; i < 6; ++i)
614  {
615  int n2 = (n-2)*(n-2);
616  int face = gmsh2NekFace[i];
617  offset = 8 + 12 * (n-2) + i * n2;
618 
619  // Create a list of interior face nodes for this face only.
620  vector<int> faceNodes(n2);
621  for (j = 0; j < n2; ++j)
622  {
623  faceNodes[j] = nodes[offset + j];
624  }
625 
626  // Now get the reordering of this face, which puts Gmsh
627  // recursive ordering into Nektar++ row-by-row order.
628  faceNodes = quadTensorNodeOrdering(faceNodes, n-2);
629  vector<int> tmp(n2);
630 
631  // Finally reorient the face according to the geometry
632  // differences.
633  if (faceOrient[i] == StdRegions::eDir1FwdDir1_Dir2FwdDir2)
634  {
635  // Orientation is the same, just copy.
636  tmp = faceNodes;
637  }
638  else if (faceOrient[i] == StdRegions::eDir1FwdDir2_Dir2FwdDir1)
639  {
640  // Tranposed faces
641  for (j = 0; j < n-2; ++j)
642  {
643  for (k = 0; k < n-2; ++k)
644  {
645  tmp[j * (n-2) + k] = faceNodes[k * (n-2) + j];
646  }
647  }
648  }
649  else if (faceOrient[i] == StdRegions::eDir1BwdDir1_Dir2FwdDir2)
650  {
651  for (j = 0; j < n-2; ++j)
652  {
653  for (k = 0; k < n-2; ++k)
654  {
655  tmp[j * (n-2) + k] = faceNodes[j * (n-2) + (n - k - 3)];
656  }
657  }
658  }
659 
660  // Now put this into the right place in the output array
661  for (k = 1; k < n-1; ++k)
662  {
663  for (j = 1; j < n-1; ++j)
664  {
665  nodeList[hexFaces[face][0] + j*hexFaces[face][1] + k*hexFaces[face][2]]
666  = faceNodes[(k-1)*(n-2) + j-1];
667  }
668  }
669  }
670 
671  // Finally, recurse on interior volume
672  vector<int> intNodes, tmpInt;
673  for (int i = 8 + 12 * (n-2) + 6 * (n-2) * (n-2); i < n*n*n; ++i)
674  {
675  intNodes.push_back(nodes[i]);
676  }
677 
678  if (intNodes.size())
679  {
680  tmpInt = hexTensorNodeOrdering(intNodes, n-2);
681  for (int k = 1, cnt = 0; k < n - 1; ++k)
682  {
683  for (int j = 1; j < n - 1; ++j)
684  {
685  for (int i = 1; i < n - 1; ++i)
686  {
687  nodeList[i + j * n + k * n * n] = tmpInt[cnt++];
688  }
689  }
690  }
691  }
692 
693  return nodeList;
694 }
std::vector< int > quadTensorNodeOrdering(const std::vector< int > &nodes, int n)
Reorder Gmsh nodes so that they appear in a tensor product format suitable for the interior of a Nekt...
Definition: InputGmsh.cpp:93
std::vector< int > hexTensorNodeOrdering(const std::vector< int > &nodes, int n)
Reorder Gmsh nodes so that they appear in a "tensor product" format suitable for the interior of a Ne...
Definition: InputGmsh.cpp:540
template<int DIM>
void Nektar::Utilities::InvTrans ( NekDouble  in[][DIM],
NekDouble  out[][DIM] 
)
inline

Calculate inverse transpose of input matrix.

Specialised versions of this function exist only for 2x2 and 3x3 matrices.

Parameters
inInput matrix $ A $
outOutput matrix $ A^{-\top} $

Definition at line 81 of file Evaluator.hxx.

82 {
83 }
template<>
void Nektar::Utilities::InvTrans< 2 > ( NekDouble  in[][2],
NekDouble  out[][2] 
)
inline

Definition at line 85 of file Evaluator.hxx.

References Determinant< 2 >().

86 {
87  NekDouble invDet = 1.0 / Determinant<2>(in);
88 
89  out[0][0] = in[1][1] * invDet;
90  out[1][0] = -in[0][1] * invDet;
91  out[0][1] = -in[1][0] * invDet;
92  out[1][1] = in[0][0] * invDet;
93 }
NekDouble Determinant< 2 >(NekDouble jac[][2])
Definition: Evaluator.hxx:60
double NekDouble
template<>
void Nektar::Utilities::InvTrans< 3 > ( NekDouble  in[][3],
NekDouble  out[][3] 
)
inline

Definition at line 95 of file Evaluator.hxx.

References Determinant< 3 >().

96 {
97  NekDouble invdet = 1.0 / Determinant<3>(in);
98 
99  out[0][0] = (in[1][1] * in[2][2] - in[2][1] * in[1][2]) * invdet;
100  out[1][0] = -(in[0][1] * in[2][2] - in[0][2] * in[2][1]) * invdet;
101  out[2][0] = (in[0][1] * in[1][2] - in[0][2] * in[1][1]) * invdet;
102  out[0][1] = -(in[1][0] * in[2][2] - in[1][2] * in[2][0]) * invdet;
103  out[1][1] = (in[0][0] * in[2][2] - in[0][2] * in[2][0]) * invdet;
104  out[2][1] = -(in[0][0] * in[1][2] - in[1][0] * in[0][2]) * invdet;
105  out[0][2] = (in[1][0] * in[2][1] - in[2][0] * in[1][1]) * invdet;
106  out[1][2] = -(in[0][0] * in[2][1] - in[2][0] * in[0][1]) * invdet;
107  out[2][2] = (in[0][0] * in[1][1] - in[1][0] * in[0][1]) * invdet;
108 }
double NekDouble
NekDouble Determinant< 3 >(NekDouble jac[][3])
Definition: Evaluator.hxx:65
bool Nektar::Utilities::operator== ( NekMeshUtils::ElmtConfig const &  p1,
NekMeshUtils::ElmtConfig const &  p2 
)

Definition at line 61 of file OutputGmsh.h.

References Nektar::NekMeshUtils::ElmtConfig::m_e, Nektar::NekMeshUtils::ElmtConfig::m_faceNodes, Nektar::NekMeshUtils::ElmtConfig::m_order, and Nektar::NekMeshUtils::ElmtConfig::m_volumeNodes.

62 {
63  return p1.m_e == p2.m_e &&
64  p1.m_faceNodes == p2.m_faceNodes &&
65  p1.m_volumeNodes == p2.m_volumeNodes &&
66  p1.m_order == p2.m_order;
67 }
static void Nektar::Utilities::PrismLineFaces ( int  prismid,
map< int, int > &  facelist,
vector< vector< int > > &  FacesToPrisms,
vector< vector< int > > &  PrismsToFaces,
vector< bool > &  PrismDone 
)
static

Definition at line 422 of file InputStar.cpp.

Referenced by PrismLineFaces(), Nektar::Utilities::InputStar::ResetNodes(), and Nektar::Utilities::InputTec::ResetNodes().

427 {
428  if (PrismDone[prismid] == false)
429  {
430  PrismDone[prismid] = true;
431 
432  // Add faces0
433  int face = PrismToFaces[prismid][0];
434  facelist[face] = face;
435  for (int i = 0; i < FaceToPrisms[face].size(); ++i)
436  {
437  PrismLineFaces(FaceToPrisms[face][i],
438  facelist,
439  FaceToPrisms,
440  PrismToFaces,
441  PrismDone);
442  }
443 
444  // Add faces1
445  face = PrismToFaces[prismid][1];
446  facelist[face] = face;
447  for (int i = 0; i < FaceToPrisms[face].size(); ++i)
448  {
449  PrismLineFaces(FaceToPrisms[face][i],
450  facelist,
451  FaceToPrisms,
452  PrismToFaces,
453  PrismDone);
454  }
455  }
456 }
static void PrismLineFaces(int prismid, map< int, int > &facelist, vector< vector< int > > &FacesToPrisms, vector< vector< int > > &PrismsToFaces, vector< bool > &PrismDone)
Definition: InputStar.cpp:422
static void Nektar::Utilities::PrismLineFaces ( int  prismid,
map< int, int > &  facelist,
vector< vector< int > > &  FacesToPrisms,
vector< vector< int > > &  PrismsToFaces,
vector< bool > &  PrismDone 
)
static

Definition at line 636 of file InputStarTec.cpp.

References PrismLineFaces().

641 {
642  if (PrismDone[prismid] == false)
643  {
644  PrismDone[prismid] = true;
645 
646  // Add faces0
647  int face = PrismToFaces[prismid][0];
648  facelist[face] = face;
649  for (int i = 0; i < FaceToPrisms[face].size(); ++i)
650  {
651  PrismLineFaces(FaceToPrisms[face][i],
652  facelist,
653  FaceToPrisms,
654  PrismToFaces,
655  PrismDone);
656  }
657 
658  // Add faces1
659  face = PrismToFaces[prismid][1];
660  facelist[face] = face;
661  for (int i = 0; i < FaceToPrisms[face].size(); ++i)
662  {
663  PrismLineFaces(FaceToPrisms[face][i],
664  facelist,
665  FaceToPrisms,
666  PrismToFaces,
667  PrismDone);
668  }
669  }
670 }
static void PrismLineFaces(int prismid, map< int, int > &facelist, vector< vector< int > > &FacesToPrisms, vector< vector< int > > &PrismsToFaces, vector< bool > &PrismDone)
std::vector<int> Nektar::Utilities::prismTensorNodeOrdering ( const std::vector< int > &  nodes,
int  n 
)

Reorder Gmsh nodes so that they appear in a "tensor product" format suitable for the interior of a Nektar++ prism. This routine is specifically designed for interior Gmsh nodes only.

Prisms are a bit of a special case, in that interior nodes are heterogeneous in the number of points they use. As an example, for a second-order interior of a fourth-order prism, this routine calculates the mapping taking us

``` ,6 ,8 .-' | \ .-' | \ ,-3 | \ ,-5 | \ ,-' | \ | \ ,-' | \ | \ 2 | \7----—8 2 | \6----—7 | \ | ,-' \ ,-' | \ | ,-' \ ,-' | \,5---—,0' | \,3---—,4' |,-' \ ,-' |,-' \ ,-' 1----—4' 0----—1'

    Gmsh                 tensor-product

```

Todo:
Make this routine work for higher orders. The Gmsh ordering seems a little different than other elements, therefore the functionality is (for now) hard-coded to orders less than 5.
Parameters
nodesThe integer IDs of the nodes to be reordered, in Gmsh format.
nThe number of nodes in one coordinate direction. If this is zero we assume no reordering needs to be done and return the identity permutation.
Returns
The nodes vector in tensor-product ordering.

Definition at line 464 of file InputGmsh.cpp.

References ASSERTL0.

Referenced by Nektar::Utilities::InputGmsh::PrismReordering().

465 {
466  std::vector<int> nodeList;
467 
468  if (n == 0)
469  {
470  return nodeList;
471  }
472 
473  nodeList.resize(nodes.size());
474 
475  if (n == 2)
476  {
477  nodeList[0] = nodes[1];
478  nodeList[1] = nodes[0];
479  return nodeList;
480  }
481 
482  // For some reason, this ordering is different. Whereas Gmsh usually orders
483  // vertices first, followed by edges, this ordering goes VVE-VVE-VVE for the
484  // three edges that contain edge-interior information, but also vertex
485  // orientation is not the same as the original Gmsh prism. The below is done
486  // by looking at the ordering by hand and is hence why we don't support
487  // order > 4 right now.
488  if (n == 3)
489  {
490  nodeList[0] = nodes[1];
491  nodeList[1] = nodes[4];
492  nodeList[2] = nodes[2];
493  nodeList[3] = nodes[5];
494  nodeList[4] = nodes[0];
495  nodeList[5] = nodes[3];
496  nodeList[6] = nodes[7];
497  nodeList[7] = nodes[8];
498  nodeList[8] = nodes[6];
499  }
500 
501  ASSERTL0(n < 4, "Prism Gmsh input and output is incomplete for orders "
502  "larger than 4");
503 
504  return nodeList;
505 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
std::vector<int> Nektar::Utilities::quadTensorNodeOrdering ( const std::vector< int > &  nodes,
int  n 
)

Reorder Gmsh nodes so that they appear in a tensor product format suitable for the interior of a Nektar++ quadrilateral.

For an example, consider a second order quadrilateral. This routine will produce a permutation map that applies the following permutation:

``` 3—6—2 6—7—8 | | | | 7 8 5 —> 3 4 5 | | | | 0—4—1 0—1—2

Gmsh tensor-product ```

We assume that Gmsh uses a recursive ordering system, so that interior nodes are reordered by calling this function recursively.

Parameters
nodesThe integer IDs of the nodes to be reordered, in Gmsh format.
nThe number of nodes in one coordinate direction. If this is zero we assume no reordering needs to be done and return the identity permutation.
Returns
The nodes vector in tensor-product ordering.

Definition at line 93 of file InputGmsh.cpp.

References CellMLToNektar.pycml::copy().

Referenced by Nektar::Utilities::InputGmsh::HexReordering(), hexTensorNodeOrdering(), Nektar::Utilities::InputGmsh::PrismReordering(), and Nektar::Utilities::InputGmsh::QuadReordering().

94 {
95  std::vector<int> nodeList;
96 
97  // Triangle
98  nodeList.resize(nodes.size());
99 
100  // Vertices and edges
101  nodeList[0] = nodes[0];
102  if (n > 1)
103  {
104  nodeList[n - 1] = nodes[1];
105  nodeList[n * n - 1] = nodes[2];
106  nodeList[n * (n - 1)] = nodes[3];
107  }
108  for (int i = 1; i < n - 1; ++i)
109  {
110  nodeList[i] = nodes[4 + i - 1];
111  }
112  for (int i = 1; i < n - 1; ++i)
113  {
114  nodeList[n * n - 1 - i] = nodes[4 + 2 * (n - 2) + i - 1];
115  }
116 
117  // Interior (recursion)
118  if (n > 2)
119  {
120  // Reorder interior nodes
121  std::vector<int> interior((n - 2) * (n - 2));
122  std::copy(
123  nodes.begin() + 4 + 4 * (n - 2), nodes.end(), interior.begin());
124  interior = quadTensorNodeOrdering(interior, n - 2);
125 
126  // Copy into full node list
127  for (int j = 1; j < n - 1; ++j)
128  {
129  nodeList[j * n] = nodes[4 + 3 * (n - 2) + n - 2 - j];
130  for (int i = 1; i < n - 1; ++i)
131  {
132  nodeList[j * n + i] = interior[(j - 1) * (n - 2) + (i - 1)];
133  }
134  nodeList[(j + 1) * n - 1] = nodes[4 + (n - 2) + j - 1];
135  }
136  }
137 
138  return nodeList;
139 }
std::vector< int > quadTensorNodeOrdering(const std::vector< int > &nodes, int n)
Reorder Gmsh nodes so that they appear in a tensor product format suitable for the interior of a Nekt...
Definition: InputGmsh.cpp:93
template<int DIM>
NekDouble Nektar::Utilities::ScalarProd ( NekDouble(&)  in1[DIM],
NekDouble(&)  in2[DIM] 
)
inline

Calculate Scalar product of input vectors.

Definition at line 132 of file Evaluator.hxx.

133 {
134  return 0.0;
135 }
template<>
NekDouble Nektar::Utilities::ScalarProd< 2 > ( NekDouble(&)  in1[2],
NekDouble(&)  in2[2] 
)
inline

Definition at line 138 of file Evaluator.hxx.

139 {
140  return in1[0] * in2[0]
141  + in1[1] * in2[1];
142 }
template<>
NekDouble Nektar::Utilities::ScalarProd< 3 > ( NekDouble(&)  in1[3],
NekDouble(&)  in2[3] 
)
inline

Definition at line 144 of file Evaluator.hxx.

145 {
146  return in1[0] * in2[0]
147  + in1[1] * in2[1]
148  + in1[2] * in2[2];
149 }
template<typename T >
void Nektar::Utilities::TestElmts ( SpatialDomains::MeshGraphSharedPtr &  graph)

Definition at line 79 of file OutputNekpp.cpp.

80 {
81  const std::map<int, boost::shared_ptr<T> > &tmp =
82  graph->GetAllElementsOfType<T>();
83  typename std::map<int, boost::shared_ptr<T> >::const_iterator it1, it2;
84 
85  SpatialDomains::CurveMap &curvedEdges = graph->GetCurvedEdges();
86  SpatialDomains::CurveMap &curvedFaces = graph->GetCurvedFaces();
87 
88  for (it1 = tmp.begin(), it2 = tmp.end(); it1 != it2; ++it1)
89  {
90  SpatialDomains::GeometrySharedPtr geom = it1->second;
91  geom->FillGeom();
92  geom->Reset(curvedEdges, curvedFaces);
93  }
94 }
boost::unordered_map< int, CurveSharedPtr > CurveMap
Definition: Curve.hpp:63
boost::shared_ptr< Geometry > GeometrySharedPtr
Definition: Geometry.h:53
std::vector<int> Nektar::Utilities::tetTensorNodeOrdering ( const std::vector< int > &  nodes,
int  n 
)

Reorder Gmsh nodes so that they appear in a "tensor product" format suitable for the interior of a Nektar++ tetrahedron.

For an example, consider a second order tetrahedron. This routine will produce a permutation map that applies the following permutation:

``` 2 5 ,/|\ ,/|\ ,/ | \ ,/ |\ ,6 '. `5 ,3 '. 4 ,/ 8\ ,/ 8 \ ,/ |\ ,/ | `\ 0-----—4–'.-----—1 0-----—1–'.-----—2 \. | ,/. | ,/ \. | ,9. | ,7 `7. '. ,/ `6. '. ,/ \. |/. |/ 39

Gmsh tensor-product ```

We assume that Gmsh uses a recursive ordering system, so that interior nodes are reordered by calling this function recursively.

Parameters
nodesThe integer IDs of the nodes to be reordered, in Gmsh format.
nThe number of nodes in one coordinate direction. If this is zero we assume no reordering needs to be done and return the identity permutation.
Returns
The nodes vector in tensor-product ordering.

Definition at line 285 of file InputGmsh.cpp.

References Nektar::NekMeshUtils::HOTriangle< T >::Align(), Nektar::NekMeshUtils::HOTriangle< T >::surfVerts, and triTensorNodeOrdering().

Referenced by Nektar::Utilities::InputGmsh::TetReordering().

286 {
287  std::vector<int> nodeList;
288  int nTri = n*(n+1)/2;
289  int nTet = n*(n+1)*(n+2)/6;
290 
291  nodeList.resize(nodes.size());
292  nodeList[0] = nodes[0];
293 
294  if (n == 1)
295  {
296  return nodeList;
297  }
298 
299  // Vertices
300  nodeList[n - 1] = nodes[1];
301  nodeList[nTri - 1] = nodes[2];
302  nodeList[nTet - 1] = nodes[3];
303 
304  if (n == 2)
305  {
306  return nodeList;
307  }
308 
309  // Set up a map that takes (a,b,c) -> m to help us figure out where things
310  // are inside the tetrahedron.
311  std::map<Mode, int, cmpop> tmp;
312 
313  for (int k = 0, cnt = 0; k < n; ++k)
314  {
315  for (int j = 0; j < n - k; ++j)
316  {
317  for (int i = 0; i < n - k - j; ++i)
318  {
319  tmp[Mode(i,j,k)] = cnt++;
320  }
321  }
322  }
323 
324  // Edges
325  for (int i = 1; i < n-1; ++i)
326  {
327  int eI = i-1;
328  nodeList[tmp[Mode(i,0,0)]] = nodes[4 + eI];
329  nodeList[tmp[Mode(n-1-i,i,0)]] = nodes[4 + (n-2) + eI];
330  nodeList[tmp[Mode(0,n-1-i,0)]] = nodes[4 + 2*(n-2) + eI];
331  nodeList[tmp[Mode(0,0,n-1-i)]] = nodes[4 + 3*(n-2) + eI];
332  nodeList[tmp[Mode(0,i,n-1-i)]] = nodes[4 + 4*(n-2) + eI];
333  nodeList[tmp[Mode(i,0,n-1-i)]] = nodes[4 + 5*(n-2) + eI];
334  }
335 
336  if (n == 3)
337  {
338  return nodeList;
339  }
340 
341  // For faces, we use the triTensorNodeOrdering routine to make our lives
342  // slightly easier.
343  int nFacePts = (n-3)*(n-2)/2;
344 
345  // Grab face points and reorder into a tensor-product type format
346  vector<vector<int> > tmpNodes(4);
347  int offset = 4 + 6*(n-2);
348 
349  for (int i = 0; i < 4; ++i)
350  {
351  tmpNodes[i].resize(nFacePts);
352  for (int j = 0; j < nFacePts; ++j)
353  {
354  tmpNodes[i][j] = nodes[offset++];
355  }
356  tmpNodes[i] = triTensorNodeOrdering(tmpNodes[i], n-3);
357  }
358 
359  if (n > 4)
360  {
361  // Now align faces
362  vector<int> triVertId(3), toAlign(3);
363  triVertId[0] = 0;
364  triVertId[1] = 1;
365  triVertId[2] = 2;
366 
367  // Faces 0,2: triangle verts {0,2,1} --> {0,1,2}
368  HOTriangle<int> hoTri(triVertId, tmpNodes[0]);
369  toAlign[0] = 0;
370  toAlign[1] = 2;
371  toAlign[2] = 1;
372 
373  hoTri.Align(toAlign);
374  tmpNodes[0] = hoTri.surfVerts;
375 
376  hoTri.surfVerts = tmpNodes[2];
377  hoTri.Align(toAlign);
378  tmpNodes[2] = hoTri.surfVerts;
379 
380  // Face 3: triangle verts {1,2,0} --> {0,1,2}
381  toAlign[0] = 1;
382  toAlign[1] = 2;
383  toAlign[2] = 0;
384 
385  hoTri.surfVerts = tmpNodes[3];
386  hoTri.Align(toAlign);
387  tmpNodes[3] = hoTri.surfVerts;
388  }
389 
390  // Now apply faces. Note that faces 3 and 2 are swapped between Gmsh and
391  // Nektar++ order.
392  for (int j = 1, cnt = 0; j < n-2; ++j)
393  {
394  for (int i = 1; i < n-j-1; ++i, ++cnt)
395  {
396  nodeList[tmp[Mode(i,j,0)]] = tmpNodes[0][cnt];
397  nodeList[tmp[Mode(i,0,j)]] = tmpNodes[1][cnt];
398  nodeList[tmp[Mode(n-1-i-j,i,j)]] = tmpNodes[3][cnt];
399  nodeList[tmp[Mode(0,i,j)]] = tmpNodes[2][cnt];
400  }
401  }
402 
403  if (n == 4)
404  {
405  return nodeList;
406  }
407 
408  // Finally, recurse on interior volume
409  vector<int> intNodes, tmpInt;
410  for (int i = offset; i < nTet; ++i)
411  {
412  intNodes.push_back(nodes[i]);
413  }
414  tmpInt = tetTensorNodeOrdering(intNodes, n-4);
415 
416  for (int k = 1, cnt = 0; k < n - 2; ++k)
417  {
418  for (int j = 1; j < n - k - 1; ++j)
419  {
420  for (int i = 1; i < n - k - j - 1; ++i)
421  {
422  nodeList[tmp[Mode(i,j,k)]] = tmpInt[cnt++];
423  }
424  }
425  }
426 
427  return nodeList;
428 }
std::vector< int > triTensorNodeOrdering(const std::vector< int > &nodes, int n)
Reorder Gmsh nodes so that they appear in a "tensor product" format suitable for the interior of a Ne...
Definition: InputGmsh.cpp:170
A lightweight struct for dealing with high-order triangle alignment.
Definition: HOAlignment.h:50
boost::tuple< int, int, int > Mode
Definition: InputGmsh.cpp:221
std::vector< int > tetTensorNodeOrdering(const std::vector< int > &nodes, int n)
Reorder Gmsh nodes so that they appear in a "tensor product" format suitable for the interior of a Ne...
Definition: InputGmsh.cpp:285
std::vector<int> Nektar::Utilities::triTensorNodeOrdering ( const std::vector< int > &  nodes,
int  n 
)

Reorder Gmsh nodes so that they appear in a "tensor product" format suitable for the interior of a Nektar++ triangle.

For an example, consider a third-order triangle. This routine will produce a permutation map that applies the following permutation:

``` 2 9 | \ | \ 7 6 7 7 | \ | \ 8 9 5 4 5 6 | \ | \ 0—3—4—1 0—1—2—3

Gmsh          tensor-product

```

We assume that Gmsh uses a recursive ordering system, so that interior nodes are reordered by calling this function recursively.

Parameters
nodesThe integer IDs of the nodes to be reordered, in Gmsh format.
nThe number of nodes in one coordinate direction. If this is zero we assume no reordering needs to be done and return the identity permutation.
Returns
The nodes vector in tensor-product ordering.

Definition at line 170 of file InputGmsh.cpp.

References CellMLToNektar.pycml::copy().

Referenced by Nektar::Utilities::InputGmsh::PrismReordering(), Nektar::Utilities::InputGmsh::TetReordering(), tetTensorNodeOrdering(), and Nektar::Utilities::InputGmsh::TriReordering().

171 {
172  std::vector<int> nodeList;
173  int cnt2;
174 
175  nodeList.resize(nodes.size());
176 
177  // Vertices
178  nodeList[0] = nodes[0];
179  if (n > 1)
180  {
181  nodeList[n - 1] = nodes[1];
182  nodeList[n * (n + 1) / 2 - 1] = nodes[2];
183  }
184 
185  // Edges
186  int cnt = n;
187  for (int i = 1; i < n - 1; ++i)
188  {
189  nodeList[i] = nodes[3 + i - 1];
190  nodeList[cnt] = nodes[3 + 3 * (n - 2) - i];
191  nodeList[cnt + n - i - 1] = nodes[3 + (n - 2) + i - 1];
192  cnt += n - i;
193  }
194 
195  // Interior (recursion)
196  if (n > 3)
197  {
198  // Reorder interior nodes
199  std::vector<int> interior((n - 3) * (n - 2) / 2);
200  std::copy(
201  nodes.begin() + 3 + 3 * (n - 2), nodes.end(), interior.begin());
202  interior = triTensorNodeOrdering(interior, n - 3);
203 
204  // Copy into full node list
205  cnt = n;
206  cnt2 = 0;
207  for (int j = 1; j < n - 2; ++j)
208  {
209  for (int i = 0; i < n - j - 2; ++i)
210  {
211  nodeList[cnt + i + 1] = interior[cnt2 + i];
212  }
213  cnt += n - j;
214  cnt2 += n - 2 - j;
215  }
216  }
217 
218  return nodeList;
219 }
std::vector< int > triTensorNodeOrdering(const std::vector< int > &nodes, int n)
Reorder Gmsh nodes so that they appear in a "tensor product" format suitable for the interior of a Ne...
Definition: InputGmsh.cpp:170

Variable Documentation

boost::mutex Nektar::Utilities::mtx
boost::mutex Nektar::Utilities::mtx2

Definition at line 48 of file ElUtil.cpp.