Nektar++
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Nektar::SpatialDomains::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.
 
void Reflect ()
 Reflect data points inside surfVerts.
 
void Align (std::vector< int > vertId)
 Align this surface to a given vertex ID.
 

Public Attributes

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

Detailed Description

template<typename T>
struct Nektar::SpatialDomains::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 52 of file HOAlignment.h.

Constructor & Destructor Documentation

◆ HOTriangle() [1/2]

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

Definition at line 54 of file HOAlignment.h.

55 : vertId(pVertId), surfVerts(pSurfVerts)
56 {
57 }
std::vector< int > vertId
The triangle vertex IDs.
Definition HOAlignment.h:63
std::vector< T > surfVerts
The triangle surface vertices – templated so that this can either be nodes or IDs.
Definition HOAlignment.h:67

◆ HOTriangle() [2/2]

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

Definition at line 58 of file HOAlignment.h.

58 : vertId(pVertId)
59 {
60 }

Member Function Documentation

◆ Align()

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

Align this surface to a given vertex ID.

Definition at line 137 of file HOAlignment.h.

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

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

Referenced by Nektar::SpatialDomains::PrismGeom::v_MakeOrder(), Nektar::SpatialDomains::PyrGeom::v_MakeOrder(), and Nektar::SpatialDomains::TetGeom::v_MakeOrder().

◆ Reflect()

template<typename T >
void Nektar::SpatialDomains::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 111 of file HOAlignment.h.

112 {
113 int i, j, cnt;
114 int np = ((int)sqrt(8.0 * surfVerts.size() + 1.0) - 1) / 2;
115 std::vector<T> tmp(np * np);
116
117 for (cnt = i = 0; i < np; ++i)
118 {
119 for (j = 0; j < np - i; ++j, cnt++)
120 {
121 tmp[i * np + np - i - 1 - j] = surfVerts[cnt];
122 }
123 }
124
125 for (cnt = i = 0; i < np; ++i)
126 {
127 for (j = 0; j < np - i; ++j, cnt++)
128 {
129 surfVerts[cnt] = tmp[i * np + j];
130 }
131 }
132 }
scalarT< T > sqrt(scalarT< T > in)
Definition scalar.hpp:289

References tinysimd::sqrt(), and Nektar::SpatialDomains::HOTriangle< T >::surfVerts.

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

◆ Rotate()

template<typename T >
void Nektar::SpatialDomains::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 75 of file HOAlignment.h.

76 {
77 int n, i, j, cnt;
78 int np = ((int)sqrt(8.0 * surfVerts.size() + 1.0) - 1) / 2;
79 std::vector<T> tmp(np * np);
80
81 for (n = 0; n < nrot; ++n)
82 {
83 for (cnt = i = 0; i < np; ++i)
84 {
85 for (j = 0; j < np - i; ++j, cnt++)
86 {
87 tmp[i * np + j] = surfVerts[cnt];
88 }
89 }
90 for (cnt = i = 0; i < np; ++i)
91 {
92 for (j = 0; j < np - i; ++j, cnt++)
93 {
94 surfVerts[cnt] = tmp[(np - 1 - i - j) * np + i];
95 }
96 }
97 }
98 }

References tinysimd::sqrt(), and Nektar::SpatialDomains::HOTriangle< T >::surfVerts.

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

Member Data Documentation

◆ surfVerts

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

◆ vertId

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

The triangle vertex IDs.

Definition at line 63 of file HOAlignment.h.

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