Commit 62637d84 authored by mattijs's avatar mattijs
Browse files

ENH: initial overhaul of volPointInterpolation.

- removed globalPointPatch*
- removed pointPatchInterpolate*
since all is now inside volPointInterpolation.
parent 39897230
......@@ -666,7 +666,7 @@ int main(int argc, char *argv[])
)
);
pointMesh procPMesh(procMesh, true);
pointMesh procPMesh(procMesh);
pointFieldDecomposer fieldDecomposer
(
......
......@@ -109,7 +109,6 @@ Foam::domainDecomposition::domainDecomposition(const IOobject& io)
procNeighbourProcessors_(nProcs_),
procProcessorPatchSize_(nProcs_),
procProcessorPatchStartIndex_(nProcs_),
globallySharedPoints_(0),
cyclicParallel_(false)
{
if (decompositionDict_.found("distributed"))
......@@ -132,15 +131,6 @@ bool Foam::domainDecomposition::writeDecomposition()
{
Info<< "\nConstructing processor meshes" << endl;
// Make a lookup map for globally shared points
Map<label> sharedPointLookup(2*globallySharedPoints_.size());
forAll(globallySharedPoints_, pointi)
{
sharedPointLookup.insert(globallySharedPoints_[pointi], pointi);
}
// Mark point/faces/cells that are in zones.
// -1 : not in zone
// -2 : in multiple zones
......
......@@ -103,9 +103,6 @@ class domainDecomposition
//- Start indices for inter-processor patches
labelListList procProcessorPatchStartIndex_;
//- List of globally shared point labels
labelList globallySharedPoints_;
//- Are there cyclic-parallel faces
bool cyclicParallel_;
......
......@@ -643,79 +643,6 @@ void Foam::domainDecomposition::decomposeMesh()
// Reset the size of used points
procPointLabels.setSize(nUsedPoints);
}
// Gather data about globally shared points
// Memory management
{
labelList pointsUsage(nPoints(), 0);
// Globally shared points are the ones used by more than 2 processors
// Size the list approximately and gather the points
labelHashSet gSharedPoints
(
min(100, nPoints()/1000)
);
// Loop through all the processors and mark up points used by
// processor boundaries. When a point is used twice, it is a
// globally shared point
for (label procI = 0; procI < nProcs_; procI++)
{
// Get list of face labels
const labelList& curFaceLabels = procFaceAddressing_[procI];
// Get start of processor faces
const labelList& curProcessorPatchStarts =
procProcessorPatchStartIndex_[procI];
const labelList& curProcessorPatchSizes =
procProcessorPatchSize_[procI];
// Reset the lookup list
pointsUsage = 0;
forAll(curProcessorPatchStarts, patchi)
{
const label curStart = curProcessorPatchStarts[patchi];
const label curEnd = curStart + curProcessorPatchSizes[patchi];
for
(
label facei = curStart;
facei < curEnd;
facei++
)
{
// Mark the original face as used
// Remember to decrement the index by one (turning index)
//
const label curF = mag(curFaceLabels[facei]) - 1;
const face& f = fcs[curF];
forAll(f, pointi)
{
if (pointsUsage[f[pointi]] == 0)
{
// Point not previously used
pointsUsage[f[pointi]] = patchi + 1;
}
else if (pointsUsage[f[pointi]] != patchi + 1)
{
// Point used by some other patch = global point!
gSharedPoints.insert(f[pointi]);
}
}
}
}
}
// Grab the result from the hash list
globallySharedPoints_ = gSharedPoints.toc();
sort(globallySharedPoints_);
}
}
// ************************************************************************* //
......@@ -26,7 +26,6 @@ License
#include "pointFieldDecomposer.H"
#include "processorPointPatchFields.H"
#include "globalPointPatchFields.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
......@@ -40,12 +39,8 @@ Foam::pointFieldDecomposer::decomposeField
// Create and map the internal field values
Field<Type> internalField(field.internalField(), pointAddressing_);
// Create a list of pointers for the patchFields including one extra
// for the global patch
PtrList<pointPatchField<Type> > patchFields
(
boundaryAddressing_.size() + 1
);
// Create a list of pointers for the patchFields
PtrList<pointPatchField<Type> > patchFields(boundaryAddressing_.size());
// Create and map the patch field values
forAll(boundaryAddressing_, patchi)
......@@ -78,17 +73,6 @@ Foam::pointFieldDecomposer::decomposeField
}
}
// Add the global patch
patchFields.set
(
boundaryAddressing_.size(),
new globalPointPatchField<Type>
(
procMesh_.boundary().globalPatch(),
DimensionedField<Type, pointMesh>::null()
)
);
// Create the field for the processor
return tmp<GeometricField<Type, pointPatchField, pointMesh> >
(
......
......@@ -37,7 +37,6 @@ SourceFiles
#ifndef lagrangianWriter_H
#define lagrangianWriter_H
#include "globalPointPatch.H"
#include "OFstream.H"
#include "Cloud.H"
#include "volFields.H"
......
......@@ -643,7 +643,6 @@ DebugSwitches
perfectInterface 0;
pointIndexHitList 0;
pointPatchField 0;
pointPatchInterpolation 0;
pointScalarField 0;
pointScalarField::DimensionedInternalField 0;
pointSet 0;
......
......@@ -453,7 +453,9 @@ $(constraintPointPatches)/processor/processorPointPatch.C
derivedPointPatches = $(pointPatches)/derived
$(derivedPointPatches)/coupled/coupledFacePointPatch.C
/*
$(derivedPointPatches)/global/globalPointPatch.C
*/
$(derivedPointPatches)/wall/wallPointPatch.C
pointBoundaryMesh = $(pointMesh)/pointBoundaryMesh
......@@ -508,7 +510,9 @@ $(constraintPointPatchFields)/processor/processorPointPatchFields.C
derivedPointPatchFields = $(pointPatchFields)/derived
$(derivedPointPatchFields)/slip/slipPointPatchFields.C
/*
$(derivedPointPatchFields)/global/globalPointPatchFields.C
*/
$(derivedPointPatchFields)/uniformFixedValue/uniformFixedValuePointPatchFields.C
$(derivedPointPatchFields)/timeVaryingUniformFixedValue/timeVaryingUniformFixedValuePointPatchFields.C
......
......@@ -121,11 +121,19 @@ public:
) = 0;
//- Initialise swap of patch point values
virtual void initSwapAdd(Field<Type>&) const
virtual void initSwapAddSeparated
(
const Pstream::commsTypes,
Field<Type>&
) const
{}
//- Complete swap of patch point values and add to local values
virtual void swapAdd(Field<Type>&) const = 0;
virtual void swapAddSeparated
(
const Pstream::commsTypes,
Field<Type>&
) const = 0;
};
......
......@@ -122,7 +122,11 @@ cyclicPointPatchField<Type>::cyclicPointPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void cyclicPointPatchField<Type>::swapAdd(Field<Type>& pField) const
void cyclicPointPatchField<Type>::swapAddSeparated
(
const Pstream::commsTypes,
Field<Type>& pField
) const
{
Field<Type> pf(this->patchInternalField(pField));
......@@ -145,7 +149,7 @@ void cyclicPointPatchField<Type>::swapAdd(Field<Type>& pField) const
}
}
addToInternalField(pField, pf);
addToInternalField(pField, pf, cyclicPatch_.separatedPoints());
}
......
......@@ -159,7 +159,11 @@ public:
{}
//- Complete swap of patch point values and add to local values
virtual void swapAdd(Field<Type>&) const;
virtual void swapAddSeparated
(
const Pstream::commsTypes commsType,
Field<Type>&
) const;
};
......
......@@ -96,16 +96,28 @@ processorPointPatchField<Type>::~processorPointPatchField()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void processorPointPatchField<Type>::initSwapAdd(Field<Type>& pField) const
void processorPointPatchField<Type>::initSwapAddSeparated
(
const Pstream::commsTypes commsType,
Field<Type>& pField
)
const
{
if (Pstream::parRun())
{
// Get internal field into my point order
Field<Type> pf(this->patchInternalField(pField));
// Get internal field into correct order for opposite side
Field<Type> pf
(
this->patchInternalField
(
pField,
procPatch_.reverseMeshPoints()
)
);
OPstream::write
(
Pstream::blocking,
commsType,
procPatch_.neighbProcNo(),
reinterpret_cast<const char*>(pf.begin()),
pf.byteSize()
......@@ -115,7 +127,11 @@ void processorPointPatchField<Type>::initSwapAdd(Field<Type>& pField) const
template<class Type>
void processorPointPatchField<Type>::swapAdd(Field<Type>& pField) const
void processorPointPatchField<Type>::swapAddSeparated
(
const Pstream::commsTypes commsType,
Field<Type>& pField
) const
{
if (Pstream::parRun())
{
......@@ -123,7 +139,7 @@ void processorPointPatchField<Type>::swapAdd(Field<Type>& pField) const
IPstream::read
(
Pstream::blocking,
commsType,
procPatch_.neighbProcNo(),
reinterpret_cast<char*>(pnf.begin()),
pnf.byteSize()
......@@ -140,22 +156,20 @@ void processorPointPatchField<Type>::swapAdd(Field<Type>& pField) const
}
else
{
const labelList& nonGlobalPatchPoints =
procPatch_.nonGlobalPatchPoints();
const labelListList& pointFaces = ppp.pointFaces();
forAll(nonGlobalPatchPoints, pfi)
forAll(pointFaces, pfi)
{
pnf[pfi] = transform
(
forwardT[pointFaces[nonGlobalPatchPoints[pfi]][0]],
forwardT[pointFaces[pfi][0]],
pnf[pfi]
);
}
}
}
addToInternalField(pField, pnf);
addToInternalField(pField, pnf, procPatch_.separatedPoints());
}
}
......
......@@ -169,11 +169,19 @@ public:
)
{}
//- Initialise swap of patch point values
virtual void initSwapAdd(Field<Type>&) const;
//- Initialise swap of non-collocated patch point values
virtual void initSwapAddSeparated
(
const Pstream::commsTypes commsType,
Field<Type>&
) const;
//- Complete swap of patch point values and add to local values
virtual void swapAdd(Field<Type>&) const;
virtual void swapAddSeparated
(
const Pstream::commsTypes commsType,
Field<Type>&
) const;
};
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "globalPointPatchField.H"
#include "PstreamCombineReduceOps.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
template<class Type>
globalPointPatchField<Type>::globalPointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF
)
:
coupledPointPatchField<Type>(p, iF),
globalPointPatch_(refCast<const globalPointPatch>(p))
{}
template<class Type>
globalPointPatchField<Type>::globalPointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
const dictionary& dict
)
:
coupledPointPatchField<Type>(p, iF, dict),
globalPointPatch_(refCast<const globalPointPatch>(p))
{
if (!isType<globalPointPatch>(p))
{
FatalIOErrorIn
(
"globalPointPatchField<Type>::globalPointPatchField\n"
"(\n"
" const pointPatch& p,\n"
" const Field<Type>& field,\n"
" const dictionary& dict\n"
")\n",
dict
) << "patch " << this->patch().index()
<< " not processorPoint type. "
<< "Patch type = " << p.type()
<< exit(FatalIOError);
}
}
template<class Type>
globalPointPatchField<Type>::globalPointPatchField
(
const globalPointPatchField<Type>& ptf,
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
const pointPatchFieldMapper& mapper
)
:
coupledPointPatchField<Type>(ptf, p, iF, mapper),
globalPointPatch_(refCast<const globalPointPatch>(ptf.patch()))
{
if (!isType<globalPointPatch>(this->patch()))
{
FatalErrorIn
(
"globalPointPatchField<Type>::globalPointPatchField\n"
"(\n"
" const globalPointPatchField<Type>& ptf,\n"
" const pointPatch& p,\n"
" const DimensionedField<Type, pointMesh>& iF,\n"
" const pointPatchFieldMapper& mapper\n"
")\n"
) << "Field type does not correspond to patch type for patch "
<< this->patch().index() << "." << endl
<< "Field type: " << typeName << endl
<< "Patch type: " << this->patch().type()
<< exit(FatalError);
}
}
template<class Type>
globalPointPatchField<Type>::globalPointPatchField
(
const globalPointPatchField<Type>& ptf,
const DimensionedField<Type, pointMesh>& iF
)
:
coupledPointPatchField<Type>(ptf, iF),
globalPointPatch_(refCast<const globalPointPatch>(ptf.patch()))
{}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
globalPointPatchField<Type>::~globalPointPatchField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class Type>
void globalPointPatchField<Type>::swapAdd(Field<Type>& pField) const
{
// Create the global list and insert local values
if (globalPointPatch_.globalPointSize() > 0)
{
Field<Type> lpf = patchInternalField(pField);
const labelList& addr = globalPointPatch_.sharedPointAddr();
Field<Type> gpf
(
globalPointPatch_.globalPointSize(),
pTraits<Type>::zero
);
forAll(addr, i)
{
gpf[addr[i]] += lpf[i];
}
combineReduce(gpf, plusEqOp<Field<Type> >());
// Extract local data
forAll (addr, i)
{
lpf[i] = gpf[addr[i]];
}
setInInternalField(pField, lpf);
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::globalPointPatchField
Description
Foam::globalPointPatchField
SourceFiles
globalPointPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef globalPointPatchField_H
#define globalPointPatchField_H
#include "coupledPointPatchField.H"
#include "globalPointPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class globalPointPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class globalPointPatchField
: