Skip to content
Snippets Groups Projects
Commit e7e1313b authored by mattijs's avatar mattijs
Browse files

use meshPoint numbering

parent 596ae902
Branches
Tags
No related merge requests found
...@@ -103,29 +103,13 @@ void processorPointPatchField<Type>::initSwapAdd(Field<Type>& pField) const ...@@ -103,29 +103,13 @@ void processorPointPatchField<Type>::initSwapAdd(Field<Type>& pField) const
// Get internal field into my point order // Get internal field into my point order
Field<Type> pf(this->patchInternalField(pField)); Field<Type> pf(this->patchInternalField(pField));
// Normally points will be ordered same on both sides due to OPstream::write
// the point numbering by decomposePar. However this will not be (
// the case for meshes changed in parallel. Pstream::blocking,
procPatch_.neighbProcNo(),
// Reorder into neighbour point order. Note that one side can have reinterpret_cast<const char*>(pf.begin()),
// more or less points than other side if partically decomposed pf.byteSize()
// cyclics are present. );
const labelList& nbrPts = procPatch_.procPolyPatch().neighbPoints();
Field<Type> nbrf(this->size(), pTraits<Type>::zero);
forAll(nbrPts, i)
{
label nbrPointI = nbrPts[i];
if (nbrPointI >= 0 && nbrPointI < nbrf.size())
{
nbrf[nbrPointI] = pf[i];
}
}
OPstream toNbr(Pstream::blocking, procPatch_.neighbProcNo());
toNbr << nbrf;
} }
} }
...@@ -136,26 +120,19 @@ void processorPointPatchField<Type>::swapAdd(Field<Type>& pField) const ...@@ -136,26 +120,19 @@ void processorPointPatchField<Type>::swapAdd(Field<Type>& pField) const
if (Pstream::parRun()) if (Pstream::parRun())
{ {
Field<Type> pnf(this->size()); Field<Type> pnf(this->size());
{
// We do not know the number of points on the other side
// so cannot use Pstream::read.
IPstream fromNbr
(
Pstream::blocking,
procPatch_.neighbProcNo()
);
fromNbr >> pnf;
}
pnf.setSize(this->size(), pTraits<Type>::zero); IPstream::read
(
Pstream::blocking,
procPatch_.neighbProcNo(),
reinterpret_cast<char*>(pnf.begin()),
pnf.byteSize()
);
if (doTransform()) if (doTransform())
{ {
const processorPolyPatch& ppp = procPatch_.procPolyPatch(); const processorPolyPatch& ppp = procPatch_.procPolyPatch();
const tensorField& forwardT = ppp.forwardT(); const tensorField& forwardT = ppp.forwardT();
const labelList& nonGlobalPatchPoints =
procPatch_.nonGlobalPatchPoints();
const labelListList& pointFaces = ppp.pointFaces();
if (forwardT.size() == 1) if (forwardT.size() == 1)
{ {
...@@ -163,6 +140,10 @@ void processorPointPatchField<Type>::swapAdd(Field<Type>& pField) const ...@@ -163,6 +140,10 @@ void processorPointPatchField<Type>::swapAdd(Field<Type>& pField) const
} }
else else
{ {
const labelList& nonGlobalPatchPoints =
procPatch_.nonGlobalPatchPoints();
const labelListList& pointFaces = ppp.pointFaces();
forAll(nonGlobalPatchPoints, pfi) forAll(nonGlobalPatchPoints, pfi)
{ {
pnf[pfi] = transform pnf[pfi] = transform
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment