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-2018 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 "mapPolyMesh.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33  defineTypeNameAndDebug(externalDisplacementMeshMover, 0);
34  defineRunTimeSelectionTable(externalDisplacementMeshMover, dictionary);
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 {
63  Info<< "Selecting externalDisplacementMeshMover " << type << endl;
64 
65  dictionaryConstructorTable::iterator cstrIter =
66  dictionaryConstructorTablePtr_->find(type);
67 
68  if (cstrIter == dictionaryConstructorTablePtr_->end())
69  {
71  << "Unknown externalDisplacementMeshMover type "
72  << type << nl << nl
73  << "Valid externalDisplacementMeshMover types:" << endl
74  << dictionaryConstructorTablePtr_->sortedToc()
75  << exit(FatalError);
76  }
77 
79  (
80  cstrIter()(dict, baffles, pointDisplacement)
81  );
82 }
83 
84 
85 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
86 
88 {}
89 
90 
91 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
92 
94 {
95  // No local data to update
96 }
97 
98 
100 {
101  // Renumber baffles
102  DynamicList<labelPair> newBaffles(baffles_.size());
103  forAll(baffles_, i)
104  {
105  label f0 = mpm.reverseFaceMap()[baffles_[i].first()];
106  label f1 = mpm.reverseFaceMap()[baffles_[i].second()];
107 
108  if (f0 >= 0 && f1 >= 0)
109  {
110  newBaffles.append(labelPair(f0, f1));
111  }
112  }
113  newBaffles.shrink();
114  baffles_.transfer(newBaffles);
115 }
116 
117 
118 // ************************************************************************* //
dictionary dict
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
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
virtual void movePoints(const pointField &)
Update local data for geometry changes.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:323
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
static autoPtr< externalDisplacementMeshMover > New(const word &type, const dictionary &dict, const List< labelPair > &baffles, pointVectorField &pointDisplacement)
Return a reference to the selected meshMover model.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
externalDisplacementMeshMover(const dictionary &dict, const List< labelPair > &baffles, pointVectorField &pointDisplacement)
Construct from dictionary and displacement field. Dictionary is.
scalar f1
Definition: createFields.H:15
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
A class for handling words, derived from string.
Definition: word.H:59
void append(const T &)
Append an element at the end of the list.
Definition: ListI.H:178
Pair< label > labelPair
Label pair.
Definition: labelPair.H:48
static const char nl
Definition: Ostream.H:260
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
defineTypeNameAndDebug(combustionModel, 0)
virtual void updateMesh(const mapPolyMesh &)
Update local data for topology changes.
messageStream Info
const labelList & reverseFaceMap() const
Reverse face map.
Definition: mapPolyMesh.H:490
Namespace for OpenFOAM.