Nektar++
PointGeom.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // File: PointGeom.h
4 //
5 // For more information, please see: http://www.nektar.info/
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // Permission is hereby granted, free of charge, to any person obtaining a
14 // copy of this software and associated documentation files (the "Software"),
15 // to deal in the Software without restriction, including without limitation
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 // and/or sell copies of the Software, and to permit persons to whom the
18 // Software is furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included
21 // in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 // DEALINGS IN THE SOFTWARE.
30 //
31 // Description: Point geometry information
32 //
33 //
34 ////////////////////////////////////////////////////////////////////////////////
35 #ifndef NEKTAR_SPATIALDOMAINS_POINTGEOM_H
36 #define NEKTAR_SPATIALDOMAINS_POINTGEOM_H
37 
41 #include <memory>
42 
43 namespace Nektar
44 {
45 
46 namespace SpatialDomains
47 {
48 
49 class PointGeom;
50 class SegGeom;
51 
52 // shorthand for boost pointer
53 typedef std::shared_ptr<PointGeom> PointGeomSharedPtr;
54 typedef std::map<int, PointGeomSharedPtr> PointGeomMap;
55 
56 class PointGeom : public Geometry0D,
57  public NekPoint<NekDouble>,
58  public std::enable_shared_from_this<PointGeom>
59 {
60 public:
62  SPATIAL_DOMAINS_EXPORT PointGeom(const int coordim,
63  const int vid,
64  NekDouble x,
65  NekDouble y,
66  NekDouble z);
67  SPATIAL_DOMAINS_EXPORT PointGeom(const PointGeom &T);
68 
70 
72  {
73  return m_globalID;
74  }
75 
77  NekDouble &y,
78  NekDouble &z);
81  NekDouble y,
82  NekDouble z);
83 
84  SPATIAL_DOMAINS_EXPORT void Mult(PointGeom &a, PointGeom &b);
85  SPATIAL_DOMAINS_EXPORT void Add(PointGeom &a, PointGeom &b);
86  SPATIAL_DOMAINS_EXPORT void Sub(PointGeom &a, PointGeom &b);
87  SPATIAL_DOMAINS_EXPORT void Rotate (PointGeom& a, int dir, NekDouble angle);
89  SPATIAL_DOMAINS_EXPORT NekDouble dot(PointGeom &a);
90 
91  SPATIAL_DOMAINS_EXPORT friend bool operator==(const PointGeom &x,
92  const PointGeom &y);
93  SPATIAL_DOMAINS_EXPORT friend bool operator==(const PointGeom &x,
94  const PointGeom *y);
95  SPATIAL_DOMAINS_EXPORT friend bool operator==(const PointGeom *x,
96  const PointGeom &y);
97  SPATIAL_DOMAINS_EXPORT friend bool operator!=(const PointGeom &x,
98  const PointGeom &y);
99  SPATIAL_DOMAINS_EXPORT friend bool operator!=(const PointGeom &x,
100  const PointGeom *y);
101  SPATIAL_DOMAINS_EXPORT friend bool operator!=(const PointGeom *x,
102  const PointGeom &y);
103 
104 protected:
105  virtual void v_GenGeomFactors();
106  virtual PointGeomSharedPtr v_GetVertex(int i) const;
107 };
108 
109 }
110 }
111 
112 #endif // NEKTAR_SPATIALDOMAINS_POINTGEOM_H
boost::call_traits< DataType >::const_reference a() const
Definition: NekPoint.hpp:176
void Add(PointGeom &a, PointGeom &b)
Definition: PointGeom.cpp:116
void GetCoords(NekDouble &x, NekDouble &y, NekDouble &z)
Definition: PointGeom.cpp:76
boost::call_traits< DataType >::const_reference y() const
Definition: NekPoint.hpp:164
NekDouble dot(PointGeom &a)
retun the dot product between this and input a
Definition: PointGeom.cpp:188
boost::call_traits< DataType >::const_reference z() const
Definition: NekPoint.hpp:170
void UpdatePosition(NekDouble x, NekDouble y, NekDouble z)
Definition: PointGeom.cpp:108
void Sub(PointGeom &a, PointGeom &b)
Definition: PointGeom.cpp:125
void Rotate(PointGeom &a, int dir, NekDouble angle)
_this = rotation of a by angle &#39;angle&#39; around axis dir
Definition: PointGeom.cpp:143
friend bool operator==(const PointGeom &x, const PointGeom &y)
Determine equivalence by the ids. No matter what the position, if the ids are the same...
Definition: PointGeom.cpp:195
virtual PointGeomSharedPtr v_GetVertex(int i) const
Definition: PointGeom.cpp:225
double NekDouble
friend bool operator!=(const PointGeom &x, const PointGeom &y)
Definition: PointGeom.cpp:210
std::shared_ptr< PointGeom > PointGeomSharedPtr
Definition: Geometry.h:59
void Mult(PointGeom &a, PointGeom &b)
_this = a x b
Definition: PointGeom.cpp:134
1D geometry information
Definition: Geometry0D.h:53
boost::call_traits< DataType >::const_reference b() const
Definition: NekPoint.hpp:182
NekDouble dist(PointGeom &a)
return distance between this and input a
Definition: PointGeom.cpp:181
boost::call_traits< DataType >::const_reference x() const
Definition: NekPoint.hpp:158
std::map< int, PointGeomSharedPtr > PointGeomMap
Definition: PointGeom.h:54
#define SPATIAL_DOMAINS_EXPORT