1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "setUpdater.H"
30 #include "mapPolyMesh.H"
31 #include "IOobjectList.H"
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
41 void setUpdater::updateSets(const mapPolyMesh& morphMap) const
44 // Update all sets in memory.
47 HashTable<const Type*> memSets =
48 morphMap.mesh().objectRegistry::lookupClass<Type>();
52 typename HashTable<const Type*>::iterator iter = memSets.begin();
53 iter != memSets.end();
57 Type& set = const_cast<Type&>(*iter());
61 Pout<< "Set:" << set.name() << " size:" << set.size()
62 << " updated in memory" << endl;
65 set.updateMesh(morphMap);
67 // Write or not? Debatable.
73 // Update all sets on disk
76 // Get last valid mesh (discard points-only change)
79 morphMap.mesh().time(),
80 morphMap.mesh().time().findInstance
82 morphMap.mesh().meshDir(),
88 IOobjectList fileSets(Objects.lookupClass(Type::typeName));
92 IOobjectList::const_iterator iter = fileSets.begin();
93 iter != fileSets.end();
97 if (!memSets.found(iter.key()))
99 // Not in memory. Load it.
104 Pout<< "Set:" << set.name() << " size:" << set.size()
105 << " updated on disk" << endl;
108 set.updateMesh(morphMap);
116 Pout<< "Set:" << iter.key() << " already updated from memory"
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 } // End namespace Foam
128 // ************************************************************************* //