fvMeshTopoChangersList.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) 2022 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 "fvMeshTopoChangersList.H"
27 #include "polyTopoChangeMap.H"
28 #include "volFields.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 namespace fvMeshTopoChangers
36 {
37  defineTypeNameAndDebug(list, 0);
38  addToRunTimeSelectionTable(fvMeshTopoChanger, list, fvMesh);
39 }
40 }
41 
42 
43 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
44 
46 :
47  fvMeshTopoChanger(mesh)
48 {
49  const dictionary& solversDict = dict.subDict("topoChangers");
50 
51  forAllConstIter(dictionary, solversDict, iter)
52  {
53  if (iter().isDict())
54  {
55  const word& name = iter().keyword();
56  const dictionary& dict = iter().dict();
57 
58  list_.insert
59  (
60  name,
61  fvMeshTopoChanger::New(mesh, dict).ptr()
62  );
63  }
64  }
65 }
66 
67 
68 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
69 
71 {}
72 
73 
74 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
75 
77 {
78  bool updated = false;
79 
81  {
82  updated = iter().update() || updated;
83  mesh().topoChanged_ = updated;
84  }
85 
86  return updated;
87 }
88 
89 
91 {
93  {
94  iter().topoChange(map);
95  }
96 }
97 
98 
100 {
102  {
103  iter().mapMesh(map);
104  }
105 }
106 
107 
109 (
110  const polyDistributionMap& map
111 )
112 {
114  {
115  iter().distribute(map);
116  }
117 }
118 
119 
120 // ************************************************************************* //
Template dictionary class which manages the storage associated with it.
Definition: PtrDictionary.H:53
dictionary dict
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
fvMesh & mesh()
Return the fvMesh.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:477
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:459
virtual bool update()
Update the mesh for both mesh motion and topology change.
addToRunTimeSelectionTable(fvMeshTopoChanger, list, fvMesh)
fvMesh & mesh
Macros for easy insertion into run-time selection tables.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:1002
list(fvMesh &mesh, const dictionary &dict)
Construct from fvMesh and dictionary.
bool topoChanged_
Is the mesh topology changing.
Definition: polyMesh.H:310
static autoPtr< fvMeshTopoChanger > New(fvMesh &, const dictionary &dict)
Select, construct and return the fvMeshTopoChanger.
A class for handling words, derived from string.
Definition: word.H:59
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
virtual void topoChange(const polyTopoChangeMap &)
Update corresponding to the given map.
virtual void distribute(const polyDistributionMap &)
Update corresponding to the given distribution map.
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
bool update(const point &, const FvWallInfoDataBase< WallInfo, Type, Derived > &w2, const scalar tol, TrackingData &td)
Evaluate distance to point. Update distSqr, origin from whomever.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:50
Abstract base class for fvMesh movers.
Namespace for OpenFOAM.