list_pointMeshMover.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) 2019-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 
26 #include "list_pointMeshMover.H"
27 #include "polyMesh.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace pointMeshMovers
35 {
38  (
40  list,
42  );
43 }
44 }
45 
46 
47 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48 
50 (
51  const polyMesh& mesh,
52  const dictionary& dict
53 )
54 :
56  movers_(0)
57 {
58  const dictionary& solversDict = dict.optionalSubDict("list");
59 
60  forAllConstIter(dictionary, solversDict, iter)
61  {
62  if (iter().isDict())
63  {
64  const word& name = iter().keyword();
65  const dictionary& dict = iter().dict();
66 
67  movers_.append
68  (
69  name,
71  );
72  }
73  }
74 }
75 
76 
77 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
78 
80 {}
81 
82 
83 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
84 
86 {
87  if (movers_.size())
88  {
89  // Accumulated displacement
90  pointField disp(poly().nPoints(), Zero);
91 
93  {
94  disp += iter().newPoints() - poly().points();
95  }
96 
97  return poly().points() + disp;
98  }
99  else
100  {
101  return poly().points();
102  }
103 }
104 
105 
107 {
109  {
110  iter().topoChange(map);
111  }
112 }
113 
114 
116 {
118  {
119  iter().mapMesh(map);
120  }
121 }
122 
123 
125 (
126  const polyDistributionMap& map
127 )
128 {
130  {
131  iter().distribute(map);
132  }
133 }
134 
135 
137 {
139  {
140  iter().movePoints(points);
141  }
142 }
143 
144 
145 // ************************************************************************* //
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:474
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:492
Macros for easy insertion into run-time selection tables.
Template dictionary class which manages the storage associated with it.
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 pointMesh movers.
static autoPtr< pointMeshMover > New(const polyMesh &, const dictionary &)
Select constructed from polyMesh and dictionary.
list(const polyMesh &, const dictionary &)
Construct from mesh and dictionary.
virtual void topoChange(const polyTopoChangeMap &)
Update local data for topology changes.
virtual void distribute(const polyDistributionMap &)
Update corresponding to the given distribution map.
virtual tmp< pointField > newPoints()
Provide current points for motion. Uses current motion field.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual void movePoints(const pointField &)
Update local data for geometry changes.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:78
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for managing temporary objects.
Definition: tmp.H:55
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
A class for handling words, derived from string.
Definition: word.H:63
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
const pointField & points
label nPoints
addToRunTimeSelectionTable(pointMeshMover, externalDisplacement, dictionary)
defineTypeNameAndDebug(externalDisplacement, 0)
Namespace for OpenFOAM.
static const zero Zero
Definition: zero.H:97
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
dictionary dict