G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsEdge.h
Go to the documentation of this file.
1
14#pragma once
15
17
18namespace gismo {
19
20template <class T>
21class gsEdge : public gsMeshElement<T>
22{
23public:
24 typedef gsMeshElement<T> MeshElement;
25 typedef typename MeshElement::scalar_t scalar_t;
26 typedef typename MeshElement::gsVertexHandle gsVertexHandle;
27 typedef typename MeshElement::gsEdgeHandle gsEdgeHandle;
28 typedef typename MeshElement::gsFaceHandle gsFaceHandle;
29 typedef gsVector3d<T> gsVector;
30 typedef gsVector * gsVectorHandle;
31
32public:
33 gsEdge() { } // : MeshElement()
34
35 gsEdge(gsVertexHandle const & v0, gsVertexHandle const & v1 ):
36 source(v0), target(v1), sharp(false)
37 {
38// faceId1=0;
39// faceId2=0;
40 // next = 0;
41 // prev = 0;
42 }
43
44
45 virtual ~gsEdge(){ }
46
47 std::ostream &print(std::ostream &os) const
48 {
49 os<<"gsEdge from "<< *source<<" to "<<*target ;
50 return os;
51 };
52
53
54 void orderVertices()
55 {
56 if ( Xless<T>(source,target) )
57 std::swap(source,target);
58 }
59
60// Lex compare
61bool operator< (gsEdge const & rhs) const
62{
63 return ( Xless<T>(this->source,rhs.source)
64
65 ||
66 ( (this->source->x() == rhs.source->x() &&
67 this->source->y() == rhs.source->y() &&
68 this->source->z() == rhs.source->z() ) &&
69 Xless<T>(this->target,rhs.target) ));
70}
71
72bool operator == (gsEdge const & rhs) const
73{
74 return (((this->source->x())==rhs.source->x())&&
75 ((this->source->y())==rhs.source->y())&&
76 ((this->source->z())==rhs.source->z())&&
77 ((this->target->x())==rhs.target->x())&&
78 ((this->target->y())==rhs.target->y())&&
79 ((this->target->z())==rhs.target->z()));
80}
81bool operator> (gsEdge const & rhs) const
82{
83 return !(*this<rhs)&&!(*this==rhs);
84}
85bool operator != (gsEdge const & rhs) const
86{
87 return !(*this==rhs);
88}
89
90public:
91
92 gsVertexHandle source, target;
93 std::vector<gsFaceHandle> nFaces;
94 bool sharp;
95 std::vector<int> numPatches;
96};
97
98} //namespace gismo
Provides gsMeshElement class - a vertex, edge, face or cell of a gsMesh.
The G+Smo namespace, containing all definitions for the library.