forked from labmec/FemCourseEigenClass2021
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample1.cpp
More file actions
39 lines (32 loc) · 948 Bytes
/
Copy pathExample1.cpp
File metadata and controls
39 lines (32 loc) · 948 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
#include "GeoMesh.h"
#include "GeoElementTemplate.h"
#include "Geom1d.h"
using namespace std;
int main() {
//Creating a Geometric Mesh
int nNodes = 2;
int nElements = 1; //nElements = nNodes-1
GeoMesh *gmesh = new GeoMesh();
gmesh->SetDimension(1);
gmesh->SetNumNodes(nNodes);
gmesh->SetNumElements(nElements);
VecDouble coord(2);
coord[0] = 0.0; //(x)
coord[1] = 0.0; //(y)
gmesh->Node(0).SetCo(coord);
coord[0] = 1.0; //(x)
coord[1] = 0.0; //(y)
gmesh->Node(1).SetCo(coord);
int matid = 1;
int elindex = 0;
int element_id = 0;
VecInt nodes(2);
nodes[0] = 0;
nodes[1] = 1;
GeoElement *gel = new GeoElementTemplate<Geom1d>(nodes, matid, gmesh, elindex);
gmesh->SetElement(element_id, gel);
gmesh->BuildConnectivity();
gmesh->Print(cout);
return 0;
}