Commit 63262b80 authored by mattijs's avatar mattijs
Browse files

BUG: processorCyclic was using incorrect message tag.

Both sides need to use the same tag so it is now calculated as
    nProcs*(max(myProcNo,neighProcNo) + min(myProcNo,neighProcNo)
which is
- commutative
- does not interfere with normal message tag 1
parent 11c5c744
......@@ -219,30 +219,6 @@ Foam::List<int> Foam::UPstream::procIDs_(1, 0);
// Standard transfer message type
int Foam::UPstream::msgType_(1);
// New message type
int Foam::UPstream::freeTag_(msgType()+1);
// Free'd message types
Foam::LIFOStack<int> Foam::UPstream::freedTags_;
int Foam::UPstream::allocateTag()
{
if (freedTags_.empty())
{
return freeTag_++;
}
else
{
return freedTags_.pop();
}
}
void Foam::UPstream::freeTag(const int tag)
{
freedTags_.push(tag);
}
// Linear communication schedule
Foam::List<Foam::UPstream::commsStruct> Foam::UPstream::linearCommunication_(0);
......
......@@ -45,7 +45,6 @@ SourceFiles
#include "HashTable.H"
#include "string.H"
#include "NamedEnum.H"
#include "LIFOStack.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -191,12 +190,6 @@ private:
static List<commsStruct> treeCommunication_;
//- Current free tag
static int freeTag_;
//- Freed tags
static LIFOStack<int> freedTags_;
// Private Member Functions
//- Set data for parallel running
......@@ -346,11 +339,6 @@ public:
{
return msgType_;
}
//- Allocate new tag
static int allocateTag();
//- Release allocated tag
static void freeTag(const int tag);
//- Get the communications type of the stream
......
......@@ -55,10 +55,20 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
)
:
processorPolyPatch(name, size, start, index, bm, myProcNo, neighbProcNo),
tag_(UPstream::allocateTag()),
tag_
(
Pstream::nProcs()*max(myProcNo, neighbProcNo)
+ min(myProcNo, neighbProcNo)
),
referPatchName_(referPatchName),
referPatchID_(-1)
{}
{
if (debug)
{
Pout<< "processorCyclicPolyPatch " << name << " uses tag " << tag_
<< endl;
}
}
Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
......@@ -70,10 +80,20 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
)
:
processorPolyPatch(name, dict, index, bm),
tag_(UPstream::allocateTag()),
tag_
(
Pstream::nProcs()*max(myProcNo(), neighbProcNo())
+ min(myProcNo(), neighbProcNo())
),
referPatchName_(dict.lookup("referPatch")),
referPatchID_(-1)
{}
{
if (debug)
{
Pout<< "processorCyclicPolyPatch " << name << " uses tag " << tag_
<< endl;
}
}
Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
......@@ -125,9 +145,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::processorCyclicPolyPatch::~processorCyclicPolyPatch()
{
UPstream::freeTag(tag_);
}
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment