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 \*---------------------------------------------------------------------------*/
30 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
32 void Foam::surfMesh::setInstance(const fileName& inst)
36 Info<< "void surfMesh::setInstance(const fileName& inst) : "
37 << "Resetting file instance to " << inst << endl;
42 storedIOPoints().writeOpt() = IOobject::AUTO_WRITE;
43 storedIOPoints().instance() = inst;
45 storedIOFaces().writeOpt() = IOobject::AUTO_WRITE;
46 storedIOFaces().instance() = inst;
48 storedIOZones().writeOpt() = IOobject::AUTO_WRITE;
49 storedIOZones().instance() = inst;
53 Foam::surfMesh::readUpdateState Foam::surfMesh::readUpdate()
57 Info<< "surfMesh::readUpdateState surfMesh::readUpdate() : "
58 << "Updating mesh based on saved data." << endl;
61 // Find point and face instances
62 fileName pointsInst(time().findInstance(meshDir(), "points"));
63 fileName facesInst(time().findInstance(meshDir(), "faces"));
67 Info<< "Points instance: old = " << pointsInstance()
68 << " new = " << pointsInst << nl
69 << "Faces instance: old = " << facesInstance()
70 << " new = " << facesInst << endl;
73 if (facesInst != facesInstance())
78 Info << "Topological change" << endl;
83 // Set instance to new instance.
84 // Note points instance can differ from faces instance.
85 setInstance(facesInst);
86 storedIOPoints().instance() = pointsInst;
88 storedIOPoints() = pointIOField
102 storedFaces() = faceIOList
116 // Reset the surface zones
117 surfZoneIOList newZones
131 // Check that zone types and names are unchanged
132 bool zonesChanged = false;
134 surfZoneList& zones = this->storedIOZones();
135 if (zones.size() != newZones.size())
143 if (zones[zoneI].name() != newZones[zoneI].name())
151 zones.transfer(newZones);
155 WarningIn("surfMesh::readUpdateState surfMesh::readUpdate()")
156 << "Number of zones has changed. This may have "
157 << "unexpected consequences. Proceed with care." << endl;
159 return surfMesh::TOPO_PATCH_CHANGE;
163 return surfMesh::TOPO_CHANGE;
167 else if (pointsInst != pointsInstance())
172 Info << "Point motion" << endl;
176 storedIOPoints().instance() = pointsInst;
178 storedIOPoints() = pointIOField
192 return surfMesh::POINTS_MOVED;
198 Info << "No change" << endl;
202 return surfMesh::UNCHANGED;
206 // ************************************************************************* //