1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "edgeFormatsCore.H"
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 Foam::word Foam::fileFormats::edgeFormatsCore::nativeExt("eMesh");
38 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
40 Foam::string Foam::fileFormats::edgeFormatsCore::getLineNoComment
50 while ((line.empty() || line[0] == '#') && is.good());
57 Foam::fileName Foam::fileFormats::edgeFormatsCore::localMeshFileName
62 const word name(meshName.size() ? meshName : surfaceRegistry::defaultName);
66 surfaceRegistry::prefix/name/surfMesh::meshSubDir
67 / name + "." + nativeExt
72 Foam::fileName Foam::fileFormats::edgeFormatsCore::findMeshInstance
78 fileName localName = localMeshFileName(meshName);
80 // Search back through the time directories list to find the time
81 // closest to and lower than current time
83 instantList ts = t.times();
86 for (instanceI = ts.size()-1; instanceI >= 0; --instanceI)
88 if (ts[instanceI].value() <= t.timeOutputValue())
94 // Noting that the current directory has already been searched
95 // for mesh data, start searching from the previously stored time directory
99 for (label i = instanceI; i >= 0; --i)
101 if (isFile(t.path()/ts[i].name()/localName))
112 Foam::fileName Foam::fileFormats::edgeFormatsCore::findMeshFile
118 fileName localName = localMeshFileName(meshName);
120 // Search back through the time directories list to find the time
121 // closest to and lower than current time
123 instantList ts = t.times();
126 for (instanceI = ts.size()-1; instanceI >= 0; --instanceI)
128 if (ts[instanceI].value() <= t.timeOutputValue())
134 // Noting that the current directory has already been searched
135 // for mesh data, start searching from the previously stored time directory
139 for (label i = instanceI; i >= 0; --i)
141 fileName testName(t.path()/ts[i].name()/localName);
143 if (isFile(testName))
150 // fallback to "constant"
151 return t.path()/"constant"/localName;
156 bool Foam::fileFormats::edgeFormatsCore::checkSupport
158 const wordHashSet& available,
161 const word& functionName
164 if (available.found(ext))
170 wordList known = available.sortedToc();
172 Info<<"Unknown file extension for " << functionName
173 << " : " << ext << nl
178 Info<<" " << known[i];
187 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
189 Foam::fileFormats::edgeFormatsCore::edgeFormatsCore()
193 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
195 Foam::fileFormats::edgeFormatsCore::~edgeFormatsCore()
199 // ************************************************************************* //