searchingEngine_CGAL.H
Go to the documentation of this file.
1 Random rndGen(653213);
2 
3 // Determine mesh bounding boxes:
4 List<treeBoundBox> meshBb
5 (
6  1,
7  treeBoundBox(coarseMesh.points()).extend(rndGen, 1e-3)
8 );
9 
10 // Dummy bounds dictionary
12 dict.add("bounds", meshBb);
13 dict.add
14 (
15  "distributionType",
16  distributedTriSurfaceMesh::distributionTypeNames_
17  [
18  distributedTriSurfaceMesh::FROZEN
19  ]
20 );
21 dict.add("mergeDistance", SMALL);
22 
23 labelList triSurfaceToAgglom(5*nFineFaces);
24 
25 const triSurface localSurface = triangulate
26 (
27  patches,
28  includePatches,
29  finalAgglom,
31  globalNumbering,
32  coarsePatches
33 );
34 
35 
36 // CGAL surface
37 
38 distributedTriSurfaceMesh 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 
53 triSurfaceToAgglom.resize(surfacesMesh.size());
54 
56 
57 std::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
88 Tree tree(triangles.begin(), triangles.end());
distributedTriSurfaceMesh surfacesMesh(IOobject("wallSurface.stl", runTime.constant(), "triSurface", runTime, IOobject::NO_READ, IOobject::NO_WRITE), localSurface, dict)
const triSurface localSurface
Random rndGen(653213)
List< treeBoundBox > meshBb(1, treeBoundBox(coarseMesh.points()).extend(rndGen, 1e-3))
engineTime & runTime
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
std::vector< Triangle > triangles
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:38
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Tree tree(triangles.begin(), triangles.end())
labelList triSurfaceToAgglom(5 *nFineFaces)
labelList f(nPoints)
CGAL::Point_3< K > Point
vector point
Point is a vector.
Definition: point.H:37
dictionary dict
const dimensionedScalar c
Speed of light in a vacuum.
const polyBoundaryMesh & patches
List< label > labelList
A List of labels.
Definition: List.H:62
const pointField & pts