Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Geometry.cpp
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // File: Geometry.cpp
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: This file contains the base class implementation for the
33 // Geometry class.
34 //
35 //
36 ////////////////////////////////////////////////////////////////////////////////
37 
39 
40 namespace Nektar
41 {
42  namespace SpatialDomains
43  {
44 
45  // static class property
47 
49  m_coordim(0),
50  m_geomFactorsState(eNotFilled),
51  m_state(eNotFilled),
52  m_shapeType(LibUtilities::eNoShapeType),
53  m_globalID(-1)
54  {
55  }
56 
57  Geometry::Geometry(const int coordim):
58  m_coordim(coordim),
59  m_geomFactorsState(eNotFilled),
60  m_state(eNotFilled),
61  m_shapeType(LibUtilities::eNoShapeType),
62  m_globalID(-1)
63  {
64  }
65 
67  {
68  }
69 
71  GeomFactorsSharedPtr geomFactor)
72  {
73  GeomFactorsSharedPtr returnval = geomFactor;
74 
75 /// \todo should this '#if 0' statement be removed?
76 #if 0
77  bool found = false;
78  if (geomFactor->GetGtype() == eRegular)
79  {
81  iter != m_regGeomFactorsManager.end();
82  ++iter)
83  {
84  if (**iter == *geomFactor)
85  {
86  returnval = *iter;
87  found = true;
88  break;
89  }
90  }
91 
92  if (!found)
93  {
94  m_regGeomFactorsManager.push_back(geomFactor);
95  returnval = geomFactor;
96  }
97  }
98 #endif
99  return returnval;
100  }
101 
102  bool SortByGlobalId(const boost::shared_ptr<Geometry>& lhs,
103  const boost::shared_ptr<Geometry>& rhs)
104  {
105  return lhs->GetGlobalID() < rhs->GetGlobalID();
106  }
107 
108  bool GlobalIdEquality(const boost::shared_ptr<Geometry>& lhs,
109  const boost::shared_ptr<Geometry>& rhs)
110  {
111  return lhs->GetGlobalID() == rhs->GetGlobalID();
112  }
113 
114  void Geometry::v_AddElmtConnected(int gvo_id, int locid)
115  {
117  "This function is only valid for shape type geometries");
118  }
119 
121  {
123  "This function is only valid for shape type geometries");
124  return 0;
125  }
126 
127  bool Geometry::v_IsElmtConnected(int gvo_id, int locid) const
128  {
130  "This function is only valid for shape type geometries");
131  return false;
132  }
133 
134  int Geometry::v_GetVid(int i) const
135  {
137  "This function is only valid for shape type geometries");
138  return 0;
139  }
140 
141  int Geometry::v_GetEid(int i) const
142  {
144  "This function is only valid for shape type geometries");
145  return 0;
146  }
147 
148  int Geometry::v_GetFid(int i) const
149  {
151  "This function is only valid for expansion type geometries");
152  return 0;
153  }
154 
156  {
158  "This function is only valid for shape type geometries");
159  return 0;
160  }
161 
163  {
165  "This function is not valid for this geometry.");
166  return StdRegions::eForwards;
167  }
168 
170  {
172  "This function is not valid for this geometry.");
173  return StdRegions::eFwd;
174  }
175 
177  {
179  "This function is not valid for this geometry.");
180  return StdRegions::eFwd;
181  }
182 
184  {
186  "This function is only valid for shape type geometries");
187  return 0;
188  }
189 
191  {
193  "This function is only valid for shape type geometries");
194  return 0;
195  }
196 
198  {
200  "This function is only valid for shape type geometries");
201  return 0;
202  }
203 
205  {
206  return m_xmap;
207  }
208 
210  const Array<OneD, const NekDouble>& gloCoord,
211  NekDouble tol)
212  {
214  "This function has not been defined for this geometry");
215  return false;
216  }
217 
219  const Array<OneD, const NekDouble>& gloCoord,
220  Array<OneD, NekDouble>& locCoord,
221  NekDouble tol)
222  {
224  "This function has not been defined for this geometry");
225  return false;
226  }
227 
229  const Array<OneD, const NekDouble>& gloCoord,
230  Array<OneD, NekDouble>& locCoord,
231  NekDouble tol,
232  NekDouble &resid)
233  {
235  "This function has not been defined for this geometry");
236  return false;
237  }
238 
239  int Geometry::v_GetVertexEdgeMap(const int i, const int j) const
240  {
242  "This function has not been defined for this geometry");
243  return 0;
244  }
245 
246  int Geometry::v_GetVertexFaceMap(const int i, const int j) const
247  {
249  "This function has not been defined for this geometry");
250  return 0;
251  }
252 
253  int Geometry::v_GetEdgeFaceMap(const int i, const int j) const
254  {
256  "This function has not been defined for this geometry");
257  return 0;
258  }
259 
261  const int i,
262  const Array<OneD,const NekDouble>& Lcoord)
263  {
265  "This function is only valid for expansion type geometries");
266  return 0.0;
267  }
268 
270  const Array<OneD,const NekDouble> &coords,
271  Array<OneD,NekDouble> &Lcoords)
272  {
274  "This function is only valid for expansion type geometries");
275  return 0.0;
276  }
277 
279  {
281  "This function is only valid for expansion type geometries");
282  }
283 
285  {
287  "This function is only valid for expansion type geometries");
288  }
289 
291  {
293  "This function is only valid for shape type geometries");
295  return returnval;
296  }
297 
299  {
300  return m_coordim;
301  }
302 
303  /**
304  * @brief Reset this geometry object: unset the current state and remove
305  * allocated GeomFactors.
306  */
307  void Geometry::v_Reset(CurveMap &curvedEdges,
308  CurveMap &curvedFaces)
309  {
310  // Reset state
313 
314  // Junk geometric factors
316  }
317  }; //end of namespace
318 }; //end of namespace
319 
StdRegions::StdExpansionSharedPtr m_xmap
Definition: Geometry.h:172
virtual StdRegions::Orientation v_GetPorient(const int i) const
Definition: Geometry.cpp:169
GeomFactorsVector::iterator GeomFactorsVectorIter
Iterator for the GeomFactorsVector.
Definition: GeomFactors.h:66
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:191
virtual bool v_ContainsPoint(const Array< OneD, const NekDouble > &gloCoord, NekDouble tol=0.0)
Definition: Geometry.cpp:209
GeomFactorsSharedPtr m_geomFactors
Definition: Geometry.h:170
virtual bool v_IsElmtConnected(int gvo_id, int locid) const
Definition: Geometry.cpp:127
virtual int v_GetNumFaces() const
Definition: Geometry.cpp:190
static GeomFactorsSharedPtr ValidateRegGeomFactor(GeomFactorsSharedPtr geomFactor)
Definition: Geometry.cpp:70
virtual NekDouble v_GetLocCoords(const Array< OneD, const NekDouble > &coords, Array< OneD, NekDouble > &Lcoords)
Definition: Geometry.cpp:269
virtual void v_Reset(CurveMap &curvedEdges, CurveMap &curvedFaces)
Reset this geometry object: unset the current state and remove allocated GeomFactors.
Definition: Geometry.cpp:307
virtual int v_GetFid(int i) const
Definition: Geometry.cpp:148
virtual int v_NumElmtConnected() const
Definition: Geometry.cpp:120
static GeomFactorsVector m_regGeomFactorsManager
Definition: Geometry.h:166
virtual int v_GetVid(int i) const
Definition: Geometry.cpp:134
bool SortByGlobalId(const boost::shared_ptr< Geometry > &lhs, const boost::shared_ptr< Geometry > &rhs)
Less than operator to sort Geometry objects by global id when sorting STL containers.
Definition: Geometry.cpp:102
virtual StdRegions::StdExpansionSharedPtr v_GetXmap() const
Definition: Geometry.cpp:204
StandardMatrixTag & lhs
virtual StdRegions::Orientation v_GetEorient(const int i) const
Definition: Geometry.cpp:162
virtual int v_GetEdgeFaceMap(int i, int j) const
Definition: Geometry.cpp:253
Geometric information has not been generated.
bool GlobalIdEquality(const boost::shared_ptr< Geometry > &lhs, const boost::shared_ptr< Geometry > &rhs)
Definition: Geometry.cpp:108
std::vector< GeomFactorsSharedPtr > GeomFactorsVector
A vector of GeomFactor pointers.
Definition: GeomFactors.h:64
double NekDouble
virtual void v_AddElmtConnected(int gvo_id, int locid)
Definition: Geometry.cpp:114
virtual int v_GetVertexFaceMap(int i, int j) const
Definition: Geometry.cpp:246
virtual int v_GetShapeDim() const
Definition: Geometry.cpp:197
virtual StdRegions::Orientation v_GetForient(const int i) const
Definition: Geometry.cpp:176
boost::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object.
Definition: GeomFactors.h:62
Geometry is straight-sided with constant geometric factors.
boost::unordered_map< int, CurveSharedPtr > CurveMap
Definition: Curve.hpp:63
virtual int v_GetVertexEdgeMap(int i, int j) const
Definition: Geometry.cpp:239
virtual int v_GetNumEdges() const
Definition: Geometry.cpp:183
boost::shared_ptr< Basis > BasisSharedPtr
GeomState m_state
enum identifier to determine if quad points are filled
Definition: Geometry.h:175
virtual NekDouble v_GetCoord(const int i, const Array< OneD, const NekDouble > &Lcoord)
Definition: Geometry.cpp:260
boost::shared_ptr< StdExpansion > StdExpansionSharedPtr
virtual int v_GetNumVerts() const
Definition: Geometry.cpp:155
int m_coordim
coordinate dimension
Definition: Geometry.h:169
virtual const LibUtilities::BasisSharedPtr v_GetBasis(const int i)
Definition: Geometry.cpp:290
virtual int v_GetEid(int i) const
Definition: Geometry.cpp:141
virtual int v_GetCoordim() const
Definition: Geometry.cpp:298