ENH: provide referPatchID() at the coupled patch level (simplifies code)
- the default returns -1 (ie, not found/available). This is overridden by processorCyclicPolyPatch to actually perform a search COMP: explicitly define polyMesh::writeObject in the header - currently no special treatment, but allows future adjustments without affecting the header.
This commit is contained in:
parent
6adac8e0ab
commit
85243dc89d
@ -1578,4 +1578,18 @@ Foam::label Foam::polyMesh::findCell
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::polyMesh::writeObject
|
||||
(
|
||||
IOstreamOption streamOpt,
|
||||
const bool writeOnProc
|
||||
) const
|
||||
{
|
||||
// Currently no special treatment. Just write the objects
|
||||
|
||||
return objectRegistry::writeObject(streamOpt, writeOnProc);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -792,6 +792,17 @@ public:
|
||||
const point& p,
|
||||
const cellDecomposition = CELL_TETS
|
||||
) const;
|
||||
|
||||
|
||||
// Write
|
||||
|
||||
//- Write items held in the objectRegistry. Normally includes mesh
|
||||
//- components (points, faces, etc) and any registered fields.
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstreamOption streamOpt,
|
||||
const bool writeOnProc = true
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -37,8 +37,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef coupledPolyPatch_H
|
||||
#define coupledPolyPatch_H
|
||||
#ifndef Foam_coupledPolyPatch_H
|
||||
#define Foam_coupledPolyPatch_H
|
||||
|
||||
#include "polyPatch.H"
|
||||
#include "diagTensorField.H"
|
||||
@ -242,7 +242,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
//- Return true because this patch is coupled
|
||||
@ -260,6 +259,12 @@ public:
|
||||
return !owner();
|
||||
}
|
||||
|
||||
//- The referring patchID (eg, for cyclics).
|
||||
virtual label referPatchID() const
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
//- Type of transform
|
||||
virtual transformType transform() const
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ License
|
||||
#include "PstreamBuffers.H"
|
||||
#include "Circulator.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
@ -47,7 +47,24 @@ namespace Foam
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
Foam::word Foam::processorPolyPatch::newName
|
||||
(
|
||||
const label myProcNo,
|
||||
const label neighbProcNo
|
||||
)
|
||||
{
|
||||
return word
|
||||
(
|
||||
"procBoundary"
|
||||
+ std::to_string(myProcNo) + "to" + std::to_string(neighbProcNo),
|
||||
false // No stripping needed
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::processorPolyPatch::processorPolyPatch
|
||||
(
|
||||
@ -181,20 +198,6 @@ Foam::processorPolyPatch::~processorPolyPatch()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::word Foam::processorPolyPatch::newName
|
||||
(
|
||||
const label myProcNo,
|
||||
const label neighbProcNo
|
||||
)
|
||||
{
|
||||
return
|
||||
"procBoundary"
|
||||
+ Foam::name(myProcNo)
|
||||
+ "to"
|
||||
+ Foam::name(neighbProcNo);
|
||||
}
|
||||
|
||||
|
||||
void Foam::processorPolyPatch::initGeometry(PstreamBuffers& pBufs)
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
|
@ -250,7 +250,18 @@ public:
|
||||
virtual ~processorPolyPatch();
|
||||
|
||||
|
||||
// Member functions
|
||||
// Static Functions
|
||||
|
||||
//- Return the name of a processorPolyPatch ("procBoundary..")
|
||||
//- constructed from the pair of processor IDs.
|
||||
static word newName
|
||||
(
|
||||
const label myProcNo,
|
||||
const label neighbProcNo
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return true only if this is a parallel run
|
||||
virtual bool coupled() const
|
||||
@ -282,14 +293,6 @@ public:
|
||||
return !owner();
|
||||
}
|
||||
|
||||
//- Return the name of a processorPolyPatch
|
||||
// constructed from the processor IDs
|
||||
static word newName
|
||||
(
|
||||
const label myProcNo,
|
||||
const label neighbProcNo
|
||||
);
|
||||
|
||||
//- Return processor-neighbour patch face centres
|
||||
const vectorField& neighbFaceCentres() const noexcept
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,7 +31,7 @@ License
|
||||
#include "SubField.H"
|
||||
#include "cyclicPolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
@ -40,6 +40,41 @@ namespace Foam
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
Foam::word Foam::processorCyclicPolyPatch::newName
|
||||
(
|
||||
const word& cyclicPolyPatchName,
|
||||
const label myProcNo,
|
||||
const label neighbProcNo
|
||||
)
|
||||
{
|
||||
return word
|
||||
(
|
||||
processorPolyPatch::newName(myProcNo, neighbProcNo)
|
||||
+ "through"
|
||||
+ cyclicPolyPatchName
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::labelList Foam::processorCyclicPolyPatch::patchIDs
|
||||
(
|
||||
const word& cyclicPolyPatchName,
|
||||
const polyBoundaryMesh& bm
|
||||
)
|
||||
{
|
||||
return bm.indices
|
||||
(
|
||||
wordRe
|
||||
(
|
||||
"procBoundary.*to.*through" + cyclicPolyPatchName,
|
||||
wordRe::REGEX
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
|
||||
@ -151,42 +186,28 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::processorCyclicPolyPatch::~processorCyclicPolyPatch()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::word Foam::processorCyclicPolyPatch::newName
|
||||
(
|
||||
const word& cyclicPolyPatchName,
|
||||
const label myProcNo,
|
||||
const label neighbProcNo
|
||||
)
|
||||
Foam::label Foam::processorCyclicPolyPatch::referPatchID() const
|
||||
{
|
||||
return
|
||||
processorPolyPatch::newName(myProcNo, neighbProcNo)
|
||||
+ "through"
|
||||
+ cyclicPolyPatchName;
|
||||
}
|
||||
|
||||
|
||||
Foam::labelList Foam::processorCyclicPolyPatch::patchIDs
|
||||
(
|
||||
const word& cyclicPolyPatchName,
|
||||
const polyBoundaryMesh& bm
|
||||
)
|
||||
{
|
||||
return bm.indices
|
||||
(
|
||||
wordRe
|
||||
if (referPatchID_ == -1)
|
||||
{
|
||||
referPatchID_ = this->boundaryMesh().findPatchID
|
||||
(
|
||||
"procBoundary.*to.*through" + cyclicPolyPatchName,
|
||||
wordRe::REGEX
|
||||
)
|
||||
);
|
||||
referPatchName_
|
||||
);
|
||||
|
||||
if (referPatchID_ == -1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Illegal referPatch name " << referPatchName_ << nl
|
||||
<< "Valid patch names: "
|
||||
<< this->boundaryMesh().names() << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
return referPatchID_;
|
||||
}
|
||||
|
||||
|
||||
@ -242,9 +263,8 @@ void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
|
||||
// Receive and initialise processorPolyPatch data
|
||||
processorPolyPatch::calcGeometry(pBufs);
|
||||
|
||||
if (Pstream::parRun())
|
||||
if (UPstream::parRun())
|
||||
{
|
||||
|
||||
// Where do we store the calculated transformation?
|
||||
// - on the processor patch?
|
||||
// - on the underlying cyclic patch?
|
||||
|
@ -36,8 +36,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef processorCyclicPolyPatch_H
|
||||
#define processorCyclicPolyPatch_H
|
||||
#ifndef Foam_processorCyclicPolyPatch_H
|
||||
#define Foam_processorCyclicPolyPatch_H
|
||||
|
||||
#include "processorPolyPatch.H"
|
||||
|
||||
@ -54,7 +54,7 @@ class processorCyclicPolyPatch
|
||||
:
|
||||
public processorPolyPatch
|
||||
{
|
||||
// Private data
|
||||
// Private Data
|
||||
|
||||
//- Name of originating patch
|
||||
const word referPatchName_;
|
||||
@ -257,19 +257,13 @@ public:
|
||||
|
||||
|
||||
// Destructor
|
||||
virtual ~processorCyclicPolyPatch();
|
||||
virtual ~processorCyclicPolyPatch() = default;
|
||||
|
||||
|
||||
// Member functions
|
||||
// Static Functions
|
||||
|
||||
//- Return name of originating cyclicPolyPatch patch
|
||||
const word& referPatchName() const
|
||||
{
|
||||
return referPatchName_;
|
||||
}
|
||||
|
||||
//- Return the name of a processorCyclicPolyPatch
|
||||
// constructed from cyclicPolyPatch name and the processor IDs
|
||||
//- Return the name of a processorCyclicPolyPatch constructed from
|
||||
//- the cyclicPolyPatch name and the pair of processor IDs.
|
||||
static word newName
|
||||
(
|
||||
const word& cyclicPolyPatchName,
|
||||
@ -285,27 +279,20 @@ public:
|
||||
const polyBoundaryMesh& bm
|
||||
);
|
||||
|
||||
//- Referring patchID.
|
||||
label referPatchID() const
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of originating cyclicPolyPatch patch
|
||||
const word& referPatchName() const
|
||||
{
|
||||
if (referPatchID_ == -1)
|
||||
{
|
||||
referPatchID_ = this->boundaryMesh().findPatchID
|
||||
(
|
||||
referPatchName_
|
||||
);
|
||||
if (referPatchID_ == -1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Illegal referPatch name " << referPatchName_
|
||||
<< endl << "Valid patch names are "
|
||||
<< this->boundaryMesh().names()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
return referPatchID_;
|
||||
return referPatchName_;
|
||||
}
|
||||
|
||||
//- The referring patchID.
|
||||
//- Searches for referPatchName() on the first call.
|
||||
virtual label referPatchID() const;
|
||||
|
||||
//- The referred coupled patch
|
||||
const coupledPolyPatch& referPatch() const
|
||||
{
|
||||
const polyPatch& pp = this->boundaryMesh()[referPatchID()];
|
||||
|
@ -160,6 +160,13 @@ public:
|
||||
return !owner();
|
||||
}
|
||||
|
||||
//- The referring patchID (eg, for cyclics).
|
||||
// Here for consistency with coupledPolyPatch
|
||||
virtual label referPatchID() const
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
//- Are the coupled planes separated?
|
||||
bool separated() const
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user