externalDisplacementMeshMover.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2013-2026 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 #include "polyTopoChangeMap.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
35 }
36 
37 
38 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
39 
41 (
42  const dictionary& dict,
43  const List<labelPair>& baffles,
44  pointVectorField& pointDisplacement
45 )
46 :
47  baffles_(baffles),
48  pointDisplacement_(pointDisplacement)
49 {}
50 
51 
52 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
53 
56 (
57  const word& type,
58  const dictionary& dict,
59  const List<labelPair>& baffles,
60  pointVectorField& pointDisplacement
61 )
62 {
64  << "Selecting externalDisplacementMeshMover " << type << endl;
65 
66  dictionaryConstructorTable::iterator cstrIter =
67  dictionaryConstructorTablePtr_->find(type);
68 
69  if (cstrIter == dictionaryConstructorTablePtr_->end())
70  {
72  << "Unknown externalDisplacementMeshMover type "
73  << type << nl << nl
74  << "Valid externalDisplacementMeshMover types:" << endl
75  << dictionaryConstructorTablePtr_->sortedToc()
76  << exit(FatalError);
77  }
78 
80  (
81  cstrIter()(dict, baffles, pointDisplacement)
82  );
83 }
84 
85 
86 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
87 
89 {}
90 
91 
92 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
93 
95 {
96  // No local data to update
97 }
98 
99 
101 (
102  const polyTopoChangeMap& map
103 )
104 {
105  // Renumber baffles
106  DynamicList<labelPair> newBaffles(baffles_.size());
107  forAll(baffles_, i)
108  {
109  label f0 = map.reverseFaceMap()[baffles_[i].first()];
110  label f1 = map.reverseFaceMap()[baffles_[i].second()];
111 
112  if (f0 >= 0 && f1 >= 0)
113  {
114  newBaffles.append(labelPair(f0, f1));
115  }
116  }
117  newBaffles.shrink();
118  baffles_.transfer(newBaffles);
119 }
120 
121 
122 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:449
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:78
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
Definition: DynamicListI.H:296
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
Definition: DynamicListI.H:252
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Abstract base class for mesh movers with externally provided displacement field giving the boundary c...
virtual void topoChange(const polyTopoChangeMap &)
Update local data for topology changes.
static autoPtr< externalDisplacementMeshMover > New(const word &type, const dictionary &dict, const List< labelPair > &baffles, pointVectorField &pointDisplacement)
Return a reference to the selected meshMover model.
externalDisplacementMeshMover(const dictionary &dict, const List< labelPair > &baffles, pointVectorField &pointDisplacement)
Construct from dictionary and displacement field. Dictionary is.
virtual void movePoints(const pointField &)
Update local data for geometry changes.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelList & reverseFaceMap() const
Reverse face map.
A class for handling words, derived from string.
Definition: word.H:63
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Pair< label > labelPair
Label pair.
Definition: labelPair.H:48
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:288
messageStream Info
defineRunTimeSelectionTable(fvConstraint, dictionary)
Ostream & indentOrNl(Ostream &os)
Indent stream or add newline if indent level == 0.
Definition: Ostream.H:250
error FatalError
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
static const char nl
Definition: Ostream.H:297
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
dictionary dict