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

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

#include <MeshElements.h>

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

Public Member Functions

 HOTriangle (vector< int > pVertId, vector< T > pSurfVerts)
 
 HOTriangle (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 (vector< int > vertId)
 Align this surface to a given vertex ID. More...
 

Public Attributes

vector< int > vertId
 The triangle vertex IDs. More...
 
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::Utilities::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 1213 of file MeshElements.h.

Constructor & Destructor Documentation

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

Definition at line 1215 of file MeshElements.h.

1216  :
1217  vertId(pVertId), surfVerts(pSurfVerts) {}
vector< int > vertId
The triangle vertex IDs.
vector< T > surfVerts
The triangle surface vertices – templated so that this can either be nodes or IDs.
template<typename T>
Nektar::Utilities::HOTriangle< T >::HOTriangle ( vector< int >  pVertId)
inline

Definition at line 1218 of file MeshElements.h.

1218 : vertId(pVertId) {}
vector< int > vertId
The triangle vertex IDs.

Member Function Documentation

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

Align this surface to a given vertex ID.

Definition at line 1295 of file MeshElements.h.

Referenced by Nektar::Utilities::Tetrahedron::Tetrahedron(), and Nektar::Utilities::InputGmsh::TetReordering().

1296  {
1297  if (vertId[0] == this->vertId[0])
1298  {
1299  if (vertId[1] == this->vertId[1] ||
1300  vertId[1] == this->vertId[2])
1301  {
1302  if (vertId[1] == this->vertId[2])
1303  {
1304  Rotate(1);
1305  Reflect();
1306  }
1307  }
1308  }
1309  else if (vertId[0] == this->vertId[1])
1310  {
1311  if (vertId[1] == this->vertId[0] ||
1312  vertId[1] == this->vertId[2])
1313  {
1314  if (vertId[1] == this->vertId[0])
1315  {
1316  Reflect();
1317  }
1318  else
1319  {
1320  Rotate(2);
1321  }
1322  }
1323  }
1324  else if (vertId[0] == this->vertId[2])
1325  {
1326  if (vertId[1] == this->vertId[0] ||
1327  vertId[1] == this->vertId[1])
1328  {
1329  if (vertId[1] == this->vertId[1])
1330  {
1331  Rotate(2);
1332  Reflect();
1333  }
1334  else
1335  {
1336  Rotate(1);
1337  }
1338  }
1339  }
1340  }
void Rotate(int nrot)
Rotates the triangle of data points inside surfVerts counter-clockwise nrot times.
void Reflect()
Reflect data points inside surfVerts.
template<typename T>
void Nektar::Utilities::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 1269 of file MeshElements.h.

1270  {
1271  int i, j, cnt;
1272  int np = ((int)sqrt(8.0*surfVerts.size()+1.0)-1)/2;
1273  vector<T> tmp(np*np);
1274 
1275  for (cnt = i = 0; i < np; ++i)
1276  {
1277  for (j = 0; j < np-i; ++j,cnt++)
1278  {
1279  tmp[i*np+np-i-1-j] = surfVerts[cnt];
1280  }
1281  }
1282 
1283  for (cnt = i = 0; i < np; ++i)
1284  {
1285  for(j = 0; j < np-i; ++j,cnt++)
1286  {
1287  surfVerts[cnt] = tmp[i*np+j];
1288  }
1289  }
1290  }
vector< T > surfVerts
The triangle surface vertices – templated so that this can either be nodes or IDs.
template<typename T>
void Nektar::Utilities::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 1233 of file MeshElements.h.

1234  {
1235  int n, i, j, cnt;
1236  int np = ((int)sqrt(8.0*surfVerts.size()+1.0)-1)/2;
1237  vector<T> tmp(np*np);
1238 
1239  for (n = 0; n < nrot; ++n)
1240  {
1241  for (cnt = i = 0; i < np; ++i)
1242  {
1243  for (j = 0; j < np-i; ++j, cnt++)
1244  {
1245  tmp[i*np+j] = surfVerts[cnt];
1246  }
1247  }
1248  for (cnt = i = 0; i < np; ++i)
1249  {
1250  for (j = 0; j < np-i; ++j,cnt++)
1251  {
1252  surfVerts[cnt] = tmp[(np-1-i-j)*np+i];
1253  }
1254  }
1255  }
1256  }
vector< T > surfVerts
The triangle surface vertices – templated so that this can either be nodes or IDs.

Member Data Documentation

template<typename T>
vector<T> Nektar::Utilities::HOTriangle< T >::surfVerts

The triangle surface vertices – templated so that this can either be nodes or IDs.

Definition at line 1225 of file MeshElements.h.

Referenced by Nektar::Utilities::Tetrahedron::Tetrahedron(), and Nektar::Utilities::InputGmsh::TetReordering().

template<typename T>
vector<int> Nektar::Utilities::HOTriangle< T >::vertId

The triangle vertex IDs.

Definition at line 1221 of file MeshElements.h.