File size: 8,457 Bytes
5a600cf | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | /*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2025 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::mappedPatchBaseBase
Description
Base class for engines and poly patches which provide mapping between two
poly patches
Example:
\verbatim
// The name of the region to map from. Optional. Defaults to the same
// region as the patch.
neighbourRegion region0;
// The name of the patch to map from
neighbourPatch movingWall;
// Couple group to specify the region and patch to map from. This is an
// alternative to specifying neighbourRegion and neighbourPatch
// directly, as shown above.
coupleGroup baffleGroup;
// The condition that triggers re-calculation following motion. Setting
// 'always' will re-calculate the mapping, 'never' will not, and
// 'detect' will compare the new and old points and re-calculate if
// there is any difference.
moveUpdate always;
\endverbatim
SourceFiles
mappedPatchBaseBase.C
\*---------------------------------------------------------------------------*/
#ifndef mappedPatchBaseBase_H
#define mappedPatchBaseBase_H
#include "coupleGroupIdentifier.H"
#include "cyclicTransform.H"
#include "polyMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class mappedPatchBaseBase Declaration
\*---------------------------------------------------------------------------*/
class mappedPatchBaseBase
{
public:
// Public types
//- The type of the transformation permitted/required by this patch
enum class transformType
{
none,
defaultNone,
specified
};
//- Enumeration for the condition that triggers re-calculation of the
// mapping following mesh motion.
//
// 'always' will re-calculate the mapping, 'never' will not, and
// 'detect' will compare the new and old points and re-calculate if
// there is any difference.
//
// The comparison that 'detect' does has an expense associated with it,
// so it should only really be used if the patch is both moving and
// static at different times. If the patch is always in motion or is
// fully stationary, then it is more efficient to specify 'always' or
// 'never'.
//
// 'always' is the default, as it is safest to assume that motion
// always affects the mapping.
enum class moveUpdate
{
always,
detect,
never
};
//- Names of the move-update conditions
static const NamedEnum<moveUpdate, 3> moveUpdateNames_;
protected:
// Protected data
//- Patch to map to
const polyPatch& patch_;
//- Couple group for the region/patch to map from
const coupleGroupIdentifier coupleGroup_;
//- Name of the region to map from
mutable word nbrRegionName_;
//- Name of the patch to map from
mutable word nbrPatchName_;
//- The transformation between the patches
mutable cyclicTransform transform_;
//- The condition that triggers re-calculation following motion
const moveUpdate moveUpdate_;
public:
//- Runtime type information
TypeName("mappedPatchBaseBase");
// Constructors
//- Construct from patch
mappedPatchBaseBase(const polyPatch&);
//- Construct from components
mappedPatchBaseBase
(
const polyPatch& pp,
const word& nbrRegionName,
const word& nbrPatchName,
const cyclicTransform& transform
);
//- Construct from dictionary
mappedPatchBaseBase
(
const polyPatch& pp,
const dictionary& dict,
const transformType tt
);
//- Construct as copy, resetting patch
mappedPatchBaseBase(const polyPatch&, const mappedPatchBaseBase&);
//- Destructor
virtual ~mappedPatchBaseBase();
// Member Functions
// Access
//- Name of the region to map from
inline const word& nbrRegionName() const;
//- Name of the patch to map from
inline const word& nbrPatchName() const;
//- The transformation between the patches
inline const transformer& transform() const;
//- Is the neighbour region the same as for this patch?
inline bool sameRegion() const;
//- Is the neighbour patch the same as this patch?
inline bool samePatch() const;
//- Is the neighbour patch the same as this patch with no transform?
inline bool sameUntransformedPatch() const;
//- Is the neighbour available?
bool haveNbr() const;
//- Get the mesh for the region to map from
const polyMesh& nbrMesh() const;
//- Get the patch to map from
const polyPatch& nbrPolyPatch() const;
// Casting
//- Restrict use of the mapper to certain configurations
struct from
{
static const label any = 0;
static const label sameRegion = 1;
static const label differentRegion = 2;
static const label differentPatch = 4;
};
//- Validate that the map exists and is appropriate for the given
// set of permitted configurations
template<class PatchField, class FieldType>
static void validateMapForField
(
const PatchField& field,
const FieldType& iF,
const dictionary& context,
const label froms = from::any
);
//- Validate that the map is appropriate for the given
// set of permitted configurations
template<class PatchField, class FieldType>
void validateForField
(
const PatchField& field,
const FieldType& iF,
const dictionary& context,
const label froms = from::any
) const;
//- Return whether or not the patches have moved
static bool moving
(
const polyPatch& patch,
const polyPatch& nbrPatch
);
// I/O
//- Return whether or not the given dictionary contains a
// mappedPatchBaseBase specification
static bool specified(const dictionary& dict);
//- Write as a dictionary
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "mappedPatchBaseBaseI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "mappedPatchBaseBaseTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
|