Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
mattijs
2012-03-28 18:59:46 +01:00
34 changed files with 2064 additions and 882 deletions

View File

@ -2832,7 +2832,7 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
) const
{
label nearestShapeI = -1;
point nearestPoint;
point nearestPoint = vector::zero;
if (nodes_.size())
{
@ -2847,10 +2847,6 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
nearestPoint
);
}
else
{
nearestPoint = vector::zero;
}
return pointIndexHit(nearestShapeI != -1, nearestPoint, nearestShapeI);
}

View File

@ -113,6 +113,17 @@ bool Foam::fileFormats::NASedgeFormat::read
// discard groupID
dynEdges.append(e);
}
else if (cmd == "PLOTEL")
{
edge e;
// label groupId = readLabel(IStringStream(line.substr(16,8))());
e[0] = readLabel(IStringStream(line.substr(16,8))());
e[1] = readLabel(IStringStream(line.substr(24,8))());
// discard groupID
dynEdges.append(e);
}
else if (cmd == "GRID")
{
label index = readLabel(IStringStream(line.substr(8,8))());

View File

@ -28,6 +28,7 @@ License
#include "addToRunTimeSelectionTable.H"
#include "addToMemberFunctionSelectionTable.H"
#include "ListOps.H"
#include "EdgeMap.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -327,10 +328,7 @@ void Foam::edgeMesh::mergePoints(const scalar mergeDist)
}
// Compact using a hashtable and commutative hash of edge.
HashTable<label, edge, Hash<edge> > edgeToLabel
(
2*edges_.size()
);
EdgeMap<label> edgeToLabel(2*edges_.size());
label newEdgeI = 0;
@ -349,13 +347,7 @@ void Foam::edgeMesh::mergePoints(const scalar mergeDist)
edges_.setSize(newEdgeI);
for
(
HashTable<label, edge, Hash<edge> >::const_iterator iter =
edgeToLabel.begin();
iter != edgeToLabel.end();
++iter
)
forAllConstIter(EdgeMap<label>, edgeToLabel, iter)
{
edges_[iter()] = iter.key();
}
@ -363,4 +355,35 @@ void Foam::edgeMesh::mergePoints(const scalar mergeDist)
}
void Foam::edgeMesh::mergeEdges()
{
EdgeMap<label> existingEdges(2*edges_.size());
label curEdgeI = 0;
forAll(edges_, edgeI)
{
const edge& e = edges_[edgeI];
if (existingEdges.insert(e, curEdgeI))
{
curEdgeI++;
}
}
if (debug)
{
Info<< "Merging duplicate edges: "
<< edges_.size() - existingEdges.size()
<< " edges will be deleted." << endl;
}
edges_.setSize(existingEdges.size());
forAllConstIter(EdgeMap<label>, existingEdges, iter)
{
edges_[iter()] = iter.key();
}
}
// ************************************************************************* //

View File

@ -246,6 +246,9 @@ public:
//- Merge common points (points within mergeDist)
void mergePoints(const scalar mergeDist);
//- Merge similar edges
void mergeEdges();
// Write

View File

@ -124,6 +124,7 @@ $(derivedFvPatchFields)/mappedFixedPushedInternalValue/mappedFixedPushedInternal
$(derivedFvPatchFields)/mappedFixedValue/mappedFixedValueFvPatchFields.C
$(derivedFvPatchFields)/mappedVelocityFluxFixedValue/mappedVelocityFluxFixedValueFvPatchField.C
$(derivedFvPatchFields)/mappedFlowRate/mappedFlowRateFvPatchVectorField.C
$(derivedFvPatchFields)/fixedMean/fixedMeanFvPatchFields.C
$(derivedFvPatchFields)/fan/fanFvPatchFields.C
$(derivedFvPatchFields)/fanPressure/fanPressureFvPatchScalarField.C
$(derivedFvPatchFields)/buoyantPressure/buoyantPressureFvPatchScalarField.C

View File

