Added faceCentres().

Removed blank lines between template specification and function definition.
This commit is contained in:
henry
2009-11-23 12:19:52 +00:00
parent 7cd4adc59d
commit 85152a2d5e
12 changed files with 113 additions and 87 deletions

View File

@ -28,7 +28,6 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
template
<
class Face,
@ -36,7 +35,6 @@ template
class PointField,
class PointType
>
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
PrimitivePatch
(
@ -60,12 +58,12 @@ PrimitivePatch
edgeLoopsPtr_(NULL),
localPointsPtr_(NULL),
localPointOrderPtr_(NULL),
faceCentresPtr_(NULL),
faceNormalsPtr_(NULL),
pointNormalsPtr_(NULL)
{}
// Construct from components
template
<
class Face,
@ -73,7 +71,6 @@ template
class PointField,
class PointType
>
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
PrimitivePatch
(
@ -98,12 +95,12 @@ PrimitivePatch
edgeLoopsPtr_(NULL),
localPointsPtr_(NULL),
localPointOrderPtr_(NULL),
faceCentresPtr_(NULL),
faceNormalsPtr_(NULL),
pointNormalsPtr_(NULL)
{}
// Construct as copy
template
<
class Face,
@ -111,7 +108,6 @@ template
class PointField,
class PointType
>
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
PrimitivePatch
(
@ -135,6 +131,7 @@ PrimitivePatch
edgeLoopsPtr_(NULL),
localPointsPtr_(NULL),
localPointOrderPtr_(NULL),
faceCentresPtr_(NULL),
faceNormalsPtr_(NULL),
pointNormalsPtr_(NULL)
{}
@ -149,8 +146,8 @@ template
class PointField,
class PointType
>
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::~PrimitivePatch()
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
~PrimitivePatch()
{
clearOut();
}
@ -158,7 +155,6 @@ Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::~PrimitivePatch()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Correct patch after moving points
template
<
class Face,
@ -166,7 +162,6 @@ template
class PointField,
class PointType
>
void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
movePoints
@ -193,7 +188,6 @@ template
class PointField,
class PointType
>
const Foam::edgeList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
edges() const
@ -214,7 +208,6 @@ template
class PointField,
class PointType
>
Foam::label
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
nInternalEdges() const
@ -235,7 +228,6 @@ template
class PointField,
class PointType
>
const Foam::labelList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
boundaryPoints() const
@ -256,7 +248,6 @@ template
class PointField,
class PointType
>
const Foam::labelListList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
faceFaces() const
@ -277,7 +268,6 @@ template
class PointField,
class PointType
>
const Foam::labelListList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
edgeFaces() const
@ -298,7 +288,6 @@ template
class PointField,
class PointType
>
const Foam::labelListList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
faceEdges() const
@ -319,7 +308,6 @@ template
class PointField,
class PointType
>
const Foam::labelListList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
pointEdges() const
@ -340,7 +328,6 @@ template
class PointField,
class PointType
>
const Foam::labelListList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
pointFaces() const
@ -361,7 +348,6 @@ template
class PointField,
class PointType
>
const Foam::List<Face>&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
localFaces() const
@ -382,7 +368,6 @@ template
class PointField,
class PointType
>
const Foam::labelList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
meshPoints() const
@ -403,7 +388,6 @@ template
class PointField,
class PointType
>
const Foam::Map<Foam::label>&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
meshPointMap() const
@ -424,7 +408,6 @@ template
class PointField,
class PointType
>
const Foam::Field<PointType>&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
localPoints() const
@ -445,7 +428,6 @@ template
class PointField,
class PointType
>
const Foam::labelList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
localPointOrder() const
@ -466,7 +448,6 @@ template
class PointField,
class PointType
>
Foam::label
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
whichPoint
@ -495,7 +476,26 @@ template
class PointField,
class PointType
>
const Foam::Field<PointType>&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
faceCentres() const
{
if (!faceCentresPtr_)
{
calcFaceCentres();
}
return *faceCentresPtr_;
}
template
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
const Foam::Field<PointType>&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
faceNormals() const
@ -516,7 +516,6 @@ template
class PointField,
class PointType
>
const Foam::Field<PointType>&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
pointNormals() const
@ -539,7 +538,6 @@ template
class PointField,
class PointType
>
void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
operator=
@ -552,6 +550,7 @@ operator=
FaceList<Face>::operator=(pp);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "PrimitivePatchAddressing.C"

View File

@ -166,6 +166,9 @@ private:
//- Local point order for most efficient search
mutable labelList* localPointOrderPtr_;
//- Face centres
mutable Field<PointType>* faceCentresPtr_;
//- Face unit normals
mutable Field<PointType>* faceNormalsPtr_;
@ -205,6 +208,9 @@ private:
//- Calculate local point order
void calcLocalPointOrder() const;
//- Calculate face centres
void calcFaceCentres() const;
//- Calculate unit face normals
void calcFaceNormals() const;
@ -370,6 +376,9 @@ public:
const labelListList& pointEdges
) const;
//- Return face centres for patch
const Field<PointType>& faceCentres() const;
//- Return face normals for patch
const Field<PointType>& faceNormals() const;

View File

@ -48,7 +48,6 @@ template
class PointField,
class PointType
>
void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
calcAddressing() const

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "PrimitivePatch.H"
@ -39,7 +37,6 @@ template
class PointField,
class PointType
>
void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
calcBdryPoints() const

View File

@ -41,7 +41,6 @@ template
class PointField,
class PointType
>
void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
visitPointRegion
@ -120,7 +119,6 @@ template
class PointField,
class PointType
>
typename Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::surfaceTopo
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
surfaceType() const
@ -174,7 +172,6 @@ template
class PointField,
class PointType
>
bool
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
checkTopology
@ -245,7 +242,6 @@ template
class PointField,
class PointType
>
bool
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
checkPointManifold

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "PrimitivePatch.H"
@ -39,7 +37,6 @@ template
class PointField,
class PointType
>
void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
clearGeom()
@ -52,6 +49,7 @@ clearGeom()
}
deleteDemandDrivenData(localPointsPtr_);
deleteDemandDrivenData(faceCentresPtr_);
deleteDemandDrivenData(faceNormalsPtr_);
deleteDemandDrivenData(pointNormalsPtr_);
}
@ -64,7 +62,6 @@ template
class PointField,
class PointType
>
void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
clearTopology()
@ -106,7 +103,6 @@ template
class PointField,
class PointType
>
void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
clearPatchMeshAddr()
@ -132,7 +128,6 @@ template
class PointField,
class PointType
>
void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
clearOut()

