ESyS-Particle  2.3.2
Edge2D.h
Go to the documentation of this file.
1 
2 // //
3 // Copyright (c) 2003-2014 by The University of Queensland //
4 // Centre for Geoscience Computing //
5 // http://earth.uq.edu.au/centre-geoscience-computing //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.opensource.org/licenses/osl-3.0.php //
10 // //
12 
13 #ifndef __EDGE2D_H
14 #define __EDGE2D_H
15 
16 //-- Project includes --
17 #include "Foundation/vec3.h"
18 #include "Foundation/Matrix3.h"
19 #include "Geometry/AEdge.h"
20 
21 //-- STL includes --
22 #include <utility>
23 using std::pair;
24 using std::make_pair;
25 
26 //-- IO includes --
27 #include <iostream>
28 using std::ostream;
29 
38 class Edge2D : public AEdge
39 {
40  public: // types
41  typedef Vec3 (Edge2D::* VectorFieldFunction)() const;
42  typedef double (Edge2D::* ScalarFieldFunction)() const;
43 
44  private:
47  int m_id0,m_id1; // corner ids
49 
50  public:
51  Edge2D(int,int,const Vec3&,const Vec3&,int,int);
52  void moveNode(int,const Vec3&);
53 
54  inline int getID(){return m_edge_id;};
55  inline void applyForce(const Vec3& f){m_force+=f;};
56  inline void zeroForce(){m_force=Vec3(0.0,0.0,0.0);};
57  Vec3 getNormal() const {return m_normal;};
58  Vec3 toGlobal(const Vec3&);
59  Vec3 toLocal(const Vec3&);
60 
61  // get id/pos pairs for each node -> mainly for checkpointing
62  pair<int,Vec3> getP0()const{return make_pair(m_id0,m_p0);};
63  pair<int,Vec3> getP1()const{return make_pair(m_id1,m_p1);};
64 
65  // access functions
66  static VectorFieldFunction getVectorFieldFunction(const string&);
67  static ScalarFieldFunction getScalarFieldFunction(const string&);
68 
69  Vec3 getForce() const {return m_force;};
70  Vec3 getForceDensity() const {return m_force/((m_p1-m_p0).norm());};
71  double getPressure() const;
72 
74  friend ostream& operator<<(ostream&,const Edge2D&);
75  void print();
76 };
77 
78 
79 #endif // __EDGE2D_H