diff --git a/applications/test/ensightFile/Make/files b/applications/test/ensightFile/Make/files deleted file mode 100644 index 856556c316..0000000000 --- a/applications/test/ensightFile/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -Test-ensightFile.C - -EXE = $(FOAM_USER_APPBIN)/Test-ensightFile diff --git a/applications/test/ensightFile/Make/options b/applications/test/ensightFile/Make/options deleted file mode 100644 index 6684cce1e7..0000000000 --- a/applications/test/ensightFile/Make/options +++ /dev/null @@ -1,8 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/fileFormats/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/conversion/lnInclude - -EXE_LIBS = \ - -lmeshTools \ - -lconversion diff --git a/applications/test/ensightFile1/Make/files b/applications/test/ensightFile1/Make/files new file mode 100644 index 0000000000..aa5fb56152 --- /dev/null +++ b/applications/test/ensightFile1/Make/files @@ -0,0 +1,3 @@ +Test-ensightFile1.cxx + +EXE = $(FOAM_USER_APPBIN)/Test-ensightFile1 diff --git a/applications/test/ensightFile1/Make/options b/applications/test/ensightFile1/Make/options new file mode 100644 index 0000000000..7ce182425d --- /dev/null +++ b/applications/test/ensightFile1/Make/options @@ -0,0 +1,5 @@ +EXE_INC = \ + -I$(LIB_SRC)/fileFormats/lnInclude + +EXE_LIBS = \ + -lfileFormats diff --git a/applications/test/ensightFile1/Test-ensightFile1.cxx b/applications/test/ensightFile1/Test-ensightFile1.cxx new file mode 100644 index 0000000000..9be1b4f3ab --- /dev/null +++ b/applications/test/ensightFile1/Test-ensightFile1.cxx @@ -0,0 +1,137 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2024 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Application + Test-ensightFile + +Description + check cleanup of ensight file and variable names + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" +#include "ensightFile.H" +#include "ensightGeoFile.H" +#include "Switch.H" +#include "IOstreams.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: + +int main(int argc, char *argv[]) +{ + argList::noBanner(); + argList::noParallel(); + argList::addBoolOption("ascii", "open as ascii instead of binary"); + argList::addBoolOption("binary", "(default)"); + argList::addBoolOption("clear", "force clear of time-steps"); + argList::addBoolOption("no-end", "skip use of endTimeStep"); + argList::addBoolOption("append", "open in append mode"); + argList::addOption("geom", "geometry file"); + argList::addOption("field", "field file"); + + #include "setRootCase.H" + + const bool with_ascii = args.found("ascii") && !args.found("binary"); + // const bool with_binary = args.found("binary"); + const bool with_append = args.found("append"); + const bool with_clear = args.found("clear"); + const bool without_end = args.found("no-end"); + + const IOstreamOption::streamFormat fmt = + ( + with_ascii + ? IOstreamOption::ASCII + : IOstreamOption::BINARY + ); + + const IOstreamOption::appendType append = + ( + with_append + ? IOstreamOption::APPEND_ATE + : IOstreamOption::NO_APPEND + ); + + + fileName file; + if (args.readIfPresent("geom", file)) + { + Info<< "Open " << file << " as geometry " + << " format:" << (with_ascii ? "ASCII" : "BINARY") + << " append:" << Switch::name(with_append) << nl; + + ensightGeoFile ensFile(append, file, fmt); + + if (append) + { + ensFile.beginTimeStep(); + + // At the moment need to pair begin/end time-step calls + if (!without_end) + { + ensFile.endTimeStep(); + } + } + + if (with_clear) + { + ensFile.clearTimeSteps(); + } + } + + if (args.readIfPresent("field", file)) + { + Info<< "Open " << file << " as field" + << " format:" << (with_ascii ? "ASCII" : "BINARY") + << " append:" << Switch::name(with_append) << nl; + + ensightFile ensFile(append, file, fmt); + + if (append) + { + ensFile.beginTimeStep(); + + // At the moment need to pair begin/end time-step calls + if (!without_end) + { + ensFile.endTimeStep(); + } + } + + if (with_clear) + { + ensFile.clearTimeSteps(); + } + } + + + Info<< "\nEnd\n" << endl; + return 0; +} + + +// ************************************************************************* // diff --git a/applications/test/ensightFileName/Make/files b/applications/test/ensightFileName/Make/files new file mode 100644 index 0000000000..f2b4af2f48 --- /dev/null +++ b/applications/test/ensightFileName/Make/files @@ -0,0 +1,3 @@ +Test-ensightFileName.cxx + +EXE = $(FOAM_USER_APPBIN)/Test-ensightFileName diff --git a/applications/test/ensightFileName/Make/options b/applications/test/ensightFileName/Make/options new file mode 100644 index 0000000000..7ce182425d --- /dev/null +++ b/applications/test/ensightFileName/Make/options @@ -0,0 +1,5 @@ +EXE_INC = \ + -I$(LIB_SRC)/fileFormats/lnInclude + +EXE_LIBS = \ + -lfileFormats diff --git a/applications/test/ensightFile/Test-ensightFile.C b/applications/test/ensightFileName/Test-ensightFileName.cxx similarity index 96% rename from applications/test/ensightFile/Test-ensightFile.C rename to applications/test/ensightFileName/Test-ensightFileName.cxx index 927bb84545..57bcc306a6 100644 --- a/applications/test/ensightFile/Test-ensightFile.C +++ b/applications/test/ensightFileName/Test-ensightFileName.cxx @@ -24,10 +24,10 @@ License along with OpenFOAM. If not, see . Application - Test-ensightFile + Test-ensightFileName Description - check cleanup of ensight file and variable names + Check cleanup of ensight file and variable names \*---------------------------------------------------------------------------*/ diff --git a/applications/utilities/mesh/conversion/ensightToFoam/ensightMeshReader.C b/applications/utilities/mesh/conversion/ensightToFoam/ensightMeshReader.C index 91be645d68..85de497991 100644 --- a/applications/utilities/mesh/conversion/ensightToFoam/ensightMeshReader.C +++ b/applications/utilities/mesh/conversion/ensightToFoam/ensightMeshReader.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2022-2023 OpenCFD Ltd. + Copyright (C) 2022-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -93,29 +93,34 @@ void Foam::fileFormats::ensightMeshReader::readIDs ( ensightReadFile& is, const bool doRead, - const label nShapes, + const label elemCount, labelList& foamToElem, Map