diff --git a/applications/test/extendedStencil/Make/files b/applications/test/extendedStencil/Make/files new file mode 100644 index 0000000000..236668cde8 --- /dev/null +++ b/applications/test/extendedStencil/Make/files @@ -0,0 +1,4 @@ + +testExtendedStencil.C + +EXE = $(FOAM_USER_APPBIN)/testExtendedStencil diff --git a/applications/test/extendedStencil/Make/options b/applications/test/extendedStencil/Make/options new file mode 100644 index 0000000000..b733f6ac04 --- /dev/null +++ b/applications/test/extendedStencil/Make/options @@ -0,0 +1,6 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +EXE_LIBS = \ + -lfiniteVolume diff --git a/applications/test/extendedStencil/testExtendedStencil.C b/applications/test/extendedStencil/testExtendedStencil.C new file mode 100644 index 0000000000..b8db2b89bf --- /dev/null +++ b/applications/test/extendedStencil/testExtendedStencil.C @@ -0,0 +1,499 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Application + testExtendedStencil + +Description + Test app for determining extended stencil. + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" +#include "fvMesh.H" +#include "volFields.H" +#include "Time.H" +#include "mapDistribute.H" +#include "OFstream.H" +#include "meshTools.H" +//#include "FECCellToFaceStencil.H" +//#include "CFCCellToFaceStencil.H" +//#include "CPCCellToFaceStencil.H" +//#include "CECCellToFaceStencil.H" +//#include "extendedCentredCellToFaceStencil.H" +//#include "extendedUpwindCellToFaceStencil.H" + +//#include "centredCFCCellToFaceStencilObject.H" +//#include "centredFECCellToFaceStencilObject.H" +//#include "centredCPCCellToFaceStencilObject.H" +//#include "centredCECCellToFaceStencilObject.H" + +//#include "upwindFECCellToFaceStencilObject.H" +//#include "upwindCPCCellToFaceStencilObject.H" +//#include "upwindCECCellToFaceStencilObject.H" + +//#include "upwindCFCCellToFaceStencilObject.H" +#include "centredCFCFaceToCellStencilObject.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +void writeStencilOBJ +( + const fileName& fName, + const point& fc, + const List& stencilCc +) +{ + OFstream str(fName); + label vertI = 0; + + meshTools::writeOBJ(str, fc); + vertI++; + + forAll(stencilCc, i) + { + meshTools::writeOBJ(str, stencilCc[i]); + vertI++; + str << "l 1 " << vertI << nl; + } +} + + +// Stats +void writeStencilStats(const labelListList& stencil) +{ + label sumSize = 0; + label nSum = 0; + label minSize = labelMax; + label maxSize = labelMin; + + forAll(stencil, i) + { + const labelList& sCells = stencil[i]; + + if (sCells.size() > 0) + { + sumSize += sCells.size(); + nSum++; + minSize = min(minSize, sCells.size()); + maxSize = max(maxSize, sCells.size()); + } + } + reduce(sumSize, sumOp