Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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.
void Reflect ()
 Reflect data points inside surfVerts.
void Align (vector< int > vertId)
 Align this surface to a given vertex ID.

Public Attributes

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

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 1194 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 1196 of file MeshElements.h.

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

Definition at line 1199 of file MeshElements.h.

: vertId(pVertId) {}

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 1276 of file MeshElements.h.

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

{
if (vertId[0] == this->vertId[0])
{
if (vertId[1] == this->vertId[1] ||
vertId[1] == this->vertId[2])
{
if (vertId[1] == this->vertId[2])
{
Rotate(1);
}
}
}
else if (vertId[0] == this->vertId[1])
{
if (vertId[1] == this->vertId[0] ||
vertId[1] == this->vertId[2])
{
if (vertId[1] == this->vertId[0])
{
}
else
{
Rotate(2);
}
}
}
else if (vertId[0] == this->vertId[2])
{
if (vertId[1] == this->vertId[0] ||
vertId[1] == this->vertId[1])
{
if (vertId[1] == this->vertId[1])
{
Rotate(2);
}
else
{
Rotate(1);
}
}
}
}
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 1250 of file MeshElements.h.

{
int i, j, cnt;
int np = ((int)sqrt(8.0*surfVerts.size()+1.0)-1)/2;
vector<T> tmp(np*np);
for (cnt = i = 0; i < np; ++i)
{
for (j = 0; j < np-i; ++j,cnt++)
{
tmp[i*np+np-i-1-j] = surfVerts[cnt];
}
}
for (cnt = i = 0; i < np; ++i)
{
for(j = 0; j < np-i; ++j,cnt++)
{
surfVerts[cnt] = tmp[i*np+j];
}
}
}
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 1214 of file MeshElements.h.

{
int n, i, j, cnt;
int np = ((int)sqrt(8.0*surfVerts.size()+1.0)-1)/2;
vector<T> tmp(np*np);
for (n = 0; n < nrot; ++n)
{
for (cnt = i = 0; i < np; ++i)
{
for (j = 0; j < np-i; ++j, cnt++)
{
tmp[i*np+j] = surfVerts[cnt];
}
}
for (cnt = i = 0; i < np; ++i)
{
for (j = 0; j < np-i; ++j,cnt++)
{
surfVerts[cnt] = tmp[(np-1-i-j)*np+i];
}
}
}
}

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 1206 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 1202 of file MeshElements.h.