STYLE: return Switch by value, not const-reference

This commit is contained in:
Mark Olesen
2020-02-21 11:44:29 +01:00
parent 86fe2b7bc9
commit 4e6caf8d61
23 changed files with 87 additions and 78 deletions

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -212,7 +213,7 @@ void Foam::attachDetach::checkDefinition()
if
(
!triggersOK
|| (triggerTimes_.empty() && !manualTrigger())
|| (triggerTimes_.empty() && !manualTrigger_)
)
{
FatalErrorInFunction
@ -249,9 +250,9 @@ Foam::attachDetach::attachDetach
masterPatchID_(masterPatchName, mme.mesh().boundaryMesh()),
slavePatchID_(slavePatchName, mme.mesh().boundaryMesh()),
triggerTimes_(triggerTimes),
manualTrigger_(manualTrigger),
triggerIndex_(0),
state_(UNKNOWN),
manualTrigger_(manualTrigger),
trigger_(false),
pointMatchMapPtr_(nullptr)
{
@ -285,9 +286,9 @@ Foam::attachDetach::attachDetach
mme.mesh().boundaryMesh()
),
triggerTimes_(dict.lookup("triggerTimes")),
manualTrigger_(dict.lookup("manualTrigger")),
triggerIndex_(0),
state_(UNKNOWN),
manualTrigger_(dict.get<bool>("manualTrigger")),
trigger_(false),
pointMatchMapPtr_(nullptr)
{
@ -337,7 +338,7 @@ bool Foam::attachDetach::setDetach() const
bool Foam::attachDetach::changeTopology() const
{
if (manualTrigger())
if (manualTrigger_)
{
if (debug)
{
@ -473,7 +474,7 @@ void Foam::attachDetach::writeDict(Ostream& os) const
os.writeEntry("masterPatchName", masterPatchID_.name());
os.writeEntry("slavePatchName", slavePatchID_.name());
os.writeEntry("triggerTimes", triggerTimes_);
os.writeEntry("manualTrigger", manualTrigger());
os.writeEntry("manualTrigger", Switch::name(manualTrigger_));
os.writeEntry("active", active());
os.endBlock();

View File

@ -88,15 +88,15 @@ class attachDetach
//- List of trigger times
scalarField triggerTimes_;
//- Use manual trigger
Switch manualTrigger_;
//- Trigger time index
mutable label triggerIndex_;
//- State of the modifier
mutable modifierState state_;
//- Use manual trigger
bool manualTrigger_;
//- Attach/detach trigger
mutable bool trigger_;
@ -197,7 +197,8 @@ public:
return state_ == ATTACHED;
}
const Switch& manualTrigger() const
//- Is manually triggered?
bool manualTrigger() const
{
return manualTrigger_;
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -126,9 +127,7 @@ public:
inline const dictionary& meshQualityCoeffDict() const;
inline const Switch& controlMeshQuality() const;
inline Switch controlMeshQuality() const;
inline const scalar& minLen() const;

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -46,8 +47,7 @@ Foam::polyMeshFilterSettings::meshQualityCoeffDict() const
}
inline const Foam::Switch&
Foam::polyMeshFilterSettings::controlMeshQuality() const
inline Foam::Switch Foam::polyMeshFilterSettings::controlMeshQuality() const
{
return controlMeshQuality_;
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -180,7 +181,8 @@ public:
// Activation and deactivation
const Switch& active() const
//- If modifier activate?
Switch active() const
{
return active_;
}