diff --git a/src/fileFormats/Make/files b/src/fileFormats/Make/files index 6ddcb081e9..91c6affaf2 100644 --- a/src/fileFormats/Make/files +++ b/src/fileFormats/Make/files @@ -1,5 +1,7 @@ ensight/file/ensightFile.C ensight/file/ensightGeoFile.C +ensight/part/ensightCells.C +ensight/part/ensightFaces.C ensight/read/ensightReadFile.C ensight/type/ensightPTraits.C diff --git a/src/fileFormats/ensight/part/ensightCells.C b/src/fileFormats/ensight/part/ensightCells.C new file mode 100644 index 0000000000..ea12323d5c --- /dev/null +++ b/src/fileFormats/ensight/part/ensightCells.C @@ -0,0 +1,263 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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 . + +\*---------------------------------------------------------------------------*/ + +#include "ensightCells.H" +#include "error.H" +#include "polyMesh.H" +#include "cellModeller.H" +#include "demandDrivenData.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +const Foam::label Foam::ensightCells::nTypes = 5; + +namespace Foam +{ + template<> + const char* Foam::NamedEnum + < + Foam::ensightCells::elemType, + 5 + >::names[] = { "tetra4", "pyramid5", "penta6", "hexa8", "nfaced" }; +} + +const Foam::NamedEnum + Foam::ensightCells::elemEnum; + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +inline Foam::label Foam::ensightCells::offset +( + const enum elemType what, + const label i +) const +{ + label n = i; + for (label typeI = 0; typeI < label(what); ++typeI) + { + n += sizes_[typeI]; + } + + return n; +} + + +void Foam::ensightCells::allocate() +{ + // overall required size + label n = 0; + forAll(sizes_, typeI) + { + n += sizes_[typeI]; + } + address_.setSize(n, 0); + + // assign corresponding sub-lists + n = 0; + forAll(sizes_, typeI) + { + deleteDemandDrivenData(lists_[typeI]); + + lists_[typeI] = new SubList