mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: support finiteArea patch groups and constraint types (#2397)
- allows simpler handling of processor conditions etc. ENH: modernize constructor for better alignment with polyPatch
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -41,26 +41,63 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// bool Foam::faBoundaryMesh::hasGroupIDs() const
|
||||
// {
|
||||
// /// if (groupIDsPtr_)
|
||||
// /// {
|
||||
// /// // Use existing cache
|
||||
// /// return !groupIDsPtr_->empty();
|
||||
// /// }
|
||||
//
|
||||
// const faPatchList& patches = *this;
|
||||
//
|
||||
// for (const faPatch& p : patches)
|
||||
// {
|
||||
// if (!p.inGroups().empty())
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return false;
|
||||
// }
|
||||
bool Foam::faBoundaryMesh::hasGroupIDs() const
|
||||
{
|
||||
if (groupIDsPtr_)
|
||||
{
|
||||
// Use existing cache
|
||||
return !groupIDsPtr_->empty();
|
||||
}
|
||||
|
||||
const faPatchList& patches = *this;
|
||||
|
||||
for (const faPatch& p : patches)
|
||||
{
|
||||
if (!p.inGroups().empty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void Foam::faBoundaryMesh::calcGroupIDs() const
|
||||
{
|
||||
if (groupIDsPtr_)
|
||||
{
|
||||
return; // Or FatalError
|
||||
}
|
||||
|
||||
groupIDsPtr_.reset(new HashTable<labelList>(16));
|
||||
auto& groupLookup = *groupIDsPtr_;
|
||||
|
||||
const faPatchList& patches = *this;
|
||||
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
const wordList& groups = patches[patchi].inGroups();
|
||||
|
||||
for (const word& groupName : groups)
|
||||
{
|
||||
groupLookup(groupName).append(patchi);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove groups that clash with patch names
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
if (groupLookup.erase(patches[patchi].name()))
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Removed group '" << patches[patchi].name()
|
||||
<< "' which clashes with patch " << patchi
|
||||
<< " of the same name."
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
@ -205,6 +242,61 @@ Foam::label Foam::faBoundaryMesh::nNonProcessor() const
|
||||
}
|
||||
|
||||
|
||||
const Foam::HashTable<Foam::labelList>&
|
||||
Foam::faBoundaryMesh::groupPatchIDs() const
|
||||
{
|
||||
if (!groupIDsPtr_)
|
||||
{
|
||||
calcGroupIDs();
|
||||
}
|
||||
|
||||
return *groupIDsPtr_;
|
||||
}
|
||||
|
||||
|
||||
void Foam::faBoundaryMesh::setGroup
|
||||
(
|
||||
const word& groupName,
|
||||
const labelUList& patchIDs
|
||||
)
|
||||
{
|
||||
groupIDsPtr_.clear();
|
||||
|
||||
faPatchList& patches = *this;
|
||||
|
||||
boolList donePatch(patches.size(), false);
|
||||
|
||||
// Add to specified patches
|
||||
for (const label patchi : patchIDs)
|
||||
{
|
||||
patches[patchi].inGroups().appendUniq(groupName);
|
||||
donePatch[patchi] = true;
|
||||
}
|
||||
|
||||
// Remove from other patches
|
||||
forAll(patches, patchi)
|
||||
{
|
||||
if (!donePatch[patchi])
|
||||
{
|
||||
wordList& groups = patches[patchi].inGroups();
|
||||
|
||||
if (groups.found(groupName))
|
||||
{
|
||||
label newi = 0;
|
||||
forAll(groups, i)
|
||||
{
|
||||
if (groups[i] != groupName)
|
||||
{
|
||||
groups[newi++] = groups[i];
|
||||
}
|
||||
}
|
||||
groups.resize(newi);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::wordList Foam::faBoundaryMesh::names() const
|
||||
{
|
||||
return PtrListOps::get<word>(*this, nameOp<faPatch>());
|
||||
@ -285,7 +377,7 @@ Foam::labelRange Foam::faBoundaryMesh::range() const
|
||||
Foam::labelList Foam::faBoundaryMesh::indices
|
||||
(
|
||||
const wordRe& matcher,
|
||||
const bool useGroups /* ignored */
|
||||
const bool useGroups
|
||||
) const
|
||||
{
|
||||
if (matcher.empty())
|
||||
@ -293,9 +385,34 @@ Foam::labelList Foam::faBoundaryMesh::indices
|
||||
return labelList();
|
||||
}
|
||||
|
||||
// Only check groups if requested and they exist
|
||||
const bool checkGroups = (useGroups && this->hasGroupIDs());
|
||||
|
||||
labelHashSet ids;
|
||||
|
||||
if (matcher.isPattern())
|
||||
{
|
||||
return PtrListOps::findMatching(*this, matcher);
|
||||
if (checkGroups)
|
||||
{
|
||||
const auto& groupLookup = groupPatchIDs();
|
||||
forAllConstIters(groupLookup, iter)
|
||||
{
|
||||
if (matcher.match(iter.key()))
|
||||
{
|
||||
// Hash ids associated with the group
|
||||
ids.insert(iter.val());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ids.empty())
|
||||
{
|
||||
return PtrListOps::findMatching(*this, matcher);
|
||||
}
|
||||
else
|
||||
{
|
||||
ids.insert(PtrListOps::findMatching(*this, matcher));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -308,16 +425,26 @@ Foam::labelList Foam::faBoundaryMesh::indices
|
||||
{
|
||||
return labelList(one{}, patchId);
|
||||
}
|
||||
else if (checkGroups)
|
||||
{
|
||||
const auto iter = groupPatchIDs().cfind(matcher);
|
||||
|
||||
if (iter.found())
|
||||
{
|
||||
// Hash ids associated with the group
|
||||
ids.insert(iter.val());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return labelList();
|
||||
return ids.sortedToc();
|
||||
}
|
||||
|
||||
|
||||
Foam::labelList Foam::faBoundaryMesh::indices
|
||||
(
|
||||
const wordRes& matcher,
|
||||
const bool useGroups /* ignored */
|
||||
const bool useGroups
|
||||
) const
|
||||
{
|
||||
if (matcher.empty())
|
||||
@ -329,7 +456,34 @@ Foam::labelList Foam::faBoundaryMesh::indices
|
||||
return this->indices(matcher.first(), useGroups);
|
||||
}
|
||||
|
||||
return PtrListOps::findMatching(*this, matcher);
|
||||
labelHashSet ids;
|
||||
|
||||
// Only check groups if requested and they exist
|
||||
if (useGroups && this->hasGroupIDs())
|
||||
{
|
||||
ids.resize(2*this->size());
|
||||
|
||||
const auto& groupLookup = groupPatchIDs();
|
||||
forAllConstIters(groupLookup, iter)
|
||||
{
|
||||
if (matcher.match(iter.key()))
|
||||
{
|
||||
// Hash ids associated with the group
|
||||
ids.insert(iter.val());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ids.empty())
|
||||
{
|
||||
return PtrListOps::findMatching(*this, matcher);
|
||||
}
|
||||
else
|
||||
{
|
||||
ids.insert(PtrListOps::findMatching(*this, matcher));
|
||||
}
|
||||
|
||||
return ids.sortedToc();
|
||||
}
|
||||
|
||||
|
||||
@ -343,14 +497,42 @@ Foam::label Foam::faBoundaryMesh::findIndex(const wordRe& key) const
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::faBoundaryMesh::findPatchID(const word& patchName) const
|
||||
Foam::label Foam::faBoundaryMesh::findPatchID
|
||||
(
|
||||
const word& patchName,
|
||||
bool allowNotFound
|
||||
) const
|
||||
{
|
||||
if (patchName.empty())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return PtrListOps::firstMatching(*this, patchName);
|
||||
const label patchId = PtrListOps::firstMatching(*this, patchName);
|
||||
|
||||
if (patchId >= 0)
|
||||
{
|
||||
return patchId;
|
||||
}
|
||||
|
||||
if (!allowNotFound)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Patch '" << patchName << "' not found. "
|
||||
<< "Available patch names: " << names() << endl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// Patch not found
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "label faBoundaryMesh::findPatchID(const word&) const"
|
||||
<< "Patch named " << patchName << " not found. "
|
||||
<< "Available patch names: " << names() << endl;
|
||||
}
|
||||
|
||||
// Not found, return -1
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -39,8 +39,8 @@ Author
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faBoundaryMesh_H
|
||||
#define faBoundaryMesh_H
|
||||
#ifndef Foam_faBoundaryMesh_H
|
||||
#define Foam_faBoundaryMesh_H
|
||||
|
||||
#include "faPatchList.H"
|
||||
#include "lduInterfacePtrsList.H"
|
||||
@ -57,6 +57,7 @@ namespace Foam
|
||||
class faMesh;
|
||||
class faBoundaryMesh;
|
||||
class wordRes;
|
||||
|
||||
Ostream& operator<<(Ostream&, const faBoundaryMesh&);
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
@ -74,16 +75,16 @@ class faBoundaryMesh
|
||||
const faMesh& mesh_;
|
||||
|
||||
//- Demand-driven: list of patch ids per group
|
||||
/// mutable autoPtr<HashTable<labelList>> groupIDsPtr_;
|
||||
mutable autoPtr<HashTable<labelList>> groupIDsPtr_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Some patches have inGroup entries
|
||||
/// bool hasGroupIDs() const;
|
||||
bool hasGroupIDs() const;
|
||||
|
||||
//- Calculate group name to patch ids lookup
|
||||
/// void calcGroupIDs() const;
|
||||
void calcGroupIDs() const;
|
||||
|
||||
//- No copy construct
|
||||
faBoundaryMesh(const faBoundaryMesh&) = delete;
|
||||
@ -167,21 +168,21 @@ public:
|
||||
|
||||
|
||||
//- Return (sorted) patch indices for all matches.
|
||||
// [FUTURE] Optionally matches patch groups.
|
||||
// Optionally matches patch groups.
|
||||
// A no-op (returns empty list) for an empty matcher
|
||||
labelList indices
|
||||
(
|
||||
const wordRe& matcher,
|
||||
const bool useGroups = true //!< currently ignored
|
||||
const bool useGroups = true
|
||||
) const;
|
||||
|
||||
//- Return (sorted) patch indices for all matches.
|
||||
// [FUTURE] Optionally matches patch groups.
|
||||
// Optionally matches patch groups.
|
||||
// A no-op (returns empty list) for an empty matcher
|
||||
labelList indices
|
||||
(
|
||||
const wordRes& matcher,
|
||||
const bool useGroups = true //!< currently ignored
|
||||
const bool useGroups = true
|
||||
) const;
|
||||
|
||||
//- Return patch index for the first match, return -1 if not found
|
||||
@ -190,11 +191,21 @@ public:
|
||||
|
||||
//- Find patch index given a name, return -1 if not found
|
||||
// A no-op (returns -1) for an empty name
|
||||
label findPatchID(const word& patchName) const;
|
||||
label findPatchID
|
||||
(
|
||||
const word& patchName,
|
||||
const bool allowNotFound = true
|
||||
) const;
|
||||
|
||||
//- Return patch index for a given edge label
|
||||
label whichPatch(const label edgeIndex) const;
|
||||
|
||||
//- The patch indices per patch group
|
||||
const HashTable<labelList>& groupPatchIDs() const;
|
||||
|
||||
//- Set/add group with patches
|
||||
void setGroup(const word& groupName, const labelUList& patchIDs);
|
||||
|
||||
//- Check boundary definition
|
||||
bool checkDefinition(const bool report = false) const;
|
||||
|
||||
|
||||
@ -39,8 +39,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef coupledFaPatch_H
|
||||
#define coupledFaPatch_H
|
||||
#ifndef Foam_coupledFaPatch_H
|
||||
#define Foam_coupledFaPatch_H
|
||||
|
||||
#include "lduInterface.H"
|
||||
#include "faPatch.H"
|
||||
@ -59,7 +59,7 @@ class coupledFaPatch
|
||||
public lduInterface,
|
||||
public faPatch
|
||||
{
|
||||
// Private data
|
||||
// Private Data
|
||||
|
||||
//- offset (distance) vector from one side of the couple to the other
|
||||
mutable vectorField separation_;
|
||||
@ -115,10 +115,11 @@ public:
|
||||
const labelList& edgeLabels,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm,
|
||||
const label ngbPolyPatchIndex
|
||||
const label nbrPolyPatchIndex,
|
||||
const word& patchType
|
||||
)
|
||||
:
|
||||
faPatch(name, edgeLabels, index, bm, ngbPolyPatchIndex)
|
||||
faPatch(name, edgeLabels, index, bm, nbrPolyPatchIndex, patchType)
|
||||
{}
|
||||
|
||||
//- Construct from dictionary
|
||||
@ -127,10 +128,11 @@ public:
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
const faBoundaryMesh& bm,
|
||||
const word& patchType
|
||||
)
|
||||
:
|
||||
faPatch(name, dict, index, bm)
|
||||
faPatch(name, dict, index, bm, patchType)
|
||||
{}
|
||||
|
||||
|
||||
@ -148,7 +150,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//- Are the coupled planes separated
|
||||
bool separated() const
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -43,6 +43,22 @@ namespace Foam
|
||||
const Foam::scalar Foam::cyclicFaPatch::matchTol_ = 1e-3;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cyclicFaPatch::cyclicFaPatch
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm,
|
||||
const word& patchType
|
||||
)
|
||||
:
|
||||
coupledFaPatch(name, dict, index, bm, patchType)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::cyclicFaPatch::calcTransforms()
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -39,8 +39,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef cyclicFaPatch_H
|
||||
#define cyclicFaPatch_H
|
||||
#ifndef Foam_cyclicFaPatch_H
|
||||
#define Foam_cyclicFaPatch_H
|
||||
|
||||
#include "coupledFaPatch.H"
|
||||
#include "cyclicLduInterface.H"
|
||||
@ -60,13 +60,13 @@ class cyclicFaPatch
|
||||
public coupledFaPatch,
|
||||
public cyclicLduInterface
|
||||
{
|
||||
// Private member functions
|
||||
// Private Member Functions
|
||||
|
||||
void calcTransforms();
|
||||
|
||||
protected:
|
||||
|
||||
// Protected static data
|
||||
// Protected Static Data
|
||||
|
||||
//- Relative tolerance (for geometric matching). Is factor of
|
||||
// maximum edge length per face.
|
||||
@ -96,18 +96,16 @@ public:
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
coupledFaPatch(name, dict, index, bm)
|
||||
{}
|
||||
const faBoundaryMesh& bm,
|
||||
const word& patchType
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~cyclicFaPatch() = default;
|
||||
|
||||
|
||||
// Member functions
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -49,29 +50,66 @@ Foam::emptyFaPatch::emptyFaPatch
|
||||
const word& name,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm,
|
||||
const label ngbPolyPatchIndex
|
||||
const label nbrPolyPatchi,
|
||||
const word& patchType
|
||||
)
|
||||
:
|
||||
emptyFaPatch(name, labelList(), index, bm, ngbPolyPatchIndex)
|
||||
emptyFaPatch(name, labelList(), index, bm, nbrPolyPatchi, patchType)
|
||||
{}
|
||||
|
||||
|
||||
Foam::emptyFaPatch::emptyFaPatch
|
||||
(
|
||||
const word& name,
|
||||
const labelList& edgeLabels,
|
||||
const labelUList& edgeLabels,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm,
|
||||
const label ngbPolyPatchIndex
|
||||
const label nbrPolyPatchi,
|
||||
const word& patchType
|
||||
)
|
||||
:
|
||||
faPatch(name, edgeLabels, index, bm, ngbPolyPatchIndex)
|
||||
faPatch(name, edgeLabels, index, bm, nbrPolyPatchi, patchType)
|
||||
{}
|
||||
|
||||
|
||||
Foam::emptyFaPatch::emptyFaPatch
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm,
|
||||
const word& patchType
|
||||
)
|
||||
:
|
||||
faPatch(name, dict, index, bm, patchType)
|
||||
{}
|
||||
|
||||
|
||||
Foam::emptyFaPatch::emptyFaPatch
|
||||
(
|
||||
const emptyFaPatch& p,
|
||||
const faBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
faPatch(p, bm)
|
||||
{}
|
||||
|
||||
|
||||
Foam::emptyFaPatch::emptyFaPatch
|
||||
(
|
||||
const emptyFaPatch& p,
|
||||
const faBoundaryMesh& bm,
|
||||
const label index,
|
||||
const labelUList& edgeLabels,
|
||||
const label nbrPolyPatchi
|
||||
)
|
||||
:
|
||||
faPatch(p, bm, index, edgeLabels, nbrPolyPatchi)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// Over-riding the face normals return from the underlying patch
|
||||
// This is the only piece of info used out of the underlying primitivePatch
|
||||
// I choose to store it there because it is used in primitive patch operations
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -40,8 +40,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef emptyFaPatch_H
|
||||
#define emptyFaPatch_H
|
||||
#ifndef Foam_emptyFaPatch_H
|
||||
#define Foam_emptyFaPatch_H
|
||||
|
||||
#include "faPatch.H"
|
||||
|
||||
@ -72,17 +72,19 @@ public:
|
||||
const word& name,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm,
|
||||
const label ngbPolyPatchIndex = -1
|
||||
const label nbrPolyPatchi = -1,
|
||||
const word& patchType = typeName
|
||||
);
|
||||
|
||||
//- Construct from components
|
||||
emptyFaPatch
|
||||
(
|
||||
const word& name,
|
||||
const labelList& edgeLabels,
|
||||
const labelUList& edgeLabels,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm,
|
||||
const label ngbPolyPatchIndex
|
||||
const label nbrPolyPatchi = -1,
|
||||
const word& patchType = typeName
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
@ -91,32 +93,43 @@ public:
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
faPatch(name, dict, index, bm)
|
||||
{}
|
||||
const faBoundaryMesh& bm,
|
||||
const word& patchType
|
||||
);
|
||||
|
||||
//- Copy construct, resetting the boundary mesh
|
||||
emptyFaPatch(const emptyFaPatch& p, const faBoundaryMesh& bm);
|
||||
|
||||
//- Copy construct, resetting boundary mesh and addressing
|
||||
emptyFaPatch
|
||||
(
|
||||
const emptyFaPatch& p,
|
||||
const faBoundaryMesh& bm,
|
||||
const label index,
|
||||
const labelUList& edgeLabels,
|
||||
const label nbrPolyPatchi = -1
|
||||
);
|
||||
|
||||
|
||||
//- Construct and return a clone, resetting the boundary mesh
|
||||
virtual autoPtr<faPatch> clone(const faBoundaryMesh& bm) const
|
||||
{
|
||||
return autoPtr<faPatch>(new emptyFaPatch(*this, bm));
|
||||
}
|
||||
|
||||
//- Construct and return a clone, resetting the edge list
|
||||
// and boundary mesh
|
||||
virtual autoPtr<faPatch> clone
|
||||
(
|
||||
const faBoundaryMesh& bm,
|
||||
const labelList& edgeLabels,
|
||||
const labelUList& edgeLabels,
|
||||
const label index,
|
||||
const label ngbPolyPatchIndex
|
||||
const label nbrPolyPatchi = -1
|
||||
) const
|
||||
{
|
||||
return autoPtr<faPatch>
|
||||
(
|
||||
new emptyFaPatch
|
||||
(
|
||||
name(),
|
||||
edgeLabels,
|
||||
index,
|
||||
bm,
|
||||
ngbPolyPatchIndex
|
||||
)
|
||||
new emptyFaPatch(*this, bm, index, edgeLabels, nbrPolyPatchi)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,7 +32,6 @@ License
|
||||
#include "faBoundaryMesh.H"
|
||||
#include "faMesh.H"
|
||||
#include "globalMeshData.H"
|
||||
#include "demandDrivenData.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -46,11 +45,81 @@ namespace Foam
|
||||
|
||||
Foam::processorFaPatch::~processorFaPatch()
|
||||
{
|
||||
deleteDemandDrivenData(neighbPointsPtr_);
|
||||
deleteDemandDrivenData(nonGlobalPatchPointsPtr_);
|
||||
neighbPointsPtr_.clear();
|
||||
nonGlobalPatchPointsPtr_.clear();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::processorFaPatch::processorFaPatch
|
||||
(
|
||||
const word& name,
|
||||
const labelUList& edgeLabels,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm,
|
||||
const label nbrPolyPatchi,
|
||||
const label myProcNo,
|
||||
const label neighbProcNo,
|
||||
const word& patchType
|
||||
)
|
||||
:
|
||||
coupledFaPatch(name, edgeLabels, index, bm, nbrPolyPatchi, patchType),
|
||||
myProcNo_(myProcNo),
|
||||
neighbProcNo_(neighbProcNo),
|
||||
neighbEdgeCentres_(),
|
||||
neighbEdgeLengths_(),
|
||||
neighbEdgeFaceCentres_(),
|
||||
neighbPointsPtr_(nullptr),
|
||||
nonGlobalPatchPointsPtr_(nullptr)
|
||||
{}
|
||||
|
||||
|
||||
Foam::processorFaPatch::processorFaPatch
|
||||
(
|
||||
const labelUList& edgeLabels,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm,
|
||||
const label nbrPolyPatchi,
|
||||
const label myProcNo,
|
||||
const label neighbProcNo,
|
||||
const word& patchType
|
||||
)
|
||||
:
|
||||
processorFaPatch
|
||||
(
|
||||
processorPolyPatch::newName(myProcNo, neighbProcNo),
|
||||
edgeLabels,
|
||||
index,
|
||||
bm,
|
||||
nbrPolyPatchi,
|
||||
myProcNo,
|
||||
neighbProcNo,
|
||||
patchType
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
Foam::processorFaPatch::processorFaPatch
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm,
|
||||
const word& patchType
|
||||
)
|
||||
:
|
||||
coupledFaPatch(name, dict, index, bm, patchType),
|
||||
myProcNo_(dict.get<label>("myProcNo")),
|
||||
neighbProcNo_(dict.get<label>("neighbProcNo")),
|
||||
neighbEdgeCentres_(),
|
||||
neighbEdgeLengths_(),
|
||||
neighbEdgeFaceCentres_(),
|
||||
neighbPointsPtr_(nullptr),
|
||||
nonGlobalPatchPointsPtr_(nullptr)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::label Foam::processorFaPatch::comm() const
|
||||
@ -78,83 +147,36 @@ void Foam::processorFaPatch::makeNonGlobalPatchPoints() const
|
||||
|| !boundaryMesh().mesh()().globalData().nGlobalPoints()
|
||||
)
|
||||
{
|
||||
nonGlobalPatchPointsPtr_ = new labelList(identity(nPoints()));
|
||||
// 1 -> 1 mapping
|
||||
nonGlobalPatchPointsPtr_.reset(new labelList(identity(nPoints())));
|
||||
}
|
||||
else
|
||||
{
|
||||
nonGlobalPatchPointsPtr_.reset(new labelList(nPoints()));
|
||||
labelList& ngpp = *nonGlobalPatchPointsPtr_;
|
||||
|
||||
// Get reference to shared points
|
||||
const labelList& sharedPoints =
|
||||
boundaryMesh().mesh()().globalData().sharedPointLabels();
|
||||
|
||||
nonGlobalPatchPointsPtr_ = new labelList(nPoints());
|
||||
labelList& ngpp = *nonGlobalPatchPointsPtr_;
|
||||
|
||||
const labelList& faMeshPatchPoints = pointLabels();
|
||||
|
||||
const labelList& meshPoints =
|
||||
boundaryMesh().mesh().patch().meshPoints();
|
||||
|
||||
label noFiltPoints = 0;
|
||||
label nNonShared = 0;
|
||||
|
||||
forAll(faMeshPatchPoints, pointI)
|
||||
forAll(faMeshPatchPoints, pointi)
|
||||
{
|
||||
label curP = meshPoints[faMeshPatchPoints[pointI]];
|
||||
|
||||
bool found = false;
|
||||
|
||||
forAll(sharedPoints, sharedI)
|
||||
const label mpi = meshPoints[faMeshPatchPoints[pointi]];
|
||||
if (!sharedPoints.found(mpi))
|
||||
{
|
||||
if (sharedPoints[sharedI] == curP)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
ngpp[noFiltPoints] = pointI;
|
||||
++noFiltPoints;
|
||||
ngpp[nNonShared] = pointi;
|
||||
++nNonShared;
|
||||
}
|
||||
}
|
||||
|
||||
ngpp.setSize(noFiltPoints);
|
||||
|
||||
|
||||
// // Get reference to shared points
|
||||
// const labelList& sharedPoints =
|
||||
// boundaryMesh().mesh().globalData().sharedPointLabels();
|
||||
|
||||
// nonGlobalPatchPointsPtr_ = new labelList(nPoints());
|
||||
// labelList& ngpp = *nonGlobalPatchPointsPtr_;
|
||||
|
||||
// const labelList& patchPoints = pointLabels();
|
||||
|
||||
// label noFiltPoints = 0;
|
||||
|
||||
// forAll(patchPoints, pointI)
|
||||
// {
|
||||
// label curP = patchPoints[pointI];
|
||||
|
||||
// bool found = false;
|
||||
|
||||
// forAll(sharedPoints, pI)
|
||||
// {
|
||||
// if (sharedPoints[pI] == curP)
|
||||
// {
|
||||
// found = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (!found)
|
||||
// {
|
||||
// ngpp[noFiltPoints] = pointI;
|
||||
// noFiltPoints++;
|
||||
// }
|
||||
// }
|
||||
|
||||
// ngpp.setSize(noFiltPoints);
|
||||
ngpp.resize(nNonShared);
|
||||
}
|
||||
}
|
||||
|
||||
@ -242,7 +264,7 @@ void Foam::processorFaPatch::initUpdateMesh()
|
||||
// For completeness
|
||||
faPatch::initUpdateMesh();
|
||||
|
||||
deleteDemandDrivenData(neighbPointsPtr_);
|
||||
neighbPointsPtr_.clear();
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
@ -308,7 +330,7 @@ void Foam::processorFaPatch::updateMesh()
|
||||
{
|
||||
// Convert neighbour edges and indices into face back into
|
||||
// my edges and points.
|
||||
neighbPointsPtr_ = new labelList(nPoints());
|
||||
neighbPointsPtr_.reset(new labelList(nPoints()));
|
||||
labelList& neighbPoints = *neighbPointsPtr_;
|
||||
|
||||
const edgeList::subList patchEdges =
|
||||
@ -330,7 +352,7 @@ void Foam::processorFaPatch::updateMesh()
|
||||
{
|
||||
// Differing number of points. Probably patch includes
|
||||
// part of a cyclic.
|
||||
neighbPointsPtr_ = nullptr;
|
||||
neighbPointsPtr_.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -355,7 +377,7 @@ const Foam::labelList& Foam::processorFaPatch::neighbPoints() const
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return *neighbPointsPtr_;
|
||||
return *neighbPointsPtr_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -39,8 +39,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef processorFaPatch_H
|
||||
#define processorFaPatch_H
|
||||
#ifndef Foam_processorFaPatch_H
|
||||
#define Foam_processorFaPatch_H
|
||||
|
||||
#include "coupledFaPatch.H"
|
||||
#include "processorLduInterface.H"
|
||||
@ -59,7 +59,7 @@ class processorFaPatch
|
||||
public coupledFaPatch,
|
||||
public processorLduInterface
|
||||
{
|
||||
// Private data
|
||||
// Private Data
|
||||
|
||||
//- My processor number
|
||||
int myProcNo_;
|
||||
@ -78,17 +78,30 @@ class processorFaPatch
|
||||
|
||||
//- Corresponding neighbouring local point label for every local point
|
||||
// (so localPoints()[i] == neighb.localPoints()[neighbPoints_[i]])
|
||||
mutable labelList* neighbPointsPtr_;
|
||||
mutable autoPtr<labelList> neighbPointsPtr_;
|
||||
|
||||
//- The set of labels of the processor patch points which are
|
||||
// non-global, i.e. present in this processor patch
|
||||
mutable labelList* nonGlobalPatchPointsPtr_;
|
||||
mutable autoPtr<labelList> nonGlobalPatchPointsPtr_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member functions
|
||||
|
||||
//- Construct from components with specified name
|
||||
processorFaPatch
|
||||
(
|
||||
const word& name,
|
||||
const labelUList& edgeLabels,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm,
|
||||
const label nbrPolyPatchi,
|
||||
const label myProcNo,
|
||||
const label neighbProcNo,
|
||||
const word& patchType = typeName
|
||||
);
|
||||
|
||||
//- Make patch weighting factors
|
||||
void makeWeights(scalarField&) const;
|
||||
|
||||
@ -99,7 +112,7 @@ protected:
|
||||
void makeNonGlobalPatchPoints() const;
|
||||
|
||||
|
||||
// Geometry functions
|
||||
// Geometry Functions
|
||||
|
||||
//- Initialise the calculation of the patch geometry
|
||||
void initGeometry();
|
||||
@ -128,27 +141,17 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
//- Construct from components with automatically generated standard name
|
||||
processorFaPatch
|
||||
(
|
||||
const word& name,
|
||||
const labelList& edgeLabels,
|
||||
const labelUList& edgeLabels,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm,
|
||||
const label ngbPolyPatchIndex,
|
||||
const label nbrPolyPatchi,
|
||||
const label myProcNo,
|
||||
const label neighbProcNo
|
||||
)
|
||||
:
|
||||
coupledFaPatch(name, edgeLabels, index, bm, ngbPolyPatchIndex),
|
||||
myProcNo_(myProcNo),
|
||||
neighbProcNo_(neighbProcNo),
|
||||
neighbEdgeCentres_(),
|
||||
neighbEdgeLengths_(),
|
||||
neighbEdgeFaceCentres_(),
|
||||
neighbPointsPtr_(nullptr),
|
||||
nonGlobalPatchPointsPtr_(nullptr)
|
||||
{}
|
||||
const label neighbProcNo,
|
||||
const word& patchType = typeName
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
processorFaPatch
|
||||
@ -156,18 +159,9 @@ public:
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
coupledFaPatch(name, dict, index, bm),
|
||||
myProcNo_(dict.get<label>("myProcNo")),
|
||||
neighbProcNo_(dict.get<label>("neighbProcNo")),
|
||||
neighbEdgeCentres_(),
|
||||
neighbEdgeLengths_(),
|
||||
neighbEdgeFaceCentres_(),
|
||||
neighbPointsPtr_(nullptr),
|
||||
nonGlobalPatchPointsPtr_(nullptr)
|
||||
{}
|
||||
const faBoundaryMesh& bm,
|
||||
const word& patchType = typeName
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -41,7 +42,7 @@ namespace Foam
|
||||
void Foam::symmetryFaPatch::makeCorrVecs(vectorField& cv) const
|
||||
{
|
||||
// Non-orthogonal correction not allowed
|
||||
cv = vector::zero;
|
||||
cv = Zero;
|
||||
}
|
||||
|
||||
|
||||
@ -50,13 +51,14 @@ void Foam::symmetryFaPatch::makeCorrVecs(vectorField& cv) const
|
||||
Foam::symmetryFaPatch::symmetryFaPatch
|
||||
(
|
||||
const word& name,
|
||||
const labelList& edgeLabels,
|
||||
const labelUList& edgeLabels,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm,
|
||||
const label ngbPolyPatchIndex
|
||||
const label nbrPolyPatchi,
|
||||
const word& patchType
|
||||
)
|
||||
:
|
||||
faPatch(name, edgeLabels, index, bm, ngbPolyPatchIndex)
|
||||
faPatch(name, edgeLabels, index, bm, nbrPolyPatchi, patchType)
|
||||
{}
|
||||
|
||||
|
||||
@ -65,10 +67,11 @@ Foam::symmetryFaPatch::symmetryFaPatch
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
const faBoundaryMesh& bm,
|
||||
const word& patchType
|
||||
)
|
||||
:
|
||||
faPatch(name, dict, index, bm)
|
||||
faPatch(name, dict, index, bm, patchType)
|
||||
{
|
||||
if (ngbPolyPatchIndex() < 0)
|
||||
{
|
||||
@ -79,4 +82,27 @@ Foam::symmetryFaPatch::symmetryFaPatch
|
||||
}
|
||||
|
||||
|
||||
Foam::symmetryFaPatch::symmetryFaPatch
|
||||
(
|
||||
const symmetryFaPatch& p,
|
||||
const faBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
faPatch(p, bm)
|
||||
{}
|
||||
|
||||
|
||||
Foam::symmetryFaPatch::symmetryFaPatch
|
||||
(
|
||||
const symmetryFaPatch& p,
|
||||
const faBoundaryMesh& bm,
|
||||
const label index,
|
||||
const labelUList& edgeLabels,
|
||||
const label nbrPolyPatchi
|
||||
)
|
||||
:
|
||||
faPatch(p, bm, index, edgeLabels, nbrPolyPatchi)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -39,8 +39,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef symmetryFaPatch_H
|
||||
#define symmetryFaPatch_H
|
||||
#ifndef Foam_symmetryFaPatch_H
|
||||
#define Foam_symmetryFaPatch_H
|
||||
|
||||
#include "faPatch.H"
|
||||
#include "symmetryPolyPatch.H"
|
||||
@ -51,14 +51,13 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class symmetryFaPatch Declaration
|
||||
Class symmetryFaPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class symmetryFaPatch
|
||||
:
|
||||
public faPatch
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
@ -70,7 +69,7 @@ protected:
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName(symmetryPolyPatch::typeName_());
|
||||
TypeName(symmetryPolyPatch::typeName_()); // ie, "symmetry"
|
||||
|
||||
|
||||
// Constructors
|
||||
@ -79,10 +78,11 @@ public:
|
||||
symmetryFaPatch
|
||||
(
|
||||
const word& name,
|
||||
const labelList& edgeLabels,
|
||||
const labelUList& edgeLabels,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm,
|
||||
const label ngbPolyPatchIndex
|
||||
const label nbrPolyPatchi,
|
||||
const word& patchType
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
@ -91,30 +91,55 @@ public:
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
const faBoundaryMesh& bm,
|
||||
const word& patchType
|
||||
);
|
||||
|
||||
//- Copy construct, resetting boundary mesh
|
||||
symmetryFaPatch(const symmetryFaPatch& p, const faBoundaryMesh& bm);
|
||||
|
||||
//- Copy construct, resetting boundary mesh and addressing
|
||||
symmetryFaPatch
|
||||
(
|
||||
const symmetryFaPatch& p,
|
||||
const faBoundaryMesh& bm,
|
||||
const label index,
|
||||
const labelUList& edgeLabels,
|
||||
const label nbrPolyPatchi
|
||||
);
|
||||
|
||||
|
||||
//- Construct and return a clone, resetting the boundary mesh
|
||||
virtual autoPtr<faPatch> clone(const faBoundaryMesh& bm) const
|
||||
{
|
||||
return autoPtr<faPatch>
|
||||
(
|
||||
new symmetryFaPatch(*this, bm)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct and return a clone, resetting the edge list
|
||||
// and boundary mesh
|
||||
//- and boundary mesh
|
||||
virtual autoPtr<faPatch> clone
|
||||
(
|
||||
const faBoundaryMesh& bm,
|
||||
const labelList& edgeLabels,
|
||||
const labelUList& edgeLabels,
|
||||
const label index,
|
||||
const label ngbPolyPatchIndex
|
||||
const label nbrPolyPatchi
|
||||
) const
|
||||
{
|
||||
return autoPtr<faPatch>
|
||||
(
|
||||
new symmetryFaPatch
|
||||
(
|
||||
name(), edgeLabels, index, bm, ngbPolyPatchIndex
|
||||
*this,
|
||||
bm,
|
||||
index,
|
||||
edgeLabels,
|
||||
nbrPolyPatchi
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Destructor
|
||||
virtual ~symmetryFaPatch() = default;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -80,10 +80,11 @@ Foam::wedgeFaPatch::wedgeFaPatch
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
const faBoundaryMesh& bm,
|
||||
const word& patchType
|
||||
)
|
||||
:
|
||||
faPatch(name, dict, index, bm),
|
||||
faPatch(name, dict, index, bm, patchType),
|
||||
wedgePolyPatchPtr_(nullptr),
|
||||
axisPoint_(-1),
|
||||
axisPointChecked_(false)
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -39,8 +39,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef wedgeFaPatch_H
|
||||
#define wedgeFaPatch_H
|
||||
#ifndef Foam_wedgeFaPatch_H
|
||||
#define Foam_wedgeFaPatch_H
|
||||
|
||||
#include "faPatch.H"
|
||||
#include "wedgePolyPatch.H"
|
||||
@ -51,14 +51,14 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class wedgeFaPatch Declaration
|
||||
Class wedgeFaPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class wedgeFaPatch
|
||||
:
|
||||
public faPatch
|
||||
{
|
||||
// Private data
|
||||
// Private Data
|
||||
|
||||
const wedgePolyPatch* wedgePolyPatchPtr_;
|
||||
|
||||
@ -68,7 +68,7 @@ class wedgeFaPatch
|
||||
//- Is it axis point looked for?
|
||||
mutable bool axisPointChecked_;
|
||||
|
||||
//- Finde axis point
|
||||
//- Find axis point
|
||||
void findAxisPoint() const;
|
||||
|
||||
|
||||
@ -83,7 +83,8 @@ public:
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
const faBoundaryMesh& bm,
|
||||
const word& patchType
|
||||
);
|
||||
|
||||
|
||||
@ -91,7 +92,7 @@ public:
|
||||
virtual ~wedgeFaPatch() = default;
|
||||
|
||||
|
||||
// Member functions
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -34,6 +34,8 @@ License
|
||||
#include "edgeFields.H"
|
||||
#include "edgeHashes.H"
|
||||
#include "polyMesh.H"
|
||||
#include "polyPatch.H"
|
||||
//#include "pointPatchField.H"
|
||||
#include "demandDrivenData.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -46,6 +48,39 @@ namespace Foam
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::faPatch::constraintType(const word& patchType)
|
||||
{
|
||||
// Reasonable to expect any faPatch constraint has an identically
|
||||
// named polyPatch/pointPatch equivalent
|
||||
|
||||
return polyPatch::constraintType(patchType);
|
||||
}
|
||||
|
||||
|
||||
Foam::wordList Foam::faPatch::constraintTypes()
|
||||
{
|
||||
const auto& cnstrTable = *dictionaryConstructorTablePtr_;
|
||||
|
||||
wordList cTypes(cnstrTable.size());
|
||||
|
||||
label i = 0;
|
||||
|
||||
forAllConstIters(cnstrTable, iter)
|
||||
{
|
||||
if (constraintType(iter.key()))
|
||||
{
|
||||
cTypes[i++] = iter.key();
|
||||
}
|
||||
}
|
||||
|
||||
cTypes.resize(i);
|
||||
|
||||
return cTypes;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::faPatch::clearOut()
|
||||
@ -61,20 +96,26 @@ void Foam::faPatch::clearOut()
|
||||
Foam::faPatch::faPatch
|
||||
(
|
||||
const word& name,
|
||||
const labelList& edgeLabels,
|
||||
const labelUList& edgeLabels,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm,
|
||||
const label ngbPolyPatchIndex
|
||||
const label nbrPolyPatchi,
|
||||
const word& patchType
|
||||
)
|
||||
:
|
||||
patchIdentifier(name, index),
|
||||
labelList(edgeLabels),
|
||||
nbrPolyPatchId_(ngbPolyPatchIndex),
|
||||
nbrPolyPatchId_(nbrPolyPatchi),
|
||||
boundaryMesh_(bm),
|
||||
edgeFacesPtr_(nullptr),
|
||||
pointLabelsPtr_(nullptr),
|
||||
pointEdgesPtr_(nullptr)
|
||||
{}
|
||||
{
|
||||
if (!patchType.empty() && constraintType(patchType))
|
||||
{
|
||||
inGroups().appendUniq(patchType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::faPatch::faPatch
|
||||
@ -82,7 +123,8 @@ Foam::faPatch::faPatch
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
const faBoundaryMesh& bm,
|
||||
const word& patchType
|
||||
)
|
||||
:
|
||||
patchIdentifier(name, dict, index),
|
||||
@ -92,13 +134,25 @@ Foam::faPatch::faPatch
|
||||
edgeFacesPtr_(nullptr),
|
||||
pointLabelsPtr_(nullptr),
|
||||
pointEdgesPtr_(nullptr)
|
||||
{}
|
||||
{
|
||||
if (!patchType.empty() && constraintType(patchType))
|
||||
{
|
||||
inGroups().appendUniq(patchType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::faPatch::faPatch(const faPatch& p, const faBoundaryMesh& bm)
|
||||
Foam::faPatch::faPatch
|
||||
(
|
||||
const faPatch& p,
|
||||
const faBoundaryMesh& bm,
|
||||
const label index,
|
||||
const labelUList& edgeLabels,
|
||||
const label nbrPolyPatchi
|
||||
)
|
||||
:
|
||||
patchIdentifier(p, p.index()),
|
||||
labelList(p),
|
||||
patchIdentifier(p, index),
|
||||
labelList(edgeLabels),
|
||||
nbrPolyPatchId_(p.nbrPolyPatchId_),
|
||||
boundaryMesh_(bm),
|
||||
edgeFacesPtr_(nullptr),
|
||||
@ -107,6 +161,23 @@ Foam::faPatch::faPatch(const faPatch& p, const faBoundaryMesh& bm)
|
||||
{}
|
||||
|
||||
|
||||
Foam::faPatch::faPatch
|
||||
(
|
||||
const faPatch& p,
|
||||
const faBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
faPatch
|
||||
(
|
||||
p,
|
||||
bm,
|
||||
p.index(),
|
||||
p.edgeLabels(),
|
||||
p.nbrPolyPatchId_
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::faPatch::~faPatch()
|
||||
@ -464,7 +535,7 @@ void Foam::faPatch::movePoints(const pointField& points)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::faPatch::resetEdges(const UList<label>& newEdges)
|
||||
void Foam::faPatch::resetEdges(const labelUList& newEdges)
|
||||
{
|
||||
clearOut();
|
||||
static_cast<labelList&>(*this) = newEdges;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -42,8 +42,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faPatch_H
|
||||
#define faPatch_H
|
||||
#ifndef Foam_faPatch_H
|
||||
#define Foam_faPatch_H
|
||||
|
||||
#include "patchIdentifier.H"
|
||||
#include "labelList.H"
|
||||
@ -157,9 +157,10 @@ public:
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
const faBoundaryMesh& bm,
|
||||
const word& patchType
|
||||
),
|
||||
(name, dict, index, bm)
|
||||
(name, dict, index, bm, patchType)
|
||||
);
|
||||
|
||||
|
||||
@ -169,10 +170,11 @@ public:
|
||||
faPatch
|
||||
(
|
||||
const word& name,
|
||||
const labelList& edgeLabels,
|
||||
const labelUList& edgeLabels,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm,
|
||||
const label ngbPolyPatchIndex
|
||||
const label nbrPolyPatchi,
|
||||
const word& patchType
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
@ -181,32 +183,54 @@ public:
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
const faBoundaryMesh& bm,
|
||||
const word& patchType
|
||||
);
|
||||
|
||||
//- Construct as copy, resetting the boundary mesh
|
||||
faPatch(const faPatch&, const faBoundaryMesh&);
|
||||
//- Copy construct, resetting the boundary mesh
|
||||
faPatch(const faPatch& p, const faBoundaryMesh& bm);
|
||||
|
||||
//- Copy construct, resetting boundary mesh and addressing
|
||||
faPatch
|
||||
(
|
||||
const faPatch& p,
|
||||
const faBoundaryMesh& bm,
|
||||
const label index,
|
||||
const labelUList& edgeLabels,
|
||||
const label nbrPolyPatchi
|
||||
);
|
||||
|
||||
|
||||
//- Construct and return a clone, resetting the boundary mesh
|
||||
virtual autoPtr<faPatch> clone(const faBoundaryMesh& bm) const
|
||||
{
|
||||
return autoPtr<faPatch>::New(*this, bm);
|
||||
}
|
||||
|
||||
//- Construct and return a clone, resetting the edge list
|
||||
//- and boundary mesh
|
||||
virtual autoPtr<faPatch> clone
|
||||
(
|
||||
const faBoundaryMesh& bm,
|
||||
const labelList& edgeLabels,
|
||||
const labelUList& edgeLabels,
|
||||
const label index,
|
||||
const label ngbPolyPatchIndex
|
||||
const label nbrPolyPatchi
|
||||
) const
|
||||
{
|
||||
return
|
||||
autoPtr<faPatch>::New
|
||||
(name(), edgeLabels, index, bm, ngbPolyPatchIndex);
|
||||
return autoPtr<faPatch>::New
|
||||
(
|
||||
*this,
|
||||
bm,
|
||||
index,
|
||||
edgeLabels,
|
||||
nbrPolyPatchi
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a pointer to a new patch created
|
||||
//- on freestore from dictionary
|
||||
//- Return pointer to a new patch created on freestore from dictionary
|
||||
static autoPtr<faPatch> New
|
||||
(
|
||||
const word& name,
|
||||
@ -215,11 +239,30 @@ public:
|
||||
const faBoundaryMesh& bm
|
||||
);
|
||||
|
||||
//- Return pointer to a new patch created on freestore from dictionary
|
||||
static autoPtr<faPatch> New
|
||||
(
|
||||
const word& patchType,
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~faPatch();
|
||||
|
||||
|
||||
// Static Member Functions
|
||||
|
||||
//- Return true if the given type is a constraint type
|
||||
static bool constraintType(const word& pt);
|
||||
|
||||
//- Return a list of all the constraint patch types
|
||||
static wordList constraintTypes();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the list of edges
|
||||
@ -228,9 +271,6 @@ public:
|
||||
return static_cast<const labelList&>(*this);
|
||||
}
|
||||
|
||||
//- Define new list of edges
|
||||
void edgeLabels(const UList<label>& newEdgeLabels);
|
||||
|
||||
//- Number of patch points
|
||||
label nPoints() const
|
||||
{
|
||||
@ -359,7 +399,7 @@ public:
|
||||
// Topological changes
|
||||
|
||||
//- Reset the list of edges (use with caution)
|
||||
void resetEdges(const UList<label>& newEdges);
|
||||
void resetEdges(const labelUList& newEdges);
|
||||
|
||||
//- Reset the list of edges (use with caution)
|
||||
void resetEdges(labelList&& newEdges);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -39,9 +39,23 @@ Foam::autoPtr<Foam::faPatch> Foam::faPatch::New
|
||||
const faBoundaryMesh& bm
|
||||
)
|
||||
{
|
||||
DebugInFunction << "Constructing faPatch" << endl;
|
||||
word patchType(dict.get<word>("type"));
|
||||
// Not needed: dict.readIfPresent("geometricType", patchType);
|
||||
|
||||
const word patchType(dict.get<word>("type"));
|
||||
return faPatch::New(patchType, name, dict, index, bm);
|
||||
}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::faPatch> Foam::faPatch::New
|
||||
(
|
||||
const word& patchType,
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faBoundaryMesh& bm
|
||||
)
|
||||
{
|
||||
DebugInFunction << "Constructing faPatch" << endl;
|
||||
|
||||
auto* ctorPtr = dictionaryConstructorTable(patchType);
|
||||
|
||||
@ -56,7 +70,7 @@ Foam::autoPtr<Foam::faPatch> Foam::faPatch::New
|
||||
) << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<faPatch>(ctorPtr(name, dict, index, bm));
|
||||
return autoPtr<faPatch>(ctorPtr(name, dict, index, bm, patchType));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -1266,11 +1266,6 @@ bool Foam::faMeshDecomposition::writeDecomposition()
|
||||
nPatches,
|
||||
new processorFaPatch
|
||||
(
|
||||
processorPolyPatch::newName
|
||||
(
|
||||
procI,
|
||||
curNeighbourProcessors[procPatchI]
|
||||
),
|
||||
curEdgeLabels,
|
||||
nPatches,
|
||||
procMesh.boundary(),
|
||||
|
||||
Reference in New Issue
Block a user