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 -------------------------------------------------------------------------------
10 License
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 
30 template<class Type>
32 {
33  if (selectionMode_ != selectionModeType::smAll)
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 * * * * * * * * * * * * * //
48 
49 inline Foam::scalar Foam::fa::faceSetOption::timeStart() const noexcept
50 {
51  return timeStart_;
52 }
53 
54 
55 inline Foam::scalar Foam::fa::faceSetOption::duration() const noexcept
56 {
57  return duration_;
58 }
59 
60 
61 inline 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 
77 {
78  return selectionMode_;
79 }
80 
81 
82 inline const Foam::wordRes&
84 {
85  return selectionNames_;
86 }
87 
88 
90 {
91  return (selectionNames_.empty() ? wordRe::null : selectionNames_.first());
92 }
93 
94 
96 {
97  return selectionMode_ != selectionModeType::smAll;
98 }
99 
101 inline Foam::scalar Foam::fa::faceSetOption::A() const noexcept
102 {
103  return A_;
104 }
105 
108 {
109  return faces_;
110 }
111 
112 
113 inline Foam::scalar Foam::fa::faceSetOption::timeStart(scalar val) noexcept
114 {
115  scalar old(timeStart_);
116  timeStart_ = val;
117  return old;
118 }
119 
120 
121 inline Foam::scalar Foam::fa::faceSetOption::duration(scalar val) noexcept
122 {
123  scalar old(duration_);
124  duration_ = val;
125  return old;
126 }
127 
128 
129 // ************************************************************************* //
rDeltaTY field()
scalar timeStart() const noexcept
Return const access to the time start.
const wordRes & selectionNames() const noexcept
Return const access to the selection names (set, zone or patch selection)
const wordRe & zoneName() const
Return const access to the first set/zone/patch name.
selectionModeType selectionMode() const noexcept
Return the face selection mode.
scalar A() const noexcept
Return const access to the total face area.
bool useSubMesh() const noexcept
True if sub-selection should be used.
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:53
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings...
Definition: wordRe.H:78
const labelList & faces() const noexcept
Return const access to the local finite-area face selection.
const direction noexcept
Definition: Scalar.H:258
bool inTimeLimits(const scalar timeValue) const
Return true if within time limits.
scalar duration() const noexcept
Return const access to the duration.
selectionModeType selectionMode_
Face selection mode.
void subsetFilter(List< Type > &field) const
Zero all non-selected locations within field.
selectionModeType
Enumeration for selection mode types.
static const wordRe null
An empty wordRe.
Definition: wordRe.H:97
labelList faces_
Set of faces to apply source to.
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127