test_write_gmsh.cc 2.24 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
#include <random>
#include <fstream>
#include <unordered_map>

#include <BRepTools.hxx>
#include <BRep_Builder.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_DataMapOfShapeInteger.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS.hxx>

#include <frackit/geometry/cylinder.hh>
#include <frackit/geometry/disk.hh>
Dennis Gläser's avatar
Dennis Gläser committed
16

17
18
#include <frackit/magnitude/magnitude.hh>
#include <frackit/magnitude/containedmagnitude.hh>
Dennis Gläser's avatar
Dennis Gläser committed
19
20

#include <frackit/common/id.hh>
21
#include <frackit/occ/breputilities.hh>
Dennis Gläser's avatar
Dennis Gläser committed
22
#include <frackit/precision/precision.hh>
23

24
#include <frackit/sampling/makeuniformpointsampler.hh>
25
#include <frackit/sampling/disksampler.hh>
26
27
28
29
30
31
32
33

#include <frackit/entitynetwork/containedentitynetwork.hh>
#include <frackit/entitynetwork/networkbuilder.hh>
#include <frackit/io/gmshwriter.hh>

//! create 3 disk-shaped fractures and write geo (gmsh file format) file
int main(int argc, char** argv)
{
Dennis Gläser's avatar
Dennis Gläser committed
34
    using namespace Frackit;
35
    using ctype = double;
Dennis Gläser's avatar
Dennis Gläser committed
36
37
    using Domain = Cylinder<ctype>;
    using Disk = Disk<ctype>;
38
39
40
41
42
43
44
45
46
47
48
49
    using Point = typename Disk::Point;
    using Direction = typename Disk::Direction;
    using Vector = typename Direction::Vector;

    const Direction e1(Vector(1.0, 0.0, 0.0));
    const Direction e2(Vector(0.0, 1.0, 0.0));
    const Direction e3(Vector(0.0, 0.0, 1.0));

    // Domain in which the disks are embedded
    Domain domain(0.5, 1.0);
    Domain domain2(Disk(Point(0.0, 0.0, 1.0), e1, e2, 1.0, 1.0), 1.0);

Dennis Gläser's avatar
Dennis Gläser committed
50
    ContainedEntityNetworkBuilder builder;
51
    builder.addConfiningSubDomain(domain, Id(1));
Dennis Gläser's avatar
Dennis Gläser committed
52
53
54
    builder.addSubDomainEntity(Disk(Point(0.0, 0.0, 0.1), e1, e2, 1.0, 1.0),  Id(1));
    builder.addSubDomainEntity(Disk(Point(0.0, 0.0, 0.5), e1, e3, 2.0, 2.0),  Id(1));
    builder.addSubDomainEntity(Disk(Point(0.0, 0.0, 0.75), e1, e2, 1.0, 1.0), Id(1));
55

56
    builder.addConfiningSubDomain(domain2, Id(2));
Dennis Gläser's avatar
Dennis Gläser committed
57
58
59
    builder.addSubDomainEntity(Disk(Point(0.0, 0.0, 1.1), e1, e2, 1.0, 1.0),  Id(2));
    builder.addSubDomainEntity(Disk(Point(0.0, 0.0, 1.5), e1, e3, 2.0, 2.0),  Id(2));
    builder.addSubDomainEntity(Disk(Point(0.0, 0.0, 1.75), e1, e2, 1.0, 1.0), Id(2));
60

Dennis Gläser's avatar
Dennis Gläser committed
61
    GmshWriter writer(builder.build());
62
63
64
65
66
67
    writer.write("final", 1.0, 1.0);

    std::cout << "All tests passed" << std::endl;

    return 0;
}