diff --git a/applications/utilities/mesh/advanced/combinePatchFaces/Make/options b/applications/utilities/mesh/advanced/combinePatchFaces/Make/options index 946497fc94..d269003b00 100644 --- a/applications/utilities/mesh/advanced/combinePatchFaces/Make/options +++ b/applications/utilities/mesh/advanced/combinePatchFaces/Make/options @@ -3,7 +3,6 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ - EXE_LIBS = \ -lfiniteVolume \ -lgenericPatches \ diff --git a/applications/utilities/mesh/advanced/refineHexMesh/Make/options b/applications/utilities/mesh/advanced/refineHexMesh/Make/options index a8c83dc5a3..17cb6a9617 100644 --- a/applications/utilities/mesh/advanced/refineHexMesh/Make/options +++ b/applications/utilities/mesh/advanced/refineHexMesh/Make/options @@ -3,10 +3,8 @@ EXE_INC = \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude - EXE_LIBS = \ -ldynamicMesh \ -lmeshTools \ - -lgenericPatches \ -lfiniteVolume \ - -lgenericPatchFields + -lgenericFvFields diff --git a/applications/utilities/mesh/advanced/removeFaces/Make/options b/applications/utilities/mesh/advanced/removeFaces/Make/options index 63c5dc5d78..ce4f38b51a 100644 --- a/applications/utilities/mesh/advanced/removeFaces/Make/options +++ b/applications/utilities/mesh/advanced/removeFaces/Make/options @@ -7,4 +7,4 @@ EXE_LIBS = \ -lmeshTools \ -ldynamicMesh \ -lfiniteVolume \ - -lgenericPatchFields + -lgenericFvFields diff --git a/applications/utilities/mesh/advanced/selectCells/Make/options b/applications/utilities/mesh/advanced/selectCells/Make/options index 20ceda87dc..bd6fe53d77 100644 --- a/applications/utilities/mesh/advanced/selectCells/Make/options +++ b/applications/utilities/mesh/advanced/selectCells/Make/options @@ -4,7 +4,6 @@ EXE_INC = \ -I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude - EXE_LIBS = \ -ldynamicMesh \ -lmeshTools \ diff --git a/applications/utilities/mesh/generation/extrudeMesh/Make/options b/applications/utilities/mesh/generation/extrudeMesh/Make/options index e3a9b1bd59..3b79b104df 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/Make/options +++ b/applications/utilities/mesh/generation/extrudeMesh/Make/options @@ -11,5 +11,5 @@ EXE_LIBS = \ -lsurfMesh \ -lmeshTools \ -ldynamicMesh \ - -lgenericPatchFields \ + -lgenericFvFields \ -lextrudeModel diff --git a/applications/utilities/mesh/generation/extrudeToRegionMesh/Make/options b/applications/utilities/mesh/generation/extrudeToRegionMesh/Make/options index ada965dd2e..912db255c6 100644 --- a/applications/utilities/mesh/generation/extrudeToRegionMesh/Make/options +++ b/applications/utilities/mesh/generation/extrudeToRegionMesh/Make/options @@ -8,7 +8,7 @@ EXE_INC = \ EXE_LIBS = \ -lfileFormats \ -lfiniteVolume \ - -lgenericPatchFields \ + -lgenericFvFields \ -lmeshTools \ -ldynamicMesh \ -lextrudeModel diff --git a/applications/utilities/mesh/generation/snappyHexMesh/Make/options b/applications/utilities/mesh/generation/snappyHexMesh/Make/options index 00e73c0975..97ed1c6ce2 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/Make/options +++ b/applications/utilities/mesh/generation/snappyHexMesh/Make/options @@ -10,7 +10,7 @@ EXE_INC = \ EXE_LIBS = \ -lfiniteVolume \ - -lgenericPatchFields \ + -lgenericFvFields \ -ldecompositionMethods \ -L$(FOAM_LIBBIN)/dummy -lscotchDecomp -lptscotchDecomp \ -lmeshTools \ diff --git a/applications/utilities/mesh/manipulation/createBaffles/Make/options b/applications/utilities/mesh/manipulation/createBaffles/Make/options index 3c8db28129..105d76e3b7 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/Make/options +++ b/applications/utilities/mesh/manipulation/createBaffles/Make/options @@ -8,4 +8,4 @@ EXE_LIBS = \ -ldynamicMesh \ -lmeshTools \ -lfiniteVolume \ - -lgenericPatchFields + -lgenericFvFields diff --git a/applications/utilities/mesh/manipulation/createNonConformalCouples/Make/options b/applications/utilities/mesh/manipulation/createNonConformalCouples/Make/options index 84507d45b5..a3cb892c27 100644 --- a/applications/utilities/mesh/manipulation/createNonConformalCouples/Make/options +++ b/applications/utilities/mesh/manipulation/createNonConformalCouples/Make/options @@ -7,4 +7,4 @@ EXE_LIBS = \ -lfiniteVolume \ -ldynamicMesh \ -lmeshTools \ - -lgenericPatchFields + -lgenericFvFields diff --git a/applications/utilities/mesh/manipulation/insideCells/Make/options b/applications/utilities/mesh/manipulation/insideCells/Make/options index e4d11a1c7c..718109541e 100644 --- a/applications/utilities/mesh/manipulation/insideCells/Make/options +++ b/applications/utilities/mesh/manipulation/insideCells/Make/options @@ -2,7 +2,6 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude - EXE_LIBS = \ -ltriSurface \ -lgenericPatches \ diff --git a/applications/utilities/mesh/manipulation/mergeBaffles/Make/options b/applications/utilities/mesh/manipulation/mergeBaffles/Make/options index 523fc41d30..0ec09dbd2e 100644 --- a/applications/utilities/mesh/manipulation/mergeBaffles/Make/options +++ b/applications/utilities/mesh/manipulation/mergeBaffles/Make/options @@ -5,6 +5,6 @@ EXE_INC = \ EXE_LIBS = \ -lfiniteVolume \ - -lgenericPatchFields \ + -lgenericFvFields \ -lmeshTools \ -ldynamicMesh diff --git a/applications/utilities/mesh/manipulation/polyDualMesh/Make/options b/applications/utilities/mesh/manipulation/polyDualMesh/Make/options index f3d9c89aac..6101c4208a 100644 --- a/applications/utilities/mesh/manipulation/polyDualMesh/Make/options +++ b/applications/utilities/mesh/manipulation/polyDualMesh/Make/options @@ -5,6 +5,6 @@ EXE_INC = \ EXE_LIBS = \ -lfiniteVolume \ - -lgenericPatchFields \ + -lgenericFvFields \ -ldynamicMesh \ -lmeshTools diff --git a/applications/utilities/mesh/manipulation/renumberMesh/Make/options b/applications/utilities/mesh/manipulation/renumberMesh/Make/options index 720011d74f..e269bb4bb5 100644 --- a/applications/utilities/mesh/manipulation/renumberMesh/Make/options +++ b/applications/utilities/mesh/manipulation/renumberMesh/Make/options @@ -11,7 +11,7 @@ EXE_LIBS = \ -lmeshTools \ -ldynamicMesh \ -lfiniteVolume \ - -lgenericPatchFields \ + -lgenericFvFields \ -lrenumberMethods \ $(LINK_FLAGS) \ -ldecompositionMethods \ diff --git a/applications/utilities/mesh/manipulation/singleCellMesh/Make/options b/applications/utilities/mesh/manipulation/singleCellMesh/Make/options index 193ad0e7b2..f8d7663f77 100644 --- a/applications/utilities/mesh/manipulation/singleCellMesh/Make/options +++ b/applications/utilities/mesh/manipulation/singleCellMesh/Make/options @@ -2,6 +2,6 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude EXE_LIBS = \ - -lgenericPatchFields \ + -lgenericFvFields \ -lfiniteVolume diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/Make/options b/applications/utilities/mesh/manipulation/splitMeshRegions/Make/options index da1b9c5016..01a976d7b7 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/Make/options +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/Make/options @@ -5,6 +5,6 @@ EXE_INC = \ EXE_LIBS = \ -lfiniteVolume \ - -lgenericPatchFields \ + -lgenericFvFields \ -ldynamicMesh \ -lmeshTools diff --git a/applications/utilities/mesh/manipulation/stitchMesh/Make/options b/applications/utilities/mesh/manipulation/stitchMesh/Make/options index ac523b8282..cfdf7cfa1d 100644 --- a/applications/utilities/mesh/manipulation/stitchMesh/Make/options +++ b/applications/utilities/mesh/manipulation/stitchMesh/Make/options @@ -7,4 +7,4 @@ EXE_LIBS = \ -ldynamicMesh \ -lmeshTools \ -lfiniteVolume \ - -lgenericPatchFields + -lgenericFvFields diff --git a/applications/utilities/mesh/manipulation/subsetMesh/Make/options b/applications/utilities/mesh/manipulation/subsetMesh/Make/options index 759535d95f..369bd4cf81 100644 --- a/applications/utilities/mesh/manipulation/subsetMesh/Make/options +++ b/applications/utilities/mesh/manipulation/subsetMesh/Make/options @@ -5,4 +5,4 @@ EXE_INC = \ EXE_LIBS = \ -ldynamicMesh \ - -lgenericPatchFields + -lgenericFvFields diff --git a/applications/utilities/mesh/manipulation/transformPoints/Make/options b/applications/utilities/mesh/manipulation/transformPoints/Make/options index 7d0cd4e3e1..46878def2b 100644 --- a/applications/utilities/mesh/manipulation/transformPoints/Make/options +++ b/applications/utilities/mesh/manipulation/transformPoints/Make/options @@ -5,4 +5,4 @@ EXE_INC = \ EXE_LIBS = \ -lmeshTools \ -lfiniteVolume \ - -lgenericPatchFields + -lgenericFvFields diff --git a/applications/utilities/miscellaneous/foamFormatConvert/Make/options b/applications/utilities/miscellaneous/foamFormatConvert/Make/options index b2bc2047e3..cf564ff159 100644 --- a/applications/utilities/miscellaneous/foamFormatConvert/Make/options +++ b/applications/utilities/miscellaneous/foamFormatConvert/Make/options @@ -6,5 +6,5 @@ EXE_INC = \ EXE_LIBS = \ -lmeshTools \ -lfiniteVolume \ - -lgenericPatchFields \ + -lgenericFvFields \ -llagrangian diff --git a/applications/utilities/miscellaneous/patchSummary/Make/options b/applications/utilities/miscellaneous/patchSummary/Make/options index b49a4d1ad0..0a0dc01ec5 100644 --- a/applications/utilities/miscellaneous/patchSummary/Make/options +++ b/applications/utilities/miscellaneous/patchSummary/Make/options @@ -1,9 +1,9 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/genericPatchFields/lnInclude \ + -I$(LIB_SRC)/generic/genericFields/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude EXE_LIBS = \ - -lgenericPatchFields \ + -lgenericFvFields \ -lfiniteVolume \ -lmeshTools diff --git a/applications/utilities/miscellaneous/patchSummary/patchSummaryTemplates.C b/applications/utilities/miscellaneous/patchSummary/patchSummaryTemplates.C index 9435026c8b..f58d89c34a 100644 --- a/applications/utilities/miscellaneous/patchSummary/patchSummaryTemplates.C +++ b/applications/utilities/miscellaneous/patchSummary/patchSummaryTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "patchSummaryTemplates.H" -#include "genericPatchField.H" +#include "genericFieldBase.H" #include "IOmanip.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -32,9 +32,9 @@ License template Foam::word Foam::patchFieldType(const PatchField& pf) { - if (isA(pf)) + if (isA(pf)) { - return refCast(pf).actualTypeName(); + return refCast(pf).actualTypeName(); } else { diff --git a/applications/utilities/parallelProcessing/decomposePar/Make/options b/applications/utilities/parallelProcessing/decomposePar/Make/options index c2ef088ccb..fa0ea41a8b 100644 --- a/applications/utilities/parallelProcessing/decomposePar/Make/options +++ b/applications/utilities/parallelProcessing/decomposePar/Make/options @@ -11,4 +11,4 @@ EXE_LIBS = \ -lparallel \ -ldecompositionMethods \ -llagrangian \ - -lgenericPatchFields + -lgenericFvFields diff --git a/applications/utilities/parallelProcessing/reconstructPar/Make/options b/applications/utilities/parallelProcessing/reconstructPar/Make/options index 69e39c6160..bcc48e7aa0 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/Make/options +++ b/applications/utilities/parallelProcessing/reconstructPar/Make/options @@ -9,4 +9,4 @@ EXE_LIBS = \ -lmeshTools \ -lparallel \ -llagrangian \ - -lgenericPatchFields + -lgenericFvFields diff --git a/applications/utilities/parallelProcessing/redistributePar/Make/options b/applications/utilities/parallelProcessing/redistributePar/Make/options index bc7b904e0f..bf469a6605 100644 --- a/applications/utilities/parallelProcessing/redistributePar/Make/options +++ b/applications/utilities/parallelProcessing/redistributePar/Make/options @@ -6,7 +6,7 @@ EXE_INC = \ EXE_LIBS = \ -lfiniteVolume \ - -lgenericPatchFields \ + -lgenericFvFields \ -ldecompositionMethods \ -L$(FOAM_LIBBIN)/dummy -lscotchDecomp -lptscotchDecomp \ -lmeshTools \ diff --git a/applications/utilities/postProcessing/dataConversion/foamDataToFluent/Make/options b/applications/utilities/postProcessing/dataConversion/foamDataToFluent/Make/options index 318e1be8f4..1e06d5c69b 100644 --- a/applications/utilities/postProcessing/dataConversion/foamDataToFluent/Make/options +++ b/applications/utilities/postProcessing/dataConversion/foamDataToFluent/Make/options @@ -3,6 +3,6 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude EXE_LIBS = \ - -lgenericPatchFields \ + -lgenericFvFields \ -lfiniteVolume \ -lmeshTools diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/options b/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/options index 0f80ffa1b4..5d1ca4db26 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/options +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/options @@ -8,5 +8,5 @@ EXE_INC = \ EXE_LIBS = \ -ldynamicMesh \ -lsampling \ - -lgenericPatchFields \ + -lgenericFvFields \ -llagrangian diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/Make/options b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/Make/options index 40a58886bf..289b1e87dc 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/Make/options +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/Make/options @@ -8,5 +8,5 @@ EXE_LIBS = \ -lfiniteVolume \ -llagrangian \ -lmeshTools \ - -lgenericPatchFields \ + -lgenericFvFields \ -lconversion diff --git a/applications/utilities/postProcessing/dataConversion/foamToGMV/Make/options b/applications/utilities/postProcessing/dataConversion/foamToGMV/Make/options index c97ea22b61..fa27271e92 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToGMV/Make/options +++ b/applications/utilities/postProcessing/dataConversion/foamToGMV/Make/options @@ -8,5 +8,5 @@ EXE_INC = \ EXE_LIBS = \ -lfiniteVolume \ -lmeshTools \ - -lgenericPatchFields \ + -lgenericFvFields \ -llagrangian diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/Make/options b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/Make/options index 50981e77e1..f271145caf 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/Make/options +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/Make/options @@ -5,9 +5,8 @@ EXE_INC = \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude - EXE_LIBS = \ -llagrangian \ -ldynamicMesh \ - -lgenericPatchFields \ + -lgenericFvFields \ -L$(FOAM_EXT_LIBBIN) -ltecio diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/Make/options b/applications/utilities/postProcessing/dataConversion/foamToVTK/Make/options index 478ceca394..1b938b7cfb 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/Make/options +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/Make/options @@ -10,5 +10,5 @@ EXE_LIBS = \ -lfoamToVTK \ -ldynamicMesh \ -llagrangian \ - -lgenericPatchFields \ + -lgenericFvFields \ -lfileFormats diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/Make/options b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/Make/options index bcbfd72de3..02401abffa 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/Make/options +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/Make/options @@ -8,5 +8,5 @@ EXE_INC = \ LIB_LIBS = \ -ldynamicMesh \ -llagrangian \ - -lgenericPatchFields \ + -lgenericFvFields \ -lfileFormats diff --git a/applications/utilities/postProcessing/dataConversion/smapToFoam/Make/options b/applications/utilities/postProcessing/dataConversion/smapToFoam/Make/options index 318e1be8f4..1e06d5c69b 100644 --- a/applications/utilities/postProcessing/dataConversion/smapToFoam/Make/options +++ b/applications/utilities/postProcessing/dataConversion/smapToFoam/Make/options @@ -3,6 +3,6 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude EXE_LIBS = \ - -lgenericPatchFields \ + -lgenericFvFields \ -lfiniteVolume \ -lmeshTools diff --git a/applications/utilities/postProcessing/foamPostProcess/Make/options b/applications/utilities/postProcessing/foamPostProcess/Make/options index 16eb624bec..9937cc1fc7 100644 --- a/applications/utilities/postProcessing/foamPostProcess/Make/options +++ b/applications/utilities/postProcessing/foamPostProcess/Make/options @@ -3,4 +3,4 @@ EXE_INC = \ EXE_LIBS = \ -lfiniteVolume \ - -lgenericPatchFields + -lgenericFvFields diff --git a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/Make/options b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/Make/options index b6cb5424ff..8a67cf154a 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/Make/options +++ b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/Make/options @@ -15,7 +15,7 @@ EXE_INC = \ LIB_LIBS = \ -ldynamicMesh \ - -lgenericPatchFields \ + -lgenericFvFields \ -llagrangian \ -L$(FOAM_LIBBIN) \ $(GLIBS) diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/Make/options b/applications/utilities/postProcessing/graphics/ensightFoamReader/Make/options index 3953bb0e6a..d3851b070e 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/Make/options +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/Make/options @@ -8,6 +8,6 @@ LIB_LIBS = \ -lOpenFOAM \ -lfiniteVolume \ -lmeshTools \ - -lgenericPatchFields \ + -lgenericFvFields \ -llagrangian \ $(PROJECT_LIBS) diff --git a/applications/utilities/postProcessing/lagrangian/particleTracks/Make/options b/applications/utilities/postProcessing/lagrangian/particleTracks/Make/options index 97b75b2ed1..878a6384fe 100644 --- a/applications/utilities/postProcessing/lagrangian/particleTracks/Make/options +++ b/applications/utilities/postProcessing/lagrangian/particleTracks/Make/options @@ -10,5 +10,5 @@ EXE_LIBS = \ -lmeshTools \ -lfileFormats \ -lsampling \ - -lgenericPatchFields \ + -lgenericFvFields \ -llagrangian diff --git a/applications/utilities/preProcessing/applyBoundaryLayer/Make/options b/applications/utilities/preProcessing/applyBoundaryLayer/Make/options index 7a8e38eb49..8d8594aba9 100644 --- a/applications/utilities/preProcessing/applyBoundaryLayer/Make/options +++ b/applications/utilities/preProcessing/applyBoundaryLayer/Make/options @@ -9,7 +9,7 @@ EXE_LIBS = \ -lmomentumTransportModels \ -lincompressibleMomentumTransportModels \ -lphysicalProperties \ - -lgenericPatchFields \ + -lgenericFvFields \ -lfiniteVolume \ -lmeshTools \ -lfvModels diff --git a/applications/utilities/preProcessing/engineSwirl/Make/options b/applications/utilities/preProcessing/engineSwirl/Make/options index 318e1be8f4..1e06d5c69b 100644 --- a/applications/utilities/preProcessing/engineSwirl/Make/options +++ b/applications/utilities/preProcessing/engineSwirl/Make/options @@ -3,6 +3,6 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude EXE_LIBS = \ - -lgenericPatchFields \ + -lgenericFvFields \ -lfiniteVolume \ -lmeshTools diff --git a/applications/utilities/preProcessing/mapFields/Make/options b/applications/utilities/preProcessing/mapFields/Make/options index 518b236496..0decdab865 100644 --- a/applications/utilities/preProcessing/mapFields/Make/options +++ b/applications/utilities/preProcessing/mapFields/Make/options @@ -9,4 +9,4 @@ EXE_LIBS = \ -lmeshTools \ -llagrangian \ -lfiniteVolume \ - -lgenericPatchFields + -lgenericFvFields diff --git a/applications/utilities/preProcessing/mapFieldsPar/Make/options b/applications/utilities/preProcessing/mapFieldsPar/Make/options index f597efdd05..457e7d2c23 100644 --- a/applications/utilities/preProcessing/mapFieldsPar/Make/options +++ b/applications/utilities/preProcessing/mapFieldsPar/Make/options @@ -7,4 +7,4 @@ EXE_LIBS = \ -lmeshTools \ -llagrangian \ -lfiniteVolume \ - -lgenericPatchFields + -lgenericFvFields diff --git a/applications/utilities/preProcessing/setFields/Make/options b/applications/utilities/preProcessing/setFields/Make/options index 06d42b6c3c..e8510dac85 100644 --- a/applications/utilities/preProcessing/setFields/Make/options +++ b/applications/utilities/preProcessing/setFields/Make/options @@ -4,5 +4,5 @@ EXE_INC = \ EXE_LIBS = \ -lfiniteVolume \ - -lgenericPatchFields \ + -lgenericFvFields \ -lmeshTools diff --git a/src/Allwmake b/src/Allwmake index ef84db2f16..a750bdc7c8 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -29,7 +29,6 @@ wmake $targetType OpenFOAM wmake $targetType fileFormats wmake $targetType surfMesh wmake $targetType triSurface -wmake $targetType genericPatches wmake $targetType meshTools # Decomposition methods needed by dummyThirdParty @@ -38,7 +37,8 @@ dummyThirdParty/Allwmake $targetType $* wmake $targetType finiteVolume wmake $targetType lagrangian/basic -wmake $targetType genericPatchFields + +generic/Allwmake $targetType $* wmake $targetType mesh/extrudeModel wmake $targetType dynamicMesh diff --git a/src/generic/Allwmake b/src/generic/Allwmake new file mode 100755 index 0000000000..dec39e024d --- /dev/null +++ b/src/generic/Allwmake @@ -0,0 +1,12 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Parse arguments for library compilation +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments + +wmake $targetType genericPatches +wmake $targetType genericFields +wmake $targetType genericFvPatches +wmake $targetType genericFvFields + +#------------------------------------------------------------------------------ diff --git a/src/generic/genericFields/Make/files b/src/generic/genericFields/Make/files new file mode 100644 index 0000000000..298c9d5aff --- /dev/null +++ b/src/generic/genericFields/Make/files @@ -0,0 +1,4 @@ +genericFieldBase/genericFieldBase.C +genericPointPatchField/genericPointPatchFields.C + +LIB = $(FOAM_LIBBIN)/libgenericFields diff --git a/src/generic/genericFields/Make/options b/src/generic/genericFields/Make/options new file mode 100644 index 0000000000..8b7581beb0 --- /dev/null +++ b/src/generic/genericFields/Make/options @@ -0,0 +1,5 @@ +EXE_INC = \ + -I$(LIB_SRC)/generic/genericPatches/lnInclude + +LIB_LIBS = \ + -lgenericPatches diff --git a/src/genericPatchFields/genericPatchField/genericPatchField.C b/src/generic/genericFields/genericFieldBase/genericFieldBase.C similarity index 67% rename from src/genericPatchFields/genericPatchField/genericPatchField.C rename to src/generic/genericFields/genericFieldBase/genericFieldBase.C index 6a87b52585..413f3fc06d 100644 --- a/src/genericPatchFields/genericPatchField/genericPatchField.C +++ b/src/generic/genericFields/genericFieldBase/genericFieldBase.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2019-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,13 +23,32 @@ License \*---------------------------------------------------------------------------*/ -#include "genericPatchField.H" +#include "genericFieldBase.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - defineTypeNameAndDebug(genericPatchField, 0); + defineTypeNameAndDebug(genericFieldBase, 0); } + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::genericFieldBase::genericFieldBase() +{} + + +Foam::genericFieldBase::genericFieldBase(const word& actualTypeName) +: + actualTypeName_(actualTypeName) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::genericFieldBase::~genericFieldBase() +{} + + // ************************************************************************* // diff --git a/src/genericPatchFields/genericPatchField/genericPatchField.H b/src/generic/genericFields/genericFieldBase/genericFieldBase.H similarity index 76% rename from src/genericPatchFields/genericPatchField/genericPatchField.H rename to src/generic/genericFields/genericFieldBase/genericFieldBase.H index 110ad09d38..46bdcce30d 100644 --- a/src/genericPatchFields/genericPatchField/genericPatchField.H +++ b/src/generic/genericFields/genericFieldBase/genericFieldBase.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2019-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,17 +22,19 @@ License along with OpenFOAM. If not, see . Class - Foam::genericPatchField + Foam::genericFieldBase Description + Base class for generic field types. Facilitates down-casting so that the + actual type can be queried. SourceFiles - genericPatchField.C + genericFieldBase.C \*---------------------------------------------------------------------------*/ -#ifndef genericPatchField_H -#define genericPatchField_H +#ifndef genericFieldBase_H +#define genericFieldBase_H #include "typeInfo.H" @@ -42,15 +44,17 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class genericFvPatch Declaration + Class genericFieldBase Declaration \*---------------------------------------------------------------------------*/ -class genericPatchField +class genericFieldBase { // Private Data + //- Actual field type name word actualTypeName_; + public: //- Runtime type information @@ -59,24 +63,21 @@ public: // Constructors - genericPatchField() - {} + //- Construct null + genericFieldBase(); - genericPatchField(const word& atn) - : - actualTypeName_(atn) - {} + //- Construct from actual type name + genericFieldBase(const word& actualTypeName); //- Destructor - virtual ~genericPatchField() - {} + virtual ~genericFieldBase(); // Member Functions //- Return the actual type name - word actualTypeName() const + inline const word& actualTypeName() const { return actualTypeName_; } diff --git a/src/generic/genericFields/genericPointPatchField/genericPointPatchField.C b/src/generic/genericFields/genericPointPatchField/genericPointPatchField.C new file mode 100644 index 0000000000..283b5480cc --- /dev/null +++ b/src/generic/genericFields/genericPointPatchField/genericPointPatchField.C @@ -0,0 +1,275 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "genericPointPatchField.H" +#include "pointPatchFieldMapper.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::genericPointPatchField::genericPointPatchField +( + const pointPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + genericFieldBase(dict.lookup("type")), + calculatedPointPatchField(p, iF, dict), + dict_(dict) +{ + forAllConstIter(dictionary, dict_, iter) + { + if (iter().keyword() != "type") + { + if + ( + iter().isStream() + && iter().stream().size() + ) + { + ITstream& is = iter().stream(); + + // Read first token + token firstToken(is); + + if + ( + firstToken.isWord() + && firstToken.wordToken() == "nonuniform" + ) + { + token fieldToken(is); + + if (!fieldToken.isCompound()) + { + if + ( + fieldToken.isLabel() + && fieldToken.labelToken() == 0 + ) + { + scalarFields_.insert + ( + iter().keyword(), + new scalarField(0) + ); + } + else + { + FatalIOErrorInFunction(dict) + << "\n token following 'nonuniform' " + "is not a compound" + << "\n on patch " << this->patch().name() + << " of field " + << this->internalField().name() + << " in file " + << this->internalField().objectPath() + << exit(FatalIOError); + } + } + + #define ReadTypeField(Type, nullArg) \ + else if \ + ( \ + fieldToken.compoundToken().type() \ + == token::Compound>::typeName \ + ) \ + { \ + Field* fPtr = new Field; \ + fPtr->transfer \ + ( \ + dynamicCast>> \ + ( \ + fieldToken.transferCompoundToken(is) \ + ) \ + ); \ + \ + if (fPtr->size() != this->size()) \ + { \ + FatalIOErrorInFunction(dict) \ + << "\n size of field " \ + << iter().keyword() \ + << " (" << fPtr->size() << ')' \ + << " is not the same size as the patch (" \ + << this->size() << ')' \ + << "\n on patch " \ + << this->patch().name() \ + << " of field " \ + << this->internalField().name() \ + << " in file " \ + << this->internalField().objectPath() \ + << exit(FatalIOError); \ + } \ + \ + Type##Fields_.insert(iter().keyword(), fPtr); \ + } + FOR_ALL_FIELD_TYPES(ReadTypeField) + #undef ReadTypeField + } + } + } + } +} + + +template +Foam::genericPointPatchField::genericPointPatchField +( + const genericPointPatchField& ptf, + const pointPatch& p, + const DimensionedField& iF, + const pointPatchFieldMapper& mapper +) +: + genericFieldBase(ptf), + calculatedPointPatchField(ptf, p, iF, mapper), + dict_(ptf.dict_) +{ + #define MapTypeFields(Type, nullArg) \ + forAllConstIter(HashPtrTable>, ptf.Type##Fields_, iter) \ + { \ + Type##Fields_.insert \ + ( \ + iter.key(), \ + mapper(*iter()).ptr() \ + ); \ + } + FOR_ALL_FIELD_TYPES(MapTypeFields); + #undef MapTypeFields +} + + +template +Foam::genericPointPatchField::genericPointPatchField +( + const genericPointPatchField& ptf, + const DimensionedField& iF +) +: + genericFieldBase(ptf), + calculatedPointPatchField(ptf, iF), + dict_(ptf.dict_), + scalarFields_(ptf.scalarFields_), + vectorFields_(ptf.vectorFields_), + sphericalTensorFields_(ptf.sphericalTensorFields_), + symmTensorFields_(ptf.symmTensorFields_), + tensorFields_(ptf.tensorFields_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::genericPointPatchField::map +( + const pointPatchField& ptf, + const pointPatchFieldMapper& mapper +) +{ + const genericPointPatchField& dptf = + refCast>(ptf); + + #define MapTypeFields(Type, nullArg) \ + forAllIter(HashPtrTable>, Type##Fields_, iter) \ + { \ + HashPtrTable>::const_iterator dptfIter = \ + dptf.Type##Fields_.find(iter.key()); \ + \ + if (dptfIter != dptf.Type##Fields_.end()) \ + { \ + mapper(*iter(), *dptfIter()); \ + } \ + } + FOR_ALL_FIELD_TYPES(MapTypeFields); + #undef MapTypeFields +} + + +template +void Foam::genericPointPatchField::reset +( + const pointPatchField& ptf +) +{ + const genericPointPatchField& dptf = + refCast>(ptf); + + #define ResetTypeFields(Type, nullArg) \ + forAllIter(HashPtrTable>, Type##Fields_, iter) \ + { \ + HashPtrTable>::const_iterator dptfIter = \ + dptf.Type##Fields_.find(iter.key()); \ + \ + if (dptfIter != dptf.Type##Fields_.end()) \ + { \ + iter()->reset(*dptfIter()); \ + } \ + } + FOR_ALL_FIELD_TYPES(ResetTypeFields); + #undef ResetTypeFields +} + + +template +void Foam::genericPointPatchField::write(Ostream& os) const +{ + writeEntry(os, "type", actualTypeName()); + + forAllConstIter(dictionary, dict_, iter) + { + if (iter().keyword() != "type") + { + if + ( + iter().isStream() + && iter().stream().size() + && iter().stream()[0].isWord() + && iter().stream()[0].wordToken() == "nonuniform" + ) + { + #define WriteTypeFieldEntry(Type, nullArg) \ + else if (Type##Fields_.found(iter().keyword())) \ + { \ + writeEntry \ + ( \ + os, \ + iter().keyword(), \ + *Type##Fields_.find(iter().keyword())() \ + ); \ + } + if (false) {} FOR_ALL_FIELD_TYPES(WriteTypeFieldEntry) + #undef WriteTypeFieldEntry + } + else + { + iter().write(os); + } + } + } +} + + +// ************************************************************************* // diff --git a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.H b/src/generic/genericFields/genericPointPatchField/genericPointPatchField.H similarity index 87% rename from src/genericPatchFields/genericPointPatchField/genericPointPatchField.H rename to src/generic/genericFields/genericPointPatchField/genericPointPatchField.H index e70d85380c..c9a3beb900 100644 --- a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.H +++ b/src/generic/genericFields/genericPointPatchField/genericPointPatchField.H @@ -25,8 +25,13 @@ Class Foam::genericPointPatchField Description - A generic version of calculatedPointPatchField, useful as a fallback for - handling unknown patch types. + This boundary condition provides a generic version of the \c calculated + condition, useful as a fallback for handling unknown patch types when + post-processing or running mesh manipulation utilities. Not generally + applicable as a user-specified condition. + +See also + Foam::calculatedPointPatchField SourceFiles genericPointPatchField.C @@ -36,7 +41,7 @@ SourceFiles #ifndef genericPointPatchField_H #define genericPointPatchField_H -#include "genericPatchField.H" +#include "genericFieldBase.H" #include "calculatedPointPatchField.H" #include "HashPtrTable.H" @@ -52,18 +57,19 @@ namespace Foam template class genericPointPatchField : - public genericPatchField, + public genericFieldBase, public calculatedPointPatchField { // Private Data + //- Patch field dictionary dictionary dict_; - HashPtrTable scalarFields_; - HashPtrTable vectorFields_; - HashPtrTable sphericalTensorFields_; - HashPtrTable symmTensorFields_; - HashPtrTable tensorFields_; + //- Fields + #define DeclareTypeFields(Type, nullArg) \ + HashPtrTable> Type##Fields_; + FOR_ALL_FIELD_TYPES(DeclareTypeFields); + #undef DeclareTypeFields public: diff --git a/src/genericPatchFields/genericPointPatchField/genericPointPatchFields.C b/src/generic/genericFields/genericPointPatchField/genericPointPatchFields.C similarity index 96% rename from src/genericPatchFields/genericPointPatchField/genericPointPatchFields.C rename to src/generic/genericFields/genericPointPatchField/genericPointPatchFields.C index 018c1dc6aa..07bcc5274b 100644 --- a/src/genericPatchFields/genericPointPatchField/genericPointPatchFields.C +++ b/src/generic/genericFields/genericPointPatchField/genericPointPatchFields.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/genericPatchFields/genericPointPatchField/genericPointPatchFields.H b/src/generic/genericFields/genericPointPatchField/genericPointPatchFields.H similarity index 96% rename from src/genericPatchFields/genericPointPatchField/genericPointPatchFields.H rename to src/generic/genericFields/genericPointPatchField/genericPointPatchFields.H index 24d1e72a76..29b77465e1 100644 --- a/src/genericPatchFields/genericPointPatchField/genericPointPatchFields.H +++ b/src/generic/genericFields/genericPointPatchField/genericPointPatchFields.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/generic/genericFvFields/Make/files b/src/generic/genericFvFields/Make/files new file mode 100644 index 0000000000..46652880bc --- /dev/null +++ b/src/generic/genericFvFields/Make/files @@ -0,0 +1,3 @@ +genericFvPatchField/genericFvPatchFields.C + +LIB = $(FOAM_LIBBIN)/libgenericFvFields diff --git a/src/generic/genericFvFields/Make/options b/src/generic/genericFvFields/Make/options new file mode 100644 index 0000000000..3f10c1a371 --- /dev/null +++ b/src/generic/genericFvFields/Make/options @@ -0,0 +1,11 @@ +EXE_INC = \ + -I$(LIB_SRC)/generic/genericPatches/lnInclude \ + -I$(LIB_SRC)/generic/genericFields/lnInclude \ + -I$(LIB_SRC)/generic/genericFvPatches/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude + +LIB_LIBS = \ + -lgenericPatches \ + -lgenericFields \ + -lgenericFvPatches \ + -lfiniteVolume diff --git a/src/generic/genericFvFields/genericFvPatchField/genericFvPatchField.C b/src/generic/genericFvFields/genericFvPatchField/genericFvPatchField.C new file mode 100644 index 0000000000..a589e43ed4 --- /dev/null +++ b/src/generic/genericFvFields/genericFvPatchField/genericFvPatchField.C @@ -0,0 +1,481 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "genericFvPatchField.H" +#include "fvPatchFieldMapper.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +template +bool insertUniformTypeField +( + const scalarList& components, + const word& keyword, + const label size, + HashPtrTable>& typeFields +) +{ + if (components.size() != Type::nComponents) + { + return false; + } + + Type t; + forAll(t, i) + { + t[i] = components[i]; + } + + typeFields.insert(keyword, new Field(size, t)); + + return true; +} + + +template<> +bool insertUniformTypeField +( + const scalarList& components, + const word& keyword, + const label size, + HashPtrTable>& typeFields +) +{ + return false; +} + +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::genericFvPatchField::genericFvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + genericFieldBase(dict.lookup("type")), + calculatedFvPatchField(p, iF, dict), + dict_(dict) +{ + if (!dict.found("value")) + { + FatalIOErrorInFunction(dict) + << "\n Cannot find 'value' entry" + << " on patch " << this->patch().name() + << " of field " << this->internalField().name() + << " in file " << this->internalField().objectPath() + << nl + << " which is required to set the" + " values of the generic patch field." << nl + << " (Actual type " << actualTypeName() << ")" << nl + << "\n Please add the 'value' entry to the write function " + "of the user-defined boundary-condition\n" + << exit(FatalIOError); + } + + forAllConstIter(dictionary, dict_, iter) + { + if (iter().keyword() != "type" && iter().keyword() != "value") + { + if + ( + iter().isStream() + && iter().stream().size() + ) + { + ITstream& is = iter().stream(); + + // Read first token + token firstToken(is); + + if + ( + firstToken.isWord() + && firstToken.wordToken() == "nonuniform" + ) + { + token fieldToken(is); + + if (!fieldToken.isCompound()) + { + if + ( + fieldToken.isLabel() + && fieldToken.labelToken() == 0 + ) + { + scalarFields_.insert + ( + iter().keyword(), + new scalarField(0) + ); + } + else + { + FatalIOErrorInFunction(dict) + << "\n token following 'nonuniform' " + "is not a compound" + << "\n on patch " << this->patch().name() + << " of field " + << this->internalField().name() + << " in file " + << this->internalField().objectPath() + << exit(FatalIOError); + } + } + + #define ReadTypeField(Type, nullArg) \ + else if \ + ( \ + fieldToken.compoundToken().type() \ + == token::Compound>::typeName \ + ) \ + { \ + Field* fPtr = new Field; \ + fPtr->transfer \ + ( \ + dynamicCast>> \ + ( \ + fieldToken.transferCompoundToken(is) \ + ) \ + ); \ + \ + if (fPtr->size() != this->size()) \ + { \ + FatalIOErrorInFunction(dict) \ + << "\n size of field " \ + << iter().keyword() \ + << " (" << fPtr->size() << ')' \ + << " is not the same size as the patch (" \ + << this->size() << ')' \ + << "\n on patch " \ + << this->patch().name() \ + << " of field " \ + << this->internalField().name() \ + << " in file " \ + << this->internalField().objectPath() \ + << exit(FatalIOError); \ + } \ + \ + Type##Fields_.insert(iter().keyword(), fPtr); \ + } + FOR_ALL_FIELD_TYPES(ReadTypeField) + #undef ReadTypeField + + else + { + FatalIOErrorInFunction(dict) + << "\n compound " << fieldToken.compoundToken() + << " not supported" + << "\n on patch " << this->patch().name() + << " of field " + << this->internalField().name() + << " in file " + << this->internalField().objectPath() + << exit(FatalIOError); + } + } + else if + ( + firstToken.isWord() + && firstToken.wordToken() == "uniform" + ) + { + token fieldToken(is); + + if (!fieldToken.isPunctuation()) + { + scalarFields_.insert + ( + iter().keyword(), + new scalarField + ( + this->size(), + fieldToken.number() + ) + ); + } + else + { + // Read as a scalarList + is.putBack(fieldToken); + scalarList l(is); + + #define InsertUniformTypeField(Type, nullArg) \ + || insertUniformTypeField \ + ( \ + l, \ + iter().keyword(), \ + this->size(), \ + Type##Fields_ \ + ) + if (!(0 FOR_ALL_FIELD_TYPES(InsertUniformTypeField))) + { + FatalIOErrorInFunction(dict) + << "\n unrecognised native type " << l + << "\n on patch " << this->patch().name() + << " of field " + << this->internalField().name() + << " in file " + << this->internalField().objectPath() + << exit(FatalIOError); + } + #undef InsertUniformTypeField + } + } + } + } + } +} + + +template +Foam::genericFvPatchField::genericFvPatchField +( + const genericFvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + genericFieldBase(ptf), + calculatedFvPatchField(ptf, p, iF, mapper), + dict_(ptf.dict_) +{ + #define MapTypeFields(Type, nullArg) \ + forAllConstIter(HashPtrTable>, ptf.Type##Fields_, iter) \ + { \ + Type##Fields_.insert \ + ( \ + iter.key(), \ + mapper(*iter()).ptr() \ + ); \ + } + FOR_ALL_FIELD_TYPES(MapTypeFields); + #undef MapTypeFields +} + + +template +Foam::genericFvPatchField::genericFvPatchField +( + const genericFvPatchField& ptf, + const DimensionedField& iF +) +: + genericFieldBase(ptf), + calculatedFvPatchField(ptf, iF), + dict_(ptf.dict_), + scalarFields_(ptf.scalarFields_), + vectorFields_(ptf.vectorFields_), + sphericalTensorFields_(ptf.sphericalTensorFields_), + symmTensorFields_(ptf.symmTensorFields_), + tensorFields_(ptf.tensorFields_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::genericFvPatchField::map +( + const fvPatchField& ptf, + const fvPatchFieldMapper& mapper +) +{ + calculatedFvPatchField::map(ptf, mapper); + + const genericFvPatchField& dptf = + refCast>(ptf); + + #define MapTypeFields(Type, nullArg) \ + forAllIter(HashPtrTable>, Type##Fields_, iter) \ + { \ + HashPtrTable>::const_iterator dptfIter = \ + dptf.Type##Fields_.find(iter.key()); \ + \ + if (dptfIter != dptf.Type##Fields_.end()) \ + { \ + mapper(*iter(), *dptfIter()); \ + } \ + } + FOR_ALL_FIELD_TYPES(MapTypeFields); + #undef MapTypeFields +} + + +template +void Foam::genericFvPatchField::reset +( + const fvPatchField& ptf +) +{ + calculatedFvPatchField::reset(ptf); + + const genericFvPatchField& dptf = + refCast>(ptf); + + #define ResetTypeFields(Type, nullArg) \ + forAllIter(HashPtrTable>, Type##Fields_, iter) \ + { \ + HashPtrTable>::const_iterator dptfIter = \ + dptf.Type##Fields_.find(iter.key()); \ + \ + if (dptfIter != dptf.Type##Fields_.end()) \ + { \ + iter()->reset(*dptfIter()); \ + } \ + } + FOR_ALL_FIELD_TYPES(ResetTypeFields); + #undef ResetTypeFields +} + + +template +Foam::tmp> +Foam::genericFvPatchField::valueInternalCoeffs +( + const tmp& +) const +{ + FatalErrorInFunction + << "cannot be called for a genericFvPatchField" + " (actual type " << actualTypeName() << ")" + << "\n on patch " << this->patch().name() + << " of field " << this->internalField().name() + << " in file " << this->internalField().objectPath() + << "\n You are probably trying to solve for a field with a " + "generic boundary condition." + << abort(FatalError); + + return *this; +} + + +template +Foam::tmp> +Foam::genericFvPatchField::valueBoundaryCoeffs +( + const tmp& +) const +{ + FatalErrorInFunction + << "cannot be called for a genericFvPatchField" + " (actual type " << actualTypeName() << ")" + << "\n on patch " << this->patch().name() + << " of field " << this->internalField().name() + << " in file " << this->internalField().objectPath() + << "\n You are probably trying to solve for a field with a " + "generic boundary condition." + << abort(FatalError); + + return *this; +} + + +template +Foam::tmp> +Foam::genericFvPatchField::gradientInternalCoeffs() const +{ + FatalErrorInFunction + << "cannot be called for a genericFvPatchField" + " (actual type " << actualTypeName() << ")" + << "\n on patch " << this->patch().name() + << " of field " << this->internalField().name() + << " in file " << this->internalField().objectPath() + << "\n You are probably trying to solve for a field with a " + "generic boundary condition." + << abort(FatalError); + + return *this; +} + +template +Foam::tmp> +Foam::genericFvPatchField::gradientBoundaryCoeffs() const +{ + FatalErrorInFunction + << "cannot be called for a genericFvPatchField" + " (actual type " << actualTypeName() << ")" + << "\n on patch " << this->patch().name() + << " of field " << this->internalField().name() + << " in file " << this->internalField().objectPath() + << "\n You are probably trying to solve for a field with a " + "generic boundary condition." + << abort(FatalError); + + return *this; +} + + +template +void Foam::genericFvPatchField::write(Ostream& os) const +{ + writeEntry(os, "type", actualTypeName()); + + forAllConstIter(dictionary, dict_, iter) + { + if (iter().keyword() != "type" && iter().keyword() != "value") + { + if + ( + iter().isStream() + && iter().stream().size() + && iter().stream()[0].isWord() + && iter().stream()[0].wordToken() == "nonuniform" + ) + { + #define WriteTypeFieldEntry(Type, nullArg) \ + else if (Type##Fields_.found(iter().keyword())) \ + { \ + writeEntry \ + ( \ + os, \ + iter().keyword(), \ + *Type##Fields_.find(iter().keyword())() \ + ); \ + } + if (false) {} FOR_ALL_FIELD_TYPES(WriteTypeFieldEntry) + #undef WriteTypeFieldEntry + } + else + { + iter().write(os); + } + } + } + + writeEntry(os, "value", *this); +} + + +// ************************************************************************* // diff --git a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.H b/src/generic/genericFvFields/genericFvPatchField/genericFvPatchField.H similarity index 92% rename from src/genericPatchFields/genericFvPatchField/genericFvPatchField.H rename to src/generic/genericFvFields/genericFvPatchField/genericFvPatchField.H index 5cee3113a7..a60442ac09 100644 --- a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.H +++ b/src/generic/genericFvFields/genericFvPatchField/genericFvPatchField.H @@ -26,8 +26,9 @@ Class Description This boundary condition provides a generic version of the \c calculated - condition, useful as a fallback for handling unknown patch types. Not - generally applicable as a user-specified condition. + condition, useful as a fallback for handling unknown patch types when + post-processing or running mesh manipulation utilities. Not generally + applicable as a user-specified condition. See also Foam::calculatedFvPatchField @@ -40,7 +41,7 @@ SourceFiles #ifndef genericFvPatchField_H #define genericFvPatchField_H -#include "genericPatchField.H" +#include "genericFieldBase.H" #include "calculatedFvPatchField.H" #include "HashPtrTable.H" @@ -56,18 +57,19 @@ namespace Foam template class genericFvPatchField : - public genericPatchField, + public genericFieldBase, public calculatedFvPatchField { // Private Data + //- Patch field dictionary dictionary dict_; - HashPtrTable scalarFields_; - HashPtrTable vectorFields_; - HashPtrTable sphericalTensorFields_; - HashPtrTable symmTensorFields_; - HashPtrTable tensorFields_; + //- Fields + #define DeclareTypeFields(Type, nullArg) \ + HashPtrTable> Type##Fields_; + FOR_ALL_FIELD_TYPES(DeclareTypeFields); + #undef DeclareTypeFields public: diff --git a/src/genericPatchFields/genericFvPatchField/genericFvPatchFields.C b/src/generic/genericFvFields/genericFvPatchField/genericFvPatchFields.C similarity index 100% rename from src/genericPatchFields/genericFvPatchField/genericFvPatchFields.C rename to src/generic/genericFvFields/genericFvPatchField/genericFvPatchFields.C diff --git a/src/genericPatchFields/genericFvPatchField/genericFvPatchFields.H b/src/generic/genericFvFields/genericFvPatchField/genericFvPatchFields.H similarity index 96% rename from src/genericPatchFields/genericFvPatchField/genericFvPatchFields.H rename to src/generic/genericFvFields/genericFvPatchField/genericFvPatchFields.H index a5ce517d92..f6e2a79912 100644 --- a/src/genericPatchFields/genericFvPatchField/genericFvPatchFields.H +++ b/src/generic/genericFvFields/genericFvPatchField/genericFvPatchFields.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/generic/genericFvPatches/Make/files b/src/generic/genericFvPatches/Make/files new file mode 100644 index 0000000000..c4a9a81c9b --- /dev/null +++ b/src/generic/genericFvPatches/Make/files @@ -0,0 +1,3 @@ +genericFvPatch/genericFvPatch.C + +LIB = $(FOAM_LIBBIN)/libgenericFvPatches diff --git a/src/genericPatchFields/Make/options b/src/generic/genericFvPatches/Make/options similarity index 67% rename from src/genericPatchFields/Make/options rename to src/generic/genericFvPatches/Make/options index 25d19f3c94..95c5af45f1 100644 --- a/src/genericPatchFields/Make/options +++ b/src/generic/genericFvPatches/Make/options @@ -1,5 +1,5 @@ EXE_INC = \ - -I$(LIB_SRC)/genericPatches/lnInclude \ + -I$(LIB_SRC)/generic/genericPatches/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude LIB_LIBS = \ diff --git a/src/genericPatchFields/genericFvPatch/genericFvPatch.C b/src/generic/genericFvPatches/genericFvPatch/genericFvPatch.C similarity index 100% rename from src/genericPatchFields/genericFvPatch/genericFvPatch.C rename to src/generic/genericFvPatches/genericFvPatch/genericFvPatch.C diff --git a/src/genericPatchFields/genericFvPatch/genericFvPatch.H b/src/generic/genericFvPatches/genericFvPatch/genericFvPatch.H similarity index 95% rename from src/genericPatchFields/genericFvPatch/genericFvPatch.H rename to src/generic/genericFvPatches/genericFvPatch/genericFvPatch.H index 387aa1e8bb..5867d8a846 100644 --- a/src/genericPatchFields/genericFvPatch/genericFvPatch.H +++ b/src/generic/genericFvPatches/genericFvPatch/genericFvPatch.H @@ -25,7 +25,8 @@ Class Foam::genericFvPatch Description - FV variant of the genericPolyPatch. + Substitute for unknown patches. Used for post-processing when only + basic fvPatch info is needed. SourceFiles genericFvPatch.C diff --git a/src/genericPatches/Make/files b/src/generic/genericPatches/Make/files similarity index 100% rename from src/genericPatches/Make/files rename to src/generic/genericPatches/Make/files diff --git a/src/genericPatches/Make/options b/src/generic/genericPatches/Make/options similarity index 100% rename from src/genericPatches/Make/options rename to src/generic/genericPatches/Make/options diff --git a/src/genericPatches/genericPointPatch/genericPointPatch.C b/src/generic/genericPatches/genericPointPatch/genericPointPatch.C similarity index 100% rename from src/genericPatches/genericPointPatch/genericPointPatch.C rename to src/generic/genericPatches/genericPointPatch/genericPointPatch.C diff --git a/src/genericPatches/genericPointPatch/genericPointPatch.H b/src/generic/genericPatches/genericPointPatch/genericPointPatch.H similarity index 95% rename from src/genericPatches/genericPointPatch/genericPointPatch.H rename to src/generic/genericPatches/genericPointPatch/genericPointPatch.H index 20a077505d..f85e67307c 100644 --- a/src/genericPatches/genericPointPatch/genericPointPatch.H +++ b/src/generic/genericPatches/genericPointPatch/genericPointPatch.H @@ -25,8 +25,8 @@ Class Foam::genericPointPatch Description - Substitute for unknown patches. Used for postprocessing when only - basic polyPatch info is needed. + Substitute for unknown patches. Used for post-processing when only + basic pointPatch info is needed. SourceFiles genericPointPatch.C diff --git a/src/genericPatches/genericPolyPatch/genericPolyPatch.C b/src/generic/genericPatches/genericPolyPatch/genericPolyPatch.C similarity index 96% rename from src/genericPatches/genericPolyPatch/genericPolyPatch.C rename to src/generic/genericPatches/genericPolyPatch/genericPolyPatch.C index 1709af1304..b78b9c89eb 100644 --- a/src/genericPatches/genericPolyPatch/genericPolyPatch.C +++ b/src/generic/genericPatches/genericPolyPatch/genericPolyPatch.C @@ -26,7 +26,7 @@ License #include "genericPolyPatch.H" #include "addToRunTimeSelectionTable.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { @@ -37,7 +37,7 @@ namespace Foam } -// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::genericPolyPatch::genericPolyPatch ( diff --git a/src/genericPatches/genericPolyPatch/genericPolyPatch.H b/src/generic/genericPatches/genericPolyPatch/genericPolyPatch.H similarity index 94% rename from src/genericPatches/genericPolyPatch/genericPolyPatch.H rename to src/generic/genericPatches/genericPolyPatch/genericPolyPatch.H index b8b0fc0bb8..816f1871bf 100644 --- a/src/genericPatches/genericPolyPatch/genericPolyPatch.H +++ b/src/generic/genericPatches/genericPolyPatch/genericPolyPatch.H @@ -25,13 +25,9 @@ Class Foam::genericPolyPatch Description - Substitute for unknown patches. Used for postprocessing when only + Substitute for unknown patches. Used for post-processing when only basic polyPatch info is needed. - Note: - Storage is not optimal. It stores all face centres and cells on all - processors to keep the addressing calculation simple. - SourceFiles genericPolyPatch.C @@ -57,9 +53,13 @@ class genericPolyPatch { // Private Data + //- Actual patch type name word actualTypeName_; + + //- Patch dictionary dictionary dict_; + public: //- Runtime type information diff --git a/src/genericPatchFields/Make/files b/src/genericPatchFields/Make/files deleted file mode 100644 index 24bc8bb36e..0000000000 --- a/src/genericPatchFields/Make/files +++ /dev/null @@ -1,6 +0,0 @@ -genericFvPatch/genericFvPatch.C -genericPatchField/genericPatchField.C -genericFvPatchField/genericFvPatchFields.C -genericPointPatchField/genericPointPatchFields.C - -LIB = $(FOAM_LIBBIN)/libgenericPatchFields diff --git a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C b/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C deleted file mode 100644 index 587224dc7f..0000000000 --- a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C +++ /dev/null @@ -1,840 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "genericFvPatchField.H" -#include "fvPatchFieldMapper.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template -Foam::genericFvPatchField::genericFvPatchField -( - const fvPatch& p, - const DimensionedField& iF, - const dictionary& dict -) -: - genericPatchField(dict.lookup("type")), - calculatedFvPatchField(p, iF, dict), - dict_(dict) -{ - if (!dict.found("value")) - { - FatalIOErrorInFunction - ( - dict - ) << "\n Cannot find 'value' entry" - << " on patch " << this->patch().name() - << " of field " << this->internalField().name() - << " in file " << this->internalField().objectPath() - << nl - << " which is required to set the" - " values of the generic patch field." << nl - << " (Actual type " << actualTypeName() << ")" << nl - << "\n Please add the 'value' entry to the write function " - "of the user-defined boundary-condition\n" - << exit(FatalIOError); - } - - forAllConstIter(dictionary, dict_, iter) - { - if (iter().keyword() != "type" && iter().keyword() != "value") - { - if - ( - iter().isStream() - && iter().stream().size() - ) - { - ITstream& is = iter().stream(); - - // Read first token - token firstToken(is); - - if - ( - firstToken.isWord() - && firstToken.wordToken() == "nonuniform" - ) - { - token fieldToken(is); - - if (!fieldToken.isCompound()) - { - if - ( - fieldToken.isLabel() - && fieldToken.labelToken() == 0 - ) - { - scalarFields_.insert - ( - iter().keyword(), - new scalarField(0) - ); - } - else - { - FatalIOErrorInFunction - ( - dict - ) << "\n token following 'nonuniform' " - "is not a compound" - << "\n on patch " << this->patch().name() - << " of field " - << this->internalField().name() - << " in file " - << this->internalField().objectPath() - << exit(FatalIOError); - } - } - else if - ( - fieldToken.compoundToken().type() - == token::Compound>::typeName - ) - { - scalarField* fPtr = new scalarField; - fPtr->transfer - ( - dynamicCast>> - ( - fieldToken.transferCompoundToken(is) - ) - ); - - if (fPtr->size() != this->size()) - { - FatalIOErrorInFunction - ( - dict - ) << "\n size of field " << iter().keyword() - << " (" << fPtr->size() << ')' - << " is not the same size as the patch (" - << this->size() << ')' - << "\n on patch " << this->patch().name() - << " of field " - << this->internalField().name() - << " in file " - << this->internalField().objectPath() - << exit(FatalIOError); - } - - scalarFields_.insert(iter().keyword(), fPtr); - } - else if - ( - fieldToken.compoundToken().type() - == token::Compound>::typeName - ) - { - vectorField* fPtr = new vectorField; - fPtr->transfer - ( - dynamicCast>> - ( - fieldToken.transferCompoundToken(is) - ) - ); - - if (fPtr->size() != this->size()) - { - FatalIOErrorInFunction - ( - dict - ) << "\n size of field " << iter().keyword() - << " (" << fPtr->size() << ')' - << " is not the same size as the patch (" - << this->size() << ')' - << "\n on patch " << this->patch().name() - << " of field " - << this->internalField().name() - << " in file " - << this->internalField().objectPath() - << exit(FatalIOError); - } - - vectorFields_.insert(iter().keyword(), fPtr); - } - else if - ( - fieldToken.compoundToken().type() - == token::Compound>::typeName - ) - { - sphericalTensorField* fPtr = new sphericalTensorField; - fPtr->transfer - ( - dynamicCast - < - token::Compound> - > - ( - fieldToken.transferCompoundToken(is) - ) - ); - - if (fPtr->size() != this->size()) - { - FatalIOErrorInFunction - ( - dict - ) << "\n size of field " << iter().keyword() - << " (" << fPtr->size() << ')' - << " is not the same size as the patch (" - << this->size() << ')' - << "\n on patch " << this->patch().name() - << " of field " - << this->internalField().name() - << " in file " - << this->internalField().objectPath() - << exit(FatalIOError); - } - - sphericalTensorFields_.insert(iter().keyword(), fPtr); - } - else if - ( - fieldToken.compoundToken().type() - == token::Compound>::typeName - ) - { - symmTensorField* fPtr = new symmTensorField; - fPtr->transfer - ( - dynamicCast - < - token::Compound> - > - ( - fieldToken.transferCompoundToken(is) - ) - ); - - if (fPtr->size() != this->size()) - { - FatalIOErrorInFunction - ( - dict - ) << "\n size of field " << iter().keyword() - << " (" << fPtr->size() << ')' - << " is not the same size as the patch (" - << this->size() << ')' - << "\n on patch " << this->patch().name() - << " of field " - << this->internalField().name() - << " in file " - << this->internalField().objectPath() - << exit(FatalIOError); - } - - symmTensorFields_.insert(iter().keyword(), fPtr); - } - else if - ( - fieldToken.compoundToken().type() - == token::Compound>::typeName - ) - { - tensorField* fPtr = new tensorField; - fPtr->transfer - ( - dynamicCast>> - ( - fieldToken.transferCompoundToken(is) - ) - ); - - if (fPtr->size() != this->size()) - { - FatalIOErrorInFunction - ( - dict - ) << "\n size of field " << iter().keyword() - << " (" << fPtr->size() << ')' - << " is not the same size as the patch (" - << this->size() << ')' - << "\n on patch " << this->patch().name() - << " of field " - << this->internalField().name() - << " in file " - << this->internalField().objectPath() - << exit(FatalIOError); - } - - tensorFields_.insert(iter().keyword(), fPtr); - } - else - { - FatalIOErrorInFunction - ( - dict - ) << "\n compound " << fieldToken.compoundToken() - << " not supported" - << "\n on patch " << this->patch().name() - << " of field " - << this->internalField().name() - << " in file " - << this->internalField().objectPath() - << exit(FatalIOError); - } - } - else if - ( - firstToken.isWord() - && firstToken.wordToken() == "uniform" - ) - { - token fieldToken(is); - - if (!fieldToken.isPunctuation()) - { - scalarFields_.insert - ( - iter().keyword(), - new scalarField - ( - this->size(), - fieldToken.number() - ) - ); - } - else - { - // Read as scalarList. - is.putBack(fieldToken); - - scalarList l(is); - - if (l.size() == vector::nComponents) - { - vector vs(l[0], l[1], l[2]); - - vectorFields_.insert - ( - iter().keyword(), - new vectorField(this->size(), vs) - ); - } - else if (l.size() == sphericalTensor::nComponents) - { - sphericalTensor vs(l[0]); - - sphericalTensorFields_.insert - ( - iter().keyword(), - new sphericalTensorField(this->size(), vs) - ); - } - else if (l.size() == symmTensor::nComponents) - { - symmTensor vs(l[0], l[1], l[2], l[3], l[4], l[5]); - - symmTensorFields_.insert - ( - iter().keyword(), - new symmTensorField(this->size(), vs) - ); - } - else if (l.size() == tensor::nComponents) - { - tensor vs - ( - l[0], l[1], l[2], - l[3], l[4], l[5], - l[6], l[7], l[8] - ); - - tensorFields_.insert - ( - iter().keyword(), - new tensorField(this->size(), vs) - ); - } - else - { - FatalIOErrorInFunction - ( - dict - ) << "\n unrecognised native type " << l - << "\n on patch " << this->patch().name() - << " of field " - << this->internalField().name() - << " in file " - << this->internalField().objectPath() - << exit(FatalIOError); - } - } - } - } - } - } -} - - -template -Foam::genericFvPatchField::genericFvPatchField -( - const genericFvPatchField& ptf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - genericPatchField(ptf), - calculatedFvPatchField(ptf, p, iF, mapper), - dict_(ptf.dict_) -{ - forAllConstIter - ( - HashPtrTable, - ptf.scalarFields_, - iter - ) - { - scalarFields_.insert - ( - iter.key(), - mapper(*iter()).ptr() - ); - } - - forAllConstIter - ( - HashPtrTable, - ptf.vectorFields_, - iter - ) - { - vectorFields_.insert - ( - iter.key(), - mapper(*iter()).ptr() - ); - } - - forAllConstIter - ( - HashPtrTable, - ptf.sphericalTensorFields_, - iter - ) - { - sphericalTensorFields_.insert - ( - iter.key(), - mapper(*iter()).ptr() - ); - } - - forAllConstIter - ( - HashPtrTable, - ptf.symmTensorFields_, - iter - ) - { - symmTensorFields_.insert - ( - iter.key(), - mapper(*iter()).ptr() - ); - } - - forAllConstIter - ( - HashPtrTable, - ptf.tensorFields_, - iter - ) - { - tensorFields_.insert - ( - iter.key(), - mapper(*iter()).ptr() - ); - } -} - - -template -Foam::genericFvPatchField::genericFvPatchField -( - const genericFvPatchField& ptf, - const DimensionedField& iF -) -: - genericPatchField(ptf), - calculatedFvPatchField(ptf, iF), - dict_(ptf.dict_), - scalarFields_(ptf.scalarFields_), - vectorFields_(ptf.vectorFields_), - sphericalTensorFields_(ptf.sphericalTensorFields_), - symmTensorFields_(ptf.symmTensorFields_), - tensorFields_(ptf.tensorFields_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -void Foam::genericFvPatchField::map -( - const fvPatchField& ptf, - const fvPatchFieldMapper& mapper -) -{ - calculatedFvPatchField::map(ptf, mapper); - - const genericFvPatchField& dptf = - refCast>(ptf); - - forAllIter - ( - HashPtrTable, - scalarFields_, - iter - ) - { - HashPtrTable::const_iterator dptfIter = - dptf.scalarFields_.find(iter.key()); - - if (dptfIter != dptf.scalarFields_.end()) - { - mapper(*iter(), *dptfIter()); - } - } - - forAllIter - ( - HashPtrTable, - vectorFields_, - iter - ) - { - HashPtrTable::const_iterator dptfIter = - dptf.vectorFields_.find(iter.key()); - - if (dptfIter != dptf.vectorFields_.end()) - { - mapper(*iter(), *dptfIter()); - } - } - - forAllIter - ( - HashPtrTable, - sphericalTensorFields_, - iter - ) - { - HashPtrTable::const_iterator dptfIter = - dptf.sphericalTensorFields_.find(iter.key()); - - if (dptfIter != dptf.sphericalTensorFields_.end()) - { - mapper(*iter(), *dptfIter()); - } - } - - forAllIter - ( - HashPtrTable, - symmTensorFields_, - iter - ) - { - HashPtrTable::const_iterator dptfIter = - dptf.symmTensorFields_.find(iter.key()); - - if (dptfIter != dptf.symmTensorFields_.end()) - { - mapper(*iter(), *dptfIter()); - } - } - - forAllIter - ( - HashPtrTable, - tensorFields_, - iter - ) - { - HashPtrTable::const_iterator dptfIter = - dptf.tensorFields_.find(iter.key()); - - if (dptfIter != dptf.tensorFields_.end()) - { - mapper(*iter(), *dptfIter()); - } - } -} - - -template -void Foam::genericFvPatchField::reset -( - const fvPatchField& ptf -) -{ - calculatedFvPatchField::reset(ptf); - - const genericFvPatchField& dptf = - refCast>(ptf); - - forAllIter - ( - HashPtrTable, - scalarFields_, - iter - ) - { - HashPtrTable::const_iterator dptfIter = - dptf.scalarFields_.find(iter.key()); - - if (dptfIter != dptf.scalarFields_.end()) - { - iter()->reset(*dptfIter()); - } - } - - forAllIter - ( - HashPtrTable, - vectorFields_, - iter - ) - { - HashPtrTable::const_iterator dptfIter = - dptf.vectorFields_.find(iter.key()); - - if (dptfIter != dptf.vectorFields_.end()) - { - iter()->reset(*dptfIter()); - } - } - - forAllIter - ( - HashPtrTable, - sphericalTensorFields_, - iter - ) - { - HashPtrTable::const_iterator dptfIter = - dptf.sphericalTensorFields_.find(iter.key()); - - if (dptfIter != dptf.sphericalTensorFields_.end()) - { - iter()->reset(*dptfIter()); - } - } - - forAllIter - ( - HashPtrTable, - symmTensorFields_, - iter - ) - { - HashPtrTable::const_iterator dptfIter = - dptf.symmTensorFields_.find(iter.key()); - - if (dptfIter != dptf.symmTensorFields_.end()) - { - iter()->reset(*dptfIter()); - } - } - - forAllIter - ( - HashPtrTable, - tensorFields_, - iter - ) - { - HashPtrTable::const_iterator dptfIter = - dptf.tensorFields_.find(iter.key()); - - if (dptfIter != dptf.tensorFields_.end()) - { - iter()->reset(*dptfIter()); - } - } -} - - -template -Foam::tmp> -Foam::genericFvPatchField::valueInternalCoeffs -( - const tmp& -) const -{ - FatalErrorInFunction - << "cannot be called for a genericFvPatchField" - " (actual type " << actualTypeName() << ")" - << "\n on patch " << this->patch().name() - << " of field " << this->internalField().name() - << " in file " << this->internalField().objectPath() - << "\n You are probably trying to solve for a field with a " - "generic boundary condition." - << abort(FatalError); - - return *this; -} - - -template -Foam::tmp> -Foam::genericFvPatchField::valueBoundaryCoeffs -( - const tmp& -) const -{ - FatalErrorInFunction - << "cannot be called for a genericFvPatchField" - " (actual type " << actualTypeName() << ")" - << "\n on patch " << this->patch().name() - << " of field " << this->internalField().name() - << " in file " << this->internalField().objectPath() - << "\n You are probably trying to solve for a field with a " - "generic boundary condition." - << abort(FatalError); - - return *this; -} - - -template -Foam::tmp> -Foam::genericFvPatchField::gradientInternalCoeffs() const -{ - FatalErrorInFunction - << "cannot be called for a genericFvPatchField" - " (actual type " << actualTypeName() << ")" - << "\n on patch " << this->patch().name() - << " of field " << this->internalField().name() - << " in file " << this->internalField().objectPath() - << "\n You are probably trying to solve for a field with a " - "generic boundary condition." - << abort(FatalError); - - return *this; -} - -template -Foam::tmp> -Foam::genericFvPatchField::gradientBoundaryCoeffs() const -{ - FatalErrorInFunction - << "cannot be called for a genericFvPatchField" - " (actual type " << actualTypeName() << ")" - << "\n on patch " << this->patch().name() - << " of field " << this->internalField().name() - << " in file " << this->internalField().objectPath() - << "\n You are probably trying to solve for a field with a " - "generic boundary condition." - << abort(FatalError); - - return *this; -} - - -template -void Foam::genericFvPatchField::write(Ostream& os) const -{ - writeEntry(os, "type", actualTypeName()); - - forAllConstIter(dictionary, dict_, iter) - { - if (iter().keyword() != "type" && iter().keyword() != "value") - { - if - ( - iter().isStream() - && iter().stream().size() - && iter().stream()[0].isWord() - && iter().stream()[0].wordToken() == "nonuniform" - ) - { - if (scalarFields_.found(iter().keyword())) - { - writeEntry - ( - os, - iter().keyword(), - *scalarFields_.find(iter().keyword())() - ); - } - else if (vectorFields_.found(iter().keyword())) - { - writeEntry - ( - os, - iter().keyword(), - *vectorFields_.find(iter().keyword())() - ); - } - else if (sphericalTensorFields_.found(iter().keyword())) - { - writeEntry - ( - os, - iter().keyword(), - *sphericalTensorFields_.find(iter().keyword())() - ); - } - else if (symmTensorFields_.found(iter().keyword())) - { - writeEntry - ( - os, - iter().keyword(), - *symmTensorFields_.find(iter().keyword())() - ); - } - else if (tensorFields_.found(iter().keyword())) - { - writeEntry - ( - os, - iter().keyword(), - *tensorFields_.find(iter().keyword())() - ); - } - } - else - { - iter().write(os); - } - } - } - - writeEntry(os, "value", *this); -} - - -// ************************************************************************* // diff --git a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C deleted file mode 100644 index 459fdf864e..0000000000 --- a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C +++ /dev/null @@ -1,652 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "genericPointPatchField.H" -#include "pointPatchFieldMapper.H" - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -Foam::genericPointPatchField::genericPointPatchField -( - const pointPatch& p, - const DimensionedField& iF, - const dictionary& dict -) -: - genericPatchField(dict.lookup("type")), - calculatedPointPatchField(p, iF, dict), - dict_(dict) -{ - forAllConstIter(dictionary, dict_, iter) - { - if (iter().keyword() != "type") - { - if - ( - iter().isStream() - && iter().stream().size() - ) - { - ITstream& is = iter().stream(); - - // Read first token - token firstToken(is); - - if - ( - firstToken.isWord() - && firstToken.wordToken() == "nonuniform" - ) - { - token fieldToken(is); - - if (!fieldToken.isCompound()) - { - if - ( - fieldToken.isLabel() - && fieldToken.labelToken() == 0 - ) - { - scalarFields_.insert - ( - iter().keyword(), - new scalarField(0) - ); - } - else - { - FatalIOErrorInFunction - ( - dict - ) << "\n token following 'nonuniform' " - "is not a compound" - << "\n on patch " << this->patch().name() - << " of field " - << this->internalField().name() - << " in file " - << this->internalField().objectPath() - << exit(FatalIOError); - } - } - else if - ( - fieldToken.compoundToken().type() - == token::Compound>::typeName - ) - { - scalarField* fPtr = new scalarField; - fPtr->transfer - ( - dynamicCast>> - ( - fieldToken.transferCompoundToken(is) - ) - ); - - if (fPtr->size() != this->size()) - { - FatalIOErrorInFunction - ( - dict - ) << "\n size of field " << iter().keyword() - << " (" << fPtr->size() << ')' - << " is not the same size as the patch (" - << this->size() << ')' - << "\n on patch " << this->patch().name() - << " of field " - << this->internalField().name() - << " in file " - << this->internalField().objectPath() - << exit(FatalIOError); - } - - scalarFields_.insert(iter().keyword(), fPtr); - } - else if - ( - fieldToken.compoundToken().type() - == token::Compound>::typeName - ) - { - vectorField* fPtr = new vectorField; - fPtr->transfer - ( - dynamicCast>> - ( - fieldToken.transferCompoundToken(is) - ) - ); - - if (fPtr->size() != this->size()) - { - FatalIOErrorInFunction - ( - dict - ) << "\n size of field " << iter().keyword() - << " (" << fPtr->size() << ')' - << " is not the same size as the patch (" - << this->size() << ')' - << "\n on patch " << this->patch().name() - << " of field " - << this->internalField().name() - << " in file " - << this->internalField().objectPath() - << exit(FatalIOError); - } - - vectorFields_.insert(iter().keyword(), fPtr); - } - else if - ( - fieldToken.compoundToken().type() - == token::Compound>::typeName - ) - { - sphericalTensorField* fPtr = new sphericalTensorField; - fPtr->transfer - ( - dynamicCast - < - token::Compound> - > - ( - fieldToken.transferCompoundToken(is) - ) - ); - - if (fPtr->size() != this->size()) - { - FatalIOErrorInFunction - ( - dict - ) << "\n size of field " << iter().keyword() - << " (" << fPtr->size() << ')' - << " is not the same size as the patch (" - << this->size() << ')' - << "\n on patch " << this->patch().name() - << " of field " - << this->internalField().name() - << " in file " - << this->internalField().objectPath() - << exit(FatalIOError); - } - - sphericalTensorFields_.insert(iter().keyword(), fPtr); - } - else if - ( - fieldToken.compoundToken().type() - == token::Compound>::typeName - ) - { - symmTensorField* fPtr = new symmTensorField; - fPtr->transfer - ( - dynamicCast - < - token::Compound> - > - ( - fieldToken.transferCompoundToken(is) - ) - ); - - if (fPtr->size() != this->size()) - { - FatalIOErrorInFunction - ( - dict - ) << "\n size of field " << iter().keyword() - << " (" << fPtr->size() << ')' - << " is not the same size as the patch (" - << this->size() << ')' - << "\n on patch " << this->patch().name() - << " of field " - << this->internalField().name() - << " in file " - << this->internalField().objectPath() - << exit(FatalIOError); - } - - symmTensorFields_.insert(iter().keyword(), fPtr); - } - else if - ( - fieldToken.compoundToken().type() - == token::Compound>::typeName - ) - { - tensorField* fPtr = new tensorField; - fPtr->transfer - ( - dynamicCast>> - ( - fieldToken.transferCompoundToken(is) - ) - ); - - if (fPtr->size() != this->size()) - { - FatalIOErrorInFunction - ( - dict - ) << "\n size of field " << iter().keyword() - << " (" << fPtr->size() << ')' - << " is not the same size as the patch (" - << this->size() << ')' - << "\n on patch " << this->patch().name() - << " of field " - << this->internalField().name() - << " in file " - << this->internalField().objectPath() - << exit(FatalIOError); - } - - tensorFields_.insert(iter().keyword(), fPtr); - } - else - { - FatalIOErrorInFunction - ( - dict - ) << "\n compound " << fieldToken.compoundToken() - << " not supported" - << "\n on patch " << this->patch().name() - << " of field " - << this->internalField().name() - << " in file " - << this->internalField().objectPath() - << exit(FatalIOError); - } - } - } - } - } -} - - -template -Foam::genericPointPatchField::genericPointPatchField -( - const genericPointPatchField& ptf, - const pointPatch& p, - const DimensionedField& iF, - const pointPatchFieldMapper& mapper -) -: - genericPatchField(ptf), - calculatedPointPatchField(ptf, p, iF, mapper), - dict_(ptf.dict_) -{ - forAllConstIter - ( - HashPtrTable, - ptf.scalarFields_, - iter - ) - { - scalarFields_.insert - ( - iter.key(), - mapper(*iter()).ptr() - ); - } - - forAllConstIter - ( - HashPtrTable, - ptf.vectorFields_, - iter - ) - { - vectorFields_.insert - ( - iter.key(), - mapper(*iter()).ptr() - ); - } - - forAllConstIter - ( - HashPtrTable, - ptf.sphericalTensorFields_, - iter - ) - { - sphericalTensorFields_.insert - ( - iter.key(), - mapper(*iter()).ptr() - ); - } - - forAllConstIter - ( - HashPtrTable, - ptf.symmTensorFields_, - iter - ) - { - symmTensorFields_.insert - ( - iter.key(), - mapper(*iter()).ptr() - ); - } - - forAllConstIter - ( - HashPtrTable, - ptf.tensorFields_, - iter - ) - { - tensorFields_.insert - ( - iter.key(), - mapper(*iter()).ptr() - ); - } -} - - -template -Foam::genericPointPatchField::genericPointPatchField -( - const genericPointPatchField& ptf, - const DimensionedField& iF -) -: - genericPatchField(ptf), - calculatedPointPatchField(ptf, iF), - dict_(ptf.dict_), - scalarFields_(ptf.scalarFields_), - vectorFields_(ptf.vectorFields_), - sphericalTensorFields_(ptf.sphericalTensorFields_), - symmTensorFields_(ptf.symmTensorFields_), - tensorFields_(ptf.tensorFields_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -void Foam::genericPointPatchField::map -( - const pointPatchField& ptf, - const pointPatchFieldMapper& mapper -) -{ - const genericPointPatchField& dptf = - refCast>(ptf); - - forAllIter - ( - HashPtrTable, - scalarFields_, - iter - ) - { - HashPtrTable::const_iterator dptfIter = - dptf.scalarFields_.find(iter.key()); - - if (dptfIter != scalarFields_.end()) - { - mapper(*iter(), *dptfIter()); - } - } - - forAllIter - ( - HashPtrTable, - vectorFields_, - iter - ) - { - HashPtrTable::const_iterator dptfIter = - dptf.vectorFields_.find(iter.key()); - - if (dptfIter != vectorFields_.end()) - { - mapper(*iter(), *dptfIter()); - } - } - - forAllIter - ( - HashPtrTable, - sphericalTensorFields_, - iter - ) - { - HashPtrTable::const_iterator dptfIter = - dptf.sphericalTensorFields_.find(iter.key()); - - if (dptfIter != sphericalTensorFields_.end()) - { - mapper(*iter(), *dptfIter()); - } - } - - forAllIter - ( - HashPtrTable, - symmTensorFields_, - iter - ) - { - HashPtrTable::const_iterator dptfIter = - dptf.symmTensorFields_.find(iter.key()); - - if (dptfIter != symmTensorFields_.end()) - { - mapper(*iter(), *dptfIter()); - } - } - - forAllIter - ( - HashPtrTable, - tensorFields_, - iter - ) - { - HashPtrTable::const_iterator dptfIter = - dptf.tensorFields_.find(iter.key()); - - if (dptfIter != tensorFields_.end()) - { - mapper(*iter(), *dptfIter()); - } - } -} - - -template -void Foam::genericPointPatchField::reset -( - const pointPatchField& ptf -) -{ - const genericPointPatchField& dptf = - refCast>(ptf); - - forAllIter - ( - HashPtrTable, - scalarFields_, - iter - ) - { - HashPtrTable::const_iterator dptfIter = - dptf.scalarFields_.find(iter.key()); - - if (dptfIter != scalarFields_.end()) - { - iter()->reset(*dptfIter()); - } - } - - forAllIter - ( - HashPtrTable, - vectorFields_, - iter - ) - { - HashPtrTable::const_iterator dptfIter = - dptf.vectorFields_.find(iter.key()); - - if (dptfIter != vectorFields_.end()) - { - iter()->reset(*dptfIter()); - } - } - - forAllIter - ( - HashPtrTable, - sphericalTensorFields_, - iter - ) - { - HashPtrTable::const_iterator dptfIter = - dptf.sphericalTensorFields_.find(iter.key()); - - if (dptfIter != sphericalTensorFields_.end()) - { - iter()->reset(*dptfIter()); - } - } - - forAllIter - ( - HashPtrTable, - symmTensorFields_, - iter - ) - { - HashPtrTable::const_iterator dptfIter = - dptf.symmTensorFields_.find(iter.key()); - - if (dptfIter != symmTensorFields_.end()) - { - iter()->reset(*dptfIter()); - } - } - - forAllIter - ( - HashPtrTable, - tensorFields_, - iter - ) - { - HashPtrTable::const_iterator dptfIter = - dptf.tensorFields_.find(iter.key()); - - if (dptfIter != tensorFields_.end()) - { - iter()->reset(*dptfIter()); - } - } -} - - -template -void Foam::genericPointPatchField::write(Ostream& os) const -{ - writeEntry(os, "type", actualTypeName()); - - forAllConstIter(dictionary, dict_, iter) - { - if (iter().keyword() != "type") - { - if - ( - iter().isStream() - && iter().stream().size() - && iter().stream()[0].isWord() - && iter().stream()[0].wordToken() == "nonuniform" - ) - { - if (scalarFields_.found(iter().keyword())) - { - writeEntry - ( - os, - iter().keyword(), - *scalarFields_.find(iter().keyword())() - ); - } - else if (vectorFields_.found(iter().keyword())) - { - writeEntry - ( - os, - iter().keyword(), - *vectorFields_.find(iter().keyword())() - ); - } - else if (sphericalTensorFields_.found(iter().keyword())) - { - writeEntry - ( - os, - iter().keyword(), - *sphericalTensorFields_.find(iter().keyword())() - ); - } - else if (symmTensorFields_.found(iter().keyword())) - { - writeEntry - ( - os, - iter().keyword(), - *symmTensorFields_.find(iter().keyword())() - ); - } - else if (tensorFields_.found(iter().keyword())) - { - writeEntry - ( - os, - iter().keyword(), - *tensorFields_.find(iter().keyword())() - ); - } - } - else - { - iter().write(os); - } - } - } -} - - -// ************************************************************************* // diff --git a/test/fvMeshTools/Test-fvMeshTools/Make/options b/test/fvMeshTools/Test-fvMeshTools/Make/options index 3c8db28129..105d76e3b7 100644 --- a/test/fvMeshTools/Test-fvMeshTools/Make/options +++ b/test/fvMeshTools/Test-fvMeshTools/Make/options @@ -8,4 +8,4 @@ EXE_LIBS = \ -ldynamicMesh \ -lmeshTools \ -lfiniteVolume \ - -lgenericPatchFields + -lgenericFvFields