BUG: cut/paste error in searchableExtrudedCircle

- use vector::removeCollinear a few places

COMP: incorrect initialization order in edgeFaceCirculator

COMP: Silence boost bind deprecation warnings (before CGAL-5.2.1)
This commit is contained in:
Mark Olesen 2022-04-21 09:45:28 +02:00
parent 8e6f2ca5de
commit 442c309dca
12 changed files with 38 additions and 29 deletions

View File

@ -32,10 +32,16 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef CGAL3DKernel_H
#define CGAL3DKernel_H
#ifndef Foam_CGAL3DKernel_H
#define Foam_CGAL3DKernel_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Silence boost bind deprecation warnings (before CGAL-5.2.1)
#include "CGAL/version.h"
#if defined(CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1050211000)
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
#endif
// ------------------------------------------------------------------------- //
#ifdef CGAL_INEXACT
@ -51,7 +57,6 @@ Description
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif

View File

@ -90,6 +90,12 @@ Description
#ifndef NO_CGAL
// Silence boost bind deprecation warnings (before CGAL-5.2.1)
#include "CGAL/version.h"
#if defined(CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1050211000)
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
#endif
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/AABB_face_graph_triangle_primitive.h>

View File

@ -222,7 +222,7 @@ void Foam::enrichedPatch::calcCutFaces() const
// Get the vector along the edge and the right vector
vector ahead = curPoint - lp[prevPointLabel];
ahead -= normal*(normal & ahead);
ahead.removeCollinear(normal);
ahead.normalise();
const vector right = normalised(normal ^ ahead);
@ -248,7 +248,7 @@ void Foam::enrichedPatch::calcCutFaces() const
vector newDir = lp[nextPoints[nextI]] - curPoint;
// Pout<< " newDir: " << newDir
// << " mag: " << mag(newDir) << flush;
newDir -= normal*(normal & newDir);
newDir.removeCollinear(normal);
scalar magNewDir = mag(newDir);
// Pout<< " corrected: " << newDir
// << " mag: " << mag(newDir) << flush;

View File

@ -382,7 +382,7 @@ void Foam::edgeInterpolation::makeDeltaCoeffs() const
faceCentres[neighbour[edgeI]]
- faceCentres[owner[edgeI]];
unitDelta -= edgeNormal*(edgeNormal & unitDelta);
unitDelta.removeCollinear(edgeNormal);
unitDelta.normalise();
@ -482,7 +482,7 @@ void Foam::edgeInterpolation::makeCorrectionVectors() const
faceCentres[neighbour[edgeI]]
- faceCentres[owner[edgeI]];
unitDelta -= edgeNormal*(edgeNormal & unitDelta);
unitDelta.removeCollinear(edgeNormal);
unitDelta.normalise();
// Edge normal - area tangent

View File

@ -44,15 +44,15 @@ inline bool directionalWallPointData<Type>::update
)
{
vector d(pt - w2.origin());
// Knock out component in direction of n
d -= n*(d&n);
d.removeCollinear(n);
scalar dist2 = magSqr(d);
if (this->valid(n))
{
vector d(pt - this->origin());
// Knock out component in direction of n
d -= n*(d&n);
d.removeCollinear(n);
scalar currentDistSqr(magSqr(d));
scalar diff = currentDistSqr - dist2;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2021 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -88,8 +88,7 @@ Foam::tensor Foam::coordinateRotations::axes::rotation
ax2 = findOrthogonal(axis1);
}
// Remove colinear component
ax2 -= ((ax1 & ax2) * ax1);
ax2.removeCollinear(ax1);
magAxis2 = mag(ax2);
@ -102,8 +101,7 @@ Foam::tensor Foam::coordinateRotations::axes::rotation
ax2 = findOrthogonal(axis1);
// Remove colinear component
ax2 -= ((ax1 & ax2) * ax1);
ax2.removeCollinear(ax1);
magAxis2 = mag(ax2);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2021 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -235,8 +235,7 @@ Foam::tensor Foam::coordSystem::cylindrical::R(const point& global) const
vector ax2(global - origin_);
// Remove colinear component
ax2 -= ((ax1 & ax2) * ax1);
ax2.removeCollinear(ax1);
const scalar magAxis2(mag(ax2));

View File

@ -118,9 +118,9 @@ Foam::edgeFaceCirculator::edgeFaceCirculator
)
:
meshPtr_(&mesh),
faceLabel_(faceLabel),
ownerSide_(ownerSide),
isBoundaryEdge_(isBoundaryEdge),
faceLabel_(faceLabel),
index_(index),
startFaceLabel_(faceLabel_)
{}

View File

@ -385,7 +385,7 @@ void Foam::searchableExtrudedCircle::findParametricNearest
vector radialStart;
{
radialStart = start-curvePoints[0];
radialStart -= (radialStart&axialVecs[0])*axialVecs[0];
radialStart.removeCollinear(axialVecs[0]);
radialStart.normalise();
qStart = quaternion(radialStart, 0.0);
@ -396,11 +396,11 @@ void Foam::searchableExtrudedCircle::findParametricNearest
quaternion qProjectedEnd;
{
vector radialEnd(end-curvePoints.last());
radialEnd -= (radialEnd&axialVecs.last())*axialVecs.last();
radialEnd.removeCollinear(axialVecs.last());
radialEnd.normalise();
vector projectedEnd = radialEnd;
projectedEnd -= (projectedEnd&axialVecs[0])*axialVecs[0];
projectedEnd.removeCollinear(axialVecs[0]);
projectedEnd.normalise();
qProjectedEnd = quaternion(projectedEnd, 0.0);
@ -413,7 +413,7 @@ void Foam::searchableExtrudedCircle::findParametricNearest
quaternion q(slerp(qStart, qProjectedEnd, lambdas[i]));
vector radialDir(q.transform(radialStart));
radialDir -= (radialDir & axialVecs[i]) * axialVecs.last();
radialDir.removeCollinear(axialVecs[i]);
radialDir.normalise();
info[i] = pointIndexHit(true, curvePoints[i]+radius_*radialDir, 0);
@ -462,7 +462,7 @@ void Foam::searchableExtrudedCircle::getNormal
// Subtract axial direction
const vector axialVec = edges[curvePt.index()].unitVec(points);
normal[i] -= (normal[i] & axialVec) * axialVec;
normal[i].removeCollinear(axialVec);
normal[i].normalise();
}
}

View File

@ -558,7 +558,7 @@ void Foam::searchableSurfacesQueries::findNearest
// Calculate vector to move onto intersection line
vector d(r.refPoint()-near[i]);
d -= (d&n)*n;
d.removeCollinear(n);
// Trim the max distance
scalar magD = mag(d);

View File

@ -326,7 +326,7 @@ bool Foam::edgeIntersections::rotatePerturb
scalar magN = mag(n) + VSMALL;
n /= magN;
rndVec -= n*(n & rndVec);
rndVec.removeCollinear(n);
rndVec.normalise();
// Scale to be moved by tolerance.

View File

@ -101,7 +101,8 @@ Foam::pointToPointPlanarInterpolation::calcCoordinateSystem
{
const point& p2 = points[i];
vector e2(p2 - p0);
e2 -= (e2&e1)*e1;
e2.removeCollinear(e1);
scalar magE2 = mag(e2);
if (magE2 > maxDist)