externalDisplacementMeshMover.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2013-2014 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 
40 Foam::externalDisplacementMeshMover::externalDisplacementMeshMover
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  (
72  "externalDisplacementMeshMover::New(const word&"
73  ", pointVectorField&, const List<labelPair>&"
74  ", const dictionary&)"
75  ) << "Unknown externalDisplacementMeshMover type "
76  << type << nl << nl
77  << "Valid externalDisplacementMeshMover types:" << endl
78  << dictionaryConstructorTablePtr_->sortedToc()
79  << exit(FatalError);
80  }
81 
83  (
84  cstrIter()(dict, baffles, pointDisplacement)
85  );
86 }
87 
88 
89 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
90 
92 {}
93 
94 
95 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
96 
98 {
99  // No local data to update
100 }
101 
102 
104 {
105  // Renumber baffles
106  DynamicList<labelPair> newBaffles(baffles_.size());
107  forAll(baffles_, i)
108  {
109  label f0 = mpm.reverseFaceMap()[baffles_[i].first()];
110  label f1 = mpm.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 // ************************************************************************* //
const labelList & reverseFaceMap() const
Reverse face map.
Definition: mapPolyMesh.H:497
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
static autoPtr< externalDisplacementMeshMover > New(const word &type, const dictionary &dict, const List< labelPair > &baffles, pointVectorField &pointDisplacement)
Return a reference to the selected meshMover model.
scalar f1
Definition: createFields.H:28
A class for handling words, derived from string.
Definition: word.H:59
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
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
messageStream Info
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual void updateMesh(const mapPolyMesh &)
Update local data for topology changes.
Namespace for OpenFOAM.
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
dictionary dict
static const char nl
Definition: Ostream.H:260
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
#define forAll(list, i)
Definition: UList.H:421
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:314
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
error FatalError
Pair< label > labelPair
Label pair.
Definition: labelPair.H:48
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
void append(const T &)
Append an element at the end of the list.
Definition: ListI.H:97
virtual void movePoints(const pointField &)
Update local data for geometry changes.
defineTypeNameAndDebug(combustionModel, 0)