Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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>

Collaboration diagram for Nektar::NekMeshUtils::HOTriangle< T >:
Collaboration graph
[legend]

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 50 of file HOAlignment.h.

Constructor & Destructor Documentation

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

Definition at line 52 of file HOAlignment.h.

53  : vertId(pVertId), surfVerts(pSurfVerts)
54  {
55  }
std::vector< T > surfVerts
The triangle surface vertices – templated so that this can either be nodes or IDs.
Definition: HOAlignment.h:65
std::vector< int > vertId
The triangle vertex IDs.
Definition: HOAlignment.h:61
template<typename T>
Nektar::NekMeshUtils::HOTriangle< T >::HOTriangle ( std::vector< int >  pVertId)
inline

Definition at line 56 of file HOAlignment.h.

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

Member Function Documentation

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 135 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().

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

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

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

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

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

Member Data Documentation

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

The triangle vertex IDs.

Definition at line 61 of file HOAlignment.h.