Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/meshgen2d/src/include/BoundaryElement.h
3203 views
1
#if !defined( MESH_BOUNDARYELEMENT_H )
2
#define MESH_BOUNDARYELEMENT_H
3
4
#include "Node.h"
5
#include "Vertex.h"
6
#include <iostream>
7
#include <fstream>
8
9
class BoundaryElement
10
{
11
public:
12
friend std::ostream& operator<< (std::ostream& o, const BoundaryElement& A);
13
BoundaryElement( int edgeTag, Node* n1, Node* n2 )
14
{
15
edge = edgeTag;
16
a = n1;
17
b = n2;
18
c = NULL;
19
left = right = 0;
20
flipped = false;
21
newTag();
22
}
23
24
void newTag();
25
26
void flip( bool status ) { flipped = status; }
27
28
Vertex* setHolder( Vertex *v )
29
{
30
Vertex *holder;
31
32
if( !flipped )
33
{
34
holder = v->vertexWith(a, b);
35
left = holder->elementId();
36
}
37
else
38
{
39
holder = v->vertexWith(b, a);
40
right = holder->elementId();
41
}
42
43
return holder;
44
}
45
46
void setLeft( int id ) { (flipped?right:left) = id; }
47
void setRight( int id ) { (flipped?left:right) = id; }
48
49
Node *from() { return a; }
50
Node *to() { return b; }
51
Node *middle() { return c; }
52
53
void addMiddleNode(Node *n) { c = n; }
54
55
private:
56
int edge;
57
Node *a, *b, *c;
58
int left, right;
59
bool flipped;
60
int tag;
61
};
62
63
std::ostream& operator<< (std::ostream& o, const BoundaryElement& A);
64
65
#endif /* MESH_BOUNDARYELEMENT_H */
66
67