View File

@ -31,7 +31,6 @@ Description
#include "PrimitivePatch.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template
@ -41,7 +40,6 @@ template
class PointField,
class PointType
>
void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
calcEdgeLoops() const
@ -174,7 +172,6 @@ template
class PointField,
class PointType
>
const Foam::labelListList&
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
edgeLoops() const

View File

@ -39,14 +39,13 @@ template
class PointField,
class PointType
>
void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
calcLocalPointOrder() const
{
// Note: Cannot use bandCompressing as point-point addressing does
// not exist and is not considered generally useful.
//
//
if (debug)
{
@ -137,4 +136,5 @@ calcLocalPointOrder() const
}
}
// ************************************************************************* //

View File

@ -27,8 +27,6 @@ License
#include "PrimitivePatch.H"
#include "Map.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template
@ -38,7 +36,6 @@ template
class PointField,
class PointType
>
void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
calcMeshData() const
@ -76,13 +73,13 @@ calcMeshData() const
////- 1.5 code:
//// if the point is used, set the mark to 1
//forAll (*this, faceI)
//forAll(*this, facei)
//{
// const Face& curPoints = this->operator[](faceI);
// const Face& curPoints = this->operator[](facei);
//
// forAll (curPoints, pointI)
// forAll(curPoints, pointi)
// {
// markedPoints.insert(curPoints[pointI], -1);
// markedPoints.insert(curPoints[pointi], -1);
// }
//}
//
@ -95,22 +92,22 @@ calcMeshData() const
//sort(pointPatch);
//
//// For every point in map give it its label in mesh points
//forAll (pointPatch, pointI)
//forAll(pointPatch, pointi)
//{
// markedPoints.find(pointPatch[pointI])() = pointI;
// markedPoints.find(pointPatch[pointi])() = pointi;
//}
//- Unsorted version:
DynamicList<label> meshPoints(2*this->size());
forAll (*this, faceI)
forAll(*this, facei)
{
const Face& curPoints = this->operator[](faceI);
const Face& curPoints = this->operator[](facei);
forAll (curPoints, pointI)
forAll(curPoints, pointi)
{
if (markedPoints.insert(curPoints[pointI], meshPoints.size()))
if (markedPoints.insert(curPoints[pointi], meshPoints.size()))
{
meshPoints.append(curPoints[pointI]);
meshPoints.append(curPoints[pointi]);
}
}
}
@ -124,14 +121,14 @@ calcMeshData() const
localFacesPtr_ = new List<Face>(*this);
List<Face>& lf = *localFacesPtr_;
forAll (*this, faceI)
forAll(*this, facei)
{
const Face& curFace = this->operator[](faceI);
lf[faceI].setSize(curFace.size());
const Face& curFace = this->operator[](facei);
lf[facei].setSize(curFace.size());
forAll (curFace, labelI)
forAll(curFace, labelI)
{
lf[faceI][labelI] = markedPoints.find(curFace[labelI])();
lf[facei][labelI] = markedPoints.find(curFace[labelI])();
}
}
@ -152,7 +149,6 @@ template
class PointField,
class PointType
>
void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
calcMeshPointMap() const
@ -182,7 +178,7 @@ calcMeshPointMap() const
meshPointMapPtr_ = new Map<label>(2*mp.size());
Map<label>& mpMap = *meshPointMapPtr_;
forAll (mp, i)
forAll(mp, i)
{
mpMap.insert(mp[i], i);
}
@ -204,7 +200,6 @@ template
class PointField,
class PointType
>
void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
calcLocalPoints() const
@ -235,9 +230,9 @@ calcLocalPoints() const
Field<PointType>& locPts = *localPointsPtr_;
forAll (meshPts, pointI)
forAll(meshPts, pointi)
{
locPts[pointI] = points_[meshPts[pointI]];
locPts[pointi] = points_[meshPts[pointi]];
}
if (debug)
@ -257,7 +252,6 @@ template
class PointField,
class PointType
>
void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
calcPointNormals() const
@ -294,15 +288,15 @@ calcPointNormals() const
Field<PointType>& n = *pointNormalsPtr_;
forAll (pf, pointI)
forAll(pf, pointi)
{
PointType& curNormal = n[pointI];
PointType& curNormal = n[pointi];
const labelList& curFaces = pf[pointI];
const labelList& curFaces = pf[pointi];
forAll (curFaces, faceI)
forAll(curFaces, facei)
{
curNormal += faceUnitNormals[curFaces[faceI]];
curNormal += faceUnitNormals[curFaces[facei]];
}
curNormal /= mag(curNormal) + VSMALL;
@ -325,7 +319,56 @@ template
class PointField,
class PointType
>
void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
calcFaceCentres() const
{
if (debug)
{
Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::"
"calcFaceCentres() : "
"calculating faceCentres in PrimitivePatch"
<< endl;
}
// It is considered an error to attempt to recalculate faceCentres
// if they have already been calculated.
if (faceCentresPtr_)
{
FatalErrorIn
(
"PrimitivePatch<Face, FaceList, PointField, PointType>::"
"calcFaceCentres()"
) << "faceCentresPtr_already allocated"
<< abort(FatalError);
}
faceCentresPtr_ = new Field<PointType>(this->size());
Field<PointType>& c = *faceCentresPtr_;
forAll(c, facei)
{
c[facei] = this->operator[](facei).centre(points_);
}
if (debug)
{
Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::"
"calcFaceCentres() : "
"finished calculating faceCentres in PrimitivePatch"
<< endl;
}
}
template
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
calcFaceNormals() const
@ -354,10 +397,10 @@ calcFaceNormals() const
Field<PointType>& n = *faceNormalsPtr_;
forAll (n, faceI)
forAll(n, facei)
{
n[faceI] = this->operator[](faceI).normal(points_);
n[faceI] /= mag(n[faceI]) + VSMALL;
n[facei] = this->operator[](facei).normal(points_);
n[facei] /= mag(n[facei]) + VSMALL;
}
if (debug)

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "PrimitivePatch.H"
@ -38,7 +36,6 @@ template
class PointField,
class PointType
>
Foam::labelList
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
meshEdges
@ -116,7 +113,6 @@ template
class PointField,
class PointType
>
Foam::labelList
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
meshEdges
@ -174,7 +170,6 @@ template
class PointField,
class PointType
>
Foam::label
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
whichEdge

View File

@ -40,7 +40,6 @@ template
class PointField,
class PointType
>
void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
calcPointEdges() const
@ -112,7 +111,6 @@ template
class PointField,
class PointType
>
void
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
calcPointFaces() const

View File

@ -42,7 +42,6 @@ template
class PointField,
class PointType
>
template <class ToPatch>
Foam::List<Foam::objectHit>
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
@ -290,7 +289,6 @@ template
class PointField,
class PointType
>
template <class ToPatch>
Foam::List<Foam::objectHit>
Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::