Loading...
Searching...
No Matches
searchingEngine_CGAL.H
Go to the documentation of this file.
1Random rndGen(653213);
2
3// Determine mesh bounding boxes:
4List<treeBoundBox> meshBb
5(
6 1,
7 treeBoundBox(coarseMesh.points()).extend(rndGen, 1e-3)
8);
9
10// Dummy bounds dictionary
12dict.add("bounds", meshBb);
14(
15 "distributionType",
16 distributedTriSurfaceMesh::distributionTypeNames_
17 [
18 distributedTriSurfaceMesh::FROZEN
19 ]
20);
21dict.add("mergeDistance", SMALL);
22
23labelList triSurfaceToAgglom(5*nFineFaces);
24
25const triSurface localSurface = triangulate
26(
27 patches,
28 includePatches,
29 finalAgglom,
31 globalNumbering,
32 coarsePatches
33);
34
35
36// CGAL surface
37
38distributedTriSurfaceMesh surfacesMesh
39(
40 IOobject
41 (
42 "wallSurface.stl",
43 runTime.constant(), // directory
44 "triSurface", // instance
45 runTime, // registry
46 IOobject::NO_READ,
47 IOobject::NO_WRITE
48 ),
50 dict
51);
52
54
56
57std::vector<Triangle> triangles;
58
59{
60 const auto& surf = static_cast<const triSurface&>(surfacesMesh);
61
62 triangles.reserve(surf.size());
63
64 const pointField& pts = surf.points();
65
66 for (const auto& f : surf)
67 {
68 const point& a = pts[f.a()];
69 const point& b = pts[f.b()];
70 const point& c = pts[f.c()];
71
72 triangles.emplace_back
73 (
74 Point(a.x(), a.y(), a.z()),
75 Point(b.x(), b.y(), b.z()),
76 Point(c.x(), c.y(), c.z())
77 );
78
79 if (triangles.back().is_degenerate())
80 {
81 std::cout << triangles.back() << std::endl;
82 }
83 }
84}
85
86
87// constructs AABB tree
88Tree tree(triangles.begin(), triangles.end());
CGAL::Point_3< K > Point
const polyBoundaryMesh & patches
engineTime & runTime
labelList f(nPoints)
dictionary dict
labelList triSurfaceToAgglom(5 *nFineFaces)
const triSurface localSurface
List< treeBoundBox > meshBb(1, treeBoundBox(coarseMesh.points()).extend(rndGen, 1e-3))
distributedTriSurfaceMesh surfacesMesh(IOobject("wallSurface.stl", runTime.constant(), "triSurface", runTime, IOobject::NO_READ, IOobject::NO_WRITE), localSurface, dict)
const pointField & pts
labelList triSurfaceToAgglom(5 *nFineFaces)
List< treeBoundBox > meshBb(1, treeBoundBox(coarseMesh.points()).extend(rndGen, 1e-3))
std::vector< Triangle > triangles
distributedTriSurfaceMesh surfacesMesh(IOobject("wallSurface.stl", runTime.constant(), "triSurface", runTime, IOobject::NO_READ, IOobject::NO_WRITE), localSurface, dict)
Tree tree(triangles.begin(), triangles.end())
volScalarField & b
volScalarField & e
Random rndGen