Development branch merge
This commit is contained in:
parent
705c28eac4
commit
6c577922c5
18 changed files with 90 additions and 4150 deletions
|
@ -466,9 +466,12 @@ initEvaluate
|
|||
const Pstream::commsTypes commsType
|
||||
)
|
||||
{
|
||||
if (this->isPointField())
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
initAddFieldTempl(Pstream::blocking, this->internalField());
|
||||
if (this->isPointField())
|
||||
{
|
||||
initAddFieldTempl(Pstream::blocking, this->internalField());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -491,27 +494,30 @@ evaluate
|
|||
const Pstream::commsTypes commsType
|
||||
)
|
||||
{
|
||||
if (this->isPointField())
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Get the neighbour side values
|
||||
tmp<Field<Type> > tpNeighbour = receivePointField<Type>(commsType);
|
||||
Field<Type>& tpn = tpNeighbour();
|
||||
|
||||
if (doTransform())
|
||||
if (this->isPointField())
|
||||
{
|
||||
const processorPolyPatch& ppp = procPatch_.procPolyPatch();
|
||||
const tensorField& forwardT = ppp.forwardT();
|
||||
// Get the neighbour side values
|
||||
tmp<Field<Type> > tpNeighbour = receivePointField<Type>(commsType);
|
||||
Field<Type>& tpn = tpNeighbour();
|
||||
|
||||
transform(tpn, forwardT[0], tpn);
|
||||
if (doTransform())
|
||||
{
|
||||
const processorPolyPatch& ppp = procPatch_.procPolyPatch();
|
||||
const tensorField& forwardT = ppp.forwardT();
|
||||
|
||||
transform(tpn, forwardT[0], tpn);
|
||||
}
|
||||
|
||||
// Average over two sides
|
||||
tpn = 0.5*(patchInternalField(this->internalField()) + tpn);
|
||||
|
||||
// Get internal field to insert values into
|
||||
Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
|
||||
|
||||
this->setInInternalField(iF, tpn);
|
||||
}
|
||||
|
||||
// Average over two sides
|
||||
tpn = 0.5*(patchInternalField(this->internalField()) + tpn);
|
||||
|
||||
// Get internal field to insert values into
|
||||
Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
|
||||
|
||||
this->setInInternalField(iF, tpn);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -697,7 +703,7 @@ initAddUpperLower
|
|||
{
|
||||
// Gather the data from the given field and send it. Note that the
|
||||
// size of the field is equal to the number of edges on the field
|
||||
// and NOT the number of points.
|
||||
// and NOT the number of points. HJ, 14/Nov/2001
|
||||
|
||||
// Get the addressing
|
||||
const labelList& me = procPatch_.localEdgeIndices();
|
||||
|
|
|
@ -144,6 +144,7 @@ public:
|
|||
const scalarField& y
|
||||
);
|
||||
|
||||
//- Create and return a clone
|
||||
autoPtr<curve> clone() const
|
||||
{
|
||||
return autoPtr<curve>(new curve(*this));
|
||||
|
|
|
@ -95,7 +95,8 @@ public:
|
|||
// If object pointer already set issue a FatalError.
|
||||
inline void set(T*);
|
||||
|
||||
//- If object pointer already set, delete object and set to given pointer
|
||||
//- If object pointer already set, delete object and set to
|
||||
// given pointer
|
||||
inline void reset(T* = 0);
|
||||
|
||||
//- If object pointer points to valid object:
|
||||
|
|
|
@ -182,7 +182,7 @@ void Foam::processorPolyPatch::calcGeometry()
|
|||
// Cache face areas
|
||||
const vectorField::subField localFaceAreas = faceAreas();
|
||||
|
||||
forAll(faceNormals, facei)
|
||||
forAll (faceNormals, facei)
|
||||
{
|
||||
scalar magSf = mag(localFaceAreas[facei]);
|
||||
scalar nbrMagSf = mag(neighbFaceAreas_[facei]);
|
||||
|
@ -320,6 +320,10 @@ void Foam::processorPolyPatch::updateMesh()
|
|||
{
|
||||
// Note cannot predict exact size since opposite nPoints might
|
||||
// be different from one over here.
|
||||
|
||||
// Disagree: This needs to be sorted out, so that processor patches
|
||||
// are simply internal faces and treat cyclics separately
|
||||
// HJ, 10/Mar/2011
|
||||
IPstream fromNeighbProc(Pstream::blocking, neighbProcNo());
|
||||
|
||||
fromNeighbProc
|
||||
|
@ -338,7 +342,7 @@ void Foam::processorPolyPatch::updateMesh()
|
|||
neighbPointsPtr_ = new labelList(nPoints(), -1);
|
||||
labelList& neighbPoints = *neighbPointsPtr_;
|
||||
|
||||
forAll(nbrPointFace, nbrPointI)
|
||||
forAll (nbrPointFace, nbrPointI)
|
||||
{
|
||||
// Find face and index in face on this side.
|
||||
const face& f = localFaces()[nbrPointFace[nbrPointI]];
|
||||
|
@ -358,7 +362,7 @@ void Foam::processorPolyPatch::updateMesh()
|
|||
}
|
||||
|
||||
// Reset all duplicate entries to -1.
|
||||
forAll(neighbPoints, patchPointI)
|
||||
forAll (neighbPoints, patchPointI)
|
||||
{
|
||||
if (neighbPoints[patchPointI] == -2)
|
||||
{
|
||||
|
@ -372,7 +376,7 @@ void Foam::processorPolyPatch::updateMesh()
|
|||
neighbEdgesPtr_ = new labelList(nEdges(), -1);
|
||||
labelList& neighbEdges = *neighbEdgesPtr_;
|
||||
|
||||
forAll(nbrEdgeFace, nbrEdgeI)
|
||||
forAll (nbrEdgeFace, nbrEdgeI)
|
||||
{
|
||||
// Find face and index in face on this side.
|
||||
const labelList& f = faceEdges()[nbrEdgeFace[nbrEdgeI]];
|
||||
|
@ -392,7 +396,7 @@ void Foam::processorPolyPatch::updateMesh()
|
|||
}
|
||||
|
||||
// Reset all duplicate entries to -1.
|
||||
forAll(neighbEdges, patchEdgeI)
|
||||
forAll (neighbEdges, patchEdgeI)
|
||||
{
|
||||
if (neighbEdges[patchEdgeI] == -2)
|
||||
{
|
||||
|
@ -414,6 +418,7 @@ const Foam::labelList& Foam::processorPolyPatch::neighbPoints() const
|
|||
<< "No extended addressing calculated for patch " << name()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return *neighbPointsPtr_;
|
||||
}
|
||||
|
||||
|
@ -426,6 +431,7 @@ const Foam::labelList& Foam::processorPolyPatch::neighbEdges() const
|
|||
<< "No extended addressing calculated for patch " << name()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return *neighbEdgesPtr_;
|
||||
}
|
||||
|
||||
|
@ -437,12 +443,13 @@ void Foam::processorPolyPatch::initOrder(const primitivePatch& pp) const
|
|||
return;
|
||||
}
|
||||
|
||||
const bool isMaster = Pstream::myProcNo() < neighbProcNo();
|
||||
|
||||
if (isMaster)
|
||||
// Master side sends the data and slave side rotates the faces
|
||||
// HJ, 10/Mar/2011
|
||||
if (owner())
|
||||
{
|
||||
pointField ctrs(calcFaceCentres(pp, pp.points()));
|
||||
|
||||
// Anchor point is the start point of all faces. HJ, 10/Mar/2011
|
||||
pointField anchors(getAnchorPoints(pp, pp.points()));
|
||||
|
||||
// Now send all info over to the neighbour
|
||||
|
@ -475,7 +482,7 @@ bool Foam::processorPolyPatch::order
|
|||
fileName nm
|
||||
(
|
||||
boundaryMesh().mesh().time().path()
|
||||
/name()+"_faces.obj"
|
||||
/name() + "_faces.obj"
|
||||
);
|
||||
Pout<< "processorPolyPatch::order : Writing my " << pp.size()
|
||||
<< " faces to OBJ file " << nm << endl;
|
||||
|
@ -493,7 +500,7 @@ bool Foam::processorPolyPatch::order
|
|||
<< "Dumping " << ctrs.size()
|
||||
<< " local faceCentres to " << localStr.name() << endl;
|
||||
|
||||
forAll(ctrs, faceI)
|
||||
forAll (ctrs, faceI)
|
||||
{
|
||||
writeOBJ(localStr, ctrs[faceI]);
|
||||
}
|
||||
|
@ -505,13 +512,11 @@ bool Foam::processorPolyPatch::order
|
|||
rotation.setSize(pp.size());
|
||||
rotation = 0;
|
||||
|
||||
const bool isMaster = Pstream::myProcNo() < neighbProcNo();
|
||||
|
||||
if (isMaster)
|
||||
if (owner())
|
||||
{
|
||||
// Do nothing (i.e. identical mapping, zero rotation).
|
||||
// See comment at top.
|
||||
forAll(faceMap, patchFaceI)
|
||||
forAll (faceMap, patchFaceI)
|
||||
{
|
||||
faceMap[patchFaceI] = patchFaceI;
|
||||
}
|
||||
|
@ -520,6 +525,7 @@ bool Foam::processorPolyPatch::order
|
|||
}
|
||||
else
|
||||
{
|
||||
// Slave side: receive points
|
||||
vectorField masterCtrs;
|
||||
vectorField masterAnchors;
|
||||
|
||||
|
@ -543,10 +549,12 @@ bool Foam::processorPolyPatch::order
|
|||
boundaryMesh().mesh().time().path()
|
||||
/name() + "_nbrFaceCentres.obj"
|
||||
);
|
||||
|
||||
Pout<< "processorPolyPatch::order : "
|
||||
<< "Dumping neighbour faceCentres to " << nbrStr.name()
|
||||
<< endl;
|
||||
forAll(masterCtrs, faceI)
|
||||
|
||||
forAll (masterCtrs, faceI)
|
||||
{
|
||||
writeOBJ(nbrStr, masterCtrs[faceI]);
|
||||
}
|
||||
|
@ -585,12 +593,13 @@ bool Foam::processorPolyPatch::order
|
|||
|
||||
if (v.size() == 1)
|
||||
{
|
||||
transformedCtrs = masterCtrs-v[0];
|
||||
transformedCtrs = masterCtrs - v[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
transformedCtrs = masterCtrs-v;
|
||||
transformedCtrs = masterCtrs - v;
|
||||
}
|
||||
|
||||
matchedAll = matchPoints
|
||||
(
|
||||
ctrs,
|
||||
|
@ -624,6 +633,7 @@ bool Foam::processorPolyPatch::order
|
|||
{
|
||||
vectorField transformedCtrs = masterCtrs;
|
||||
transformList(forwardT(), transformedCtrs);
|
||||
|
||||
matchedAll = matchPoints
|
||||
(
|
||||
ctrs,
|
||||
|
@ -656,7 +666,7 @@ bool Foam::processorPolyPatch::order
|
|||
fileName str
|
||||
(
|
||||
boundaryMesh().mesh().time().path()
|
||||
/name()/name()+"_faces.obj"
|
||||
/name()/name() + "_faces.obj"
|
||||
);
|
||||
Pout<< "processorPolyPatch::order :"
|
||||
<< " Writing faces to OBJ file " << str.name() << endl;
|
||||
|
@ -675,7 +685,7 @@ bool Foam::processorPolyPatch::order
|
|||
|
||||
label vertI = 0;
|
||||
|
||||
forAll(ctrs, faceI)
|
||||
forAll (ctrs, faceI)
|
||||
{
|
||||
label masterFaceI = faceMap[faceI];
|
||||
|
||||
|
@ -690,7 +700,8 @@ bool Foam::processorPolyPatch::order
|
|||
|
||||
if (!matchedAll)
|
||||
{
|
||||
SeriousErrorIn
|
||||
FatalErrorIn
|
||||
// SeriousErrorIn
|
||||
(
|
||||
"processorPolyPatch::order(const primitivePatch&"
|
||||
", labelList&, labelList&) const"
|
||||
|
@ -703,13 +714,13 @@ bool Foam::processorPolyPatch::order
|
|||
<< " multiple separated (from cyclics) processor patches"
|
||||
<< endl
|
||||
<< " Continuing with incorrect face ordering from now on!"
|
||||
<< endl;
|
||||
<< abort(FatalError);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set rotation.
|
||||
forAll(faceMap, oldFaceI)
|
||||
// Set rotation
|
||||
forAll (faceMap, oldFaceI)
|
||||
{
|
||||
// The face f will be at newFaceI (after morphing) and we want its
|
||||
// anchorPoint (= f[0]) to align with the anchorpoint for the
|
||||
|
@ -729,7 +740,8 @@ bool Foam::processorPolyPatch::order
|
|||
|
||||
if (rotation[newFaceI] == -1)
|
||||
{
|
||||
SeriousErrorIn
|
||||
FatalErrorIn
|
||||
// SeriousErrorIn
|
||||
(
|
||||
"processorPolyPatch::order(const primitivePatch&"
|
||||
", labelList&, labelList&) const"
|
||||
|
@ -742,13 +754,13 @@ bool Foam::processorPolyPatch::order
|
|||
<< " when matching the halves of processor patch "
|
||||
<< name()
|
||||
<< "Continuing with incorrect face ordering from now on!"
|
||||
<< endl;
|
||||
<< abort(FatalError);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
forAll(faceMap, faceI)
|
||||
forAll (faceMap, faceI)
|
||||
{
|
||||
if (faceMap[faceI] != faceI || rotation[faceI] != 0)
|
||||
{
|
||||
|
@ -768,10 +780,8 @@ void Foam::processorPolyPatch::syncOrder() const
|
|||
return;
|
||||
}
|
||||
|
||||
// Read and discard info from master side
|
||||
const bool isMaster = Pstream::myProcNo() < neighbProcNo();
|
||||
|
||||
if (!isMaster)
|
||||
// Read and discard info from owner side from the neighbour
|
||||
if (neighbour())
|
||||
{
|
||||
vectorField masterCtrs;
|
||||
vectorField masterAnchors;
|
||||
|
@ -784,6 +794,7 @@ void Foam::processorPolyPatch::syncOrder() const
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::processorPolyPatch::write(Ostream& os) const
|
||||
{
|
||||
polyPatch::write(os);
|
||||
|
|
|
@ -2975,7 +2975,8 @@ void Foam::autoLayerDriver::addLayers
|
|||
);
|
||||
|
||||
const_cast<Time&>(mesh.time())++;
|
||||
Info<< "Writing shrunk mesh to " << meshRefiner_.timeName() << endl;
|
||||
Info<< "Writing shrunk mesh to " << meshRefiner_.timeName()
|
||||
<< endl;
|
||||
|
||||
// See comment in autoSnapDriver why we should not remove meshPhi
|
||||
// using mesh.clearPout().
|
||||
|
|
|
@ -1613,7 +1613,7 @@ Foam::label Foam::meshRefinement::addPatch
|
|||
fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh.boundary());
|
||||
|
||||
// Add polyPatch at the end
|
||||
polyPatches.setSize(sz+1);
|
||||
polyPatches.setSize(sz + 1);
|
||||
polyPatches.set
|
||||
(
|
||||
sz,
|
||||
|
|
|
@ -1,257 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright held by original author
|
||||
\\/ 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 "CompactListList_dev.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Container>
|
||||
Foam::CompactListList_dev<T, Container>::CompactListList_dev(const List<Container>& ll)
|
||||
:
|
||||
size_(ll.size()),
|
||||
offsets_(ll.size()+1)
|
||||
{
|
||||
label sumSize = 0;
|
||||
offsets_[0] = 0;
|
||||
forAll(ll, i)
|
||||
{
|
||||
sumSize += ll[i].size();
|
||||
offsets_[i+1] = sumSize;
|
||||
}
|
||||
|
||||
m_.setSize(sumSize);
|
||||
|
||||
label k = 0;
|
||||
forAll(ll, i)
|
||||
{
|
||||
const Container& lli = ll[i];
|
||||
|
||||
forAll(lli, j)
|
||||
{
|
||||
m_[k++] = lli[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
Foam::CompactListList_dev<T, Container>::CompactListList_dev
|
||||
(
|
||||
const UList<label>& rowSizes
|
||||
)
|
||||
:
|
||||
size_(rowSizes.size()),
|
||||
offsets_(rowSizes.size()+1)
|
||||
{
|
||||
label sumSize = 0;
|
||||
offsets_[0] = 0;
|
||||
forAll(rowSizes, i)
|
||||
{
|
||||
sumSize += rowSizes[i];
|
||||
offsets_[i+1] = sumSize;
|
||||
}
|
||||
|
||||
m_.setSize(sumSize);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
Foam::CompactListList_dev<T, Container>::CompactListList_dev
|
||||
(
|
||||
const UList<label>& rowSizes,
|
||||
const T& t
|
||||
)
|
||||
:
|
||||
size_(rowSizes.size()),
|
||||
offsets_(rowSizes.size()+1)
|
||||
{
|
||||
label sumSize = 0;
|
||||
offsets_[0] = 0;
|
||||
forAll(rowSizes, i)
|
||||
{
|
||||
sumSize += rowSizes[i];
|
||||
offsets_[i+1] = sumSize;
|
||||
}
|
||||
|
||||
m_.setSize(sumSize, t);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
Foam::CompactListList_dev<T, Container>::CompactListList_dev
|
||||
(
|
||||
const Xfer<CompactListList_dev<T, Container> >& lst
|
||||
)
|
||||
{
|
||||
transfer(lst());
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
Foam::CompactListList_dev<T, Container>::CompactListList_dev
|
||||
(
|
||||
CompactListList_dev<T, Container>& lst,
|
||||
bool reUse
|
||||
)
|
||||
:
|
||||
size_(lst.size()),
|
||||
offsets_(lst.offsets_, reUse),
|
||||
m_(lst.m_, reUse)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Container>
|
||||
void Foam::CompactListList_dev<T, Container>::setSize(const label nRows)
|
||||
{
|
||||
if (nRows == 0)
|
||||
{
|
||||
clear();
|
||||
}
|
||||
if (nRows < size())
|
||||
{
|
||||
size_ = nRows;
|
||||
offsets_.setSize(nRows+1);
|
||||
m_.setSize(offsets_[nRows]);
|
||||
}
|
||||
else if (nRows > size())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"CompactListList_dev<T, Container>::setSize(const label nRows)"
|
||||
) << "Cannot be used to extend the list from " << offsets_.size()
|
||||
<< " to " << nRows << nl
|
||||
<< " Please use one of the other setSize member functions"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
void Foam::CompactListList_dev<T, Container>::setSize
|
||||
(
|
||||
const label nRows,
|
||||
const label nData
|
||||
)
|
||||
{
|
||||
size_ = nRows;
|
||||
offsets_.setSize(nRows+1);
|
||||
m_.setSize(nData);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
void Foam::CompactListList_dev<T, Container>::setSize
|
||||
(
|
||||
const label nRows,
|
||||
const label nData,
|
||||
const T& t
|
||||
)
|
||||
{
|
||||
size_ = nRows;
|
||||
offsets_.setSize(nRows+1);
|
||||
m_.setSize(nData, t);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
void Foam::CompactListList_dev<T, Container>::setSize(const UList<label>& rowSizes)
|
||||
{
|
||||
size_ = rowSizes.size();
|
||||
offsets_.setSize(rowSizes.size()+1);
|
||||
|
||||
label sumSize = 0;
|
||||
offsets_[0] = 0;
|
||||
forAll(rowSizes, i)
|
||||
{
|
||||
sumSize += rowSizes[i];
|
||||
offsets_[i+1] = sumSize;
|
||||
}
|
||||
|
||||
m_.setSize(sumSize);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
Foam::labelList Foam::CompactListList_dev<T, Container>::sizes() const
|
||||
{
|
||||
labelList rowSizes(size());
|
||||
|
||||
if (rowSizes.size() > 0)
|
||||
{
|
||||
forAll(rowSizes, i)
|
||||
{
|
||||
rowSizes[i] = offsets_[i+1] - offsets_[i];
|
||||
}
|
||||
}
|
||||
return rowSizes;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
void Foam::CompactListList_dev<T, Container>::clear()
|
||||
{
|
||||
size_ = 0;
|
||||
offsets_.clear();
|
||||
m_.clear();
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
void Foam::CompactListList_dev<T, Container>::transfer
|
||||
(
|
||||
CompactListList_dev<T, Container>& a
|
||||
)
|
||||
{
|
||||
size_ = a.size_;
|
||||
offsets_.transfer(a.offsets_);
|
||||
m_.transfer(a.m_);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Container>
|
||||
Foam::List<Container> Foam::CompactListList_dev<T, Container>::operator()()
|
||||
const
|
||||
{
|
||||
List<Container> ll(size());
|
||||
|
||||
forAll(ll, i)
|
||||
{
|
||||
ll[i] = Container(operator[](i));
|
||||
}
|
||||
|
||||
return ll;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * //
|
||||
|
||||
#include "CompactListList_devIO.C"
|
||||
|
||||
// ************************************************************************* //
|
|
@ -1,270 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright held by original author
|
||||
\\/ 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::CompactListList_dev
|
||||
|
||||
Description
|
||||
A packed storage unstructured matrix of objects of type \<T\>
|
||||
using an offset table for access.
|
||||
|
||||
The offset table is the size of the number of rows+1
|
||||
whose elements are the
|
||||
accumulated sizes of the rows, i.e.
|
||||
- offset[i] gives the index of first element of row i
|
||||
- offset[i+1] - offset[i] is the number of elements in row i
|
||||
|
||||
Storage is allocated on free-store during construction.
|
||||
|
||||
As a special case a null-contructed CompactListList_dev has an empty
|
||||
offsets_ (instead of size 1).
|
||||
|
||||
SourceFiles
|
||||
CompactListList_dev.C
|
||||
CompactListList_devI.H
|
||||
CompactListList_devIO.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef CompactListListDev_H
|
||||
#define CompactListListDev_H
|
||||
|
||||
#include "labelList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
template<class T, class Container> class CompactListList_dev;
|
||||
|
||||
template<class T, class Container> Istream& operator>>
|
||||
(
|
||||
Istream&,
|
||||
CompactListList_dev<T, Container>&
|
||||
);
|
||||
template<class T, class Container> Ostream& operator<<
|
||||
(
|
||||
Ostream&,
|
||||
const CompactListList_dev<T, Container>&
|
||||
);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class CompactListList_dev Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class T, class Container = List<T> >
|
||||
class CompactListList_dev
|
||||
{
|
||||
// Private data
|
||||
|
||||
label size_;
|
||||
|
||||
//- Offset table
|
||||
List<label> offsets_;
|
||||
|
||||
//- Packed matrix of data
|
||||
List<T> m_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Static Member Functions
|
||||
|
||||
//- Return a null CompactListList_dev
|
||||
inline static const CompactListList_dev<T, Container>& null();
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Null constructor.
|
||||
inline CompactListList_dev();
|
||||
|
||||
//- Construct by converting given List<List<T> >
|
||||
explicit CompactListList_dev(const List<Container>&);
|
||||
|
||||
//- Construct given size of offset table (number of rows)
|
||||
// and number of data.
|
||||
inline CompactListList_dev(const label nRows, const label nData);
|
||||
|
||||
//- Construct given size of offset table (number of rows),
|
||||
// the number of data and a value for all elements.
|
||||
inline CompactListList_dev(const label nRows, const label nData, const T&);
|
||||
|
||||
//- Construct given list of row-sizes.
|
||||
explicit CompactListList_dev(const UList<label>& rowSizes);
|
||||
|
||||
//- Construct given list of row-sizes
|
||||
CompactListList_dev(const UList<label>& rowSizes, const T&);
|
||||
|
||||
//- Construct by transferring the parameter contents
|
||||
explicit CompactListList_dev(const Xfer<CompactListList_dev<T, Container> >&);
|
||||
|
||||
//- Construct as copy or re-use as specified.
|
||||
CompactListList_dev(CompactListList_dev<T, Container>&, bool reUse);
|
||||
|
||||
//- Construct from Istream.
|
||||
CompactListList_dev(Istream&);
|
||||
|
||||
//- Clone
|
||||
inline autoPtr<CompactListList_dev<T, Container> > clone() const;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the primary size, i.e. the number of rows
|
||||
inline label size() const;
|
||||
|
||||
//- Return true if the number of rows is zero
|
||||
inline bool empty() const;
|
||||
|
||||
//- Return the offset table (= size()+1)
|
||||
inline const List<label>& offsets() const;
|
||||
|
||||
//- Return non-const access to the offset table
|
||||
inline List<label>& offsets();
|
||||
|
||||
//- Return the packed matrix of data
|
||||
inline const List<T>& m() const;
|
||||
|
||||
//- Return non-const access to the packed matrix of data
|
||||
inline List<T>& m();
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
//- Reset size of CompactListList_dev.
|
||||
// This form only allows contraction of the CompactListList_dev.
|
||||
void setSize(const label nRows);
|
||||
|
||||
//- Reset size of CompactListList_dev.
|
||||
void setSize(const label nRows, const label nData);
|
||||
|
||||
//- Reset sizes of CompactListList_dev and value for new elements.
|
||||
void setSize(const label nRows, const label nData, const T&);
|
||||
|
||||
//- Reset size of CompactListList_dev.
|
||||
void setSize(const UList<label>& rowSizes);
|
||||
|
||||
//- Reset size of CompactListList_dev.
|
||||
// This form only allows contraction of the CompactListList_dev.
|
||||
inline void resize(const label nRows);
|
||||
|
||||
//- Reset size of CompactListList_dev.
|
||||
inline void resize(const label nRows, const label nData);
|
||||
|
||||
//- Reset sizes of CompactListList_dev and value for new elements.
|
||||
inline void resize(const label nRows, const label nData, const T&);
|
||||
|
||||
//- Reset size of CompactListList_dev.
|
||||
inline void resize(const UList<label>& rowSizes);
|
||||
|
||||
//- Clear the CompactListList_dev, i.e. set sizes to zero.
|
||||
void clear();
|
||||
|
||||
//- Return sizes (to be used e.g. for construction)
|
||||
labelList sizes() const;
|
||||
|
||||
//- Transfer the contents of the argument CompactListList_dev
|
||||
// into this CompactListList_dev and annul the argument list.
|
||||
void transfer(CompactListList_dev<T, Container>&);
|
||||
|
||||
//- Transfer the contents to the Xfer container
|
||||
inline Xfer<CompactListList_dev<T, Container> > xfer();
|
||||
|
||||
// Other
|
||||
|
||||
//- Return index into m
|
||||
inline label index(const label row, const label col) const;
|
||||
|
||||
//- Get row for index into m.
|
||||
inline label whichRow(const label index) const;
|
||||
|
||||
//- Get column index (j) given above row
|
||||
inline label whichColumn(const label row, const label index) const;
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
//- Return subscript-checked row as UList.
|
||||
inline UList<T> operator[](const label i);
|
||||
|
||||
//- Return const subscript-checked row as UList.
|
||||
inline const UList<T> operator[](const label i) const;
|
||||
|
||||
//- Return subscript-checked element.
|
||||
inline T& operator()(const label i, const label j);
|
||||
|
||||
//- Return const subscript-checked element.
|
||||
inline const T& operator()(const label i, const label j) const;
|
||||
|
||||
//- Return as List<Container>
|
||||
List<Container> operator()() const;
|
||||
|
||||
//- Assignment of all entries to the given value
|
||||
inline void operator=(const T&);
|
||||
|
||||
|
||||
// Istream operator
|
||||
|
||||
//- Read CompactListList_dev from Istream, discarding contents
|
||||
// of existing CompactListList_dev.
|
||||
friend Istream& operator>> <T, Container>
|
||||
(
|
||||
Istream&,
|
||||
CompactListList_dev<T, Container>&
|
||||
);
|
||||
|
||||
// Write CompactListList_dev to Ostream.
|
||||
friend Ostream& operator<< <T, Container>
|
||||
(
|
||||
Ostream&,
|
||||
const CompactListList_dev<T, Container>&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
# include "CompactListList_devI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "CompactListList_dev.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
|
@ -1,276 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright held by original author
|
||||
\\/ 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 "ListOps.H"
|
||||
#include "SubList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Container>
|
||||
inline Foam::CompactListList_dev<T, Container>::CompactListList_dev()
|
||||
:
|
||||
size_(0)
|
||||
{}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline Foam::CompactListList_dev<T, Container>::CompactListList_dev
|
||||
(
|
||||
const label nRows,
|
||||
const label nData
|
||||
)
|
||||
:
|
||||
size_(nRows),
|
||||
offsets_(nRows+1, 0),
|
||||
m_(nData)
|
||||
{}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline Foam::CompactListList_dev<T, Container>::CompactListList_dev
|
||||
(
|
||||
const label nRows,
|
||||
const label nData,
|
||||
const T& t
|
||||
)
|
||||
:
|
||||
size_(nRows),
|
||||
offsets_(nRows+1, 0),
|
||||
m_(nData, t)
|
||||
{}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline Foam::autoPtr<Foam::CompactListList_dev<T, Container> >
|
||||
Foam::CompactListList_dev<T, Container>::clone() const
|
||||
{
|
||||
return autoPtr<CompactListList_dev<T, Container> >
|
||||
(
|
||||
new CompactListList_dev<T, Container>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Container>
|
||||
inline const Foam::CompactListList_dev<T, Container>&
|
||||
Foam::CompactListList_dev<T, Container>::null()
|
||||
{
|
||||
return *reinterpret_cast< CompactListList_dev<T, Container>* >(0);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline Foam::label Foam::CompactListList_dev<T, Container>::size() const
|
||||
{
|
||||
return size_;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline bool Foam::CompactListList_dev<T, Container>::empty() const
|
||||
{
|
||||
return !size_;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline const Foam::List<Foam::label>&
|
||||
Foam::CompactListList_dev<T, Container>::offsets() const
|
||||
{
|
||||
return offsets_;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline Foam::List<Foam::label>& Foam::CompactListList_dev<T, Container>::offsets()
|
||||
{
|
||||
return offsets_;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline const Foam::List<T>& Foam::CompactListList_dev<T, Container>::m()
|
||||
const
|
||||
{
|
||||
return m_;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline Foam::List<T>& Foam::CompactListList_dev<T, Container>::m()
|
||||
{
|
||||
return m_;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline Foam::label Foam::CompactListList_dev<T, Container>::index
|
||||
(
|
||||
const label i,
|
||||
const label j
|
||||
) const
|
||||
{
|
||||
return offsets_[i] + j;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline Foam::label Foam::CompactListList_dev<T, Container>::whichRow(const label i)
|
||||
const
|
||||
{
|
||||
if (i < 0 || i >= m_.size())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"CompactListList_dev<T, Container>::whichRow(const label) const"
|
||||
) << "Index " << i << " outside 0.." << m_.size()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return findLower(offsets_, i+1);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline Foam::label Foam::CompactListList_dev<T, Container>::whichColumn
|
||||
(
|
||||
const label row,
|
||||
const label i
|
||||
) const
|
||||
{
|
||||
return i - index(row, 0);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline Foam::Xfer<Foam::CompactListList_dev<T, Container> >
|
||||
Foam::CompactListList_dev<T, Container>::xfer()
|
||||
{
|
||||
return xferMove(*this);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline void Foam::CompactListList_dev<T, Container>::resize(const label nRows)
|
||||
{
|
||||
this->setSize(nRows);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline void Foam::CompactListList_dev<T, Container>::resize
|
||||
(
|
||||
const label nRows,
|
||||
const label nData
|
||||
)
|
||||
{
|
||||
this->setSize(nRows, nData);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline void Foam::CompactListList_dev<T, Container>::resize
|
||||
(
|
||||
const label nRows,
|
||||
const label nData,
|
||||
const T& t
|
||||
)
|
||||
{
|
||||
this->setSize(nRows, nData, t);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline void Foam::CompactListList_dev<T, Container>::resize
|
||||
(
|
||||
const UList<label>& rowSizes
|
||||
)
|
||||
{
|
||||
this->setSize(rowSizes);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Container>
|
||||
inline Foam::UList<T> Foam::CompactListList_dev<T, Container>::operator[]
|
||||
(
|
||||
const label i
|
||||
)
|
||||
{
|
||||
label start = offsets_[i];
|
||||
return UList<T>((m_.size() ? &m_[start] : NULL), offsets_[i+1] - start);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline const Foam::UList<T>
|
||||
Foam::CompactListList_dev<T, Container>::operator[]
|
||||
(
|
||||
const label i
|
||||
) const
|
||||
{
|
||||
label start = offsets_[i];
|
||||
return UList<T>
|
||||
(
|
||||
(m_.size() ? const_cast<T*>(&m_[start]) : NULL),
|
||||
offsets_[i+1] - start
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline T& Foam::CompactListList_dev<T, Container>::operator()
|
||||
(
|
||||
const label i,
|
||||
const label j
|
||||
)
|
||||
{
|
||||
return m_[index(i, j)];
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline const T& Foam::CompactListList_dev<T, Container>::operator()
|
||||
(
|
||||
const label i,
|
||||
const label j
|
||||
) const
|
||||
{
|
||||
return m_[index(i, j)];
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
inline void Foam::CompactListList_dev<T, Container>::operator=(const T& t)
|
||||
{
|
||||
m_ = t;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -1,66 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright held by original author
|
||||
\\/ 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 "CompactListList_dev.H"
|
||||
#include "Istream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Container>
|
||||
Foam::CompactListList_dev<T, Container>::CompactListList_dev(Istream& is)
|
||||
{
|
||||
operator>>(is, *this);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Container>
|
||||
Foam::Istream& Foam::operator>>(Istream& is, CompactListList_dev<T, Container>& lst)
|
||||
{
|
||||
is >> lst.offsets_ >> lst.m_;
|
||||
// Note: empty list gets output as two empty lists
|
||||
if (lst.offsets_.size() == 0)
|
||||
{
|
||||
lst.size_ = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
lst.size_ = lst.offsets_.size()-1;
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Container>
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const CompactListList_dev<T, Container>& lst)
|
||||
{
|
||||
os << lst.offsets_ << lst.m_;
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
File diff suppressed because it is too large
Load diff
|
@ -1,368 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright held by original author
|
||||
\\/ 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::fvMeshDistribute
|
||||
|
||||
Description
|
||||
Sends/receives parts of mesh+fvfields to neighbouring processors.
|
||||
Used in load balancing.
|
||||
|
||||
Input is per local cell the processor it should move to. Moves meshes
|
||||
and volFields/surfaceFields and returns map which can be used to
|
||||
distribute other.
|
||||
|
||||
Notes:
|
||||
- does not handle cyclics. Will probably handle separated proc patches.
|
||||
- if all cells move off processor also all its processor patches will
|
||||
get deleted so comms might be screwed up (since e.g. globalMeshData
|
||||
expects procPatches on all)
|
||||
- initial mesh has to have procPatches last and all normal patches common
|
||||
to all processors and in the same order. This is checked.
|
||||
- faces are matched topologically but points on the faces are not. So
|
||||
expect problems -on separated patches (cyclics?) -on zero sized processor
|
||||
edges.
|
||||
|
||||
SourceFiles
|
||||
fvMeshDistribute.C
|
||||
fvMeshDistributeTemplates.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef fvMeshDistribute_H
|
||||
#define fvMeshDistribute_H
|
||||
|
||||
#include "Field.H"
|
||||
//#include "uLabel.H"
|
||||
#include "fvMeshSubset.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class mapAddedPolyMesh;
|
||||
class mapDistributePolyMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class fvMeshDistribute Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class fvMeshDistribute
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Underlying fvMesh
|
||||
fvMesh& mesh_;
|
||||
|
||||
//- Absolute merging tolerance (constructing meshes gets done using
|
||||
// geometric matching)
|
||||
const scalar mergeTol_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Find indices with value
|
||||
static labelList select
|
||||
(
|
||||
const bool selectEqual,
|
||||
const labelList& values,
|
||||
const label value
|
||||
);
|
||||
|
||||
//- Check all procs have same names and in exactly same order.
|
||||
static void checkEqualWordList(const string&, const wordList&);
|
||||
|
||||
//- Merge wordlists over all processors
|
||||
static wordList mergeWordList(const wordList&);
|
||||
|
||||
|
||||
// Patch handling
|
||||
|
||||
//- Find patch to put exposed faces into.
|
||||
label findNonEmptyPatch() const;
|
||||
|
||||
//- Appends processorPolyPatch. Returns patchID.
|
||||
label addProcPatch(const word& patchName, const label nbrProc);
|
||||
|
||||
//- Add patch field
|
||||
template<class GeoField>
|
||||
void addPatchFields(const word& patchFieldType);
|
||||
|
||||
//- Deletes last patch.
|
||||
void deleteTrailingPatch();
|
||||
|
||||
// Delete trailing patch fields
|
||||
template<class GeoField>
|
||||
void deleteTrailingPatchFields();
|
||||
|
||||
//- Save boundary fields
|
||||
template <class T, class Mesh>
|
||||
void saveBoundaryFields
|
||||
(
|
||||
PtrList<FieldField<fvsPatchField, T> >& bflds
|
||||
) const;
|
||||
|
||||
//- Map boundary fields
|
||||
template <class T, class Mesh>
|
||||
void mapBoundaryFields
|
||||
(
|
||||
const mapPolyMesh& map,
|
||||
const PtrList<FieldField<fvsPatchField, T> >& oldBflds
|
||||
);
|
||||
|
||||
//- Init patch fields of certain type
|
||||
template<class GeoField, class PatchFieldType>
|
||||
void initPatchFields
|
||||
(
|
||||
const typename GeoField::value_type& initVal
|
||||
);
|
||||
|
||||
//- Delete all processor patches. Move any processor faces into
|
||||
// patchI.
|
||||
autoPtr<mapPolyMesh> deleteProcPatches(const label patchI);
|
||||
|
||||
//- Repatch the mesh. This is only nessecary for the proc
|
||||
// boundary faces. newPatchID is over all boundary faces: -1 or
|
||||
// new patchID. constructFaceMap is being adapted for the
|
||||
// possible new face position (since proc faces get automatically
|
||||
// matched)
|
||||
autoPtr<mapPolyMesh> repatch
|
||||
(
|
||||
const labelList& newPatchID,
|
||||
labelListList& constructFaceMap
|
||||
);
|
||||
|
||||
//- Merge any shared points that are geometrically shared. Needs
|
||||
// parallel valid mesh - uses globalMeshData.
|
||||
// constructPointMap is adapted for the new point labels.
|
||||
autoPtr<mapPolyMesh> mergeSharedPoints
|
||||
(
|
||||
labelListList& constructPointMap
|
||||
);
|
||||
|
||||
// Coupling information
|
||||
|
||||
//- Construct the local environment of all boundary faces.
|
||||
void getNeighbourData
|
||||
(
|
||||
const labelList& distribution,
|
||||
labelList& sourceFace,
|
||||
labelList& sourceProc,
|
||||
labelList& sourceNewProc
|
||||
) const;
|
||||
|
||||
// Subset the neighbourCell/neighbourProc fields
|
||||
static void subsetBoundaryData
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const labelList& faceMap,
|
||||
const labelList& cellMap,
|
||||
|
||||
const labelList& oldDistribution,
|
||||
const labelList& oldFaceOwner,
|
||||
const labelList& oldFaceNeighbour,
|
||||
const label oldInternalFaces,
|
||||
|
||||
const labelList& sourceFace,
|
||||
const labelList& sourceProc,
|
||||
const labelList& sourceNewProc,
|
||||
|
||||
labelList& subFace,
|
||||
labelList& subProc,
|
||||
labelList& subNewProc
|
||||
);
|
||||
|
||||
//- Find cells on mesh whose faceID/procID match the neighbour
|
||||
// cell/proc of domainMesh. Store the matching face.
|
||||
static void findCouples
|
||||
(
|
||||
const primitiveMesh&,
|
||||
const labelList& sourceFace,
|
||||
const labelList& sourceProc,
|
||||
|
||||
const label domain,
|
||||
const primitiveMesh& domainMesh,
|
||||
const labelList& domainFace,
|
||||
const labelList& domainProc,
|
||||
|
||||
labelList& masterCoupledFaces,
|
||||
labelList& slaveCoupledFaces
|
||||
);
|
||||
|
||||
//- Map data on boundary faces to new mesh (resulting from adding
|
||||
// two meshes)
|
||||
static labelList mapBoundaryData
|
||||
(
|
||||
const primitiveMesh& mesh, // mesh after adding
|
||||
const mapAddedPolyMesh& map,
|
||||
const labelList& boundaryData0, // mesh before adding
|
||||
const label nInternalFaces1,
|
||||
const labelList& boundaryData1 // added mesh
|
||||
);
|
||||
|
||||
|
||||
// Other
|
||||
|
||||
//- Remove cells. Add all exposed faces to patch oldInternalPatchI
|
||||
autoPtr<mapPolyMesh> doRemoveCells
|
||||
(
|
||||
const labelList& cellsToRemove,
|
||||
const label oldInternalPatchI
|
||||
);
|
||||
|
||||
//- Add processor patches. Changes mesh and returns per neighbour
|
||||
// proc the processor patchID.
|
||||
void addProcPatches
|
||||
(
|
||||
const labelList&, // processor that neighbour is on
|
||||
labelList& procPatchID
|
||||
);
|
||||
|
||||
//- Get boundary faces to be repatched. Is -1 or new patchID
|
||||
static labelList getProcBoundaryPatch
|
||||
(
|
||||
const labelList& neighbourNewProc,// new processor per b. face
|
||||
const labelList& procPatchID // patchID
|
||||
);
|
||||
|
||||
//- Send mesh and coupling data.
|
||||
static void sendMesh
|
||||
(
|
||||
const label domain,
|
||||
const fvMesh& mesh,
|
||||
const wordList& pointZoneNames,
|
||||
const wordList& facesZoneNames,
|
||||
const wordList& cellZoneNames,
|
||||
const labelList& sourceFace,
|
||||
const labelList& sourceProc,
|
||||
const labelList& sourceNewProc,
|
||||
OSstream& toDomain
|
||||
);
|
||||
//- Send subset of fields
|
||||
template<class GeoField>
|
||||
static void sendFields
|
||||
(
|
||||
const label domain,
|
||||
const wordList& fieldNames,
|
||||
const fvMeshSubset&,
|
||||
OSstream& toNbr
|
||||
);
|
||||
|
||||
//- Receive mesh. Opposite of sendMesh
|
||||
static autoPtr<fvMesh> receiveMesh
|
||||
(
|
||||
const label domain,
|
||||
const wordList& pointZoneNames,
|
||||
const wordList& facesZoneNames,
|
||||
const wordList& cellZoneNames,
|
||||
const Time& runTime,
|
||||
labelList& domainSourceFace,
|
||||
labelList& domainSourceProc,
|
||||
labelList& domainSourceNewProc,
|
||||
ISstream& fromNbr
|
||||
);
|
||||
|
||||
//- Receive fields. Opposite of sendFields
|
||||
template<class GeoField>
|
||||
static void receiveFields
|
||||
(
|
||||
const label domain,
|
||||
const wordList& fieldNames,
|
||||
fvMesh&,
|
||||
PtrList<GeoField>&,
|
||||
const dictionary& fieldDicts
|
||||
);
|
||||
|
||||
//- Do parallel exchange
|
||||
template <class Container, class T>
|
||||
static void exchange
|
||||
(
|
||||
const List<Container >& sendBufs,
|
||||
List<Container >& recvBufs,
|
||||
labelListList& sizes
|
||||
);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
fvMeshDistribute(const fvMeshDistribute&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const fvMeshDistribute&);
|
||||
|
||||
public:
|
||||
|
||||
ClassName("fvMeshDistribute");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh and absolute merge tolerance
|
||||
fvMeshDistribute(fvMesh& mesh, const scalar mergeTol);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Helper function: count cells per processor in wanted distribution
|
||||
static labelList countCells(const labelList&);
|
||||
|
||||
//- Send cells to neighbours according to distribution
|
||||
// (for every cell the new proc)
|
||||
autoPtr<mapDistributePolyMesh> distribute(const labelList& dist);
|
||||
|
||||
// Debugging
|
||||
|
||||
//- Print some info on coupling data
|
||||
static void printCoupleInfo
|
||||
(
|
||||
const primitiveMesh&,
|
||||
const labelList&,
|
||||
const labelList&,
|
||||
const labelList&
|
||||
);
|
||||
|
||||
//- Print some field info
|
||||
template<class GeoField>
|
||||
static void printFieldInfo(const fvMesh&);
|
||||
|
||||
//- Print some info on mesh.
|
||||
static void printMeshInfo(const fvMesh&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "fvMeshDistributeTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
|
@ -1,499 +0,0 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright held by original author
|
||||
\\/ 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 "mapPolyMesh.H"
|
||||
#include "PstreamCombineReduceOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
//- combineReduce operator for lists. Used for counting.
|
||||
class listEq
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
template<class T>
|
||||
void operator()(T& x, const T& y) const
|
||||
{
|
||||
forAll(y, i)
|
||||
{
|
||||
if (y[i].size())
|
||||
{
|
||||
x[i] = y[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <class Container, class T>
|
||||
void Foam::fvMeshDistribute::exchange
|
||||
(
|
||||
const List<Container >& sendBufs,
|
||||
List<Container >& recvBufs,
|
||||
labelListList& sizes
|
||||
)
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
if (!contiguous<T>())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Pstream::exchange(..)"
|
||||
) << "Continuous data only." << Foam::abort(FatalError);
|
||||
}
|
||||
|
||||
if (sendBufs.size() != Pstream::nProcs())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Pstream::exchange(..)"
|
||||
) << "Size of list:" << sendBufs.size()
|
||||
<< " does not equal the number of processors:"
|
||||
<< Pstream::nProcs()
|
||||
<< Foam::abort(FatalError);
|
||||
}
|
||||
|
||||
sizes.setSize(Pstream::nProcs());
|
||||
labelList& nsTransPs = sizes[Pstream::myProcNo()];
|
||||
nsTransPs.setSize(Pstream::nProcs());
|
||||
|
||||
forAll(sendBufs, procI)
|
||||
{
|
||||
nsTransPs[procI] = sendBufs[procI].size();
|
||||
}
|
||||
|
||||
Foam::combineReduce(sizes, listEq());
|
||||
|
||||
|
||||
// Set up receives
|
||||
// ~~~~~~~~~~~~~~~
|
||||
|
||||
recvBufs.setSize(sendBufs.size());
|
||||
forAll(sizes, procI)
|
||||
{
|
||||
label nRecv = sizes[procI][Pstream::myProcNo()];
|
||||
|
||||
if (procI != Pstream::myProcNo() && nRecv > 0)
|
||||
{
|
||||
recvBufs[procI].setSize(nRecv);
|
||||
IPstream::read
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
procI,
|
||||
reinterpret_cast<char*>(recvBufs[procI].begin()),
|
||||
nRecv*sizeof(T)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set up sends
|
||||
// ~~~~~~~~~~~~
|
||||
|
||||
forAll(sendBufs, procI)
|
||||
{
|
||||
if (procI != Pstream::myProcNo() && sendBufs[procI].size() > 0)
|
||||
{
|
||||
if
|
||||
(
|
||||
!OPstream::write
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
procI,
|
||||
reinterpret_cast<const char*>(sendBufs[procI].begin()),
|
||||
sendBufs[procI].size()*sizeof(T)
|
||||
)
|
||||
)
|
||||
{
|
||||
FatalErrorIn("Pstream::exchange(..)")
|
||||
<< "Cannot send outgoing message. "
|
||||
<< "to:" << procI << " nBytes:"
|
||||
<< label(sendBufs[procI].size()*sizeof(T))
|
||||
<< Foam::abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Wait for all to finish
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
IPstream::waitRequests();
|
||||
OPstream::waitRequests();
|
||||
}
|
||||
|
||||
// Do myself
|
||||
recvBufs[Pstream::myProcNo()] = sendBufs[Pstream::myProcNo()];
|
||||
}
|
||||
|
||||
|
||||
template<class GeoField>
|
||||
void Foam::fvMeshDistribute::printFieldInfo(const fvMesh& mesh)
|
||||
{
|
||||
HashTable<const GeoField*> flds
|
||||
(
|
||||
mesh.objectRegistry::lookupClass<GeoField>()
|
||||
);
|
||||
|
||||
for
|
||||
(
|
||||
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
|
||||
iter != flds.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
const GeoField& fld = *iter();
|
||||
|
||||
Pout<< "Field:" << iter.key() << " internalsize:" << fld.size()
|
||||
//<< " value:" << fld
|
||||
<< endl;
|
||||
|
||||
forAll(fld.boundaryField(), patchI)
|
||||
{
|
||||
Pout<< " " << patchI
|
||||
<< ' ' << fld.boundaryField()[patchI].patch().name()
|
||||
<< ' ' << fld.boundaryField()[patchI].type()
|
||||
<< ' ' << fld.boundaryField()[patchI].size()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class GeoField>
|
||||
void Foam::fvMeshDistribute::addPatchFields(const word& patchFieldType)
|
||||
{
|
||||
HashTable<const GeoField*> flds
|
||||
(
|
||||
mesh_.objectRegistry::lookupClass<GeoField>()
|
||||
);
|
||||
|
||||
for
|
||||
(
|
||||
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
|
||||
iter != flds.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
const GeoField& fld = *iter();
|
||||
|
||||
typename GeoField::GeometricBoundaryField& bfld =
|
||||
const_cast<typename GeoField::GeometricBoundaryField&>
|
||||
(
|
||||
fld.boundaryField()
|
||||
);
|
||||
|
||||
label sz = bfld.size();
|
||||
bfld.setSize(sz + 1);
|
||||
bfld.set
|
||||
(
|
||||
sz,
|
||||
GeoField::PatchFieldType::New
|
||||
(
|
||||
patchFieldType,
|
||||
mesh_.boundary()[sz],
|
||||
fld.dimensionedInternalField()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Delete trailing patch fields
|
||||
template<class GeoField>
|
||||
void Foam::fvMeshDistribute::deleteTrailingPatchFields()
|
||||
{
|
||||
HashTable<const GeoField*> flds
|
||||
(
|
||||
mesh_.objectRegistry::lookupClass<GeoField>()
|
||||
);
|
||||
|
||||
for
|
||||
(
|
||||
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
|
||||
iter != flds.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
const GeoField& fld = *iter();
|
||||
|
||||
typename GeoField::GeometricBoundaryField& bfld =
|
||||
const_cast<typename GeoField::GeometricBoundaryField&>
|
||||
(
|
||||
fld.boundaryField()
|
||||
);
|
||||
|
||||
// Shrink patchFields
|
||||
bfld.setSize(bfld.size() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Save whole boundary field
|
||||
template <class T, class Mesh>
|
||||
void Foam::fvMeshDistribute::saveBoundaryFields
|
||||
(
|
||||
PtrList<FieldField<fvsPatchField, T> >& bflds
|
||||
) const
|
||||
{
|
||||
typedef GeometricField<T, fvsPatchField, Mesh> fldType;
|
||||
|
||||
HashTable<const fldType*> flds
|
||||
(
|
||||
mesh_.objectRegistry::lookupClass<fldType>()
|
||||
);
|
||||
|
||||
bflds.setSize(flds.size());
|
||||
|
||||
label i = 0;
|
||||
|
||||
for
|
||||
(
|
||||
typename HashTable<const fldType*>::const_iterator iter = flds.begin();
|
||||
iter != flds.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
const fldType& fld = *iter();
|
||||
|
||||
bflds.set(i, fld.boundaryField().clone().ptr());
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Map boundary field
|
||||
template <class T, class Mesh>
|
||||
void Foam::fvMeshDistribute::mapBoundaryFields
|
||||
(
|
||||
const mapPolyMesh& map,
|
||||
const PtrList<FieldField<fvsPatchField, T> >& oldBflds
|
||||
)
|
||||
{
|
||||
const labelList& oldPatchStarts = map.oldPatchStarts();
|
||||
const labelList& faceMap = map.faceMap();
|
||||
|
||||
typedef GeometricField<T, fvsPatchField, Mesh> fldType;
|
||||
|
||||
HashTable<const fldType*> flds
|
||||
(
|
||||
mesh_.objectRegistry::lookupClass<fldType>()
|
||||
);
|
||||
|
||||
if (flds.size() != oldBflds.size())
|
||||
{
|
||||
FatalErrorIn("fvMeshDistribute::mapBoundaryFields(..)") << "problem"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
label fieldI = 0;
|
||||
|
||||
for
|
||||
(
|
||||
typename HashTable<const fldType*>::const_iterator iter = flds.begin();
|
||||
iter != flds.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
const fldType& fld = *iter();
|
||||
typename fldType::GeometricBoundaryField& bfld =
|
||||
const_cast<typename fldType::GeometricBoundaryField&>
|
||||
(
|
||||
fld.boundaryField()
|
||||
);
|
||||
|
||||
|
||||
const FieldField<fvsPatchField, T>& oldBfld = oldBflds[fieldI++];
|
||||
|
||||
// Pull from old boundary field into bfld.
|
||||
|
||||
forAll(bfld, patchI)
|
||||
{
|
||||
fvsPatchField<T>& patchFld = bfld[patchI];
|
||||
label faceI = patchFld.patch().patch().start();
|
||||
|
||||
forAll(patchFld, i)
|
||||
{
|
||||
label oldFaceI = faceMap[faceI++];
|
||||
|
||||
// Find patch and local patch face oldFaceI was in.
|
||||
forAll(oldPatchStarts, oldPatchI)
|
||||
{
|
||||
label oldLocalI = oldFaceI - oldPatchStarts[oldPatchI];
|
||||
|
||||
if (oldLocalI >= 0 && oldLocalI < oldBfld[oldPatchI].size())
|
||||
{
|
||||
patchFld[i] = oldBfld[oldPatchI][oldLocalI];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Init patch fields of certain type
|
||||
template<class GeoField, class PatchFieldType>
|
||||
void Foam::fvMeshDistribute::initPatchFields
|
||||
(
|
||||
const typename GeoField::value_type& initVal
|
||||
)
|
||||
{
|
||||
HashTable<const GeoField*> flds
|
||||
(
|
||||
mesh_.objectRegistry::lookupClass<GeoField>()
|
||||
);
|
||||
|
||||
for
|
||||
(
|
||||
typename HashTable<const GeoField*>::const_iterator iter = flds.begin();
|
||||
iter != flds.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
const GeoField& fld = *iter();
|
||||
|
||||
typename GeoField::GeometricBoundaryField& bfld =
|
||||
const_cast<typename GeoField::GeometricBoundaryField&>
|
||||
(
|
||||
fld.boundaryField()
|
||||
);
|
||||
|
||||
forAll(bfld, patchI)
|
||||
{
|
||||
if (isA<PatchFieldType>(bfld[patchI]))
|
||||
{
|
||||
bfld[patchI] == initVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Send fields. Note order supplied so we can receive in exactly the same order.
|
||||
// Note that field gets written as entry in dictionary so we
|
||||
// can construct from subdictionary.
|
||||
// (since otherwise the reading as-a-dictionary mixes up entries from
|
||||
// consecutive fields)
|
||||
// The dictionary constructed is:
|
||||
// volScalarField
|
||||
// {
|
||||
// p {internalField ..; boundaryField ..;}
|
||||
// k {internalField ..; boundaryField ..;}
|
||||
// }
|
||||
// volVectorField
|
||||
// {
|
||||
// U {internalField ... }
|
||||
// }
|
||||
|
||||
// volVectorField {U {internalField ..; boundaryField ..;}}
|
||||
//
|
||||
template<class GeoField>
|
||||
void Foam::fvMeshDistribute::sendFields
|
||||
(
|
||||
const label domain,
|
||||
const wordList& fieldNames,
|
||||
const fvMeshSubset& subsetter,
|
||||
OSstream& toNbr
|
||||
)
|
||||
{
|
||||
toNbr << GeoField::typeName << token::NL << token::BEGIN_BLOCK << token::NL;
|
||||
forAll(fieldNames, i)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Subsetting field " << fieldNames[i]
|
||||
<< " for domain:" << domain << endl;
|
||||
}
|
||||
|
||||
// Send all fieldNames. This has to be exactly the same set as is
|
||||
// being received!
|
||||
const GeoField& fld =
|
||||
subsetter.baseMesh().lookupObject<GeoField>(fieldNames[i]);
|
||||
|
||||
tmp<GeoField> tsubfld = subsetter.interpolate(fld);
|
||||
|
||||
toNbr
|
||||
<< fieldNames[i] << token::NL << token::BEGIN_BLOCK
|
||||
<< tsubfld
|
||||
<< token::NL << token::END_BLOCK << token::NL;
|
||||
}
|
||||
toNbr << token::END_BLOCK << token::NL;
|
||||
}
|
||||
|
||||
|
||||
// Opposite of sendFields
|
||||
template<class GeoField>
|
||||
void Foam::fvMeshDistribute::receiveFields
|
||||
(
|
||||
const label domain,
|
||||
const wordList& fieldNames,
|
||||
fvMesh& mesh,
|
||||
PtrList<GeoField>& fields,
|
||||
const dictionary& fieldDicts
|
||||
)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Receiving fields " << fieldNames
|
||||
<< " from domain:" << domain << endl;
|
||||
}
|
||||
|
||||
fields.setSize(fieldNames.size());
|
||||
|
||||
forAll(fieldNames, i)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Constructing field " << fieldNames[i]
|
||||
<< " from domain:" << domain << endl;
|
||||
}
|
||||
|
||||
fields.set
|
||||
(
|
||||
i,
|
||||
new GeoField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldNames[i],
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
fieldDicts.subDict(fieldNames[i])
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -360,7 +360,7 @@ edgeInterpolationScheme<Type>::interpolate
|
|||
|
||||
for (label i=0; i<size; i++)
|
||||
{
|
||||
const tensorField& curT =
|
||||
const tensorField& curT =
|
||||
mesh.edgeTransformTensors()[start + i];
|
||||
|
||||
const tensor& Te = curT[0];
|
||||
|
@ -372,13 +372,13 @@ edgeInterpolationScheme<Type>::interpolate
|
|||
(
|
||||
Te.T(),
|
||||
pLambda[i]*transform(TP, pOwnVf[i])
|
||||
+ (1.0 - pLambda[i])*transform(TN, pNgbVf[i])
|
||||
+ (1 - pLambda[i])*transform(TN, pNgbVf[i])
|
||||
);
|
||||
}
|
||||
|
||||
// tsf().boundaryField()[pi] =
|
||||
// pLambda*vf.boundaryField()[pi].patchInternalField()
|
||||
// + (1.0 - pLambda)*vf.boundaryField()[pi].patchNeighbourField();
|
||||
// + (1 - pLambda)*vf.boundaryField()[pi].patchNeighbourField();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -118,7 +118,7 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs()
|
|||
return;
|
||||
}
|
||||
|
||||
// a simpler way of doing this would be nice
|
||||
// A simpler way of doing this would be nice
|
||||
scalar avgU = -flowRate_/gSum(patch().magSf());
|
||||
|
||||
vectorField n = patch().nf();
|
||||
|
@ -128,7 +128,7 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs()
|
|||
|
||||
if (phi.dimensions() == dimVelocity*dimArea)
|
||||
{
|
||||
// volumetric flow-rate
|
||||
// Volumetric flow-rate
|
||||
operator==(n*avgU);
|
||||
}
|
||||
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
|
@ -136,7 +136,7 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs()
|
|||
const fvPatchField<scalar>& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
||||
// mass flow-rate
|
||||
// Mass flow-rate
|
||||
operator==(n*avgU/rhop);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -69,10 +69,10 @@ tmp<volScalarField> CoEulerDdtScheme<Type>::CorDeltaT() const
|
|||
|
||||
forAll(owner, faceI)
|
||||
{
|
||||
corDeltaT[owner[faceI]] =
|
||||
corDeltaT[owner[faceI]] =
|
||||
max(corDeltaT[owner[faceI]], cofrDeltaT[faceI]);
|
||||
|
||||
corDeltaT[neighbour[faceI]] =
|
||||
corDeltaT[neighbour[faceI]] =
|
||||
max(corDeltaT[neighbour[faceI]], cofrDeltaT[faceI]);
|
||||
}
|
||||
|
||||
|
|
|
@ -206,7 +206,10 @@ public:
|
|||
}
|
||||
|
||||
template<class T>
|
||||
const typename Field<T>::subField patchSlice(const Field<T>& l) const
|
||||
const typename Field<T>::subField patchSlice
|
||||
(
|
||||
const Field<T>& l
|
||||
) const
|
||||
{
|
||||
return typename Field<T>::subField
|
||||
(
|
||||
|
|
|
@ -59,12 +59,11 @@ void Foam::processorTetPolyPatchCellDecomp::calcMeshPoints() const
|
|||
masterFaces[faceI] = pp[faceI].reverseFace();
|
||||
}
|
||||
|
||||
mp =
|
||||
primitiveFacePatch
|
||||
(
|
||||
masterFaces,
|
||||
pp.points()
|
||||
).meshPoints();
|
||||
mp = primitiveFacePatch
|
||||
(
|
||||
masterFaces,
|
||||
pp.points()
|
||||
).meshPoints();
|
||||
}
|
||||
|
||||
// Get reference to shared points
|
||||
|
|
Reference in a new issue