diff --git a/applications/test/foamToEnsight-check/Make/files b/applications/test/foamToEnsight-check/Make/files new file mode 100644 index 0000000000..d5b94d1fe7 --- /dev/null +++ b/applications/test/foamToEnsight-check/Make/files @@ -0,0 +1,3 @@ +foamToEnsight-check.C + +EXE = $(FOAM_USER_APPBIN)/foamToEnsight-check diff --git a/applications/test/foamToEnsight-check/Make/options b/applications/test/foamToEnsight-check/Make/options new file mode 100644 index 0000000000..7fd9abdcb7 --- /dev/null +++ b/applications/test/foamToEnsight-check/Make/options @@ -0,0 +1,16 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/conversion/lnInclude \ + -I$(LIB_SRC)/lagrangian/intermediate/lnInclude + +EXE_LIBS = \ + -lfiniteVolume \ + -lfiniteArea \ + -lfileFormats \ + -lmeshTools \ + -lconversion \ + -llagrangianIntermediate \ + -lgenericPatchFields diff --git a/applications/test/foamToEnsight-check/foamToEnsight-check.C b/applications/test/foamToEnsight-check/foamToEnsight-check.C new file mode 100644 index 0000000000..8759fcf8db --- /dev/null +++ b/applications/test/foamToEnsight-check/foamToEnsight-check.C @@ -0,0 +1,357 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2022 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 + foamToEnsight-check + +Description + Check data sizes for conversion to ensight format. + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" +#include "timeSelector.H" +#include "IOobjectList.H" +#include "IOmanip.H" +#include "OFstream.H" +#include "Pstream.H" +#include "HashOps.H" +#include "regionProperties.H" + +#include "fvc.H" +#include "faMesh.H" +#include "fvMesh.H" + +// file-format/conversion +#include "ensightFaMesh.H" +#include "ensightMesh.H" + +using namespace Foam; + + +void printStats(const FixedList& stats, const char *what = "") +{ + Info<< what << "max-comm: "<< stats[0] << nl + << what << "max-size: "<< stats[1] << nl + << what << "off-proc: "<< stats[2] << nl; +} + + +template +FixedList printPartInfo +( + const EnsightPartType& part, + int verbose = 0 +) +{ + Info<< "part: " << part.name().c_str() << nl + << " size: " + << (Pstream::parRun() ? part.total() : part.size()) + << " ("; + + FixedList stats(Zero); + + label& maxComm = stats[0]; + label& maxSize = stats[1]; + label& totNonLocalSize = stats[2]; + + for (int typei=0; typei < EnsightPartType::nTypes; ++typei) + { + const auto etype = typename EnsightPartType::elemType(typei); + + if (typei) Info<< ' '; + Info<< EnsightPartType::elemNames[etype] << ": " + << (Pstream::parRun() ? part.total(etype) : part.size(etype)); + + label elemCount = part.size(etype); + label commCount = (Pstream::master() ? label(0) : elemCount); + label nonLocalCount = commCount; + + if (Pstream::parRun()) + { + reduce(elemCount, maxOp