mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: viewFactorsGen with std::vector (reserve) instead of std::list
This commit is contained in:
@ -25,7 +25,7 @@ dict.add("mergeDistance", SMALL);
|
|||||||
|
|
||||||
labelList triSurfaceToAgglom(5*nFineFaces);
|
labelList triSurfaceToAgglom(5*nFineFaces);
|
||||||
|
|
||||||
triSurface localSurface = triangulate
|
const triSurface localSurface = triangulate
|
||||||
(
|
(
|
||||||
patches,
|
patches,
|
||||||
includePatches,
|
includePatches,
|
||||||
@ -57,28 +57,35 @@ triSurfaceToAgglom.resize(surfacesMesh.size());
|
|||||||
|
|
||||||
surfacesMesh.setField(triSurfaceToAgglom);
|
surfacesMesh.setField(triSurfaceToAgglom);
|
||||||
|
|
||||||
const pointField& pts = surfacesMesh.localPoints();
|
std::vector<Triangle> triangles;
|
||||||
|
|
||||||
std::list<Triangle> triangles;
|
|
||||||
|
|
||||||
for (const auto& triLocal : surfacesMesh.localFaces())
|
|
||||||
{
|
{
|
||||||
point p1l = pts[triLocal[0]];
|
const auto& surf = static_cast<const triSurface&>(surfacesMesh);
|
||||||
point p2l = pts[triLocal[1]];
|
|
||||||
point p3l = pts[triLocal[2]];
|
|
||||||
|
|
||||||
Point p1(p1l[0], p1l[1], p1l[2]);
|
triangles.reserve(surf.size());
|
||||||
Point p2(p2l[0], p2l[1], p2l[2]);
|
|
||||||
Point p3(p3l[0], p3l[1], p3l[2]);
|
|
||||||
|
|
||||||
Triangle tri(p1, p2, p3);
|
const pointField& pts = surf.points();
|
||||||
|
|
||||||
if (tri.is_degenerate())
|
for (const auto& f : surf)
|
||||||
{
|
{
|
||||||
std::cout << tri << std::endl;
|
const point& a = pts[f.a()];
|
||||||
|
const point& b = pts[f.b()];
|
||||||
|
const point& c = pts[f.c()];
|
||||||
|
|
||||||
|
triangles.emplace_back
|
||||||
|
(
|
||||||
|
Point(a.x(), a.y(), a.z()),
|
||||||
|
Point(b.x(), b.y(), b.z()),
|
||||||
|
Point(c.x(), c.y(), c.z())
|
||||||
|
);
|
||||||
|
|
||||||
|
if (triangles.back().is_degenerate())
|
||||||
|
{
|
||||||
|
std::cout << triangles.back() << std::endl;
|
||||||
}
|
}
|
||||||
triangles.push_back(tri);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// constructs AABB tree
|
// constructs AABB tree
|
||||||
Tree tree(triangles.begin(), triangles.end());
|
Tree tree(triangles.begin(), triangles.end());
|
||||||
|
|||||||
@ -100,6 +100,7 @@ Description
|
|||||||
#endif
|
#endif
|
||||||
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
|
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
#include <CGAL/Simple_cartesian.h>
|
#include <CGAL/Simple_cartesian.h>
|
||||||
#include <CGAL/AABB_tree.h>
|
#include <CGAL/AABB_tree.h>
|
||||||
#include <CGAL/AABB_traits.h>
|
#include <CGAL/AABB_traits.h>
|
||||||
@ -112,7 +113,7 @@ typedef K::Direction_3 Vector3C;
|
|||||||
typedef K::Triangle_3 Triangle;
|
typedef K::Triangle_3 Triangle;
|
||||||
typedef K::Segment_3 Segment;
|
typedef K::Segment_3 Segment;
|
||||||
|
|
||||||
typedef std::list<Triangle>::iterator Iterator;
|
typedef std::vector<Triangle>::iterator Iterator;
|
||||||
typedef CGAL::AABB_triangle_primitive<K, Iterator> Primitive;
|
typedef CGAL::AABB_triangle_primitive<K, Iterator> Primitive;
|
||||||
typedef CGAL::AABB_traits<K, Primitive> AABB_triangle_traits;
|
typedef CGAL::AABB_traits<K, Primitive> AABB_triangle_traits;
|
||||||
typedef CGAL::AABB_tree<AABB_triangle_traits> Tree;
|
typedef CGAL::AABB_tree<AABB_triangle_traits> Tree;
|
||||||
@ -872,7 +873,7 @@ int main(int argc, char *argv[])
|
|||||||
GaussPoints[4][4] = -GaussPoints[4][3];
|
GaussPoints[4][4] = -GaussPoints[4][3];
|
||||||
|
|
||||||
|
|
||||||
List<scalarList> GaussWeights(5);
|
FixedList<scalarList, 5> GaussWeights;
|
||||||
GaussWeights[0].setSize(1);
|
GaussWeights[0].setSize(1);
|
||||||
GaussWeights[0] = 2;
|
GaussWeights[0] = 2;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user