tetrahedron: triangle: Improved barycentric handling on tets and tris

Updated the tetrahedron and triangle classes to use the barycentric
primitives. Removed duplicate code for generating random positions in
tets and tris, and fixed bug in tri random position.
This commit is contained in:
Will Bainbridge
2017-06-06 12:01:02 +01:00
parent 7a2c87c10f
commit 14cc288672
17 changed files with 497 additions and 127 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -97,7 +97,7 @@ Foam::scalarField Foam::cellShapeControl::cellSize
Foam::scalar Foam::cellShapeControl::cellSize(const point& pt) const
{
FixedList<scalar, 4> bary;
barycentric bary;
cellShapeControlMesh::Cell_handle ch;
shapeControlMesh_.barycentricCoords(pt, bary, ch);
@ -172,7 +172,7 @@ Foam::scalar Foam::cellShapeControl::cellSize(const point& pt) const
Foam::tensor Foam::cellShapeControl::cellAlignment(const point& pt) const
{
FixedList<scalar, 4> bary;
barycentric bary;
cellShapeControlMesh::Cell_handle ch;
shapeControlMesh_.barycentricCoords(pt, bary, ch);
@ -244,7 +244,7 @@ void Foam::cellShapeControl::cellSizeAndAlignment
tensor& alignment
) const
{
FixedList<scalar, 4> bary;
barycentric bary;
cellShapeControlMesh::Cell_handle ch;
shapeControlMesh_.barycentricCoords(pt, bary, ch);

View File

@ -452,7 +452,7 @@ Foam::cellShapeControlMesh::~cellShapeControlMesh()
void Foam::cellShapeControlMesh::barycentricCoords
(
const Foam::point& pt,
FixedList<scalar, 4>& bary,
barycentric& bary,
Cell_handle& ch
) const
{
@ -472,7 +472,7 @@ void Foam::cellShapeControlMesh::barycentricCoords
topoint(ch->vertex(3)->point())
);
tet.barycentric(pt, bary);
bary = tet.pointToBarycentric(pt);
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -122,7 +122,7 @@ public:
void barycentricCoords
(
const Foam::point& pt,
FixedList<scalar, 4>& bary,
barycentric& bary,
Cell_handle& ch
) const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -118,8 +118,7 @@ Foam::scalar Foam::nonUniformField::interpolate
pts[faceHitByPt[2]]
);
FixedList<scalar, 3> bary;
tri.barycentric(pt, bary);
const barycentric2D bary = tri.pointToBarycentric(pt);
// return pointCellSize_[pMap[faceHitByPt[0]]]*bary[0]
// + pointCellSize_[pMap[faceHitByPt[1]]]*bary[1]