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::linesource Struct Reference

#include <Octree.h>

Collaboration diagram for Nektar::NekMeshUtils::linesource:
Collaboration graph
[legend]

Public Member Functions

 linesource (Array< OneD, NekDouble > p1, Array< OneD, NekDouble > p2, NekDouble r, NekDouble d)
 
bool withinRange (Array< OneD, NekDouble > p)
 
NekDouble Length ()
 

Public Attributes

Array< OneD, NekDoublex1
 
Array< OneD, NekDoublex2
 
NekDouble R
 
NekDouble delta
 

Detailed Description

Definition at line 51 of file Octree.h.

Constructor & Destructor Documentation

Nektar::NekMeshUtils::linesource::linesource ( Array< OneD, NekDouble p1,
Array< OneD, NekDouble p2,
NekDouble  r,
NekDouble  d 
)
inline

Definition at line 55 of file Octree.h.

59  : x1(p1), x2(p2), R(r), delta(d)
60  {
61  }
Array< OneD, NekDouble > x1
Definition: Octree.h:53
Array< OneD, NekDouble > x2
Definition: Octree.h:53

Member Function Documentation

NekDouble Nektar::NekMeshUtils::linesource::Length ( )
inline

Definition at line 93 of file Octree.h.

Referenced by withinRange().

94  {
95  return sqrt((x1[0] - x2[0]) * (x1[0] - x2[0]) +
96  (x1[1] - x2[1]) * (x1[1] - x2[1]) +
97  (x1[2] - x2[2]) * (x1[2] - x2[2]));
98  }
Array< OneD, NekDouble > x1
Definition: Octree.h:53
Array< OneD, NekDouble > x2
Definition: Octree.h:53
bool Nektar::NekMeshUtils::linesource::withinRange ( Array< OneD, NekDouble p)
inline

Definition at line 63 of file Octree.h.

References Length().

64  {
65  Array<OneD, NekDouble> Le(3), Re(3), s(3);
66  for (int i = 0; i < 3; i++)
67  {
68  Le[i] = p[i] - x1[i];
69  Re[i] = p[i] - x2[i];
70  s[i] = x2[i] - x1[i];
71  }
72  Array<OneD, NekDouble> dev(3);
73  dev[0] = Le[1] * Re[2] - Re[1] * Le[2];
74  dev[1] = Le[2] * Re[0] - Re[2] * Le[0];
75  dev[2] = Le[0] * Re[1] - Re[0] * Le[1];
76 
77  NekDouble dist =
78  sqrt(dev[0] * dev[0] + dev[1] * dev[1] + dev[2] * dev[2]) / Length();
79 
80  NekDouble t = -1.0 * ((x1[0] - p[0]) * s[0] + (x1[1] - p[1]) * s[1] +
81  (x1[2] - p[2]) * s[2]) / Length() / Length();
82 
83  if (dist < R && !(t > 1) && !(t < 0))
84  {
85  return true;
86  }
87  else
88  {
89  return false;
90  }
91  }
Array< OneD, NekDouble > x1
Definition: Octree.h:53
Array< OneD, NekDouble > x2
Definition: Octree.h:53
double NekDouble

Member Data Documentation

NekDouble Nektar::NekMeshUtils::linesource::delta

Definition at line 54 of file Octree.h.

NekDouble Nektar::NekMeshUtils::linesource::R

Definition at line 54 of file Octree.h.

Array<OneD, NekDouble> Nektar::NekMeshUtils::linesource::x1

Definition at line 53 of file Octree.h.

Array<OneD, NekDouble> Nektar::NekMeshUtils::linesource::x2

Definition at line 53 of file Octree.h.