Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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;
75  SPATIAL_DOMAINS_EXPORT void GetCoords(Array<OneD,NekDouble> &coords);
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