/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 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 .
\*---------------------------------------------------------------------------*/
#include "PrimitivePatch.H"
#include "Map.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template
Foam::PrimitivePatch::PrimitivePatch
(
const FaceList& faces,
const Field& points
)
:
FaceList(faces),
points_(points),
edgesPtr_(nullptr),
nInternalEdges_(-1),
boundaryPointsPtr_(nullptr),
faceFacesPtr_(nullptr),
edgeFacesPtr_(nullptr),
faceEdgesPtr_(nullptr),
pointEdgesPtr_(nullptr),
pointFacesPtr_(nullptr),
localFacesPtr_(nullptr),
meshPointsPtr_(nullptr),
meshPointMapPtr_(nullptr),
edgeLoopsPtr_(nullptr),
localPointsPtr_(nullptr),
localPointOrderPtr_(nullptr),
faceCentresPtr_(nullptr),
faceAreasPtr_(nullptr),
faceNormalsPtr_(nullptr),
pointNormalsPtr_(nullptr)
{}
template
Foam::PrimitivePatch::PrimitivePatch
(
FaceList&& faces,
Field&& points
)
:
FaceList(move(faces)),
points_(move(points)),
edgesPtr_(nullptr),
nInternalEdges_(-1),
boundaryPointsPtr_(nullptr),
faceFacesPtr_(nullptr),
edgeFacesPtr_(nullptr),
faceEdgesPtr_(nullptr),
pointEdgesPtr_(nullptr),
pointFacesPtr_(nullptr),
localFacesPtr_(nullptr),
meshPointsPtr_(nullptr),
meshPointMapPtr_(nullptr),
edgeLoopsPtr_(nullptr),
localPointsPtr_(nullptr),
localPointOrderPtr_(nullptr),
faceCentresPtr_(nullptr),
faceAreasPtr_(nullptr),
faceNormalsPtr_(nullptr),
pointNormalsPtr_(nullptr)
{}
template
Foam::PrimitivePatch::PrimitivePatch
(
FaceList& faces,
Field& points,
const bool reuse
)
:
FaceList(faces, reuse),
points_(points, reuse),
edgesPtr_(nullptr),
nInternalEdges_(-1),
boundaryPointsPtr_(nullptr),
faceFacesPtr_(nullptr),
edgeFacesPtr_(nullptr),
faceEdgesPtr_(nullptr),
pointEdgesPtr_(nullptr),
pointFacesPtr_(nullptr),
localFacesPtr_(nullptr),
meshPointsPtr_(nullptr),
meshPointMapPtr_(nullptr),
edgeLoopsPtr_(nullptr),
localPointsPtr_(nullptr),
localPointOrderPtr_(nullptr),
faceCentresPtr_(nullptr),
faceAreasPtr_(nullptr),
faceNormalsPtr_(nullptr),
pointNormalsPtr_(nullptr)
{}
template
Foam::PrimitivePatch::PrimitivePatch
(
const PrimitivePatch& pp
)
:
PrimitivePatchName(),
FaceList(pp),
points_(pp.points_),
edgesPtr_(nullptr),
nInternalEdges_(-1),
boundaryPointsPtr_(nullptr),
faceFacesPtr_(nullptr),
edgeFacesPtr_(nullptr),
faceEdgesPtr_(nullptr),
pointEdgesPtr_(nullptr),
pointFacesPtr_(nullptr),
localFacesPtr_(nullptr),
meshPointsPtr_(nullptr),
meshPointMapPtr_(nullptr),
edgeLoopsPtr_(nullptr),
localPointsPtr_(nullptr),
localPointOrderPtr_(nullptr),
faceCentresPtr_(nullptr),
faceAreasPtr_(nullptr),
faceNormalsPtr_(nullptr),
pointNormalsPtr_(nullptr)
{}
template
Foam::PrimitivePatch::PrimitivePatch
(
PrimitivePatch&& pp
)
:
PrimitivePatchName(),
FaceList(move(pp)),
points_(move(pp.points_)),
edgesPtr_(nullptr),
nInternalEdges_(-1),
boundaryPointsPtr_(nullptr),
faceFacesPtr_(nullptr),
edgeFacesPtr_(nullptr),
faceEdgesPtr_(nullptr),
pointEdgesPtr_(nullptr),
pointFacesPtr_(nullptr),
localFacesPtr_(nullptr),
meshPointsPtr_(nullptr),
meshPointMapPtr_(nullptr),
edgeLoopsPtr_(nullptr),
localPointsPtr_(nullptr),
localPointOrderPtr_(nullptr),
faceCentresPtr_(nullptr),
faceAreasPtr_(nullptr),
faceNormalsPtr_(nullptr),
pointNormalsPtr_(nullptr)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template
Foam::PrimitivePatch::~PrimitivePatch()
{
clearOut();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template
const Foam::edgeList& Foam::PrimitivePatch::edges() const
{
if (!edgesPtr_)
{
calcAddressing();
}
return *edgesPtr_;
}
template
Foam::label Foam::PrimitivePatch::nInternalEdges() const
{
if (!edgesPtr_)
{
calcAddressing();
}
return nInternalEdges_;
}
template
const Foam::labelList&
Foam::PrimitivePatch::boundaryPoints() const
{
if (!boundaryPointsPtr_)
{
calcBdryPoints();
}
return *boundaryPointsPtr_;
}
template
const Foam::labelListList&
Foam::PrimitivePatch::
faceFaces() const
{
if (!faceFacesPtr_)
{
calcAddressing();
}
return *faceFacesPtr_;
}
template
const Foam::labelListList&
Foam::PrimitivePatch::edgeFaces() const
{
if (!edgeFacesPtr_)
{
calcAddressing();
}
return *edgeFacesPtr_;
}
template
const Foam::labelListList&
Foam::PrimitivePatch::faceEdges() const
{
if (!faceEdgesPtr_)
{
calcAddressing();
}
return *faceEdgesPtr_;
}
template
const Foam::labelListList&
Foam::PrimitivePatch::pointEdges() const
{
if (!pointEdgesPtr_)
{
calcPointEdges();
}
return *pointEdgesPtr_;
}
template
const Foam::labelListList&
Foam::PrimitivePatch::pointFaces() const
{
if (!pointFacesPtr_)
{
calcPointFaces();
}
return *pointFacesPtr_;
}
template
const Foam::List
<
typename Foam::PrimitivePatch::FaceType
>&
Foam::PrimitivePatch::localFaces() const
{
if (!localFacesPtr_)
{
calcMeshData();
}
return *localFacesPtr_;
}
template
const Foam::labelList&
Foam::PrimitivePatch::meshPoints() const
{
if (!meshPointsPtr_)
{
calcMeshData();
}
return *meshPointsPtr_;
}
template
const Foam::Map&
Foam::PrimitivePatch::meshPointMap() const
{
if (!meshPointMapPtr_)
{
calcMeshPointMap();
}
return *meshPointMapPtr_;
}
template
const Foam::Field
<
typename Foam::PrimitivePatch::PointType
>&
Foam::PrimitivePatch::localPoints() const
{
if (!localPointsPtr_)
{
calcLocalPoints();
}
return *localPointsPtr_;
}
template
const Foam::labelList&
Foam::PrimitivePatch::localPointOrder() const
{
if (!localPointOrderPtr_)
{
calcLocalPointOrder();
}
return *localPointOrderPtr_;
}
template
Foam::label Foam::PrimitivePatch::whichPoint
(
const label gp
) const
{
Map