Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/meshgen2d/src/Element.cpp
3196 views
1
#include "Element.h"
2
#include <iostream>
3
#include <algorithm>
4
5
#ifdef _NO_STD_MINMAX
6
#include "minmaxpatch.h"
7
#endif
8
9
static int nextTag = 1;
10
11
Element::Element()
12
{
13
newTag();
14
}
15
16
void Element::
17
newTag()
18
{
19
elementTag = nextTag;
20
++nextTag;
21
}
22
23
bool Element::isBoundaryConnector( const std::set< std::pair< int, int > > &links ) const
24
{
25
int n = 0;
26
27
for (int i = 0; i < sz - 1; i++)
28
for (int j = i + 1; j < sz; j++)
29
{
30
int t1 = nodes[i]->tag, t2 = nodes[j]->tag;
31
if ( nodes[i]->boundarynode && nodes[j]->boundarynode &&
32
links.find(std::make_pair(std::min(t1, t2), std::max(t1, t2))) != links.end() )
33
n++;
34
}
35
36
return n > 1;
37
}
38
39
std::ostream& operator<< (std::ostream& o, const Element& A)
40
{
41
int body = A.body;
42
43
o << A.elementTag << ' ' << body << ' ' << A.elementType();
44
45
for(int i = 0; i < A.sz; ++i)
46
{
47
o << ' ' << A.nodes[i]->tag;
48
}
49
o << '\n';
50
51
return o;
52
}
53
54