ENH: topoDistanceData: templated on passive data type.
Also adds pointTopoDistance, edgeTopoDistance.
This commit is contained in:
parent
9b4462e07b
commit
c3571b7357
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -88,12 +88,12 @@ labelList nearestPatch(const polyMesh& mesh, const labelList& patchIDs)
|
||||
}
|
||||
|
||||
// Field on cells and faces.
|
||||
List<topoDistanceData> cellData(mesh.nCells());
|
||||
List<topoDistanceData> faceData(mesh.nFaces());
|
||||
List<topoDistanceData<label>> cellData(mesh.nCells());
|
||||
List<topoDistanceData<label>> faceData(mesh.nFaces());
|
||||
|
||||
// Start of changes
|
||||
labelList patchFaces(nFaces);
|
||||
List<topoDistanceData> patchData(nFaces);
|
||||
List<topoDistanceData<label>> patchData(nFaces);
|
||||
nFaces = 0;
|
||||
for (const label patchi : patchIDs)
|
||||
{
|
||||
@ -102,13 +102,13 @@ labelList nearestPatch(const polyMesh& mesh, const labelList& patchIDs)
|
||||
forAll(pp, i)
|
||||
{
|
||||
patchFaces[nFaces] = pp.start()+i;
|
||||
patchData[nFaces] = topoDistanceData(patchi, 0);
|
||||
patchData[nFaces] = topoDistanceData<label>(0, patchi);
|
||||
++nFaces;
|
||||
}
|
||||
}
|
||||
|
||||
// Propagate information inwards
|
||||
FaceCellWave<topoDistanceData> deltaCalc
|
||||
FaceCellWave<topoDistanceData<label>> deltaCalc
|
||||
(
|
||||
mesh,
|
||||
patchFaces,
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -34,7 +34,7 @@ License
|
||||
#include "syncTools.H"
|
||||
#include "meshTools.H"
|
||||
#include "PatchEdgeFaceWave.H"
|
||||
#include "patchEdgeFaceRegion.H"
|
||||
#include "edgeTopoDistanceData.H"
|
||||
#include "globalIndex.H"
|
||||
#include "OBJstream.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
@ -511,8 +511,8 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection
|
||||
|
||||
|
||||
// Data on all edges and faces
|
||||
List<patchEdgeFaceRegion> allEdgeInfo(patch.nEdges());
|
||||
List<patchEdgeFaceRegion> allFaceInfo(patch.size());
|
||||
List<edgeTopoDistanceData<label>> allEdgeInfo(patch.nEdges());
|
||||
List<edgeTopoDistanceData<label>> allFaceInfo(patch.size());
|
||||
|
||||
bool search = true;
|
||||
|
||||
@ -528,12 +528,12 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection
|
||||
while (search)
|
||||
{
|
||||
DynamicList<label> changedEdges;
|
||||
DynamicList<patchEdgeFaceRegion> changedInfo;
|
||||
DynamicList<edgeTopoDistanceData<label>> changedInfo;
|
||||
|
||||
label seedFacei = labelMax;
|
||||
for (; oldFaceID < patch.size(); oldFaceID++)
|
||||
{
|
||||
if (allFaceInfo[oldFaceID].region() == -1)
|
||||
if (allFaceInfo[oldFaceID].data() == -1)
|
||||
{
|
||||
seedFacei = globalFaces.toGlobal(oldFaceID);
|
||||
break;
|
||||
@ -553,7 +553,7 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection
|
||||
|
||||
forAll(fEdges, i)
|
||||
{
|
||||
if (allEdgeInfo[fEdges[i]].region() != -1)
|
||||
if (allEdgeInfo[fEdges[i]].data() != -1)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Problem in edge face wave: attempted to assign a "
|
||||
@ -563,7 +563,14 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection
|
||||
}
|
||||
|
||||
changedEdges.append(fEdges[i]);
|
||||
changedInfo.append(regioni);
|
||||
changedInfo.append
|
||||
(
|
||||
edgeTopoDistanceData<label>
|
||||
(
|
||||
0, // distance
|
||||
regioni
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -571,7 +578,7 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection
|
||||
PatchEdgeFaceWave
|
||||
<
|
||||
indirectPrimitivePatch,
|
||||
patchEdgeFaceRegion
|
||||
edgeTopoDistanceData<label>
|
||||
> calc
|
||||
(
|
||||
mesh_,
|
||||
@ -588,7 +595,7 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection
|
||||
label nCells = 0;
|
||||
forAll(allFaceInfo, facei)
|
||||
{
|
||||
if (allFaceInfo[facei].region() == regioni)
|
||||
if (allFaceInfo[facei].data() == regioni)
|
||||
{
|
||||
nCells++;
|
||||
}
|
||||
@ -611,7 +618,7 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection
|
||||
|
||||
forAll(allFaceInfo, facei)
|
||||
{
|
||||
regioni = allFaceInfo[facei].region();
|
||||
regioni = allFaceInfo[facei].data();
|
||||
|
||||
regionFaceIDs[regioni].append(faceLocalPatchIDs[facei]);
|
||||
regionFacePatchIDs[regioni].append(facePatchIDs[facei]);
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -417,12 +417,12 @@ Foam::labelList Foam::meshRefinement::nearestPatch
|
||||
}
|
||||
|
||||
// Field on cells and faces.
|
||||
List<topoDistanceData> cellData(mesh_.nCells());
|
||||
List<topoDistanceData> faceData(mesh_.nFaces());
|
||||
List<topoDistanceData<label>> cellData(mesh_.nCells());
|
||||
List<topoDistanceData<label>> faceData(mesh_.nFaces());
|
||||
|
||||
// Start of changes
|
||||
labelList patchFaces(nFaces);
|
||||
List<topoDistanceData> patchData(nFaces);
|
||||
List<topoDistanceData<label>> patchData(nFaces);
|
||||
nFaces = 0;
|
||||
forAll(adaptPatchIDs, i)
|
||||
{
|
||||
@ -432,13 +432,13 @@ Foam::labelList Foam::meshRefinement::nearestPatch
|
||||
forAll(pp, i)
|
||||
{
|
||||
patchFaces[nFaces] = pp.start()+i;
|
||||
patchData[nFaces] = topoDistanceData(patchi, 0);
|
||||
patchData[nFaces] = topoDistanceData<label>(0, patchi);
|
||||
nFaces++;
|
||||
}
|
||||
}
|
||||
|
||||
// Propagate information inwards
|
||||
FaceCellWave<topoDistanceData> deltaCalc
|
||||
FaceCellWave<topoDistanceData<label>> deltaCalc
|
||||
(
|
||||
mesh_,
|
||||
patchFaces,
|
||||
@ -542,12 +542,12 @@ Foam::labelList Foam::meshRefinement::nearestIntersection
|
||||
labelList nearestRegion(mesh_.nFaces(), defaultRegion);
|
||||
|
||||
// Field on cells and faces.
|
||||
List<topoDistanceData> cellData(mesh_.nCells());
|
||||
List<topoDistanceData> faceData(mesh_.nFaces());
|
||||
List<topoDistanceData<label>> cellData(mesh_.nCells());
|
||||
List<topoDistanceData<label>> faceData(mesh_.nFaces());
|
||||
|
||||
// Start walking from all intersected faces
|
||||
DynamicList<label> patchFaces(start.size());
|
||||
DynamicList<topoDistanceData> patchData(start.size());
|
||||
DynamicList<topoDistanceData<label>> patchData(start.size());
|
||||
forAll(start, i)
|
||||
{
|
||||
label facei = testFaces[i];
|
||||
@ -555,18 +555,18 @@ Foam::labelList Foam::meshRefinement::nearestIntersection
|
||||
{
|
||||
patchFaces.append(facei);
|
||||
label regioni = surfaces_.globalRegion(surface1[i], region1[i]);
|
||||
patchData.append(topoDistanceData(regioni, 0));
|
||||
patchData.append(topoDistanceData<label>(0, regioni));
|
||||
}
|
||||
else if (surface2[i] != -1)
|
||||
{
|
||||
patchFaces.append(facei);
|
||||
label regioni = surfaces_.globalRegion(surface2[i], region2[i]);
|
||||
patchData.append(topoDistanceData(regioni, 0));
|
||||
patchData.append(topoDistanceData<label>(0, regioni));
|
||||
}
|
||||
}
|
||||
|
||||
// Propagate information inwards
|
||||
FaceCellWave<topoDistanceData> deltaCalc
|
||||
FaceCellWave<topoDistanceData<label>> deltaCalc
|
||||
(
|
||||
mesh_,
|
||||
patchFaces,
|
||||
|
@ -47,7 +47,7 @@ License
|
||||
#include "OBJstream.H"
|
||||
#include "patchFaceOrientation.H"
|
||||
#include "PatchEdgeFaceWave.H"
|
||||
#include "patchEdgeFaceRegion.H"
|
||||
#include "edgeTopoDistanceData.H"
|
||||
#include "polyMeshAdder.H"
|
||||
#include "IOmanip.H"
|
||||
#include "refinementParameters.H"
|
||||
@ -3507,8 +3507,8 @@ Foam::label Foam::meshRefinement::markPatchZones
|
||||
labelList& faceToZone
|
||||
) const
|
||||
{
|
||||
List<patchEdgeFaceRegion> allEdgeInfo(patch.nEdges());
|
||||
List<patchEdgeFaceRegion> allFaceInfo(patch.size());
|
||||
List<edgeTopoDistanceData<label>> allEdgeInfo(patch.nEdges());
|
||||
List<edgeTopoDistanceData<label>> allFaceInfo(patch.size());
|
||||
|
||||
|
||||
// Protect all non-manifold edges
|
||||
@ -3519,7 +3519,7 @@ Foam::label Foam::meshRefinement::markPatchZones
|
||||
{
|
||||
if (nMasterFacesPerEdge[edgeI] > 2)
|
||||
{
|
||||
allEdgeInfo[edgeI] = -2;
|
||||
allEdgeInfo[edgeI] = edgeTopoDistanceData<label>(0, -2);
|
||||
nProtected++;
|
||||
}
|
||||
}
|
||||
@ -3532,12 +3532,12 @@ Foam::label Foam::meshRefinement::markPatchZones
|
||||
// Hand out zones
|
||||
|
||||
DynamicList<label> changedEdges;
|
||||
DynamicList<patchEdgeFaceRegion> changedInfo;
|
||||
DynamicList<edgeTopoDistanceData<label>> changedInfo;
|
||||
|
||||
const scalar tol = PatchEdgeFaceWave
|
||||
<
|
||||
indirectPrimitivePatch,
|
||||
patchEdgeFaceRegion
|
||||
edgeTopoDistanceData<label>
|
||||
>::propagationTol();
|
||||
|
||||
int dummyTrackData;
|
||||
@ -3577,11 +3577,11 @@ Foam::label Foam::meshRefinement::markPatchZones
|
||||
|
||||
if (procI == Pstream::myProcNo())
|
||||
{
|
||||
patchEdgeFaceRegion& faceInfo = allFaceInfo[seedFaceI];
|
||||
edgeTopoDistanceData<label>& faceInfo = allFaceInfo[seedFaceI];
|
||||
|
||||
|
||||
// Set face
|
||||
faceInfo = currentZoneI;
|
||||
faceInfo = edgeTopoDistanceData<label>(0, currentZoneI);
|
||||
|
||||
// .. and seed its edges
|
||||
const labelList& fEdges = patch.faceEdges()[seedFaceI];
|
||||
@ -3589,7 +3589,7 @@ Foam::label Foam::meshRefinement::markPatchZones
|
||||
{
|
||||
label edgeI = fEdges[fEdgeI];
|
||||
|
||||
patchEdgeFaceRegion& edgeInfo = allEdgeInfo[edgeI];
|
||||
edgeTopoDistanceData<label>& edgeInfo = allEdgeInfo[edgeI];
|
||||
|
||||
if
|
||||
(
|
||||
@ -3622,7 +3622,7 @@ Foam::label Foam::meshRefinement::markPatchZones
|
||||
PatchEdgeFaceWave
|
||||
<
|
||||
indirectPrimitivePatch,
|
||||
patchEdgeFaceRegion
|
||||
edgeTopoDistanceData<label>
|
||||
> calc
|
||||
(
|
||||
mesh_,
|
||||
@ -3648,7 +3648,7 @@ Foam::label Foam::meshRefinement::markPatchZones
|
||||
<< " at " << patch.faceCentres()[faceI]
|
||||
<< exit(FatalError);
|
||||
}
|
||||
faceToZone[faceI] = allFaceInfo[faceI].region();
|
||||
faceToZone[faceI] = allFaceInfo[faceI].data();
|
||||
}
|
||||
|
||||
return currentZoneI;
|
||||
|
@ -94,7 +94,6 @@ patchWave = $(algorithms)/PatchEdgeFaceWave
|
||||
$(patchWave)/PatchEdgeFaceWaveName.C
|
||||
$(patchWave)/patchEdgeFaceInfo.C
|
||||
$(patchWave)/patchPatchDist.C
|
||||
$(patchWave)/patchEdgeFaceRegion.C
|
||||
$(patchWave)/patchEdgeFaceRegions.C
|
||||
|
||||
|
||||
@ -297,8 +296,6 @@ PatchFunction1/makePatchFunction1s.C
|
||||
PatchFunction1/coordinateLabelScaling.C
|
||||
|
||||
meshStructure/meshStructure.C
|
||||
meshStructure/topoDistanceData.C
|
||||
meshStructure/pointTopoDistanceData.C
|
||||
|
||||
output/foamVtkIndPatchWriter.C
|
||||
output/foamVtkWriteTopoSet.C
|
||||
|
@ -0,0 +1,52 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type, class PrimitivePatchType>
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Foam::Ostream& os,
|
||||
const Foam::edgeTopoDistanceData<Type, PrimitivePatchType>& wDist
|
||||
)
|
||||
{
|
||||
return os << wDist.distance_ << token::SPACE << wDist.data_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type, class PrimitivePatchType>
|
||||
Foam::Istream& Foam::operator>>
|
||||
(
|
||||
Foam::Istream& is,
|
||||
Foam::edgeTopoDistanceData<Type, PrimitivePatchType>& wDist
|
||||
)
|
||||
{
|
||||
return is >> wDist.distance_ >> wDist.data_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,253 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019,2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
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::edgeTopoDistanceData
|
||||
|
||||
Description
|
||||
For use with PatchEdgeFaceWave. Determines topological distance to
|
||||
starting edges. Templated on passive transported data.
|
||||
|
||||
SourceFiles
|
||||
edgeTopoDistanceDataI.H
|
||||
edgeTopoDistanceData.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef edgeTopoDistanceData_H
|
||||
#define edgeTopoDistanceData_H
|
||||
|
||||
#include "point.H"
|
||||
#include "tensor.H"
|
||||
#include "indirectPrimitivePatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward Declarations
|
||||
class polyPatch;
|
||||
class polyMesh;
|
||||
template<class Type, class PrimitivePatchType>
|
||||
class edgeTopoDistanceData;
|
||||
|
||||
template<class Type, class PrimitivePatchType>
|
||||
Istream& operator>>
|
||||
(
|
||||
Istream&,
|
||||
edgeTopoDistanceData<Type, PrimitivePatchType>&
|
||||
);
|
||||
template<class Type, class PrimitivePatchType>
|
||||
Ostream& operator<<
|
||||
(
|
||||
Ostream&,
|
||||
const edgeTopoDistanceData<Type, PrimitivePatchType>&
|
||||
);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class edgeTopoDistanceData Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type, class PrimitivePatchType = indirectPrimitivePatch>
|
||||
class edgeTopoDistanceData
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Distance
|
||||
label distance_;
|
||||
|
||||
//- Starting data
|
||||
Type data_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
typedef Type dataType;
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null with invalid (-1) for distance, null constructor
|
||||
// for data
|
||||
inline edgeTopoDistanceData();
|
||||
|
||||
//- Construct from distance, data
|
||||
inline edgeTopoDistanceData
|
||||
(
|
||||
const label distance,
|
||||
const Type& data
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
inline label distance() const
|
||||
{
|
||||
return distance_;
|
||||
}
|
||||
|
||||
inline const Type& data() const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
|
||||
// Needed by PatchEdgeFaceWave
|
||||
|
||||
//- Check whether origin has been changed at all or
|
||||
// still contains original (invalid) value.
|
||||
template<class TrackingData>
|
||||
inline bool valid(TrackingData& td) const;
|
||||
|
||||
//- Apply rotation matrix
|
||||
template<class TrackingData>
|
||||
inline void transform
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const PrimitivePatchType& patch,
|
||||
const tensor& rotTensor,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Influence of face on edge
|
||||
template<class TrackingData>
|
||||
inline bool updateEdge
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const PrimitivePatchType& patch,
|
||||
const label edgeI,
|
||||
const label facei,
|
||||
const edgeTopoDistanceData<Type, PrimitivePatchType>& faceInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- New information for edge (from e.g. coupled edge)
|
||||
template<class TrackingData>
|
||||
inline bool updateEdge
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const PrimitivePatchType& patch,
|
||||
const edgeTopoDistanceData<Type, PrimitivePatchType>& edgeInfo,
|
||||
const bool sameOrientation,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Influence of edge on face.
|
||||
template<class TrackingData>
|
||||
inline bool updateFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const PrimitivePatchType& patch,
|
||||
const label facei,
|
||||
const label edgeI,
|
||||
const edgeTopoDistanceData<Type, PrimitivePatchType>& edgeInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Same (like operator==)
|
||||
template<class TrackingData>
|
||||
inline bool equal
|
||||
(
|
||||
const edgeTopoDistanceData<Type, PrimitivePatchType>&,
|
||||
TrackingData&
|
||||
) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
// Needed for List IO
|
||||
inline bool operator==
|
||||
(
|
||||
const edgeTopoDistanceData<Type, PrimitivePatchType>&
|
||||
) const;
|
||||
inline bool operator!=
|
||||
(
|
||||
const edgeTopoDistanceData<Type, PrimitivePatchType>&
|
||||
) const;
|
||||
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Ostream& operator<< <Type, PrimitivePatchType>
|
||||
(
|
||||
Ostream&,
|
||||
const edgeTopoDistanceData<Type, PrimitivePatchType>&
|
||||
);
|
||||
friend Istream& operator>> <Type, PrimitivePatchType>
|
||||
(
|
||||
Istream&,
|
||||
edgeTopoDistanceData<Type, PrimitivePatchType>&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
//- Data are contiguous if data type is contiguous
|
||||
template<class Type, class PrimitivePatchType>
|
||||
struct is_contiguous<edgeTopoDistanceData<Type, PrimitivePatchType>> :
|
||||
is_contiguous<Type> {};
|
||||
|
||||
//- Data are contiguous label if data type is label
|
||||
template<class Type, class PrimitivePatchType>
|
||||
struct is_contiguous_label<edgeTopoDistanceData<Type, PrimitivePatchType>> :
|
||||
is_contiguous_label<Type> {};
|
||||
|
||||
//- Data are contiguous scalar if data type is scalar
|
||||
template<class Type, class PrimitivePatchType>
|
||||
struct is_contiguous_scalar<edgeTopoDistanceData<Type, PrimitivePatchType>> :
|
||||
is_contiguous_scalar<Type>{};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "edgeTopoDistanceData.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "edgeTopoDistanceDataI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,188 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
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 "polyMesh.H"
|
||||
#include "transform.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type, class PrimitivePatchType>
|
||||
inline
|
||||
Foam::edgeTopoDistanceData<Type, PrimitivePatchType>::edgeTopoDistanceData()
|
||||
:
|
||||
distance_(-1),
|
||||
data_()
|
||||
{}
|
||||
|
||||
|
||||
template<class Type, class PrimitivePatchType>
|
||||
inline
|
||||
Foam::edgeTopoDistanceData<Type, PrimitivePatchType>::edgeTopoDistanceData
|
||||
(
|
||||
const label distance,
|
||||
const Type& data
|
||||
)
|
||||
:
|
||||
distance_(distance),
|
||||
data_(data)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type, class PrimitivePatchType>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::edgeTopoDistanceData<Type, PrimitivePatchType>::valid
|
||||
(
|
||||
TrackingData& td
|
||||
) const
|
||||
{
|
||||
return distance_ != -1;
|
||||
}
|
||||
|
||||
|
||||
template<class Type, class PrimitivePatchType>
|
||||
template<class TrackingData>
|
||||
inline void Foam::edgeTopoDistanceData<Type, PrimitivePatchType>::transform
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const PrimitivePatchType& patch,
|
||||
const tensor& rotTensor,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
template<class Type, class PrimitivePatchType>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::edgeTopoDistanceData<Type, PrimitivePatchType>::updateEdge
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const PrimitivePatchType& patch,
|
||||
const label edgeI,
|
||||
const label facei,
|
||||
const edgeTopoDistanceData<Type, PrimitivePatchType>& faceInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
// From face to edge
|
||||
if (distance_ == -1)
|
||||
{
|
||||
data_ = faceInfo.data_;
|
||||
distance_ = faceInfo.distance_ + 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
template<class Type, class PrimitivePatchType>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::edgeTopoDistanceData<Type, PrimitivePatchType>::updateEdge
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const PrimitivePatchType& patch,
|
||||
const edgeTopoDistanceData<Type, PrimitivePatchType>& edgeInfo,
|
||||
const bool sameOrientation,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
// From edge to edge (e.g. coupled edges)
|
||||
if (distance_ == -1)
|
||||
{
|
||||
this->operator=(edgeInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
template<class Type, class PrimitivePatchType>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::edgeTopoDistanceData<Type, PrimitivePatchType>::updateFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const PrimitivePatchType& patch,
|
||||
const label facei,
|
||||
const label edgeI,
|
||||
const edgeTopoDistanceData<Type, PrimitivePatchType>& edgeInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
// From edge to face
|
||||
if (distance_ == -1)
|
||||
{
|
||||
this->operator=(edgeInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
template<class Type, class PrimitivePatchType>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::edgeTopoDistanceData<Type, PrimitivePatchType>::equal
|
||||
(
|
||||
const edgeTopoDistanceData<Type, PrimitivePatchType>& rhs,
|
||||
TrackingData& td
|
||||
) const
|
||||
{
|
||||
return operator==(rhs);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type, class PrimitivePatchType>
|
||||
inline bool Foam::edgeTopoDistanceData<Type, PrimitivePatchType>::operator==
|
||||
(
|
||||
const Foam::edgeTopoDistanceData<Type, PrimitivePatchType>& rhs
|
||||
) const
|
||||
{
|
||||
return distance() == rhs.distance() && data() == rhs.data();
|
||||
}
|
||||
|
||||
|
||||
template<class Type, class PrimitivePatchType>
|
||||
inline bool Foam::edgeTopoDistanceData<Type, PrimitivePatchType>::operator!=
|
||||
(
|
||||
const Foam::edgeTopoDistanceData<Type, PrimitivePatchType>& rhs
|
||||
) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -110,8 +110,8 @@ void Foam::meshStructure::correct
|
||||
)
|
||||
{
|
||||
// Field on cells and faces.
|
||||
List<topoDistanceData> cellData(mesh.nCells());
|
||||
List<topoDistanceData> faceData(mesh.nFaces());
|
||||
List<topoDistanceData<label>> cellData(mesh.nCells());
|
||||
List<topoDistanceData<label>> faceData(mesh.nFaces());
|
||||
|
||||
{
|
||||
if (debug)
|
||||
@ -124,20 +124,20 @@ void Foam::meshStructure::correct
|
||||
|
||||
// Start of changes
|
||||
labelList patchFaces(pp.size());
|
||||
List<topoDistanceData> patchData(pp.size());
|
||||
List<topoDistanceData<label>> patchData(pp.size());
|
||||
forAll(pp, patchFacei)
|
||||
{
|
||||
patchFaces[patchFacei] = pp.addressing()[patchFacei];
|
||||
patchData[patchFacei] = topoDistanceData
|
||||
patchData[patchFacei] = topoDistanceData<label>
|
||||
(
|
||||
globalFaces.toGlobal(patchFacei),
|
||||
0
|
||||
0, // distance
|
||||
globalFaces.toGlobal(patchFacei) // passive data
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Propagate information inwards
|
||||
FaceCellWave<topoDistanceData> distanceCalc
|
||||
FaceCellWave<topoDistanceData<label>> distanceCalc
|
||||
(
|
||||
mesh,
|
||||
patchFaces,
|
||||
@ -232,25 +232,25 @@ void Foam::meshStructure::correct
|
||||
}
|
||||
|
||||
// Field on edges and points.
|
||||
List<pointTopoDistanceData> edgeData(mesh.nEdges());
|
||||
List<pointTopoDistanceData> pointData(mesh.nPoints());
|
||||
List<pointTopoDistanceData<label>> edgeData(mesh.nEdges());
|
||||
List<pointTopoDistanceData<label>> pointData(mesh.nPoints());
|
||||
|
||||
// Start of changes
|
||||
labelList patchPoints(pp.nPoints());
|
||||
List<pointTopoDistanceData> patchData(pp.nPoints());
|
||||
List<pointTopoDistanceData<label>> patchData(pp.nPoints());
|
||||
forAll(pp.meshPoints(), patchPointi)
|
||||
{
|
||||
patchPoints[patchPointi] = pp.meshPoints()[patchPointi];
|
||||
patchData[patchPointi] = pointTopoDistanceData
|
||||
patchData[patchPointi] = pointTopoDistanceData<label>
|
||||
(
|
||||
globalPoints.toGlobal(patchPointi),
|
||||
0
|
||||
0, // distance
|
||||
globalPoints.toGlobal(patchPointi) // passive data
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Walk
|
||||
PointEdgeWave<pointTopoDistanceData> distanceCalc
|
||||
PointEdgeWave<pointTopoDistanceData<label>> distanceCalc
|
||||
(
|
||||
mesh,
|
||||
patchPoints,
|
||||
@ -308,7 +308,8 @@ void Foam::meshStructure::correct
|
||||
// << " at:" << mesh.faceCentres()[facei]
|
||||
// << " data:" << faceData[facei]
|
||||
// << " pointDatas:"
|
||||
// << UIndirectList<pointTopoDistanceData>(pointData, f)
|
||||
// << UIndirectList<pointTopoDistanceData<label>>
|
||||
// (pointData, f)
|
||||
// << endl;
|
||||
|
||||
label patchFacei = faceData[facei].data();
|
||||
|
@ -26,27 +26,27 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "pointTopoDistanceData.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const pointTopoDistanceData& rhs
|
||||
Foam::Ostream& os,
|
||||
const Foam::pointTopoDistanceData<Type>& wDist
|
||||
)
|
||||
{
|
||||
return os << rhs.data_ << token::SPACE << rhs.distance_;
|
||||
return os << wDist.distance_ << token::SPACE << wDist.data_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::Istream& Foam::operator>>
|
||||
(
|
||||
Istream& is,
|
||||
pointTopoDistanceData& rhs
|
||||
Foam::Istream& is,
|
||||
Foam::pointTopoDistanceData<Type>& wDist
|
||||
)
|
||||
{
|
||||
return is >> rhs.data_ >> rhs.distance_;
|
||||
return is >> wDist.distance_ >> wDist.data_;
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,7 +29,7 @@ Class
|
||||
|
||||
Description
|
||||
For use with PointEdgeWave. Determines topological distance to
|
||||
starting points
|
||||
starting points. Templated on passive transported data.
|
||||
|
||||
SourceFiles
|
||||
pointTopoDistanceDataI.H
|
||||
@ -51,38 +51,45 @@ namespace Foam
|
||||
// Forward Declarations
|
||||
class polyPatch;
|
||||
class polyMesh;
|
||||
class pointTopoDistanceData;
|
||||
|
||||
Istream& operator>>(Istream&, pointTopoDistanceData&);
|
||||
Ostream& operator<<(Ostream&, const pointTopoDistanceData&);
|
||||
template<class Type> class pointTopoDistanceData;
|
||||
template<class Type>
|
||||
Istream& operator>>(Istream&, pointTopoDistanceData<Type>&);
|
||||
template<class Type>
|
||||
Ostream& operator<<(Ostream&, const pointTopoDistanceData<Type>&);
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class pointTopoDistanceData Declaration
|
||||
Class pointTopoDistanceData Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class pointTopoDistanceData
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- Starting data
|
||||
label data_;
|
||||
// Protected data
|
||||
|
||||
//- Distance
|
||||
label distance_;
|
||||
|
||||
//- Starting data
|
||||
Type data_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
typedef Type dataType;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Default construct, with invalid (-1) for data and distance
|
||||
//- Construct null with invalid (-1) for distance, null constructor
|
||||
// for data
|
||||
inline pointTopoDistanceData();
|
||||
|
||||
//- Construct from components
|
||||
inline pointTopoDistanceData
|
||||
(
|
||||
const label data,
|
||||
const label distance
|
||||
const label distance,
|
||||
const Type& data
|
||||
);
|
||||
|
||||
|
||||
@ -90,16 +97,16 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
label data() const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
label distance() const
|
||||
inline label distance() const
|
||||
{
|
||||
return distance_;
|
||||
}
|
||||
|
||||
inline const Type& data() const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
|
||||
// Needed by PointEdgeWave
|
||||
|
||||
@ -111,7 +118,7 @@ public:
|
||||
template<class TrackingData>
|
||||
inline bool sameGeometry
|
||||
(
|
||||
const pointTopoDistanceData&,
|
||||
const pointTopoDistanceData<Type>&,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
) const;
|
||||
@ -152,7 +159,7 @@ public:
|
||||
const polyMesh& mesh,
|
||||
const label pointi,
|
||||
const label edgeI,
|
||||
const pointTopoDistanceData& edgeInfo,
|
||||
const pointTopoDistanceData<Type>& edgeInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
@ -164,7 +171,7 @@ public:
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label pointi,
|
||||
const pointTopoDistanceData& newPointInfo,
|
||||
const pointTopoDistanceData<Type>& newPointInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
@ -174,7 +181,7 @@ public:
|
||||
template<class TrackingData>
|
||||
inline bool updatePoint
|
||||
(
|
||||
const pointTopoDistanceData& newPointInfo,
|
||||
const pointTopoDistanceData<Type>& newPointInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
@ -186,44 +193,54 @@ public:
|
||||
const polyMesh& mesh,
|
||||
const label edgeI,
|
||||
const label pointi,
|
||||
const pointTopoDistanceData& pointInfo,
|
||||
const pointTopoDistanceData<Type>& pointInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Test for equality, with TrackingData
|
||||
template<class TrackingData>
|
||||
inline bool equal(const pointTopoDistanceData&, TrackingData&)
|
||||
inline bool equal(const pointTopoDistanceData<Type>&, TrackingData&)
|
||||
const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Test for equality
|
||||
inline bool operator==(const pointTopoDistanceData&) const;
|
||||
|
||||
//- Test for inequality
|
||||
inline bool operator!=(const pointTopoDistanceData&) const;
|
||||
// Needed for List IO
|
||||
inline bool operator==(const pointTopoDistanceData<Type>&) const;
|
||||
inline bool operator!=(const pointTopoDistanceData<Type>&) const;
|
||||
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Ostream& operator<<(Ostream&, const pointTopoDistanceData&);
|
||||
friend Istream& operator>>(Istream&, pointTopoDistanceData&);
|
||||
friend Ostream& operator<< <Type>
|
||||
(
|
||||
Ostream&,
|
||||
const pointTopoDistanceData<Type>&
|
||||
);
|
||||
friend Istream& operator>> <Type>
|
||||
(
|
||||
Istream&,
|
||||
pointTopoDistanceData<Type>&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Contiguous data for pointTopoDistanceData
|
||||
template<> struct is_contiguous<pointTopoDistanceData> : std::true_type {};
|
||||
//- Data are contiguous if data type is contiguous
|
||||
template<class Type>
|
||||
struct is_contiguous<pointTopoDistanceData<Type>> : is_contiguous<Type> {};
|
||||
|
||||
//- Contiguous label data for pointTopoDistanceData
|
||||
template<> struct is_contiguous_label<pointTopoDistanceData>
|
||||
:
|
||||
std::true_type
|
||||
{};
|
||||
//- Data are contiguous label if data type is label
|
||||
template<class Type>
|
||||
struct is_contiguous_label<pointTopoDistanceData<Type>> :
|
||||
is_contiguous_label<Type> {};
|
||||
|
||||
//- Data are contiguous scalar if data type is scalar
|
||||
template<class Type>
|
||||
struct is_contiguous_scalar<pointTopoDistanceData<Type>> :
|
||||
is_contiguous_scalar<Type>{};
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -231,6 +248,12 @@ template<> struct is_contiguous_label<pointTopoDistanceData>
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "pointTopoDistanceData.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "pointTopoDistanceDataI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
@ -30,38 +30,42 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::pointTopoDistanceData::pointTopoDistanceData()
|
||||
template<class Type>
|
||||
inline Foam::pointTopoDistanceData<Type>::pointTopoDistanceData()
|
||||
:
|
||||
data_(-1),
|
||||
distance_(-1)
|
||||
distance_(-1),
|
||||
data_()
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::pointTopoDistanceData::pointTopoDistanceData
|
||||
template<class Type>
|
||||
inline Foam::pointTopoDistanceData<Type>::pointTopoDistanceData
|
||||
(
|
||||
const label data,
|
||||
const label distance
|
||||
const label distance,
|
||||
const Type& data
|
||||
)
|
||||
:
|
||||
data_(data),
|
||||
distance_(distance)
|
||||
distance_(distance),
|
||||
data_(data)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::pointTopoDistanceData::valid(TrackingData& td) const
|
||||
inline bool Foam::pointTopoDistanceData<Type>::valid(TrackingData& td) const
|
||||
{
|
||||
return distance_ != -1;
|
||||
}
|
||||
|
||||
|
||||
// No geometric data so never any problem on cyclics
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::pointTopoDistanceData::sameGeometry
|
||||
inline bool Foam::pointTopoDistanceData<Type>::sameGeometry
|
||||
(
|
||||
const pointTopoDistanceData&,
|
||||
const pointTopoDistanceData<Type>&,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
) const
|
||||
@ -71,8 +75,9 @@ inline bool Foam::pointTopoDistanceData::sameGeometry
|
||||
|
||||
|
||||
// No geometric data.
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline void Foam::pointTopoDistanceData::leaveDomain
|
||||
inline void Foam::pointTopoDistanceData<Type>::leaveDomain
|
||||
(
|
||||
const polyPatch& patch,
|
||||
const label patchPointi,
|
||||
@ -83,8 +88,9 @@ inline void Foam::pointTopoDistanceData::leaveDomain
|
||||
|
||||
|
||||
// No geometric data.
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline void Foam::pointTopoDistanceData::transform
|
||||
inline void Foam::pointTopoDistanceData<Type>::transform
|
||||
(
|
||||
const tensor& rotTensor,
|
||||
TrackingData& td
|
||||
@ -93,8 +99,9 @@ inline void Foam::pointTopoDistanceData::transform
|
||||
|
||||
|
||||
// No geometric data.
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline void Foam::pointTopoDistanceData::enterDomain
|
||||
inline void Foam::pointTopoDistanceData<Type>::enterDomain
|
||||
(
|
||||
const polyPatch& patch,
|
||||
const label patchPointi,
|
||||
@ -105,21 +112,22 @@ inline void Foam::pointTopoDistanceData::enterDomain
|
||||
|
||||
|
||||
// Update this with information from connected edge
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::pointTopoDistanceData::updatePoint
|
||||
inline bool Foam::pointTopoDistanceData<Type>::updatePoint
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label pointi,
|
||||
const label edgeI,
|
||||
const pointTopoDistanceData& edgeInfo,
|
||||
const pointTopoDistanceData<Type>& edgeInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
if (distance_ == -1)
|
||||
{
|
||||
data_ = edgeInfo.data_;
|
||||
distance_ = edgeInfo.distance_ + 1;
|
||||
data_ = edgeInfo.data_;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -128,19 +136,21 @@ inline bool Foam::pointTopoDistanceData::updatePoint
|
||||
|
||||
|
||||
// Update this with new information on same point
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::pointTopoDistanceData::updatePoint
|
||||
inline bool Foam::pointTopoDistanceData<Type>::updatePoint
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label pointi,
|
||||
const pointTopoDistanceData& newPointInfo,
|
||||
const pointTopoDistanceData<Type>& newPointInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
if (distance_ == -1)
|
||||
{
|
||||
operator=(newPointInfo);
|
||||
distance_ = newPointInfo.distance_;
|
||||
data_ = newPointInfo.data_;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -149,17 +159,19 @@ inline bool Foam::pointTopoDistanceData::updatePoint
|
||||
|
||||
|
||||
// Update this with new information on same point. No extra information.
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::pointTopoDistanceData::updatePoint
|
||||
inline bool Foam::pointTopoDistanceData<Type>::updatePoint
|
||||
(
|
||||
const pointTopoDistanceData& newPointInfo,
|
||||
const pointTopoDistanceData<Type>& newPointInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
if (distance_ == -1)
|
||||
{
|
||||
operator=(newPointInfo);
|
||||
distance_ = newPointInfo.distance_;
|
||||
data_ = newPointInfo.data_;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -168,20 +180,22 @@ inline bool Foam::pointTopoDistanceData::updatePoint
|
||||
|
||||
|
||||
// Update this with information from connected point
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::pointTopoDistanceData::updateEdge
|
||||
inline bool Foam::pointTopoDistanceData<Type>::updateEdge
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label edgeI,
|
||||
const label pointi,
|
||||
const pointTopoDistanceData& pointInfo,
|
||||
const pointTopoDistanceData<Type>& pointInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
if (distance_ == -1)
|
||||
{
|
||||
operator=(pointInfo);
|
||||
distance_ = pointInfo.distance_;
|
||||
data_ = pointInfo.data_;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -189,10 +203,11 @@ inline bool Foam::pointTopoDistanceData::updateEdge
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::pointTopoDistanceData::equal
|
||||
inline bool Foam::pointTopoDistanceData<Type>::equal
|
||||
(
|
||||
const pointTopoDistanceData& rhs,
|
||||
const pointTopoDistanceData<Type>& rhs,
|
||||
TrackingData& td
|
||||
) const
|
||||
{
|
||||
@ -202,18 +217,20 @@ inline bool Foam::pointTopoDistanceData::equal
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
inline bool Foam::pointTopoDistanceData::operator==
|
||||
template<class Type>
|
||||
inline bool Foam::pointTopoDistanceData<Type>::operator==
|
||||
(
|
||||
const pointTopoDistanceData& rhs
|
||||
const Foam::pointTopoDistanceData<Type>& rhs
|
||||
) const
|
||||
{
|
||||
return data_ == rhs.data_ && distance_ == rhs.distance_;
|
||||
return distance() == rhs.distance() && data() == rhs.data();
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::pointTopoDistanceData::operator!=
|
||||
template<class Type>
|
||||
inline bool Foam::pointTopoDistanceData<Type>::operator!=
|
||||
(
|
||||
const pointTopoDistanceData& rhs
|
||||
const Foam::pointTopoDistanceData<Type>& rhs
|
||||
) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
|
@ -30,23 +30,25 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const topoDistanceData& rhs
|
||||
Foam::Ostream& os,
|
||||
const Foam::topoDistanceData<Type>& wDist
|
||||
)
|
||||
{
|
||||
return os << rhs.data_ << token::SPACE << rhs.distance_;
|
||||
return os << wDist.distance_ << token::SPACE << wDist.data_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::Istream& Foam::operator>>
|
||||
(
|
||||
Istream& is,
|
||||
topoDistanceData& rhs
|
||||
Foam::Istream& is,
|
||||
Foam::topoDistanceData<Type>& wDist
|
||||
)
|
||||
{
|
||||
return is >> rhs.data_ >> rhs.distance_;
|
||||
return is >> wDist.distance_ >> wDist.data_;
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,7 +28,8 @@ Class
|
||||
Foam::topoDistanceData
|
||||
|
||||
Description
|
||||
For use with FaceCellWave. Determines topological distance to starting faces
|
||||
For use with FaceCellWave. Determines topological distance to starting
|
||||
faces. Templated on passive transported data.
|
||||
|
||||
SourceFiles
|
||||
topoDistanceDataI.H
|
||||
@ -50,38 +51,42 @@ namespace Foam
|
||||
// Forward Declarations
|
||||
class polyPatch;
|
||||
class polyMesh;
|
||||
class topoDistanceData;
|
||||
template<class Type> class topoDistanceData;
|
||||
|
||||
Istream& operator>>(Istream&, topoDistanceData&);
|
||||
Ostream& operator<<(Ostream&, const topoDistanceData&);
|
||||
template<class Type>
|
||||
Istream& operator>>(Istream&, topoDistanceData<Type>&);
|
||||
template<class Type>
|
||||
Ostream& operator<<(Ostream&, const topoDistanceData<Type>&);
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class topoDistanceData Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class topoDistanceData
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- Starting data
|
||||
label data_;
|
||||
|
||||
//- Distance
|
||||
label distance_;
|
||||
|
||||
//- Starting data
|
||||
Type data_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Default construct, with invalid (-1) for data and distance
|
||||
//- Construct null with invalid (-1) for distance, null constructor
|
||||
// for data
|
||||
inline topoDistanceData();
|
||||
|
||||
//- Construct from components
|
||||
inline topoDistanceData
|
||||
(
|
||||
const label data,
|
||||
const label distance
|
||||
const label distance,
|
||||
const Type& data
|
||||
);
|
||||
|
||||
|
||||
@ -89,16 +94,16 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
label data() const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
label distance() const
|
||||
inline label distance() const
|
||||
{
|
||||
return distance_;
|
||||
}
|
||||
|
||||
inline const Type& data() const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
|
||||
// Needed by FaceCellWave
|
||||
|
||||
@ -111,7 +116,7 @@ public:
|
||||
inline bool sameGeometry
|
||||
(
|
||||
const polyMesh&,
|
||||
const topoDistanceData&,
|
||||
const topoDistanceData<Type>&,
|
||||
const scalar,
|
||||
TrackingData& td
|
||||
) const;
|
||||
@ -155,7 +160,7 @@ public:
|
||||
const polyMesh&,
|
||||
const label thisCelli,
|
||||
const label neighbourFacei,
|
||||
const topoDistanceData& neighbourInfo,
|
||||
const topoDistanceData<Type>& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
@ -167,7 +172,7 @@ public:
|
||||
const polyMesh&,
|
||||
const label thisFacei,
|
||||
const label neighbourCelli,
|
||||
const topoDistanceData& neighbourInfo,
|
||||
const topoDistanceData<Type>& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
@ -178,40 +183,58 @@ public:
|
||||
(
|
||||
const polyMesh&,
|
||||
const label thisFacei,
|
||||
const topoDistanceData& neighbourInfo,
|
||||
const topoDistanceData<Type>& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Test for equality, with TrackingData
|
||||
template<class TrackingData>
|
||||
inline bool equal(const topoDistanceData&, TrackingData& td) const;
|
||||
inline bool equal
|
||||
(
|
||||
const topoDistanceData<Type>&,
|
||||
TrackingData& td
|
||||
) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Test for equality
|
||||
inline bool operator==(const topoDistanceData&) const;
|
||||
// Needed for List IO
|
||||
inline bool operator==(const topoDistanceData<Type>&) const;
|
||||
|
||||
//- Test for inequality
|
||||
inline bool operator!=(const topoDistanceData&) const;
|
||||
inline bool operator!=(const topoDistanceData<Type>&) const;
|
||||
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Ostream& operator<<(Ostream&, const topoDistanceData&);
|
||||
friend Istream& operator>>(Istream&, topoDistanceData&);
|
||||
friend Ostream& operator<< <Type>
|
||||
(
|
||||
Ostream&,
|
||||
const topoDistanceData<Type>&
|
||||
);
|
||||
friend Istream& operator>> <Type>
|
||||
(
|
||||
Istream&,
|
||||
topoDistanceData<Type>&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Contiguous data for topoDistanceData
|
||||
template<> struct is_contiguous<topoDistanceData> : std::true_type {};
|
||||
//- Data are contiguous if data type is contiguous
|
||||
template<class Type>
|
||||
struct is_contiguous<topoDistanceData<Type>> : is_contiguous<Type> {};
|
||||
|
||||
//- Contiguous label data for topoDistanceData
|
||||
template<> struct is_contiguous_label<topoDistanceData> : std::true_type {};
|
||||
//- Data are contiguous label if data type is label
|
||||
template<class Type>
|
||||
struct is_contiguous_label<topoDistanceData<Type>> :
|
||||
is_contiguous_label<Type> {};
|
||||
|
||||
//- Data are contiguous scalar if data type is scalar
|
||||
template<class Type>
|
||||
struct is_contiguous_scalar<topoDistanceData<Type>> :
|
||||
is_contiguous_scalar<Type>{};
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -219,6 +242,12 @@ template<> struct is_contiguous_label<topoDistanceData> : std::true_type {};
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "topoDistanceData.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "topoDistanceDataI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
@ -30,39 +30,43 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::topoDistanceData::topoDistanceData()
|
||||
template<class Type>
|
||||
inline Foam::topoDistanceData<Type>::topoDistanceData()
|
||||
:
|
||||
data_(-1),
|
||||
distance_(-1)
|
||||
distance_(-1),
|
||||
data_()
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::topoDistanceData::topoDistanceData
|
||||
template<class Type>
|
||||
inline Foam::topoDistanceData<Type>::topoDistanceData
|
||||
(
|
||||
const label data,
|
||||
const label distance
|
||||
const label distance,
|
||||
const Type& data
|
||||
)
|
||||
:
|
||||
data_(data),
|
||||
distance_(distance)
|
||||
distance_(distance),
|
||||
data_(data)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::topoDistanceData::valid(TrackingData& td) const
|
||||
inline bool Foam::topoDistanceData<Type>::valid(TrackingData& td) const
|
||||
{
|
||||
return distance_ != -1;
|
||||
}
|
||||
|
||||
|
||||
// No geometric data so never any problem on cyclics
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::topoDistanceData::sameGeometry
|
||||
inline bool Foam::topoDistanceData<Type>::sameGeometry
|
||||
(
|
||||
const polyMesh&,
|
||||
const topoDistanceData&,
|
||||
const topoDistanceData<Type>&,
|
||||
const scalar,
|
||||
TrackingData&
|
||||
) const
|
||||
@ -72,8 +76,9 @@ inline bool Foam::topoDistanceData::sameGeometry
|
||||
|
||||
|
||||
// No geometric data.
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline void Foam::topoDistanceData::leaveDomain
|
||||
inline void Foam::topoDistanceData<Type>::leaveDomain
|
||||
(
|
||||
const polyMesh&,
|
||||
const polyPatch& patch,
|
||||
@ -85,8 +90,9 @@ inline void Foam::topoDistanceData::leaveDomain
|
||||
|
||||
|
||||
// No geometric data.
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline void Foam::topoDistanceData::transform
|
||||
inline void Foam::topoDistanceData<Type>::transform
|
||||
(
|
||||
const polyMesh&,
|
||||
const tensor& rotTensor,
|
||||
@ -96,8 +102,9 @@ inline void Foam::topoDistanceData::transform
|
||||
|
||||
|
||||
// No geometric data.
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline void Foam::topoDistanceData::enterDomain
|
||||
inline void Foam::topoDistanceData<Type>::enterDomain
|
||||
(
|
||||
const polyMesh&,
|
||||
const polyPatch& patch,
|
||||
@ -109,20 +116,21 @@ inline void Foam::topoDistanceData::enterDomain
|
||||
|
||||
|
||||
// Update cell with neighbouring face information
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::topoDistanceData::updateCell
|
||||
inline bool Foam::topoDistanceData<Type>::updateCell
|
||||
(
|
||||
const polyMesh&,
|
||||
const label thisCelli,
|
||||
const label neighbourFacei,
|
||||
const topoDistanceData& neighbourInfo,
|
||||
const topoDistanceData<Type>& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData&
|
||||
)
|
||||
{
|
||||
if (distance_ == -1)
|
||||
{
|
||||
operator=(neighbourInfo);
|
||||
this->operator=(neighbourInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -131,13 +139,14 @@ inline bool Foam::topoDistanceData::updateCell
|
||||
|
||||
|
||||
// Update face with neighbouring cell information
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::topoDistanceData::updateFace
|
||||
inline bool Foam::topoDistanceData<Type>::updateFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label thisFacei,
|
||||
const label neighbourCelli,
|
||||
const topoDistanceData& neighbourInfo,
|
||||
const topoDistanceData<Type>& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData&
|
||||
)
|
||||
@ -146,8 +155,8 @@ inline bool Foam::topoDistanceData::updateFace
|
||||
|
||||
if (distance_ == -1)
|
||||
{
|
||||
data_ = neighbourInfo.data_;
|
||||
distance_ = neighbourInfo.distance_ + 1;
|
||||
data_ = neighbourInfo.data_;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -156,12 +165,13 @@ inline bool Foam::topoDistanceData::updateFace
|
||||
|
||||
|
||||
// Update face with coupled face information
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::topoDistanceData::updateFace
|
||||
inline bool Foam::topoDistanceData<Type>::updateFace
|
||||
(
|
||||
const polyMesh&,
|
||||
const label thisFacei,
|
||||
const topoDistanceData& neighbourInfo,
|
||||
const topoDistanceData<Type>& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData&
|
||||
)
|
||||
@ -169,7 +179,7 @@ inline bool Foam::topoDistanceData::updateFace
|
||||
// From face to face (e.g. coupled faces)
|
||||
if (distance_ == -1)
|
||||
{
|
||||
operator=(neighbourInfo);
|
||||
this->operator=(neighbourInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -177,10 +187,11 @@ inline bool Foam::topoDistanceData::updateFace
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::topoDistanceData::equal
|
||||
inline bool Foam::topoDistanceData<Type>::equal
|
||||
(
|
||||
const topoDistanceData& rhs,
|
||||
const topoDistanceData<Type>& rhs,
|
||||
TrackingData& td
|
||||
) const
|
||||
{
|
||||
@ -190,18 +201,20 @@ inline bool Foam::topoDistanceData::equal
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
inline bool Foam::topoDistanceData::operator==
|
||||
template<class Type>
|
||||
inline bool Foam::topoDistanceData<Type>::operator==
|
||||
(
|
||||
const topoDistanceData& rhs
|
||||
const Foam::topoDistanceData<Type>& rhs
|
||||
) const
|
||||
{
|
||||
return data_ == rhs.data_ && distance_ == rhs.distance_;
|
||||
return distance() == rhs.distance() && data() == rhs.data();
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::topoDistanceData::operator!=
|
||||
template<class Type>
|
||||
inline bool Foam::topoDistanceData<Type>::operator!=
|
||||
(
|
||||
const topoDistanceData& rhs
|
||||
const Foam::topoDistanceData<Type>& rhs
|
||||
) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
|
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -28,7 +28,7 @@ License
|
||||
#include "regionSplit2D.H"
|
||||
#include "polyMesh.H"
|
||||
#include "PatchEdgeFaceWave.H"
|
||||
#include "Time.H"
|
||||
#include "edgeTopoDistanceData.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -45,10 +45,10 @@ Foam::regionSplit2D::regionSplit2D
|
||||
{
|
||||
globalIndex globalFaces(blockedFaces.size());
|
||||
label regionI = globalFaces.toGlobal(0);
|
||||
List<patchEdgeFaceRegion> allEdgeInfo(patch.nEdges());
|
||||
List<patchEdgeFaceRegion> allFaceInfo(patch.size());
|
||||
List<edgeTopoDistanceData<label>> allEdgeInfo(patch.nEdges());
|
||||
List<edgeTopoDistanceData<label>> allFaceInfo(patch.size());
|
||||
DynamicList<label> changedEdges;
|
||||
DynamicList<patchEdgeFaceRegion> changedRegions;
|
||||
DynamicList<edgeTopoDistanceData<label>> changedRegions;
|
||||
label nBlockedFaces = 0;
|
||||
forAll(blockedFaces, faceI)
|
||||
{
|
||||
@ -60,7 +60,14 @@ Foam::regionSplit2D::regionSplit2D
|
||||
changedEdges.append(fEdges[feI]);
|
||||
|
||||
// Append globally unique value
|
||||
changedRegions.append(regionI);
|
||||
changedRegions.append
|
||||
(
|
||||
edgeTopoDistanceData<label>
|
||||
(
|
||||
0, // distance
|
||||
regionI // passive data
|
||||
)
|
||||
);
|
||||
}
|
||||
nBlockedFaces++;
|
||||
regionI++;
|
||||
@ -68,7 +75,11 @@ Foam::regionSplit2D::regionSplit2D
|
||||
else
|
||||
{
|
||||
// Block all non-seeded faces from the walk
|
||||
allFaceInfo[faceI] = -2;
|
||||
allFaceInfo[faceI] = edgeTopoDistanceData<label>
|
||||
(
|
||||
0, // distance
|
||||
-2 // passive data
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,7 +92,7 @@ Foam::regionSplit2D::regionSplit2D
|
||||
PatchEdgeFaceWave
|
||||
<
|
||||
indirectPrimitivePatch,
|
||||
patchEdgeFaceRegion
|
||||
edgeTopoDistanceData<label>
|
||||
>
|
||||
(
|
||||
mesh,
|
||||
@ -100,7 +111,7 @@ Foam::regionSplit2D::regionSplit2D
|
||||
label compactRegionI = 0;
|
||||
forAll(allFaceInfo, faceI)
|
||||
{
|
||||
label regionI = allFaceInfo[faceI].region();
|
||||
label regionI = allFaceInfo[faceI].data();
|
||||
if
|
||||
(
|
||||
globalFaces.isLocal(regionI)
|
||||
@ -129,7 +140,7 @@ Foam::regionSplit2D::regionSplit2D
|
||||
// Set the region index per face
|
||||
forAll(allFaceInfo, faceI)
|
||||
{
|
||||
label regionI = allFaceInfo[faceI].region();
|
||||
label regionI = allFaceInfo[faceI].data();
|
||||
if (regionI >= 0)
|
||||
{
|
||||
this->operator[](faceI) = regionToCompactAddr[regionI] + offset;
|
||||
|
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -42,7 +42,6 @@ SourceFiles
|
||||
#include "boolList.H"
|
||||
#include "labelList.H"
|
||||
#include "indirectPrimitivePatch.H"
|
||||
#include "patchEdgeFaceRegion.H"
|
||||
#include "globalIndex.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -34,7 +34,7 @@ License
|
||||
#include "PatchTools.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "PatchEdgeFaceWave.H"
|
||||
#include "patchEdgeFaceRegion.H"
|
||||
#include "edgeTopoDistanceData.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -83,11 +83,11 @@ void Foam::regionToFace::markZone
|
||||
) const
|
||||
{
|
||||
// Data on all edges and faces
|
||||
List<patchEdgeFaceRegion> allEdgeInfo(patch.nEdges());
|
||||
List<patchEdgeFaceRegion> allFaceInfo(patch.size());
|
||||
List<edgeTopoDistanceData<label>> allEdgeInfo(patch.nEdges());
|
||||
List<edgeTopoDistanceData<label>> allFaceInfo(patch.size());
|
||||
|
||||
DynamicList<label> changedEdges;
|
||||
DynamicList<patchEdgeFaceRegion> changedInfo;
|
||||
DynamicList<edgeTopoDistanceData<label>> changedInfo;
|
||||
|
||||
if (Pstream::myProcNo() == proci)
|
||||
{
|
||||
@ -95,7 +95,14 @@ void Foam::regionToFace::markZone
|
||||
for (const label edgei : fEdges)
|
||||
{
|
||||
changedEdges.append(edgei);
|
||||
changedInfo.append(zoneI);
|
||||
changedInfo.append
|
||||
(
|
||||
edgeTopoDistanceData<label>
|
||||
(
|
||||
0, // distance
|
||||
zoneI
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,7 +110,7 @@ void Foam::regionToFace::markZone
|
||||
PatchEdgeFaceWave
|
||||
<
|
||||
indirectPrimitivePatch,
|
||||
patchEdgeFaceRegion
|
||||
edgeTopoDistanceData<label>
|
||||
> calc
|
||||
(
|
||||
mesh_,
|
||||
@ -117,7 +124,7 @@ void Foam::regionToFace::markZone
|
||||
|
||||
forAll(allFaceInfo, facei)
|
||||
{
|
||||
if (allFaceInfo[facei].region() == zoneI)
|
||||
if (allFaceInfo[facei].data() == zoneI)
|
||||
{
|
||||
faceZone[facei] = zoneI;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -113,12 +113,12 @@ Foam::labelList Foam::structuredDecomp::decompose
|
||||
}
|
||||
|
||||
// Field on cells and faces.
|
||||
List<topoDistanceData> cellData(mesh.nCells());
|
||||
List<topoDistanceData> faceData(mesh.nFaces());
|
||||
List<topoDistanceData<label>> cellData(mesh.nCells());
|
||||
List<topoDistanceData<label>> faceData(mesh.nFaces());
|
||||
|
||||
// Start of changes
|
||||
labelList patchFaces(nFaces);
|
||||
List<topoDistanceData> patchData(nFaces);
|
||||
List<topoDistanceData<label>> patchData(nFaces);
|
||||
nFaces = 0;
|
||||
for (const label patchi : patchIDs)
|
||||
{
|
||||
@ -127,13 +127,13 @@ Foam::labelList Foam::structuredDecomp::decompose
|
||||
forAll(fc, i)
|
||||
{
|
||||
patchFaces[nFaces] = pp.start()+i;
|
||||
patchData[nFaces] = topoDistanceData(finalDecomp[fc[i]], 0);
|
||||
patchData[nFaces] = topoDistanceData<label>(0, finalDecomp[fc[i]]);
|
||||
nFaces++;
|
||||
}
|
||||
}
|
||||
|
||||
// Propagate information inwards
|
||||
FaceCellWave<topoDistanceData> deltaCalc
|
||||
FaceCellWave<topoDistanceData<label>> deltaCalc
|
||||
(
|
||||
mesh,
|
||||
patchFaces,
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -72,8 +72,8 @@ bool Foam::structuredRenumber::layerLess::operator()
|
||||
const label b
|
||||
)
|
||||
{
|
||||
const topoDistanceData& ta = distance_[a];
|
||||
const topoDistanceData& tb = distance_[b];
|
||||
const topoDistanceData<label>& ta = distance_[a];
|
||||
const topoDistanceData<label>& tb = distance_[b];
|
||||
|
||||
int dummy;
|
||||
|
||||
@ -209,7 +209,7 @@ Foam::labelList Foam::structuredRenumber::renumber
|
||||
|
||||
// Walk sub-ordering (=column index) out.
|
||||
labelList patchFaces(nFaces);
|
||||
List<topoDistanceData> patchData(nFaces);
|
||||
List<topoDistanceData<label>> patchData(nFaces);
|
||||
nFaces = 0;
|
||||
for (const label patchi : patchIDs)
|
||||
{
|
||||
@ -218,21 +218,21 @@ Foam::labelList Foam::structuredRenumber::renumber
|
||||
forAll(fc, i)
|
||||
{
|
||||
patchFaces[nFaces] = pp.start()+i;
|
||||
patchData[nFaces] = topoDistanceData
|
||||
patchData[nFaces] = topoDistanceData<label>
|
||||
(
|
||||
orderedToOld[fc[i]],// passive data: global column
|
||||
0 // distance: layer
|
||||
0, // distance: layer
|
||||
orderedToOld[fc[i]] // passive data: global column
|
||||
);
|
||||
nFaces++;
|
||||
}
|
||||
}
|
||||
|
||||
// Field on cells and faces.
|
||||
List<topoDistanceData> cellData(mesh.nCells());
|
||||
List<topoDistanceData> faceData(mesh.nFaces());
|
||||
List<topoDistanceData<label>> cellData(mesh.nCells());
|
||||
List<topoDistanceData<label>> faceData(mesh.nFaces());
|
||||
|
||||
// Propagate information inwards
|
||||
OppositeFaceCellWave<topoDistanceData> deltaCalc
|
||||
OppositeFaceCellWave<topoDistanceData<label>> deltaCalc
|
||||
(
|
||||
mesh,
|
||||
patchFaces,
|
||||
|
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -43,11 +44,12 @@ SourceFiles
|
||||
#define structuredRenumber_H
|
||||
|
||||
#include "renumberMethod.H"
|
||||
#include "topoDistanceData.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
template<class Type> class topoDistanceData;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class structuredRenumber Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -66,7 +68,7 @@ public:
|
||||
{
|
||||
const bool depthFirst_;
|
||||
const labelList& order_;
|
||||
const List<topoDistanceData>& distance_;
|
||||
const List<topoDistanceData<label>>& distance_;
|
||||
|
||||
public:
|
||||
|
||||
@ -74,7 +76,7 @@ public:
|
||||
(
|
||||
const bool depthFirst,
|
||||
const labelList& order,
|
||||
const List<topoDistanceData>& distance
|
||||
const List<topoDistanceData<label>>& distance
|
||||
)
|
||||
:
|
||||
depthFirst_(depthFirst),
|
||||
|
@ -54,7 +54,7 @@ Foam::label Foam::shortestPathSet::findMinFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label cellI,
|
||||
const List<topoDistanceData>& allFaceInfo,
|
||||
const List<topoDistanceData<label>>& allFaceInfo,
|
||||
const bitSet& isLeakPoint,
|
||||
const bool distanceMode,
|
||||
const point& origin
|
||||
@ -70,7 +70,7 @@ Foam::label Foam::shortestPathSet::findMinFace
|
||||
forAll(cFaces2, i)
|
||||
{
|
||||
label faceI = cFaces2[i];
|
||||
const topoDistanceData& info = allFaceInfo[faceI];
|
||||
const topoDistanceData<label>& info = allFaceInfo[faceI];
|
||||
if (info.distance() < minDist)
|
||||
{
|
||||
minDist = info.distance();
|
||||
@ -146,14 +146,14 @@ void Foam::shortestPathSet::calculateDistance
|
||||
const polyMesh& mesh,
|
||||
const label cellI,
|
||||
|
||||
List<topoDistanceData>& allFaceInfo,
|
||||
List<topoDistanceData>& allCellInfo
|
||||
List<topoDistanceData<label>>& allFaceInfo,
|
||||
List<topoDistanceData<label>>& allCellInfo
|
||||
) const
|
||||
{
|
||||
int dummyTrackData = 0;
|
||||
|
||||
// Seed faces on cell1
|
||||
DynamicList<topoDistanceData> faceDist;
|
||||
DynamicList<topoDistanceData<label>> faceDist;
|
||||
DynamicList<label> cFaces1;
|
||||
|
||||
if (cellI != -1)
|
||||
@ -167,7 +167,7 @@ void Foam::shortestPathSet::calculateDistance
|
||||
if (!allFaceInfo[facei].valid(dummyTrackData))
|
||||
{
|
||||
cFaces1.append(facei);
|
||||
faceDist.append(topoDistanceData(123, 0));
|
||||
faceDist.append(topoDistanceData<label>(0, 123));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -177,7 +177,7 @@ void Foam::shortestPathSet::calculateDistance
|
||||
// Walk through face-cell wave till all cells are reached
|
||||
FaceCellWave
|
||||
<
|
||||
topoDistanceData
|
||||
topoDistanceData<label>
|
||||
> wallDistCalc
|
||||
(
|
||||
mesh,
|
||||
@ -215,7 +215,7 @@ void Foam::shortestPathSet::calculateDistance
|
||||
forAll(fld.boundaryField(), patchi)
|
||||
{
|
||||
const polyPatch& pp = mesh.boundaryMesh()[patchi];
|
||||
SubList<topoDistanceData> p(pp.patchSlice(allFaceInfo));
|
||||
SubList<topoDistanceData<label>> p(pp.patchSlice(allFaceInfo));
|
||||
scalarField pfld(fld.boundaryField()[patchi].size());
|
||||
forAll(pfld, i)
|
||||
{
|
||||
@ -398,18 +398,18 @@ bool Foam::shortestPathSet::genSingleLeakPath
|
||||
bitSet& isLeakPoint,
|
||||
|
||||
// Work storage
|
||||
List<topoDistanceData>& allFaceInfo,
|
||||
List<topoDistanceData>& allCellInfo
|
||||
List<topoDistanceData<label>>& allFaceInfo,
|
||||
List<topoDistanceData<label>>& allCellInfo
|
||||
) const
|
||||
{
|
||||
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||
const topoDistanceData maxData(labelMax, labelMax);
|
||||
const topoDistanceData<label> maxData(labelMax, labelMax);
|
||||
|
||||
|
||||
allFaceInfo.setSize(mesh.nFaces());
|
||||
allFaceInfo = topoDistanceData();
|
||||
allFaceInfo = topoDistanceData<label>();
|
||||
allCellInfo.setSize(mesh.nCells());
|
||||
allCellInfo = topoDistanceData();
|
||||
allCellInfo = topoDistanceData<label>();
|
||||
|
||||
// Mark blocked faces with high distance
|
||||
forAll(isBlockedFace, facei)
|
||||
@ -597,8 +597,8 @@ bool Foam::shortestPathSet::genSingleLeakPath
|
||||
origin
|
||||
);
|
||||
|
||||
const topoDistanceData& cInfo = allCellInfo[frontCellI];
|
||||
const topoDistanceData& fInfo = allFaceInfo[frontFaceI];
|
||||
const topoDistanceData<label>& cInfo = allCellInfo[frontCellI];
|
||||
const topoDistanceData<label>& fInfo = allFaceInfo[frontFaceI];
|
||||
|
||||
if (fInfo.distance() <= cInfo.distance())
|
||||
{
|
||||
@ -715,7 +715,7 @@ bool Foam::shortestPathSet::genSingleLeakPath
|
||||
&& allCellInfo[frontCellI].distance() < minCellDistance
|
||||
)
|
||||
{
|
||||
const topoDistanceData& cInfo = allCellInfo[frontCellI];
|
||||
const topoDistanceData<label>& cInfo = allCellInfo[frontCellI];
|
||||
|
||||
samplingPts.append(mesh.cellCentres()[frontCellI]);
|
||||
samplingCells.append(frontCellI);
|
||||
@ -935,7 +935,7 @@ void Foam::shortestPathSet::genSamples
|
||||
// - isLeakPoint : is point on a leakFace
|
||||
|
||||
|
||||
const topoDistanceData maxData(labelMax, labelMax);
|
||||
const topoDistanceData<label> maxData(labelMax, labelMax);
|
||||
|
||||
// Get the target point
|
||||
const label outsideCelli = mesh.findCell(outsidePoint);
|
||||
@ -943,8 +943,8 @@ void Foam::shortestPathSet::genSamples
|
||||
// Maintain overall track length. Used to make curveDist continuous.
|
||||
scalar trackLength = 0;
|
||||
|
||||
List<topoDistanceData> allFaceInfo(mesh.nFaces());
|
||||
List<topoDistanceData> allCellInfo(mesh.nCells());
|
||||
List<topoDistanceData<label>> allFaceInfo(mesh.nFaces());
|
||||
List<topoDistanceData<label>> allCellInfo(mesh.nCells());
|
||||
|
||||
|
||||
// Boundary face + additional temporary blocks (to force leakpath to
|
||||
|
@ -82,7 +82,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class topoDistanceData;
|
||||
template<class Type> class topoDistanceData;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class shortestPathSet Declaration
|
||||
@ -111,7 +111,7 @@ class shortestPathSet
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label cellI,
|
||||
const List<topoDistanceData>& allFaceInfo,
|
||||
const List<topoDistanceData<label>>& allFaceInfo,
|
||||
const bitSet& isLeakPoint,
|
||||
const bool minDistance,
|
||||
const point& origin
|
||||
@ -135,8 +135,8 @@ class shortestPathSet
|
||||
const polyMesh& mesh,
|
||||
const label cellI,
|
||||
|
||||
List<topoDistanceData>& allFaceInfo,
|
||||
List<topoDistanceData>& allCellInfo
|
||||
List<topoDistanceData<label>>& allFaceInfo,
|
||||
List<topoDistanceData<label>>& allCellInfo
|
||||
) const;
|
||||
|
||||
//- Checks if face uses a leak point
|
||||
@ -192,8 +192,8 @@ class shortestPathSet
|
||||
bitSet& isLeakPoint,
|
||||
|
||||
// Work storage
|
||||
List<topoDistanceData>& allFaceInfo,
|
||||
List<topoDistanceData>& allCellInfo
|
||||
List<topoDistanceData<label>>& allFaceInfo,
|
||||
List<topoDistanceData<label>>& allCellInfo
|
||||
) const;
|
||||
|
||||
//- Calculate path between insideCelli (-1 if not on current processor)
|
||||
|
Loading…
Reference in New Issue
Block a user