Merge branch 'master' of github.com-OpenFOAM:OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -80,15 +80,6 @@ Description
|
||||
#{
|
||||
Pout<< "**codeSetValue**" << endl;
|
||||
#};
|
||||
|
||||
// Dummy entry. Make dependent on above to trigger recompilation
|
||||
code
|
||||
#{
|
||||
$codeInclude
|
||||
$codeCorrect
|
||||
$codeAddSup
|
||||
$codeSetValue
|
||||
#};
|
||||
}
|
||||
|
||||
sourceTimeCoeffs
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -59,8 +59,8 @@ namespace functionEntries
|
||||
}
|
||||
|
||||
|
||||
const Foam::word Foam::functionEntries::codeStream::codeTemplateC
|
||||
= "codeStreamTemplate.C";
|
||||
const Foam::word Foam::functionEntries::codeStream::codeTemplateC =
|
||||
"codeStreamTemplate.C";
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
@ -123,8 +123,8 @@ Foam::functionEntries::codeStream::getFunction
|
||||
const dictionary& codeDict
|
||||
)
|
||||
{
|
||||
// get code, codeInclude, codeOptions
|
||||
dynamicCodeContext context(codeDict);
|
||||
// get code, codeInclude, ...
|
||||
dynamicCodeContext context(codeDict, {"code", "codeInclude", "localCode"});
|
||||
|
||||
// codeName: codeStream + _<sha1>
|
||||
// codeDir : _<sha1>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -293,7 +293,7 @@ void Foam::codedBase::updateLibrary
|
||||
dict
|
||||
);
|
||||
|
||||
dynamicCodeContext context(dict);
|
||||
dynamicCodeContext context(dict, codeKeys());
|
||||
|
||||
// codeName: name + _<sha1>
|
||||
// codeDir : name
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -92,30 +92,26 @@ class codedBase
|
||||
protected:
|
||||
|
||||
//- Update library as required
|
||||
void updateLibrary
|
||||
(
|
||||
const word& name
|
||||
) const;
|
||||
void updateLibrary(const word& name) const;
|
||||
|
||||
//- Get the loaded dynamic libraries
|
||||
virtual dlLibraryTable& libs() const = 0;
|
||||
|
||||
//- Adapt the context for the current object
|
||||
virtual void prepare
|
||||
(
|
||||
dynamicCode&,
|
||||
const dynamicCodeContext&
|
||||
) const = 0;
|
||||
virtual void prepare(dynamicCode&, const dynamicCodeContext&) const = 0;
|
||||
|
||||
// Return a description (type + name) for the output
|
||||
//- Return a description (type + name) for the output
|
||||
virtual string description() const = 0;
|
||||
|
||||
// Clear any redirected objects
|
||||
//- Clear any redirected objects
|
||||
virtual void clearRedirect() const = 0;
|
||||
|
||||
// Get the dictionary to initialize the codeContext
|
||||
//- Get the dictionary to initialize the codeContext
|
||||
virtual const dictionary& codeDict() const = 0;
|
||||
|
||||
//- Get the keywords associated with source code
|
||||
virtual const wordList& codeKeys() const = 0;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -343,7 +343,13 @@ void Foam::dynamicCode::reset
|
||||
)
|
||||
{
|
||||
clear();
|
||||
setFilterContext(context);
|
||||
|
||||
forAllConstIter(HashTable<string>, context.code(), iter)
|
||||
{
|
||||
setFilterVariable(iter.key(), iter());
|
||||
}
|
||||
|
||||
setFilterVariable("SHA1sum", context.sha1().str());
|
||||
}
|
||||
|
||||
|
||||
@ -369,18 +375,6 @@ void Foam::dynamicCode::addCreateFile
|
||||
}
|
||||
|
||||
|
||||
void Foam::dynamicCode::setFilterContext
|
||||
(
|
||||
const dynamicCodeContext& context
|
||||
)
|
||||
{
|
||||
filterVars_.set("localCode", context.localCode());
|
||||
filterVars_.set("code", context.code());
|
||||
filterVars_.set("codeInclude", context.include());
|
||||
filterVars_.set("SHA1sum", context.sha1().str());
|
||||
}
|
||||
|
||||
|
||||
void Foam::dynamicCode::setFilterVariable
|
||||
(
|
||||
const word& key,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -259,9 +259,6 @@ public:
|
||||
//- Add a file to create with its contents. Will not be filtered
|
||||
void addCreateFile(const fileName& name, const string& contents);
|
||||
|
||||
//- Define filter variables for code, codeInclude, SHA1sum
|
||||
void setFilterContext(const dynamicCodeContext&);
|
||||
|
||||
//- Define a filter variable
|
||||
void setFilterVariable(const word& key, const std::string& value);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,102 +27,7 @@ License
|
||||
#include "stringOps.H"
|
||||
#include "OSHA1stream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::dynamicCodeContext::dynamicCodeContext(const dictionary& dict)
|
||||
:
|
||||
dict_(dict),
|
||||
code_(),
|
||||
localCode_(),
|
||||
include_(),
|
||||
options_(),
|
||||
libs_()
|
||||
{
|
||||
// Expand dictionary entries
|
||||
|
||||
// Note: removes any leading/trailing whitespace
|
||||
// - necessary for compilation options, convenient for includes
|
||||
// and body.
|
||||
|
||||
const entry* codePtr = dict.lookupEntryPtr
|
||||
(
|
||||
"code",
|
||||
false,
|
||||
false
|
||||
);
|
||||
if (codePtr)
|
||||
{
|
||||
code_ = stringOps::trim(codePtr->stream());
|
||||
stringOps::inplaceExpand(code_, dict);
|
||||
}
|
||||
|
||||
const entry* includePtr = dict.lookupEntryPtr
|
||||
(
|
||||
"codeInclude",
|
||||
false,
|
||||
false
|
||||
);
|
||||
if (includePtr)
|
||||
{
|
||||
include_ = stringOps::trim(includePtr->stream());
|
||||
stringOps::inplaceExpand(include_, dict);
|
||||
}
|
||||
|
||||
const entry* optionsPtr = dict.lookupEntryPtr
|
||||
(
|
||||
"codeOptions",
|
||||
false,
|
||||
false
|
||||
);
|
||||
if (optionsPtr)
|
||||
{
|
||||
options_ = stringOps::trim(optionsPtr->stream());
|
||||
stringOps::inplaceExpand(options_, dict);
|
||||
}
|
||||
|
||||
const entry* libsPtr = dict.lookupEntryPtr("codeLibs", false, false);
|
||||
if (libsPtr)
|
||||
{
|
||||
libs_ = stringOps::trim(libsPtr->stream());
|
||||
stringOps::inplaceExpand(libs_, dict);
|
||||
}
|
||||
|
||||
const entry* localPtr = dict.lookupEntryPtr("localCode", false, false);
|
||||
if (localPtr)
|
||||
{
|
||||
localCode_ = stringOps::trim(localPtr->stream());
|
||||
stringOps::inplaceExpand(localCode_, dict);
|
||||
}
|
||||
|
||||
// Calculate SHA1 digest from include, options, localCode, code
|
||||
OSHA1stream os;
|
||||
os << include_ << options_ << libs_ << localCode_ << code_;
|
||||
sha1_ = os.digest();
|
||||
|
||||
|
||||
// Add line number after calculating sha1 since includes processorDDD
|
||||
// in path which differs between processors.
|
||||
|
||||
if (codePtr)
|
||||
{
|
||||
addLineDirective(code_, codePtr->startLineNumber(), dict.name());
|
||||
}
|
||||
|
||||
if (includePtr)
|
||||
{
|
||||
addLineDirective(include_, includePtr->startLineNumber(), dict.name());
|
||||
}
|
||||
|
||||
// Do not add line directive to options_ (Make/options) and libs since
|
||||
// they are preprocessed as a single line at this point. Can be fixed.
|
||||
if (localPtr)
|
||||
{
|
||||
addLineDirective(localCode_, localPtr->startLineNumber(), dict.name());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::dynamicCodeContext::addLineDirective
|
||||
(
|
||||
@ -135,4 +40,69 @@ void Foam::dynamicCodeContext::addLineDirective
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::dynamicCodeContext::dynamicCodeContext
|
||||
(
|
||||
const dictionary& dict,
|
||||
const wordList& codeKeys
|
||||
)
|
||||
:
|
||||
dict_(dict),
|
||||
code_(),
|
||||
options_(),
|
||||
libs_()
|
||||
{
|
||||
// Expand all dictionary entries. Note that this removes any leading or
|
||||
// trailing whitespace, which is necessary for compilation options, and
|
||||
// doesn't hurt for everything else
|
||||
List<const entry*> codePtrs(codeKeys.size(), nullptr);
|
||||
forAll(codeKeys, i)
|
||||
{
|
||||
const word& key = codeKeys[i];
|
||||
codePtrs[i] = dict.lookupEntryPtr(key, false, false);
|
||||
if (codePtrs[i])
|
||||
{
|
||||
code_.insert
|
||||
(
|
||||
key,
|
||||
stringOps::expand
|
||||
(
|
||||
stringOps::trim(codePtrs[i]->stream()),
|
||||
dict
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
code_.insert(key, "");
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate SHA1 digest from all entries
|
||||
OSHA1stream os;
|
||||
forAllConstIter(HashTable<string>, code_, iter)
|
||||
{
|
||||
os << iter();
|
||||
}
|
||||
sha1_ = os.digest();
|
||||
|
||||
// Add line directive after calculating SHA1 since this includes
|
||||
// "processor..." in the path which differs between cores
|
||||
forAll(codeKeys, i)
|
||||
{
|
||||
if (codePtrs[i])
|
||||
{
|
||||
const word& key = codeKeys[i];
|
||||
addLineDirective
|
||||
(
|
||||
code_[key],
|
||||
codePtrs[i]->startLineNumber(),
|
||||
dict.name()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -36,6 +36,7 @@ SourceFiles
|
||||
#define dynamicCodeContext_H
|
||||
|
||||
#include "dictionary.H"
|
||||
#include "HashTable.H"
|
||||
#include "SHA1Digest.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -54,31 +55,42 @@ class dynamicCodeContext
|
||||
//- The parent dictionary context
|
||||
const dictionary& dict_;
|
||||
|
||||
//- Optional "code" entry
|
||||
string code_;
|
||||
|
||||
//- Optional "localCode" entry
|
||||
string localCode_;
|
||||
|
||||
//- Optional "codeInclude" entry
|
||||
string include_;
|
||||
//- Code entries
|
||||
HashTable<string> code_;
|
||||
|
||||
//- Optional "codeOptions" entry
|
||||
string options_;
|
||||
|
||||
//- Optional "codeLib" entry
|
||||
//- Optional "codeLibs" entry
|
||||
string libs_;
|
||||
|
||||
//- Calculated SHA1Digest
|
||||
SHA1Digest sha1_;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Add a \#line directive to the start of the given source string that
|
||||
// compilation messages are meaningful
|
||||
static void addLineDirective
|
||||
(
|
||||
string&,
|
||||
const label lineNum,
|
||||
const fileName& name
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from a dictionary
|
||||
dynamicCodeContext(const dictionary&);
|
||||
//- Construct from a dictionary and lists of which entries correspond
|
||||
// to code
|
||||
dynamicCodeContext
|
||||
(
|
||||
const dictionary& dict,
|
||||
const wordList& codeKeys
|
||||
);
|
||||
|
||||
|
||||
// Member functions
|
||||
@ -89,10 +101,10 @@ public:
|
||||
return dict_;
|
||||
}
|
||||
|
||||
//- Return the code-includes
|
||||
const string& include() const
|
||||
//- Return the code table
|
||||
const HashTable<string>& code() const
|
||||
{
|
||||
return include_;
|
||||
return code_;
|
||||
}
|
||||
|
||||
//- Return the code-options
|
||||
@ -107,31 +119,11 @@ public:
|
||||
return libs_;
|
||||
}
|
||||
|
||||
//- Return the code
|
||||
const string& code() const
|
||||
{
|
||||
return code_;
|
||||
}
|
||||
|
||||
//- Return the local (file-scope) code
|
||||
const string& localCode() const
|
||||
{
|
||||
return localCode_;
|
||||
}
|
||||
|
||||
//- Return SHA1 digest calculated from include, options, code
|
||||
const SHA1Digest& sha1() const
|
||||
{
|
||||
return sha1_;
|
||||
}
|
||||
|
||||
//- Helper: add \#line directive
|
||||
static void addLineDirective
|
||||
(
|
||||
string&,
|
||||
const label lineNum,
|
||||
const fileName& name
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -31,15 +31,22 @@ License
|
||||
#include "dynamicCodeContext.H"
|
||||
#include "stringOps.H"
|
||||
|
||||
// * * * * * * * * * * * * Private Static Data Members * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
const Foam::wordList Foam::codedFixedValuePointPatchField<Type>::codeKeys_ =
|
||||
{"code", "codeInclude", "localCode"};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
const Foam::word Foam::codedFixedValuePointPatchField<Type>::codeTemplateC
|
||||
= "fixedValuePointPatchFieldTemplate.C";
|
||||
const Foam::word Foam::codedFixedValuePointPatchField<Type>::codeTemplateC =
|
||||
"fixedValuePointPatchFieldTemplate.C";
|
||||
|
||||
template<class Type>
|
||||
const Foam::word Foam::codedFixedValuePointPatchField<Type>::codeTemplateH
|
||||
= "fixedValuePointPatchFieldTemplate.H";
|
||||
const Foam::word Foam::codedFixedValuePointPatchField<Type>::codeTemplateH =
|
||||
"fixedValuePointPatchFieldTemplate.H";
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
@ -141,8 +148,8 @@ void Foam::codedFixedValuePointPatchField<Type>::prepare
|
||||
|
||||
|
||||
template<class Type>
|
||||
const Foam::dictionary& Foam::codedFixedValuePointPatchField<Type>::codeDict()
|
||||
const
|
||||
const Foam::dictionary&
|
||||
Foam::codedFixedValuePointPatchField<Type>::codeDict() const
|
||||
{
|
||||
// Use system/codeDict or in-line
|
||||
return
|
||||
@ -154,6 +161,14 @@ const
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
const Foam::wordList&
|
||||
Foam::codedFixedValuePointPatchField<Type>::codeKeys() const
|
||||
{
|
||||
return codeKeys_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::string Foam::codedFixedValuePointPatchField<Type>::description() const
|
||||
{
|
||||
|
||||
@ -105,6 +105,12 @@ class codedFixedValuePointPatchField
|
||||
public fixedValuePointPatchField<Type>,
|
||||
public codedBase
|
||||
{
|
||||
// Private static data
|
||||
|
||||
//- The keywords associated with source code
|
||||
static const wordList codeKeys_;
|
||||
|
||||
|
||||
// Private data
|
||||
|
||||
//- Dictionary contents for the boundary condition
|
||||
@ -128,15 +134,18 @@ class codedFixedValuePointPatchField
|
||||
//- Adapt the context for the current object
|
||||
virtual void prepare(dynamicCode&, const dynamicCodeContext&) const;
|
||||
|
||||
// Return a description (type + name) for the output
|
||||
//- Return a description (type + name) for the output
|
||||
virtual string description() const;
|
||||
|
||||
// Clear the ptr to the redirected object
|
||||
//- Clear the ptr to the redirected object
|
||||
virtual void clearRedirect() const;
|
||||
|
||||
// Get the dictionary to initialize the codeContext
|
||||
//- Get the dictionary to initialize the codeContext
|
||||
virtual const dictionary& codeDict() const;
|
||||
|
||||
//- Get the keywords associated with source code
|
||||
virtual const wordList& codeKeys() const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -127,6 +127,7 @@ bool Foam::combineFaces::validFace
|
||||
void Foam::combineFaces::regioniseFaces
|
||||
(
|
||||
const scalar minCos,
|
||||
const labelHashSet& patchIDs,
|
||||
const label celli,
|
||||
const labelList& cEdges,
|
||||
Map<label>& faceRegion
|
||||
@ -145,9 +146,15 @@ void Foam::combineFaces::regioniseFaces
|
||||
label p1 = patches.whichPatch(f1);
|
||||
|
||||
// Face can be merged if
|
||||
// - same non-coupled patch
|
||||
// - same non-coupled patch in list
|
||||
// - small angle
|
||||
if (p0 != -1 && p0 == p1 && !patches[p0].coupled())
|
||||
if
|
||||
(
|
||||
p0 != -1
|
||||
&& p0 == p1
|
||||
&& !patches[p0].coupled()
|
||||
&& patchIDs.found(p0)
|
||||
)
|
||||
{
|
||||
vector f0Normal = mesh_.faceAreas()[f0];
|
||||
f0Normal /= mag(f0Normal);
|
||||
@ -298,6 +305,7 @@ Foam::labelListList Foam::combineFaces::getMergeSets
|
||||
(
|
||||
const scalar featureCos,
|
||||
const scalar minConcaveCos,
|
||||
const labelHashSet& patchIDs,
|
||||
const labelHashSet& boundaryCells
|
||||
) const
|
||||
{
|
||||
@ -317,7 +325,7 @@ Foam::labelListList Foam::combineFaces::getMergeSets
|
||||
|
||||
// Region per face
|
||||
Map<label> faceRegion(cFaces.size());
|
||||
regioniseFaces(featureCos, celli, cEdges, faceRegion);
|
||||
regioniseFaces(featureCos, patchIDs, celli, cEdges, faceRegion);
|
||||
|
||||
// Now we have in faceRegion for every face the region with planar
|
||||
// face sharing the same region. We now check whether the resulting
|
||||
@ -381,7 +389,8 @@ Foam::labelListList Foam::combineFaces::getMergeSets
|
||||
Foam::labelListList Foam::combineFaces::getMergeSets
|
||||
(
|
||||
const scalar featureCos,
|
||||
const scalar minConcaveCos
|
||||
const scalar minConcaveCos,
|
||||
const labelHashSet& patchIDs
|
||||
) const
|
||||
{
|
||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
@ -389,9 +398,9 @@ Foam::labelListList Foam::combineFaces::getMergeSets
|
||||
// Pick up all cells on boundary
|
||||
labelHashSet boundaryCells(mesh_.nFaces()-mesh_.nInternalFaces());
|
||||
|
||||
forAll(patches, patchi)
|
||||
forAllConstIter(labelHashSet, patchIDs, iter)
|
||||
{
|
||||
const polyPatch& patch = patches[patchi];
|
||||
const polyPatch& patch = patches[iter.key()];
|
||||
|
||||
if (!patch.coupled())
|
||||
{
|
||||
@ -402,7 +411,20 @@ Foam::labelListList Foam::combineFaces::getMergeSets
|
||||
}
|
||||
}
|
||||
|
||||
return getMergeSets(featureCos, minConcaveCos, boundaryCells);
|
||||
return getMergeSets(featureCos, minConcaveCos, patchIDs, boundaryCells);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Foam::labelListList Foam::combineFaces::getMergeSets
|
||||
(
|
||||
const scalar featureCos,
|
||||
const scalar minConcaveCos
|
||||
) const
|
||||
{
|
||||
const labelHashSet patchIDs(identity(mesh_.boundaryMesh().size()));
|
||||
|
||||
return getMergeSets(featureCos, minConcaveCos, patchIDs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -101,6 +101,7 @@ class combineFaces
|
||||
void regioniseFaces
|
||||
(
|
||||
const scalar minCos,
|
||||
const labelHashSet& patchIDs,
|
||||
const label celli,
|
||||
const labelList& cEdges,
|
||||
Map<label>& faceRegion
|
||||
@ -153,14 +154,24 @@ public:
|
||||
// Helper functions
|
||||
|
||||
//- Extract lists of all (non-coupled) boundary faces on selected
|
||||
// cells that can be merged. Uses getFaceRegions.
|
||||
// patches and cells that can be merged. Uses getFaceRegions.
|
||||
labelListList getMergeSets
|
||||
(
|
||||
const scalar featureCos,
|
||||
const scalar minConcaveCos,
|
||||
const labelHashSet& patchIDs,
|
||||
const labelHashSet& boundaryCells
|
||||
) const;
|
||||
|
||||
//- Extract lists of all (non-coupled) boundary faces on selected
|
||||
// patches that can be merged. Uses getFaceRegions.
|
||||
labelListList getMergeSets
|
||||
(
|
||||
const scalar featureCos,
|
||||
const scalar minConcaveCos,
|
||||
const labelHashSet& patchIDs
|
||||
) const;
|
||||
|
||||
//- Extract lists of all (non-coupled) boundary faces that can
|
||||
// be merged. Uses getFaceRegions.
|
||||
labelListList getMergeSets
|
||||
|
||||
@ -31,15 +31,22 @@ License
|
||||
#include "dynamicCodeContext.H"
|
||||
#include "stringOps.H"
|
||||
|
||||
// * * * * * * * * * * * * Private Static Data Members * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
const Foam::wordList Foam::codedFixedValueFvPatchField<Type>::codeKeys_ =
|
||||
{"code", "codeInclude", "localCode"};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
const Foam::word Foam::codedFixedValueFvPatchField<Type>::codeTemplateC
|
||||
= "fixedValueFvPatchFieldTemplate.C";
|
||||
const Foam::word Foam::codedFixedValueFvPatchField<Type>::codeTemplateC =
|
||||
"fixedValueFvPatchFieldTemplate.C";
|
||||
|
||||
template<class Type>
|
||||
const Foam::word Foam::codedFixedValueFvPatchField<Type>::codeTemplateH
|
||||
= "fixedValueFvPatchFieldTemplate.H";
|
||||
const Foam::word Foam::codedFixedValueFvPatchField<Type>::codeTemplateH =
|
||||
"fixedValueFvPatchFieldTemplate.H";
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
@ -153,6 +160,13 @@ const
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
const Foam::wordList& Foam::codedFixedValueFvPatchField<Type>::codeKeys() const
|
||||
{
|
||||
return codeKeys_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::string Foam::codedFixedValueFvPatchField<Type>::description() const
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -103,6 +103,12 @@ class codedFixedValueFvPatchField
|
||||
public fixedValueFvPatchField<Type>,
|
||||
public codedBase
|
||||
{
|
||||
// Private static data
|
||||
|
||||
//- The keywords associated with source code
|
||||
static const wordList codeKeys_;
|
||||
|
||||
|
||||
// Private data
|
||||
|
||||
//- Dictionary contents for the boundary condition
|
||||
@ -126,15 +132,18 @@ class codedFixedValueFvPatchField
|
||||
//- Adapt the context for the current object
|
||||
virtual void prepare(dynamicCode&, const dynamicCodeContext&) const;
|
||||
|
||||
// Return a description (type + name) for the output
|
||||
//- Return a description (type + name) for the output
|
||||
virtual string description() const;
|
||||
|
||||
// Clear the ptr to the redirected object
|
||||
//- Clear the ptr to the redirected object
|
||||
virtual void clearRedirect() const;
|
||||
|
||||
// Get the dictionary to initialize the codeContext
|
||||
//- Get the dictionary to initialize the codeContext
|
||||
virtual const dictionary& codeDict() const;
|
||||
|
||||
//- Get the keywords associated with source code
|
||||
virtual const wordList& codeKeys() const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -31,15 +31,22 @@ License
|
||||
#include "dynamicCodeContext.H"
|
||||
#include "stringOps.H"
|
||||
|
||||
// * * * * * * * * * * * * Private Static Data Members * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
const Foam::wordList Foam::codedMixedFvPatchField<Type>::codeKeys_ =
|
||||
{"code", "codeInclude", "localCode"};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
const Foam::word Foam::codedMixedFvPatchField<Type>::codeTemplateC
|
||||
= "mixedFvPatchFieldTemplate.C";
|
||||
const Foam::word Foam::codedMixedFvPatchField<Type>::codeTemplateC =
|
||||
"mixedFvPatchFieldTemplate.C";
|
||||
|
||||
template<class Type>
|
||||
const Foam::word Foam::codedMixedFvPatchField<Type>::codeTemplateH
|
||||
= "mixedFvPatchFieldTemplate.H";
|
||||
const Foam::word Foam::codedMixedFvPatchField<Type>::codeTemplateH =
|
||||
"mixedFvPatchFieldTemplate.H";
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
@ -153,6 +160,13 @@ const
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
const Foam::wordList& Foam::codedMixedFvPatchField<Type>::codeKeys() const
|
||||
{
|
||||
return codeKeys_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::string Foam::codedMixedFvPatchField<Type>::description() const
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -113,6 +113,12 @@ class codedMixedFvPatchField
|
||||
public mixedFvPatchField<Type>,
|
||||
public codedBase
|
||||
{
|
||||
// Private static data
|
||||
|
||||
//- The keywords associated with source code
|
||||
static const wordList codeKeys_;
|
||||
|
||||
|
||||
// Private data
|
||||
|
||||
//- Dictionary contents for the boundary condition
|
||||
@ -136,15 +142,18 @@ class codedMixedFvPatchField
|
||||
//- Adapt the context for the current object
|
||||
virtual void prepare(dynamicCode&, const dynamicCodeContext&) const;
|
||||
|
||||
// Return a description (type + name) for the output
|
||||
//- Return a description (type + name) for the output
|
||||
virtual string description() const;
|
||||
|
||||
// Clear the ptr to the redirected object
|
||||
//- Clear the ptr to the redirected object
|
||||
virtual void clearRedirect() const;
|
||||
|
||||
// Get the dictionary to initialize the codeContext
|
||||
//- Get the dictionary to initialize the codeContext
|
||||
virtual const dictionary& codeDict() const;
|
||||
|
||||
//- Get the keywords associated with source code
|
||||
virtual const wordList& codeKeys() const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -33,6 +33,20 @@ License
|
||||
#include "stringOps.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * Protected Static Data Members * * * * * * * * * * * //
|
||||
|
||||
const Foam::wordList Foam::codedFunctionObject::codeKeys_ =
|
||||
{
|
||||
"codeData",
|
||||
"codeEnd",
|
||||
"codeExecute",
|
||||
"codeInclude",
|
||||
"codeRead",
|
||||
"codeWrite",
|
||||
"localCode"
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
@ -47,6 +61,7 @@ namespace Foam
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::codedFunctionObject::prepare
|
||||
@ -55,13 +70,7 @@ void Foam::codedFunctionObject::prepare
|
||||
const dynamicCodeContext& context
|
||||
) const
|
||||
{
|
||||
// Set additional rewrite rules
|
||||
dynCode.setFilterVariable("typeName", name_);
|
||||
dynCode.setFilterVariable("codeData", codeData_);
|
||||
dynCode.setFilterVariable("codeRead", codeRead_);
|
||||
dynCode.setFilterVariable("codeExecute", codeExecute_);
|
||||
dynCode.setFilterVariable("codeWrite", codeWrite_);
|
||||
dynCode.setFilterVariable("codeEnd", codeEnd_);
|
||||
|
||||
// Compile filtered C template
|
||||
dynCode.addCompileFile("functionObjectTemplate.C");
|
||||
@ -114,6 +123,12 @@ const Foam::dictionary& Foam::codedFunctionObject::codeDict() const
|
||||
}
|
||||
|
||||
|
||||
const Foam::wordList& Foam::codedFunctionObject::codeKeys() const
|
||||
{
|
||||
return codeKeys_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::codedFunctionObject::codedFunctionObject
|
||||
@ -129,9 +144,6 @@ Foam::codedFunctionObject::codedFunctionObject
|
||||
dict_(dict)
|
||||
{
|
||||
read(dict_);
|
||||
|
||||
updateLibrary(name_);
|
||||
redirectFunctionObject();
|
||||
}
|
||||
|
||||
|
||||
@ -184,114 +196,15 @@ bool Foam::codedFunctionObject::end()
|
||||
|
||||
bool Foam::codedFunctionObject::read(const dictionary& dict)
|
||||
{
|
||||
// Backward compatibility
|
||||
if (dict.found("redirectType"))
|
||||
// The name keyword is "name". "redirectType" is also maintained here
|
||||
// for backwards compatibility, but "name" is taken in preference and
|
||||
// is printed in the error message if neither keyword is present.
|
||||
name_ = word::null;
|
||||
name_ = dict.lookupOrDefault("redirectType", name_);
|
||||
name_ = dict.lookupOrDefault("name", name_);
|
||||
if (name_ == word::null)
|
||||
{
|
||||
dict.lookup("redirectType") >> name_;
|
||||
}
|
||||
else
|
||||
{
|
||||
dict.lookup("name") >> name_;
|
||||
}
|
||||
|
||||
const entry* dataPtr = dict.lookupEntryPtr
|
||||
(
|
||||
"codeData",
|
||||
false,
|
||||
false
|
||||
);
|
||||
if (dataPtr)
|
||||
{
|
||||
codeData_ = stringOps::trim(dataPtr->stream());
|
||||
stringOps::inplaceExpand(codeData_, dict);
|
||||
dynamicCodeContext::addLineDirective
|
||||
(
|
||||
codeData_,
|
||||
dataPtr->startLineNumber(),
|
||||
dict.name()
|
||||
);
|
||||
}
|
||||
|
||||
const entry* readPtr = dict.lookupEntryPtr
|
||||
(
|
||||
"codeRead",
|
||||
false,
|
||||
false
|
||||
);
|
||||
if (readPtr)
|
||||
{
|
||||
codeRead_ = stringOps::trim(readPtr->stream());
|
||||
stringOps::inplaceExpand(codeRead_, dict);
|
||||
dynamicCodeContext::addLineDirective
|
||||
(
|
||||
codeRead_,
|
||||
readPtr->startLineNumber(),
|
||||
dict.name()
|
||||
);
|
||||
}
|
||||
|
||||
const entry* execPtr = dict.lookupEntryPtr
|
||||
(
|
||||
"codeExecute",
|
||||
false,
|
||||
false
|
||||
);
|
||||
if (execPtr)
|
||||
{
|
||||
codeExecute_ = stringOps::trim(execPtr->stream());
|
||||
stringOps::inplaceExpand(codeExecute_, dict);
|
||||
dynamicCodeContext::addLineDirective
|
||||
(
|
||||
codeExecute_,
|
||||
execPtr->startLineNumber(),
|
||||
dict.name()
|
||||
);
|
||||
}
|
||||
|
||||
const entry* writePtr = dict.lookupEntryPtr
|
||||
(
|
||||
"codeWrite",
|
||||
false,
|
||||
false
|
||||
);
|
||||
if (writePtr)
|
||||
{
|
||||
codeWrite_ = stringOps::trim(writePtr->stream());
|
||||
stringOps::inplaceExpand(codeWrite_, dict);
|
||||
dynamicCodeContext::addLineDirective
|
||||
(
|
||||
codeWrite_,
|
||||
writePtr->startLineNumber(),
|
||||
dict.name()
|
||||
);
|
||||
}
|
||||
|
||||
const entry* endPtr = dict.lookupEntryPtr
|
||||
(
|
||||
"codeEnd",
|
||||
false,
|
||||
false
|
||||
);
|
||||
if (endPtr)
|
||||
{
|
||||
codeEnd_ = stringOps::trim(endPtr->stream());
|
||||
stringOps::inplaceExpand(codeEnd_, dict);
|
||||
dynamicCodeContext::addLineDirective
|
||||
(
|
||||
codeEnd_,
|
||||
endPtr->startLineNumber(),
|
||||
dict.name()
|
||||
);
|
||||
}
|
||||
|
||||
if(!dataPtr && !readPtr && !execPtr && !writePtr && !endPtr)
|
||||
{
|
||||
IOWarningInFunction
|
||||
(
|
||||
dict
|
||||
) << "No critical \"code\" prefixed keywords were found."
|
||||
<< " Please check the code documentation for more details."
|
||||
<< nl << endl;
|
||||
dict.lookup("name"); // <-- generate error message with "name" in it
|
||||
}
|
||||
|
||||
updateLibrary(name_);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -90,6 +90,12 @@ class codedFunctionObject
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected static data
|
||||
|
||||
//- The keywords associated with source code
|
||||
static const wordList codeKeys_;
|
||||
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Reference to the time database
|
||||
@ -98,14 +104,9 @@ protected:
|
||||
//- Input dictionary
|
||||
dictionary dict_;
|
||||
|
||||
//- The name
|
||||
word name_;
|
||||
|
||||
string codeData_;
|
||||
string codeRead_;
|
||||
string codeExecute_;
|
||||
string codeWrite_;
|
||||
string codeEnd_;
|
||||
|
||||
//- Underlying functionObject
|
||||
mutable autoPtr<functionObject> redirectFunctionObjectPtr_;
|
||||
|
||||
@ -118,15 +119,18 @@ protected:
|
||||
//- Adapt the context for the current object
|
||||
virtual void prepare(dynamicCode&, const dynamicCodeContext&) const;
|
||||
|
||||
// Return a description (type + name) for the output
|
||||
//- Return a description (type + name) for the output
|
||||
virtual string description() const;
|
||||
|
||||
// Clear any redirected objects
|
||||
//- Clear any redirected objects
|
||||
virtual void clearRedirect() const;
|
||||
|
||||
// Get the dictionary to initialize the codeContext
|
||||
//- Get the dictionary to initialize the codeContext
|
||||
virtual const dictionary& codeDict() const;
|
||||
|
||||
//- Get the keywords associated with source code
|
||||
virtual const wordList& codeKeys() const;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,6 +29,13 @@ License
|
||||
#include "dynamicCode.H"
|
||||
#include "dynamicCodeContext.H"
|
||||
|
||||
// * * * * * * * * * * * Protected Static Data Members * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
const Foam::wordList Foam::fv::CodedSource<Type>::codeKeys_ =
|
||||
{"codeAddSup", "codeCorrect", "codeInclude", "codeSetValue", "localCode"};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
@ -45,11 +52,6 @@ void Foam::fv::CodedSource<Type>::prepare
|
||||
dynCode.setFilterVariable("TemplateType", sourceType);
|
||||
dynCode.setFilterVariable("SourceType", sourceType + "Source");
|
||||
|
||||
// dynCode.removeFilterVariable("code");
|
||||
dynCode.setFilterVariable("codeCorrect", codeCorrect_);
|
||||
dynCode.setFilterVariable("codeAddSup", codeAddSup_);
|
||||
dynCode.setFilterVariable("codeSetValue", codeSetValue_);
|
||||
|
||||
// compile filtered C template
|
||||
dynCode.addCompileFile("codedFvOptionTemplate.C");
|
||||
|
||||
@ -108,6 +110,13 @@ const Foam::dictionary& Foam::fv::CodedSource<Type>::codeDict() const
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
const Foam::wordList& Foam::fv::CodedSource<Type>::codeKeys() const
|
||||
{
|
||||
return codeKeys_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -89,15 +89,6 @@ Usage
|
||||
#{
|
||||
Pout<< "**codeSetValue**" << endl;
|
||||
#};
|
||||
|
||||
// Dummy entry. Make dependent on above to trigger recompilation
|
||||
code
|
||||
#{
|
||||
$codeInclude
|
||||
$codeCorrect
|
||||
$codeAddSup
|
||||
$codeSetValue
|
||||
#};
|
||||
}
|
||||
|
||||
sourceTimeCoeffs
|
||||
@ -136,17 +127,19 @@ class CodedSource
|
||||
public cellSetOption,
|
||||
public codedBase
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected static data
|
||||
|
||||
//- The keywords associated with source code
|
||||
static const wordList codeKeys_;
|
||||
|
||||
|
||||
// Protected data
|
||||
|
||||
//- The name
|
||||
word name_;
|
||||
|
||||
string codeCorrect_;
|
||||
string codeAddSup_;
|
||||
string codeSetValue_;
|
||||
|
||||
//- Underlying functionObject
|
||||
mutable autoPtr<option> redirectFvOptionPtr_;
|
||||
|
||||
@ -159,15 +152,18 @@ protected:
|
||||
//- Adapt the context for the current object
|
||||
virtual void prepare(dynamicCode&, const dynamicCodeContext&) const;
|
||||
|
||||
// Return a description (type + name) for the output
|
||||
//- Return a description (type + name) for the output
|
||||
virtual string description() const;
|
||||
|
||||
// Clear any redirected objects
|
||||
//- Clear any redirected objects
|
||||
virtual void clearRedirect() const;
|
||||
|
||||
// Get the dictionary to initialize the codeContext
|
||||
//- Get the dictionary to initialize the codeContext
|
||||
virtual const dictionary& codeDict() const;
|
||||
|
||||
//- Get the keywords associated with source code
|
||||
virtual const wordList& codeKeys() const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -36,67 +36,18 @@ bool Foam::fv::CodedSource<Type>::read(const dictionary& dict)
|
||||
coeffs_.lookup("fields") >> fieldNames_;
|
||||
applied_.setSize(fieldNames_.size(), false);
|
||||
|
||||
// Backward compatibility
|
||||
if (dict.found("redirectType"))
|
||||
// The name keyword is "name". "redirectType" is also maintained here
|
||||
// for backwards compatibility, but "name" is taken in preference and
|
||||
// is printed in the error message if neither keyword is present.
|
||||
name_ = word::null;
|
||||
name_ = dict.lookupOrDefault("redirectType", name_);
|
||||
name_ = dict.lookupOrDefault("name", name_);
|
||||
if (name_ == word::null)
|
||||
{
|
||||
dict.lookup("redirectType") >> name_;
|
||||
}
|
||||
else
|
||||
{
|
||||
dict.lookup("name") >> name_;
|
||||
dict.lookup("name"); // <-- generate error message with "name" in it
|
||||
}
|
||||
|
||||
// Code snippets
|
||||
{
|
||||
const entry& e = coeffs_.lookupEntry
|
||||
(
|
||||
"codeCorrect",
|
||||
false,
|
||||
false
|
||||
);
|
||||
codeCorrect_ = stringOps::trim(e.stream());
|
||||
stringOps::inplaceExpand(codeCorrect_, coeffs_);
|
||||
dynamicCodeContext::addLineDirective
|
||||
(
|
||||
codeCorrect_,
|
||||
e.startLineNumber(),
|
||||
coeffs_.name()
|
||||
);
|
||||
}
|
||||
|
||||
{
|
||||
const entry& e = coeffs_.lookupEntry
|
||||
(
|
||||
"codeAddSup",
|
||||
false,
|
||||
false
|
||||
);
|
||||
codeAddSup_ = stringOps::trim(e.stream());
|
||||
stringOps::inplaceExpand(codeAddSup_, coeffs_);
|
||||
dynamicCodeContext::addLineDirective
|
||||
(
|
||||
codeAddSup_,
|
||||
e.startLineNumber(),
|
||||
coeffs_.name()
|
||||
);
|
||||
}
|
||||
|
||||
{
|
||||
const entry& e = coeffs_.lookupEntry
|
||||
(
|
||||
"codeSetValue",
|
||||
false,
|
||||
false
|
||||
);
|
||||
codeSetValue_ = stringOps::trim(e.stream());
|
||||
stringOps::inplaceExpand(codeSetValue_, coeffs_);
|
||||
dynamicCodeContext::addLineDirective
|
||||
(
|
||||
codeSetValue_,
|
||||
e.startLineNumber(),
|
||||
coeffs_.name()
|
||||
);
|
||||
}
|
||||
updateLibrary(name_);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -997,7 +997,7 @@ public:
|
||||
(
|
||||
const scalar minCos,
|
||||
const scalar concaveCos,
|
||||
const labelList& patchIDs,
|
||||
const labelHashSet& patchIDs,
|
||||
const dictionary& motionDict,
|
||||
const labelList& preserveFaces
|
||||
);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -248,7 +248,7 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo
|
||||
(
|
||||
const scalar minCos,
|
||||
const scalar concaveCos,
|
||||
const labelList& patchIDs,
|
||||
const labelHashSet& patchIDs,
|
||||
const dictionary& motionDict,
|
||||
const labelList& preserveFaces
|
||||
)
|
||||
@ -256,28 +256,6 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo
|
||||
// Patch face merging engine
|
||||
combineFaces faceCombiner(mesh_, true);
|
||||
|
||||
// Pick up all candidate cells on boundary
|
||||
labelHashSet boundaryCells(mesh_.nFaces()-mesh_.nInternalFaces());
|
||||
|
||||
{
|
||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
|
||||
forAll(patchIDs, i)
|
||||
{
|
||||
label patchi = patchIDs[i];
|
||||
|
||||
const polyPatch& patch = patches[patchi];
|
||||
|
||||
if (!patch.coupled())
|
||||
{
|
||||
forAll(patch, i)
|
||||
{
|
||||
boundaryCells.insert(mesh_.faceOwner()[patch.start()+i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get all sets of faces that can be merged. Since only faces on the same
|
||||
// patch get merged there is no risk of e.g. patchID faces getting merged
|
||||
// with original patches (or even processor patches). There is a risk
|
||||
@ -285,12 +263,7 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo
|
||||
// angle. Would be pretty weird starting mesh though.
|
||||
labelListList allFaceSets
|
||||
(
|
||||
faceCombiner.getMergeSets
|
||||
(
|
||||
minCos,
|
||||
concaveCos,
|
||||
boundaryCells
|
||||
)
|
||||
faceCombiner.getMergeSets(minCos, concaveCos, patchIDs)
|
||||
);
|
||||
|
||||
// Filter out any set that contains any preserveFace
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -114,6 +114,17 @@ Foam::layerParameters::layerParameters
|
||||
boundaryMesh.size(),
|
||||
readScalar(dict.lookup("minThickness"))
|
||||
),
|
||||
mergeFaces_
|
||||
(
|
||||
boundaryMesh.size(),
|
||||
dict.found("mergeFaces")
|
||||
? (
|
||||
dict.lookupType<bool>("mergeFaces")
|
||||
? mergeFace::yes
|
||||
: mergeFace::no
|
||||
)
|
||||
: mergeFace::ifOnMeshedPatch
|
||||
),
|
||||
featureAngle_(readScalar(dict.lookup("featureAngle"))),
|
||||
concaveAngle_
|
||||
(
|
||||
@ -361,6 +372,14 @@ Foam::layerParameters::layerParameters
|
||||
"minThickness",
|
||||
minThickness_[patchi]
|
||||
);
|
||||
|
||||
if (layerDict.found("mergeFaces"))
|
||||
{
|
||||
mergeFaces_[patchi] =
|
||||
layerDict.lookupType<bool>("mergeFaces")
|
||||
? mergeFace::yes
|
||||
: mergeFace::no;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -76,6 +76,16 @@ public:
|
||||
TOTAL_AND_EXPANSION
|
||||
};
|
||||
|
||||
//- Enumeration defining whether to merge faces on a given patch. Read
|
||||
// as a boolean (no/yes). Defaults to merging only on patches which
|
||||
// were meshed/snapped to (ifOnMeshedPatch).
|
||||
enum class mergeFace
|
||||
{
|
||||
no,
|
||||
ifOnMeshedPatch,
|
||||
yes
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -112,6 +122,9 @@ private:
|
||||
//- Minimum total thickness
|
||||
scalarField minThickness_;
|
||||
|
||||
//- Whether to merge boundary faces of the same layer cell
|
||||
List<mergeFace> mergeFaces_;
|
||||
|
||||
|
||||
scalar featureAngle_;
|
||||
|
||||
@ -225,6 +238,12 @@ public:
|
||||
return minThickness_;
|
||||
}
|
||||
|
||||
//- Whether to merge boundary faces of the same layer cell
|
||||
const List<mergeFace>& mergeFaces() const
|
||||
{
|
||||
return mergeFaces_;
|
||||
}
|
||||
|
||||
|
||||
// Control
|
||||
|
||||
|
||||
@ -2832,11 +2832,25 @@ void Foam::snappyLayerDriver::mergePatchFacesUndo
|
||||
duplicateFace[cpl[1]] = cpl[0];
|
||||
}
|
||||
|
||||
// Get a set of which patches are to have faces merged
|
||||
labelHashSet patchIDs(meshRefiner_.meshedPatches());
|
||||
forAll(mesh.boundaryMesh(), patchi)
|
||||
{
|
||||
if (layerParams.mergeFaces()[patchi] == layerParameters::mergeFace::no)
|
||||
{
|
||||
patchIDs.unset(patchi);
|
||||
}
|
||||
if (layerParams.mergeFaces()[patchi] == layerParameters::mergeFace::yes)
|
||||
{
|
||||
patchIDs.set(patchi);
|
||||
}
|
||||
}
|
||||
|
||||
label nChanged = meshRefiner_.mergePatchFacesUndo
|
||||
(
|
||||
minCos,
|
||||
concaveCos,
|
||||
meshRefiner_.meshedPatches(),
|
||||
patchIDs,
|
||||
motionDict,
|
||||
duplicateFace
|
||||
);
|
||||
|
||||
@ -91,7 +91,6 @@ meshQualityControls
|
||||
|
||||
writeFlags
|
||||
(
|
||||
noRefinement
|
||||
// scalarLevels
|
||||
// layerSets
|
||||
// layerFields
|
||||
|
||||
Reference in New Issue
Block a user