ENH: meshStructure: detect mesh structure

This commit is contained in:
mattijs 2013-01-22 09:49:20 +00:00
parent 7d5d504788
commit f35b67eef7
11 changed files with 1197 additions and 3 deletions

View File

@ -187,6 +187,9 @@ mappedPatches/mappedPolyPatch/mappedVariableThicknessWallPolyPatch.C
mappedPatches/mappedPointPatch/mappedPointPatch.C
mappedPatches/mappedPointPatch/mappedWallPointPatch.C
meshStructure/meshStructure.C
meshStructure/topoDistanceData.C
meshStructure/pointTopoDistanceData.C
regionCoupled/patches/regionCoupledPolyPatch/regionCoupledBase.C
regionCoupled/patches/regionCoupledPolyPatch/regionCoupledPolyPatch.C

View File

@ -0,0 +1,387 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "meshStructure.H"
#include "FaceCellWave.H"
#include "topoDistanceData.H"
#include "pointTopoDistanceData.H"
#include "PointEdgeWave.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(meshStructure, 0);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::meshStructure::isStructuredCell
(
const polyMesh& mesh,
const label layerI,
const label cellI
) const
{
const cell& cFaces = mesh.cells()[cellI];
// Count number of side faces
label nSide = 0;
forAll(cFaces, i)
{
if (faceToPatchEdgeAddressing_[cFaces[i]] != -1)
{
nSide++;
}
}
if (nSide != cFaces.size()-2)
{
return false;
}
// Check that side faces have correct point layers
forAll(cFaces, i)
{
if (faceToPatchEdgeAddressing_[cFaces[i]] != -1)
{
const face& f = mesh.faces()[cFaces[i]];
label nLayer = 0;
label nLayerPlus1 = 0;
forAll(f, fp)
{
label pointI = f[fp];
if (pointLayer_[pointI] == layerI)
{
nLayer++;
}
else if (pointLayer_[pointI] == layerI+1)
{
nLayerPlus1++;
}
}
if (f.size() != 4 || (nLayer+nLayerPlus1 != 4))
{
return false;
}
}
}
return true;
}
void Foam::meshStructure::correct
(
const polyMesh& mesh,
const uindirectPrimitivePatch& pp
)
{
// Field on cells and faces.
List<topoDistanceData> cellData(mesh.nCells());
List<topoDistanceData> faceData(mesh.nFaces());
{
if (debug)
{
Info<< typeName << " : seeding "
<< returnReduce(pp.size(), sumOp<label>()) << " patch faces"
<< nl << endl;
}
// Start of changes
labelList patchFaces(pp.size());
List<topoDistanceData> patchData(pp.size());
forAll(pp, patchFaceI)
{
patchFaces[patchFaceI] = pp.addressing()[patchFaceI];
patchData[patchFaceI] = topoDistanceData(patchFaceI, 0);
}
// Propagate information inwards
FaceCellWave<topoDistanceData> distanceCalc
(
mesh,
patchFaces,
patchData,
faceData,
cellData,
mesh.globalData().nTotalCells()+1
);
// Determine cells from face-cell-walk
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cellToPatchFaceAddressing_.setSize(mesh.nCells());
cellLayer_.setSize(mesh.nCells());
forAll(cellToPatchFaceAddressing_, cellI)
{
cellToPatchFaceAddressing_[cellI] = cellData[cellI].data();
cellLayer_[cellI] = cellData[cellI].distance();
}
// Determine faces from face-cell-walk
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
faceToPatchFaceAddressing_.setSize(mesh.nFaces());
faceToPatchEdgeAddressing_.setSize(mesh.nFaces());
faceToPatchEdgeAddressing_ = labelMin;
faceLayer_.setSize(mesh.nFaces());
forAll(faceToPatchFaceAddressing_, faceI)
{
label own = mesh.faceOwner()[faceI];
label patchFaceI = faceData[faceI].data();
label patchDist = faceData[faceI].distance();
if (mesh.isInternalFace(faceI))
{
label nei = mesh.faceNeighbour()[faceI];
if (cellData[own].distance() == cellData[nei].distance())
{
// side face
faceToPatchFaceAddressing_[faceI] = 0;
faceLayer_[faceI] = cellData[own].distance();
}
else if (cellData[own].distance() < cellData[nei].distance())
{
// unturned face
faceToPatchFaceAddressing_[faceI] = patchFaceI+1;
faceToPatchEdgeAddressing_[faceI] = -1;
faceLayer_[faceI] = patchDist;
}
else
{
// turned face
faceToPatchFaceAddressing_[faceI] = -(patchFaceI+1);
faceToPatchEdgeAddressing_[faceI] = -1;
faceLayer_[faceI] = patchDist;
}
}
else if (patchDist == cellData[own].distance())
{
// starting face
faceToPatchFaceAddressing_[faceI] = -(patchFaceI+1);
faceToPatchEdgeAddressing_[faceI] = -1;
faceLayer_[faceI] = patchDist;
}
else
{
// unturned face or side face. Cannot be determined until
// we determine the point layers. Problem is that both are
// the same number of steps away from the initial seed face.
}
}
}
// Determine points from separate walk on point-edge
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
pointToPatchPointAddressing_.setSize(mesh.nPoints());
pointLayer_.setSize(mesh.nPoints());
if (debug)
{
Info<< typeName << " : seeding "
<< returnReduce(pp.nPoints(), sumOp<label>()) << " patch points"
<< nl << endl;
}
// Field on edges and points.
List<pointTopoDistanceData> edgeData(mesh.nEdges());
List<pointTopoDistanceData> pointData(mesh.nPoints());
// Start of changes
labelList patchPoints(pp.nPoints());
List<pointTopoDistanceData> patchData(pp.nPoints());
forAll(pp.meshPoints(), patchPointI)
{
patchPoints[patchPointI] = pp.meshPoints()[patchPointI];
patchData[patchPointI] = pointTopoDistanceData(patchPointI, 0);
}
// Walk
PointEdgeWave<pointTopoDistanceData> distanceCalc
(
mesh,
patchPoints,
patchData,
pointData,
edgeData,
mesh.globalData().nTotalPoints() // max iterations
);
forAll(pointData, pointI)
{
pointToPatchPointAddressing_[pointI] = pointData[pointI].data();
pointLayer_[pointI] = pointData[pointI].distance();
}
// Derive from originating patch points what the patch edges were.
EdgeMap<label> pointsToEdge(pp.nEdges());
forAll(pp.edges(), edgeI)
{
pointsToEdge.insert(pp.edges()[edgeI], edgeI);
}
// Look up on faces
forAll(faceToPatchEdgeAddressing_, faceI)
{
if (faceToPatchEdgeAddressing_[faceI] == labelMin)
{
// Face not yet done. Check if all points on same level
// or if not see what edge it originates from
const face& f = mesh.faces()[faceI];
label levelI = pointLayer_[f[0]];
for (label fp = 1; fp < f.size(); fp++)
{
if (pointLayer_[f[fp]] != levelI)
{
levelI = -1;
break;
}
}
if (levelI != -1)
{
// All same level
//Pout<< "Horizontal boundary face " << faceI
// << " at:" << mesh.faceCentres()[faceI]
// << " data:" << faceData[faceI]
// << " pointDatas:"
// << UIndirectList<pointTopoDistanceData>(pointData, f)
// << endl;
label patchFaceI = faceData[faceI].data();
label patchDist = faceData[faceI].distance();
faceToPatchEdgeAddressing_[faceI] = -1;
faceToPatchFaceAddressing_[faceI] = patchFaceI+1;
faceLayer_[faceI] = patchDist;
}
else
{
// Points of face on different levels
// See if there is any edge
forAll(f, fp)
{
label pointI = f[fp];
label nextPointI = f.nextLabel(fp);
EdgeMap<label>::const_iterator fnd = pointsToEdge.find
(
edge
(
pointData[pointI].data(),
pointData[nextPointI].data()
)
);
if (fnd != pointsToEdge.end())
{
faceToPatchEdgeAddressing_[faceI] = fnd();
faceToPatchFaceAddressing_[faceI] = 0;
label own = mesh.faceOwner()[faceI];
faceLayer_[faceI] = cellData[own].distance();
// Note: could test whether the other edges on the
// face are consistent
break;
}
}
}
}
}
}
// Use maps to find out mesh structure.
{
label nLayers = gMax(cellLayer_)+1;
labelListList layerToCells(invertOneToMany(nLayers, cellLayer_));
structured_ = true;
forAll(layerToCells, layerI)
{
const labelList& lCells = layerToCells[layerI];
forAll(lCells, lCellI)
{
label cellI = lCells[lCellI];
structured_ = isStructuredCell
(
mesh,
layerI,
cellI
);
if (!structured_)
{
break;
}
}
if (!structured_)
{
break;
}
}
reduce(structured_, andOp<bool>());
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::meshStructure::meshStructure
(
const polyMesh& mesh,
const uindirectPrimitivePatch& pp
)
{
correct(mesh, pp);
}
// ************************************************************************* //

View File

@ -0,0 +1,175 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::meshStructure
Description
Detect extruded mesh structure given a set of patch faces.
SourceFiles
meshStructure.C
\*---------------------------------------------------------------------------*/
#ifndef meshStructure_H
#define meshStructure_H
#include "labelList.H"
#include "uindirectPrimitivePatch.H"
#include "className.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class polyMesh;
/*---------------------------------------------------------------------------*\
Class meshStructure Declaration
\*---------------------------------------------------------------------------*/
class meshStructure
{
// Private data
//- Cell to patch face
labelList cellToPatchFaceAddressing_;
//- Cell to layer
labelList cellLayer_;
//- Face to patch face
labelList faceToPatchFaceAddressing_;
//- Face to patch edge
labelList faceToPatchEdgeAddressing_;
//- Face to layer
labelList faceLayer_;
//- Point to patch point
labelList pointToPatchPointAddressing_;
//- Point to layer
labelList pointLayer_;
//- Is mesh structured?
bool structured_;
// Private Member Functions
//- Is cell structured
bool isStructuredCell
(
const polyMesh& mesh,
const label layerI,
const label cellI
) const;
//- Calculate all maps.
void correct
(
const polyMesh& mesh,
const uindirectPrimitivePatch& pp
);
public:
// Declare name of the class and its debug switch
ClassName("meshStructure");
// Constructors
//- Construct null
meshStructure(const polyMesh& mesh, const uindirectPrimitivePatch&);
// Member Functions
//- Is mesh structured?
inline bool structured() const;
//- Cell to patch face
inline const labelList& cellToPatchFaceAddressing() const;
//- Cell to patch face
inline labelList& cellToPatchFaceAddressing();
//- Cell to layer
inline const labelList& cellLayer() const;
//- Cell to layer
inline labelList& cellLayer();
//- Face to patch face
inline const labelList& faceToPatchFaceAddressing() const;
//- Face to patch face
inline labelList& faceToPatchFaceAddressing();
//- Face to patch edge
inline const labelList& faceToPatchEdgeAddressing() const;
//- Face to patch edge
inline labelList& faceToPatchEdgeAddressing();
//- Face to layer
inline const labelList& faceLayer() const;
//- Face to layer
inline labelList& faceLayer();
//- Point to patch point
inline const labelList& pointToPatchPointAddressing() const;
//- Point to patch point
inline labelList& pointToPatchPointAddressing();
//- Point to layer
inline const labelList& pointLayer() const;
//- Point to layer
inline labelList& pointLayer();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "meshStructureI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,120 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "meshStructure.H"
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::meshStructure::structured() const
{
return structured_;
}
const Foam::labelList& Foam::meshStructure::cellToPatchFaceAddressing() const
{
return cellToPatchFaceAddressing_;
}
Foam::labelList& Foam::meshStructure::cellToPatchFaceAddressing()
{
return cellToPatchFaceAddressing_;
}
const Foam::labelList& Foam::meshStructure::cellLayer() const
{
return cellLayer_;
}
Foam::labelList& Foam::meshStructure::cellLayer()
{
return cellLayer_;
}
const Foam::labelList& Foam::meshStructure::faceToPatchFaceAddressing() const
{
return faceToPatchFaceAddressing_;
}
Foam::labelList& Foam::meshStructure::faceToPatchFaceAddressing()
{
return faceToPatchFaceAddressing_;
}
const Foam::labelList& Foam::meshStructure::faceToPatchEdgeAddressing() const
{
return faceToPatchEdgeAddressing_;
}
Foam::labelList& Foam::meshStructure::faceToPatchEdgeAddressing()
{
return faceToPatchEdgeAddressing_;
}
const Foam::labelList& Foam::meshStructure::faceLayer() const
{
return faceLayer_;
}
Foam::labelList& Foam::meshStructure::faceLayer()
{
return faceLayer_;
}
const Foam::labelList& Foam::meshStructure::pointToPatchPointAddressing() const
{
return pointToPatchPointAddressing_;
}
Foam::labelList& Foam::meshStructure::pointToPatchPointAddressing()
{
return pointToPatchPointAddressing_;
}
const Foam::labelList& Foam::meshStructure::pointLayer() const
{
return pointLayer_;
}
Foam::labelList& Foam::meshStructure::pointLayer()
{
return pointLayer_;
}
// ************************************************************************* //

View File

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

View File

@ -0,0 +1,227 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::pointTopoDistanceData
Description
For use with PointEdgeWave. Determines topological distance to
starting points
SourceFiles
pointTopoDistanceDataI.H
pointTopoDistanceData.C
\*---------------------------------------------------------------------------*/
#ifndef pointTopoDistanceData_H
#define pointTopoDistanceData_H
#include "point.H"
#include "tensor.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class polyPatch;
class polyMesh;
/*---------------------------------------------------------------------------*\
Class pointTopoDistanceData Declaration
\*---------------------------------------------------------------------------*/
class pointTopoDistanceData
{
// Private data
//- Starting data
label data_;
//- Distance
label distance_;
public:
// Constructors
//- Construct null
inline pointTopoDistanceData();
//- Construct from count
inline pointTopoDistanceData
(
const label data,
const label distance
);
// Member Functions
// Access
inline label data() const
{
return data_;
}
inline label distance() const
{
return distance_;
}
// Needed by PointEdgeWave
//- Check whether origin has been changed at all or
// still contains original (invalid) value.
template<class TrackingData>
inline bool valid(TrackingData& td) const;
//- Check for identical geometrical data. Used for cyclics checking.
template<class TrackingData>
inline bool sameGeometry
(
const pointTopoDistanceData&,
const scalar tol,
TrackingData& td
) const;
//- Convert origin to relative vector to leaving point
// (= point coordinate)
template<class TrackingData>
inline void leaveDomain
(
const polyPatch& patch,
const label patchPointI,
const point& pos,
TrackingData& td
);
//- Convert relative origin to absolute by adding entering point
template<class TrackingData>
inline void enterDomain
(
const polyPatch& patch,
const label patchPointI,
const point& pos,
TrackingData& td
);
//- Apply rotation matrix to origin
template<class TrackingData>
inline void transform
(
const tensor& rotTensor,
TrackingData& td
);
//- Influence of edge on point
template<class TrackingData>
inline bool updatePoint
(
const polyMesh& mesh,
const label pointI,
const label edgeI,
const pointTopoDistanceData& edgeInfo,
const scalar tol,
TrackingData& td
);
//- Influence of different value on same point.
// Merge new and old info.
template<class TrackingData>
inline bool updatePoint
(
const polyMesh& mesh,
const label pointI,
const pointTopoDistanceData& newPointInfo,
const scalar tol,
TrackingData& td
);
//- Influence of different value on same point.
// No information about current position whatsoever.
template<class TrackingData>
inline bool updatePoint
(
const pointTopoDistanceData& newPointInfo,
const scalar tol,
TrackingData& td
);
//- Influence of point on edge.
template<class TrackingData>
inline bool updateEdge
(
const polyMesh& mesh,
const label edgeI,
const label pointI,
const pointTopoDistanceData& pointInfo,
const scalar tol,
TrackingData& td
);
//- Same (like operator==)
template<class TrackingData>
inline bool equal(const pointTopoDistanceData&, TrackingData&)
const;
// Member Operators
// Needed for List IO
inline bool operator==(const pointTopoDistanceData&) const;
inline bool operator!=(const pointTopoDistanceData&) const;
// IOstream Operators
friend Ostream& operator<<(Ostream&, const pointTopoDistanceData&);
friend Istream& operator>>(Istream&, pointTopoDistanceData&);
};
//- Data associated with pointTopoDistanceData type are contiguous
template<>
inline bool contiguous<pointTopoDistanceData>()
{
return true;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "pointTopoDistanceDataI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,233 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "polyMesh.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
inline Foam::pointTopoDistanceData::pointTopoDistanceData()
:
data_(-1),
distance_(-1)
{}
// Construct from components
inline Foam::pointTopoDistanceData::pointTopoDistanceData
(
const label data,
const label distance
)
:
data_(data),
distance_(distance)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template <class TrackingData>
inline bool Foam::pointTopoDistanceData::valid(TrackingData& td) const
{
return distance_ != -1;
}
// No geometric data so never any problem on cyclics
template <class TrackingData>
inline bool Foam::pointTopoDistanceData::sameGeometry
(
const pointTopoDistanceData&,
const scalar tol,
TrackingData& td
) const
{
return true;
}
// No geometric data.
template <class TrackingData>
inline void Foam::pointTopoDistanceData::leaveDomain
(
const polyPatch& patch,
const label patchPointI,
const point& coord,
TrackingData& td
)
{}
// No geometric data.
template <class TrackingData>
inline void Foam::pointTopoDistanceData::transform
(
const tensor& rotTensor,
TrackingData& td
)
{}
// No geometric data.
template <class TrackingData>
inline void Foam::pointTopoDistanceData::enterDomain
(
const polyPatch& patch,
const label patchPointI,
const point& coord,
TrackingData& td
)
{}
// Update this with information from connected edge
template <class TrackingData>
inline bool Foam::pointTopoDistanceData::updatePoint
(
const polyMesh& mesh,
const label pointI,
const label edgeI,
const pointTopoDistanceData& edgeInfo,
const scalar tol,
TrackingData& td
)
{
if (distance_ == -1)
{
data_ = edgeInfo.data_;
distance_ = edgeInfo.distance_ + 1;
return true;
}
else
{
return false;
}
}
// Update this with new information on same point
template<class TrackingData>
inline bool Foam::pointTopoDistanceData::updatePoint
(
const polyMesh& mesh,
const label pointI,
const pointTopoDistanceData& newPointInfo,
const scalar tol,
TrackingData& td
)
{
if (distance_ == -1)
{
operator=(newPointInfo);
return true;
}
else
{
return false;
}
}
// Update this with new information on same point. No extra information.
template<class TrackingData>
inline bool Foam::pointTopoDistanceData::updatePoint
(
const pointTopoDistanceData& newPointInfo,
const scalar tol,
TrackingData& td
)
{
if (distance_ == -1)
{
operator=(newPointInfo);
return true;
}
else
{
return false;
}
}
// Update this with information from connected point
template<class TrackingData>
inline bool Foam::pointTopoDistanceData::updateEdge
(
const polyMesh& mesh,
const label edgeI,
const label pointI,
const pointTopoDistanceData& pointInfo,
const scalar tol,
TrackingData& td
)
{
if (distance_ == -1)
{
operator=(pointInfo);
return true;
}
else
{
return false;
}
}
template <class TrackingData>
inline bool Foam::pointTopoDistanceData::equal
(
const pointTopoDistanceData& rhs,
TrackingData& td
) const
{
return operator==(rhs);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline bool Foam::pointTopoDistanceData::operator==
(
const Foam::pointTopoDistanceData& rhs
) const
{
return data() == rhs.data() && distance() == rhs.distance();
}
inline bool Foam::pointTopoDistanceData::operator!=
(
const Foam::pointTopoDistanceData& rhs
) const
{
return !(*this == rhs);
}
// ************************************************************************* //

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -4,7 +4,6 @@ simpleGeomDecomp/simpleGeomDecomp.C
hierarchGeomDecomp/hierarchGeomDecomp.C
manualDecomp/manualDecomp.C
multiLevelDecomp/multiLevelDecomp.C
structuredDecomp/topoDistanceData.C
structuredDecomp/structuredDecomp.C
noDecomp/noDecomp.C