Loading...
Searching...
No Matches
faceSetOptionI.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2019-2022 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
28// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
29
30template<class Type>
32{
34 {
35 List<Type> filtered(field.size(), Zero);
36
37 for (const label facei : faces_)
38 {
39 filtered[facei] = field[facei];
40 }
41
42 field.swap(filtered);
43 }
44}
45
46
47// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
49inline Foam::scalar Foam::fa::faceSetOption::timeStart() const noexcept
50{
51 return timeStart_;
52}
53
55inline Foam::scalar Foam::fa::faceSetOption::duration() const noexcept
56{
57 return duration_;
58}
59
60
61inline bool Foam::fa::faceSetOption::inTimeLimits(const scalar timeValue) const
62{
63 return
64 (
65 (timeStart_ < 0)
66 ||
67 (
68 (mesh_.time().value() >= timeStart_)
69 && (mesh_.time().value() <= (timeStart_ + duration_))
70 )
71 );
72}
73
74
80
81
86}
87
90{
91 return (selectionNames_.empty() ? wordRe::null : selectionNames_.first());
92}
93
98}
99
101inline Foam::scalar Foam::fa::faceSetOption::A() const noexcept
102{
103 return A_;
104}
105
108{
109 return faces_;
110}
111
112
113inline Foam::scalar Foam::fa::faceSetOption::timeStart(scalar val) noexcept
115 scalar old(timeStart_);
116 timeStart_ = val;
117 return old;
118}
119
120
121inline Foam::scalar Foam::fa::faceSetOption::duration(scalar val) noexcept
122{
123 scalar old(duration_);
124 duration_ = val;
125 return old;
126}
127
128
129// ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
scalar timeStart() const noexcept
Return const access to the time start.
labelList faces_
Set of faces to apply source to.
scalar duration() const noexcept
Return const access to the duration.
void subsetFilter(List< Type > &field) const
Zero all non-selected locations within field.
wordRes selectionNames_
Face selection names (for set, zone or patch selections).
scalar A_
Sum of face area.
selectionModeType
Enumeration for selection mode types.
@ smAll
"all" finite-area faces
selectionModeType selectionMode() const noexcept
Return the face selection mode.
bool useSubMesh() const noexcept
True if sub-selection should be used.
scalar duration_
Duration.
scalar timeStart_
Time start.
const wordRe & zoneName() const
Return const access to the first set/zone/patch name.
selectionModeType selectionMode_
Face selection mode.
const labelList & faces() const noexcept
Return const access to the local finite-area face selection.
const wordRes & selectionNames() const noexcept
Return const access to the selection names (set, zone or patch selection).
scalar A() const noexcept
Return const access to the total face area.
bool inTimeLimits(const scalar timeValue) const
Return true if within time limits.
const fvMesh & mesh_
Reference to the mesh database.
Definition faOption.H:175
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
Definition wordRe.H:81
static const wordRe null
An empty wordRe.
Definition wordRe.H:97
A List of wordRe with additional matching capabilities.
Definition wordRes.H:56
rDeltaTY field()
List< label > labelList
A List of labels.
Definition List.H:62
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
const direction noexcept
Definition scalarImpl.H:265