diff --git a/.gitignore b/.gitignore index ebe5e91530..f32722697b 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ *.la *.so *.jar +lex.yy.c # Corefiles core @@ -27,10 +28,13 @@ core lnInclude # linux build folder(s) - anywhere -linux*Gcc*[SD]POpt* +linux*Gcc* # reinstate wmake/rules that look like build folders !wmake/rules/linux* +# but do ignore the derived files in there +wmake/rules/linux*/dirToString +wmake/rules/linux*/wmkdep # doxygen generated documentation doc/[Dd]oxygen/html diff --git a/applications/solvers/heatTransfer/buoyantFoam/createFields.H b/applications/solvers/heatTransfer/buoyantFoam/createFields.H index 99cb78bcac..0a5a098d9f 100644 --- a/applications/solvers/heatTransfer/buoyantFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantFoam/createFields.H @@ -58,7 +58,7 @@ Info<< "Calculating field g.h\n" << endl; volScalarField gh("gh", g & mesh.C()); - dimensionedScalar pRef("pRef", p.dimensions(), 1.0e5); + dimensionedScalar pRef("pRef", p.dimensions(), thermo->lookup("pRef")); Info<< "Creating field pd\n" << endl; volScalarField pd @@ -67,10 +67,14 @@ ( "pd", runTime.timeName(), - mesh + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE ), - p - rho*gh - pRef, - p.boundaryField().types() + mesh ); + p = pd + rho*gh + pRef; + thermo->correct(); + dimensionedScalar initialMass = fvc::domainIntegrate(rho); diff --git a/applications/solvers/heatTransfer/buoyantFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantFoam/pEqn.H index 2421bd3bf8..2a1929eb72 100644 --- a/applications/solvers/heatTransfer/buoyantFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantFoam/pEqn.H @@ -1,8 +1,5 @@ bool closedVolume = pd.needReference(); -//pd.boundaryField() == -// p.boundaryField() - rho.boundaryField()*gh.boundaryField() - pRef.value(); - rho = thermo->rho(); volScalarField rUA = 1.0/UEqn.A(); diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H index 1bdb4d874b..184242be81 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H @@ -54,8 +54,7 @@ Info<< "Calculating field g.h\n" << endl; volScalarField gh("gh", g & mesh.C()); - - dimensionedScalar pRef("pRef", p.dimensions(), 1.0e5); + dimensionedScalar pRef("pRef", p.dimensions(), thermo->lookup("pRef")); Info<< "Creating field pd\n" << endl; volScalarField pd @@ -64,16 +63,26 @@ ( "pd", runTime.timeName(), - mesh + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE ), - p - rho*gh - pRef, - p.boundaryField().types() + mesh ); + p = pd + rho*gh + pRef; + thermo->correct(); + label pdRefCell = 0; scalar pdRefValue = 0.0; - setRefCell(pd, mesh.solutionDict().subDict("SIMPLE"), pdRefCell, pdRefValue); + setRefCell + ( + pd, + mesh.solutionDict().subDict("SIMPLE"), + pdRefCell, + pdRefValue + ); dimensionedScalar initialMass = fvc::domainIntegrate(rho); diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H index 8accc61b7f..6f7aa582f0 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H @@ -1,6 +1,3 @@ -pd.boundaryField() == - p.boundaryField() - rho.boundaryField()*gh.boundaryField() - pRef.value(); - volScalarField rUA = 1.0/UEqn().A(); U = rUA*UEqn().H(); UEqn.clear(); diff --git a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/createFields.H b/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/createFields.H index 0cdc89f117..76e3805bca 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/createFields.H @@ -55,8 +55,7 @@ Info<< "Calculating field g.h\n" << endl; volScalarField gh("gh", g & mesh.C()); - - dimensionedScalar pRef("pRef", p.dimensions(), 1.0e5); + dimensionedScalar pRef("pRef", p.dimensions(), thermo->lookup("pRef")); Info<< "Creating field pd\n" << endl; volScalarField pd @@ -65,12 +64,16 @@ ( "pd", runTime.timeName(), - mesh + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE ), - p - rho*gh - pRef, - p.boundaryField().types() + mesh ); + p = pd + rho*gh + pRef; + thermo->correct(); + label pdRefCell = 0; scalar pdRefValue = 0.0; diff --git a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/pEqn.H index 8accc61b7f..6f7aa582f0 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/pEqn.H @@ -1,6 +1,3 @@ -pd.boundaryField() == - p.boundaryField() - rho.boundaryField()*gh.boundaryField() - pRef.value(); - volScalarField rUA = 1.0/UEqn().A(); U = rUA*UEqn().H(); UEqn.clear(); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H index aec296a1b3..6460cc9990 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H @@ -11,7 +11,12 @@ List initialMassf(fluidRegions.size()); - dimensionedScalar pRef("pRef", dimensionSet(1, -1, -2, 0, 0), 1.0E5); + dimensionedScalar pRef + ( + "pRef", + dimensionSet(1, -1, -2, 0, 0), + rp.lookup("pRef") + ); // Populate fluid field pointer lists forAll(fluidRegions, i) @@ -173,7 +178,7 @@ Info<< " Updating p from pd\n" << endl; thermof[i].p() == pdf[i] + rhof[i]*ghf[i] + pRef; - + thermof[i].correct(); initialMassf[i] = fvc::domainIntegrate(rhof[i]).value(); } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/pEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/pEqn.H index 9e07ab170c..3e071ce8ba 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/pEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/pEqn.H @@ -1,11 +1,6 @@ { bool closedVolume = false; - //pdf[i].boundaryField() == - // thermof[i].p().boundaryField() - // - rhof[i].boundaryField()*ghf[i].boundaryField() - // - pRef.value(); - rhof[i] = thermof[i].rho(); volScalarField rUA = 1.0/UEqn().A(); @@ -15,11 +10,11 @@ fvc::interpolate(rhof[i]) *( (fvc::interpolate(Uf[i]) & fluidRegions[i].Sf()) -// + fvc::ddtPhiCorr(rUA, rhof[i], Uf[i], phif[i]) + + fvc::ddtPhiCorr(rUA, rhof[i], Uf[i], phif[i]) ) - fvc::interpolate(rhof[i]*rUA*ghf[i]) - *fvc::snGrad(rhof[i]) - *fluidRegions[i].magSf(); + *fvc::snGrad(rhof[i]) + *fluidRegions[i].magSf(); // Solve pressure difference # include "pdEqn.H" @@ -55,8 +50,7 @@ initialMassf[i] ) - fvc::domainIntegrate(thermof[i].psi()*thermof[i].p()) - ) - /fvc::domainIntegrate(thermof[i].psi()); + )/fvc::domainIntegrate(thermof[i].psi()); rhof[i] = thermof[i].rho(); } diff --git a/applications/solvers/heatTransfer/lesBuoyantFoam/createFields.H b/applications/solvers/heatTransfer/lesBuoyantFoam/createFields.H index 3fd85b36c5..7b63660f7e 100644 --- a/applications/solvers/heatTransfer/lesBuoyantFoam/createFields.H +++ b/applications/solvers/heatTransfer/lesBuoyantFoam/createFields.H @@ -37,7 +37,7 @@ mesh ); -# include "compressibleCreatePhi.H" + #include "compressibleCreatePhi.H" Info<< "Creating turbulence model\n" << endl; @@ -53,7 +53,7 @@ Info<< "Calculating field g.h\n" << endl; volScalarField gh("gh", g & mesh.C()); - dimensionedScalar pRef("pRef", p.dimensions(), 0.0); + dimensionedScalar pRef("pRef", p.dimensions(), thermo->lookup("pRef")); Info<< "Creating field pd\n" << endl; volScalarField pd @@ -69,7 +69,7 @@ mesh ); - //pd = p - rho*gh - pRef; p = pd + rho*gh + pRef; + thermo->correct(); dimensionedScalar initialMass = fvc::domainIntegrate(rho); diff --git a/applications/utilities/mesh/generation/extrudeMesh/Allwclean b/applications/utilities/mesh/generation/extrudeMesh/Allwclean new file mode 100755 index 0000000000..f7842e25d0 --- /dev/null +++ b/applications/utilities/mesh/generation/extrudeMesh/Allwclean @@ -0,0 +1,6 @@ +#!/bin/sh +set -x + +wclean libso extrudeModel +wclean + diff --git a/applications/utilities/mesh/generation/extrudeMesh/Allwmake b/applications/utilities/mesh/generation/extrudeMesh/Allwmake new file mode 100755 index 0000000000..876125ce82 --- /dev/null +++ b/applications/utilities/mesh/generation/extrudeMesh/Allwmake @@ -0,0 +1,6 @@ +#!/bin/sh +set -x + +wmake libso extrudeModel +wmake + diff --git a/applications/utilities/mesh/generation/extrudeMesh/Make/files b/applications/utilities/mesh/generation/extrudeMesh/Make/files index f5a718066d..08f746cc3f 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/Make/files +++ b/applications/utilities/mesh/generation/extrudeMesh/Make/files @@ -1,3 +1,4 @@ extrudeMesh.C EXE = $(FOAM_APPBIN)/extrudeMesh + diff --git a/applications/utilities/mesh/generation/extrudeMesh/Make/options b/applications/utilities/mesh/generation/extrudeMesh/Make/options index cd6c02a3f0..8326ac3b50 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/Make/options +++ b/applications/utilities/mesh/generation/extrudeMesh/Make/options @@ -1,8 +1,11 @@ EXE_INC = \ -IextrudedMesh \ + -IextrudeModel/lnInclude \ -I$(FOAM_SRC)/meshTools/lnInclude \ -I$(FOAM_SRC)/dynamicMesh/lnInclude EXE_LIBS = \ -lmeshTools \ - -ldynamicMesh + -ldynamicMesh \ + -lextrudeModel + diff --git a/applications/utilities/mesh/generation/extrudeMesh/createTimeExtruded.H b/applications/utilities/mesh/generation/extrudeMesh/createTimeExtruded.H index 0774b15d2c..7a4ce1ed73 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/createTimeExtruded.H +++ b/applications/utilities/mesh/generation/extrudeMesh/createTimeExtruded.H @@ -3,6 +3,6 @@ Time runTimeExtruded ( Time::controlDictName, - rootDirTarget, - caseDirTarget + args.rootPath(), + args.caseName() ); diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C index 6517e92e33..bcb9df59c0 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C @@ -23,39 +23,10 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Description - Extrude mesh from existing patch or from patch read from file. Merges close - points so be careful. + Extrude mesh from existing patch or from patch read from file. + Note: Merges close points so be careful. - Can do wedges: - - use wedgeExtruder instead of e.g. linearNormalExtruder - - extrusion is opposite the surface/patch normal so inwards the source - mesh - - axis direction has to be consistent with this. - - use -mergeFaces option if doing full 360 and want to merge front and back - - E.g. starting from 'movingWall' patch of cavity tutorial: - - we want to rotate around the left side of this patch (is at x=0,y=0.1) - for a full 360 degrees: - - wedgeExtruder - ( - point(0,0.1,0), // point on axis - vector(0,0,-1), // (normalized!) direction of axis - 360.0/180.0*mathematicalConstant::pi // angle - ) - - - note direction of axis. This should be consistent with rotating against - the patch normal direction. If you get it wrong you'll see all cells - with extreme aspect ratio and internal faces wrong way around in - checkMesh - - - call with e.g. 10 layers. Thickness argument (0.1) is not used! - - extrudeMesh 10 0.1 \ - -sourceRoot $FOAM_TUTORIALS/icoFoam \ - -sourceCase cavity \ - -sourcePatch movingWall - -mergeFaces + Type of extrusion prescribed by run-time selectable model. \*---------------------------------------------------------------------------*/ @@ -72,10 +43,7 @@ Description #include "perfectInterface.H" #include "extrudedMesh.H" -#include "linearNormalExtruder.H" -#include "linearRadialExtruder.H" -#include "sigmaRadialExtruder.H" -#include "wedgeExtruder.H" +#include "extrudeModel.H" using namespace Foam; @@ -99,6 +67,23 @@ int main(int argc, char *argv[]) autoPtr meshPtr(NULL); + autoPtr model + ( + extrudeModel::New + ( + IOdictionary + ( + IOobject + ( + "extrudeProperties", + runTimeExtruded.constant(), + runTimeExtruded, + IOobject::MUST_READ + ) + ) + ) + ); + if (args.options().found("sourceRoot")) { fileName rootDirSource(args.options()["sourceRoot"]); @@ -115,7 +100,6 @@ int main(int argc, char *argv[]) rootDirSource, caseDirSource ); - # include "createPolyMesh.H" label patchID = mesh.boundaryMesh().findPatchID(patchName); @@ -153,20 +137,7 @@ int main(int argc, char *argv[]) runTimeExtruded ), pp, - nLayers, // number of layers - linearNormalExtruder(-thickness) // overall thickness(signed!) - //wedgeExtruder - //( - // point(0,0.1,0), // point on axis - // vector(0,0,-1), // (normalized!) direction of axis - // 360.0/180.0*mathematicalConstant::pi // angle - //) - //wedgeExtruder - //( - // point(0,0,0), // point on axis - // vector(0,1,0), // (normalized!) direction of axis - // 30.0/180.0*mathematicalConstant::pi // angle - //) + model() ) ); } @@ -198,12 +169,10 @@ int main(int argc, char *argv[]) runTimeExtruded ), fMesh, - nLayers, // number of layers - linearNormalExtruder(-thickness) // overall thickness (signed!) + model() ) ); } - extrudedMesh& mesh = meshPtr(); diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/Make/files b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/Make/files new file mode 100644 index 0000000000..c8d0cc571b --- /dev/null +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/Make/files @@ -0,0 +1,9 @@ +extrudeModel/extrudeModel.C +extrudeModel/newExtrudeModel.C +linearNormal/linearNormal.C +linearRadial/linearRadial.C +sigmaRadial/sigmaRadial.C +wedge/wedge.C + +LIB = $(FOAM_LIBBIN)/libextrudeModel + diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/Make/options b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/Make/options new file mode 100644 index 0000000000..2a37902358 --- /dev/null +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/Make/options @@ -0,0 +1,8 @@ +EXE_INC = \ + -I$(FOAM_SRC)/meshTools/lnInclude \ + -I$(FOAM_SRC)/dynamicMesh/lnInclude + +EXE_LIBS = \ + -lmeshTools \ + -ldynamicMesh + diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/extrudeModel/extrudeModel.C b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/extrudeModel/extrudeModel.C new file mode 100644 index 0000000000..50a6ab0886 --- /dev/null +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/extrudeModel/extrudeModel.C @@ -0,0 +1,66 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 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 + +\*---------------------------------------------------------------------------*/ + +#include "extrudeModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(extrudeModel, 0); + defineRunTimeSelectionTable(extrudeModel, dictionary); +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::extrudeModel::extrudeModel +( + const word& modelType, + const dictionary& dict +) +: + nLayers_(readLabel(dict.lookup("nLayers"))), + dict_(dict), + coeffDict_(dict.subDict(modelType + "Coeffs")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::extrudeModel::~extrudeModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::label Foam::extrudeModel::nLayers() const +{ + return nLayers_; +} + + +// ************************************************************************* // + diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/extrudeModel/extrudeModel.H b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/extrudeModel/extrudeModel.H new file mode 100644 index 0000000000..a6d2fc741f --- /dev/null +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/extrudeModel/extrudeModel.H @@ -0,0 +1,136 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 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 + +Class + Foam::extrudeModel + +Description + Top level extrusion model class + +SourceFiles + extrudeModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef extrudeModel_H +#define extrudeModel_H + +#include "dictionary.H" +#include "point.H" +#include "autoPtr.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class extrudeModel Declaration +\*---------------------------------------------------------------------------*/ + +class extrudeModel +{ +protected: + + // Protected data + + const label nLayers_; + + const dictionary& dict_; + + const dictionary& coeffDict_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + extrudeModel(const extrudeModel&); + + //- Disallow default bitwise assignment + void operator=(const extrudeModel&); + + +public: + + //- Runtime type information + TypeName("extrudeModel"); + + //- Declare runtime constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + extrudeModel, + dictionary, + ( + const dictionary& dict + ), + (dict) + ); + + + // Constructors + + //- Construct from dictionary + extrudeModel(const word& modelType, const dictionary&); + + + // Selectors + + //- Select null constructed + static autoPtr New(const dictionary&); + + + //- Destructor + virtual ~extrudeModel(); + + + // Member Functions + + // Access + + label nLayers() const; + + + // Member Operators + + virtual point operator() + ( + const point& surfacePoint, + const vector& surfaceNormal, + const label layer + ) const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/extrudeModel/newExtrudeModel.C b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/extrudeModel/newExtrudeModel.C new file mode 100644 index 0000000000..4b076aa378 --- /dev/null +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/extrudeModel/newExtrudeModel.C @@ -0,0 +1,59 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 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 + +\*---------------------------------------------------------------------------*/ + +#include "extrudeModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::extrudeModel::New +( + const dictionary& dict +) +{ + word extrudeModelType(dict.lookup("extrudeModel")); + + Info<< "Selecting extrudeModel " << extrudeModelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(extrudeModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn("extrudeModel::New(const dictionary&)") + << "Unknown extrudeModelType type " + << extrudeModelType + << ", constructor not in hash table" << nl << nl + << " Valid extrudeModel types are :" << nl + << dictionaryConstructorTablePtr_->toc() << nl + << exit(FatalError); + } + + return autoPtr(cstrIter()(dict)); +} + + +// ************************************************************************* // + diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearNormal/linearNormal.C b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearNormal/linearNormal.C new file mode 100644 index 0000000000..74bb7ef501 --- /dev/null +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearNormal/linearNormal.C @@ -0,0 +1,79 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 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 + +\*---------------------------------------------------------------------------*/ + +#include "linearNormal.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace extrudeModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(linearNormal, 0); + +addToRunTimeSelectionTable(extrudeModel, linearNormal, dictionary); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +linearNormal::linearNormal(const dictionary& dict) +: + extrudeModel(typeName, dict), + thickness_(readScalar(coeffDict_.lookup("thickness"))) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +linearNormal::~linearNormal() +{} + + +// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * // + +point linearNormal::operator() +( + const point& surfacePoint, + const vector& surfaceNormal, + const label layer +) const +{ + scalar d = thickness_*layer/nLayers_; + return surfacePoint + d*surfaceNormal; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace extrudeModels +} // End namespace Foam + +// ************************************************************************* // + diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/linearNormalExtruder.H b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearNormal/linearNormal.H similarity index 80% rename from applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/linearNormalExtruder.H rename to applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearNormal/linearNormal.H index d1c86f97df..1b6e499888 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/linearNormalExtruder.H +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearNormal/linearNormal.H @@ -23,27 +23,33 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::linearNormalExtruder + Foam::extrudeModels::linearNormal Description + Extrudes by transforming points normal to the surface by a given distance \*---------------------------------------------------------------------------*/ -#ifndef linearNormalExtruder_H -#define linearNormalExtruder_H +#ifndef linearNormal_H +#define linearNormal_H #include "point.H" +#include "extrudeModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { +namespace extrudeModels +{ /*---------------------------------------------------------------------------*\ - Class linearNormalExtruder Declaration + Class linearNormal Declaration \*---------------------------------------------------------------------------*/ -class linearNormalExtruder +class linearNormal +: + public extrudeModel { // Private data @@ -53,13 +59,17 @@ class linearNormalExtruder public: + //- Runtime type information + TypeName("linearNormal"); + // Constructors //- Construct from components - linearNormalExtruder(const scalar thickness) - : - thickness_(thickness) - {} + linearNormal(const dictionary& dict); + + + //- Destructor + ~linearNormal(); // Member Operators @@ -68,19 +78,14 @@ public: ( const point& surfacePoint, const vector& surfaceNormal, - const label nLayers, const label layer - ) const - { - scalar d = thickness_*layer/nLayers; - - return surfacePoint + d*surfaceNormal; - } + ) const; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace extrudeModels } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -88,3 +93,4 @@ public: #endif // ************************************************************************* // + diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearRadial/linearRadial.C b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearRadial/linearRadial.C new file mode 100644 index 0000000000..3c9ab8162a --- /dev/null +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearRadial/linearRadial.C @@ -0,0 +1,82 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 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 + +\*---------------------------------------------------------------------------*/ + +#include "linearRadial.H" +#include "addToRunTimeSelectionTable.H" + +namespace Foam +{ +namespace extrudeModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(linearRadial, 0); + +addToRunTimeSelectionTable(extrudeModel, linearRadial, dictionary); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +linearRadial::linearRadial(const dictionary& dict) +: + extrudeModel(typeName, dict), + R_(readScalar(coeffDict_.lookup("R"))) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +linearRadial::~linearRadial() +{} + + +// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * // + +point linearRadial::operator() +( + const point& surfacePoint, + const vector& surfaceNormal, + const label layer +) const +{ + // radius of the surface + scalar rs = mag(surfacePoint); + vector rsHat = surfacePoint/rs; + + scalar delta = (R_ - rs)/nLayers_; + scalar r = rs + layer*delta; + return r*rsHat; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace extrudeModels +} // End namespace Foam + +// ************************************************************************* // + diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/linearRadialExtruder.H b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearRadial/linearRadial.H similarity index 77% rename from applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/linearRadialExtruder.H rename to applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearRadial/linearRadial.H index 5a20c66042..be6073da99 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/linearRadialExtruder.H +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearRadial/linearRadial.H @@ -23,27 +23,31 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::linearRadialExtruder + Foam::extrudeModels::linearRadial Description \*---------------------------------------------------------------------------*/ -#ifndef linearRadialExtruder_H -#define linearRadialExtruder_H +#ifndef linearRadial_H +#define linearRadial_H -#include "point.H" +#include "extrudeModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { +namespace extrudeModels +{ /*---------------------------------------------------------------------------*\ - Class linearRadialExtruder Declaration + Class linearRadial Declaration \*---------------------------------------------------------------------------*/ -class linearRadialExtruder +class linearRadial +: + public extrudeModel { // Private data @@ -52,13 +56,17 @@ class linearRadialExtruder public: + //- Runtime type information + TypeName("linearRadial"); + // Constructors //- Construct from components - linearRadialExtruder(const scalar R) - : - R_(R) - {} + linearRadial(const dictionary& dict); + + + //- Destructor + ~linearRadial(); // Member Operators @@ -67,23 +75,14 @@ public: ( const point& surfacePoint, const vector& surfaceNormal, - const label nLayers, const label layer - ) const - { - // radius of the surface - scalar rs = mag(surfacePoint); - vector rsHat = surfacePoint/rs; - - scalar delta = (R_ - rs)/nLayers; - scalar r = rs + layer*delta; - return r*rsHat; - } + ) const; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace extrudeModels } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -91,3 +90,4 @@ public: #endif // ************************************************************************* // + diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/sigmaRadial/sigmaRadial.C b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/sigmaRadial/sigmaRadial.C new file mode 100644 index 0000000000..b1536800bb --- /dev/null +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/sigmaRadial/sigmaRadial.C @@ -0,0 +1,87 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 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 + +\*---------------------------------------------------------------------------*/ + +#include "sigmaRadial.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace extrudeModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(sigmaRadial, 0); + +addToRunTimeSelectionTable(extrudeModel, sigmaRadial, dictionary); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +sigmaRadial::sigmaRadial(const dictionary& dict) +: + extrudeModel(typeName, dict), + RTbyg_(readScalar(coeffDict_.lookup("RTbyg"))), + pRef_(readScalar(coeffDict_.lookup("pRef"))), + pStrat_(readScalar(coeffDict_.lookup("pStrat"))) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +sigmaRadial::~sigmaRadial() +{} + + +// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * // + +point sigmaRadial::operator() +( + const point& surfacePoint, + const vector& surfaceNormal, + const label layer +) const +{ + // radius of the surface + scalar rs = mag(surfacePoint); + vector rsHat = surfacePoint/rs; + + scalar p = pRef_ - layer*(pRef_ - pStrat_)/nLayers_; + scalar r = rs - RTbyg_*log(p/pRef_); + + return r*rsHat; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace extrudeModels +} // End namespace Foam + +// ************************************************************************* // + diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/sigmaRadialExtruder.H b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/sigmaRadial/sigmaRadial.H similarity index 73% rename from applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/sigmaRadialExtruder.H rename to applications/utilities/mesh/generation/extrudeMesh/extrudeModel/sigmaRadial/sigmaRadial.H index 9bc1bfc6ae..4819ded58c 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/sigmaRadialExtruder.H +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/sigmaRadial/sigmaRadial.H @@ -23,27 +23,31 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::sigmaRadialExtruder + Foam::extrudeModels::sigmaRadial Description \*---------------------------------------------------------------------------*/ -#ifndef sigmaRadialExtruder_H -#define sigmaRadialExtruder_H +#ifndef sigmaRadial_H +#define sigmaRadial_H -#include "point.H" +#include "extrudeModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { +namespace extrudeModels +{ /*---------------------------------------------------------------------------*\ - Class sigmaRadialExtruder Declaration + Class sigmaRadial Declaration \*---------------------------------------------------------------------------*/ -class sigmaRadialExtruder +class sigmaRadial +: + public extrudeModel { // Private data @@ -54,20 +58,17 @@ class sigmaRadialExtruder public: + //- Runtime type information + TypeName("sigmaRadial"); + // Constructors //- Construct from components - sigmaRadialExtruder - ( - const scalar RTbyg, - const scalar pRef, - const scalar pStrat - ) - : - RTbyg_(RTbyg), - pRef_(pRef), - pStrat_(pStrat) - {} + sigmaRadial(const dictionary& dict); + + + //-Destructor + ~sigmaRadial(); // Member Operators @@ -76,24 +77,14 @@ public: ( const point& surfacePoint, const vector& surfaceNormal, - const label nLayers, const label layer - ) const - { - // radius of the surface - scalar rs = mag(surfacePoint); - vector rsHat = surfacePoint/rs; - - scalar p = pRef_ - layer*(pRef_ - pStrat_)/nLayers; - scalar r = rs - RTbyg_*Foam::log(p/pRef_); - - return r*rsHat; - } + ) const; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace extrudeModels } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -101,3 +92,4 @@ public: #endif // ************************************************************************* // + diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.C b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.C new file mode 100644 index 0000000000..589d04443a --- /dev/null +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.C @@ -0,0 +1,127 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 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 + +\*---------------------------------------------------------------------------*/ + +#include "wedge.H" +#include "addToRunTimeSelectionTable.H" +#include "mathematicalConstants.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace extrudeModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(wedge, 0); + +addToRunTimeSelectionTable(extrudeModel, wedge, dictionary); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +wedge::wedge(const dictionary& dict) +: + extrudeModel(typeName, dict), + axisPt_(coeffDict_.lookup("axisPt")), + axisNormal_(coeffDict_.lookup("axisNormal")), + angle_ + ( + readScalar(coeffDict_.lookup("angle")) + *mathematicalConstant::pi/180.0 + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +wedge::~wedge() +{} + + +// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * // + +point wedge::operator() +( + const point& surfacePoint, + const vector& surfaceNormal, + const label layer +) const +{ + scalar sliceAngle; + // For the case of a single layer extrusion assume a + // symmetric wedge about the reference plane is required + if (nLayers_ == 1) + { + if (layer == 0) + { + sliceAngle = -angle_/2.0; + } + else + { + sliceAngle = angle_/2.0; + } + } + else + { + sliceAngle = angle_*(layer + 1)/nLayers_; + } + + // Find projection onto axis (or rather decompose surfacePoint + // into vector along edge (proj), vector normal to edge in plane + // of surface point and surface normal. + point d = surfacePoint - axisPt_; + + d -= (axisNormal_ & d)*axisNormal_; + + scalar dMag = mag(d); + + point edgePt = surfacePoint - d; + + // Rotate point around sliceAngle. + point rotatedPoint = edgePt; + + if (dMag > VSMALL) + { + vector n = (d/dMag) ^ axisNormal_; + + rotatedPoint += + + cos(sliceAngle)*d + - sin(sliceAngle)*mag(d)*n; // Use either n or surfaceNormal + } + + return rotatedPoint; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace extrudeModels +} // End namespace Foam + +// ************************************************************************* // + diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/wedgeExtruder.H b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.H similarity index 56% rename from applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/wedgeExtruder.H rename to applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.H index b4d6c68644..681cff2c7f 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/wedgeExtruder.H +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.H @@ -23,29 +23,40 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::wedgeExtruder + Foam::extrudeModels::wedge Description Extrudes by rotating a surface around an axis - + - extrusion is opposite the surface/patch normal so inwards the source + mesh + - axis direction has to be consistent with this. + - use -mergeFaces option if doing full 360 and want to merge front and back + - note direction of axis. This should be consistent with rotating against + the patch normal direction. If you get it wrong you'll see all cells + with extreme aspect ratio and internal faces wrong way around in + checkMesh \*---------------------------------------------------------------------------*/ -#ifndef wedgeExtruder_H -#define wedgeExtruder_H +#ifndef wedge_H +#define wedge_H -#include "point.H" +#include "extrudeModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { +namespace extrudeModels +{ /*---------------------------------------------------------------------------*\ - Class wedgeExtruder Declaration + Class wedge Declaration \*---------------------------------------------------------------------------*/ -class wedgeExtruder +class wedge +: + public extrudeModel { // Private data @@ -58,22 +69,19 @@ class wedgeExtruder //- overall angle (radians) const scalar angle_; + public: + //- Runtime type information + TypeName("wedge"); + // Constructors //- Construct from components - wedgeExtruder - ( - const point& axisPt, - const point& axisNormal, - const scalar angle - ) - : - axisPt_(axisPt), - axisNormal_(axisNormal), - angle_(angle) - {} + wedge(const dictionary& dict); + + //- Destrcuctor + ~wedge(); // Member Operators @@ -82,60 +90,14 @@ public: ( const point& surfacePoint, const vector& surfaceNormal, - const label nLayers, const label layer - ) const - { - scalar sliceAngle; - - // For the case of a single layer extrusion assume a - // symmetric wedge about the reference plane is required - if (nLayers == 1) - { - if (layer == 0) - { - sliceAngle = -angle_/2.0; - } - else - { - sliceAngle = angle_/2.0; - } - } - else - { - sliceAngle = angle_ * (layer+1)/nLayers; - } - - // Find projection onto axis (or rather decompose surfacePoint - // into vector along edge (proj), vector normal to edge in plane - // of surface point and surface normal. - point d = surfacePoint - axisPt_; - - d -= (axisNormal_&d)*axisNormal_; - - scalar dMag = mag(d); - - point edgePt = surfacePoint - d; - - // Rotate point around sliceAngle. - point rotatedPoint = edgePt; - - if (dMag > VSMALL) - { - vector n = (d/dMag) ^ axisNormal_; - - rotatedPoint += - + cos(sliceAngle)*d - - sin(sliceAngle)*mag(d)*n; // Use either n or surfaceNormal - } - - return rotatedPoint; - } + ) const; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace extrudeModels } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeProperties b/applications/utilities/mesh/generation/extrudeMesh/extrudeProperties new file mode 100644 index 0000000000..c9b7977508 --- /dev/null +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeProperties @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object extrudeProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +extrudeModel wedge; +//extrudeModel linearNormal; +//extrudeModel linearRadial; +//extrudeModel sigmaRadial; + +nLayers 1; + +wedgeCoeffs +{ + axisPt (0 0 0); + axisNormal (0 -1 0); + angle 2.0; +} + +linearNormalCoeffs +{ + thickness 0.1; +} + +linearRadialCoeffs +{ + R 0.1; +} + +sigmaRadialCoeffs +{ + RTbyg 1; + pRef 1; + pStrat 1; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/extrudedMesh.C b/applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/extrudedMesh.C index 6ac35c797f..b650224ec8 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/extrudedMesh.C +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/extrudedMesh.C @@ -46,19 +46,19 @@ template < class Face, template class FaceList, - class PointField, - class PointExtruder + class PointField > Foam::pointField Foam::extrudedMesh::extrudedPoints ( const PrimitivePatch& extrudePatch, - const label nLayers, - const PointExtruder& extruder + const extrudeModel& model ) { const pointField& surfacePoints = extrudePatch.localPoints(); const vectorField& surfaceNormals = extrudePatch.pointNormals(); + const label nLayers = model.nLayers(); + pointField ePoints((nLayers + 1)*surfacePoints.size()); for (label layer=0; layer<=nLayers; layer++) @@ -67,11 +67,10 @@ Foam::pointField Foam::extrudedMesh::extrudedPoints forAll(surfacePoints, i) { - ePoints[offset + i] = extruder + ePoints[offset + i] = model ( surfacePoints[i], surfaceNormals[i], - nLayers, layer ); } @@ -85,7 +84,7 @@ template class FaceList, class PointField> Foam::faceList Foam::extrudedMesh::extrudedFaces ( const PrimitivePatch& extrudePatch, - const label nLayers + const extrudeModel& model ) { const pointField& surfacePoints = extrudePatch.localPoints(); @@ -93,6 +92,8 @@ Foam::faceList Foam::extrudedMesh::extrudedFaces const edgeList& surfaceEdges = extrudePatch.edges(); const label nInternalEdges = extrudePatch.nInternalEdges(); + const label nLayers = model.nLayers(); + label nFaces = (nLayers + 1)*surfaceFaces.size() + nLayers*surfaceEdges.size(); @@ -108,7 +109,7 @@ Foam::faceList Foam::extrudedMesh::extrudedFaces label nextLayerOffset = currentLayerOffset + surfacePoints.size(); // Side faces from layer to layer+1 - for (label i = 0; i < nInternalEdges; i++) + for (label i=0; i class FaceList, class PointField> Foam::cellList Foam::extrudedMesh::extrudedCells ( const PrimitivePatch& extrudePatch, - const label nLayers + const extrudeModel& model ) { const List& surfaceFaces = extrudePatch.localFaces(); const edgeList& surfaceEdges = extrudePatch.edges(); const label nInternalEdges = extrudePatch.nInternalEdges(); + const label nLayers = model.nLayers(); + cellList eCells(nLayers*surfaceFaces.size()); // Size the cells @@ -200,7 +203,7 @@ Foam::cellList Foam::extrudedMesh::extrudedCells for (label layer=0; layer class FaceList, - class PointField, - class PointExtruder + class PointField > Foam::extrudedMesh::extrudedMesh ( const IOobject& io, const PrimitivePatch& extrudePatch, - const label nLayers, - const PointExtruder& extruder + const extrudeModel& model ) : polyMesh ( io, - extrudedPoints(extrudePatch, nLayers, extruder), - extrudedFaces(extrudePatch, nLayers), - extrudedCells(extrudePatch, nLayers) - ) + extrudedPoints(extrudePatch, model), + extrudedFaces(extrudePatch, model), + extrudedCells(extrudePatch, model) + ), + model_(model) { List patches(3); label facei = nInternalFaces(); - label sz = nLayers*(extrudePatch.nEdges() - extrudePatch.nInternalEdges()); + label sz = + model_.nLayers() + *(extrudePatch.nEdges() - extrudePatch.nInternalEdges()); patches[0] = new wallPolyPatch ( @@ -351,3 +355,4 @@ Foam::extrudedMesh::extrudedMesh // ************************************************************************* // + diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/extrudedMesh.H b/applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/extrudedMesh.H index b40210cfa2..71bfb2e07b 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/extrudedMesh.H +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/extrudedMesh.H @@ -36,6 +36,7 @@ SourceFiles #define extrudedMesh_H #include "polyMesh.H" +#include "extrudeModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -50,24 +51,22 @@ class extrudedMesh : public polyMesh { + // Private data + + const extrudeModel& model_; + + // Private Member Functions //- Do edge and face use points in same order? static bool sameOrder(const face&, const edge&); //- Construct and return the extruded mesh points - template - < - class Face, - template class FaceList, - class PointField, - class PointExtruder - > + template class FaceList, class PointField> pointField extrudedPoints ( const PrimitivePatch& extrudePatch, - const label nLayers, - const PointExtruder& extruder + const extrudeModel& model ); //- Construct and return the extruded mesh faces @@ -75,7 +74,7 @@ class extrudedMesh faceList extrudedFaces ( const PrimitivePatch& extrudePatch, - const label nLayers + const extrudeModel& model ); //- Construct and return the extruded mesh cells @@ -83,7 +82,7 @@ class extrudedMesh cellList extrudedCells ( const PrimitivePatch& extrudePatch, - const label nLayers + const extrudeModel& model ); @@ -99,19 +98,12 @@ public: // Constructors //- Construct from the primitivePatch to extrude - template - < - class Face, - template class FaceList, - class PointField, - class PointExtruder - > + template class FaceList, class PointField> extrudedMesh ( const IOobject& io, const PrimitivePatch& extrudePatch, - const label nLayers, - const PointExtruder& extruder + const extrudeModel& model ); }; @@ -133,3 +125,4 @@ public: #endif // ************************************************************************* // + diff --git a/applications/utilities/mesh/generation/extrudeMesh/faceMesh.H b/applications/utilities/mesh/generation/extrudeMesh/faceMesh.H index cb5f89a7e1..a9714d9bac 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/faceMesh.H +++ b/applications/utilities/mesh/generation/extrudeMesh/faceMesh.H @@ -51,12 +51,14 @@ class faceMesh : public PrimitivePatch { - PrimitivePatch read(Istream& is) - { - pointField points(is); - faceList faces(is); - return PrimitivePatch(faces, points); - } + // Private member functions + + PrimitivePatch read(Istream& is) + { + pointField points(is); + faceList faces(is); + return PrimitivePatch(faces, points); + } public: diff --git a/applications/utilities/mesh/generation/extrudeMesh/setRoots.H b/applications/utilities/mesh/generation/extrudeMesh/setRoots.H index fd37e12e37..255949426b 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/setRoots.H +++ b/applications/utilities/mesh/generation/extrudeMesh/setRoots.H @@ -1,13 +1,6 @@ argList::validArgs.clear(); argList::noParallel(); - argList::validArgs.append("target root"); - argList::validArgs.append("target case"); - - argList::validArgs.append("nLayers"); - argList::validArgs.append("overal thickness"); - - argList::validOptions.insert("sourceRoot", "source root"); argList::validOptions.insert("sourceCase", "source case"); argList::validOptions.insert("sourcePatch", "source patch"); @@ -23,16 +16,3 @@ FatalError.exit(); } - - fileName rootDirTarget(args.additionalArgs()[0]); - fileName caseDirTarget(args.additionalArgs()[1]); - - label nLayers(readLabel(IStringStream(args.additionalArgs()[2])())); - scalar thickness(readScalar(IStringStream(args.additionalArgs()[3])())); - - Info<< "Target: " << rootDirTarget << " " << caseDirTarget << endl; - - Info<< "Extruding layers:" << nl - << " number of layers " << nLayers << nl - << " overall thickness " << thickness << nl - << endl; diff --git a/bin/tools/buildParaViewFunctions b/bin/tools/buildParaViewFunctions index dd18e7342d..5d70681343 100644 --- a/bin/tools/buildParaViewFunctions +++ b/bin/tools/buildParaViewFunctions @@ -140,6 +140,7 @@ buildParaView () { # set general options addCMakeVariable "BUILD_SHARED_LIBS:BOOL=ON" + addCMakeVariable "CMAKE_BUILD_TYPE:STRING=Release" # set paraview environment unset PARAVIEW_SRC_DIR diff --git a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C index 97dfc106f6..54e7985d0d 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C @@ -134,7 +134,7 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const const unallocLabelList& faceCells = p.patch().faceCells(); // Build the d-vectors - vectorField pd = + vectorField pd = mesh.Sf().boundaryField()[patchi] /( mesh.magSf().boundaryField()[patchi] @@ -198,7 +198,7 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const const unallocLabelList& faceCells = p.faceCells(); // Build the d-vectors - vectorField pd = + vectorField pd = mesh.Sf().boundaryField()[patchi] /( mesh.magSf().boundaryField()[patchi] @@ -239,6 +239,7 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const // For 3D meshes check the determinant of the dd tensor and switch to // Gauss if it is less than 3 + /* Currently the det(dd[celli]) criterion is incorrect: dd is weighted by Sf if (mesh.nGeometricD() == 3) { label nBadCells = 0; @@ -279,7 +280,7 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const if (mesh.boundary()[patchi].size()) { - label patchFacei = + label patchFacei = facei - mesh.boundaryMesh()[patchi].start(); if (mesh.boundary()[patchi].coupled()) @@ -294,14 +295,14 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const 0.2 ); - lsP.boundaryField()[patchi][patchFacei] = + lsP.boundaryField()[patchi][patchFacei] = (1 - wf) *Sf.boundaryField()[patchi][patchFacei] /V[celli]; } else { - lsP.boundaryField()[patchi][patchFacei] = + lsP.boundaryField()[patchi][patchFacei] = Sf.boundaryField()[patchi][patchFacei] /V[celli]; } @@ -318,7 +319,7 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const << endl; } } - + */ if (debug) { diff --git a/src/lagrangian/molecularDynamics/potential/energyScalingFunction/derived/shifted/shifted.H b/src/lagrangian/molecularDynamics/potential/energyScalingFunction/derived/shifted/shifted.H index 86b65a8215..0841bfe56c 100644 --- a/src/lagrangian/molecularDynamics/potential/energyScalingFunction/derived/shifted/shifted.H +++ b/src/lagrangian/molecularDynamics/potential/energyScalingFunction/derived/shifted/shifted.H @@ -57,7 +57,6 @@ class shifted scalar e_at_rCut_; - public: //- Runtime type information diff --git a/src/meshTools/octree/treeBoundBox.C b/src/meshTools/octree/treeBoundBox.C index 6cbe0161c9..042209ec7c 100644 --- a/src/meshTools/octree/treeBoundBox.C +++ b/src/meshTools/octree/treeBoundBox.C @@ -27,8 +27,6 @@ License #include "treeBoundBox.H" #include "ListOps.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // const Foam::treeBoundBox Foam::treeBoundBox::greatBox @@ -50,6 +48,7 @@ const Foam::label facesArray[6][4] = }; //! @endcond + const Foam::faceList Foam::treeBoundBox::faces ( initListList(facesArray) @@ -74,12 +73,34 @@ const Foam::label edgesArray[12][2] = }; //! @endcond + const Foam::edgeList Foam::treeBoundBox::edges ( initListList(edgesArray) ); +const Foam::FixedList Foam::treeBoundBox::faceNormals +( + calcFaceNormals() +); + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::FixedList Foam::treeBoundBox::calcFaceNormals() +{ + FixedList normals; + normals[LEFT] = vector(-1, 0, 0); + normals[RIGHT] = vector( 1, 0, 0); + normals[BOTTOM] = vector( 0, -1, 0); + normals[TOP] = vector( 0, 1, 0); + normals[BACK] = vector( 0, 0, -1); + normals[FRONT] = vector( 0, 0, 1); + return normals; +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Construct as the bounding box of the given pointField diff --git a/src/meshTools/octree/treeBoundBox.H b/src/meshTools/octree/treeBoundBox.H index c4784cb9bc..01d7a9a6bd 100644 --- a/src/meshTools/octree/treeBoundBox.H +++ b/src/meshTools/octree/treeBoundBox.H @@ -78,6 +78,11 @@ class treeBoundBox public boundBox { +private: + + //- To initialise faceNormals. + static FixedList calcFaceNormals(); + public: // Static data members @@ -142,6 +147,9 @@ public: //- Edge to point addressing static const edgeList edges; + //- Per face the unit normal + static const FixedList faceNormals; + //- Face on which neighbour is static direction neighbourFaceBits(const label&); diff --git a/src/postProcessing/fieldAverage/fieldAverage/fieldAverage.C b/src/postProcessing/fieldAverage/fieldAverage/fieldAverage.C index f2b48b8318..dcb00c06d6 100644 --- a/src/postProcessing/fieldAverage/fieldAverage/fieldAverage.C +++ b/src/postProcessing/fieldAverage/fieldAverage/fieldAverage.C @@ -85,23 +85,23 @@ void Foam::fieldAverage::initialise() const word fieldName = faItems_[i].fieldName(); if (obr_.foundObject(fieldName)) { - addMeanFields(i, meanScalarFields_); + addMeanField(i, meanScalarFields_); } else if (obr_.foundObject(fieldName)) { - addMeanFields(i, meanVectorFields_); + addMeanField(i, meanVectorFields_); } else if (obr_.foundObject(fieldName)) { - addMeanFields(i, meanSphericalTensorFields_); + addMeanField(i, meanSphericalTensorFields_); } else if (obr_.foundObject(fieldName)) { - addMeanFields(i, meanSymmTensorFields_); + addMeanField(i, meanSymmTensorFields_); } else if (obr_.foundObject(fieldName)) { - addMeanFields(i, meanTensorFields_); + addMeanField(i, meanTensorFields_); } else { @@ -118,29 +118,29 @@ void Foam::fieldAverage::initialise() if (faItems_[i].prime2Mean()) { const word fieldName = faItems_[i].fieldName(); + if (!faItems_[i].mean()) + { + FatalErrorIn("Foam::fieldAverage::initialise()") + << "To calculate the prime-squared average, the " + << "mean average must also be selected for field " + << fieldName << nl << exit(FatalError); + } + if (obr_.foundObject(fieldName)) { - if (!faItems_[i].mean()) - { - FatalErrorIn("Foam::fieldAverage::initialise()") - << "To calculate the prime-squared average, the " - << "mean average must also be selected for field " - << fieldName << nl << exit(FatalError); - } - addPrime2MeanFields(i, prime2MeanScalarFields_); + addPrime2MeanField + ( + i, + meanScalarFields_, + prime2MeanScalarFields_ + ); } else if (obr_.foundObject(fieldName)) { - if (!faItems_[i].mean()) - { - FatalErrorIn("Foam::fieldAverage::initialise()") - << "To calculate the prime-squared average, the " - << "mean average must also be selected for field " - << fieldName << nl << exit(FatalError); - } - addPrime2MeanFields + addPrime2MeanField ( i, + meanVectorFields_, prime2MeanSymmTensorFields_ ); } @@ -251,8 +251,16 @@ void Foam::fieldAverage::calcAverages() totalTime_[i] += obr_.time().deltaT().value(); } - addMeanSqrToPrime2Mean(prime2MeanScalarFields_); - addMeanSqrToPrime2Mean(prime2MeanSymmTensorFields_); + addMeanSqrToPrime2Mean + ( + meanScalarFields_, + prime2MeanScalarFields_ + ); + addMeanSqrToPrime2Mean + ( + meanVectorFields_, + prime2MeanSymmTensorFields_ + ); calculateMeanFields(meanScalarFields_); calculateMeanFields(meanVectorFields_); @@ -260,8 +268,16 @@ void Foam::fieldAverage::calcAverages() calculateMeanFields(meanSymmTensorFields_); calculateMeanFields(meanTensorFields_); - calculatePrime2MeanFields(prime2MeanScalarFields_); - calculatePrime2MeanFields(prime2MeanSymmTensorFields_); + calculatePrime2MeanFields + ( + meanScalarFields_, + prime2MeanScalarFields_ + ); + calculatePrime2MeanFields + ( + meanVectorFields_, + prime2MeanSymmTensorFields_ + ); } diff --git a/src/postProcessing/fieldAverage/fieldAverage/fieldAverage.H b/src/postProcessing/fieldAverage/fieldAverage/fieldAverage.H index 01e48bb71e..5c080e1873 100644 --- a/src/postProcessing/fieldAverage/fieldAverage/fieldAverage.H +++ b/src/postProcessing/fieldAverage/fieldAverage/fieldAverage.H @@ -161,22 +161,21 @@ protected: // valid, and populate field lists void initialise(); - //- Add mean average fields to PtrLists + //- Add mean average field to PtrList template - void addMeanFields + void addMeanField ( - const label fieldi, + const label, PtrList >& - fieldList ); - //- Add prime-squared average fields to PtrLists + //- Add prime-squared average field to PtrList template - void addPrime2MeanFields + void addPrime2MeanField ( - const label fieldi, + const label, + PtrList >&, PtrList >& - fieldList ); @@ -190,23 +189,22 @@ protected: void calculateMeanFields ( PtrList >& - fieldList ); //- Add mean-squared field value to prime-squared mean field template void addMeanSqrToPrime2Mean ( + PtrList >&, PtrList >& - fieldList ); //- Calculate prime-squared average fields template void calculatePrime2MeanFields ( + PtrList >&, PtrList >& - fieldList ); diff --git a/src/postProcessing/fieldAverage/fieldAverage/fieldAverageTemplates.C b/src/postProcessing/fieldAverage/fieldAverage/fieldAverageTemplates.C index 13dfd02502..b1448a5e3a 100644 --- a/src/postProcessing/fieldAverage/fieldAverage/fieldAverageTemplates.C +++ b/src/postProcessing/fieldAverage/fieldAverage/fieldAverageTemplates.C @@ -31,23 +31,22 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template -void Foam::fieldAverage::addMeanFields +void Foam::fieldAverage::addMeanField ( const label fieldi, - PtrList >& fieldList + PtrList >& meanFieldList ) { if (faItems_[fieldi].mean()) { typedef GeometricField fieldType; - const fvMesh& mesh = refCast(obr_); const word& fieldName = faItems_[fieldi].fieldName(); - const fieldType& baseField = mesh.lookupObject(fieldName); - const word meanFieldName = fieldName + EXT_MEAN; + const fieldType& baseField = obr_.lookupObject(fieldName); + const word meanFieldName = fieldName + EXT_MEAN; Info<< "Reading/calculating field " << meanFieldName << nl << endl; - fieldList.set + meanFieldList.set ( fieldi, new fieldType @@ -55,8 +54,8 @@ void Foam::fieldAverage::addMeanFields IOobject ( meanFieldName, - mesh.time().timeName(), - mesh, + obr_.time().timeName(), + obr_, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE ), @@ -68,26 +67,25 @@ void Foam::fieldAverage::addMeanFields template -void Foam::fieldAverage::addPrime2MeanFields +void Foam::fieldAverage::addPrime2MeanField ( const label fieldi, - PtrList >& fieldList + PtrList >& meanFieldList, + PtrList >& prime2MeanFieldList ) { - if (faItems_[fieldi].mean()) + if (faItems_[fieldi].mean() && meanFieldList.set(fieldi)) { typedef GeometricField fieldType1; typedef GeometricField fieldType2; - const fvMesh& mesh = refCast(obr_); const word& fieldName = faItems_[fieldi].fieldName(); - const fieldType1& baseField = mesh.lookupObject(fieldName); - const fieldType1& meanField = - mesh.lookupObject(fieldName + EXT_MEAN); - const word meanFieldName = fieldName + EXT_PRIME2MEAN; + const fieldType1& baseField = obr_.lookupObject(fieldName); + const fieldType1& meanField = meanFieldList[fieldi]; + const word meanFieldName = fieldName + EXT_PRIME2MEAN; Info<< "Reading/calculating field " << meanFieldName << nl << endl; - fieldList.set + prime2MeanFieldList.set ( fieldi, new fieldType2 @@ -95,8 +93,8 @@ void Foam::fieldAverage::addPrime2MeanFields IOobject ( meanFieldName, - mesh.time().timeName(), - mesh, + obr_.time().timeName(), + obr_, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE ), @@ -110,7 +108,7 @@ void Foam::fieldAverage::addPrime2MeanFields template void Foam::fieldAverage::calculateMeanFields ( - PtrList >& fieldList + PtrList >& meanFieldList ) { typedef GeometricField fieldType; @@ -119,31 +117,27 @@ void Foam::fieldAverage::calculateMeanFields forAll(faItems_, i) { - if (fieldList.set(i)) + if (faItems_[i].mean() && meanFieldList.set(i)) { - if (faItems_[i].mean()) + const word& fieldName = faItems_[i].fieldName(); + const fieldType& baseField = + obr_.lookupObject(fieldName); + fieldType& meanField = meanFieldList[i]; + + scalar alpha = 0.0; + scalar beta = 0.0; + if (faItems_[i].timeBase()) { - const fvMesh& mesh = refCast(obr_); - const word& fieldName = faItems_[i].fieldName(); - const fieldType& baseField = - mesh.lookupObject(fieldName); - fieldType& meanField = fieldList[i]; - - scalar alpha = 0.0; - scalar beta = 0.0; - if (faItems_[i].timeBase()) - { - alpha = (totalTime_[i] - dt)/totalTime_[i]; - beta = dt/totalTime_[i]; - } - else - { - alpha = scalar(totalIter_[i] - 1)/scalar(totalIter_[i]); - beta = 1.0/scalar(totalIter_[i]); - } - - meanField = alpha*meanField + beta*baseField; + alpha = (totalTime_[i] - dt)/totalTime_[i]; + beta = dt/totalTime_[i]; } + else + { + alpha = scalar(totalIter_[i] - 1)/scalar(totalIter_[i]); + beta = 1.0/scalar(totalIter_[i]); + } + + meanField = alpha*meanField + beta*baseField; } } } @@ -152,7 +146,8 @@ void Foam::fieldAverage::calculateMeanFields template void Foam::fieldAverage::calculatePrime2MeanFields ( - PtrList >& fieldList + PtrList >& meanFieldList, + PtrList >& prime2MeanFieldList ) { typedef GeometricField fieldType1; @@ -162,36 +157,36 @@ void Foam::fieldAverage::calculatePrime2MeanFields forAll(faItems_, i) { - if (fieldList.set(i)) + if + ( + faItems_[i].prime2Mean() + && meanFieldList.set(i) + && prime2MeanFieldList.set(i) + ) { - if (faItems_[i].prime2Mean()) + const word& fieldName = faItems_[i].fieldName(); + const fieldType1& baseField = + obr_.lookupObject(fieldName); + const fieldType1& meanField = meanFieldList[i]; + fieldType2& prime2MeanField = prime2MeanFieldList[i]; + + scalar alpha = 0.0; + scalar beta = 0.0; + if (faItems_[i].timeBase()) { - const fvMesh& mesh = refCast(obr_); - const word& fieldName = faItems_[i].fieldName(); - const fieldType1& baseField = - mesh.lookupObject(fieldName); - const fieldType1& meanField = - mesh.lookupObject(fieldName + EXT_MEAN); - fieldType2& prime2MeanField = fieldList[i]; - - scalar alpha = 0.0; - scalar beta = 0.0; - if (faItems_[i].timeBase()) - { - alpha = (totalTime_[i] - dt)/totalTime_[i]; - beta = dt/totalTime_[i]; - } - else - { - alpha = scalar(totalIter_[i] - 1)/scalar(totalIter_[i]); - beta = 1.0/scalar(totalIter_[i]); - } - - prime2MeanField = - alpha*prime2MeanField - + beta*sqr(baseField) - - sqr(meanField); + alpha = (totalTime_[i] - dt)/totalTime_[i]; + beta = dt/totalTime_[i]; } + else + { + alpha = scalar(totalIter_[i] - 1)/scalar(totalIter_[i]); + beta = 1.0/scalar(totalIter_[i]); + } + + prime2MeanField = + alpha*prime2MeanField + + beta*sqr(baseField) + - sqr(meanField); } } } @@ -200,7 +195,8 @@ void Foam::fieldAverage::calculatePrime2MeanFields template void Foam::fieldAverage::addMeanSqrToPrime2Mean ( - PtrList >& fieldList + PtrList >& meanFieldList, + PtrList >& prime2MeanFieldList ) { typedef GeometricField fieldType1; @@ -208,18 +204,17 @@ void Foam::fieldAverage::addMeanSqrToPrime2Mean forAll(faItems_, i) { - if (fieldList.set(i)) + if + ( + faItems_[i].prime2Mean() + && meanFieldList.set(i) + && prime2MeanFieldList.set(i) + ) { - if (faItems_[i].prime2Mean()) - { - const fvMesh& mesh = refCast(obr_); - const word& fieldName = faItems_[i].fieldName(); - const fieldType1& meanField = - mesh.lookupObject(fieldName + EXT_MEAN); - fieldType2& prime2MeanField = fieldList[i]; + const fieldType1& meanField = meanFieldList[i]; + fieldType2& prime2MeanField = prime2MeanFieldList[i]; - prime2MeanField += sqr(meanField); - } + prime2MeanField += sqr(meanField); } } } diff --git a/tutorials/buoyantFoam/hotRoom/0/p b/tutorials/buoyantFoam/hotRoom/0/p index cdf7cab2f7..10cf8ccf8e 100644 --- a/tutorials/buoyantFoam/hotRoom/0/p +++ b/tutorials/buoyantFoam/hotRoom/0/p @@ -20,21 +20,21 @@ internalField uniform 100000; boundaryField { - floor + floor { - type fixedFluxBuoyantPressure; + type calculated; value uniform 100000; } - ceiling + ceiling { - type fixedFluxBuoyantPressure; + type calculated; value uniform 100000; } - fixedWalls + fixedWalls { - type fixedFluxBuoyantPressure; + type calculated; value uniform 100000; } } diff --git a/tutorials/buoyantFoam/hotRoom/0/pd b/tutorials/buoyantFoam/hotRoom/0/pd new file mode 100644 index 0000000000..3a679ba63a --- /dev/null +++ b/tutorials/buoyantFoam/hotRoom/0/pd @@ -0,0 +1,42 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object pd; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + floor + { + type fixedFluxBuoyantPressure; + value uniform 0; + } + + ceiling + { + type fixedFluxBuoyantPressure; + value uniform 0; + } + + fixedWalls + { + type fixedFluxBuoyantPressure; + value uniform 0; + } +} + +// ************************************************************************* // diff --git a/tutorials/buoyantFoam/hotRoom/constant/thermophysicalProperties b/tutorials/buoyantFoam/hotRoom/constant/thermophysicalProperties index 7eb3ee5b9f..845c425d42 100644 --- a/tutorials/buoyantFoam/hotRoom/constant/thermophysicalProperties +++ b/tutorials/buoyantFoam/hotRoom/constant/thermophysicalProperties @@ -18,4 +18,6 @@ thermoType hThermo system/machines +runParallel $application 4 system/machines +runApplication reconstructPar diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/constant/LESProperties b/tutorials/compressibleLesInterFoam/depthCharge3D/constant/LESProperties new file mode 100644 index 0000000000..976ee308c2 --- /dev/null +++ b/tutorials/compressibleLesInterFoam/depthCharge3D/constant/LESProperties @@ -0,0 +1,182 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.0 | +| \\ / A nd | Web: http://www.openfoam.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +FoamFile +{ + version 2.0; + format ascii; + + root ""; + case ""; + instance ""; + local ""; + + class dictionary; + object LESProperties; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +LESModel laminar; + +delta smooth; + +laminarCoeffs +{ +} + +oneEqEddyCoeffs +{ + ck 0.07; + ce 1.05; +} + +dynOneEqEddyCoeffs +{ + ce 1.05; + filter simple; +} + +locDynOneEqEddyCoeffs +{ + ce 1.05; + filter simple; +} + +SmagorinskyCoeffs +{ + ce 1.05; + ck 0.07; +} + +Smagorinsky2Coeffs +{ + ce 1.05; + ck 0.07; + cD2 0.02; +} + +spectEddyViscCoeffs +{ + ce 1.05; + cB 8.22; + cK1 0.83; + cK2 1.03; + cK3 4.75; + cK4 2.55; +} + +dynSmagorinskyCoeffs +{ + ce 1.05; + filter simple; +} + +mixedSmagorinskyCoeffs +{ + ce 1.05; + ck 0.07; + filter simple; +} + +dynMixedSmagorinskyCoeffs +{ + ce 1.05; + filter simple; +} + +LRRDiffStressCoeffs +{ + ce 1.05; + ck 0.09; + c1 1.8; + c2 0.6; +} + +DeardorffDiffStressCoeffs +{ + ce 1.05; + ck 0.09; + cm 4.13; +} + +SpalartAllmarasCoeffs +{ + alphaNut 1.5; + Cb1 0.1355; + Cb2 0.622; + Cw2 0.3; + Cw3 2; + Cv1 7.1; + CDES 0.65; + ck 0.07; +} + +cubeRootVolCoeffs +{ + deltaCoeff 1; +} + +PrandtlCoeffs +{ + delta cubeRootVol; + cubeRootVolCoeffs + { + deltaCoeff 1; + } + smoothCoeffs + { + delta cubeRootVol; + cubeRootVolCoeffs + { + deltaCoeff 1; + } + maxDeltaRatio 1.1; + } + Cdelta 0.158; +} + +vanDriestCoeffs +{ + delta cubeRootVol; + cubeRootVolCoeffs + { + deltaCoeff 1; + } + smoothCoeffs + { + delta cubeRootVol; + cubeRootVolCoeffs + { + deltaCoeff 1; + } + maxDeltaRatio 1.1; + } + Aplus 26; + Cdelta 0.158; +} + +smoothCoeffs +{ + delta cubeRootVol; + cubeRootVolCoeffs + { + deltaCoeff 1; + } + maxDeltaRatio 1.1; +} + +kappa 0.4187; + +wallFunctionCoeffs +{ + E 9; +} + + +// ************************************************************************* // diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/constant/environmentalProperties b/tutorials/compressibleLesInterFoam/depthCharge3D/constant/environmentalProperties new file mode 100644 index 0000000000..a5d1b7134e --- /dev/null +++ b/tutorials/compressibleLesInterFoam/depthCharge3D/constant/environmentalProperties @@ -0,0 +1,27 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.0 | +| \\ / A nd | Web: http://www.openfoam.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +FoamFile +{ + version 2.0; + format ascii; + + root ""; + case ""; + instance ""; + local ""; + + class dictionary; + object environmentalProperties; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +g g [0 1 -2 0 0 0 0] (0 -9.81 0); + +// ************************************************************************* // diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/constant/polyMesh/blockMeshDict b/tutorials/compressibleLesInterFoam/depthCharge3D/constant/polyMesh/blockMeshDict new file mode 100644 index 0000000000..6a0e1ca9ce --- /dev/null +++ b/tutorials/compressibleLesInterFoam/depthCharge3D/constant/polyMesh/blockMeshDict @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 1; + +vertices +( + (0 0 0) + (1 0 0) + (1 2 0) + (0 2 0) + (0 0 1) + (1 0 1) + (1 2 1) + (0 2 1) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (80 160 80) simpleGrading (1 1 1) +); + +patches +( + wall walls + ( + (3 7 6 2) + (0 4 7 3) + (2 6 5 1) + (1 5 4 0) + (0 3 2 1) + (4 5 6 7) + ) +); + +// ************************************************************************* // diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/constant/polyMesh/boundary b/tutorials/compressibleLesInterFoam/depthCharge3D/constant/polyMesh/boundary new file mode 100644 index 0000000000..8856b4ac44 --- /dev/null +++ b/tutorials/compressibleLesInterFoam/depthCharge3D/constant/polyMesh/boundary @@ -0,0 +1,28 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class polyBoundaryMesh; + location "constant/polyMesh"; + object boundary; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +1 +( + walls + { + type wall; + nFaces 64000; + startFace 3040000; + } +) + +// ************************************************************************* // diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/constant/transportProperties b/tutorials/compressibleLesInterFoam/depthCharge3D/constant/transportProperties new file mode 100644 index 0000000000..201e3b4946 --- /dev/null +++ b/tutorials/compressibleLesInterFoam/depthCharge3D/constant/transportProperties @@ -0,0 +1,39 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +phase1 //water +{ + transportModel Newtonian; + nu nu [0 2 -1 0 0 0 0] 1e-6; + rho rho [1 -3 0 0 0 0 0] 1000; + rho0 rho0 [1 -3 0 0 0 0 0] 1000; + psi psi [0 -2 2 0 0] 1e-5; +} + +phase2 //air +{ + transportModel Newtonian; + nu nu [0 2 -1 0 0 0 0] 1.589e-5; + rho rho [1 -3 0 0 0 0 0] 1; + rho0 rho0 [1 -3 0 0 0 0 0] 0; + psi psi [0 -2 2 0 0] 1e-5; +} + +pMin pMin [1 -1 -2 0 0 0 0] 1e4; + +sigma sigma [1 0 -2 0 0 0 0] 0.07; + +// ************************************************************************* // diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/system/controlDict b/tutorials/compressibleLesInterFoam/depthCharge3D/system/controlDict new file mode 100644 index 0000000000..0580c2dc55 --- /dev/null +++ b/tutorials/compressibleLesInterFoam/depthCharge3D/system/controlDict @@ -0,0 +1,53 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application lesInterFoam; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 0.5; + +deltaT 1e-04; + +writeControl adjustableRunTime; + +writeInterval 5e-03; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 8; + +writeCompression compressed; + +timeFormat general; + +timePrecision 10; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 0.25; + +maxDeltaT 1; + +// ************************************************************************* // diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/system/decomposeParDict b/tutorials/compressibleLesInterFoam/depthCharge3D/system/decomposeParDict new file mode 100644 index 0000000000..f8801b351d --- /dev/null +++ b/tutorials/compressibleLesInterFoam/depthCharge3D/system/decomposeParDict @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method hierarchical; +//method metis; +//method parMetis; + +simpleCoeffs +{ + n (1 4 1); + delta 0.001; +} + +hierarchicalCoeffs +{ + n (1 4 1); + delta 0.001; + order xyz; +} + +metisCoeffs +{} + +manualCoeffs +{ + dataFile ""; +} + +distributed no; + +roots +( +); + +// ************************************************************************* // diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/system/fvSchemes b/tutorials/compressibleLesInterFoam/depthCharge3D/system/fvSchemes new file mode 100644 index 0000000000..ee05b3ed1d --- /dev/null +++ b/tutorials/compressibleLesInterFoam/depthCharge3D/system/fvSchemes @@ -0,0 +1,64 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + div(rho*phi,U) Gauss upwind; //linear; + + div(phi,alpha) Gauss vanLeer; + div(phirb,alpha) Gauss interfaceCompression 1.0; + + div(phi,pd) Gauss upwind; //vanLeer; //linear; + + div(phi,k) Gauss vanLeer; + + div((nuEff*dev(grad(U).T()))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear uncorrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default uncorrected; +} + +fluxRequired +{ + default no; + pd; + pcorr; + gamma; +} + +// ************************************************************************* // diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/system/fvSolution b/tutorials/compressibleLesInterFoam/depthCharge3D/system/fvSolution new file mode 100644 index 0000000000..f97cf54032 --- /dev/null +++ b/tutorials/compressibleLesInterFoam/depthCharge3D/system/fvSolution @@ -0,0 +1,126 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + pcorr PCG + { + preconditioner GAMG + { + tolerance 1e-5; + relTol 0; + + smoother DICGaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + nBottomSweeps 2; + + cacheAgglomeration false; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + }; + + tolerance 1e-5; + relTol 0; + maxIter 100; + }; + + rho diagonal + {}; + + pd GAMG + { + tolerance 1e-7; + relTol 0.01; + + smoother DIC; //GaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + nFinestSweeps 2; + + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + }; + + pdFinal PCG + { + preconditioner GAMG + { + tolerance 1e-7; + relTol 0; + + nVcycles 2; + + smoother DICGaussSeidel; + nPreSweeps 2; + nPostSweeps 2; + nFinestSweeps 2; + + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + }; + + tolerance 1e-7; + relTol 0; + maxIter 20; + }; + + U smoothSolver + { + smoother GaussSeidel; + tolerance 1e-6; + relTol 0; + nSweeps 1; + }; + + k PBiCG + { + preconditioner DILU; + tolerance 1e-08; + relTol 0; + }; + B PBiCG + { + preconditioner DILU; + tolerance 1e-08; + relTol 0; + }; + nuTilda PBiCG + { + preconditioner DILU; + tolerance 1e-08; + relTol 0; + }; +} + +PISO +{ + momentumPredictor no; + transSonic no; + nOuterCorrectors 3; + nCorrectors 1; + nNonOrthogonalCorrectors 0; + nAlphaCorr 1; + nAlphaSubCycles 1; + cGamma 1; +} + +// ************************************************************************* // diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/system/machines b/tutorials/compressibleLesInterFoam/depthCharge3D/system/machines new file mode 100644 index 0000000000..4b24efafd5 --- /dev/null +++ b/tutorials/compressibleLesInterFoam/depthCharge3D/system/machines @@ -0,0 +1 @@ +noisy diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/system/setFieldsDict b/tutorials/compressibleLesInterFoam/depthCharge3D/system/setFieldsDict new file mode 100644 index 0000000000..d0e4350372 --- /dev/null +++ b/tutorials/compressibleLesInterFoam/depthCharge3D/system/setFieldsDict @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object setFieldsDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +defaultFieldValues +( + volScalarFieldValue alpha1 1 + volScalarFieldValue pd 1e5 +); + +regions +( + sphereToCell + { + centre (0.5 0.5 0.5); + radius 0.1; + + fieldValues + ( + volScalarFieldValue alpha1 0 + volScalarFieldValue pd 10e5 + ); + } + + boxToCell + { + box (-10 1 -1) (10 10 1); + + fieldValues + ( + volScalarFieldValue alpha1 0 + ); + } +); + +// ************************************************************************* // diff --git a/tutorials/gnemdFoam/nanoNozzle/system/potentialDict b/tutorials/gnemdFoam/nanoNozzle/system/potentialDict index b5207eea24..7789766620 100644 --- a/tutorials/gnemdFoam/nanoNozzle/system/potentialDict +++ b/tutorials/gnemdFoam/nanoNozzle/system/potentialDict @@ -63,7 +63,7 @@ pair shift2 0.97e-9; scale2 1.2e11; } - writeTables yes; + writeTables no; } Ar-Ne @@ -80,7 +80,7 @@ pair epsilon 8.765026657e-22; } energyScalingFunction shiftedForce; - writeTables yes; + writeTables no; } Ne-Ne @@ -97,7 +97,7 @@ pair epsilon 5.813260729e-22; } energyScalingFunction shiftedForce; - writeTables yes; + writeTables no; } } diff --git a/tutorials/lesCavitatingFoam/Allclean b/tutorials/lesCavitatingFoam/Allclean index d37677187f..35d86a2121 100755 --- a/tutorials/lesCavitatingFoam/Allclean +++ b/tutorials/lesCavitatingFoam/Allclean @@ -14,7 +14,7 @@ cd .. cd throttle3D rm -rf constant/polyMesh/sets > /dev/null 2>&1 rm -rf 0 > /dev/null 2>&1 - cp -r 0.orig 0 + cp -r 0.org 0 rm system/cellSetDict > /dev/null 2>&1 rm -rf processor[0-9] > /dev/null 2>&1 diff --git a/tutorials/lesCavitatingFoam/Allrun b/tutorials/lesCavitatingFoam/Allrun index f16d9a5c00..33517002c0 100755 --- a/tutorials/lesCavitatingFoam/Allrun +++ b/tutorials/lesCavitatingFoam/Allrun @@ -26,7 +26,7 @@ cd throttle cd .. cd throttle3D - cp -r 0.orig 0 + cp -r 0.org 0 runApplication blockMesh @@ -42,3 +42,4 @@ cd throttle3D runParallel $application 4 system/machines runApplication reconstructPar cd .. + diff --git a/tutorials/lesCavitatingFoam/throttle3D/0.org/U b/tutorials/lesCavitatingFoam/throttle3D/0.org/U new file mode 100644 index 0000000000..00bd1a6a19 --- /dev/null +++ b/tutorials/lesCavitatingFoam/throttle3D/0.org/U @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type zeroGradient; + value uniform (0 0 0); + } + + outlet + { + type zeroGradient; + value uniform (0 0 0); + } + + walls + { + type fixedValue; + value uniform (0 0 0); + } + + frontBack + { + type fixedValue; + value uniform (0 0 0); + } +} + +// ************************************************************************* // diff --git a/tutorials/lesCavitatingFoam/throttle3D/0.org/gamma b/tutorials/lesCavitatingFoam/throttle3D/0.org/gamma new file mode 100644 index 0000000000..8a9e660169 --- /dev/null +++ b/tutorials/lesCavitatingFoam/throttle3D/0.org/gamma @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object gamma; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type calculated; + value uniform 0; + } + + outlet + { + type calculated; + value uniform 0; + } + + walls + { + type calculated; + value uniform 0; + } + + frontBack + { + type calculated; + value uniform 0; + } +} + +// ************************************************************************* // diff --git a/tutorials/buoyantFoam/hotRoom/0/R b/tutorials/lesCavitatingFoam/throttle3D/0.org/k similarity index 79% rename from tutorials/buoyantFoam/hotRoom/0/R rename to tutorials/lesCavitatingFoam/throttle3D/0.org/k index 497fafd279..1deb4efcb9 100644 --- a/tutorials/buoyantFoam/hotRoom/0/R +++ b/tutorials/lesCavitatingFoam/throttle3D/0.org/k @@ -9,28 +9,34 @@ FoamFile { version 2.0; format ascii; - class volSymmTensorField; - object R; + class volScalarField; + object k; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [0 2 -2 0 0 0 0]; +dimensions [0 2 -2 0 0]; -internalField uniform (0 0 0 0 0 0); +internalField uniform 10.0; boundaryField { - floor + inlet + { + type fixedValue; + value uniform 0.5; + } + + outlet { type zeroGradient; } - ceiling + walls { type zeroGradient; } - fixedWalls + frontBack { type zeroGradient; } diff --git a/tutorials/lesCavitatingFoam/throttle3D/0.org/nuSgs b/tutorials/lesCavitatingFoam/throttle3D/0.org/nuSgs new file mode 100644 index 0000000000..908414b2ea --- /dev/null +++ b/tutorials/lesCavitatingFoam/throttle3D/0.org/nuSgs @@ -0,0 +1,43 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class volScalarField; + object nuSgs; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -1 0 0 0 0]; + +internalField uniform 1e-11; + +boundaryField +{ + inlet + { + type zeroGradient; + } + outlet + { + type zeroGradient; + } + walls + { + type fixedValue; + value uniform 0; + } + frontBack + { + type fixedValue; + value uniform 0; + } +} + +// ************************************************************************* // diff --git a/tutorials/lesCavitatingFoam/throttle3D/0.org/p b/tutorials/lesCavitatingFoam/throttle3D/0.org/p new file mode 100644 index 0000000000..245ce1f46b --- /dev/null +++ b/tutorials/lesCavitatingFoam/throttle3D/0.org/p @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0]; + +internalField uniform 300e5; + +boundaryField +{ + inlet + { + type totalPressure; + U U; + phi phiv; + rho rho; + psi none; + gamma 1; + p0 uniform 300e5; + } + + outlet + { + type fixedValue; + value uniform 100e5; + } + + walls + { + type zeroGradient; + } + + frontBack + { + type zeroGradient; + } +} + +// ************************************************************************* // diff --git a/tutorials/buoyantSimpleFoam/hotRoom/0/R b/tutorials/lesCavitatingFoam/throttle3D/0.org/rho similarity index 74% rename from tutorials/buoyantSimpleFoam/hotRoom/0/R rename to tutorials/lesCavitatingFoam/throttle3D/0.org/rho index 0c5efc0097..c3a355b28e 100644 --- a/tutorials/buoyantSimpleFoam/hotRoom/0/R +++ b/tutorials/lesCavitatingFoam/throttle3D/0.org/rho @@ -9,28 +9,35 @@ FoamFile { version 2.0; format ascii; - class volSymmTensorField; - object R; + class volScalarField; + object rho; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [0 -2 -2 0 0 0 0]; +dimensions [1 -3 0 0 0]; -internalField uniform (0 0 0 0 0 0); +internalField uniform 845; boundaryField { - floor + inlet + { + type fixedValue; + value uniform 845; + } + + outlet + { + type fixedValue; + value uniform 835; + } + + walls { type zeroGradient; } - ceiling - { - type zeroGradient; - } - - fixedWalls + frontBack { type zeroGradient; } diff --git a/tutorials/mdEquilibrationFoam/periodicCube/system/controlDict b/tutorials/mdEquilibrationFoam/periodicCube/system/controlDict index fec9c326de..76f7ed8a7e 100644 --- a/tutorials/mdEquilibrationFoam/periodicCube/system/controlDict +++ b/tutorials/mdEquilibrationFoam/periodicCube/system/controlDict @@ -20,7 +20,7 @@ startTime 0; stopAt endTime; -endTime 4e-10; +endTime 1e-10; deltaT 1e-14; diff --git a/tutorials/mhdFoam/Allrun b/tutorials/mhdFoam/Allrun index 57065d0204..df0077cf05 100755 --- a/tutorials/mhdFoam/Allrun +++ b/tutorials/mhdFoam/Allrun @@ -3,7 +3,7 @@ . $WM_PROJECT_DIR/bin/tools/RunFunctions # Get application name from directory -application=`basename $PWD` +application="mdEquilibrationFoam" (cd hartmann && runApplication blockMesh) (cd hartmann && runApplication $application) diff --git a/tutorials/rasCavitatingFoam/throttle/system/fvSolution b/tutorials/rasCavitatingFoam/throttle/system/fvSolution index ecacbfeb1d..f6bad1ada0 100644 --- a/tutorials/rasCavitatingFoam/throttle/system/fvSolution +++ b/tutorials/rasCavitatingFoam/throttle/system/fvSolution @@ -46,7 +46,7 @@ solvers p GAMG { - preconditioner 1e-5; + tolerance 1e-8; relTol 0; smoother GaussSeidel; diff --git a/tutorials/rasInterFoam/damBreak/Allrun b/tutorials/rasInterFoam/damBreak/Allrun index 599b286f3d..4e77ce4173 100755 --- a/tutorials/rasInterFoam/damBreak/Allrun +++ b/tutorials/rasInterFoam/damBreak/Allrun @@ -3,7 +3,7 @@ . $WM_PROJECT_DIR/bin/tools/RunFunctions # Get application name from directory -application="interFoam" +application="rasInterFoam" runApplication blockMesh runApplication setFields diff --git a/tutorials/simpleFoam/pitzDailyExptInlet/system/decomposeParDict b/tutorials/simpleFoam/pitzDailyExptInlet/system/decomposeParDict index 0eb9e31146..296e5226e1 100644 --- a/tutorials/simpleFoam/pitzDailyExptInlet/system/decomposeParDict +++ b/tutorials/simpleFoam/pitzDailyExptInlet/system/decomposeParDict @@ -17,7 +17,7 @@ FoamFile numberOfSubdomains 4; method hierarchical; -method metis; +//method metis; //method parMetis; simpleCoeffs @@ -34,15 +34,7 @@ hierarchicalCoeffs } metisCoeffs -{ - //processorWeights - //( - // 1 - // 1 - // 1 - // 1 - //); -} +{} manualCoeffs { @@ -51,7 +43,7 @@ manualCoeffs distributed no; -roots +roots ( ); diff --git a/wmake/rules/linux64Gcc/dirToString b/wmake/rules/linux64Gcc/dirToString deleted file mode 100755 index 1f9e9266a6..0000000000 Binary files a/wmake/rules/linux64Gcc/dirToString and /dev/null differ diff --git a/wmake/rules/linux64Gcc/wmkdep b/wmake/rules/linux64Gcc/wmkdep deleted file mode 100755 index 002e73dea8..0000000000 Binary files a/wmake/rules/linux64Gcc/wmkdep and /dev/null differ diff --git a/wmake/src/lex.yy.c b/wmake/src/lex.yy.c deleted file mode 100644 index f9381dc27b..0000000000 --- a/wmake/src/lex.yy.c +++ /dev/null @@ -1,2514 +0,0 @@ - -#line 3 "lex.yy.c" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 33 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ -#include -#include -#include -#include - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have . Non-C99 systems may or may not. */ - -#if __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -#if __STDC__ - -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN (yy_start) = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START (((yy_start) - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart(yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#define YY_BUF_SIZE 16384 -#endif - -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -extern int yyleng; - -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - - #define YY_LESS_LINENO(n) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, (yytext_ptr) ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef unsigned int yy_size_t; -#endif - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) - -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart (FILE *input_file ); -void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); -void yy_delete_buffer (YY_BUFFER_STATE b ); -void yy_flush_buffer (YY_BUFFER_STATE b ); -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); -void yypop_buffer_state (void ); - -static void yyensure_buffer_stack (void ); -static void yy_load_buffer_state (void ); -static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); - -#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) - -YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); - -void *yyalloc (yy_size_t ); -void *yyrealloc (void *,yy_size_t ); -void yyfree (void * ); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -/* Begin user sect3 */ - -typedef unsigned char YY_CHAR; - -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; - -typedef int yy_state_type; - -extern int yylineno; - -int yylineno = 1; - -extern char *yytext; -#define yytext_ptr yytext - -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - yyleng = (size_t) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - -#define YY_NUM_RULES 19 -#define YY_END_OF_BUFFER 20 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static yyconst flex_int16_t yy_accept[285] = - { 0, - 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, - 17, 17, 20, 18, 18, 18, 18, 18, 18, 18, - 18, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 6, 6, 6, 6, 6, 6, 18, 18, 18, 18, - 18, 14, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 17, 17, 17, 17, 17, 17, 17, 17, 0, - 2, 0, 0, 0, 0, 0, 0, 0, 0, 4, - 6, 2, 6, 6, 6, 6, 6, 6, 6, 0, - 0, 14, 0, 0, 15, 2, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, - - 17, 2, 17, 17, 17, 17, 17, 17, 17, 17, - 0, 0, 1, 0, 0, 0, 6, 6, 6, 0, - 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, - 0, 17, 17, 1, 17, 17, 17, 0, 0, 0, - 0, 6, 6, 0, 0, 15, 0, 0, 0, 10, - 0, 0, 0, 0, 0, 9, 0, 0, 0, 12, - 0, 0, 0, 0, 17, 17, 17, 17, 0, 0, - 0, 0, 6, 6, 0, 10, 0, 10, 0, 0, - 0, 8, 0, 9, 0, 9, 12, 0, 12, 0, - 0, 0, 11, 0, 0, 0, 17, 17, 17, 17, - - 0, 0, 0, 0, 6, 6, 0, 10, 8, 0, - 8, 0, 9, 12, 11, 0, 11, 0, 0, 0, - 17, 17, 17, 17, 0, 0, 0, 7, 6, 6, - 0, 8, 0, 11, 0, 0, 7, 17, 17, 17, - 7, 0, 0, 6, 0, 0, 0, 17, 17, 0, - 0, 6, 0, 0, 0, 0, 13, 0, 17, 17, - 0, 5, 0, 13, 0, 13, 17, 5, 0, 0, - 13, 17, 0, 0, 17, 0, 0, 17, 0, 0, - 17, 16, 16, 0 - } ; - -static yyconst flex_int32_t yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 1, 5, 6, 1, 1, 1, 7, 1, - 1, 8, 1, 1, 1, 1, 9, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 10, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 11, 1, 12, 13, - - 14, 1, 15, 16, 17, 18, 1, 19, 20, 21, - 22, 23, 1, 24, 25, 26, 27, 28, 29, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst flex_int32_t yy_meta[30] = - { 0, - 1, 1, 2, 3, 4, 1, 5, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1 - } ; - -static yyconst flex_int16_t yy_base[316] = - { 0, - 0, 8, 11, 24, 40, 48, 14, 64, 81, 54, - 20, 109, 806, 807, 807, 801, 26, 57, 115, 4, - 781, 807, 807, 792, 782, 28, 118, 121, 60, 766, - 0, 0, 30, 127, 126, 761, 38, 59, 68, 104, - 131, 126, 137, 138, 142, 146, 147, 173, 772, 156, - 156, 0, 0, 767, 71, 161, 178, 183, 746, 757, - 807, 753, 187, 184, 731, 190, 195, 725, 718, 807, - 0, 0, 205, 209, 201, 716, 212, 710, 703, 161, - 209, 212, 217, 713, 708, 220, 228, 224, 227, 231, - 232, 235, 0, 244, 243, 680, 258, 244, 249, 0, - - 678, 0, 0, 264, 265, 659, 272, 269, 656, 651, - 669, 669, 807, 281, 637, 626, 287, 630, 614, 289, - 297, 298, 306, 305, 269, 309, 313, 317, 627, 316, - 321, 614, 165, 0, 330, 596, 577, 594, 331, 576, - 568, 567, 558, 334, 346, 347, 348, 566, 352, 356, - 360, 359, 367, 562, 368, 374, 375, 556, 381, 382, - 388, 539, 387, 391, 538, 401, 515, 509, 499, 406, - 469, 463, 449, 442, 409, 450, 406, 416, 417, 446, - 423, 424, 427, 442, 431, 437, 438, 441, 445, 449, - 420, 453, 457, 416, 456, 286, 405, 467, 377, 368, - - 371, 468, 368, 337, 361, 398, 469, 470, 353, 482, - 483, 430, 489, 490, 349, 496, 497, 328, 500, 507, - 323, 510, 307, 516, 283, 203, 281, 517, 274, 520, - 515, 521, 520, 527, 530, 531, 544, 263, 461, 235, - 545, 194, 551, 554, 549, 555, 560, 190, 565, 179, - 569, 573, 571, 575, 151, 579, 583, 592, 132, 599, - 115, 807, 597, 127, 601, 605, 48, 0, 42, 604, - 611, 34, 26, 612, 17, 621, 625, 626, 630, 636, - 643, 807, 631, 807, 650, 655, 660, 665, 670, 675, - 680, 685, 689, 694, 699, 704, 709, 714, 719, 724, - - 729, 734, 739, 744, 749, 754, 759, 764, 769, 774, - 779, 784, 789, 794, 799 - } ; - -static yyconst flex_int16_t yy_def[316] = - { 0, - 285, 285, 286, 286, 287, 287, 285, 285, 284, 9, - 288, 288, 284, 284, 284, 284, 284, 284, 284, 284, - 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, - 289, 289, 289, 289, 289, 289, 290, 290, 290, 291, - 290, 290, 290, 290, 290, 290, 290, 290, 48, 48, - 290, 292, 292, 292, 292, 292, 292, 292, 292, 284, - 284, 293, 284, 284, 284, 284, 284, 284, 284, 284, - 289, 289, 294, 289, 289, 289, 289, 289, 289, 290, - 291, 290, 290, 291, 291, 291, 295, 290, 290, 290, - 290, 290, 48, 48, 290, 48, 48, 290, 290, 292, - - 292, 292, 296, 292, 292, 292, 292, 292, 292, 292, - 284, 293, 284, 284, 284, 284, 294, 289, 289, 290, - 295, 297, 295, 298, 290, 290, 299, 300, 48, 290, - 290, 292, 296, 292, 292, 292, 292, 284, 284, 284, - 284, 289, 289, 290, 297, 297, 298, 301, 302, 298, - 303, 290, 299, 304, 305, 299, 300, 306, 307, 300, - 308, 48, 290, 290, 292, 292, 292, 292, 284, 284, - 284, 284, 289, 289, 290, 301, 302, 302, 303, 309, - 310, 303, 290, 304, 305, 305, 306, 307, 307, 308, - 311, 312, 308, 48, 290, 290, 292, 292, 292, 292, - - 284, 284, 284, 284, 289, 289, 290, 302, 309, 310, - 310, 290, 305, 307, 311, 312, 312, 48, 290, 290, - 292, 292, 292, 292, 284, 284, 284, 284, 289, 289, - 290, 310, 290, 312, 290, 290, 290, 292, 292, 292, - 292, 284, 284, 289, 290, 313, 290, 292, 292, 284, - 284, 289, 290, 313, 314, 315, 313, 290, 292, 292, - 284, 284, 290, 314, 315, 315, 292, 292, 284, 290, - 315, 292, 284, 290, 292, 284, 290, 292, 284, 290, - 292, 284, 290, 0, 284, 284, 284, 284, 284, 284, - 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, - - 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, - 284, 284, 284, 284, 284 - } ; - -static yyconst flex_int16_t yy_nxt[837] = - { 0, - 284, 15, 134, 16, 284, 67, 112, 67, 17, 18, - 284, 19, 23, 20, 24, 15, 17, 16, 25, 26, - 68, 53, 17, 54, 21, 27, 14, 28, 55, 29, - 278, 25, 26, 61, 62, 61, 62, 72, 73, 276, - 30, 32, 14, 16, 14, 81, 275, 82, 33, 34, - 14, 19, 14, 35, 273, 48, 33, 49, 63, 50, - 63, 67, 64, 67, 36, 18, 81, 19, 82, 20, - 51, 83, 17, 65, 272, 81, 68, 82, 102, 103, - 21, 37, 38, 14, 39, 14, 37, 37, 40, 41, - 42, 37, 43, 37, 37, 37, 37, 37, 44, 45, - - 37, 37, 46, 37, 37, 47, 37, 37, 37, 37, - 56, 81, 57, 85, 58, 14, 63, 55, 66, 63, - 64, 63, 63, 64, 66, 59, 64, 77, 74, 67, - 63, 65, 75, 81, 65, 82, 264, 65, 86, 87, - 82, 269, 78, 76, 81, 81, 82, 82, 89, 81, - 267, 82, 90, 81, 81, 82, 82, 97, 88, 97, - 264, 80, 104, 81, 104, 82, 105, 134, 81, 91, - 82, 112, 98, 92, 93, 99, 93, 106, 94, 104, - 81, 107, 82, 105, 108, 67, 108, 67, 63, 95, - 63, 63, 64, 114, 106, 64, 67, 261, 67, 109, - - 68, 259, 77, 65, 67, 250, 65, 113, 112, 112, - 74, 68, 63, 77, 75, 67, 81, 78, 85, 81, - 120, 82, 69, 242, 81, 76, 82, 81, 78, 85, - 113, 81, 112, 82, 81, 122, 82, 123, 81, 81, - 82, 82, 81, 124, 82, 97, 127, 97, 249, 80, - 81, 81, 82, 82, 125, 128, 81, 126, 82, 97, - 98, 97, 99, 80, 130, 104, 108, 104, 108, 105, - 108, 131, 108, 104, 98, 135, 81, 105, 82, 151, - 106, 109, 63, 248, 139, 109, 64, 244, 106, 113, - 112, 112, 144, 81, 243, 82, 81, 65, 82, 113, - - 113, 112, 112, 242, 122, 122, 123, 146, 113, 148, - 112, 220, 149, 122, 150, 123, 81, 154, 82, 240, - 155, 158, 156, 81, 159, 82, 160, 163, 81, 152, - 82, 104, 63, 166, 170, 105, 64, 175, 228, 238, - 228, 81, 164, 82, 235, 161, 106, 65, 113, 113, - 112, 112, 148, 122, 122, 149, 148, 150, 215, 149, - 148, 178, 209, 149, 180, 150, 81, 181, 82, 182, - 183, 154, 154, 229, 155, 155, 156, 186, 154, 158, - 227, 155, 159, 156, 160, 158, 158, 225, 159, 159, - 189, 160, 191, 224, 81, 192, 82, 193, 81, 230, - - 82, 228, 104, 223, 198, 195, 105, 63, 221, 202, - 148, 64, 207, 149, 196, 208, 81, 106, 82, 218, - 148, 180, 65, 149, 181, 208, 182, 180, 180, 215, - 181, 181, 211, 182, 81, 154, 82, 81, 155, 82, - 213, 154, 212, 233, 155, 158, 213, 187, 159, 158, - 214, 184, 159, 191, 214, 209, 192, 191, 193, 176, - 192, 191, 217, 81, 192, 82, 193, 206, 104, 63, - 222, 63, 105, 64, 148, 205, 81, 149, 82, 208, - 110, 248, 219, 106, 226, 231, 180, 180, 204, 181, - 181, 232, 232, 154, 158, 203, 155, 159, 213, 214, - - 191, 191, 201, 192, 192, 234, 234, 81, 237, 82, - 237, 104, 236, 104, 81, 105, 82, 241, 228, 241, - 228, 230, 81, 228, 82, 180, 239, 81, 181, 82, - 232, 191, 200, 199, 192, 245, 234, 81, 81, 82, - 82, 197, 194, 246, 247, 237, 241, 237, 241, 99, - 245, 81, 251, 82, 251, 252, 81, 251, 82, 255, - 253, 258, 256, 258, 257, 187, 260, 81, 260, 82, - 251, 184, 251, 262, 252, 176, 251, 262, 81, 255, - 82, 174, 256, 255, 257, 173, 256, 255, 266, 263, - 256, 172, 257, 258, 171, 258, 262, 169, 168, 81, - - 260, 82, 260, 268, 81, 255, 82, 167, 256, 255, - 271, 81, 256, 82, 271, 255, 274, 165, 256, 81, - 271, 82, 279, 270, 279, 277, 280, 281, 280, 281, - 162, 279, 81, 279, 82, 143, 282, 280, 81, 280, - 82, 142, 283, 81, 281, 82, 281, 141, 140, 282, - 14, 14, 14, 14, 14, 22, 22, 22, 22, 22, - 31, 31, 31, 31, 31, 52, 52, 52, 52, 52, - 71, 113, 138, 137, 71, 80, 136, 80, 110, 80, - 84, 132, 84, 129, 84, 100, 100, 100, 100, 112, - 112, 112, 112, 112, 117, 117, 117, 117, 117, 121, - - 121, 121, 121, 121, 133, 133, 133, 133, 133, 145, - 145, 145, 145, 145, 147, 81, 147, 147, 147, 153, - 81, 153, 153, 153, 157, 119, 157, 157, 157, 148, - 118, 148, 148, 148, 177, 79, 177, 177, 177, 179, - 116, 179, 179, 179, 154, 115, 154, 154, 154, 185, - 69, 185, 185, 185, 158, 113, 158, 158, 158, 188, - 111, 188, 188, 188, 190, 110, 190, 190, 190, 180, - 101, 180, 180, 180, 210, 96, 210, 210, 210, 191, - 79, 191, 191, 191, 216, 69, 216, 216, 216, 254, - 70, 254, 254, 254, 255, 60, 255, 255, 255, 265, - - 69, 265, 265, 265, 60, 284, 13, 284, 284, 284, - 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, - 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, - 284, 284, 284, 284, 284, 284 - } ; - -static yyconst flex_int16_t yy_chk[837] = - { 0, - 0, 1, 103, 1, 0, 20, 103, 20, 1, 2, - 0, 2, 3, 2, 3, 7, 2, 7, 3, 3, - 20, 11, 7, 11, 2, 4, 11, 4, 11, 4, - 275, 4, 4, 17, 17, 26, 26, 33, 33, 273, - 4, 5, 5, 5, 5, 37, 272, 37, 5, 6, - 6, 6, 6, 6, 269, 10, 6, 10, 18, 10, - 18, 29, 18, 29, 6, 8, 38, 8, 38, 8, - 10, 39, 8, 18, 267, 39, 29, 39, 55, 55, - 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 12, 40, 12, 40, 12, 12, 19, 12, 19, 27, - 19, 27, 28, 27, 28, 12, 28, 35, 34, 35, - 34, 19, 34, 42, 27, 42, 264, 28, 41, 41, - 41, 261, 35, 34, 43, 44, 43, 44, 44, 45, - 259, 45, 45, 46, 47, 46, 47, 50, 43, 50, - 255, 50, 56, 51, 56, 51, 56, 133, 80, 46, - 80, 133, 50, 47, 48, 51, 48, 56, 48, 57, - 48, 57, 48, 57, 58, 64, 58, 64, 63, 48, - 63, 66, 63, 66, 57, 66, 67, 250, 67, 58, - - 64, 248, 75, 63, 75, 242, 66, 73, 73, 73, - 74, 67, 74, 77, 74, 77, 81, 75, 81, 82, - 83, 82, 226, 226, 83, 74, 83, 86, 77, 86, - 87, 88, 87, 88, 89, 87, 89, 87, 90, 91, - 90, 91, 92, 88, 92, 94, 91, 94, 240, 94, - 95, 98, 95, 98, 89, 92, 99, 90, 99, 97, - 94, 97, 95, 97, 98, 104, 105, 104, 105, 104, - 108, 99, 108, 107, 97, 107, 125, 107, 125, 125, - 104, 105, 114, 238, 114, 108, 114, 229, 107, 117, - 117, 117, 120, 196, 227, 196, 120, 114, 120, 121, - - 122, 121, 122, 225, 121, 122, 121, 122, 123, 124, - 123, 196, 124, 123, 124, 123, 126, 127, 126, 223, - 127, 128, 127, 130, 128, 130, 128, 130, 131, 126, - 131, 135, 139, 135, 139, 135, 139, 144, 204, 221, - 204, 144, 131, 144, 218, 128, 135, 139, 145, 146, - 145, 146, 147, 145, 146, 147, 149, 147, 215, 149, - 150, 149, 209, 150, 151, 150, 152, 151, 152, 151, - 152, 153, 155, 205, 153, 155, 153, 155, 156, 157, - 203, 156, 157, 156, 157, 159, 160, 201, 159, 160, - 159, 160, 161, 200, 163, 161, 163, 161, 164, 206, - - 164, 206, 166, 199, 166, 163, 166, 170, 197, 170, - 177, 170, 175, 177, 164, 177, 175, 166, 175, 194, - 178, 179, 170, 178, 179, 178, 179, 181, 182, 191, - 181, 182, 181, 182, 183, 185, 183, 212, 185, 212, - 185, 186, 183, 212, 186, 188, 186, 187, 188, 189, - 188, 184, 189, 190, 189, 180, 190, 192, 190, 176, - 192, 193, 192, 195, 193, 195, 193, 174, 198, 202, - 198, 202, 198, 202, 208, 173, 207, 208, 207, 208, - 239, 239, 195, 198, 202, 207, 210, 211, 172, 210, - 211, 210, 211, 213, 214, 171, 213, 214, 213, 214, - - 216, 217, 169, 216, 217, 216, 217, 219, 220, 219, - 220, 222, 219, 222, 220, 222, 220, 224, 228, 224, - 228, 230, 231, 230, 231, 232, 222, 233, 232, 233, - 232, 234, 168, 167, 234, 231, 234, 235, 236, 235, - 236, 165, 162, 233, 236, 237, 241, 237, 241, 235, - 235, 237, 243, 237, 243, 244, 245, 244, 245, 246, - 245, 247, 246, 247, 246, 158, 249, 247, 249, 247, - 251, 154, 251, 251, 252, 148, 252, 252, 253, 254, - 253, 143, 254, 256, 254, 142, 256, 257, 256, 253, - 257, 141, 257, 258, 140, 258, 258, 138, 137, 258, - - 260, 258, 260, 260, 263, 265, 263, 136, 265, 266, - 265, 270, 266, 270, 266, 271, 270, 132, 271, 274, - 271, 274, 276, 263, 276, 274, 277, 278, 277, 278, - 129, 279, 277, 279, 277, 119, 279, 280, 283, 280, - 283, 118, 280, 280, 281, 280, 281, 116, 115, 281, - 285, 285, 285, 285, 285, 286, 286, 286, 286, 286, - 287, 287, 287, 287, 287, 288, 288, 288, 288, 288, - 289, 112, 111, 110, 289, 290, 109, 290, 106, 290, - 291, 101, 291, 96, 291, 292, 292, 292, 292, 293, - 293, 293, 293, 293, 294, 294, 294, 294, 294, 295, - - 295, 295, 295, 295, 296, 296, 296, 296, 296, 297, - 297, 297, 297, 297, 298, 85, 298, 298, 298, 299, - 84, 299, 299, 299, 300, 79, 300, 300, 300, 301, - 78, 301, 301, 301, 302, 76, 302, 302, 302, 303, - 69, 303, 303, 303, 304, 68, 304, 304, 304, 305, - 65, 305, 305, 305, 306, 62, 306, 306, 306, 307, - 60, 307, 307, 307, 308, 59, 308, 308, 308, 309, - 54, 309, 309, 309, 310, 49, 310, 310, 310, 311, - 36, 311, 311, 311, 312, 30, 312, 312, 312, 313, - 25, 313, 313, 313, 314, 24, 314, 314, 314, 315, - - 21, 315, 315, 315, 16, 13, 284, 284, 284, 284, - 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, - 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, - 284, 284, 284, 284, 284, 284 - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -extern int yy_flex_debug; -int yy_flex_debug = 0; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#line 1 "wmkdep.l" -#line 2 "wmkdep.l" -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2008 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 - wmkdep - -Description - A fast dependency list generator which emulates the behaviour and - output of cpp -M. However, the output contains no duplications and - is ~40% faster than cpp. - - The algorithm uses flex to scan for includes and searches the files - found. Each file is entererd into a hash table so that files are - scaned only once. This is why this program is faster than cpp. - -Usage - wmkdep [ -Idirectory ... -Idirectory] filename - -\*---------------------------------------------------------------------------*/ - -#define FILE_STACK_SIZE 300 -#define HASH_TABLE_SIZE 500 - -#include -#include -#include -#include - -void nextFile(const char* fileName); -void importFile(const char* fileName); -void importDirectory(const char* dirName); - -# undef yywrap /* sometimes a macro by default */ - - -#line 792 "lex.yy.c" - -#define INITIAL 0 -#define CMNT 1 -#define CFNAME 2 -#define SCFNAME 3 -#define JFNAME 4 -#define FFNAME 5 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -static int yy_init_globals (void ); - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap (void ); -#else -extern int yywrap (void ); -#endif -#endif - - static void yyunput (int c,char *buf_ptr ); - -#ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); -#endif - -#ifndef YY_NO_INPUT - -#ifdef __cplusplus -static int yyinput (void ); -#else -static int input (void ); -#endif - -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - size_t n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ - }\ -\ - -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* end tables serialization structures and prototypes */ - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int yylex (void); - -#define YY_DECL int yylex (void) -#endif /* !YY_DECL */ - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - if ( yyleng > 0 ) \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ - (yytext[yyleng - 1] == '\n'); \ - YY_USER_ACTION - -/** The main scanner function which does all the work. - */ -YY_DECL -{ - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -#line 60 "wmkdep.l" - - -#line 956 "lex.yy.c" - - if ( !(yy_init) ) - { - (yy_init) = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_load_buffer_state( ); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); - - /* Support of yytext. */ - *yy_cp = (yy_hold_char); - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = (yy_start); - yy_current_state += YY_AT_BOL(); -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 285 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 807 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; - -case 1: -/* rule 1 can match eol */ -YY_RULE_SETUP -#line 62 "wmkdep.l" -; /* remove c++ style one line comments */ - YY_BREAK -case 2: -YY_RULE_SETUP -#line 64 "wmkdep.l" -BEGIN(CMNT); /* start removing c style comment */ - YY_BREAK -case 3: -/* rule 3 can match eol */ -YY_RULE_SETUP -#line 65 "wmkdep.l" -; - YY_BREAK -case 4: -YY_RULE_SETUP -#line 66 "wmkdep.l" -BEGIN(INITIAL); /* end removing c style comment */ - YY_BREAK -case 5: -YY_RULE_SETUP -#line 68 "wmkdep.l" -BEGIN(CFNAME); /* c-file name */ - YY_BREAK -case 6: -YY_RULE_SETUP -#line 69 "wmkdep.l" -{ BEGIN(INITIAL); nextFile(yytext); } /*"*/ - YY_BREAK -case 7: -YY_RULE_SETUP -#line 71 "wmkdep.l" -BEGIN(JFNAME); /* java-file name */ - YY_BREAK -case 8: -YY_RULE_SETUP -#line 72 "wmkdep.l" -BEGIN(INITIAL); - YY_BREAK -case 9: -YY_RULE_SETUP -#line 73 "wmkdep.l" -BEGIN(INITIAL); - YY_BREAK -case 10: -YY_RULE_SETUP -#line 74 "wmkdep.l" -BEGIN(INITIAL); - YY_BREAK -case 11: -YY_RULE_SETUP -#line 75 "wmkdep.l" -BEGIN(INITIAL); - YY_BREAK -case 12: -YY_RULE_SETUP -#line 76 "wmkdep.l" -BEGIN(INITIAL); - YY_BREAK -case 13: -YY_RULE_SETUP -#line 77 "wmkdep.l" -BEGIN(INITIAL); - YY_BREAK -case 14: -YY_RULE_SETUP -#line 78 "wmkdep.l" -{ BEGIN(INITIAL); importFile(yytext); } /*"*/ - YY_BREAK -case 15: -YY_RULE_SETUP -#line 79 "wmkdep.l" -{ BEGIN(INITIAL); importDirectory(yytext); } /*"*/ - YY_BREAK -case 16: -YY_RULE_SETUP -#line 81 "wmkdep.l" -BEGIN(FFNAME); /* FORTRAN-file name */ - YY_BREAK -case 17: -/* rule 17 can match eol */ -YY_RULE_SETUP -#line 82 "wmkdep.l" -{ BEGIN(INITIAL); nextFile(yytext); } /*'*/ - YY_BREAK -case 18: -/* rule 18 can match eol */ -YY_RULE_SETUP -#line 84 "wmkdep.l" -; - YY_BREAK -case 19: -YY_RULE_SETUP -#line 86 "wmkdep.l" -ECHO; - YY_BREAK -#line 1139 "lex.yy.c" -case YY_STATE_EOF(INITIAL): -case YY_STATE_EOF(CMNT): -case YY_STATE_EOF(CFNAME): -case YY_STATE_EOF(SCFNAME): -case YY_STATE_EOF(JFNAME): -case YY_STATE_EOF(FFNAME): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( yywrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ -} /* end of yylex */ - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ -static int yy_get_next_buffer (void) -{ - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; - int ret_val; - - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - int num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ( (yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart(yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; -} - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - - static yy_state_type yy_get_previous_state (void) -{ - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = (yy_start); - yy_current_state += YY_AT_BOL(); - - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 285 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; -} - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) -{ - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 285 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 284); - - return yy_is_jam ? 0 : yy_current_state; -} - - static void yyunput (int c, register char * yy_bp ) -{ - register char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#ifndef YY_NO_INPUT -#ifdef __cplusplus - static int yyinput (void) -#else - static int input (void) -#endif - -{ - int c; - - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - int offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart(yyin ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap( ) ) - return EOF; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } - - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve yytext */ - (yy_hold_char) = *++(yy_c_buf_p); - - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); - - return c; -} -#endif /* ifndef YY_NO_INPUT */ - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ - void yyrestart (FILE * input_file ) -{ - - if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_init_buffer(YY_CURRENT_BUFFER,input_file ); - yy_load_buffer_state( ); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ - void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) -{ - - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); - */ - yyensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; -} - -static void yy_load_buffer_state (void) -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ - YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer(b,file ); - - return b; -} - -/** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() - * - */ - void yy_delete_buffer (YY_BUFFER_STATE b ) -{ - - if ( ! b ) - return; - - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yyfree((void *) b->yy_ch_buf ); - - yyfree((void *) b ); -} - -#ifndef __cplusplus -extern int isatty (int ); -#endif /* __cplusplus */ - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. - */ - static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) - -{ - int oerrno = errno; - - yy_flush_buffer(b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ - void yy_flush_buffer (YY_BUFFER_STATE b ) -{ - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) -{ - if (new_buffer == NULL) - return; - - yyensure_buffer_stack(); - - /* This block is copied from yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -void yypop_buffer_state (void) -{ - if (!YY_CURRENT_BUFFER) - return; - - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } -} - -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -static void yyensure_buffer_stack (void) -{ - int num_to_alloc; - - if (!(yy_buffer_stack)) { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} - -/** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) -{ - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer(b ); - - return b; -} - -/** Setup the input buffer state to scan a string. The next call to yylex() will - * scan from a @e copy of @a str. - * @param str a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * yy_scan_bytes() instead. - */ -YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) -{ - - return yy_scan_bytes(yystr,strlen(yystr) ); -} - -/** Setup the input buffer state to scan the given bytes. The next call to yylex() will - * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) yyalloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer(buf,n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -static void yy_fatal_error (yyconst char* msg ) -{ - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); -} - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - yytext[yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = yytext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) - -/* Accessor methods (get/set functions) to struct members. */ - -/** Get the current line number. - * - */ -int yyget_lineno (void) -{ - - return yylineno; -} - -/** Get the input stream. - * - */ -FILE *yyget_in (void) -{ - return yyin; -} - -/** Get the output stream. - * - */ -FILE *yyget_out (void) -{ - return yyout; -} - -/** Get the length of the current token. - * - */ -int yyget_leng (void) -{ - return yyleng; -} - -/** Get the current token. - * - */ - -char *yyget_text (void) -{ - return yytext; -} - -/** Set the current line number. - * @param line_number - * - */ -void yyset_lineno (int line_number ) -{ - - yylineno = line_number; -} - -/** Set the input stream. This does not discard the current - * input buffer. - * @param in_str A readable stream. - * - * @see yy_switch_to_buffer - */ -void yyset_in (FILE * in_str ) -{ - yyin = in_str ; -} - -void yyset_out (FILE * out_str ) -{ - yyout = out_str ; -} - -int yyget_debug (void) -{ - return yy_flex_debug; -} - -void yyset_debug (int bdebug ) -{ - yy_flex_debug = bdebug ; -} - -static int yy_init_globals (void) -{ - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. - */ - - (yy_buffer_stack) = 0; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; - (yy_init) = 0; - (yy_start) = 0; - -/* Defined in main.c */ -#ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; -#else - yyin = (FILE *) 0; - yyout = (FILE *) 0; -#endif - - /* For future reference: Set errno on error, since we are called by - * yylex_init() - */ - return 0; -} - -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy (void) -{ - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); - } - - /* Destroy the stack itself. */ - yyfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * yylex() is called, initialization will occur. */ - yy_init_globals( ); - - return 0; -} - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) -{ - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) -{ - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; -} -#endif - -void *yyalloc (yy_size_t size ) -{ - return (void *) malloc( size ); -} - -void *yyrealloc (void * ptr, yy_size_t size ) -{ - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); -} - -void yyfree (void * ptr ) -{ - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ -} - -#define YYTABLES_NAME "yytables" - -#line 86 "wmkdep.l" - - - - -int nDirectories; -char** directories; -char* sourceFile = NULL; -char* sourceExt = NULL; -char* objectFile = NULL; -char* classFile = NULL; -char* depFile = NULL; - -int main(int argc, char* argv[]) -{ - char *dotPtr, *slashPtr; - int i; - - if (argc == 1) - { - fprintf(stderr,"input file not supplied\n"); - exit(1); - } - - sourceFile = (char*)malloc(strlen(argv[argc-1]) + 1); - strcpy(sourceFile, argv[argc-1]); - fprintf(stderr,"Making dependency list for source file %s\n", sourceFile); - - - /* Get list of -I directories. */ - nDirectories = 0; - - for (i = 1; i < argc; i++) - { - if (strncmp(argv[i], "-I", 2) == 0) - { - nDirectories++; - } - } - - directories = (char**)malloc(sizeof(char*)*nDirectories); - - nDirectories = 0; - - for (i = 1; i < argc; i++) - { - if (strncmp(argv[i], "-I", 2) == 0) - { - directories[nDirectories++] = strdup(argv[i] + 2); - } - } - - - - if ((dotPtr = strrchr(sourceFile, '.')) == NULL) - { - fprintf - ( - stderr, - "Cannot find extension in source file name %s\n", - sourceFile - ); - exit(1); - } - - if ((slashPtr = strrchr(sourceFile, '/')) == NULL) - { - slashPtr = sourceFile; - } - else - { - slashPtr++; - } - - sourceExt = (char*)malloc(strlen(sourceFile)); - sourceExt[0] = 0; - strncat - ( - sourceExt, - dotPtr+1, - (&sourceFile[strlen(sourceFile) - 1] - dotPtr)/sizeof(char) - ); - - /* initialise depFile to zero and use strncat rather than strncpy - because there is a bug in the SGI strncat that if 0 preceeds the . - it inserts a space */ - depFile = (char*)malloc(strlen(sourceFile) + 3); - depFile[0] = 0; - strncat(depFile, sourceFile, (dotPtr - sourceFile)/sizeof(char)); - strcat(depFile, ".dep"); - - if (strcmp(sourceExt, "java") == 0) - { - classFile = (char*)malloc(strlen(sourceFile) + 17); - strcpy(classFile, "$(CLASSES_DIR)/"); - strncat(classFile, sourceFile, (dotPtr - sourceFile)/sizeof(char)); - strcat(classFile, ".class"); - - printf("%s: %s\n", classFile, depFile); - } - else - { - objectFile = (char*)malloc(strlen(sourceFile) + 16); - strcpy(objectFile, "$(OBJECTS_DIR)/"); - strncat(objectFile, slashPtr, (dotPtr - slashPtr)/sizeof(char)); - strcat(objectFile, ".o"); - - printf("%s: %s\n", objectFile, depFile); - } - - nextFile(sourceFile); - yylex(); - - - for (i = 0; i < nDirectories; i++) - { - free(directories[i]); - } - free(directories); - - free(sourceFile); - free(sourceExt); - free(objectFile); - free(classFile); - free(depFile); - - return 0; -} - - -int currentBuffer = 0; /* Buffer pointer stack counter */ -YY_BUFFER_STATE buffers[FILE_STACK_SIZE]; /* Buffer pointer stack */ - -/* file name entry in hash table */ - -struct FileName -{ - char* name; - struct FileName* next; -}; - -struct FileName* fileHashTable[HASH_TABLE_SIZE]; /* File hash table */ -struct FileName* dirHashTable[HASH_TABLE_SIZE]; /* Directory hash table */ - - -/* lookup name in hash table, if not found insert in table */ - -int lookUp(struct FileName** hashTable, const char* p) -{ - int ii = 0; - struct FileName* n; - struct FileName* nn; - - /* hash */ - const char* pp = p; - while (*pp) ii = ii<<1 ^ *pp++; - if (ii < 0) ii = -ii; - ii %= HASH_TABLE_SIZE; - - /* search */ - for (n=hashTable[ii]; n; n=n->next) - { - if (strcmp(p, n->name) == 0) - { - /* entry found so return true */ - return 1; - } - } - - /* insert */ - nn = (struct FileName*)malloc(sizeof(struct FileName)); - nn->name = (char*)malloc(strlen(p)+1); - strcpy(nn->name, p); - nn->next = hashTable[ii]; - hashTable[ii] = nn; - - /* entry not found, and therefore added. return false */ - return 0; -} - - - -/* Add a directory name to the file name */ - -char* addDirectoryName(const char* directoryName, const char* fileName) -{ - char* pathName; - pathName = (char*)malloc(strlen(directoryName) + strlen(fileName) + 2); - - strcpy(pathName, directoryName); - - if (directoryName[strlen(directoryName)-1] != '/') - { - strcat(pathName, "/"); - } - - strcat(pathName, fileName); - - return pathName; -} - - -/* open a file and create buffer and put on stack stack */ - -void nextFile(const char* fileName) -{ - int d; - char* pathName; - - if (lookUp(fileHashTable, fileName)) return; - - if (currentBuffer >= FILE_STACK_SIZE) - { - fprintf - ( - stderr, - "depth of file search exceeds stack size %d " - "while opening %s for file %s\n", - FILE_STACK_SIZE, fileName, sourceFile - ); - exit(1); - } - - /* Pointer to new file which is set if the file is successfully opened */ - FILE* newyyin = NULL; - - if (!(newyyin = fopen(fileName, "r"))) - { - for (d=0; dd_name, ".java") - && !strstr(list->d_name, ".java~") - ) - { - path = addDirectoryName(uDirName, list->d_name); - nextFile(path); - free(path); - } - } - - closedir(source); - free(uDirName); - } -} - - -/* The lexer calls yywrap to handle EOF conditions */ - -int yywrap() -{ - /* Close the file for the buffer which has just reached EOF */ - /* This causes strange problems - fclose(yyin); - yyin = 0; - */ - - /* Delete the buffer */ - yy_delete_buffer(YY_CURRENT_BUFFER); - - /* Set buffer counter to previous buffer */ - currentBuffer--; - - if (currentBuffer >= 0) /* if buffer counter refers to a valid file */ - { - /* reset input buffer to the previous buffer on the stack */ - yy_switch_to_buffer(buffers[currentBuffer]); - - /* Return to the normal state for the previous buffer on the stack */ - BEGIN(INITIAL); - - /* return 0 to inform lex to continue reading */ - return 0; - } - else /* else there are no more buffers on the stack */ - { - /* return 1 to inform lex finish now that all buffers have been read */ - return 1; - } -} - - -/*****************************************************************************/ - diff --git a/wmake/src/wmkdep.l b/wmake/src/wmkdep.l index 05d91e6a5e..ba8554ef2c 100644 --- a/wmake/src/wmkdep.l +++ b/wmake/src/wmkdep.l @@ -56,7 +56,7 @@ void importDirectory(const char* dirName); %} -%s CMNT CFNAME SCFNAME JFNAME FFNAME +%x CMNT CFNAME SCFNAME JFNAME FFNAME %% "//".*\n ; /* remove c++ style one line comments */