GIT: Resolved conflict

This commit is contained in:
Andrew Heather
2016-12-14 15:56:58 +00:00
779 changed files with 25526 additions and 42273 deletions

View File

@ -28,7 +28,7 @@ License
#include "mapDistribute.H"
#include "unitConversion.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
void Foam::AMIMethod<SourcePatch, TargetPatch>::checkPatches() const

View File

@ -71,44 +71,6 @@ Foam::vector Foam::cyclicAMIPolyPatch::findFaceNormalMaxRadius
}
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
void Foam::cyclicAMIPolyPatch::calcTransforms()
{
const cyclicAMIPolyPatch& half0 = *this;
vectorField half0Areas(half0.size());
forAll(half0, facei)
{
half0Areas[facei] = half0[facei].normal(half0.points());
}
const cyclicAMIPolyPatch& half1 = neighbPatch();
vectorField half1Areas(half1.size());
forAll(half1, facei)
{
half1Areas[facei] = half1[facei].normal(half1.points());
}
calcTransforms
(
half0,
half0.faceCentres(),
half0Areas,
half1.faceCentres(),
half1Areas
);
if (debug)
{
Pout<< "calcTransforms() : patch: " << name() << nl
<< " forwardT = " << forwardT() << nl
<< " reverseT = " << reverseT() << nl
<< " separation = " << separation() << nl
<< " collocated = " << collocated() << nl << endl;
}
}
void Foam::cyclicAMIPolyPatch::calcTransforms
(
const primitivePatch& half0,
@ -323,7 +285,7 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
void Foam::cyclicAMIPolyPatch::resetAMI
(
@ -399,6 +361,42 @@ void Foam::cyclicAMIPolyPatch::resetAMI
}
void Foam::cyclicAMIPolyPatch::calcTransforms()
{
const cyclicAMIPolyPatch& half0 = *this;
vectorField half0Areas(half0.size());
forAll(half0, facei)
{
half0Areas[facei] = half0[facei].normal(half0.points());
}
const cyclicAMIPolyPatch& half1 = neighbPatch();
vectorField half1Areas(half1.size());
forAll(half1, facei)
{
half1Areas[facei] = half1[facei].normal(half1.points());
}
calcTransforms
(
half0,
half0.faceCentres(),
half0Areas,
half1.faceCentres(),
half1Areas
);
if (debug)
{
Pout<< "calcTransforms() : patch: " << name() << nl
<< " forwardT = " << forwardT() << nl
<< " reverseT = " << reverseT() << nl
<< " separation = " << separation() << nl
<< " collocated = " << collocated() << nl << endl;
}
}
void Foam::cyclicAMIPolyPatch::initGeometry(PstreamBuffers& pBufs)
{
// The AMI is no longer valid. Leave it up to demand-driven calculation

View File

@ -53,9 +53,6 @@ class cyclicAMIPolyPatch
:
public coupledPolyPatch
{
private:
// Private Member Functions
//- Return normal of face at max distance from rotation axis

View File

@ -104,7 +104,7 @@ namespace Foam
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class Type, class TrackingData>
bool Foam::FaceCellWave<Type, TrackingData>::updateCell

View File

@ -77,8 +77,6 @@ class FaceCellWave
:
public FaceCellWaveName
{
private:
// Private Member Functions
//- Disallow default bitwise copy construct
@ -90,7 +88,7 @@ private:
protected:
// Private data
// Protected data
//- Reference to mesh
const polyMesh& mesh_;
@ -244,7 +242,7 @@ protected:
void handleExplicitConnections();
// Private static data
// Protected static data
static const scalar geomTol_;
static scalar propagationTol_;

View File

@ -133,7 +133,7 @@ public:
//- Helper class for finding nearest
// Nearest:
// Nearest:
// - point+local index
// - sqr(distance)
// - processor

View File

@ -134,7 +134,7 @@ Foam::Istream& Foam::topoSetSource::checkIs(Istream& is)
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::topoSetSource::addOrDelete
(

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -28,6 +28,7 @@ License
#include "polyMesh.H"
#include "Time.H"
#include "addToRunTimeSelectionTable.H"
#include "mapDistributePolyMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -228,6 +229,37 @@ void cellSet::updateMesh(const mapPolyMesh& morphMap)
}
void cellSet::distribute(const mapDistributePolyMesh& map)
{
boolList inSet(map.nOldCells());
forAllConstIter(cellSet, *this, iter)
{
inSet[iter.key()] = true;
}
map.distributeCellData(inSet);
// Count
label n = 0;
forAll(inSet, celli)
{
if (inSet[celli])
{
n++;
}
}
clear();
resize(n);
forAll(inSet, celli)
{
if (inSet[celli])
{
insert(celli);
}
}
}
void Foam::cellSet::writeDebug
(
Ostream& os,

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -147,9 +147,12 @@ public:
//- Return max index+1.
virtual label maxSize(const polyMesh& mesh) const;
//- Update any stored data for new labels
//- Update any stored data for new labels.
virtual void updateMesh(const mapPolyMesh& morphMap);
//- Update any stored data for mesh redistribution.
virtual void distribute(const mapDistributePolyMesh&);
//- Write maxLen items with label and coordinates.
virtual void writeDebug
(

View File

@ -229,7 +229,13 @@ void cellZoneSet::deleteSet(const topoSet& set)
void cellZoneSet::sync(const polyMesh& mesh)
{}
{
cellSet::sync(mesh);
// Take over contents of cellSet into addressing.
addressing_ = sortedToc();
updateSet();
}
label cellZoneSet::maxSize(const polyMesh& mesh) const

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,7 +25,7 @@ Class
Foam::cellZoneSet
Description
Like cellSet but updates cellZone when writing.
Like cellSet but -reads data from cellZone -updates cellZone when writing.
SourceFiles
cellZone.C
@ -126,7 +126,7 @@ public:
//- Delete elements present in set.
virtual void deleteSet(const topoSet& set);
//- Sync cellZoneSet across coupled patches.
//- Sync cellSet across coupled patches; update cellZone from cellSet
virtual void sync(const polyMesh& mesh);
//- Write maxLen items with label and coordinates.
@ -150,10 +150,6 @@ public:
//- Return max index+1.
virtual label maxSize(const polyMesh& mesh) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,6 +27,7 @@ License
#include "mapPolyMesh.H"
#include "polyMesh.H"
#include "syncTools.H"
#include "mapDistributePolyMesh.H"
#include "addToRunTimeSelectionTable.H"
@ -161,6 +162,37 @@ void faceSet::updateMesh(const mapPolyMesh& morphMap)
}
void faceSet::distribute(const mapDistributePolyMesh& map)
{
boolList inSet(map.nOldFaces());
forAllConstIter(faceSet, *this, iter)
{
inSet[iter.key()] = true;
}
map.distributeFaceData(inSet);
// Count
label n = 0;
forAll(inSet, facei)
{
if (inSet[facei])
{
n++;
}
}
clear();
resize(n);
forAll(inSet, facei)
{
if (inSet[facei])
{
insert(facei);
}
}
}
void faceSet::writeDebug
(
Ostream& os,

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -116,6 +116,9 @@ public:
//- Update any stored data for new labels
virtual void updateMesh(const mapPolyMesh& morphMap);
//- Update any stored data for mesh redistribution.
virtual void distribute(const mapDistributePolyMesh&);
//- Write maxLen items with label and coordinates.
virtual void writeDebug
(

View File

@ -26,6 +26,9 @@ License
#include "faceZoneSet.H"
#include "mapPolyMesh.H"
#include "polyMesh.H"
#include "setToFaceZone.H"
#include "setsToFaceZone.H"
#include "syncTools.H"
#include "addToRunTimeSelectionTable.H"
@ -322,7 +325,132 @@ void faceZoneSet::deleteSet(const topoSet& set)
void faceZoneSet::sync(const polyMesh& mesh)
{}
{
// Make sure that the faceZone is consistent with the faceSet
{
const labelHashSet zoneSet(addressing_);
// Get elements that are in zone but not faceSet
labelHashSet badSet(zoneSet);
badSet -= *this;
// Add elements that are in faceSet but not in zone
labelHashSet fSet(*this);
fSet -= zoneSet;
badSet += fSet;
label nBad = returnReduce(badSet.size(), sumOp<label>());
if (nBad)
{
WarningInFunction << "Detected " << nBad
<< " faces that are in the faceZone but not"
<< " in the faceSet or vice versa."
<< " The faceZoneSet should only be manipulated"
<< " using " << setsToFaceZone::typeName
<< " or " << setToFaceZone::typeName << endl;
}
}
// Make sure that on coupled faces orientation is opposite. Pushes
// master orientation to slave in case of conflict.
// 0 : not in faceZone
// 1 : in faceZone and unflipped
//-1 : in faceZone and flipped
const label UNFLIPPED = 1;
const label FLIPPED = -1;
labelList myZoneFace(mesh.nFaces()-mesh.nInternalFaces(), 0);
forAll(addressing_, i)
{
label bFacei = addressing_[i]-mesh.nInternalFaces();
if (bFacei >= 0)
{
if (flipMap_[i])
{
myZoneFace[bFacei] = FLIPPED;
}
else
{
myZoneFace[bFacei] = UNFLIPPED;
}
}
}
labelList neiZoneFace(myZoneFace);
syncTools::swapBoundaryFaceList(mesh, neiZoneFace);
const PackedBoolList isMasterFace(syncTools::getMasterFaces(mesh));
// Rebuild faceZone addressing and flipMap
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DynamicList<label> newAddressing(addressing_.size());
DynamicList<bool> newFlipMap(flipMap_.size());
forAll(addressing_, i)
{
label facei = addressing_[i];
if (facei < mesh.nInternalFaces())
{
newAddressing.append(facei);
newFlipMap.append(flipMap_[i]);
}
}
for (label facei = mesh.nInternalFaces(); facei < mesh.nFaces(); facei++)
{
label myStat = myZoneFace[facei-mesh.nInternalFaces()];
label neiStat = neiZoneFace[facei-mesh.nInternalFaces()];
if (myStat == 0)
{
if (neiStat == UNFLIPPED)
{
// Neighbour is unflipped so I am flipped
newAddressing.append(facei);
newFlipMap.append(true);
}
else if (neiStat == FLIPPED)
{
newAddressing.append(facei);
newFlipMap.append(false);
}
}
else
{
if (myStat == neiStat)
{
// Conflict. masterFace wins
newAddressing.append(facei);
if (isMasterFace[facei])
{
newFlipMap.append(myStat == FLIPPED);
}
else
{
newFlipMap.append(neiStat == UNFLIPPED);
}
}
else
{
newAddressing.append(facei);
newFlipMap.append(myStat == FLIPPED);
}
}
}
addressing_.transfer(newAddressing);
flipMap_.transfer(newFlipMap);
updateSet();
}
label faceZoneSet::maxSize(const polyMesh& mesh) const

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,7 +25,7 @@ Class
Foam::faceZoneSet
Description
Like faceSet but updates faceZone when writing.
Like faceSet but -reads data from faceZone -updates faceZone when writing.
SourceFiles
faceZone.C
@ -167,10 +167,6 @@ public:
//- Return max index+1.
virtual label maxSize(const polyMesh& mesh) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,6 +27,7 @@ License
#include "mapPolyMesh.H"
#include "polyMesh.H"
#include "syncTools.H"
#include "mapDistributePolyMesh.H"
#include "addToRunTimeSelectionTable.H"
@ -156,6 +157,37 @@ void pointSet::updateMesh(const mapPolyMesh& morphMap)
}
void pointSet::distribute(const mapDistributePolyMesh& map)
{
boolList inSet(map.nOldPoints());
forAllConstIter(pointSet, *this, iter)
{
inSet[iter.key()] = true;
}
map.distributePointData(inSet);
// Count
label n = 0;
forAll(inSet, pointi)
{
if (inSet[pointi])
{
n++;
}
}
clear();
resize(n);
forAll(inSet, pointi)
{
if (inSet[pointi])
{
insert(pointi);
}
}
}
void pointSet::writeDebug
(
Ostream& os,

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -119,6 +119,9 @@ public:
//- Update any stored data for new labels
//virtual void updateMesh(const polyTopoChange& meshMod);
//- Update any stored data for mesh redistribution.
virtual void distribute(const mapDistributePolyMesh&);
//- Write maxLen items with label and coordinates.
virtual void writeDebug
(

View File

@ -230,7 +230,13 @@ void pointZoneSet::deleteSet(const topoSet& set)
void pointZoneSet::sync(const polyMesh& mesh)
{}
{
pointSet::sync(mesh);
// Take over contents of pointSet into addressing.
addressing_ = sortedToc();
updateSet();
}
label pointZoneSet::maxSize(const polyMesh& mesh) const

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,7 +25,8 @@ Class
Foam::pointZoneSet
Description
Like pointSet but updates pointZone when writing.
Like pointSet but -reads data from pointZone -updates pointZone when
writing.
SourceFiles
pointZone.C
@ -153,10 +154,6 @@ public:
//- Return max index+1.
virtual label maxSize(const polyMesh& mesh) const;
};

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -130,7 +130,7 @@ Foam::fileName Foam::topoSet::localPath
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
// Update stored cell numbers using map.
// Do in two passes to prevent allocation if nothing changed.
@ -550,6 +550,26 @@ void Foam::topoSet::updateMesh(const mapPolyMesh&)
}
void Foam::topoSet::removeFiles(const polyMesh& mesh)
{
IOobject io
(
"dummy",
mesh.facesInstance(),
mesh.meshSubDir/"sets",
mesh
);
fileName setsDir(io.path());
if (debug) DebugVar(setsDir);
if (isDir(setsDir))
{
rmDir(setsDir);
}
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::topoSet::operator=(const topoSet& rhs)

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -32,6 +32,7 @@ Description
SourceFiles
topoSet.C
topoSetTemplates.C
\*---------------------------------------------------------------------------*/
@ -54,6 +55,7 @@ namespace Foam
class mapPolyMesh;
class polyMesh;
class primitiveMesh;
class mapDistributePolyMesh;
/*---------------------------------------------------------------------------*\
Class topoSet Declaration
@ -297,9 +299,28 @@ public:
//- Update any stored data for new labels. Not implemented.
virtual void updateMesh(const mapPolyMesh& morphMap);
//- Update any stored data for mesh redistribution.
virtual void distribute(const mapDistributePolyMesh&) = 0;
//- Return max allowable index (+1). Not implemented.
virtual label maxSize(const polyMesh& mesh) const = 0;
//- Helper: call updateMesh on all sets in container (and
// updates instance)
template<class Container>
static void updateMesh
(
const fileName& instance,
const mapPolyMesh&,
Container&
);
//- Helper: set instance on all sets in container
template<class Container>
static void setInstance(const fileName& instance, Container&);
//- Helper: remove all sets files from mesh instance
static void removeFiles(const polyMesh&);
// Member operators
@ -316,6 +337,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "topoSetTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,59 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ 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/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Container>
void Foam::topoSet::setInstance
(
const fileName& instance,
Container& lst
)
{
forAll(lst, i)
{
lst[i].instance() = instance;
}
}
template<class Container>
void Foam::topoSet::updateMesh
(
const fileName& instance,
const mapPolyMesh& map,
Container& lst
)
{
forAll(lst, i)
{
lst[i].instance() = instance;
lst[i].updateMesh(map);
}
}
// ************************************************************************* //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -26,6 +26,7 @@ License
#include "triSurfaceTools.H"
#include "triSurface.H"
#include "MeshedSurface.H"
#include "OFstream.H"
#include "mergePoints.H"
#include "polyMesh.H"
@ -2743,8 +2744,168 @@ void Foam::triSurfaceTools::calcInterpolationWeights
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Tracking:
// Checking:
bool Foam::triSurfaceTools::validTri
(
const triSurface& surf,
const label facei
)
{
typedef labelledTri FaceType;
const FaceType& f = surf[facei];
// Simple check on indices ok.
forAll(f, fp)
{
if (f[fp] < 0 || f[fp] >= surf.points().size())
{
WarningInFunction
<< "triangle " << facei << " vertices " << f
<< " uses point indices outside point range 0.."
<< surf.points().size()-1
<< endl;
return false;
}
}
if (f[0] == f[1] || f[0] == f[2] || f[1] == f[2])
{
WarningInFunction
<< "triangle " << facei
<< " uses non-unique vertices " << f
<< " coords:" << f.points(surf.points())
<< endl;
return false;
}
// duplicate triangle check
const labelList& fFaces = surf.faceFaces()[facei];
// Check if faceNeighbours use same points as this face.
// Note: discards normal information - sides of baffle are merged.
forAll(fFaces, i)
{
label nbrFacei = fFaces[i];
if (nbrFacei <= facei)
{
// lower numbered faces already checked
continue;
}
const FaceType& nbrF = surf[nbrFacei];
// Same as calling triFace::compare(f, nbrF) == 1 only
if
(
(f[0] == nbrF[0] || f[0] == nbrF[1] || f[0] == nbrF[2])
&& (f[1] == nbrF[0] || f[1] == nbrF[1] || f[1] == nbrF[2])
&& (f[2] == nbrF[0] || f[2] == nbrF[1] || f[2] == nbrF[2])
)
{
WarningInFunction
<< "triangle " << facei << " vertices " << f
<< " has the same vertices as triangle " << nbrFacei
<< " vertices " << nbrF
<< " coords:" << f.points(surf.points())
<< endl;
return false;
}
}
return true;
}
bool Foam::triSurfaceTools::validTri
(
const MeshedSurface<face>& surf,
const label facei
)
{
typedef face FaceType;
const FaceType& f = surf[facei];
if (f.size() != 3)
{
WarningInFunction
<< "face " << facei
<< " is not a triangle, it has " << f.size()
<< " indices"
<< endl;
return false;
}
// Simple check on indices ok.
forAll(f, fp)
{
if (f[fp] < 0 || f[fp] >= surf.points().size())
{
WarningInFunction
<< "triangle " << facei << " vertices " << f
<< " uses point indices outside point range 0.."
<< surf.points().size()-1
<< endl;
return false;
}
}
if (f[0] == f[1] || f[0] == f[2] || f[1] == f[2])
{
WarningInFunction
<< "triangle " << facei
<< " uses non-unique vertices " << f
<< " coords:" << f.points(surf.points())
<< endl;
return false;
}
// duplicate triangle check
const labelList& fFaces = surf.faceFaces()[facei];
// Check if faceNeighbours use same points as this face.
// Note: discards normal information - sides of baffle are merged.
forAll(fFaces, i)
{
label nbrFacei = fFaces[i];
if (nbrFacei <= facei)
{
// lower numbered faces already checked
continue;
}
const FaceType& nbrF = surf[nbrFacei];
// Same as calling triFace::compare(f, nbrF) == 1 only
if
(
(f[0] == nbrF[0] || f[0] == nbrF[1] || f[0] == nbrF[2])
&& (f[1] == nbrF[0] || f[1] == nbrF[1] || f[1] == nbrF[2])
&& (f[2] == nbrF[0] || f[2] == nbrF[1] || f[2] == nbrF[2])
)
{
WarningInFunction
<< "triangle " << facei << " vertices " << f
<< " has the same vertices as triangle " << nbrFacei
<< " vertices " << nbrF
<< " coords:" << f.points(surf.points())
<< endl;
return false;
}
}
return true;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Tracking:
// Test point on surface to see if is on face,edge or point.
Foam::surfaceLocation Foam::triSurfaceTools::classify

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -50,11 +50,14 @@ namespace Foam
{
// Forward declaration of classes
class triSurface;
class edge;
class labelledTri;
class polyBoundaryMesh;
class plane;
class triSurface;
class face;
template<class Face> class MeshedSurface;
/*---------------------------------------------------------------------------*\
Class triSurfaceTools Declaration
@ -159,7 +162,7 @@ class triSurfaceTools
);
//- Calculate minimum (cos of) edge angle using addressing from
/// collapsing
// collapsing
// edge to v1 at pt. Returns 1 if v1 is on edge without neighbours
// (and hence no edge angle can be defined)
static scalar collapseMinCosAngle
@ -516,6 +519,15 @@ public:
static triSurface delaunay2D(const List<vector2D>&);
// Surface checking functionality
//- Check single triangle for (topological) validity
static bool validTri(const triSurface&, const label facei);
//- Check single triangle for (topological) validity
static bool validTri(const MeshedSurface<face>&, const label facei);
// Tracking
//- Test point on plane of triangle to see if on edge or point or inside