diff --git a/applications/solvers/DNS/dnsFoam/readTransportProperties.H b/applications/solvers/DNS/dnsFoam/readTransportProperties.H index 77af096bf..0d8090854 100644 --- a/applications/solvers/DNS/dnsFoam/readTransportProperties.H +++ b/applications/solvers/DNS/dnsFoam/readTransportProperties.H @@ -7,7 +7,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/DNS/dnsFoam/readTurbulenceProperties.H b/applications/solvers/DNS/dnsFoam/readTurbulenceProperties.H index 9f4d8368a..dc48e2fd8 100644 --- a/applications/solvers/DNS/dnsFoam/readTurbulenceProperties.H +++ b/applications/solvers/DNS/dnsFoam/readTurbulenceProperties.H @@ -7,7 +7,7 @@ "turbulenceProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/basic/laplacianFoam/createFields.H b/applications/solvers/basic/laplacianFoam/createFields.H index 3359f2896..616afe1a8 100644 --- a/applications/solvers/basic/laplacianFoam/createFields.H +++ b/applications/solvers/basic/laplacianFoam/createFields.H @@ -23,7 +23,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/basic/scalarTransportFoam/createFields.H b/applications/solvers/basic/scalarTransportFoam/createFields.H index fb88dcc88..394fe42e9 100644 --- a/applications/solvers/basic/scalarTransportFoam/createFields.H +++ b/applications/solvers/basic/scalarTransportFoam/createFields.H @@ -39,7 +39,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C b/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C index 950a370d4..d7402c175 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C +++ b/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C @@ -50,10 +50,12 @@ PDRkEpsilon::PDRkEpsilon const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - const basicThermo& thermophysicalModel + const basicThermo& thermophysicalModel, + const word& turbulenceModelName, + const word& modelName ) : - RASModel(typeName, rho, U, phi, thermophysicalModel), + RASModel(typeName, rho, U, phi, thermophysicalModel, turbulenceModelName), Cmu_ ( diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.H b/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.H index 8ab470533..839c3de99 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.H +++ b/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.H @@ -112,7 +112,9 @@ public: const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - const basicThermo& thermophysicalModel + const basicThermo& thermophysicalModel, + const word& turbulenceModelName = turbulenceModel::typeName, + const word& modelName = typeName ); diff --git a/applications/solvers/combustion/PDRFoam/createFields.H b/applications/solvers/combustion/PDRFoam/createFields.H index 6d3a4bdf5..047840fae 100644 --- a/applications/solvers/combustion/PDRFoam/createFields.H +++ b/applications/solvers/combustion/PDRFoam/createFields.H @@ -110,7 +110,7 @@ "PDRProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/combustion/PDRFoam/readCombustionProperties.H b/applications/solvers/combustion/PDRFoam/readCombustionProperties.H index 9f4435b25..acc5cb786 100644 --- a/applications/solvers/combustion/PDRFoam/readCombustionProperties.H +++ b/applications/solvers/combustion/PDRFoam/readCombustionProperties.H @@ -7,7 +7,7 @@ "combustionProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/combustion/XiFoam/readCombustionProperties.H b/applications/solvers/combustion/XiFoam/readCombustionProperties.H index da0a3a94a..58b0626fb 100644 --- a/applications/solvers/combustion/XiFoam/readCombustionProperties.H +++ b/applications/solvers/combustion/XiFoam/readCombustionProperties.H @@ -7,7 +7,7 @@ "combustionProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/combustion/dieselEngineFoam/readCombustionProperties.H b/applications/solvers/combustion/dieselEngineFoam/readCombustionProperties.H index 687d83ea9..84cf9b975 100644 --- a/applications/solvers/combustion/dieselEngineFoam/readCombustionProperties.H +++ b/applications/solvers/combustion/dieselEngineFoam/readCombustionProperties.H @@ -7,7 +7,7 @@ IOdictionary combustionProperties "combustionProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/combustion/fireFoam/createFields.H b/applications/solvers/combustion/fireFoam/createFields.H index b2acec7ed..1ad5cd190 100644 --- a/applications/solvers/combustion/fireFoam/createFields.H +++ b/applications/solvers/combustion/fireFoam/createFields.H @@ -65,7 +65,7 @@ IOdictionary combustionProperties "combustionProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/combustion/reactingFoam/readChemistryProperties.H b/applications/solvers/combustion/reactingFoam/readChemistryProperties.H index ab51afe28..f0bcf7597 100644 --- a/applications/solvers/combustion/reactingFoam/readChemistryProperties.H +++ b/applications/solvers/combustion/reactingFoam/readChemistryProperties.H @@ -7,7 +7,7 @@ IOdictionary chemistryProperties "chemistryProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE, false ) diff --git a/applications/solvers/combustion/rhoReactingFoam/readChemistryProperties.H b/applications/solvers/combustion/rhoReactingFoam/readChemistryProperties.H index ab51afe28..f0bcf7597 100644 --- a/applications/solvers/combustion/rhoReactingFoam/readChemistryProperties.H +++ b/applications/solvers/combustion/rhoReactingFoam/readChemistryProperties.H @@ -7,7 +7,7 @@ IOdictionary chemistryProperties "chemistryProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE, false ) diff --git a/applications/solvers/compressible/rhoCentralFoam/readThermophysicalProperties.H b/applications/solvers/compressible/rhoCentralFoam/readThermophysicalProperties.H index adc9ec4d1..0b28b77ee 100644 --- a/applications/solvers/compressible/rhoCentralFoam/readThermophysicalProperties.H +++ b/applications/solvers/compressible/rhoCentralFoam/readThermophysicalProperties.H @@ -9,7 +9,7 @@ IOdictionary thermophysicalProperties "thermophysicalProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/compressible/rhoSonicFoam/readThermodynamicProperties.H b/applications/solvers/compressible/rhoSonicFoam/readThermodynamicProperties.H index 1fc57fc5f..4e19adaae 100644 --- a/applications/solvers/compressible/rhoSonicFoam/readThermodynamicProperties.H +++ b/applications/solvers/compressible/rhoSonicFoam/readThermodynamicProperties.H @@ -7,7 +7,7 @@ "thermodynamicProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/compressible/rhopSonicFoam/readThermodynamicProperties.H b/applications/solvers/compressible/rhopSonicFoam/readThermodynamicProperties.H index e8242e806..1e08986df 100644 --- a/applications/solvers/compressible/rhopSonicFoam/readThermodynamicProperties.H +++ b/applications/solvers/compressible/rhopSonicFoam/readThermodynamicProperties.H @@ -7,7 +7,7 @@ "thermodynamicProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/compressible/sonicDyMFoam/readTransportProperties.H b/applications/solvers/compressible/sonicDyMFoam/readTransportProperties.H index 1502e2033..c30f65b44 100644 --- a/applications/solvers/compressible/sonicDyMFoam/readTransportProperties.H +++ b/applications/solvers/compressible/sonicDyMFoam/readTransportProperties.H @@ -7,7 +7,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/compressible/sonicLiquidFoam/readThermodynamicProperties.H b/applications/solvers/compressible/sonicLiquidFoam/readThermodynamicProperties.H index d8dad7d80..82f3655f4 100644 --- a/applications/solvers/compressible/sonicLiquidFoam/readThermodynamicProperties.H +++ b/applications/solvers/compressible/sonicLiquidFoam/readThermodynamicProperties.H @@ -7,7 +7,7 @@ "thermodynamicProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/compressible/sonicLiquidFoam/readTransportProperties.H b/applications/solvers/compressible/sonicLiquidFoam/readTransportProperties.H index 1502e2033..c30f65b44 100644 --- a/applications/solvers/compressible/sonicLiquidFoam/readTransportProperties.H +++ b/applications/solvers/compressible/sonicLiquidFoam/readTransportProperties.H @@ -7,7 +7,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/coupled/blockCoupledScalarTransportFoam/createFields.H b/applications/solvers/coupled/blockCoupledScalarTransportFoam/createFields.H index d3d4b42a8..6f4efc8e9 100644 --- a/applications/solvers/coupled/blockCoupledScalarTransportFoam/createFields.H +++ b/applications/solvers/coupled/blockCoupledScalarTransportFoam/createFields.H @@ -69,7 +69,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/coupled/conjugateHeatFoam/createFields.H b/applications/solvers/coupled/conjugateHeatFoam/createFields.H index d04677e18..afd4d5483 100644 --- a/applications/solvers/coupled/conjugateHeatFoam/createFields.H +++ b/applications/solvers/coupled/conjugateHeatFoam/createFields.H @@ -7,7 +7,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/coupled/conjugateHeatSimpleFoam/createFields.H b/applications/solvers/coupled/conjugateHeatSimpleFoam/createFields.H index 42330b79f..e9d058919 100644 --- a/applications/solvers/coupled/conjugateHeatSimpleFoam/createFields.H +++ b/applications/solvers/coupled/conjugateHeatSimpleFoam/createFields.H @@ -7,7 +7,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/electromagnetics/electrostaticFoam/createFields.H b/applications/solvers/electromagnetics/electrostaticFoam/createFields.H index 64522273b..04c86c4ed 100644 --- a/applications/solvers/electromagnetics/electrostaticFoam/createFields.H +++ b/applications/solvers/electromagnetics/electrostaticFoam/createFields.H @@ -7,7 +7,7 @@ "physicalProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/electromagnetics/mhdFoam/createFields.H b/applications/solvers/electromagnetics/mhdFoam/createFields.H index d5a0e62de..dcc9b127b 100644 --- a/applications/solvers/electromagnetics/mhdFoam/createFields.H +++ b/applications/solvers/electromagnetics/mhdFoam/createFields.H @@ -7,7 +7,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/engine/icoDyMEngineFoam/createFields.H b/applications/solvers/engine/icoDyMEngineFoam/createFields.H index 3fbf47549..b203e1283 100644 --- a/applications/solvers/engine/icoDyMEngineFoam/createFields.H +++ b/applications/solvers/engine/icoDyMEngineFoam/createFields.H @@ -7,7 +7,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/financial/financialFoam/createFields.H b/applications/solvers/financial/financialFoam/createFields.H index 6cdbbe2bd..dc0da4d2a 100644 --- a/applications/solvers/financial/financialFoam/createFields.H +++ b/applications/solvers/financial/financialFoam/createFields.H @@ -7,7 +7,7 @@ "financialProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/finiteArea/liquidFilmFoam/readTransportProperties.H b/applications/solvers/finiteArea/liquidFilmFoam/readTransportProperties.H index 2f2c99ffd..1d68c4173 100644 --- a/applications/solvers/finiteArea/liquidFilmFoam/readTransportProperties.H +++ b/applications/solvers/finiteArea/liquidFilmFoam/readTransportProperties.H @@ -5,7 +5,7 @@ IOdictionary transportProperties "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/finiteArea/surfactantFoam/createFaFields.H b/applications/solvers/finiteArea/surfactantFoam/createFaFields.H index 89d8da2f7..a8be20751 100644 --- a/applications/solvers/finiteArea/surfactantFoam/createFaFields.H +++ b/applications/solvers/finiteArea/surfactantFoam/createFaFields.H @@ -21,7 +21,7 @@ IOdictionary transportProperties "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/heatTransfer/boussinesqBuoyantFoam/readTransportProperties.H b/applications/solvers/heatTransfer/boussinesqBuoyantFoam/readTransportProperties.H index 571a66ee0..02492fe22 100644 --- a/applications/solvers/heatTransfer/boussinesqBuoyantFoam/readTransportProperties.H +++ b/applications/solvers/heatTransfer/boussinesqBuoyantFoam/readTransportProperties.H @@ -7,7 +7,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/immersedBoundary/icoDyMIbFoam/createFields.H b/applications/solvers/immersedBoundary/icoDyMIbFoam/createFields.H index 2721134d9..5af8f976c 100644 --- a/applications/solvers/immersedBoundary/icoDyMIbFoam/createFields.H +++ b/applications/solvers/immersedBoundary/icoDyMIbFoam/createFields.H @@ -7,7 +7,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/immersedBoundary/icoIbFoam/createFields.H b/applications/solvers/immersedBoundary/icoIbFoam/createFields.H index 2721134d9..5af8f976c 100644 --- a/applications/solvers/immersedBoundary/icoIbFoam/createFields.H +++ b/applications/solvers/immersedBoundary/icoIbFoam/createFields.H @@ -7,7 +7,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/incompressible/RichardsFoam/RichardsFoam.C b/applications/solvers/incompressible/RichardsFoam/RichardsFoam.C index 7c8ed800e..1097a75a9 100644 --- a/applications/solvers/incompressible/RichardsFoam/RichardsFoam.C +++ b/applications/solvers/incompressible/RichardsFoam/RichardsFoam.C @@ -1,25 +1,25 @@ /*---------------------------------------------------------------------------*\ ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. - \\/ M anipulation | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright ------------------------------------------------------------------------------- License - This file is part of OpenFOAM. + This file is part of foam-extend. - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . + along with foam-extend. If not, see . Application RichardsFoam diff --git a/applications/solvers/incompressible/RichardsFoam/setDeltaT.H b/applications/solvers/incompressible/RichardsFoam/setDeltaT.H index c597cda93..b2c47552e 100644 --- a/applications/solvers/incompressible/RichardsFoam/setDeltaT.H +++ b/applications/solvers/incompressible/RichardsFoam/setDeltaT.H @@ -1,25 +1,25 @@ /*---------------------------------------------------------------------------*\ ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. - \\/ M anipulation | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright ------------------------------------------------------------------------------- License - This file is part of OpenFOAM. + This file is part of foam-extend. - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . + along with foam-extend. If not, see . Global setDeltaT diff --git a/applications/solvers/incompressible/RichardsFoam/spatialMeanValueRichardsonFoam/spatialMeanValueRichardsonFoam.C b/applications/solvers/incompressible/RichardsFoam/spatialMeanValueRichardsonFoam/spatialMeanValueRichardsonFoam.C index 298304b98..2068fb95d 100644 --- a/applications/solvers/incompressible/RichardsFoam/spatialMeanValueRichardsonFoam/spatialMeanValueRichardsonFoam.C +++ b/applications/solvers/incompressible/RichardsFoam/spatialMeanValueRichardsonFoam/spatialMeanValueRichardsonFoam.C @@ -1,25 +1,25 @@ /*---------------------------------------------------------------------------*\ ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. - \\/ M anipulation | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright ------------------------------------------------------------------------------- License - This file is part of OpenFOAM. + This file is part of foam-extend. - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . + along with foam-extend. If not, see . Application spatialMeanValue diff --git a/applications/solvers/incompressible/boundaryFoam/createFields.H b/applications/solvers/incompressible/boundaryFoam/createFields.H index e4db531c0..34a4592e5 100644 --- a/applications/solvers/incompressible/boundaryFoam/createFields.H +++ b/applications/solvers/incompressible/boundaryFoam/createFields.H @@ -6,7 +6,7 @@ "U", runTime.timeName(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::AUTO_WRITE ), mesh @@ -44,7 +44,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/incompressible/channelFoam/readTransportProperties.H b/applications/solvers/incompressible/channelFoam/readTransportProperties.H index 87c93c919..abaee647c 100644 --- a/applications/solvers/incompressible/channelFoam/readTransportProperties.H +++ b/applications/solvers/incompressible/channelFoam/readTransportProperties.H @@ -6,7 +6,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE, false ) diff --git a/applications/solvers/incompressible/icoDyMFoam/createFields.H b/applications/solvers/incompressible/icoDyMFoam/createFields.H index 6e54a75c4..ba6a35cc0 100644 --- a/applications/solvers/incompressible/icoDyMFoam/createFields.H +++ b/applications/solvers/incompressible/icoDyMFoam/createFields.H @@ -7,7 +7,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/incompressible/icoDyMSimpleFoam/createFields.H b/applications/solvers/incompressible/icoDyMSimpleFoam/createFields.H index ad0d528b7..de42195a6 100644 --- a/applications/solvers/incompressible/icoDyMSimpleFoam/createFields.H +++ b/applications/solvers/incompressible/icoDyMSimpleFoam/createFields.H @@ -7,7 +7,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/incompressible/icoFoam/createFields.H b/applications/solvers/incompressible/icoFoam/createFields.H index 4fdfcb208..b9747cf22 100644 --- a/applications/solvers/incompressible/icoFoam/createFields.H +++ b/applications/solvers/incompressible/icoFoam/createFields.H @@ -7,7 +7,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/incompressible/shallowWaterFoam/readGravitationalAcceleration.H b/applications/solvers/incompressible/shallowWaterFoam/readGravitationalAcceleration.H index 0e34b0fa1..78b2bdc33 100644 --- a/applications/solvers/incompressible/shallowWaterFoam/readGravitationalAcceleration.H +++ b/applications/solvers/incompressible/shallowWaterFoam/readGravitationalAcceleration.H @@ -7,7 +7,7 @@ IOdictionary gravitationalProperties "gravitationalProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/lagrangian/coalChemistryFoam/readChemistryProperties.H b/applications/solvers/lagrangian/coalChemistryFoam/readChemistryProperties.H index ab51afe28..f0bcf7597 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/readChemistryProperties.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/readChemistryProperties.H @@ -7,7 +7,7 @@ IOdictionary chemistryProperties "chemistryProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE, false ) diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/readChemistryProperties.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/readChemistryProperties.H index ab51afe28..f0bcf7597 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/readChemistryProperties.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/readChemistryProperties.H @@ -7,7 +7,7 @@ IOdictionary chemistryProperties "chemistryProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE, false ) diff --git a/applications/solvers/lagrangian/reactingParcelFoam/readChemistryProperties.H b/applications/solvers/lagrangian/reactingParcelFoam/readChemistryProperties.H index ab51afe28..f0bcf7597 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/readChemistryProperties.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/readChemistryProperties.H @@ -7,7 +7,7 @@ IOdictionary chemistryProperties "chemistryProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE, false ) diff --git a/applications/solvers/multiSolver/multiSolverDemo/createFields_icoFoam.H b/applications/solvers/multiSolver/multiSolverDemo/createFields_icoFoam.H index 2e2c782db..cdbed4af2 100644 --- a/applications/solvers/multiSolver/multiSolverDemo/createFields_icoFoam.H +++ b/applications/solvers/multiSolver/multiSolverDemo/createFields_icoFoam.H @@ -7,7 +7,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/multiSolver/multiSolverDemo/createFields_scalarTransportFoam.H b/applications/solvers/multiSolver/multiSolverDemo/createFields_scalarTransportFoam.H index 5eb6c116f..c33ab487c 100644 --- a/applications/solvers/multiSolver/multiSolverDemo/createFields_scalarTransportFoam.H +++ b/applications/solvers/multiSolver/multiSolverDemo/createFields_scalarTransportFoam.H @@ -39,7 +39,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/multiphase/barotropicCavitatingFoam/readThermodynamicProperties.H b/applications/solvers/multiphase/barotropicCavitatingFoam/readThermodynamicProperties.H index c057c442b..5121f49e1 100644 --- a/applications/solvers/multiphase/barotropicCavitatingFoam/readThermodynamicProperties.H +++ b/applications/solvers/multiphase/barotropicCavitatingFoam/readThermodynamicProperties.H @@ -7,7 +7,7 @@ "thermodynamicProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/multiphase/barotropicCavitatingFoam/readTransportProperties.H b/applications/solvers/multiphase/barotropicCavitatingFoam/readTransportProperties.H index a253dd1be..722b7e4ba 100644 --- a/applications/solvers/multiphase/barotropicCavitatingFoam/readTransportProperties.H +++ b/applications/solvers/multiphase/barotropicCavitatingFoam/readTransportProperties.H @@ -7,7 +7,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/multiphase/bubbleFoam/createFields.H b/applications/solvers/multiphase/bubbleFoam/createFields.H index 26013f9f4..c5c1a8212 100644 --- a/applications/solvers/multiphase/bubbleFoam/createFields.H +++ b/applications/solvers/multiphase/bubbleFoam/createFields.H @@ -91,7 +91,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/multiphase/bubbleFoam/createRASTurbulence.H b/applications/solvers/multiphase/bubbleFoam/createRASTurbulence.H index 9eb468f91..906b2e39a 100644 --- a/applications/solvers/multiphase/bubbleFoam/createRASTurbulence.H +++ b/applications/solvers/multiphase/bubbleFoam/createRASTurbulence.H @@ -5,7 +5,7 @@ "RASProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/multiphase/cavitatingFoam/readThermodynamicProperties.H b/applications/solvers/multiphase/cavitatingFoam/readThermodynamicProperties.H index d3fbb9307..3740f1056 100644 --- a/applications/solvers/multiphase/cavitatingFoam/readThermodynamicProperties.H +++ b/applications/solvers/multiphase/cavitatingFoam/readThermodynamicProperties.H @@ -7,7 +7,7 @@ "thermodynamicProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/newPhaseChangeTwoPhaseMixture.C b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/newPhaseChangeTwoPhaseMixture.C index bf96e7a7c..0c896f119 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/newPhaseChangeTwoPhaseMixture.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/newPhaseChangeTwoPhaseMixture.C @@ -43,7 +43,7 @@ Foam::phaseChangeTwoPhaseMixture::New "transportProperties", U.time().constant(), U.db(), - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE, false ) diff --git a/applications/solvers/multiphase/settlingFoam/createFields.H b/applications/solvers/multiphase/settlingFoam/createFields.H index 57f62457b..38a71cff7 100644 --- a/applications/solvers/multiphase/settlingFoam/createFields.H +++ b/applications/solvers/multiphase/settlingFoam/createFields.H @@ -50,7 +50,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/createFields.H b/applications/solvers/multiphase/twoPhaseEulerFoam/createFields.H index 0a2d24ed6..4b11cce9c 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/createFields.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/createFields.H @@ -7,7 +7,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/readPPProperties.H b/applications/solvers/multiphase/twoPhaseEulerFoam/readPPProperties.H index 3acbf758d..c1b319cbc 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/readPPProperties.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/readPPProperties.H @@ -5,7 +5,7 @@ "ppProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/solidMechanics/deprecatedSolvers/contactStressFoam/createFields.H b/applications/solvers/solidMechanics/deprecatedSolvers/contactStressFoam/createFields.H index 52b1f820a..9454eaed8 100644 --- a/applications/solvers/solidMechanics/deprecatedSolvers/contactStressFoam/createFields.H +++ b/applications/solvers/solidMechanics/deprecatedSolvers/contactStressFoam/createFields.H @@ -8,7 +8,7 @@ "U", runTime.timeName(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::AUTO_WRITE ), mesh @@ -23,7 +23,7 @@ "mechanicalProperties", "constant", mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/solidMechanics/deprecatedSolvers/icoFsiFoam/createFields.H b/applications/solvers/solidMechanics/deprecatedSolvers/icoFsiFoam/createFields.H index 461709e4b..68d92f649 100644 --- a/applications/solvers/solidMechanics/deprecatedSolvers/icoFsiFoam/createFields.H +++ b/applications/solvers/solidMechanics/deprecatedSolvers/icoFsiFoam/createFields.H @@ -7,7 +7,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/solidMechanics/deprecatedSolvers/icoFsiFoam/readCouplingProperties.H b/applications/solvers/solidMechanics/deprecatedSolvers/icoFsiFoam/readCouplingProperties.H index c10e7af3c..51fc02d14 100644 --- a/applications/solvers/solidMechanics/deprecatedSolvers/icoFsiFoam/readCouplingProperties.H +++ b/applications/solvers/solidMechanics/deprecatedSolvers/icoFsiFoam/readCouplingProperties.H @@ -6,7 +6,7 @@ "couplingProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/solidMechanics/deprecatedSolvers/icoFsiFoam/readMechanicalProperties.H b/applications/solvers/solidMechanics/deprecatedSolvers/icoFsiFoam/readMechanicalProperties.H index f06856dce..be3280868 100644 --- a/applications/solvers/solidMechanics/deprecatedSolvers/icoFsiFoam/readMechanicalProperties.H +++ b/applications/solvers/solidMechanics/deprecatedSolvers/icoFsiFoam/readMechanicalProperties.H @@ -7,7 +7,7 @@ "mechanicalProperties", runTime.constant(), stressMesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/solidMechanics/deprecatedSolvers/solidDisplacementFoam/readMechanicalProperties.H b/applications/solvers/solidMechanics/deprecatedSolvers/solidDisplacementFoam/readMechanicalProperties.H index 91bd5f3da..9f256bd68 100644 --- a/applications/solvers/solidMechanics/deprecatedSolvers/solidDisplacementFoam/readMechanicalProperties.H +++ b/applications/solvers/solidMechanics/deprecatedSolvers/solidDisplacementFoam/readMechanicalProperties.H @@ -7,7 +7,7 @@ "mechanicalProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/solidMechanics/deprecatedSolvers/solidDisplacementFoam/readThermalProperties.H b/applications/solvers/solidMechanics/deprecatedSolvers/solidDisplacementFoam/readThermalProperties.H index a4c3082fb..12e10a607 100644 --- a/applications/solvers/solidMechanics/deprecatedSolvers/solidDisplacementFoam/readThermalProperties.H +++ b/applications/solvers/solidMechanics/deprecatedSolvers/solidDisplacementFoam/readThermalProperties.H @@ -7,7 +7,7 @@ "thermalProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/solidMechanics/deprecatedSolvers/stressedFoam/readMechanicalProperties.H b/applications/solvers/solidMechanics/deprecatedSolvers/stressedFoam/readMechanicalProperties.H index 0e8a1918b..81afaeafe 100644 --- a/applications/solvers/solidMechanics/deprecatedSolvers/stressedFoam/readMechanicalProperties.H +++ b/applications/solvers/solidMechanics/deprecatedSolvers/stressedFoam/readMechanicalProperties.H @@ -7,7 +7,7 @@ "mechanicalProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/solidMechanics/deprecatedSolvers/stressedFoam/readThermalProperties.H b/applications/solvers/solidMechanics/deprecatedSolvers/stressedFoam/readThermalProperties.H index a4c3082fb..12e10a607 100644 --- a/applications/solvers/solidMechanics/deprecatedSolvers/stressedFoam/readThermalProperties.H +++ b/applications/solvers/solidMechanics/deprecatedSolvers/stressedFoam/readThermalProperties.H @@ -7,7 +7,7 @@ "thermalProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/solidMechanics/elasticThermalSolidFoam/readThermalProperties.H b/applications/solvers/solidMechanics/elasticThermalSolidFoam/readThermalProperties.H index a4c3082fb..12e10a607 100644 --- a/applications/solvers/solidMechanics/elasticThermalSolidFoam/readThermalProperties.H +++ b/applications/solvers/solidMechanics/elasticThermalSolidFoam/readThermalProperties.H @@ -7,7 +7,7 @@ "thermalProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/createFields.H b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/createFields.H index 1f930006d..caaf161fd 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/createFields.H +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/createFields.H @@ -7,7 +7,7 @@ "transportProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/readCouplingProperties.H b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/readCouplingProperties.H index 26f76ed67..f07a7969f 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/readCouplingProperties.H +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/readCouplingProperties.H @@ -6,7 +6,7 @@ "couplingProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/solidMechanics/stressFemFoam/readMechanicalProperties.H b/applications/solvers/solidMechanics/stressFemFoam/readMechanicalProperties.H index abeff6d13..f042c1082 100644 --- a/applications/solvers/solidMechanics/stressFemFoam/readMechanicalProperties.H +++ b/applications/solvers/solidMechanics/stressFemFoam/readMechanicalProperties.H @@ -7,7 +7,7 @@ "mechanicalProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/surfaceTracking/bubbleInterTrackFoam/createBubble.H b/applications/solvers/surfaceTracking/bubbleInterTrackFoam/createBubble.H index e46ce1469..4e71afe3c 100644 --- a/applications/solvers/surfaceTracking/bubbleInterTrackFoam/createBubble.H +++ b/applications/solvers/surfaceTracking/bubbleInterTrackFoam/createBubble.H @@ -28,7 +28,7 @@ "mrfProperties", runTime.constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ); diff --git a/applications/solvers/surfaceTracking/freeSurface/functionObjects/bubbleHistory/bubbleHistory.C b/applications/solvers/surfaceTracking/freeSurface/functionObjects/bubbleHistory/bubbleHistory.C index 7d76173b6..7408a0222 100644 --- a/applications/solvers/surfaceTracking/freeSurface/functionObjects/bubbleHistory/bubbleHistory.C +++ b/applications/solvers/surfaceTracking/freeSurface/functionObjects/bubbleHistory/bubbleHistory.C @@ -285,7 +285,7 @@ bool Foam::bubbleHistory::start() } -bool Foam::bubbleHistory::execute() +bool Foam::bubbleHistory::execute(const bool forceWrite) { const fvMesh& mesh = time_.lookupObject(regionName_); @@ -401,6 +401,11 @@ bool Foam::bubbleHistory::execute() } +bool Foam::bubbleHistory::setTime() +{ + return true; +} + bool Foam::bubbleHistory::read(const dictionary& dict) { if (dict.found("region")) diff --git a/applications/solvers/surfaceTracking/freeSurface/functionObjects/bubbleHistory/bubbleHistory.H b/applications/solvers/surfaceTracking/freeSurface/functionObjects/bubbleHistory/bubbleHistory.H index fc0f48a2b..013d5c0f0 100644 --- a/applications/solvers/surfaceTracking/freeSurface/functionObjects/bubbleHistory/bubbleHistory.H +++ b/applications/solvers/surfaceTracking/freeSurface/functionObjects/bubbleHistory/bubbleHistory.H @@ -109,10 +109,21 @@ public: virtual bool start(); //- execute is called at each ++ or += of the time-loop - virtual bool execute(); + virtual bool execute(const bool forceWrite); + + //- Called when time was set at the end of the Time::operator++ + virtual bool setTime(); //- Read and set the function object if its data has changed virtual bool read(const dictionary& dict); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const pointField&) + {} }; diff --git a/applications/solvers/surfaceTracking/freeSurface/functionObjects/sloshingHistory/sloshingHistory.C b/applications/solvers/surfaceTracking/freeSurface/functionObjects/sloshingHistory/sloshingHistory.C index beba853fb..cde12ffc1 100644 --- a/applications/solvers/surfaceTracking/freeSurface/functionObjects/sloshingHistory/sloshingHistory.C +++ b/applications/solvers/surfaceTracking/freeSurface/functionObjects/sloshingHistory/sloshingHistory.C @@ -186,7 +186,7 @@ bool Foam::sloshingHistory::start() } -bool Foam::sloshingHistory::execute() +bool Foam::sloshingHistory::execute(const bool forceWrite) { const fvMesh& mesh = time_.lookupObject(regionName_); @@ -209,6 +209,12 @@ bool Foam::sloshingHistory::execute() } +bool Foam::sloshingHistory::setTime() +{ + return true; +} + + bool Foam::sloshingHistory::read(const dictionary& dict) { if (dict.found("region")) diff --git a/applications/solvers/surfaceTracking/freeSurface/functionObjects/sloshingHistory/sloshingHistory.H b/applications/solvers/surfaceTracking/freeSurface/functionObjects/sloshingHistory/sloshingHistory.H index 633c70a76..310146395 100644 --- a/applications/solvers/surfaceTracking/freeSurface/functionObjects/sloshingHistory/sloshingHistory.H +++ b/applications/solvers/surfaceTracking/freeSurface/functionObjects/sloshingHistory/sloshingHistory.H @@ -114,10 +114,21 @@ public: virtual bool start(); //- execute is called at each ++ or += of the time-loop - virtual bool execute(); + virtual bool execute(const bool forceWrite); + + //- Called when time was set at the end of the Time::operator++ + virtual bool setTime(); //- Read and set the function object if its data has changed virtual bool read(const dictionary& dict); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const pointField&) + {} }; diff --git a/applications/utilities/mesh/generation/snappyHexMesh/Make/options b/applications/utilities/mesh/generation/snappyHexMesh/Make/options index d380ebf20..281ba3844 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/Make/options +++ b/applications/utilities/mesh/generation/snappyHexMesh/Make/options @@ -14,5 +14,4 @@ EXE_LIBS = \ -lmeshTools \ -ldynamicMesh \ -ldynamicFvMesh \ - -lautoMesh \ - -L$(MESQUITE_LIB_DIR) -lmesquite + -lautoMesh diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatch.C b/applications/utilities/mesh/manipulation/createPatch/createPatch.C index b3d567b7e..3c601ed0e 100644 --- a/applications/utilities/mesh/manipulation/createPatch/createPatch.C +++ b/applications/utilities/mesh/manipulation/createPatch/createPatch.C @@ -46,6 +46,7 @@ Description #include "mapPolyMesh.H" #include "directTopoChange.H" #include "polyModifyFace.H" +#include "wordReList.H" using namespace Foam; @@ -698,7 +699,10 @@ int main(int argc, char *argv[]) if (sourceType == "patches") { - labelHashSet patchSources(patches.patchSet(dict.lookup("patches"))); + labelHashSet patchSources + ( + patches.patchSet(wordReList(dict.lookup("patches"))) + ); // Repatch faces of the patches. forAllConstIter(labelHashSet, patchSources, iter) diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index c68bf6f24..6cc19d35f 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -95,7 +95,7 @@ using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template -void addPatchFields(fvMesh& mesh, const word& patchFieldType) +void addPatchFields(const fvMesh& mesh, const word& patchFieldType) { HashTable flds ( @@ -136,7 +136,7 @@ void addPatchFields(fvMesh& mesh, const word& patchFieldType) // Remove last patch field template -void trimPatchFields(fvMesh& mesh, const label nPatches) +void trimPatchFields(const fvMesh& mesh, const label nPatches) { HashTable flds ( @@ -163,7 +163,7 @@ void trimPatchFields(fvMesh& mesh, const label nPatches) // Reorder patch field template -void reorderPatchFields(fvMesh& mesh, const labelList& oldToNew) +void reorderPatchFields(const fvMesh& mesh, const labelList& oldToNew) { HashTable flds ( diff --git a/applications/utilities/parallelProcessing/decomposeSets/decomposeSets.C b/applications/utilities/parallelProcessing/decomposeSets/decomposeSets.C index 77daf7e6f..a2c9a1494 100644 --- a/applications/utilities/parallelProcessing/decomposeSets/decomposeSets.C +++ b/applications/utilities/parallelProcessing/decomposeSets/decomposeSets.C @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) // Set all times on processor meshes equal to decomposed mesh forAll (databases, procI) { - databases[procI].setTime(runTime.timeName(), runTime.timeIndex()); + databases[procI].setTime(runTime, runTime.timeIndex()); } // Read all meshes and addressing to reconstructed mesh diff --git a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C index 51dcb16f8..122b05d98 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C +++ b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C @@ -51,7 +51,7 @@ Description int main(int argc, char *argv[]) { // enable -constant ... if someone really wants it - // enable -zeroTime to prevent accidentally trashing the initial fields + // enable -noZero to prevent accidentally trashing the initial fields timeSelector::addOptions(true, true); argList::noParallel(); # include "addRegionOption.H" @@ -125,7 +125,7 @@ int main(int argc, char *argv[]) // Set all times on processor meshes equal to reconstructed mesh forAll (databases, procI) { - databases[procI].setTime(runTime.timeName(), runTime.timeIndex()); + databases[procI].setTime(runTime); } // Read all meshes and addressing to reconstructed mesh diff --git a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C index c5a01c0c0..c619b42aa 100644 --- a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C +++ b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C @@ -50,8 +50,8 @@ Description int main(int argc, char *argv[]) { - // enable -constant ... if someone really wants it - // enable -zeroTime to prevent accidentally trashing the initial fields + // disable -constant + // enable -noZero to prevent accidentally trashing the initial fields timeSelector::addOptions(false, true); argList::noParallel(); # include "addRegionOption.H" diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C index db185e03b..d38f0016c 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C @@ -74,7 +74,7 @@ using namespace Foam; int main(int argc, char *argv[]) { // enable -constant - // probably don't need -zeroTime though, since the fields are vetted + // probably don't need -noZero though, since the fields are vetted // afterwards anyhow timeSelector::addOptions(true, false); argList::noParallel(); diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/CMakeLists.txt b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/CMakeLists.txt index 18f46de99..b9679bbf7 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/CMakeLists.txt +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/CMakeLists.txt @@ -22,12 +22,14 @@ LINK_DIRECTORIES( INCLUDE_DIRECTORIES( $ENV{WM_PROJECT_DIR}/src/OpenFOAM/lnInclude + $ENV{WM_PROJECT_DIR}/src/OSspecific/$ENV{WM_OSTYPE}/lnInclude $ENV{WM_PROJECT_DIR}/src/finiteVolume/lnInclude ${PROJECT_SOURCE_DIR}/../vtkPV3Foam ) ADD_DEFINITIONS( -DWM_$ENV{WM_PRECISION_OPTION} + -DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE} ) # Set output library destination to plugin folder diff --git a/applications/utilities/postProcessing/graphics/PV4FoamReader/PV4FoamReader/CMakeLists.txt b/applications/utilities/postProcessing/graphics/PV4FoamReader/PV4FoamReader/CMakeLists.txt index e9054371f..b34f901da 100644 --- a/applications/utilities/postProcessing/graphics/PV4FoamReader/PV4FoamReader/CMakeLists.txt +++ b/applications/utilities/postProcessing/graphics/PV4FoamReader/PV4FoamReader/CMakeLists.txt @@ -22,12 +22,14 @@ LINK_DIRECTORIES( INCLUDE_DIRECTORIES( $ENV{WM_PROJECT_DIR}/src/foam/lnInclude + $ENV{WM_PROJECT_DIR}/src/OSspecific/$ENV{WM_OSTYPE}/lnInclude $ENV{WM_PROJECT_DIR}/src/finiteVolume/lnInclude ${PROJECT_SOURCE_DIR}/../vtkPV4Foam ) ADD_DEFINITIONS( -DWM_$ENV{WM_PRECISION_OPTION} + -DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE} ) # Set output library destination to plugin folder diff --git a/applications/utilities/postProcessing/graphics/PVFoamReader/PVFoamReader/CMakeLists.txt b/applications/utilities/postProcessing/graphics/PVFoamReader/PVFoamReader/CMakeLists.txt index 1c88efbbf..14e5d235a 100644 --- a/applications/utilities/postProcessing/graphics/PVFoamReader/PVFoamReader/CMakeLists.txt +++ b/applications/utilities/postProcessing/graphics/PVFoamReader/PVFoamReader/CMakeLists.txt @@ -18,11 +18,16 @@ SET(PVFoamReader_LIBS INCLUDE_DIRECTORIES( $ENV{WM_PROJECT_DIR}/src/OpenFOAM/lnInclude + $ENV{WM_PROJECT_DIR}/src/OSspecific/$ENV{WM_OSTYPE}/lnInclude $ENV{WM_PROJECT_DIR}/src/finiteVolume/lnInclude $ENV{ParaView_INST_DIR}/include ../vtkFoam/lnInclude ) -ADD_DEFINITIONS(-DWM_$ENV{WM_PRECISION_OPTION}) + +ADD_DEFINITIONS( + -DWM_$ENV{WM_PRECISION_OPTION} + -DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE} +) #----------------------------------------------------------------------------- # Most users should not need to change anything below this line. diff --git a/applications/utilities/postProcessing/multiSolver/multiSolver.C b/applications/utilities/postProcessing/multiSolver/multiSolver.C index ed162a23a..88481bf71 100644 --- a/applications/utilities/postProcessing/multiSolver/multiSolver.C +++ b/applications/utilities/postProcessing/multiSolver/multiSolver.C @@ -55,7 +55,7 @@ void parseOptions token nextOption(optionsStream); // Bug workaround - if (nextOption.type() == token::FATALERROR) + if (nextOption.type() == token::ERROR) { break; } @@ -89,7 +89,7 @@ void parseOptions token nextOption(optionsStream); // Bug workaround - if (nextOption.type() == token::FATALERROR) + if (nextOption.type() == token::ERROR) { break; } diff --git a/applications/utilities/postProcessing/sampling/probeLocations/probeLocations.C b/applications/utilities/postProcessing/sampling/probeLocations/probeLocations.C index 587cae97a..441c43871 100644 --- a/applications/utilities/postProcessing/sampling/probeLocations/probeLocations.C +++ b/applications/utilities/postProcessing/sampling/probeLocations/probeLocations.C @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) ( probes::typeName, mesh, - "probesDict", + word("probesDict"), IOobject::MUST_READ, true ); diff --git a/applications/utilities/postProcessing/sampling/sample/sample.C b/applications/utilities/postProcessing/sampling/sample/sample.C index c0ce97c5a..0eeac119f 100644 --- a/applications/utilities/postProcessing/sampling/sample/sample.C +++ b/applications/utilities/postProcessing/sampling/sample/sample.C @@ -106,7 +106,7 @@ int main(int argc, char *argv[]) ( sampledSets::typeName, mesh, - "sampleDict", + word("sampleDict"), IOobject::MUST_READ, true ); @@ -115,7 +115,7 @@ int main(int argc, char *argv[]) ( sampledSurfaces::typeName, mesh, - "sampleDict", + word("sampleDict"), IOobject::MUST_READ, true ); diff --git a/etc/bashrc b/etc/bashrc index 47ae6e22d..8e0ce4362 100755 --- a/etc/bashrc +++ b/etc/bashrc @@ -47,7 +47,7 @@ export FOAM_DEV=1 # # Location of FOAM installation # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -foamInstall=$HOME/$WM_PROJECT +foamInstall=$HOME/OpenFOAM # foamInstall=~$WM_PROJECT # foamInstall=/usr/local/$WM_PROJECT # foamInstall=/opt/$WM_PROJECT @@ -179,6 +179,9 @@ export WM_COMPILER_LIB_ARCH= # WM_PRECISION_OPTION = LDP | DP | SP : ${WM_PRECISION_OPTION:=DP}; export WM_PRECISION_OPTION +# WM_LABEL_SIZE = 32 | 64 +: ${WM_LABEL_SIZE:=32}; export WM_LABEL_SIZE + # WM_COMPILE_OPTION = Opt | Debug | Prof : ${WM_COMPILE_OPTION:=Opt}; export WM_COMPILE_OPTION diff --git a/etc/codeTemplates/BC/BC.C b/etc/codeTemplates/BC/BC.C new file mode 100644 index 000000000..918205766 --- /dev/null +++ b/etc/codeTemplates/BC/BC.C @@ -0,0 +1,240 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "CONSTRUCT.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +Foam::scalar Foam::CLASS::t() const +{ + return this->db().time().timeOutputValue(); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::CLASS:: +CONSTRUCT +( + const fvPatch& p, + const DimensionedField& iF +) +: + PARENT(p, iF), + scalarData_(0.0), + data_(pTraits::zero), + fieldData_(p.size(), pTraits::zero), + timeVsData_(), + wordData_("wordDefault"), + labelData_(-1), + boolData_(false) +{ + this->refValue() = pTraits::zero; + this->refGrad() = pTraits::zero; + this->valueFraction() = 0.0; +} + + +template +Foam::CLASS:: +CONSTRUCT +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + PARENT(p, iF), + scalarData_(readScalar(dict.lookup("scalarData"))), + data_(pTraits(dict.lookup("data"))), + fieldData_("fieldData", dict, p.size()), + timeVsData_(DataEntry::New("timeVsData", dict)), + wordData_(dict.lookupOrDefault("wordName", "wordDefault")), + labelData_(-1), + boolData_(false) +{ + this->refGrad() = pTraits::zero; + this->valueFraction() = 0.0; + + this->refValue() = FIELD("fieldData", dict, p.size()); + FVPATCHF::operator=(this->refValue()); + + PARENT::evaluate(); + + /* + //Initialise with the value entry if evaluation is not possible + FVPATCHF::operator= + ( + FIELD("value", dict, p.size()) + ); + this->refValue() = *this; + */ +} + + +template +Foam::CLASS:: +CONSTRUCT +( + const CLASS& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + PARENT(ptf, p, iF, mapper), + scalarData_(ptf.scalarData_), + data_(ptf.data_), + fieldData_(ptf.fieldData_, mapper), + timeVsData_(ptf.timeVsData_, false), + wordData_(ptf.wordData_), + labelData_(-1), + boolData_(ptf.boolData_) +{} + + +template +Foam::CLASS:: +CONSTRUCT +( + const CLASS& ptf +) +: + PARENT(ptf), + scalarData_(ptf.scalarData_), + data_(ptf.data_), + fieldData_(ptf.fieldData_), + timeVsData_(ptf.timeVsData_, false), + wordData_(ptf.wordData_), + labelData_(-1), + boolData_(ptf.boolData_) +{} + + +template +Foam::CLASS:: +CONSTRUCT +( + const CLASS& ptf, + const DimensionedField& iF +) +: + PARENT(ptf, iF), + scalarData_(ptf.scalarData_), + data_(ptf.data_), + fieldData_(ptf.fieldData_), + timeVsData_(ptf.timeVsData_, false), + wordData_(ptf.wordData_), + labelData_(-1), + boolData_(ptf.boolData_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::CLASS::autoMap +( + const fvPatchFieldMapper& m +) +{ + PARENT::autoMap(m); + fieldData_.autoMap(m); +} + + +template +void Foam::CLASS::rmap +( + const FVPATCHF& ptf, + const labelList& addr +) +{ + PARENT::rmap(ptf, addr); + + const CLASS& tiptf = + refCast(ptf); + + fieldData_.rmap(tiptf.fieldData_, addr); +} + + +template +void Foam::CLASS::updateCoeffs() +{ + if (this->updated()) + { + return; + } + + PARENT::operator== + ( + data_ + + fieldData_ + + scalarData_*timeVsData_->value(t()) + ); + + const scalarField& phip = + this->patch().template lookupPatchField("phi"); + this->valueFraction() = 1.0 - pos(phip); + + PARENT::updateCoeffs(); +} + + +template +void Foam::CLASS::write +( + Ostream& os +) const +{ + FVPATCHF::write(os); + os.writeKeyword("scalarData") << scalarData_ << token::END_STATEMENT << nl; + os.writeKeyword("data") << data_ << token::END_STATEMENT << nl; + fieldData_.writeEntry("fieldData", os); + timeVsData_->writeData(os); + os.writeKeyword("wordData") << wordData_ << token::END_STATEMENT << nl; + this->writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * Build Macro Function * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + FVPATCHF, + CLASS + ); +} + +// ************************************************************************* // diff --git a/etc/codeTemplates/BC/BC.H b/etc/codeTemplates/BC/BC.H new file mode 100644 index 000000000..f8906e6fd --- /dev/null +++ b/etc/codeTemplates/BC/BC.H @@ -0,0 +1,246 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +Class + Foam::CONSTRUCT + +Group + grpGenericBoundaryConditions + +Description + This boundary condition provides a NAME condition, + calculated as: + + \f[ + Q = Q_{0} + Q_{p} + s*Q_{t} + \f] + + where + \vartable + s | single scalar value [units] + Q_{0} | single TYPE value [units] + Q_{p} | TYPE field across patch [units] + Q_{t} | TYPE function of time [units] + \endtable + + \heading Patch usage + + \table + Property | Description | Req'd? | Default + scalarData | single scalar value | yes | + data | single TYPE value | yes | + fieldData | TYPE field across patch | yes | + timeVsData | TYPE function of time | yes | + wordData | word, eg name of data object | no | wordDefault + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type NAME; + scalarData -1; + data ONE; + fieldData uniform THREE; + timeVsData table ( + (0 ZERO) + (1 TWO) + ); + wordName anotherName; + value uniform FOUR; // optional initial value + } + \endverbatim + +SourceFiles + CONSTRUCT.C + +\*---------------------------------------------------------------------------*/ + +#ifndef CONSTRUCT_H +#define CONSTRUCT_H + +#include "BASEFvPatchFields.H" +#include "DataEntry.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class CONSTRUCT Declaration +\*---------------------------------------------------------------------------*/ + +template +class CONSTRUCT +: + public PARENT +{ + // Private data + + //- Single valued scalar quantity, e.g. a coefficient + scalar scalarData_; + + //- Single valued Type quantity, e.g. reference pressure pRefValue_ + // Other options include vector, tensor + TYPE data_; + + //- Field of Types, typically defined across patch faces + // e.g. total pressure p0_. Other options include vectorField + FIELD fieldData_; + + //- Type specified as a function of time for time-varying BCs + autoPtr > timeVsData_; + + //- Word entry, e.g. pName_ for name of the pressure field on database + word wordData_; + + //- Label, e.g. patch index, current time index + label labelData_; + + //- Boolean for true/false, e.g. specify if flow rate is volumetric_ + bool boolData_; + + + // Private Member Functions + + //- Return current time + scalar t() const; + + +public: + + //- Runtime type information + TypeName("NAME"); + + + // Constructors + + //- Construct from patch and internal field + CONSTRUCT + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + CONSTRUCT + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given BASETypeFvPatchField + // onto a new patch + CONSTRUCT + ( + const CLASS&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + CONSTRUCT + ( + const CLASS& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new CLASS(*this) + ); + } + + //- Construct as copy setting internal field reference + CONSTRUCT + ( + const CLASS&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new CLASS + ( + *this, + iF + ) + ); + } + + + // Member functions + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const FVPATCHF&, + const labelList& + ); + + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "CONSTRUCT.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriterRunTime.C b/etc/codeTemplates/BC/BCs.C similarity index 93% rename from src/sampling/sampledSurface/writers/dx/dxSurfaceWriterRunTime.C rename to etc/codeTemplates/BC/BCs.C index 64380a317..ac5e5e8b2 100644 --- a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriterRunTime.C +++ b/etc/codeTemplates/BC/BCs.C @@ -23,10 +23,9 @@ License \*---------------------------------------------------------------------------*/ -#include "objectRegistry.H" -#include "dxSurfaceWriter.H" -#include "surfaceWriters.H" +#include "CONSTRUCTs.H" #include "addToRunTimeSelectionTable.H" +#include "volFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -35,7 +34,7 @@ namespace Foam // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -makeSurfaceWriters(dxSurfaceWriter); +makePatchFields(NAME); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriterRunTime.C b/etc/codeTemplates/BC/BCs.H similarity index 84% rename from src/sampling/sampledSurface/writers/raw/rawSurfaceWriterRunTime.C rename to etc/codeTemplates/BC/BCs.H index bbe6e410b..7d6466fa5 100644 --- a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriterRunTime.C +++ b/etc/codeTemplates/BC/BCs.H @@ -23,23 +23,27 @@ License \*---------------------------------------------------------------------------*/ -#include "objectRegistry.H" -#include "rawSurfaceWriter.H" -#include "surfaceWriters.H" -#include "addToRunTimeSelectionTable.H" +#ifndef CONSTRUCTs_H +#define CONSTRUCTs_H + +#include "CONSTRUCT.H" +#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeSurfaceWriterType(rawSurfaceWriter, bool); -makeSurfaceWriters(rawSurfaceWriter); +makePatchTypeFieldTypedefs(NAME); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + // ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/null/nullSurfaceWriterRunTime.C b/etc/codeTemplates/BC/BCsFwd.H similarity index 83% rename from src/sampling/sampledSurface/writers/null/nullSurfaceWriterRunTime.C rename to etc/codeTemplates/BC/BCsFwd.H index 47abcf259..33690cbcf 100644 --- a/src/sampling/sampledSurface/writers/null/nullSurfaceWriterRunTime.C +++ b/etc/codeTemplates/BC/BCsFwd.H @@ -23,23 +23,28 @@ License \*---------------------------------------------------------------------------*/ -#include "objectRegistry.H" -#include "nullSurfaceWriter.H" -#include "surfaceWriters.H" -#include "addToRunTimeSelectionTable.H" +#ifndef CONSTRUCTsFwd_H +#define CONSTRUCTsFwd_H + +#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeSurfaceWriterType(nullSurfaceWriter, bool); -makeSurfaceWriters(nullSurfaceWriter); +template class CONSTRUCT; + +makePatchTypeFieldTypedefs(NAME); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + // ************************************************************************* // diff --git a/etc/codeTemplates/BC/Make/files b/etc/codeTemplates/BC/Make/files new file mode 100644 index 000000000..bf5c6588a --- /dev/null +++ b/etc/codeTemplates/BC/Make/files @@ -0,0 +1,3 @@ +COMPILED.C + +LIB = $(FOAM_USER_LIBBIN)/libNAME diff --git a/etc/codeTemplates/BC/Make/options b/etc/codeTemplates/BC/Make/options new file mode 100644 index 000000000..a3ae8da83 --- /dev/null +++ b/etc/codeTemplates/BC/Make/options @@ -0,0 +1,7 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +LIB_LIBS = \ + -lfiniteVolume \ + -lmeshTools diff --git a/etc/codeTemplates/app/Make/files b/etc/codeTemplates/app/Make/files new file mode 100644 index 000000000..bfe94ae06 --- /dev/null +++ b/etc/codeTemplates/app/Make/files @@ -0,0 +1,3 @@ +NAME.C + +EXE = $(FOAM_USER_APPBIN)/NAME diff --git a/etc/codeTemplates/app/Make/options b/etc/codeTemplates/app/Make/options new file mode 100644 index 000000000..d27c95d03 --- /dev/null +++ b/etc/codeTemplates/app/Make/options @@ -0,0 +1,7 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +EXE_LIBS = \ + -lfiniteVolume \ + -lmeshTools diff --git a/etc/codeTemplates/app/app.C b/etc/codeTemplates/app/app.C new file mode 100644 index 000000000..85722a69b --- /dev/null +++ b/etc/codeTemplates/app/app.C @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +Application + NAME + +Description + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + #include "createTime.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/etc/codeTemplates/dynamicCode/FilterFunctionObjectTemplate.C b/etc/codeTemplates/dynamicCode/FilterFunctionObjectTemplate.C new file mode 100644 index 000000000..f1df6147e --- /dev/null +++ b/etc/codeTemplates/dynamicCode/FilterFunctionObjectTemplate.C @@ -0,0 +1,65 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "FilterFunctionObjectTemplate.H" + +// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // + +extern "C" +{ + // dynamicCode: + // SHA1 = ${SHA1sum} + // + // unique function name that can be checked if the correct library version + // has been loaded + void ${typeName}_${SHA1sum}(bool load) + { + if (load) + { + // code that can be explicitly executed after loading + } + else + { + // code that can be explicitly executed before unloading + } + } +} + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineNamedTemplateTypeNameAndDebug(${typeName}FilterFunctionObject, 0); + + //addToRunTimeSelectionTable + addToRunTimeSelectionTable + ( + functionObject, + ${typeName}FilterFunctionObject, + dictionary + ); +} + +// ************************************************************************* // diff --git a/etc/codeTemplates/dynamicCode/FilterFunctionObjectTemplate.H b/etc/codeTemplates/dynamicCode/FilterFunctionObjectTemplate.H new file mode 100644 index 000000000..b048d2782 --- /dev/null +++ b/etc/codeTemplates/dynamicCode/FilterFunctionObjectTemplate.H @@ -0,0 +1,51 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +Description + FunctionObject wrapper around functionObjectTemplate to allow them + to be created via the functions entry within controlDict. + +SourceFiles + FilterFunctionObject.C + +\*---------------------------------------------------------------------------*/ + +#ifndef FilterFunctionObject_H +#define FilterFunctionObject_H + +#include "functionObjectTemplate.H" +#include "OutputFilterFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef OutputFilterFunctionObject<${typeName}FunctionObject> + ${typeName}FilterFunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/etc/codeTemplates/dynamicCode/IOfunctionObjectTemplate.H b/etc/codeTemplates/dynamicCode/IOfunctionObjectTemplate.H new file mode 100644 index 000000000..5c7c5f7a0 --- /dev/null +++ b/etc/codeTemplates/dynamicCode/IOfunctionObjectTemplate.H @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +Typedef + Foam::IOfunctionObjectTemplate + +Description + Instance of the generic IOOutputFilter for ${typeName}FunctionObject. + +\*---------------------------------------------------------------------------*/ + +#ifndef IOfunctionObjectTemplate_H +#define IOfunctionObjectTemplate_H + +#include "functionObjectTemplate.H" +#include "IOOutputFilter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef IOOutputFilter<${typeName}FunctionObject> + IO${typeName}FunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/foam/primitives/ints/ulong/ulong.H b/etc/codeTemplates/dynamicCode/codeStreamTemplate.C similarity index 72% rename from src/foam/primitives/ints/ulong/ulong.H rename to etc/codeTemplates/dynamicCode/codeStreamTemplate.C index 3081d39c2..e0b7eb6e9 100644 --- a/src/foam/primitives/ints/ulong/ulong.H +++ b/etc/codeTemplates/dynamicCode/codeStreamTemplate.C @@ -21,47 +21,51 @@ License You should have received a copy of the GNU General Public License along with foam-extend. If not, see . -Primitive - ulong - Description - System unsigned long - -SourceFiles - ulongIO.C + Template for use with codeStream. \*---------------------------------------------------------------------------*/ -#ifndef ulong_H -#define ulong_H +#include "dictionary.H" +#include "Ostream.H" +#include "Pstream.H" +#include "unitConversion.H" -#include "word.H" +//{{{ begin codeInclude +${codeInclude} +//}}} end codeInclude // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -class Istream; -class Ostream; +// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * // -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +//{{{ begin localCode +${localCode} +//}}} end localCode -//- Return a string representation of a ulong -word name(const unsigned long); -// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // + +extern "C" +{ + void ${typeName} + ( + Ostream& os, + const dictionary& dict + ) + { +//{{{ begin code + ${code} +//}}} end code + } +} -unsigned long readUlong(Istream&); -Istream& operator>>(Istream&, unsigned long&); -Ostream& operator<<(Ostream&, const unsigned long); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - // ************************************************************************* // diff --git a/etc/codeTemplates/dynamicCode/codedFvOptionTemplate.C b/etc/codeTemplates/dynamicCode/codedFvOptionTemplate.C new file mode 100644 index 000000000..3f2a6a4a2 --- /dev/null +++ b/etc/codeTemplates/dynamicCode/codedFvOptionTemplate.C @@ -0,0 +1,204 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "codedFvOptionTemplate.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "surfaceFields.H" +#include "unitConversion.H" +#include "fvMatrix.H" + +//{{{ begin codeInclude +${codeInclude} +//}}} end codeInclude + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +namespace fv +{ + +// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * // + +//{{{ begin localCode +${localCode} +//}}} end localCode + + +// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // + +extern "C" +{ + // dynamicCode: + // SHA1 = ${SHA1sum} + // + // unique function name that can be checked if the correct library version + // has been loaded + void ${typeName}_${SHA1sum}(bool load) + { + if (load) + { + // code that can be explicitly executed after loading + } + else + { + // code that can be explicitly executed before unloading + } + } +} + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +//makeRemovablePatchTypeField +//( +// fvPatch${FieldType}, +// ${typeName}FvOption${SourceType} +//); +defineTypeNameAndDebug(${typeName}FvOption${SourceType}, 0); +addToRunTimeSelectionTable +( + option, + ${typeName}FvOption${SourceType}, + dictionary +); + + +const char* const ${typeName}FvOption${SourceType}::SHA1sum = + "${SHA1sum}"; + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +${typeName}FvOption${SourceType}:: +${typeName}FvOption${SourceType} +( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + option(name, modelType, dict, mesh) +{ + if (${verbose:-false}) + { + Info<<"construct ${typeName} sha1: ${SHA1sum}" + " from components\n"; + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +${typeName}FvOption${SourceType}:: +~${typeName}FvOption${SourceType}() +{ + if (${verbose:-false}) + { + Info<<"destroy ${typeName} sha1: ${SHA1sum}\n"; + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void ${typeName}FvOption${SourceType}::correct +( + GeometricField<${TemplateType}, fvPatchField, volMesh>& fld +) +{ + if (${verbose:-false}) + { + Info<<"${typeName}FvOption${SourceType}::correct()\n"; + } + +//{{{ begin code + ${codeCorrect} +//}}} end code +} + + +void ${typeName}FvOption${SourceType}::addSup +( + fvMatrix<${TemplateType}>& eqn, + const label fieldI +) +{ + if (${verbose:-false}) + { + Info<<"${typeName}FvOption${SourceType}::addSup()\n"; + } + +//{{{ begin code + ${codeAddSup} +//}}} end code +} + + +void ${typeName}FvOption${SourceType}::addSup +( + const volScalarField& rho, + fvMatrix<${TemplateType}>& eqn, + const label fieldI +) +{ + if (${verbose:-false}) + { + Info<<"${typeName}FvOption${SourceType}::addSup()\n"; + } + +//{{{ begin code + ${codeAddSup} +//}}} end code +} + + +void ${typeName}FvOption${SourceType}::setValue +( + fvMatrix<${TemplateType}>& eqn, + const label fieldI +) +{ + if (${verbose:-false}) + { + Info<<"${typeName}FvOption${SourceType}::setValue()\n"; + } + +//{{{ begin code + ${codeSetValue} +//}}} end code +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +} // End namespace fv +// ************************************************************************* // diff --git a/etc/codeTemplates/dynamicCode/codedFvOptionTemplate.H b/etc/codeTemplates/dynamicCode/codedFvOptionTemplate.H new file mode 100644 index 000000000..bb4482f84 --- /dev/null +++ b/etc/codeTemplates/dynamicCode/codedFvOptionTemplate.H @@ -0,0 +1,193 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +Description + Template for use with dynamic code generation of a source. + The hook functions take the following arguments: + + codeCorrect + ( + GeometricField& fld + ) + + codeAddSup + ( + fvMatrix& eqn, + const label fieldI + ) + + setValue + ( + fvMatrix& eqn, + const label fieldI + ) + + where : + fld is the field in fieldNames + eqn is the fvMatrix + + energySource + { + type scalarCodedSource; + + active true; + selectionMode all; + + scalarCodedSourceCoeffs + { + fieldNames (h); + redirectType sourceTime; + + codeInclude + #{ + + #}; + + codeCorrect + #{ + Pout<< "**codeCorrect**" << endl; + #}; + + codeAddSup + #{ + const Time& time = mesh().time(); + const scalarField& V = mesh_.V(); + scalarField& heSource = eqn.source(); + heSource -= 0.1*sqr(time.value())*V; + #}; + + codeSetValue + #{ + Pout<< "**codeSetValue**" << endl; + #}; + + // Dummy entry. Make dependent on above to trigger recompilation + code + #{ + $codeInclude + $codeCorrect + $codeAddSup + $codeSetValue + #}; + } + + sourceTimeCoeffs + { + // Dummy entry + } + } + +SourceFiles + codedFvOptionTemplate.C + +\*---------------------------------------------------------------------------*/ + +#ifndef codedFvOptionTemplate_H +#define codedFvOptionTemplate_H + +#include "fvOption.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +namespace fv +{ + +/*---------------------------------------------------------------------------*\ + A templated CodedFvOption +\*---------------------------------------------------------------------------*/ + +class ${typeName}FvOption${SourceType} +: + public option +{ +public: + + //- Information about the SHA1 of the code itself + static const char* const SHA1sum; + + //- Runtime type information + TypeName("${typeName}"); + + + // Constructors + + //- Construct from patch and internal field + ${typeName}FvOption${SourceType} + ( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + //- Destructor + virtual ~${typeName}FvOption${SourceType}(); + + + // Member functions + + //- Correct field + virtual void correct + ( + GeometricField<${TemplateType}, fvPatchField, volMesh>& + ); + + //- Explicit and implicit matrix contributions + virtual void addSup + ( + fvMatrix<${TemplateType}>& eqn, + const label fieldI + ); + + //- Explicit and implicit matrix contributions for compressible + // equations + virtual void addSup + ( + const volScalarField& rho, + fvMatrix<${TemplateType}>& eqn, + const label fieldI + ); + + //- Set value + virtual void setValue + ( + fvMatrix<${TemplateType}>& eqn, + const label fieldI + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +} // End namespace fv + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/etc/codeTemplates/dynamicCode/fixedValueFvPatchFieldTemplate.C b/etc/codeTemplates/dynamicCode/fixedValueFvPatchFieldTemplate.C new file mode 100644 index 000000000..ace8bba6b --- /dev/null +++ b/etc/codeTemplates/dynamicCode/fixedValueFvPatchFieldTemplate.C @@ -0,0 +1,211 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "fixedValueFvPatchFieldTemplate.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "surfaceFields.H" +#include "unitConversion.H" +//{{{ begin codeInclude +${codeInclude} +//}}} end codeInclude + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * // + +//{{{ begin localCode +${localCode} +//}}} end localCode + + +// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // + +extern "C" +{ + // dynamicCode: + // SHA1 = ${SHA1sum} + // + // unique function name that can be checked if the correct library version + // has been loaded + void ${typeName}_${SHA1sum}(bool load) + { + if (load) + { + // code that can be explicitly executed after loading + } + else + { + // code that can be explicitly executed before unloading + } + } +} + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makeRemovablePatchTypeField +( + fvPatch${FieldType}, + ${typeName}FixedValueFvPatch${FieldType} +); + + +const char* const ${typeName}FixedValueFvPatch${FieldType}::SHA1sum = + "${SHA1sum}"; + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +${typeName}FixedValueFvPatch${FieldType}:: +${typeName}FixedValueFvPatch${FieldType} +( + const fvPatch& p, + const DimensionedField<${TemplateType}, volMesh>& iF +) +: + fixedValueFvPatchField<${TemplateType}>(p, iF) +{ + if (${verbose:-false}) + { + Info<<"construct ${typeName} sha1: ${SHA1sum}" + " from patch/DimensionedField\n"; + } +} + + +${typeName}FixedValueFvPatch${FieldType}:: +${typeName}FixedValueFvPatch${FieldType} +( + const ${typeName}FixedValueFvPatch${FieldType}& ptf, + const fvPatch& p, + const DimensionedField<${TemplateType}, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchField<${TemplateType}>(ptf, p, iF, mapper) +{ + if (${verbose:-false}) + { + Info<<"construct ${typeName} sha1: ${SHA1sum}" + " from patch/DimensionedField/mapper\n"; + } +} + + +${typeName}FixedValueFvPatch${FieldType}:: +${typeName}FixedValueFvPatch${FieldType} +( + const fvPatch& p, + const DimensionedField<${TemplateType}, volMesh>& iF, + const dictionary& dict +) +: + fixedValueFvPatchField<${TemplateType}>(p, iF, dict) +{ + if (${verbose:-false}) + { + Info<<"construct ${typeName} sha1: ${SHA1sum}" + " from patch/dictionary\n"; + } +} + + +${typeName}FixedValueFvPatch${FieldType}:: +${typeName}FixedValueFvPatch${FieldType} +( + const ${typeName}FixedValueFvPatch${FieldType}& ptf +) +: + fixedValueFvPatchField<${TemplateType}>(ptf) +{ + if (${verbose:-false}) + { + Info<<"construct ${typeName} sha1: ${SHA1sum}" + " as copy\n"; + } +} + + +${typeName}FixedValueFvPatch${FieldType}:: +${typeName}FixedValueFvPatch${FieldType} +( + const ${typeName}FixedValueFvPatch${FieldType}& ptf, + const DimensionedField<${TemplateType}, volMesh>& iF +) +: + fixedValueFvPatchField<${TemplateType}>(ptf, iF) +{ + if (${verbose:-false}) + { + Info<<"construct ${typeName} sha1: ${SHA1sum} " + "as copy/DimensionedField\n"; + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +${typeName}FixedValueFvPatch${FieldType}:: +~${typeName}FixedValueFvPatch${FieldType}() +{ + if (${verbose:-false}) + { + Info<<"destroy ${typeName} sha1: ${SHA1sum}\n"; + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void ${typeName}FixedValueFvPatch${FieldType}::updateCoeffs() +{ + if (this->updated()) + { + return; + } + + if (${verbose:-false}) + { + Info<<"updateCoeffs ${typeName} sha1: ${SHA1sum}\n"; + } + +//{{{ begin code + ${code} +//}}} end code + + this->fixedValueFvPatchField<${TemplateType}>::updateCoeffs(); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/etc/codeTemplates/dynamicCode/fixedValueFvPatchFieldTemplate.H b/etc/codeTemplates/dynamicCode/fixedValueFvPatchFieldTemplate.H new file mode 100644 index 000000000..cd2efdbbe --- /dev/null +++ b/etc/codeTemplates/dynamicCode/fixedValueFvPatchFieldTemplate.H @@ -0,0 +1,142 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +Description + Template for use with dynamic code generation of a + fixedValue fvPatchField. + + - without state + +SourceFiles + fixedValueFvPatchFieldTemplate.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fixedValueFvPatchTemplate${FieldType}_H +#define fixedValueFvPatchTemplate${FieldType}_H + +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + A templated FixedValueFvPatch +\*---------------------------------------------------------------------------*/ + +class ${typeName}FixedValueFvPatch${FieldType} +: + public fixedValueFvPatchField<${TemplateType}> +{ +public: + + //- Information about the SHA1 of the code itself + static const char* const SHA1sum; + + //- Runtime type information + TypeName("${typeName}"); + + + // Constructors + + //- Construct from patch and internal field + ${typeName}FixedValueFvPatch${FieldType} + ( + const fvPatch&, + const DimensionedField<${TemplateType}, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + ${typeName}FixedValueFvPatch${FieldType} + ( + const fvPatch&, + const DimensionedField<${TemplateType}, volMesh>&, + const dictionary& + ); + + //- Construct by mapping a copy onto a new patch + ${typeName}FixedValueFvPatch${FieldType} + ( + const ${typeName}FixedValueFvPatch${FieldType}&, + const fvPatch&, + const DimensionedField<${TemplateType}, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + ${typeName}FixedValueFvPatch${FieldType} + ( + const ${typeName}FixedValueFvPatch${FieldType}& + ); + + //- Construct and return a clone + virtual tmp< fvPatch${FieldType} > clone() const + { + return tmp< fvPatch${FieldType} > + ( + new ${typeName}FixedValueFvPatch${FieldType}(*this) + ); + } + + //- Construct as copy setting internal field reference + ${typeName}FixedValueFvPatch${FieldType} + ( + const ${typeName}FixedValueFvPatch${FieldType}&, + const DimensionedField<${TemplateType}, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp< fvPatch${FieldType} > clone + ( + const DimensionedField<${TemplateType}, volMesh>& iF + ) const + { + return tmp< fvPatch${FieldType} > + ( + new ${typeName}FixedValueFvPatch${FieldType}(*this, iF) + ); + } + + + //- Destructor + virtual ~${typeName}FixedValueFvPatch${FieldType}(); + + + // Member functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/etc/codeTemplates/dynamicCode/fixedValuePointPatchFieldTemplate.C b/etc/codeTemplates/dynamicCode/fixedValuePointPatchFieldTemplate.C new file mode 100644 index 000000000..39b025d2b --- /dev/null +++ b/etc/codeTemplates/dynamicCode/fixedValuePointPatchFieldTemplate.C @@ -0,0 +1,211 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "fixedValuePointPatchFieldTemplate.H" +#include "addToRunTimeSelectionTable.H" +#include "pointPatchFieldMapper.H" +#include "pointFields.H" +#include "unitConversion.H" +//{{{ begin codeInclude +${codeInclude} +//}}} end codeInclude + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * // + +//{{{ begin localCode +${localCode} +//}}} end localCode + + +// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // + +extern "C" +{ + // dynamicCode: + // SHA1 = ${SHA1sum} + // + // unique function name that can be checked if the correct library version + // has been loaded + void ${typeName}_${SHA1sum}(bool load) + { + if (load) + { + // code that can be explicitly executed after loading + } + else + { + // code that can be explicitly executed before unloading + } + } +} + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makePointPatchTypeField +( + pointPatch${FieldType}, + ${typeName}FixedValuePointPatch${FieldType} +); + + +const char* const ${typeName}FixedValuePointPatch${FieldType}::SHA1sum = + "${SHA1sum}"; + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +${typeName}FixedValuePointPatch${FieldType}:: +${typeName}FixedValuePointPatch${FieldType} +( + const pointPatch& p, + const DimensionedField<${TemplateType}, pointMesh>& iF +) +: + fixedValuePointPatchField<${TemplateType}>(p, iF) +{ + if (${verbose:-false}) + { + Info<<"construct ${typeName} sha1: ${SHA1sum}" + " from patch/DimensionedField\n"; + } +} + + +${typeName}FixedValuePointPatch${FieldType}:: +${typeName}FixedValuePointPatch${FieldType} +( + const ${typeName}FixedValuePointPatch${FieldType}& ptf, + const pointPatch& p, + const DimensionedField<${TemplateType}, pointMesh>& iF, + const pointPatchFieldMapper& mapper +) +: + fixedValuePointPatchField<${TemplateType}>(ptf, p, iF, mapper) +{ + if (${verbose:-false}) + { + Info<<"construct ${typeName} sha1: ${SHA1sum}" + " from patch/DimensionedField/mapper\n"; + } +} + + +${typeName}FixedValuePointPatch${FieldType}:: +${typeName}FixedValuePointPatch${FieldType} +( + const pointPatch& p, + const DimensionedField<${TemplateType}, pointMesh>& iF, + const dictionary& dict, + const bool valueRequired +) +: + fixedValuePointPatchField<${TemplateType}>(p, iF, dict, valueRequired) +{ + if (${verbose:-false}) + { + Info<<"construct ${typeName} sha1: ${SHA1sum}" + " from patch/dictionary\n"; + } +} + + +${typeName}FixedValuePointPatch${FieldType}:: +${typeName}FixedValuePointPatch${FieldType} +( + const ${typeName}FixedValuePointPatch${FieldType}& ptf +) +: + fixedValuePointPatchField<${TemplateType}>(ptf) +{ + if (${verbose:-false}) + { + Info<<"construct ${typeName} sha1: ${SHA1sum}" + " as copy\n"; + } +} + + +${typeName}FixedValuePointPatch${FieldType}:: +${typeName}FixedValuePointPatch${FieldType} +( + const ${typeName}FixedValuePointPatch${FieldType}& ptf, + const DimensionedField<${TemplateType}, pointMesh>& iF +) +: + fixedValuePointPatchField<${TemplateType}>(ptf, iF) +{ + if (${verbose:-false}) + { + Info<<"construct ${typeName} sha1: ${SHA1sum} " + "as copy/DimensionedField\n"; + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +${typeName}FixedValuePointPatch${FieldType}:: +~${typeName}FixedValuePointPatch${FieldType}() +{ + if (${verbose:-false}) + { + Info<<"destroy ${typeName} sha1: ${SHA1sum}\n"; + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void ${typeName}FixedValuePointPatch${FieldType}::updateCoeffs() +{ + if (this->updated()) + { + return; + } + + if (${verbose:-false}) + { + Info<<"updateCoeffs ${typeName} sha1: ${SHA1sum}\n"; + } + +//{{{ begin code + ${code} +//}}} end code + + this->fixedValuePointPatchField<${TemplateType}>::updateCoeffs(); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/etc/codeTemplates/dynamicCode/fixedValuePointPatchFieldTemplate.H b/etc/codeTemplates/dynamicCode/fixedValuePointPatchFieldTemplate.H new file mode 100644 index 000000000..35174e101 --- /dev/null +++ b/etc/codeTemplates/dynamicCode/fixedValuePointPatchFieldTemplate.H @@ -0,0 +1,143 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +Description + Template for use with dynamic code generation of a + fixedValue pointPatchField. + + - without state + +SourceFiles + fixedValuePointPatchFieldTemplate.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fixedValuePointPatchTemplate${FieldType}_H +#define fixedValuePointPatchTemplate${FieldType}_H + +#include "fixedValuePointPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + A templated FixedValuePointPatchField +\*---------------------------------------------------------------------------*/ + +class ${typeName}FixedValuePointPatch${FieldType} +: + public fixedValuePointPatchField<${TemplateType}> +{ +public: + + //- Information about the SHA1 of the code itself + static const char* const SHA1sum; + + //- Runtime type information + TypeName("${typeName}"); + + + // Constructors + + //- Construct from patch and internal field + ${typeName}FixedValuePointPatch${FieldType} + ( + const pointPatch&, + const DimensionedField<${TemplateType}, pointMesh>& + ); + + //- Construct from patch, internal field and dictionary + ${typeName}FixedValuePointPatch${FieldType} + ( + const pointPatch&, + const DimensionedField<${TemplateType}, pointMesh>&, + const dictionary&, + const bool valueRequired=true + ); + + //- Construct by mapping a copy onto a new patch + ${typeName}FixedValuePointPatch${FieldType} + ( + const ${typeName}FixedValuePointPatch${FieldType}&, + const pointPatch&, + const DimensionedField<${TemplateType}, pointMesh>&, + const pointPatchFieldMapper& + ); + + //- Construct as copy + ${typeName}FixedValuePointPatch${FieldType} + ( + const ${typeName}FixedValuePointPatch${FieldType}& + ); + + //- Construct and return a clone + virtual autoPtr< pointPatchField<${TemplateType}> > clone() const + { + return autoPtr< pointPatchField<${TemplateType}> > + ( + new ${typeName}FixedValuePointPatch${FieldType}(*this) + ); + } + + //- Construct as copy setting internal field reference + ${typeName}FixedValuePointPatch${FieldType} + ( + const ${typeName}FixedValuePointPatch${FieldType}&, + const DimensionedField<${TemplateType}, pointMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual autoPtr< pointPatchField<${TemplateType}> > clone + ( + const DimensionedField<${TemplateType}, pointMesh>& iF + ) const + { + return autoPtr< pointPatchField<${TemplateType}> > + ( + new ${typeName}FixedValuePointPatch${FieldType}(*this, iF) + ); + } + + + //- Destructor + virtual ~${typeName}FixedValuePointPatch${FieldType}(); + + + // Member functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/etc/codeTemplates/dynamicCode/functionObjectTemplate.C b/etc/codeTemplates/dynamicCode/functionObjectTemplate.C new file mode 100644 index 000000000..9d881b899 --- /dev/null +++ b/etc/codeTemplates/dynamicCode/functionObjectTemplate.C @@ -0,0 +1,157 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "functionObjectTemplate.H" +#include "functionObject.H" +#include "foamTime.H" +#include "fvCFD.H" +#include "unitConversion.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(${typeName}FunctionObject, 0); + + +// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * // + +//{{{ begin localCode +${localCode} +//}}} end localCode + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +const objectRegistry& ${typeName}FunctionObject::obr() const +{ + return obr_; +} + + +const fvMesh& ${typeName}FunctionObject::mesh() const +{ + return refCast(obr_); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +${typeName}FunctionObject::${typeName}FunctionObject +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool +) +: + name_(name), + obr_(obr) +{ + read(dict); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +${typeName}FunctionObject::~${typeName}FunctionObject() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void ${typeName}FunctionObject::read(const dictionary& dict) +{ + if (${verbose:-false}) + { + Info<<"read ${typeName} sha1: ${SHA1sum}\n"; + } + +//{{{ begin code + ${codeRead} +//}}} end code +} + + +void ${typeName}FunctionObject::execute() +{ + if (${verbose:-false}) + { + Info<<"execute ${typeName} sha1: ${SHA1sum}\n"; + } + +//{{{ begin code + ${codeExecute} +//}}} end code +} + + +void ${typeName}FunctionObject::end() +{ + if (${verbose:-false}) + { + Info<<"end ${typeName} sha1: ${SHA1sum}\n"; + } + +//{{{ begin code + ${codeEnd} +//}}} end code +} + + +void ${typeName}FunctionObject::timeSet() +{ + if (${verbose:-false}) + { + Info<<"timeSet ${typeName} sha1: ${SHA1sum}\n"; + } + +//{{{ begin codeTime + ${codeTimeSet} +//}}} end code +} + + +void ${typeName}FunctionObject::write() +{ + if (${verbose:-false}) + { + Info<<"write ${typeName} sha1: ${SHA1sum}\n"; + } + +//{{{ begin code + ${code} +//}}} end code +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + + +// ************************************************************************* // diff --git a/etc/codeTemplates/dynamicCode/functionObjectTemplate.H b/etc/codeTemplates/dynamicCode/functionObjectTemplate.H new file mode 100644 index 000000000..09fb75556 --- /dev/null +++ b/etc/codeTemplates/dynamicCode/functionObjectTemplate.H @@ -0,0 +1,151 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +Description + Template for use with dynamic code generation of a + OutputFilter functionObject. + +SourceFiles + functionObjectTemplate.C + +\*---------------------------------------------------------------------------*/ + +#ifndef functionObjectTemplate_H +#define functionObjectTemplate_H + +#include "stringList.H" +#include "pointField.H" + +//{{{ begin codeInclude +${codeInclude} +//}}} end codeInclude + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class objectRegistry; +class dictionary; +class polyMesh; +class mapPolyMesh; +class fvMesh; + +/*---------------------------------------------------------------------------*\ + A templated functionObject +\*---------------------------------------------------------------------------*/ + +class ${typeName}FunctionObject +{ + // Private data + + //- Name of this set of system calls + word name_; + + //- Registry + const objectRegistry& obr_; + +//{{{ begin codeData + ${codeData} +//}}} end codeData + + + // Private Member Functions + + const objectRegistry& obr() const; + + const fvMesh& mesh() const; + + //- Disallow default bitwise copy construct + ${typeName}FunctionObject(const ${typeName}FunctionObject&); + + //- Disallow default bitwise assignment + void operator=(const ${typeName}FunctionObject&); + + +public: + + //- Runtime type information + TypeName("${typeName}"); + + + // Constructors + + //- Construct for given objectRegistry and dictionary. + // Allow the possibility to load fields from files + ${typeName}FunctionObject + ( + const word& name, + const objectRegistry& unused, + const dictionary&, + const bool loadFromFilesUnused = false + ); + + + //- Destructor + virtual ~${typeName}FunctionObject(); + + + // Member Functions + + //- Return name of the system call set + virtual const word& name() const + { + return name_; + } + + //- Read the system calls + virtual void read(const dictionary&); + + //- Execute the "executeCalls" at each time-step + virtual void execute(); + + //- Execute the "endCalls" at the final time-loop + virtual void end(); + + //- Write, execute the "writeCalls" + virtual void write(); + + //- Called when time was set at the end of the Time::operator++ + virtual void timeSet(); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const pointField&) + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/etc/codeTemplates/dynamicCode/mixedFvPatchFieldTemplate.C b/etc/codeTemplates/dynamicCode/mixedFvPatchFieldTemplate.C new file mode 100644 index 000000000..48a51671f --- /dev/null +++ b/etc/codeTemplates/dynamicCode/mixedFvPatchFieldTemplate.C @@ -0,0 +1,211 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "mixedFvPatchFieldTemplate.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "surfaceFields.H" +#include "unitConversion.H" +//{{{ begin codeInclude +${codeInclude} +//}}} end codeInclude + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * // + +//{{{ begin localCode +${localCode} +//}}} end localCode + + +// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // + +extern "C" +{ + // dynamicCode: + // SHA1 = ${SHA1sum} + // + // unique function name that can be checked if the correct library version + // has been loaded + void ${typeName}_${SHA1sum}(bool load) + { + if (load) + { + // code that can be explicitly executed after loading + } + else + { + // code that can be explicitly executed before unloading + } + } +} + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makeRemovablePatchTypeField +( + fvPatch${FieldType}, + ${typeName}MixedValueFvPatch${FieldType} +); + + +const char* const ${typeName}MixedValueFvPatch${FieldType}::SHA1sum = + "${SHA1sum}"; + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +${typeName}MixedValueFvPatch${FieldType}:: +${typeName}MixedValueFvPatch${FieldType} +( + const fvPatch& p, + const DimensionedField<${TemplateType}, volMesh>& iF +) +: + mixedFvPatchField<${TemplateType}>(p, iF) +{ + if (${verbose:-false}) + { + Info<<"construct ${typeName} sha1: ${SHA1sum}" + " from patch/DimensionedField\n"; + } +} + + +${typeName}MixedValueFvPatch${FieldType}:: +${typeName}MixedValueFvPatch${FieldType} +( + const ${typeName}MixedValueFvPatch${FieldType}& ptf, + const fvPatch& p, + const DimensionedField<${TemplateType}, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + mixedFvPatchField<${TemplateType}>(ptf, p, iF, mapper) +{ + if (${verbose:-false}) + { + Info<<"construct ${typeName} sha1: ${SHA1sum}" + " from patch/DimensionedField/mapper\n"; + } +} + + +${typeName}MixedValueFvPatch${FieldType}:: +${typeName}MixedValueFvPatch${FieldType} +( + const fvPatch& p, + const DimensionedField<${TemplateType}, volMesh>& iF, + const dictionary& dict +) +: + mixedFvPatchField<${TemplateType}>(p, iF, dict) +{ + if (${verbose:-false}) + { + Info<<"construct ${typeName} sha1: ${SHA1sum}" + " from patch/dictionary\n"; + } +} + + +${typeName}MixedValueFvPatch${FieldType}:: +${typeName}MixedValueFvPatch${FieldType} +( + const ${typeName}MixedValueFvPatch${FieldType}& ptf +) +: + mixedFvPatchField<${TemplateType}>(ptf) +{ + if (${verbose:-false}) + { + Info<<"construct ${typeName} sha1: ${SHA1sum}" + " as copy\n"; + } +} + + +${typeName}MixedValueFvPatch${FieldType}:: +${typeName}MixedValueFvPatch${FieldType} +( + const ${typeName}MixedValueFvPatch${FieldType}& ptf, + const DimensionedField<${TemplateType}, volMesh>& iF +) +: + mixedFvPatchField<${TemplateType}>(ptf, iF) +{ + if (${verbose:-false}) + { + Info<<"construct ${typeName} sha1: ${SHA1sum} " + "as copy/DimensionedField\n"; + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +${typeName}MixedValueFvPatch${FieldType}:: +~${typeName}MixedValueFvPatch${FieldType}() +{ + if (${verbose:-false}) + { + Info<<"destroy ${typeName} sha1: ${SHA1sum}\n"; + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void ${typeName}MixedValueFvPatch${FieldType}::updateCoeffs() +{ + if (this->updated()) + { + return; + } + + if (${verbose:-false}) + { + Info<<"updateCoeffs ${typeName} sha1: ${SHA1sum}\n"; + } + +//{{{ begin code + ${code} +//}}} end code + + this->mixedFvPatchField<${TemplateType}>::updateCoeffs(); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/etc/codeTemplates/dynamicCode/mixedFvPatchFieldTemplate.H b/etc/codeTemplates/dynamicCode/mixedFvPatchFieldTemplate.H new file mode 100644 index 000000000..494d33644 --- /dev/null +++ b/etc/codeTemplates/dynamicCode/mixedFvPatchFieldTemplate.H @@ -0,0 +1,142 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +Description + Template for use with dynamic code generation of a + mixed fvPatchField. + + - without state + +SourceFiles + mixedFvPatchFieldTemplate.C + +\*---------------------------------------------------------------------------*/ + +#ifndef mixedFvPatchTemplate${FieldType}_H +#define mixedFvPatchTemplate${FieldType}_H + +#include "mixedFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + A templated MixedValueFvPatchField +\*---------------------------------------------------------------------------*/ + +class ${typeName}MixedValueFvPatch${FieldType} +: + public mixedFvPatchField<${TemplateType}> +{ +public: + + //- Information about the SHA1 of the code itself + static const char* const SHA1sum; + + //- Runtime type information + TypeName("${typeName}"); + + + // Constructors + + //- Construct from patch and internal field + ${typeName}MixedValueFvPatch${FieldType} + ( + const fvPatch&, + const DimensionedField<${TemplateType}, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + ${typeName}MixedValueFvPatch${FieldType} + ( + const fvPatch&, + const DimensionedField<${TemplateType}, volMesh>&, + const dictionary& + ); + + //- Construct by mapping a copy onto a new patch + ${typeName}MixedValueFvPatch${FieldType} + ( + const ${typeName}MixedValueFvPatch${FieldType}&, + const fvPatch&, + const DimensionedField<${TemplateType}, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + ${typeName}MixedValueFvPatch${FieldType} + ( + const ${typeName}MixedValueFvPatch${FieldType}& + ); + + //- Construct and return a clone + virtual tmp< fvPatch${FieldType} > clone() const + { + return tmp< fvPatch${FieldType} > + ( + new ${typeName}MixedValueFvPatch${FieldType}(*this) + ); + } + + //- Construct as copy setting internal field reference + ${typeName}MixedValueFvPatch${FieldType} + ( + const ${typeName}MixedValueFvPatch${FieldType}&, + const DimensionedField<${TemplateType}, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp< fvPatch${FieldType} > clone + ( + const DimensionedField<${TemplateType}, volMesh>& iF + ) const + { + return tmp< fvPatch${FieldType} > + ( + new ${typeName}MixedValueFvPatch${FieldType}(*this, iF) + ); + } + + + //- Destructor + virtual ~${typeName}MixedValueFvPatch${FieldType}(); + + + // Member functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/etc/codeTemplates/foamCommentStyles b/etc/codeTemplates/foamCommentStyles new file mode 100644 index 000000000..b55f2c237 --- /dev/null +++ b/etc/codeTemplates/foamCommentStyles @@ -0,0 +1,31 @@ +1234567890123456789012345678901234567890123456789012345678901234567890123456789 + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +------------------------------------------------------------------------------- + +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// ************************************************************************* // + +// ------------------------------------------------------------------------- // + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // + +// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // diff --git a/etc/codeTemplates/foamScript b/etc/codeTemplates/foamScript new file mode 100755 index 000000000..49c427da7 --- /dev/null +++ b/etc/codeTemplates/foamScript @@ -0,0 +1,32 @@ +#!/bin/sh +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | foam-extend: Open Source CFD +# \\ / O peration | Version: 4.0 +# \\ / A nd | Web: http://www.foam-extend.org +# \\/ M anipulation | For copyright notice see file Copyright +#------------------------------------------------------------------------------ +# License +# This file is part of foam-extend. +# +# foam-extend is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# foam-extend 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 foam-extend. If not, see . +# +# Script +# +# +# Description +# +#------------------------------------------------------------------------------ + +# ----------------------------------------------------------------- end-of-file diff --git a/etc/codeTemplates/functionObject/FUNCTIONOBJECT.C b/etc/codeTemplates/functionObject/FUNCTIONOBJECT.C new file mode 100644 index 000000000..61fc5e904 --- /dev/null +++ b/etc/codeTemplates/functionObject/FUNCTIONOBJECT.C @@ -0,0 +1,96 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "FUNCTIONOBJECT.H" +#include "dictionary.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +defineTypeNameAndDebug(FUNCTIONOBJECT, 0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::FUNCTIONOBJECT::FUNCTIONOBJECT +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +: + name_(name), + obr_(obr), + wordData_(dict.lookupOrDefault("wordData", "defaultWord")), + scalarData_(readScalar(dict.lookup("scalarData"))), + labelData_(readLabel(dict.lookup("labelData"))) +{ + read(dict); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::FUNCTIONOBJECT::~FUNCTIONOBJECT() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::FUNCTIONOBJECT::read(const dictionary& dict) +{ + dict.readIfPresent("wordData", wordData_); + dict.lookup("scalarData") >> scalarData_; + dict.lookup("labelData") >> labelData_; +} + + +void Foam::FUNCTIONOBJECT::execute() +{ + // Do nothing - only valid on write +} + + +void Foam::FUNCTIONOBJECT::end() +{ + // Do nothing - only valid on write +} + + +void Foam::FUNCTIONOBJECT::timeSet() +{ + // Do nothing - only valid on write +} + + +void Foam::FUNCTIONOBJECT::write() +{ +} + + +// ************************************************************************* // diff --git a/etc/codeTemplates/functionObject/FUNCTIONOBJECT.H b/etc/codeTemplates/functionObject/FUNCTIONOBJECT.H new file mode 100644 index 000000000..826815335 --- /dev/null +++ b/etc/codeTemplates/functionObject/FUNCTIONOBJECT.H @@ -0,0 +1,176 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +Class + Foam::FUNCTIONOBJECT + +Group + +Description + This function object... + + Example of function object specification: + \verbatim + FUNCTIONOBJECT1 + { + type FUNCTIONOBJECT; + functionObjectLibs ("libFUNCTIONOBJECTFunctionObject.so"); + ... + wordData someWord; + scalarData 1.0; + labelData 1; + } + \endverbatim + + \heading Function object usage + \table + Property | Description | Required | Default value + type | type name: FUNCTIONOBJECT | yes | + wordData | some word option... | no | defaultWord + scalarData | some scalar value... | yes | + labelData | some label value... | yes | + \endtable + +SourceFiles + FUNCTIONOBJECT.C + IOFUNCTIONOBJECT.H + +\*---------------------------------------------------------------------------*/ + +#ifndef FUNCTIONOBJECT_H +#define FUNCTIONOBJECT_H + +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class objectRegistry; +class dictionary; +class polyMesh; +class mapPolyMesh; + +/*---------------------------------------------------------------------------*\ + Class FUNCTIONOBJECT Declaration +\*---------------------------------------------------------------------------*/ + +class FUNCTIONOBJECT +{ + // Private data + + //- Name of this set of FUNCTIONOBJECT + word name_; + + //- Refererence to Db + const objectRegistry& obr_; + + // Read from dictionary + + //- word + word wordData_; + + //- scalar + scalar scalarData_; + + //- label + label labelData_; + + + // Private Member Functions + + + //- Disallow default bitwise copy construct + FUNCTIONOBJECT(const FUNCTIONOBJECT&); + + //- Disallow default bitwise assignment + void operator=(const FUNCTIONOBJECT&); + + +public: + + //- Runtime type information + TypeName("FUNCTIONOBJECT"); + + + // Constructors + + //- Construct for given objectRegistry and dictionary. + // Allow the possibility to load fields from files + FUNCTIONOBJECT + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + + + //- Destructor + virtual ~FUNCTIONOBJECT(); + + + // Member Functions + + //- Return name of the FUNCTIONOBJECT + virtual const word& name() const + { + return name_; + } + + //- Read the FUNCTIONOBJECT data + virtual void read(const dictionary&); + + //- Execute, currently does nothing + virtual void execute(); + + //- Execute at the final time-loop, currently does nothing + virtual void end(); + + //- Called when time was set at the end of the Time::operator++ + virtual void timeSet(); + + //- Write the FUNCTIONOBJECT + virtual void write(); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const polyMesh&) + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/etc/codeTemplates/functionObject/FUNCTIONOBJECTFunctionObject.C b/etc/codeTemplates/functionObject/FUNCTIONOBJECTFunctionObject.C new file mode 100644 index 000000000..3fcaccb19 --- /dev/null +++ b/etc/codeTemplates/functionObject/FUNCTIONOBJECTFunctionObject.C @@ -0,0 +1,46 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "FUNCTIONOBJECTFunctionObject.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineNamedTemplateTypeNameAndDebug + ( + FUNCTIONOBJECTFunctionObject, + 0 + ); + + addToRunTimeSelectionTable + ( + functionObject, + FUNCTIONOBJECTFunctionObject, + dictionary + ); +} + +// ************************************************************************* // diff --git a/etc/codeTemplates/functionObject/FUNCTIONOBJECTFunctionObject.H b/etc/codeTemplates/functionObject/FUNCTIONOBJECTFunctionObject.H new file mode 100644 index 000000000..083783cec --- /dev/null +++ b/etc/codeTemplates/functionObject/FUNCTIONOBJECTFunctionObject.H @@ -0,0 +1,54 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +Typedef + Foam::FUNCTIONOBJECTFunctionObject + +Description + FunctionObject wrapper around FUNCTIONOBJECT to allow them to be + created via the functions entry within controlDict. + +SourceFiles + FUNCTIONOBJECTFunctionObject.C + +\*---------------------------------------------------------------------------*/ + +#ifndef FUNCTIONOBJECTFunctionObject_H +#define FUNCTIONOBJECTFunctionObject_H + +#include "FUNCTIONOBJECT.H" +#include "OutputFilterFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef OutputFilterFunctionObject + FUNCTIONOBJECTFunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/etc/codeTemplates/functionObject/IOFUNCTIONOBJECT.H b/etc/codeTemplates/functionObject/IOFUNCTIONOBJECT.H new file mode 100644 index 000000000..9c6db88e0 --- /dev/null +++ b/etc/codeTemplates/functionObject/IOFUNCTIONOBJECT.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +Typedef + Foam::IOFUNCTIONOBJECT + +Description + Instance of the generic IOOutputFilter for FUNCTIONOBJECT. + +\*---------------------------------------------------------------------------*/ + +#ifndef IOFUNCTIONOBJECT_H +#define IOFUNCTIONOBJECT_H + +#include "FUNCTIONOBJECT.H" +#include "IOOutputFilter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef IOOutputFilter IOFUNCTIONOBJECT; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/etc/codeTemplates/functionObject/Make/files b/etc/codeTemplates/functionObject/Make/files new file mode 100644 index 000000000..73b995603 --- /dev/null +++ b/etc/codeTemplates/functionObject/Make/files @@ -0,0 +1,4 @@ +FUNCTIONOBJECT.C +FUNCTIONOBJECTFunctionObject.C + +LIB = $(FOAM_USER_LIBBIN)/libFUNCTIONOBJECTFunctionObject diff --git a/etc/codeTemplates/functionObject/Make/options b/etc/codeTemplates/functionObject/Make/options new file mode 100644 index 000000000..a3ae8da83 --- /dev/null +++ b/etc/codeTemplates/functionObject/Make/options @@ -0,0 +1,7 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +LIB_LIBS = \ + -lfiniteVolume \ + -lmeshTools diff --git a/etc/codeTemplates/source/_Template.C b/etc/codeTemplates/source/_Template.C new file mode 100644 index 000000000..d143f0562 --- /dev/null +++ b/etc/codeTemplates/source/_Template.C @@ -0,0 +1,102 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "CLASSNAME.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +const dataType Foam::CLASSNAME::staticData(); + + +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::CLASSNAME::CLASSNAME() +: + baseClassName(), + data_() +{} + + +Foam::CLASSNAME::CLASSNAME(const dataType& data) +: + baseClassName(), + data_(data) +{} + + +Foam::CLASSNAME::CLASSNAME(const CLASSNAME&) +: + baseClassName(), + data_() +{} + + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +Foam::autoPtr +Foam::CLASSNAME::New() +{ + return autoPtr(new CLASSNAME); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::CLASSNAME::~CLASSNAME() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // + +void Foam::CLASSNAME::operator=(const CLASSNAME& rhs) +{ + // Check for assignment to self + if (this == &rhs) + { + FatalErrorIn("Foam::CLASSNAME::operator=(const Foam::CLASSNAME&)") + << "Attempted assignment to self" + << abort(FatalError); + } +} + +// * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * // + + +// ************************************************************************* // diff --git a/src/foam/db/IOstreams/token/CompoundToken/CompoundToken.H b/etc/codeTemplates/source/_Template.H similarity index 62% rename from src/foam/db/IOstreams/token/CompoundToken/CompoundToken.H rename to etc/codeTemplates/source/_Template.H index bdd0f3dd0..088c2adf5 100644 --- a/src/foam/db/IOstreams/token/CompoundToken/CompoundToken.H +++ b/etc/codeTemplates/source/_Template.H @@ -22,86 +22,91 @@ License along with foam-extend. If not, see . Class - Foam::CompoundToken + Foam::CLASSNAME Description - An abstract base class for managing compound tokens + +SourceFiles + CLASSNAMEI.H + CLASSNAME.C + CLASSNAMEIO.C \*---------------------------------------------------------------------------*/ -#ifndef CompoundToken_H -#define CompoundToken_H +#ifndef CLASSNAME_H +#define CLASSNAME_H -#include "refCount.H" -#include "typeInfo.H" -#include "autoPtr.H" -#include "runTimeSelectionTables.H" +#include ".H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -// Forward declaration of friend functions and operators +// Forward declaration of classes +class Istream; +class Ostream; -class CompoundToken; -Ostream& operator<<(Ostream&, const CompoundToken&); +// Forward declaration of friend functions and operators +class CLASSNAME; +Istream& operator>>(Istream&, CLASSNAME&); +Ostream& operator<<(Ostream&, const CLASSNAME&); /*---------------------------------------------------------------------------*\ - Class CompoundToken Declaration + Class CLASSNAME Declaration \*---------------------------------------------------------------------------*/ -class CompoundToken +class CLASSNAME : - public refCount + public baseClassName { + // Private data + + //- Description of data_ + dataType data_; + + // Private Member Functions //- Disallow default bitwise copy construct - CompoundToken(const CompoundToken&); + CLASSNAME(const CLASSNAME&); //- Disallow default bitwise assignment - void operator=(const CompoundToken&); + void operator=(const CLASSNAME&); public: - //- Runtime type information - virtual const word& type() const = 0; + // Static data members - - // Declare run-time constructor selection tables - - declareRunTimeSelectionTable - ( - autoPtr, - CompoundToken, - Istream, - (const word& type, Istream& is), - (type, is) - ); + //- Static data staticData + static const dataType staticData; // Constructors //- Construct null - CompoundToken() - {} + CLASSNAME(); - //- Return the clone as this and increment reference count - virtual autoPtr clone() const = 0; + //- Construct from components + CLASSNAME(const dataType& data); + + //- Construct from Istream + CLASSNAME(Istream&); + + //- Construct as copy + CLASSNAME(const CLASSNAME&); // Selectors //- Select null constructed - static autoPtr New(const word& type, Istream& is); + static autoPtr New(); - // Destructor - - virtual ~CompoundToken(); + //- Destructor + ~CLASSNAME(); // Member Functions @@ -114,12 +119,20 @@ public: // Write - virtual void write(Istream&) = 0; + // Member Operators + + void operator=(const CLASSNAME&); + + + // Friend Functions + + // Friend Operators // IOstream Operators - friend Ostream& operator<<(Ostream&, const CompoundToken&); + friend Istream& operator>>(Istream&, CLASSNAME&); + friend Ostream& operator<<(Ostream&, const CLASSNAME&); }; @@ -129,6 +142,10 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#include "CLASSNAMEI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/etc/codeTemplates/source/_TemplateApp.C b/etc/codeTemplates/source/_TemplateApp.C new file mode 100644 index 000000000..65e484a09 --- /dev/null +++ b/etc/codeTemplates/source/_TemplateApp.C @@ -0,0 +1,48 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +Application + CLASSNAME + +Description + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + #include "createTime.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nEnd\n" << endl; + return 0; +} + + +// ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/null/nullSurfaceWriter.C b/etc/codeTemplates/source/_TemplateI.H similarity index 74% rename from src/sampling/sampledSurface/writers/null/nullSurfaceWriter.C rename to etc/codeTemplates/source/_TemplateI.H index d3ff7f1cf..a4e6bf00c 100644 --- a/src/sampling/sampledSurface/writers/null/nullSurfaceWriter.C +++ b/etc/codeTemplates/source/_TemplateI.H @@ -23,40 +23,36 @@ License \*---------------------------------------------------------------------------*/ -#include "nullSurfaceWriter.H" +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template -Foam::nullSurfaceWriter::nullSurfaceWriter() -: - surfaceWriter() -{} +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -template -Foam::nullSurfaceWriter::~nullSurfaceWriter() -{} - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -void Foam::nullSurfaceWriter::write -( - const fileName& outputDir, - const fileName& surfaceName, - const pointField& points, - const faceList& faces, - const fileName& fieldName, - const Field& values, - const bool verbose -) const -{} + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // ************************************************************************* // diff --git a/etc/codeTemplates/source/_TemplateIO.C b/etc/codeTemplates/source/_TemplateIO.C new file mode 100644 index 000000000..61aa2c71b --- /dev/null +++ b/etc/codeTemplates/source/_TemplateIO.C @@ -0,0 +1,70 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "CLASSNAME.H" +#include "IOstreams.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::CLASSNAME::CLASSNAME(Istream& is) +: + base1(is), + base2(is), + member1(is), + member2(is) +{ + // Check state of Istream + is.check("Foam::CLASSNAME::CLASSNAME(Foam::Istream&)"); +} + + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +Foam::Istream& Foam::operator>>(Istream& is, CLASSNAME&) +{ + // Check state of Istream + is.check + ( + "Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::CLASSNAME&)" + ); + + return is; +} + + +Foam::Ostream& Foam::operator<<(Ostream& os, const CLASSNAME&) +{ + // Check state of Ostream + os.check + ( + "Foam::Ostream& Foam::operator<<(Foam::Ostream&, " + "const Foam::CLASSNAME&)" + ); + + return os; +} + + +// ************************************************************************* // diff --git a/etc/codeTemplates/source/foamNewSource b/etc/codeTemplates/source/foamNewSource new file mode 100755 index 000000000..b0e33f24e --- /dev/null +++ b/etc/codeTemplates/source/foamNewSource @@ -0,0 +1,115 @@ +#!/bin/sh +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | foam-extend: Open Source CFD +# \\ / O peration | Version: 4.0 +# \\ / A nd | Web: http://www.foam-extend.org +# \\/ M anipulation | For copyright notice see file Copyright +#------------------------------------------------------------------------------- +# License +# This file is part of foam-extend. +# +# foam-extend is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# foam-extend 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 foam-extend. If not, see . +# +# Script +# foamNewSource +# +# Description +# Create a new standard OpenFOAM source file +# +#------------------------------------------------------------------------------ +Script=${0##*/} +Template="$WM_PROJECT_DIR/etc/codeTemplates/source/_Template" + +usage() { + while [ "$#" -ge 1 ]; do echo "$1"; shift; done + cat< +options: + -help print the usage + +* create a new standard OpenFOAM source file + +type: (C|H|I|IO|App) + +A ClassName starting with '-' will simply display the template + +USAGE + exit 1 +} + + +className="$2" +unset subType Type printOpt + +# for a className starting with '-' simply display the code +if [ "${2#-}" != "${2}" ] +then + printOpt=true +fi + + +# this implicitly covers a lone -help +[ "$#" -gt 1 ] || usage + +case "$1" in +(-h | -help) + usage + ;; +(C|H) + Type=".$1" + ;; +(I) + Type="$1.H" + ;; +(IO) + Type="$1.C" + ;; +(app|App) + subType=App + Type=".C" + ;; +(*) + usage "unknown type '$1'" + ;; +esac + +[ "$#" -eq 2 ] || usage "wrong number of arguments" +shift 2 + + +if [ "${printOpt:-false}" = true ] +then + cat $Template$subType$Type +else + + fileName="$className$Type" + + echo "$Script: Creating new interface file $fileName" + if [ -e "$fileName" ] + then + echo " Error: file exists" + exit 1 + fi + + # process class name + sed "s/CLASSNAME/$className/g" $Template$subType$Type > $fileName + + if [ "$subType" = App -a ! -d Make ] + then + wmakeFilesAndOptions + fi +fi + +#------------------------------------------------------------------------------ diff --git a/etc/codeTemplates/template/_TemplateTemplate.C b/etc/codeTemplates/template/_TemplateTemplate.C new file mode 100644 index 000000000..086321407 --- /dev/null +++ b/etc/codeTemplates/template/_TemplateTemplate.C @@ -0,0 +1,122 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "CLASSNAME.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +template +const dataType Foam::CLASSNAME::staticData(); + + +// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::CLASSNAME::CLASSNAME() +: + baseClassName(), + data_() +{} + + +template +Foam::CLASSNAME::CLASSNAME(const dataType& data) +: + baseClassName(), + data_(data) +{} + + +template +Foam::CLASSNAME::CLASSNAME +( + const CLASSNAME& +) +: + baseCLASSNAME(), + data_() +{} + + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +template +Foam::autoPtr > +Foam::CLASSNAME::New() +{ + return autoPtr > + ( + new CLASSNAME + ); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::CLASSNAME::~CLASSNAME() +{} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // + +template +void Foam::CLASSNAME::operator= +( + const CLASSNAME& rhs +) +{ + // Check for assignment to self + if (this == &rhs) + { + FatalErrorIn + ( + "Foam::CLASSNAME::operator=" + "(const Foam::CLASSNAME&)" + ) << "Attempted assignment to self" + << abort(FatalError); + } +} + + +// * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * // + + +// ************************************************************************* // diff --git a/etc/codeTemplates/template/_TemplateTemplate.H b/etc/codeTemplates/template/_TemplateTemplate.H new file mode 100644 index 000000000..3410c6dd6 --- /dev/null +++ b/etc/codeTemplates/template/_TemplateTemplate.H @@ -0,0 +1,157 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +Class + Foam::CLASSNAME + +Description + +SourceFiles + CLASSNAMEI.H + CLASSNAME.C + CLASSNAMEIO.C + +\*---------------------------------------------------------------------------*/ + +#ifndef CLASSNAME_H +#define CLASSNAME_H + +#include ".H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class someClass; + + +// Forward declaration of friend functions and operators + +template +class CLASSNAME; + +template +Istream& operator>>(Istream&, CLASSNAME&); + +template +Ostream& operator<<(Ostream&, const CLASSNAME&); + + +/*---------------------------------------------------------------------------*\ + Class CLASSNAME Declaration +\*---------------------------------------------------------------------------*/ + +template +class CLASSNAME +: + public baseClassName +{ + // Private data + + dataType data_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + CLASSNAME(const CLASSNAME&); + + //- Disallow default bitwise assignment + void operator=(const CLASSNAME&); + + +public: + + // Static data members + + //- Static data someStaticData + static const dataType staticData; + + + // Constructors + + //- Construct null + CLASSNAME(); + + //- Construct from components + CLASSNAME(const dataType& data); + + //- Construct from Istream + CLASSNAME(Istream&); + + //- Construct as copy + CLASSNAME(const CLASSNAME&); + + + // Selectors + + //- Select null constructed + static autoPtr > New(); + + + //- Destructor + ~CLASSNAME(); + + + // Member Functions + + // Member Operators + + void operator=(const CLASSNAME&); + + + // Friend Functions + + // Friend Operators + + // IOstream Operators + + friend Istream& operator>> + (Istream&, CLASSNAME&); + + friend Ostream& operator<< + (Ostream&, const CLASSNAME&); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "CLASSNAMEI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "CLASSNAME.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/foam/primitives/ints/longLong/longLong.H b/etc/codeTemplates/template/_TemplateTemplateI.H similarity index 69% rename from src/foam/primitives/ints/longLong/longLong.H rename to etc/codeTemplates/template/_TemplateTemplateI.H index a593ecb26..a4e6bf00c 100644 --- a/src/foam/primitives/ints/longLong/longLong.H +++ b/etc/codeTemplates/template/_TemplateTemplateI.H @@ -21,47 +21,38 @@ License You should have received a copy of the GNU General Public License along with foam-extend. If not, see . -Primitive - long long - -Description - A long long (64 bits on many systems) - -SourceFiles - longLongIO.C - \*---------------------------------------------------------------------------*/ -#ifndef longLong_H -#define longLong_H +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // -#include "word.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - -class Istream; -class Ostream; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -//- Return a string representation of a long long -word name(long long); - -// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // - -long long readLongLong(Istream&); -Istream& operator>>(Istream&, long long&); -Ostream& operator<<(Ostream&, const long long); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif // ************************************************************************* // diff --git a/etc/codeTemplates/template/_TemplateTemplateIO.C b/etc/codeTemplates/template/_TemplateTemplateIO.C new file mode 100644 index 000000000..fd5aaf94b --- /dev/null +++ b/etc/codeTemplates/template/_TemplateTemplateIO.C @@ -0,0 +1,82 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "CLASSNAME.H" +#include "IOstreams.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::CLASSNAME::CLASSNAME(Istream& is) +: + base1(is), + base2(is), + member1(is), + member2(is) +{ + // Check state of Istream + is.check("Foam::CLASSNAME::CLASSNAME(Foam::Istream&)"); +} + + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +template +Foam::Istream& Foam::operator>> +( + Istream& is, + CLASSNAME& +) +{ + // Check state of Istream + is.check + ( + "Foam::Istream& Foam::operator>>" + "(Foam::Istream&, Foam::CLASSNAME&)" + ); + + return is; +} + + +template +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const CLASSNAME& +) +{ + // Check state of Ostream + os.check + ( + "Foam::Ostream& Foam::operator<<" + "(Ostream&, const CLASSNAME&)" + ); + + return os; +} + + +// ************************************************************************* // diff --git a/etc/codeTemplates/template/foamNewTemplate b/etc/codeTemplates/template/foamNewTemplate new file mode 100755 index 000000000..f5e5e1891 --- /dev/null +++ b/etc/codeTemplates/template/foamNewTemplate @@ -0,0 +1,130 @@ +#!/bin/sh +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | foam-extend: Open Source CFD +# \\ / O peration | Version: 4.0 +# \\ / A nd | Web: http://www.foam-extend.org +# \\/ M anipulation | For copyright notice see file Copyright +#------------------------------------------------------------------------------- +# License +# This file is part of foam-extend. +# +# foam-extend is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# foam-extend 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 foam-extend. If not, see . +# +# Script +# foamNewTemplate +# +# Description +# Create a new standard OpenFOAM templated source file +# +#------------------------------------------------------------------------------ +Script=${0##*/} +Template="$WM_PROJECT_DIR/etc/codeTemplates/template/_TemplateTemplate" + +usage() { + while [ "$#" -ge 1 ]; do echo "$1"; shift; done + cat<