remote: Centralised class to replace patchToPatch::procFace
This commit is contained in:
@ -36,8 +36,7 @@ SourceFiles
|
|||||||
#ifndef RemoteData_H
|
#ifndef RemoteData_H
|
||||||
#define RemoteData_H
|
#define RemoteData_H
|
||||||
|
|
||||||
#include "Istream.H"
|
#include "remote.H"
|
||||||
#include "Ostream.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -62,17 +61,13 @@ inline Ostream& operator<<(Ostream&, const RemoteData<Type>&);
|
|||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
class RemoteData
|
class RemoteData
|
||||||
|
:
|
||||||
|
public remote
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Public Data
|
// Public Data
|
||||||
|
|
||||||
//- Processor index
|
|
||||||
label proci;
|
|
||||||
|
|
||||||
//- Element index
|
|
||||||
label elementi;
|
|
||||||
|
|
||||||
//- Data
|
//- Data
|
||||||
Type data;
|
Type data;
|
||||||
|
|
||||||
|
|||||||
@ -30,8 +30,7 @@ License
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
inline Foam::RemoteData<Type>::RemoteData()
|
inline Foam::RemoteData<Type>::RemoteData()
|
||||||
:
|
:
|
||||||
proci(-1),
|
remote(),
|
||||||
elementi(-1),
|
|
||||||
data()
|
data()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -44,8 +43,7 @@ inline Foam::RemoteData<Type>::RemoteData
|
|||||||
const Type& d
|
const Type& d
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
proci(p),
|
remote(p, e),
|
||||||
elementi(e),
|
|
||||||
data(d)
|
data(d)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -111,9 +109,8 @@ inline bool Foam::operator==
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
a.proci == b.proci
|
static_cast<const remote&>(a) == static_cast<const remote&>(b)
|
||||||
&& a.elementi == b.elementi
|
&& a.data == b.data;
|
||||||
&& a.data == b.data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -133,17 +130,14 @@ inline bool Foam::operator!=
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
inline Foam::Ostream& Foam::operator<<(Ostream& os, const RemoteData<Type>& p)
|
inline Foam::Ostream& Foam::operator<<(Ostream& os, const RemoteData<Type>& p)
|
||||||
{
|
{
|
||||||
return os
|
return os << static_cast<const remote&>(p) << token::SPACE << p.data;
|
||||||
<< p.proci << token::SPACE
|
|
||||||
<< p.elementi << token::SPACE
|
|
||||||
<< p.data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
inline Foam::Istream& Foam::operator>>(Istream& is, RemoteData<Type>& p)
|
inline Foam::Istream& Foam::operator>>(Istream& is, RemoteData<Type>& p)
|
||||||
{
|
{
|
||||||
return is >> p.proci >> p.elementi >> p.data;
|
return is >> static_cast<remote&>(p) >> p.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
113
src/OpenFOAM/primitives/remote/remote.H
Normal file
113
src/OpenFOAM/primitives/remote/remote.H
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration | Website: https://openfoam.org
|
||||||
|
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||||
|
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::remote
|
||||||
|
|
||||||
|
Description
|
||||||
|
Struct for keeping processor, element (cell, face, point) index.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
remoteI.H
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef remote_H
|
||||||
|
#define remote_H
|
||||||
|
|
||||||
|
#include "Istream.H"
|
||||||
|
#include "Ostream.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// Forward declaration of friend functions and operators
|
||||||
|
class remote;
|
||||||
|
inline bool operator==(const remote&, const remote&);
|
||||||
|
inline bool operator!=(const remote&, const remote&);
|
||||||
|
inline Istream& operator>>(Istream&, remote&);
|
||||||
|
inline Ostream& operator<<(Ostream&, const remote&);
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class remote Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class remote
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Public Data
|
||||||
|
|
||||||
|
//- Processor index
|
||||||
|
label proci;
|
||||||
|
|
||||||
|
//- Element index
|
||||||
|
label elementi;
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
inline remote();
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
inline remote(const label, const label);
|
||||||
|
|
||||||
|
//- Construct from stream
|
||||||
|
inline remote(Istream& is);
|
||||||
|
|
||||||
|
|
||||||
|
// Friend Operators
|
||||||
|
|
||||||
|
//- Equality comparison
|
||||||
|
friend bool operator==(const remote& a, const remote& b);
|
||||||
|
|
||||||
|
//- Inequality comparison
|
||||||
|
friend bool operator!=(const remote& a, const remote& b);
|
||||||
|
|
||||||
|
|
||||||
|
// IOstream Operators
|
||||||
|
|
||||||
|
//- Write to stream
|
||||||
|
friend Ostream& operator<<(Ostream& os, const remote& p);
|
||||||
|
|
||||||
|
//- Read from stream
|
||||||
|
friend Istream& operator>>(Istream& is, remote& p);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "remoteI.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
78
src/OpenFOAM/primitives/remote/remoteI.H
Normal file
78
src/OpenFOAM/primitives/remote/remoteI.H
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration | Website: https://openfoam.org
|
||||||
|
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||||
|
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "remote.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline Foam::remote::remote()
|
||||||
|
:
|
||||||
|
proci(-1),
|
||||||
|
elementi(-1)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::remote::remote(const label p, const label e)
|
||||||
|
:
|
||||||
|
proci(p),
|
||||||
|
elementi(e)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::remote::remote(Istream& is)
|
||||||
|
{
|
||||||
|
is >> *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline bool Foam::operator==(const remote& a, const remote& b)
|
||||||
|
{
|
||||||
|
return a.proci == b.proci && a.elementi == b.elementi;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool Foam::operator!=(const remote& a, const remote& b)
|
||||||
|
{
|
||||||
|
return !(a == b);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline Foam::Ostream& Foam::operator<<(Ostream& os, const remote& p)
|
||||||
|
{
|
||||||
|
return os << p.proci << token::SPACE << p.elementi;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::Istream& Foam::operator>>(Istream& is, remote& p)
|
||||||
|
{
|
||||||
|
return is >> p.proci >> p.elementi;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -120,7 +120,7 @@ void Foam::fvMeshStitcher::intersectNonConformalCyclic
|
|||||||
// non-conformal interfaces are ordered.
|
// non-conformal interfaces are ordered.
|
||||||
auto procFacesToIndices = []
|
auto procFacesToIndices = []
|
||||||
(
|
(
|
||||||
const List<List<patchToPatch::procFace>>& faceOtherProcFaces,
|
const List<List<remote>>& faceOtherProcFaces,
|
||||||
const bool owner
|
const bool owner
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -130,8 +130,7 @@ void Foam::fvMeshStitcher::intersectNonConformalCyclic
|
|||||||
{
|
{
|
||||||
forAll(faceOtherProcFaces[facei], i)
|
forAll(faceOtherProcFaces[facei], i)
|
||||||
{
|
{
|
||||||
const patchToPatch::procFace& otherProcFacei =
|
const remote& otherProcFacei = faceOtherProcFaces[facei][i];
|
||||||
faceOtherProcFaces[facei][i];
|
|
||||||
|
|
||||||
is[otherProcFacei.proci] ++;
|
is[otherProcFacei.proci] ++;
|
||||||
}
|
}
|
||||||
@ -150,13 +149,12 @@ void Foam::fvMeshStitcher::intersectNonConformalCyclic
|
|||||||
{
|
{
|
||||||
forAll(faceOtherProcFaces[facei], i)
|
forAll(faceOtherProcFaces[facei], i)
|
||||||
{
|
{
|
||||||
const patchToPatch::procFace& otherProcFacei =
|
const remote& otherProcFacei = faceOtherProcFaces[facei][i];
|
||||||
faceOtherProcFaces[facei][i];
|
|
||||||
|
|
||||||
FixedList<label, 3>& index =
|
FixedList<label, 3>& index =
|
||||||
indices[otherProcFacei.proci][is[otherProcFacei.proci] ++];
|
indices[otherProcFacei.proci][is[otherProcFacei.proci] ++];
|
||||||
|
|
||||||
index = {facei, otherProcFacei.facei, i};
|
index = {facei, otherProcFacei.elementi, i};
|
||||||
|
|
||||||
if (!owner) Swap(index[0], index[1]);
|
if (!owner) Swap(index[0], index[1]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -295,7 +295,7 @@ bool Foam::particle::hitNonConformalCyclicPatch
|
|||||||
|
|
||||||
// Project the particle through the non-conformal patch
|
// Project the particle through the non-conformal patch
|
||||||
point receivePos;
|
point receivePos;
|
||||||
const patchToPatch::procFace receiveProcFace =
|
const remote receiveProcFace =
|
||||||
nccpp.ray
|
nccpp.ray
|
||||||
(
|
(
|
||||||
stepFractionSpan(td.mesh)[0]
|
stepFractionSpan(td.mesh)[0]
|
||||||
@ -318,7 +318,7 @@ bool Foam::particle::hitNonConformalCyclicPatch
|
|||||||
td.sendFromPatch = nccpp.index();
|
td.sendFromPatch = nccpp.index();
|
||||||
td.sendToProc = receiveProcFace.proci;
|
td.sendToProc = receiveProcFace.proci;
|
||||||
td.sendToPatch = nccpp.nbrPatchID();
|
td.sendToPatch = nccpp.nbrPatchID();
|
||||||
td.sendToPatchFace = receiveProcFace.facei;
|
td.sendToPatchFace = receiveProcFace.elementi;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -328,7 +328,7 @@ bool Foam::particle::hitNonConformalCyclicPatch
|
|||||||
(
|
(
|
||||||
td.mesh,
|
td.mesh,
|
||||||
nccpp.index(),
|
nccpp.index(),
|
||||||
receiveProcFace.facei
|
receiveProcFace.elementi
|
||||||
);
|
);
|
||||||
correctAfterNonConformalCyclicTransfer
|
correctAfterNonConformalCyclicTransfer
|
||||||
(
|
(
|
||||||
|
|||||||
@ -318,7 +318,7 @@ Foam::nonConformalCyclicPolyPatch::rays() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::patchToPatch::procFace Foam::nonConformalCyclicPolyPatch::ray
|
Foam::remote Foam::nonConformalCyclicPolyPatch::ray
|
||||||
(
|
(
|
||||||
const scalar fraction,
|
const scalar fraction,
|
||||||
const label origFacei,
|
const label origFacei,
|
||||||
|
|||||||
@ -227,7 +227,7 @@ public:
|
|||||||
const patchToPatches::rays& rays() const;
|
const patchToPatches::rays& rays() const;
|
||||||
|
|
||||||
//- Compute a ray intersection across the coupling
|
//- Compute a ray intersection across the coupling
|
||||||
patchToPatch::procFace ray
|
remote ray
|
||||||
(
|
(
|
||||||
const scalar fraction,
|
const scalar fraction,
|
||||||
const label origFacei,
|
const label origFacei,
|
||||||
|
|||||||
@ -161,14 +161,14 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::List<Foam::List<Foam::patchToPatch::procFace>>
|
Foam::List<Foam::List<Foam::remote>>
|
||||||
Foam::patchToPatch::localFacesToProcFaces
|
Foam::patchToPatch::localFacesToProcFaces
|
||||||
(
|
(
|
||||||
const List<DynamicList<label>>& localFaces,
|
const List<DynamicList<label>>& localFaces,
|
||||||
const List<procFace>& map
|
const List<remote>& map
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
List<List<procFace>> result(localFaces.size());
|
List<List<remote>> result(localFaces.size());
|
||||||
|
|
||||||
forAll(localFaces, thisFacei)
|
forAll(localFaces, thisFacei)
|
||||||
{
|
{
|
||||||
@ -178,7 +178,7 @@ Foam::patchToPatch::localFacesToProcFaces
|
|||||||
{
|
{
|
||||||
result[thisFacei][i] =
|
result[thisFacei][i] =
|
||||||
isNull(map)
|
isNull(map)
|
||||||
? procFace({Pstream::myProcNo(), localFaces[thisFacei][i]})
|
? remote({Pstream::myProcNo(), localFaces[thisFacei][i]})
|
||||||
: map[localFaces[thisFacei][i]];
|
: map[localFaces[thisFacei][i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -190,8 +190,8 @@ Foam::patchToPatch::localFacesToProcFaces
|
|||||||
Foam::List<Foam::DynamicList<Foam::label>>
|
Foam::List<Foam::DynamicList<Foam::label>>
|
||||||
Foam::patchToPatch::procFacesToLocalFaces
|
Foam::patchToPatch::procFacesToLocalFaces
|
||||||
(
|
(
|
||||||
const List<List<procFace>>& procFaces,
|
const List<List<remote>>& procFaces,
|
||||||
const HashTable<label, procFace, Hash<procFace>>& map
|
const HashTable<label, remote, Hash<remote>>& map
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
List<DynamicList<label>> result(procFaces.size());
|
List<DynamicList<label>> result(procFaces.size());
|
||||||
@ -204,7 +204,7 @@ Foam::patchToPatch::procFacesToLocalFaces
|
|||||||
{
|
{
|
||||||
result[tgtFacei][i] =
|
result[tgtFacei][i] =
|
||||||
isNull(map)
|
isNull(map)
|
||||||
? procFaces[tgtFacei][i].facei
|
? procFaces[tgtFacei][i].elementi
|
||||||
: map[procFaces[tgtFacei][i]];
|
: map[procFaces[tgtFacei][i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -816,7 +816,7 @@ Foam::labelList Foam::patchToPatch::subsetLocalTgt
|
|||||||
tgtLocalSrcFaces_ =
|
tgtLocalSrcFaces_ =
|
||||||
List<DynamicList<label>>(tgtLocalSrcFaces_, newToOldLocalTgtFace);
|
List<DynamicList<label>>(tgtLocalSrcFaces_, newToOldLocalTgtFace);
|
||||||
localTgtProcFacesPtr_() =
|
localTgtProcFacesPtr_() =
|
||||||
List<procFace>(localTgtProcFacesPtr_(), newToOldLocalTgtFace);
|
List<remote>(localTgtProcFacesPtr_(), newToOldLocalTgtFace);
|
||||||
|
|
||||||
return newToOldLocalTgtFace;
|
return newToOldLocalTgtFace;
|
||||||
}
|
}
|
||||||
@ -834,7 +834,7 @@ void Foam::patchToPatch::distributeSrc
|
|||||||
void Foam::patchToPatch::rDistributeTgt(const primitiveOldTimePatch& tgtPatch)
|
void Foam::patchToPatch::rDistributeTgt(const primitiveOldTimePatch& tgtPatch)
|
||||||
{
|
{
|
||||||
// Create a map from source procFace to local source face
|
// Create a map from source procFace to local source face
|
||||||
HashTable<label, procFace, Hash<procFace>> srcProcFaceToLocal;
|
HashTable<label, remote, Hash<remote>> srcProcFaceToLocal;
|
||||||
forAll(localSrcProcFacesPtr_(), localSrcFacei)
|
forAll(localSrcProcFacesPtr_(), localSrcFacei)
|
||||||
{
|
{
|
||||||
srcProcFaceToLocal.insert
|
srcProcFaceToLocal.insert
|
||||||
@ -846,7 +846,7 @@ void Foam::patchToPatch::rDistributeTgt(const primitiveOldTimePatch& tgtPatch)
|
|||||||
|
|
||||||
// Collect the source procFaces on the target and convert to local
|
// Collect the source procFaces on the target and convert to local
|
||||||
// source face addressing
|
// source face addressing
|
||||||
List<List<procFace>> tgtSrcProcFaces =
|
List<List<remote>> tgtSrcProcFaces =
|
||||||
localFacesToProcFaces(tgtLocalSrcFaces_);
|
localFacesToProcFaces(tgtLocalSrcFaces_);
|
||||||
|
|
||||||
rDistributeListList(tgtPatch.size(), tgtMapPtr_(), tgtSrcProcFaces);
|
rDistributeListList(tgtPatch.size(), tgtMapPtr_(), tgtSrcProcFaces);
|
||||||
@ -892,8 +892,8 @@ Foam::patchToPatch::patchToPatch(const bool reverse)
|
|||||||
tgtLocalSrcFaces_(),
|
tgtLocalSrcFaces_(),
|
||||||
srcMapPtr_(nullptr),
|
srcMapPtr_(nullptr),
|
||||||
tgtMapPtr_(nullptr),
|
tgtMapPtr_(nullptr),
|
||||||
localSrcProcFacesPtr_(new List<procFace>()),
|
localSrcProcFacesPtr_(new List<remote>()),
|
||||||
localTgtProcFacesPtr_(new List<procFace>())
|
localTgtProcFacesPtr_(new List<remote>())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -39,6 +39,7 @@ SourceFiles
|
|||||||
#include "distributionMap.H"
|
#include "distributionMap.H"
|
||||||
#include "primitivePatch.H"
|
#include "primitivePatch.H"
|
||||||
#include "primitiveOldTimePatch.H"
|
#include "primitiveOldTimePatch.H"
|
||||||
|
#include "remote.H"
|
||||||
#include "runTimeSelectionTables.H"
|
#include "runTimeSelectionTables.H"
|
||||||
#include "treeBoundBox.H"
|
#include "treeBoundBox.H"
|
||||||
|
|
||||||
@ -53,45 +54,6 @@ namespace Foam
|
|||||||
|
|
||||||
class patchToPatch
|
class patchToPatch
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
|
|
||||||
// Public Structures
|
|
||||||
|
|
||||||
//- Structure to conveniently store processor and face indices
|
|
||||||
struct procFace
|
|
||||||
{
|
|
||||||
//- The processor index
|
|
||||||
label proci;
|
|
||||||
|
|
||||||
//- The face index
|
|
||||||
label facei;
|
|
||||||
|
|
||||||
//- Equality comparison
|
|
||||||
friend bool operator==(const procFace& a, const procFace& b)
|
|
||||||
{
|
|
||||||
return a.proci == b.proci && a.facei == b.facei;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Inequality comparison
|
|
||||||
friend bool operator!=(const procFace& a, const procFace& b)
|
|
||||||
{
|
|
||||||
return !(a == b);
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Output stream operator
|
|
||||||
friend Ostream& operator<<(Ostream& os, const procFace& p)
|
|
||||||
{
|
|
||||||
return os << p.proci << token::SPACE << p.facei;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Input stream operator
|
|
||||||
friend Istream& operator>>(Istream& is, procFace& p)
|
|
||||||
{
|
|
||||||
return is >> p.proci >> p.facei;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Private Data
|
// Private Data
|
||||||
@ -118,11 +80,11 @@ protected:
|
|||||||
|
|
||||||
//- When running in parallel, a map from local source face index to
|
//- When running in parallel, a map from local source face index to
|
||||||
// source processor and face index
|
// source processor and face index
|
||||||
autoPtr<List<procFace>> localSrcProcFacesPtr_;
|
autoPtr<List<remote>> localSrcProcFacesPtr_;
|
||||||
|
|
||||||
//- When running in parallel, a map from local target face index to
|
//- When running in parallel, a map from local target face index to
|
||||||
// target processor and face index
|
// target processor and face index
|
||||||
autoPtr<List<procFace>> localTgtProcFacesPtr_;
|
autoPtr<List<remote>> localTgtProcFacesPtr_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
@ -156,17 +118,17 @@ protected:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Map local faces to proc faces
|
//- Map local faces to proc faces
|
||||||
static List<List<procFace>> localFacesToProcFaces
|
static List<List<remote>> localFacesToProcFaces
|
||||||
(
|
(
|
||||||
const List<DynamicList<label>>& localFaces,
|
const List<DynamicList<label>>& localFaces,
|
||||||
const List<procFace>& map = NullObjectRef<List<procFace>>()
|
const List<remote>& map = NullObjectRef<List<remote>>()
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Map proc faces to local faces
|
//- Map proc faces to local faces
|
||||||
static List<DynamicList<label>> procFacesToLocalFaces
|
static List<DynamicList<label>> procFacesToLocalFaces
|
||||||
(
|
(
|
||||||
const List<List<procFace>>& procFaces,
|
const List<List<remote>>& procFaces,
|
||||||
const HashTable<label, procFace, Hash<procFace>>& map
|
const HashTable<label, remote, Hash<remote>>& map
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -301,7 +263,7 @@ protected:
|
|||||||
(
|
(
|
||||||
const distributionMap& map,
|
const distributionMap& map,
|
||||||
const primitiveOldTimePatch& patch,
|
const primitiveOldTimePatch& patch,
|
||||||
List<procFace>& localProcFaces
|
List<remote>& localProcFaces
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- As above, but when you want the proc-faces without the
|
//- As above, but when you want the proc-faces without the
|
||||||
@ -309,7 +271,7 @@ protected:
|
|||||||
void distributePatch
|
void distributePatch
|
||||||
(
|
(
|
||||||
const distributionMap& map,
|
const distributionMap& map,
|
||||||
List<procFace>& localProcFaces
|
List<remote>& localProcFaces
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
@ -441,10 +403,10 @@ public:
|
|||||||
inline bool isSingleProcess() const;
|
inline bool isSingleProcess() const;
|
||||||
|
|
||||||
//- For each source face, the coupled target procs and faces
|
//- For each source face, the coupled target procs and faces
|
||||||
inline List<List<procFace>> srcTgtProcFaces() const;
|
inline List<List<remote>> srcTgtProcFaces() const;
|
||||||
|
|
||||||
//- For each target face, the coupled source procs and faces
|
//- For each target face, the coupled source procs and faces
|
||||||
inline List<List<procFace>> tgtSrcProcFaces() const;
|
inline List<List<remote>> tgtSrcProcFaces() const;
|
||||||
|
|
||||||
|
|
||||||
// Interpolation
|
// Interpolation
|
||||||
|
|||||||
@ -102,7 +102,7 @@ inline bool Foam::patchToPatch::isSingleProcess() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::List<Foam::List<Foam::patchToPatch::procFace>>
|
inline Foam::List<Foam::List<Foam::remote>>
|
||||||
Foam::patchToPatch::srcTgtProcFaces() const
|
Foam::patchToPatch::srcTgtProcFaces() const
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
@ -112,7 +112,7 @@ Foam::patchToPatch::srcTgtProcFaces() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::List<Foam::List<Foam::patchToPatch::procFace>>
|
inline Foam::List<Foam::List<Foam::remote>>
|
||||||
Foam::patchToPatch::tgtSrcProcFaces() const
|
Foam::patchToPatch::tgtSrcProcFaces() const
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
|
|||||||
@ -222,7 +222,7 @@ Foam::patchToPatch::distributePatch
|
|||||||
(
|
(
|
||||||
const distributionMap& map,
|
const distributionMap& map,
|
||||||
const primitiveOldTimePatch& patch,
|
const primitiveOldTimePatch& patch,
|
||||||
List<procFace>& localProcFaces
|
List<remote>& localProcFaces
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
static const label thisProci = Pstream::myProcNo();
|
static const label thisProci = Pstream::myProcNo();
|
||||||
@ -387,7 +387,7 @@ Foam::patchToPatch::distributePatch
|
|||||||
void Foam::patchToPatch::distributePatch
|
void Foam::patchToPatch::distributePatch
|
||||||
(
|
(
|
||||||
const distributionMap& map,
|
const distributionMap& map,
|
||||||
List<procFace>& localProcFaces
|
List<remote>& localProcFaces
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
static const label thisProci = Pstream::myProcNo();
|
static const label thisProci = Pstream::myProcNo();
|
||||||
|
|||||||
@ -165,12 +165,12 @@ Foam::label Foam::patchToPatches::rays::finalise
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::patchToPatch::procFace Foam::patchToPatches::rays::ray
|
Foam::remote Foam::patchToPatches::rays::ray
|
||||||
(
|
(
|
||||||
const primitiveOldTimePatch& outPatch,
|
const primitiveOldTimePatch& outPatch,
|
||||||
const autoPtr<PrimitiveOldTimePatch<faceList, pointField>>&
|
const autoPtr<PrimitiveOldTimePatch<faceList, pointField>>&
|
||||||
localOutPatchPtr,
|
localOutPatchPtr,
|
||||||
const autoPtr<List<procFace>>& localOutProcFacesPtr,
|
const autoPtr<List<remote>>& localOutProcFacesPtr,
|
||||||
const List<DynamicList<label>>& inLocalOutFaces,
|
const List<DynamicList<label>>& inLocalOutFaces,
|
||||||
const scalar fraction,
|
const scalar fraction,
|
||||||
const label inFacei,
|
const label inFacei,
|
||||||
@ -213,12 +213,12 @@ Foam::patchToPatch::procFace Foam::patchToPatches::rays::ray
|
|||||||
|
|
||||||
return
|
return
|
||||||
isSingleProcess()
|
isSingleProcess()
|
||||||
? procFace({Pstream::myProcNo(), localOutFacei})
|
? remote({Pstream::myProcNo(), localOutFacei})
|
||||||
: localOutProcFacesPtr()[localOutFacei];
|
: localOutProcFacesPtr()[localOutFacei];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return procFace({-1, -1});
|
return remote({-1, -1});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ Foam::patchToPatches::rays::~rays()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::patchToPatch::procFace Foam::patchToPatches::rays::srcToTgtRay
|
Foam::remote Foam::patchToPatches::rays::srcToTgtRay
|
||||||
(
|
(
|
||||||
const primitiveOldTimePatch& tgtPatch,
|
const primitiveOldTimePatch& tgtPatch,
|
||||||
const scalar fraction,
|
const scalar fraction,
|
||||||
@ -283,7 +283,7 @@ Foam::patchToPatch::procFace Foam::patchToPatches::rays::srcToTgtRay
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::patchToPatch::procFace Foam::patchToPatches::rays::tgtToSrcRay
|
Foam::remote Foam::patchToPatches::rays::tgtToSrcRay
|
||||||
(
|
(
|
||||||
const primitiveOldTimePatch& srcPatch,
|
const primitiveOldTimePatch& srcPatch,
|
||||||
const scalar fraction,
|
const scalar fraction,
|
||||||
|
|||||||
@ -114,12 +114,12 @@ class rays
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Compute a ray intersection
|
//- Compute a ray intersection
|
||||||
procFace ray
|
remote ray
|
||||||
(
|
(
|
||||||
const primitiveOldTimePatch& outPatch,
|
const primitiveOldTimePatch& outPatch,
|
||||||
const autoPtr<PrimitiveOldTimePatch<faceList, pointField>>&
|
const autoPtr<PrimitiveOldTimePatch<faceList, pointField>>&
|
||||||
localOutPatchPtr,
|
localOutPatchPtr,
|
||||||
const autoPtr<List<procFace>>& localOutProcFacesPtr,
|
const autoPtr<List<remote>>& localOutProcFacesPtr,
|
||||||
const List<DynamicList<label>>& inLocalOutFacesPtr,
|
const List<DynamicList<label>>& inLocalOutFacesPtr,
|
||||||
const scalar fraction,
|
const scalar fraction,
|
||||||
const label inFacei,
|
const label inFacei,
|
||||||
@ -154,7 +154,7 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Compute a ray intersection from the source side to the target
|
//- Compute a ray intersection from the source side to the target
|
||||||
procFace srcToTgtRay
|
remote srcToTgtRay
|
||||||
(
|
(
|
||||||
const primitiveOldTimePatch& tgtPatch,
|
const primitiveOldTimePatch& tgtPatch,
|
||||||
const scalar fraction,
|
const scalar fraction,
|
||||||
@ -165,7 +165,7 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Compute a ray intersection from the target side to the source
|
//- Compute a ray intersection from the target side to the source
|
||||||
procFace tgtToSrcRay
|
remote tgtToSrcRay
|
||||||
(
|
(
|
||||||
const primitiveOldTimePatch& srcPatch,
|
const primitiveOldTimePatch& srcPatch,
|
||||||
const scalar fraction,
|
const scalar fraction,
|
||||||
|
|||||||
@ -93,7 +93,7 @@ public:
|
|||||||
size_(-1),
|
size_(-1),
|
||||||
hasUnmapped_(false)
|
hasUnmapped_(false)
|
||||||
{
|
{
|
||||||
const List<List<patchToPatch::procFace>> procFaces =
|
const List<List<remote>> procFaces =
|
||||||
forward_ ? pToP_.tgtSrcProcFaces() : pToP_.srcTgtProcFaces();
|
forward_ ? pToP_.tgtSrcProcFaces() : pToP_.srcTgtProcFaces();
|
||||||
|
|
||||||
size_ = procFaces.size();
|
size_ = procFaces.size();
|
||||||
|
|||||||
Reference in New Issue
Block a user