Nektar++
Public Member Functions | Public Attributes | List of all members
Nektar::NekMeshUtils::HOTriangle< T > Struct Template Reference

A lightweight struct for dealing with high-order triangle alignment. More...

#include <HOAlignment.h>

Public Member Functions

 HOTriangle (std::vector< int > pVertId, std::vector< T > pSurfVerts)
 
 HOTriangle (std::vector< int > pVertId)
 
void Rotate (int nrot)
 Rotates the triangle of data points inside surfVerts counter-clockwise nrot times. More...
 
void Reflect ()
 Reflect data points inside surfVerts. More...
 
void Align (std::vector< int > vertId)
 Align this surface to a given vertex ID. More...
 

Public Attributes

std::vector< int > vertId
 The triangle vertex IDs. More...
 
std::vector< T > surfVerts
 The triangle surface vertices – templated so that this can either be nodes or IDs. More...
 

Detailed Description

template<typename T>
struct Nektar::NekMeshUtils::HOTriangle< T >

A lightweight struct for dealing with high-order triangle alignment.

The logic underlying these routines is taken from the original Nektar code.

Definition at line 49 of file HOAlignment.h.

Constructor & Destructor Documentation

◆ HOTriangle() [1/2]

template<typename T>
Nektar::NekMeshUtils::HOTriangle< T >::HOTriangle ( std::vector< int >  pVertId,
std::vector< T >  pSurfVerts 
)
inline

Definition at line 51 of file HOAlignment.h.

52  : vertId(pVertId), surfVerts(pSurfVerts)
53  {
54  }
std::vector< T > surfVerts
The triangle surface vertices – templated so that this can either be nodes or IDs.
Definition: HOAlignment.h:64
std::vector< int > vertId
The triangle vertex IDs.
Definition: HOAlignment.h:60

◆ HOTriangle() [2/2]

template<typename T>
Nektar::NekMeshUtils::HOTriangle< T >::HOTriangle ( std::vector< int >  pVertId)
inline

Definition at line 55 of file HOAlignment.h.

55  : vertId(pVertId)
56  {
57  }
std::vector< int > vertId
The triangle vertex IDs.
Definition: HOAlignment.h:60

Member Function Documentation

◆ Align()

template<typename T>
void Nektar::NekMeshUtils::HOTriangle< T >::Align ( std::vector< int >  vertId)
inline

Align this surface to a given vertex ID.

Definition at line 134 of file HOAlignment.h.

References Nektar::NekMeshUtils::HOTriangle< T >::Reflect(), and Nektar::NekMeshUtils::HOTriangle< T >::Rotate().

Referenced by Nektar::NekMeshUtils::Prism::GetCurvedNodes(), Nektar::NekMeshUtils::Tetrahedron::GetCurvedNodes(), Nektar::Utilities::InputGmsh::PrismReordering(), Nektar::Utilities::OutputGmsh::Process(), Nektar::NekMeshUtils::Tetrahedron::Tetrahedron(), Nektar::Utilities::InputGmsh::TetReordering(), and Nektar::Utilities::tetTensorNodeOrdering().

135  {
136  if (vertId[0] == this->vertId[0])
137  {
138  if (vertId[1] == this->vertId[1] || vertId[1] == this->vertId[2])
139  {
140  if (vertId[1] == this->vertId[2])
141  {
142  Rotate(1);
143  Reflect();
144  }
145  }
146  }
147  else if (vertId[0] == this->vertId[1])
148  {
149  if (vertId[1] == this->vertId[0] || vertId[1] == this->vertId[2])
150  {
151  if (vertId[1] == this->vertId[0])
152  {
153  Reflect();
154  }
155  else
156  {
157  Rotate(2);
158  }
159  }
160  }
161  else if (vertId[0] == this->vertId[2])
162  {
163  if (vertId[1] == this->vertId[0] || vertId[1] == this->vertId[1])
164  {
165  if (vertId[1] == this->vertId[1])
166  {
167  Rotate(2);
168  Reflect();
169  }
170  else
171  {
172  Rotate(1);
173  }
174  }
175  }
176  }
void Rotate(int nrot)
Rotates the triangle of data points inside surfVerts counter-clockwise nrot times.
Definition: HOAlignment.h:72
void Reflect()
Reflect data points inside surfVerts.
Definition: HOAlignment.h:108

◆ Reflect()

template<typename T>
void Nektar::NekMeshUtils::HOTriangle< T >::Reflect ( )
inline

Reflect data points inside surfVerts.

This applies a mapping essentially doing the following reordering:

9 9 7 8 -> 8 7 4 5 6 6 5 4 0 1 2 3 3 2 1 0

Definition at line 108 of file HOAlignment.h.

Referenced by Nektar::NekMeshUtils::HOTriangle< T >::Align().

109  {
110  int i, j, cnt;
111  int np = ((int)sqrt(8.0 * surfVerts.size() + 1.0) - 1) / 2;
112  std::vector<T> tmp(np * np);
113 
114  for (cnt = i = 0; i < np; ++i)
115  {
116  for (j = 0; j < np - i; ++j, cnt++)
117  {
118  tmp[i * np + np - i - 1 - j] = surfVerts[cnt];
119  }
120  }
121 
122  for (cnt = i = 0; i < np; ++i)
123  {
124  for (j = 0; j < np - i; ++j, cnt++)
125  {
126  surfVerts[cnt] = tmp[i * np + j];
127  }
128  }
129  }
std::vector< T > surfVerts
The triangle surface vertices – templated so that this can either be nodes or IDs.
Definition: HOAlignment.h:64

◆ Rotate()

template<typename T>
void Nektar::NekMeshUtils::HOTriangle< T >::Rotate ( int  nrot)
inline

Rotates the triangle of data points inside surfVerts counter-clockwise nrot times.

Parameters
nrotNumber of times to rotate triangle.

Definition at line 72 of file HOAlignment.h.

Referenced by Nektar::NekMeshUtils::HOTriangle< T >::Align().

73  {
74  int n, i, j, cnt;
75  int np = ((int)sqrt(8.0 * surfVerts.size() + 1.0) - 1) / 2;
76  std::vector<T> tmp(np * np);
77 
78  for (n = 0; n < nrot; ++n)
79  {
80  for (cnt = i = 0; i < np; ++i)
81  {
82  for (j = 0; j < np - i; ++j, cnt++)
83  {
84  tmp[i * np + j] = surfVerts[cnt];
85  }
86  }
87  for (cnt = i = 0; i < np; ++i)
88  {
89  for (j = 0; j < np - i; ++j, cnt++)
90  {
91  surfVerts[cnt] = tmp[(np - 1 - i - j) * np + i];
92  }
93  }
94  }
95  }
std::vector< T > surfVerts
The triangle surface vertices – templated so that this can either be nodes or IDs.
Definition: HOAlignment.h:64

Member Data Documentation

◆ surfVerts

template<typename T>
std::vector<T> Nektar::NekMeshUtils::HOTriangle< T >::surfVerts

◆ vertId

template<typename T>
std::vector<int> Nektar::NekMeshUtils::HOTriangle< T >::vertId

The triangle vertex IDs.

Definition at line 60 of file HOAlignment.h.