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 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Point geometry information
33 //
34 //
35 ////////////////////////////////////////////////////////////////////////////////
36 #ifndef NEKTAR_SPATIALDOMAINS_POINTGEOM_H
37 #define NEKTAR_SPATIALDOMAINS_POINTGEOM_H
38 
39 
44 #include <boost/enable_shared_from_this.hpp>
45 
46 namespace Nektar
47 {
48  namespace SpatialDomains
49  {
50  class PointGeom;
51  class SegGeom;
52 
53  // shorthand for boost pointer
54  typedef boost::shared_ptr<PointGeom> PointGeomSharedPtr;
55  typedef std::vector< PointGeomSharedPtr > PointGeomVector;
57  typedef std::map<int, PointGeomSharedPtr> PointGeomMap;
58  typedef std::set< PointGeomSharedPtr > PointGeomSet;
59 
60  class PointGeom: public Geometry0D, public NekPoint<NekDouble>,
61  public boost::enable_shared_from_this<PointGeom>
62  {
63  public:
65  SPATIAL_DOMAINS_EXPORT PointGeom(const int coordim, const int vid,
67  SPATIAL_DOMAINS_EXPORT PointGeom(const PointGeom &T);
68 
70 
71  SPATIAL_DOMAINS_EXPORT void AddElmtConnected(int gvo_id, int locid);
73  SPATIAL_DOMAINS_EXPORT bool IsElmtConnected(int gvo_id, int locid) const;
77 
78  inline int GetVid() const
79  {
80  return m_vid;
81  }
82 
83  inline void SetVid(const int vid)
84  {
85  m_vid = vid;
86  }
87 
88  // Math routines
89  SPATIAL_DOMAINS_EXPORT void Mult (PointGeom& a, PointGeom& b);
90  SPATIAL_DOMAINS_EXPORT void Add (PointGeom& a, PointGeom& b);
91  SPATIAL_DOMAINS_EXPORT void Sub (PointGeom& a, PointGeom& b);
94 
95  SPATIAL_DOMAINS_EXPORT friend bool operator == (const PointGeom &x, const PointGeom &y);
96  SPATIAL_DOMAINS_EXPORT friend bool operator == (const PointGeom &x, const PointGeom *y);
97  SPATIAL_DOMAINS_EXPORT friend bool operator == (const PointGeom *x, const PointGeom &y);
98  SPATIAL_DOMAINS_EXPORT friend bool operator != (const PointGeom &x, const PointGeom &y);
99  SPATIAL_DOMAINS_EXPORT friend bool operator != (const PointGeom &x, const PointGeom *y);
100  SPATIAL_DOMAINS_EXPORT friend bool operator != (const PointGeom *x, const PointGeom &y);
101 
103  GetPointOrientation(const SegGeom& edge1,
104  const SegGeom& edge2);
105 
106  protected:
107  int m_vid;
108  std::list<CompToElmt> m_elmtMap;
109 
110  virtual void v_GenGeomFactors();
111  virtual int v_GetVid(int id) const;
112 
113  virtual PointGeomSharedPtr v_GetVertex(int i) const;
114 
115  private:
116  virtual NekDouble v_GetCoord(
117  const int i,
118  const Array<OneD,const NekDouble>& Lcoord);
119  virtual NekDouble v_GetLocCoords(
120  const Array<OneD,const NekDouble>& coords,
121  Array<OneD,NekDouble>& Lcoords);
122  };
123 
124 
125  }; //end of namespace
126 }; //end of namespace
127 
128 #endif //NEKTAR_SPATIALDOMAINS_POINTGEOM_H
virtual NekDouble v_GetLocCoords(const Array< OneD, const NekDouble > &coords, Array< OneD, NekDouble > &Lcoords)
Definition: PointGeom.cpp:303
boost::call_traits< DataType >::const_reference y() const
Definition: NekPoint.hpp:170
void Add(PointGeom &a, PointGeom &b)
Definition: PointGeom.cpp:159
virtual int v_GetVid(int id) const
Definition: PointGeom.cpp:239
std::vector< PointGeomSharedPtr > PointGeomVector
Definition: Geometry3D.h:61
void GetCoords(NekDouble &x, NekDouble &y, NekDouble &z)
Definition: PointGeom.cpp:122
NekDouble dot(PointGeom &a)
Definition: PointGeom.cpp:192
void UpdatePosition(NekDouble x, NekDouble y, NekDouble z)
Definition: PointGeom.cpp:151
void Sub(PointGeom &a, PointGeom &b)
Definition: PointGeom.cpp:168
std::set< PointGeomSharedPtr > PointGeomSet
Definition: PointGeom.h:58
void SetVid(const int vid)
Definition: PointGeom.h:83
boost::call_traits< DataType >::const_reference a() const
Definition: NekPoint.hpp:182
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:199
std::map< int, PointGeomSharedPtr > PointGeomMap
Definition: MeshGraph.h:108
virtual NekDouble v_GetCoord(const int i, const Array< OneD, const NekDouble > &Lcoord)
Definition: PointGeom.cpp:298
boost::call_traits< DataType >::const_reference z() const
Definition: NekPoint.hpp:176
boost::call_traits< DataType >::const_reference x() const
Definition: NekPoint.hpp:164
double NekDouble
boost::call_traits< DataType >::const_reference b() const
Definition: NekPoint.hpp:188
friend bool operator!=(const PointGeom &x, const PointGeom &y)
Definition: PointGeom.cpp:214
std::vector< PointGeomSharedPtr >::iterator PointGeomVectorIter
Definition: PointGeom.h:56
std::list< CompToElmt > m_elmtMap
Definition: PointGeom.h:108
void Mult(PointGeom &a, PointGeom &b)
Definition: PointGeom.cpp:177
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
bool IsElmtConnected(int gvo_id, int locid) const
Definition: PointGeom.cpp:106
1D geometry information
Definition: Geometry0D.h:54
static StdRegions::Orientation GetPointOrientation(const SegGeom &edge1, const SegGeom &edge2)
Get the orientation of point1; to be used later for normal convention.
Definition: PointGeom.cpp:269
NekDouble dist(PointGeom &a)
Definition: PointGeom.cpp:186
void AddElmtConnected(int gvo_id, int locid)
Definition: PointGeom.cpp:95
virtual PointGeomSharedPtr v_GetVertex(int i) const
Definition: PointGeom.cpp:244
boost::shared_ptr< PointGeom > PointGeomSharedPtr
Definition: Geometry.h:60
#define SPATIAL_DOMAINS_EXPORT