Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/meshgen2d/src/include/Element.h
3203 views
1
#if !defined( BL_ELEMENT_H )
2
#define BL_ELEMENT_H
3
4
#include <vector>
5
#include <fstream>
6
#include <set>
7
8
#include "../../config.h"
9
#if defined(_NO_STD_MINMAX) || defined(WIN32)
10
#include "minmaxpatch.h"
11
#endif
12
13
#include "MeshNode.h"
14
15
class Element
16
{
17
public:
18
friend std::ostream& operator<< (std::ostream& o, const Element& A);
19
20
Element();
21
Element( const int t ) { elementTag = t; }
22
23
~Element() { };
24
25
void newTag();
26
int elementId() const { return elementTag; }
27
28
void setBody( const int bd ) { body = bd; }
29
int partOfBody() const { return body; }
30
bool isSameBody( const int bd ) const { return body == bd; }
31
32
int size() const { return sz; }
33
34
Node* nodeAt( const int t) { return nodes[t]; }
35
36
bool isBoundaryConnector( const std::set< std::pair< int, int > > &links ) const;
37
38
void upgrade(std::vector<Node *> &newNodes)
39
{
40
Node **n = new Node*[sz+newNodes.size()];
41
42
int i;
43
for (i = 0; i < sz; i++)
44
n[i] = nodes[i];
45
for (i = 0; i < newNodes.size(); i++)
46
n[sz+i] = newNodes[i];
47
48
delete[] nodes;
49
nodes = n;
50
51
sz += newNodes.size();
52
}
53
54
virtual int elementType() const = 0;
55
56
protected:
57
int elementTag;
58
int sz;
59
int body;
60
Node** nodes;
61
};
62
63
std::ostream& operator<< (std::ostream& o, const Element& A);
64
65
#endif /* BL_ELEMENT_H */
66
67