@ -0,0 +1,142 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "fixedMeanFvPatchField.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
fixedMeanFvPatchField<Type>::fixedMeanFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
fixedValueFvPatchField<Type>(p, iF),
meanValue_(pTraits<Type>::zero)
{}
template<class Type>
fixedMeanFvPatchField<Type>::fixedMeanFvPatchField
(
const fixedMeanFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
meanValue_(ptf.meanValue_)
{}
template<class Type>
fixedMeanFvPatchField<Type>::fixedMeanFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchField<Type>(p, iF, dict),
meanValue_(pTraits<Type>(dict.lookup("meanValue")))
{}
template<class Type>
fixedMeanFvPatchField<Type>::fixedMeanFvPatchField
(
const fixedMeanFvPatchField<Type>& ptf
)
:
fixedValueFvPatchField<Type>(ptf),
meanValue_(ptf.meanValue_)
{}
template<class Type>
fixedMeanFvPatchField<Type>::fixedMeanFvPatchField
(
const fixedMeanFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
fixedValueFvPatchField<Type>(ptf, iF),
meanValue_(ptf.meanValue_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void fixedMeanFvPatchField<Type>::updateCoeffs()
{
if (this->updated())
{
return;
}
Field<Type> newValues(this->patchInternalField());
Type meanValuePsi =
gSum(this->patch().magSf()*newValues)
/gSum(this->patch().magSf());
if (mag(meanValue_) > SMALL && mag(meanValuePsi)/mag(meanValue_) > 0.5)
{
newValues *= mag(meanValue_)/mag(meanValuePsi);
}
else
{
newValues += (meanValue_ - meanValuePsi);
}
this->operator==(newValues);
fixedValueFvPatchField<Type>::updateCoeffs();
}
template<class Type>
void fixedMeanFvPatchField<Type>::write(Ostream& os) const
{
fvPatchField<Type>::write(os);
os.writeKeyword("meanValue") << meanValue_ << token::END_STATEMENT << nl;
this->writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,158 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::fixedMeanFvPatchField
Description
Extrapolates field to the patch using the near-cell values and adjusts
the distribution to match the specified meanValue.
SourceFiles
fixedMeanFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef fixedMeanFvPatchField_H
#define fixedMeanFvPatchField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class fixedMeanFvPatch Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class fixedMeanFvPatchField
:
public fixedValueFvPatchField<Type>
{
protected:
// Protected data
//- MeanValue value the field is adjusted to maintain
Type meanValue_;
public:
//- Runtime type information
TypeName("fixedMean");
// Constructors
//- Construct from patch and internal field
fixedMeanFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch, internal field and dictionary
fixedMeanFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct by mapping given fixedMeanFvPatchField
// onto a new patch
fixedMeanFvPatchField
(
const fixedMeanFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
fixedMeanFvPatchField
(
const fixedMeanFvPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchField<Type> >
(
new fixedMeanFvPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
fixedMeanFvPatchField
(
const fixedMeanFvPatchField<Type>&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<Type> > clone
(
const DimensionedField<Type, volMesh>& iF
) const
{
return tmp<fvPatchField<Type> >
(
new fixedMeanFvPatchField<Type>(*this, iF)
);
}
// Member functions
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "fixedMeanFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "fixedMeanFvPatchFields.H"
#include "volMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(fixedMean);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef fixedMeanFvPatchFields_H
#define fixedMeanFvPatchFields_H
#include "fixedMeanFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(fixedMean);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef fixedMeanFvPatchFieldsFwd_H
#define fixedMeanFvPatchFieldsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class fixedMeanFvPatchField;
makePatchTypeFieldTypedefs(fixedMean);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -33,11 +33,15 @@ License
#include "OFstream.H"
#include "IFstream.H"
#include "unitConversion.H"
#include "EdgeMap.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::surfaceFeatures, 0);
const Foam::scalar Foam::surfaceFeatures::parallelTolerance =
sin(degToRad(1.0));
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -170,7 +174,10 @@ void Foam::surfaceFeatures::setFromStatus(const List<edgeStatus>& edgeStat)
//construct feature points where more than 2 feature edges meet
void Foam::surfaceFeatures::calcFeatPoints(const List<edgeStatus>& edgeStat)
void Foam::surfaceFeatures::calcFeatPoints
(
const List<edgeStatus>& edgeStat
)
{
DynamicList<label> featurePoints(surf_.nPoints()/1000);
@ -200,6 +207,60 @@ void Foam::surfaceFeatures::calcFeatPoints(const List<edgeStatus>& edgeStat)
}
void Foam::surfaceFeatures::classifyFeatureAngles
(
const labelListList& edgeFaces,
List<edgeStatus>& edgeStat,
const scalar minCos
) const
{
const vectorField& faceNormals = surf_.faceNormals();
const pointField& points = surf_.points();
forAll(edgeFaces, edgeI)
{
const labelList& eFaces = edgeFaces[edgeI];
if (eFaces.size() != 2)
{
// Non-manifold. What to do here? Is region edge? external edge?
edgeStat[edgeI] = REGION;
}
else
{
label face0 = eFaces[0];
label face1 = eFaces[1];
if (surf_[face0].region() != surf_[face1].region())
{
edgeStat[edgeI] = REGION;
}
else
{
if ((faceNormals[face0] & faceNormals[face1]) < minCos)
{
// Check if convex or concave by looking at angle
// between face centres and normal
vector f0Tof1 =
surf_[face1].centre(points)
- surf_[face0].centre(points);
if ((f0Tof1 & faceNormals[face0]) > 0.0)
{
edgeStat[edgeI] = INTERNAL;
}
else
{
edgeStat[edgeI] = EXTERNAL;
}
}
}
}
}
}
// Returns next feature edge connected to pointI with correct value.
Foam::label Foam::surfaceFeatures::nextFeatEdge
(
@ -436,6 +497,80 @@ Foam::surfaceFeatures::surfaceFeatures
}
Foam::surfaceFeatures::surfaceFeatures
(
const triSurface& surf,
const pointField& points,
const edgeList& edges,
const scalar mergeTol
)
:
surf_(surf),
featurePoints_(0),
featureEdges_(0),
externalStart_(0),
internalStart_(0)
{
// Match edge mesh edges with the triSurface edges
const labelListList& surfEdgeFaces = surf_.edgeFaces();
const edgeList& surfEdges = surf_.edges();
scalar mergeTolSqr = sqr(mergeTol);
EdgeMap<label> dynFeatEdges(2*edges.size());
DynamicList<labelList> dynFeatureEdgeFaces(edges.size());
labelList edgeLabel;
nearestFeatEdge
(
edges,
points,
mergeTolSqr,
edgeLabel // label of surface edge or -1
);
label count = 0;
forAll(edgeLabel, sEdgeI)
{
const label sEdge = edgeLabel[sEdgeI];
if (sEdge == -1)
{
continue;
}
dynFeatEdges.insert(surfEdges[sEdge], count++);
dynFeatureEdgeFaces.append(surfEdgeFaces[sEdge]);
}
// Find whether an edge is external or internal
List<edgeStatus> edgeStat(dynFeatEdges.size(), NONE);
classifyFeatureAngles(dynFeatureEdgeFaces, edgeStat, GREAT);
// Transfer the edge status to a list encompassing all edges in the surface
// so that calcFeatPoints can be used.
List<edgeStatus> allEdgeStat(surf_.nEdges(), NONE);
forAll(allEdgeStat, eI)
{
EdgeMap<label>::const_iterator iter = dynFeatEdges.find(surfEdges[eI]);
if (iter != dynFeatEdges.end())
{
allEdgeStat[eI] = edgeStat[iter()];
}
}
edgeStat.clear();
dynFeatEdges.clear();
setFromStatus(allEdgeStat);
}
//- Construct as copy
Foam::surfaceFeatures::surfaceFeatures(const surfaceFeatures& sf)
:
@ -496,54 +631,10 @@ void Foam::surfaceFeatures::findFeatures(const scalar includedAngle)
{
scalar minCos = Foam::cos(degToRad(180.0 - includedAngle));
const labelListList& edgeFaces = surf_.edgeFaces();
const vectorField& faceNormals = surf_.faceNormals();
const pointField& points = surf_.points();
// Per edge whether is feature edge.
List<edgeStatus> edgeStat(surf_.nEdges(), NONE);
forAll(edgeFaces, edgeI)
{
const labelList& eFaces = edgeFaces[edgeI];
if (eFaces.size() != 2)
{
// Non-manifold. What to do here? Is region edge? external edge?
edgeStat[edgeI] = REGION;
}
else
{
label face0 = eFaces[0];
label face1 = eFaces[1];
if (surf_[face0].region() != surf_[face1].region())
{
edgeStat[edgeI] = REGION;
}
else
{
if ((faceNormals[face0] & faceNormals[face1]) < minCos)
{
// Check if convex or concave by looking at angle
// between face centres and normal
vector f0Tof1 =
surf_[face1].centre(points)
- surf_[face0].centre(points);
if ((f0Tof1 & faceNormals[face0]) > 0.0)
{
edgeStat[edgeI] = INTERNAL;
}
else
{
edgeStat[edgeI] = EXTERNAL;
}
}
}
}
}
classifyFeatureAngles(surf_.edgeFaces(), edgeStat, minCos);
setFromStatus(edgeStat);
}
@ -1147,6 +1238,9 @@ void Foam::surfaceFeatures::nearestSurfEdge
const pointField& localPoints = surf_.localPoints();
treeBoundBox searchDomain(localPoints);
searchDomain.inflate(0.1);
indexedOctree<treeDataEdge> ppTree
(
treeDataEdge
@ -1156,7 +1250,7 @@ void Foam::surfaceFeatures::nearestSurfEdge
localPoints,
selectedEdges
), // all information needed to do geometric checks
treeBoundBox(localPoints), // overall search domain
searchDomain, // overall search domain
8, // maxLevel
10, // leafsize
3.0 // duplicity
@ -1216,6 +1310,8 @@ void Foam::surfaceFeatures::nearestSurfEdge
pointOnEdge.setSize(selectedSampleEdges.size());
pointOnFeature.setSize(selectedSampleEdges.size());
treeBoundBox searchDomain(surf_.localPoints());
indexedOctree<treeDataEdge> ppTree
(
treeDataEdge
@ -1224,11 +1320,11 @@ void Foam::surfaceFeatures::nearestSurfEdge
surf_.edges(),
surf_.localPoints(),
selectedEdges
), // all information needed to do geometric checks
treeBoundBox(surf_.localPoints()), // overall search domain
8, // maxLevel
10, // leafsize
3.0 // duplicity
), // all information needed to do geometric checks
searchDomain, // overall search domain
8, // maxLevel
10, // leafsize
3.0 // duplicity
);
forAll(selectedSampleEdges, i)
@ -1262,6 +1358,67 @@ void Foam::surfaceFeatures::nearestSurfEdge
}
void Foam::surfaceFeatures::nearestFeatEdge
(
const edgeList& edges,
const pointField& points,
scalar searchSpanSqr, // Search span
labelList& edgeLabel
) const
{
edgeLabel = labelList(surf_.nEdges(), -1);
treeBoundBox searchDomain(points);
searchDomain.inflate(0.1);
indexedOctree<treeDataEdge> ppTree
(
treeDataEdge
(
false,
edges,
points,
identity(edges.size())
), // all information needed to do geometric checks
searchDomain, // overall search domain
8, // maxLevel
10, // leafsize
3.0 // duplicity
);
const edgeList& surfEdges = surf_.edges();
const pointField& surfLocalPoints = surf_.localPoints();
forAll(surfEdges, edgeI)
{
const edge& sample = surfEdges[edgeI];
const point& startPoint = surfLocalPoints[sample.start()];
const point& midPoint = sample.centre(surfLocalPoints);
pointIndexHit infoMid = ppTree.findNearest
(
midPoint,
searchSpanSqr
);
if (infoMid.hit())
{
const vector surfEdgeDir = midPoint - startPoint;
const edge& featEdge = edges[infoMid.index()];
const vector featEdgeDir = featEdge.vec(points);
// Check that the edges are nearly parallel
if (mag(surfEdgeDir ^ featEdgeDir) < parallelTolerance)
{
edgeLabel[edgeI] = edgeI;
}
}
}
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::surfaceFeatures::operator=(const surfaceFeatures& rhs)

View File

@ -95,6 +95,11 @@ private:
{}
};
// Static data
//- Tolerance for determining whether two vectors are parallel
static const scalar parallelTolerance;
// Private data
@ -130,6 +135,14 @@ private:
//- Construct feature points where more than 2 feature edges meet
void calcFeatPoints(const List<edgeStatus>&);
//- Classify the angles of the feature edges
void classifyFeatureAngles
(
const labelListList& edgeFaces,
List<edgeStatus>& edgeStat,
const scalar minCos
) const;
//- Choose next unset feature edge.
label nextFeatEdge
(
@ -186,6 +199,15 @@ public:
//- Construct from file
surfaceFeatures(const triSurface&, const fileName& fName);
//- Construct from pointField and edgeList (edgeMesh)
surfaceFeatures
(
const triSurface&,
const pointField& points,
const edgeList& edges,
const scalar mergeTol = 1e-6
);
//- Construct as copy
surfaceFeatures(const surfaceFeatures&);
@ -327,9 +349,8 @@ public:
pointField& edgePoint
) const;
//- Find nearest surface edge (out of selectedEdges) for each
// sample edge.
// sample edge.
// Sets:
// - edgeLabel : label of surface edge.
// - pointOnEdge : exact position of nearest point on edge.
@ -347,6 +368,16 @@ public:
pointField& pointOnFeature // point on sample edge
) const;
//- Find nearest feature edge to each surface edge. Uses the
// mid-point of the surface edges.
void nearestFeatEdge
(
const edgeList& edges,
const pointField& points,
scalar searchSpanSqr,
labelList& edgeLabel
) const;
// Write