mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
#+DATE: TBA
|
||||
#+LINK: http://www.openfoam.com
|
||||
#+OPTIONS: author:nil ^:{}
|
||||
# Copyright (c) 2010 OpenCFD Ltd.
|
||||
# Copyright (c) 2011 OpenCFD Ltd.
|
||||
|
||||
* Overview
|
||||
OpenFOAM-dev is the latest major release of OpenFOAM including many new
|
||||
@ -117,7 +117,7 @@
|
||||
*** *New* compact binary I/O for faces and cells. This speeds up reading/writing meshes in binary.
|
||||
*** *Updated* runTimeModifiable
|
||||
+ user selectable model to use for checking run-time modifiable
|
||||
dictionaries:
|
||||
dictionaries (see also doc/changes/inotify.txt):
|
||||
+ timeStamp : use time stamp as before
|
||||
+ inotify : use inotify instead of time stamp
|
||||
+ timeStampMaster : only master checks and reads file. Slaves get file
|
||||
|
||||
@ -23,7 +23,7 @@ fvMesh mesh
|
||||
fvMesh::defaultRegion,
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::NO_READ
|
||||
IOobject::MUST_READ
|
||||
),
|
||||
xferMove<Field<vector> >(points),
|
||||
faces.xfer(),
|
||||
|
||||
@ -4,8 +4,8 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/dieselSpray/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
@ -27,12 +27,12 @@ EXE_LIBS = \
|
||||
-llagrangian \
|
||||
-lmeshTools \
|
||||
-ldieselSpray \
|
||||
-lliquids \
|
||||
-lliquidMixture \
|
||||
-lliquidProperties \
|
||||
-lliquidMixtureProperties \
|
||||
-lthermophysicalFunctions \
|
||||
-lspecie \
|
||||
-lbasicThermophysicalModels \
|
||||
-llaminarFlameSpeedModels \
|
||||
-lchemistryModel \
|
||||
-lODE \
|
||||
-lpdf
|
||||
-ldistributionModels
|
||||
|
||||
@ -5,8 +5,8 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/dieselSpray/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
@ -24,13 +24,13 @@ EXE_LIBS = \
|
||||
-llagrangian \
|
||||
-lmeshTools \
|
||||
-ldieselSpray \
|
||||
-lliquids \
|
||||
-lliquidMixture \
|
||||
-lliquidProperties \
|
||||
-lliquidMixtureProperties \
|
||||
-lthermophysicalFunctions \
|
||||
-lspecie \
|
||||
-lbasicThermophysicalModels \
|
||||
-llaminarFlameSpeedModels \
|
||||
-lchemistryModel \
|
||||
-lODE \
|
||||
-lpdf \
|
||||
-ldistributionModels \
|
||||
-lfiniteVolume
|
||||
|
||||
@ -5,7 +5,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude
|
||||
|
||||
|
||||
EXE_LIBS = \
|
||||
@ -17,4 +17,4 @@ EXE_LIBS = \
|
||||
-lcompressibleTurbulenceModel \
|
||||
-lcompressibleLESModels \
|
||||
-lcompressibleRASModels \
|
||||
-lradiation
|
||||
-lradiationModels
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
EXE_INC = \
|
||||
-I../buoyantSimpleFoam \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/RAS \
|
||||
@ -11,7 +11,7 @@ EXE_INC = \
|
||||
EXE_LIBS = \
|
||||
-lbasicThermophysicalModels \
|
||||
-lspecie \
|
||||
-lradiation \
|
||||
-lradiationModels \
|
||||
-lcompressibleTurbulenceModel \
|
||||
-lcompressibleRASModels \
|
||||
-lfiniteVolume \
|
||||
|
||||
@ -5,18 +5,18 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/coalCombustion/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/pdfs/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
|
||||
-I$(LIB_SRC)/surfaceFilmModels/lnInclude \
|
||||
-I$(LIB_SRC)/ODE/lnInclude
|
||||
|
||||
@ -31,14 +31,14 @@ EXE_LIBS = \
|
||||
-lcoalCombustion\
|
||||
-lspecie \
|
||||
-lbasicThermophysicalModels \
|
||||
-lliquids \
|
||||
-lliquidMixture \
|
||||
-lpointSolids \
|
||||
-lpointSolidMixture \
|
||||
-lliquidProperties \
|
||||
-lliquidMixtureProperties \
|
||||
-lsolidProperties \
|
||||
-lsolidMixtureProperties \
|
||||
-lthermophysicalFunctions \
|
||||
-lreactionThermophysicalModels \
|
||||
-lSLGThermo \
|
||||
-lchemistryModel \
|
||||
-lradiation \
|
||||
-lradiationModels \
|
||||
-lsurfaceFilmModels \
|
||||
-lODE
|
||||
|
||||
@ -4,7 +4,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
|
||||
@ -21,7 +21,7 @@ EXE_LIBS = \
|
||||
-lthermophysicalFunctions \
|
||||
-lbasicThermophysicalModels \
|
||||
-lspecie \
|
||||
-lradiation \
|
||||
-lradiationModels \
|
||||
-lincompressibleRASModels \
|
||||
-lincompressibleLESModels \
|
||||
-lincompressibleTransportModels \
|
||||
|
||||
@ -4,7 +4,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
|
||||
@ -18,7 +18,7 @@ EXE_LIBS = \
|
||||
-lthermophysicalFunctions \
|
||||
-lbasicThermophysicalModels \
|
||||
-lspecie \
|
||||
-lradiation \
|
||||
-lradiationModels \
|
||||
-lincompressibleRASModels \
|
||||
-lincompressibleLESModels \
|
||||
-lincompressibleTransportModels \
|
||||
|
||||
@ -5,18 +5,18 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/coalCombustion/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/pdfs/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
|
||||
-I$(LIB_SRC)/ODE/lnInclude \
|
||||
-I$(LIB_SRC)/surfaceFilmModels/lnInclude
|
||||
|
||||
@ -30,14 +30,14 @@ EXE_LIBS = \
|
||||
-llagrangianIntermediate \
|
||||
-lspecie \
|
||||
-lbasicThermophysicalModels \
|
||||
-lliquids \
|
||||
-lliquidMixture \
|
||||
-lpointSolids \
|
||||
-lpointSolidMixture \
|
||||
-lliquidProperties \
|
||||
-lliquidMixtureProperties \
|
||||
-lsolidProperties \
|
||||
-lsolidMixtureProperties \
|
||||
-lthermophysicalFunctions \
|
||||
-lreactionThermophysicalModels \
|
||||
-lSLGThermo \
|
||||
-lchemistryModel \
|
||||
-lradiation \
|
||||
-lradiationModels \
|
||||
-lODE \
|
||||
-lsurfaceFilmModels
|
||||
|
||||
@ -2,18 +2,18 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I${LIB_SRC}/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
||||
-I$(LIB_SRC)/thermophysicalModels/pdfs/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
|
||||
-I$(LIB_SRC)/surfaceFilmModels/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
|
||||
@ -26,13 +26,13 @@ EXE_LIBS = \
|
||||
-lcompressibleLESModels \
|
||||
-lspecie \
|
||||
-lbasicThermophysicalModels \
|
||||
-lpointSolids \
|
||||
-lpointSolidMixture \
|
||||
-lsolidProperties \
|
||||
-lsolidMixtureProperties \
|
||||
-lthermophysicalFunctions \
|
||||
-lreactionThermophysicalModels \
|
||||
-lSLGThermo \
|
||||
-lchemistryModel \
|
||||
-lradiation \
|
||||
-lradiationModels \
|
||||
-lsurfaceFilmModels \
|
||||
-llagrangianIntermediate \
|
||||
-lODE
|
||||
|
||||
@ -4,18 +4,18 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/pdfs/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
|
||||
-I$(LIB_SRC)/ODE/lnInclude \
|
||||
-I$(LIB_SRC)/surfaceFilmModels/lnInclude
|
||||
|
||||
@ -29,14 +29,14 @@ EXE_LIBS = \
|
||||
-llagrangianIntermediate \
|
||||
-lspecie \
|
||||
-lbasicThermophysicalModels \
|
||||
-lliquids \
|
||||
-lliquidMixture \
|
||||
-lpointSolids \
|
||||
-lpointSolidMixture \
|
||||
-lliquidProperties \
|
||||
-lliquidMixtureProperties \
|
||||
-lsolidProperties \
|
||||
-lsolidMixtureProperties \
|
||||
-lthermophysicalFunctions \
|
||||
-lreactionThermophysicalModels \
|
||||
-lSLGThermo \
|
||||
-lchemistryModel \
|
||||
-lradiation \
|
||||
-lradiationModels \
|
||||
-lODE \
|
||||
-lsurfaceFilmModels
|
||||
|
||||
@ -5,18 +5,18 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/coalCombustion/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/pdfs/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
|
||||
-I$(LIB_SRC)/ODE/lnInclude \
|
||||
-I$(LIB_SRC)/surfaceFilmModels/lnInclude
|
||||
|
||||
@ -30,14 +30,14 @@ EXE_LIBS = \
|
||||
-llagrangianIntermediate \
|
||||
-lspecie \
|
||||
-lbasicThermophysicalModels \
|
||||
-lliquids \
|
||||
-lliquidMixture \
|
||||
-lpointSolids \
|
||||
-lpointSolidMixture \
|
||||
-lliquidProperties \
|
||||
-lliquidMixtureProperties \
|
||||
-lsolidProperties \
|
||||
-lsolidMixtureProperties \
|
||||
-lthermophysicalFunctions \
|
||||
-lreactionThermophysicalModels \
|
||||
-lSLGThermo \
|
||||
-lchemistryModel \
|
||||
-lradiation \
|
||||
-lradiationModels \
|
||||
-lODE \
|
||||
-lsurfaceFilmModels
|
||||
|
||||
@ -4,7 +4,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
@ -16,7 +16,7 @@ EXE_LIBS = \
|
||||
-lthermophysicalFunctions \
|
||||
-lbasicThermophysicalModels \
|
||||
-lspecie \
|
||||
-lradiation \
|
||||
-lradiationModels \
|
||||
-lcompressibleTurbulenceModel \
|
||||
-lcompressibleRASModels \
|
||||
-lcompressibleLESModels \
|
||||
|
||||
3
applications/test/Distribution/Make/files
Normal file
3
applications/test/Distribution/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-Distribution.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-DistributionTest
|
||||
2
applications/test/Distribution/Make/options
Normal file
2
applications/test/Distribution/Make/options
Normal file
@ -0,0 +1,2 @@
|
||||
/* EXE_INC = */
|
||||
/* EXE_LIBS = */
|
||||
292
applications/test/Distribution/Test-Distribution.C
Normal file
292
applications/test/Distribution/Test-Distribution.C
Normal file
@ -0,0 +1,292 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
Test-Distribution
|
||||
|
||||
Description
|
||||
Test the Distribution class
|
||||
|
||||
Plot normal distribution test in gnuplot using:
|
||||
|
||||
@verbatim
|
||||
normalDistribution(mean, sigma, x) = \
|
||||
sqrt(1.0/(2.0*pi*sigma**2))*exp(-(x - mean)**2.0/(2.0*sigma**2))
|
||||
|
||||
plot normalDistribution(8.5, 2.5, x), "Distribution_scalar_test_x" w p
|
||||
@endverbatim
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "vector.H"
|
||||
#include "labelVector.H"
|
||||
#include "tensor.H"
|
||||
#include "Distribution.H"
|
||||
#include "Random.H"
|
||||
#include "dimensionedTypes.H"
|
||||
#include "argList.H"
|
||||
#include "PstreamReduceOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
# include "setRootCase.H"
|
||||
|
||||
Random R(918273);
|
||||
|
||||
{
|
||||
// scalar
|
||||
label randomDistributionTestSize = 50000000;
|
||||
|
||||
Distribution<scalar> dS(scalar(5e-2));
|
||||
|
||||
Info<< nl << "Distribution<scalar>" << nl
|
||||
<< "Sampling "
|
||||
<< randomDistributionTestSize
|
||||
<< " times from GaussNormal distribution."
|
||||
<< endl;
|
||||
|
||||
for (label i = 0; i < randomDistributionTestSize; i++)
|
||||
{
|
||||
dS.add(2.5*R.GaussNormal() + 8.5);
|
||||
}
|
||||
|
||||
Info<< "Mean " << dS.mean() << nl
|
||||
<< "Median " << dS.median()
|
||||
<< endl;
|
||||
|
||||
dS.write("Distribution_scalar_test_1");
|
||||
|
||||
Distribution<scalar> dS2(scalar(1e-2));
|
||||
|
||||
Info<< nl << "Distribution<scalar>" << nl
|
||||
<< "Sampling "
|
||||
<< randomDistributionTestSize
|
||||
<< " times from GaussNormal distribution."
|
||||
<< endl;
|
||||
|
||||
for (label i = 0; i < randomDistributionTestSize; i++)
|
||||
{
|
||||
dS2.add(1.5*R.GaussNormal() -6.0);
|
||||
}
|
||||
|
||||
Info<< "Mean " << dS2.mean() << nl
|
||||
<< "Median " << dS2.median()
|
||||
<< endl;
|
||||
|
||||
dS2.write("Distribution_scalar_test_2");
|
||||
|
||||
Info<< nl << "Adding previous two Distribution<scalar>" << endl;
|
||||
|
||||
dS = dS + dS2;
|
||||
|
||||
dS.write("Distribution_scalar_test_1+2");
|
||||
}
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// scalar in parallel
|
||||
label randomDistributionTestSize = 100000000;
|
||||
|
||||
Distribution<scalar> dS(scalar(1e-1));
|
||||
|
||||
Pout<< "Distribution<scalar>" << nl
|
||||
<< "Sampling "
|
||||
<< randomDistributionTestSize
|
||||
<< " times from uniform distribution."
|
||||
<< endl;
|
||||
|
||||
for (label i = 0; i < randomDistributionTestSize; i++)
|
||||
{
|
||||
dS.add(R.scalar01() + 10*Pstream::myProcNo());
|
||||
}
|
||||
|
||||
Pout<< "Mean " << dS.mean() << nl
|
||||
<< "Median " << dS.median()
|
||||
<< endl;
|
||||
|
||||
reduce(dS, sumOp< Distribution<scalar> >());
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
Info<< "Reducing parallel Distribution<scalar>" << nl
|
||||
<< "Mean " << dS.mean() << nl
|
||||
<< "Median " << dS.median()
|
||||
<< endl;
|
||||
|
||||
dS.write("Distribution_scalar_test_parallel_reduced");
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// vector
|
||||
Distribution<vector> dV(vector(0.1, 0.05, 0.15));
|
||||
|
||||
label randomDistributionTestSize = 1000000;
|
||||
|
||||
Info<< nl << "Distribution<vector>" << nl
|
||||
<< "Sampling "
|
||||
<< randomDistributionTestSize
|
||||
<< " times from uniform and GaussNormal distribution."
|
||||
<< endl;
|
||||
|
||||
for (label i = 0; i < randomDistributionTestSize; i++)
|
||||
{
|
||||
dV.add(R.vector01());
|
||||
|
||||
// Adding separate GaussNormal components with component
|
||||
// weights
|
||||
|
||||
dV.add
|
||||
(
|
||||
vector
|
||||
(
|
||||
R.GaussNormal()*3.0 + 1.5,
|
||||
R.GaussNormal()*0.25 + 4.0,
|
||||
R.GaussNormal()*3.0 - 1.5
|
||||
),
|
||||
vector(1.0, 2.0, 5.0)
|
||||
);
|
||||
}
|
||||
|
||||
Info<< "Mean " << dV.mean() << nl
|
||||
<< "Median " << dV.median()
|
||||
<< endl;
|
||||
|
||||
dV.write("Distribution_vector_test");
|
||||
}
|
||||
|
||||
// {
|
||||
// // labelVector
|
||||
// Distribution<labelVector> dLV(labelVector::one*10);
|
||||
|
||||
// label randomDistributionTestSize = 2000000;
|
||||
|
||||
// Info<< nl << "Distribution<labelVector>" << nl
|
||||
// << "Sampling "
|
||||
// << randomDistributionTestSize
|
||||
// << " times from uniform distribution."
|
||||
// << endl;
|
||||
|
||||
// for (label i = 0; i < randomDistributionTestSize; i++)
|
||||
// {
|
||||
// dLV.add
|
||||
// (
|
||||
// labelVector
|
||||
// (
|
||||
// R.integer(-1000, 1000),
|
||||
// R.integer(-5000, 5000),
|
||||
// R.integer(-2000, 7000)
|
||||
// )
|
||||
// );
|
||||
// }
|
||||
|
||||
// Info<< "Mean " << dLV.mean() << nl
|
||||
// << "Median " << dLV.median()
|
||||
// << endl;
|
||||
|
||||
// dLV.write("Distribution_labelVector_test");
|
||||
// }
|
||||
|
||||
{
|
||||
// tensor
|
||||
Distribution<tensor> dT(tensor::one*1e-2);
|
||||
|
||||
label randomDistributionTestSize = 2000000;
|
||||
|
||||
Info<< nl << "Distribution<tensor>" << nl
|
||||
<< "Sampling "
|
||||
<< randomDistributionTestSize
|
||||
<< " times from uniform distribution."
|
||||
<< endl;
|
||||
|
||||
for (label i = 0; i < randomDistributionTestSize; i++)
|
||||
{
|
||||
dT.add(R.tensor01());
|
||||
}
|
||||
|
||||
Info<< "Mean " << dT.mean() << nl
|
||||
<< "Median " << dT.median()
|
||||
<< endl;
|
||||
|
||||
dT.write("Distribution_tensor_test");
|
||||
}
|
||||
|
||||
{
|
||||
// symmTensor
|
||||
Distribution<symmTensor> dSyT(symmTensor::one*1e-2);
|
||||
|
||||
label randomDistributionTestSize = 2000000;
|
||||
|
||||
Info<< nl << "Distribution<symmTensor>" << nl
|
||||
<< "Sampling "
|
||||
<< randomDistributionTestSize
|
||||
<< " times from uniform distribution."
|
||||
<< endl;
|
||||
|
||||
for (label i = 0; i < randomDistributionTestSize; i++)
|
||||
{
|
||||
dSyT.add(R.symmTensor01());
|
||||
}
|
||||
|
||||
Info<< "Mean " << dSyT.mean() << nl
|
||||
<< "Median " << dSyT.median()
|
||||
<< endl;
|
||||
|
||||
dSyT.write("Distribution_symmTensor_test");
|
||||
}
|
||||
|
||||
{
|
||||
// sphericalTensor
|
||||
Distribution<sphericalTensor> dSpT(sphericalTensor::one*1e-2);
|
||||
|
||||
label randomDistributionTestSize = 50000000;
|
||||
|
||||
Info<< nl << "Distribution<sphericalTensor>" << nl
|
||||
<< "Sampling "
|
||||
<< randomDistributionTestSize
|
||||
<< " times from uniform distribution."
|
||||
<< endl;
|
||||
|
||||
for (label i = 0; i < randomDistributionTestSize; i++)
|
||||
{
|
||||
dSpT.add(R.sphericalTensor01());
|
||||
}
|
||||
|
||||
Info<< "Mean " << dSpT.mean() << nl
|
||||
<< "Median " << dSpT.median()
|
||||
<< endl;
|
||||
|
||||
dSpT.write("Distribution_sphericalTensor_test");
|
||||
}
|
||||
|
||||
Info<< nl << "End" << nl << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,3 +1,3 @@
|
||||
hashTableTest2.C
|
||||
Test-HashTable2.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/hashTableTest2
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-HashTable2
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -22,6 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Miscellaneous tests for HashTable
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
hashTableTest3.C
|
||||
Test-HashTable3.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/hashTableTest3
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-HashTable3
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -22,7 +22,6 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
|
||||
Test speeds for some HashTable operations
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -1,3 +1,3 @@
|
||||
Test-namedEnum.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/NamedEnum
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-NamedEnum
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-llagrangianIntermediate \
|
||||
-lradiation \
|
||||
-lradiationModels \
|
||||
-lthermophysicalFunctions
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,7 +25,7 @@ Application
|
||||
testDataEntry
|
||||
|
||||
Description
|
||||
Tests lagrangian/intermediate/submodels/IO/DataEntry
|
||||
Tests DataEntry
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
Test-dimensionedType.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/dimensionedType
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-dimensionedType
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -50,133 +50,71 @@ int main(int argc, char *argv[])
|
||||
|
||||
const globalMeshData& globalData = mesh.globalData();
|
||||
const indirectPrimitivePatch& coupledPatch = globalData.coupledPatch();
|
||||
const globalIndexAndTransform& transforms = globalData.globalTransforms();
|
||||
|
||||
|
||||
// Test:print (collocated) shared points
|
||||
// Test:print shared points
|
||||
{
|
||||
const labelListList& globalPointSlaves =
|
||||
globalData.globalPointSlaves();
|
||||
const mapDistribute& globalPointSlavesMap =
|
||||
globalData.globalPointSlavesMap();
|
||||
const labelListList& slaves =
|
||||
globalData.globalPointSlaves();
|
||||
const labelListList& transformedSlaves =
|
||||
globalData.globalPointTransformedSlaves();
|
||||
|
||||
// Create field with my local data
|
||||
pointField coords(globalPointSlavesMap.constructSize());
|
||||
SubList<point>(coords, coupledPatch.nPoints()).assign
|
||||
(
|
||||
coupledPatch.localPoints()
|
||||
);
|
||||
|
||||
// Exchange data
|
||||
globalPointSlavesMap.distribute(coords);
|
||||
// Exchange data. Apply positional transforms.
|
||||
globalPointSlavesMap.distribute(transforms, coords, true);
|
||||
|
||||
// Print
|
||||
forAll(globalPointSlaves, pointI)
|
||||
forAll(slaves, pointI)
|
||||
{
|
||||
const labelList& slavePoints = globalPointSlaves[pointI];
|
||||
const labelList& slavePoints = slaves[pointI];
|
||||
|
||||
if (slavePoints.size() > 0)
|
||||
{
|
||||
Pout<< "Master point:" << pointI
|
||||
<< " coord:" << coords[pointI]
|
||||
<< " connected to slave points:" << endl;
|
||||
<< " connected to untransformed slave points:" << endl;
|
||||
|
||||
forAll(slavePoints, i)
|
||||
{
|
||||
Pout<< " " << coords[slavePoints[i]] << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const labelList& transformedSlavePoints = transformedSlaves[pointI];
|
||||
|
||||
|
||||
// Test: (collocated) point to faces addressing
|
||||
{
|
||||
const labelListList& globalPointBoundaryFaces =
|
||||
globalData.globalPointBoundaryFaces();
|
||||
const mapDistribute& globalPointBoundaryFacesMap =
|
||||
globalData.globalPointBoundaryFacesMap();
|
||||
|
||||
label nBnd = mesh.nFaces()-mesh.nInternalFaces();
|
||||
|
||||
pointField fc(globalPointBoundaryFacesMap.constructSize());
|
||||
SubList<point>(fc, nBnd).assign
|
||||
(
|
||||
primitivePatch
|
||||
(
|
||||
SubList<face>
|
||||
(
|
||||
mesh.faces(),
|
||||
nBnd,
|
||||
mesh.nInternalFaces()
|
||||
),
|
||||
mesh.points()
|
||||
).faceCentres()
|
||||
);
|
||||
|
||||
// Exchange data
|
||||
globalPointBoundaryFacesMap.distribute(fc);
|
||||
|
||||
// Print
|
||||
forAll(globalPointBoundaryFaces, pointI)
|
||||
{
|
||||
const labelList& bFaces = globalPointBoundaryFaces[pointI];
|
||||
|
||||
Pout<< "Point:" << pointI
|
||||
<< " at:" << coupledPatch.localPoints()[pointI]
|
||||
<< " connected to faces:" << endl;
|
||||
|
||||
forAll(bFaces, i)
|
||||
if (transformedSlavePoints.size() > 0)
|
||||
{
|
||||
Pout<< " " << fc[bFaces[i]] << endl;
|
||||
Pout<< "Master point:" << pointI
|
||||
<< " coord:" << coords[pointI]
|
||||
<< " connected to transformed slave points:" << endl;
|
||||
|
||||
forAll(transformedSlavePoints, i)
|
||||
{
|
||||
Pout<< " " << coords[transformedSlavePoints[i]]
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Test:(collocated) point to cells addressing
|
||||
// Test:print shared edges
|
||||
{
|
||||
const labelList& boundaryCells = globalData.boundaryCells();
|
||||
const labelListList& globalPointBoundaryCells =
|
||||
globalData.globalPointBoundaryCells();
|
||||
const mapDistribute& globalPointBoundaryCellsMap =
|
||||
globalData.globalPointBoundaryCellsMap();
|
||||
|
||||
pointField cc(globalPointBoundaryCellsMap.constructSize());
|
||||
forAll(boundaryCells, i)
|
||||
{
|
||||
cc[i] = mesh.cellCentres()[boundaryCells[i]];
|
||||
}
|
||||
|
||||
// Exchange data
|
||||
globalPointBoundaryCellsMap.distribute(cc);
|
||||
|
||||
// Print
|
||||
forAll(globalPointBoundaryCells, pointI)
|
||||
{
|
||||
const labelList& bCells = globalPointBoundaryCells[pointI];
|
||||
|
||||
Pout<< "Point:" << pointI
|
||||
<< " at:" << coupledPatch.localPoints()[pointI]
|
||||
<< " connected to cells:" << endl;
|
||||
|
||||
forAll(bCells, i)
|
||||
{
|
||||
Pout<< " " << cc[bCells[i]] << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Test:print (collocated) shared edges
|
||||
{
|
||||
const labelListList& globalEdgeSlaves =
|
||||
globalData.globalEdgeSlaves();
|
||||
const mapDistribute& globalEdgeSlavesMap =
|
||||
globalData.globalEdgeSlavesMap();
|
||||
const labelListList& slaves =
|
||||
globalData.globalEdgeSlaves();
|
||||
const labelListList& transformedSlaves =
|
||||
globalData.globalEdgeTransformedSlaves();
|
||||
|
||||
// Test: distribute edge centres
|
||||
pointField ec(globalEdgeSlavesMap.constructSize());
|
||||
@ -188,13 +126,13 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
}
|
||||
|
||||
// Exchange data
|
||||
globalEdgeSlavesMap.distribute(ec);
|
||||
// Exchange data Apply positional transforms.
|
||||
globalEdgeSlavesMap.distribute(transforms, ec, true);
|
||||
|
||||
// Print
|
||||
forAll(globalEdgeSlaves, edgeI)
|
||||
forAll(slaves, edgeI)
|
||||
{
|
||||
const labelList& slaveEdges = globalEdgeSlaves[edgeI];
|
||||
const labelList& slaveEdges = slaves[edgeI];
|
||||
|
||||
if (slaveEdges.size() > 0)
|
||||
{
|
||||
@ -207,10 +145,102 @@ int main(int argc, char *argv[])
|
||||
Pout<< " " << ec[slaveEdges[i]] << endl;
|
||||
}
|
||||
}
|
||||
const labelList& transformedSlaveEdges = transformedSlaves[edgeI];
|
||||
|
||||
if (transformedSlaveEdges.size() > 0)
|
||||
{
|
||||
Pout<< "Master edge:" << edgeI
|
||||
<< " centre:" << ec[edgeI]
|
||||
<< " connected to transformed slave edges:" << endl;
|
||||
|
||||
forAll(transformedSlaveEdges, i)
|
||||
{
|
||||
Pout<< " " << ec[transformedSlaveEdges[i]]
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// Test: (collocated) point to faces addressing
|
||||
//{
|
||||
// const labelListList& globalPointBoundaryFaces =
|
||||
// globalData.globalPointBoundaryFaces();
|
||||
// const mapDistribute& globalPointBoundaryFacesMap =
|
||||
// globalData.globalPointBoundaryFacesMap();
|
||||
//
|
||||
// label nBnd = mesh.nFaces()-mesh.nInternalFaces();
|
||||
//
|
||||
// pointField fc(globalPointBoundaryFacesMap.constructSize());
|
||||
// SubList<point>(fc, nBnd).assign
|
||||
// (
|
||||
// primitivePatch
|
||||
// (
|
||||
// SubList<face>
|
||||
// (
|
||||
// mesh.faces(),
|
||||
// nBnd,
|
||||
// mesh.nInternalFaces()
|
||||
// ),
|
||||
// mesh.points()
|
||||
// ).faceCentres()
|
||||
// );
|
||||
//
|
||||
// // Exchange data
|
||||
// globalPointBoundaryFacesMap.distribute(fc);
|
||||
//
|
||||
// // Print
|
||||
// forAll(globalPointBoundaryFaces, pointI)
|
||||
// {
|
||||
// const labelList& bFaces = globalPointBoundaryFaces[pointI];
|
||||
//
|
||||
// Pout<< "Point:" << pointI
|
||||
// << " at:" << coupledPatch.localPoints()[pointI]
|
||||
// << " connected to faces:" << endl;
|
||||
//
|
||||
// forAll(bFaces, i)
|
||||
// {
|
||||
// Pout<< " " << fc[bFaces[i]] << endl;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//
|
||||
//// Test:(collocated) point to cells addressing
|
||||
//{
|
||||
// const labelList& boundaryCells = globalData.boundaryCells();
|
||||
// const labelListList& globalPointBoundaryCells =
|
||||
// globalData.globalPointBoundaryCells();
|
||||
// const mapDistribute& globalPointBoundaryCellsMap =
|
||||
// globalData.globalPointBoundaryCellsMap();
|
||||
//
|
||||
// pointField cc(globalPointBoundaryCellsMap.constructSize());
|
||||
// forAll(boundaryCells, i)
|
||||
// {
|
||||
// cc[i] = mesh.cellCentres()[boundaryCells[i]];
|
||||
// }
|
||||
//
|
||||
// // Exchange data
|
||||
// globalPointBoundaryCellsMap.distribute(cc);
|
||||
//
|
||||
// // Print
|
||||
// forAll(globalPointBoundaryCells, pointI)
|
||||
// {
|
||||
// const labelList& bCells = globalPointBoundaryCells[pointI];
|
||||
//
|
||||
// Pout<< "Point:" << pointI
|
||||
// << " at:" << coupledPatch.localPoints()[pointI]
|
||||
// << " connected to cells:" << endl;
|
||||
//
|
||||
// forAll(bCells, i)
|
||||
// {
|
||||
// Pout<< " " << cc[bCells[i]] << endl;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
Test-lduMatrix3.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-lduMatrix
|
||||
@ -1,4 +0,0 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
EXE_LIBS = -lfiniteVolume
|
||||
@ -1,163 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "fvMesh.H"
|
||||
#include "volFields.H"
|
||||
#include "LduMatrix.H"
|
||||
#include "diagTensorField.H"
|
||||
#include "TPCG.H"
|
||||
#include "TPBiCG.H"
|
||||
#include "NoPreconditioner.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
typedef Foam::LduMatrix<vector, diagTensor, scalar>
|
||||
lduVectorMatrix;
|
||||
defineNamedTemplateTypeNameAndDebug(lduVectorMatrix, 0);
|
||||
|
||||
typedef Foam::DiagonalSolver<vector, diagTensor, scalar>
|
||||
lduVectorDiagonalSolver;
|
||||
defineNamedTemplateTypeNameAndDebug(lduVectorDiagonalSolver, 0);
|
||||
|
||||
template<>
|
||||
const vector lduVectorMatrix::great_(1e15, 1e15, 1e15);
|
||||
|
||||
template<>
|
||||
const vector lduVectorMatrix::small_(1e-15, 1e-15, 1e-15);
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef LduMatrix<vector, diagTensor, scalar>::preconditioner
|
||||
lduVectorPreconditioner;
|
||||
defineTemplateRunTimeSelectionTable(lduVectorPreconditioner, symMatrix);
|
||||
defineTemplateRunTimeSelectionTable(lduVectorPreconditioner, asymMatrix);
|
||||
|
||||
typedef LduMatrix<vector, diagTensor, scalar>::smoother
|
||||
lduVectorSmoother;
|
||||
defineTemplateRunTimeSelectionTable(lduVectorSmoother, symMatrix);
|
||||
defineTemplateRunTimeSelectionTable(lduVectorSmoother, asymMatrix);
|
||||
|
||||
typedef LduMatrix<vector, diagTensor, scalar>::solver
|
||||
lduVectorSolver;
|
||||
defineTemplateRunTimeSelectionTable(lduVectorSolver, symMatrix);
|
||||
defineTemplateRunTimeSelectionTable(lduVectorSolver, asymMatrix);
|
||||
|
||||
typedef TPCG<vector, diagTensor, scalar> TPCGVector;
|
||||
defineNamedTemplateTypeNameAndDebug(TPCGVector, 0);
|
||||
|
||||
LduMatrix<vector, diagTensor, scalar>::solver::
|
||||
addsymMatrixConstructorToTable<TPCGVector>
|
||||
addTPCGSymMatrixConstructorToTable_;
|
||||
|
||||
typedef TPBiCG<vector, diagTensor, scalar> TPBiCGVector;
|
||||
defineNamedTemplateTypeNameAndDebug(TPBiCGVector, 0);
|
||||
|
||||
LduMatrix<vector, diagTensor, scalar>::solver::
|
||||
addasymMatrixConstructorToTable<TPBiCGVector>
|
||||
addTPBiCGSymMatrixConstructorToTable_;
|
||||
|
||||
typedef NoPreconditioner<vector, diagTensor, scalar> NoPreconditionerVector;
|
||||
defineNamedTemplateTypeNameAndDebug(NoPreconditionerVector, 0);
|
||||
|
||||
LduMatrix<vector, diagTensor, scalar>::preconditioner::
|
||||
addsymMatrixConstructorToTable<NoPreconditionerVector>
|
||||
addNoPreconditionerSymMatrixConstructorToTable_;
|
||||
|
||||
LduMatrix<vector, diagTensor, scalar>::preconditioner::
|
||||
addasymMatrixConstructorToTable<NoPreconditionerVector>
|
||||
addNoPreconditionerAsymMatrixConstructorToTable_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "setRootCase.H"
|
||||
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
|
||||
volVectorField psi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
lduVectorMatrix testMatrix(mesh);
|
||||
testMatrix.diag() = 2*pTraits<diagTensor>::one;
|
||||
testMatrix.source() = pTraits<vector>::one;
|
||||
testMatrix.upper() = 0.1;
|
||||
testMatrix.lower() = -0.1;
|
||||
|
||||
Info<< testMatrix << endl;
|
||||
|
||||
FieldField<Field, scalar> boundaryCoeffs(0);
|
||||
FieldField<Field, scalar> internalCoeffs(0);
|
||||
|
||||
autoPtr<lduVectorMatrix::solver> testMatrixSolver =
|
||||
lduVectorMatrix::solver::New
|
||||
(
|
||||
psi.name(),
|
||||
testMatrix,
|
||||
boundaryCoeffs,
|
||||
internalCoeffs,
|
||||
psi.boundaryField().interfaces(),
|
||||
IStringStream
|
||||
(
|
||||
"PBiCG"
|
||||
"{"
|
||||
" preconditioner none;"
|
||||
" tolerance (1e-05 1e-05 1e-05);"
|
||||
" relTol (0 0 0);"
|
||||
"}"
|
||||
)()
|
||||
);
|
||||
|
||||
lduVectorMatrix::solverPerformance solverPerf =
|
||||
testMatrixSolver->solve(psi);
|
||||
|
||||
solverPerf.print();
|
||||
|
||||
Info<< psi << endl;
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,163 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "fvMesh.H"
|
||||
#include "volFields.H"
|
||||
#include "LduMatrix.H"
|
||||
#include "tensorField.H"
|
||||
#include "TPCG.H"
|
||||
#include "TPBiCG.H"
|
||||
#include "NoPreconditioner.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
typedef Foam::LduMatrix<vector, tensor, scalar>
|
||||
lduVectorMatrix;
|
||||
defineNamedTemplateTypeNameAndDebug(lduVectorMatrix, 0);
|
||||
|
||||
typedef Foam::DiagonalSolver<vector, tensor, scalar>
|
||||
lduVectorDiagonalSolver;
|
||||
defineNamedTemplateTypeNameAndDebug(lduVectorDiagonalSolver, 0);
|
||||
|
||||
template<>
|
||||
const vector lduVectorMatrix::great_(1e15, 1e15, 1e15);
|
||||
|
||||
template<>
|
||||
const vector lduVectorMatrix::small_(1e-15, 1e-15, 1e-15);
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef LduMatrix<vector, tensor, scalar>::preconditioner
|
||||
lduVectorPreconditioner;
|
||||
defineTemplateRunTimeSelectionTable(lduVectorPreconditioner, symMatrix);
|
||||
defineTemplateRunTimeSelectionTable(lduVectorPreconditioner, asymMatrix);
|
||||
|
||||
typedef LduMatrix<vector, tensor, scalar>::smoother
|
||||
lduVectorSmoother;
|
||||
defineTemplateRunTimeSelectionTable(lduVectorSmoother, symMatrix);
|
||||
defineTemplateRunTimeSelectionTable(lduVectorSmoother, asymMatrix);
|
||||
|
||||
typedef LduMatrix<vector, tensor, scalar>::solver
|
||||
lduVectorSolver;
|
||||
defineTemplateRunTimeSelectionTable(lduVectorSolver, symMatrix);
|
||||
defineTemplateRunTimeSelectionTable(lduVectorSolver, asymMatrix);
|
||||
|
||||
typedef TPCG<vector, tensor, scalar> TPCGVector;
|
||||
defineNamedTemplateTypeNameAndDebug(TPCGVector, 0);
|
||||
|
||||
LduMatrix<vector, tensor, scalar>::solver::
|
||||
addsymMatrixConstructorToTable<TPCGVector>
|
||||
addTPCGSymMatrixConstructorToTable_;
|
||||
|
||||
typedef TPBiCG<vector, tensor, scalar> TPBiCGVector;
|
||||
defineNamedTemplateTypeNameAndDebug(TPBiCGVector, 0);
|
||||
|
||||
LduMatrix<vector, tensor, scalar>::solver::
|
||||
addasymMatrixConstructorToTable<TPBiCGVector>
|
||||
addTPBiCGSymMatrixConstructorToTable_;
|
||||
|
||||
typedef NoPreconditioner<vector, tensor, scalar> NoPreconditionerVector;
|
||||
defineNamedTemplateTypeNameAndDebug(NoPreconditionerVector, 0);
|
||||
|
||||
LduMatrix<vector, tensor, scalar>::preconditioner::
|
||||
addsymMatrixConstructorToTable<NoPreconditionerVector>
|
||||
addNoPreconditionerSymMatrixConstructorToTable_;
|
||||
|
||||
LduMatrix<vector, tensor, scalar>::preconditioner::
|
||||
addasymMatrixConstructorToTable<NoPreconditionerVector>
|
||||
addNoPreconditionerAsymMatrixConstructorToTable_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "setRootCase.H"
|
||||
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
|
||||
volVectorField psi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
lduVectorMatrix testMatrix(mesh);
|
||||
testMatrix.diag() = 2*I;
|
||||
testMatrix.source() = pTraits<vector>::one;
|
||||
testMatrix.upper() = 0.1;
|
||||
testMatrix.lower() = -0.1;
|
||||
|
||||
Info<< testMatrix << endl;
|
||||
|
||||
FieldField<Field, scalar> boundaryCoeffs(0);
|
||||
FieldField<Field, scalar> internalCoeffs(0);
|
||||
|
||||
autoPtr<lduVectorMatrix::solver> testMatrixSolver =
|
||||
lduVectorMatrix::solver::New
|
||||
(
|
||||
psi.name(),
|
||||
testMatrix,
|
||||
//boundaryCoeffs,
|
||||
//internalCoeffs,
|
||||
//psi.boundaryField().interfaces(),
|
||||
IStringStream
|
||||
(
|
||||
"PBiCG"
|
||||
"{"
|
||||
" preconditioner none;"
|
||||
" tolerance (1e-05 1e-05 1e-05);"
|
||||
" relTol (0 0 0);"
|
||||
"}"
|
||||
)()
|
||||
);
|
||||
|
||||
lduVectorMatrix::solverPerformance solverPerf =
|
||||
testMatrixSolver->solve(psi);
|
||||
|
||||
solverPerf.print();
|
||||
|
||||
Info<< psi << endl;
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,148 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
icoFoam
|
||||
|
||||
Description
|
||||
Transient solver for incompressible, laminar flow of Newtonian fluids.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "LduMatrix.H"
|
||||
#include "diagTensorField.H"
|
||||
|
||||
typedef LduMatrix<vector, scalar, scalar> lduVectorMatrix;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "setRootCase.H"
|
||||
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
# include "createFields.H"
|
||||
# include "initContinuityErrs.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.loop())
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
# include "readPISOControls.H"
|
||||
# include "CourantNo.H"
|
||||
|
||||
fvVectorMatrix UEqn
|
||||
(
|
||||
fvm::ddt(U)
|
||||
+ fvm::div(phi, U)
|
||||
- fvm::laplacian(nu, U)
|
||||
);
|
||||
|
||||
fvVectorMatrix UEqnp(UEqn == -fvc::grad(p));
|
||||
|
||||
lduVectorMatrix U3Eqnp(mesh);
|
||||
U3Eqnp.diag() = UEqnp.diag();
|
||||
U3Eqnp.upper() = UEqnp.upper();
|
||||
U3Eqnp.lower() = UEqnp.lower();
|
||||
U3Eqnp.source() = UEqnp.source();
|
||||
|
||||
UEqnp.addBoundaryDiag(U3Eqnp.diag(), 0);
|
||||
UEqnp.addBoundarySource(U3Eqnp.source(), false);
|
||||
|
||||
autoPtr<lduVectorMatrix::solver> U3EqnpSolver =
|
||||
lduVectorMatrix::solver::New
|
||||
(
|
||||
U.name(),
|
||||
U3Eqnp,
|
||||
dictionary
|
||||
(
|
||||
IStringStream
|
||||
(
|
||||
"{"
|
||||
" solver PBiCG;"
|
||||
" preconditioner DILU;"
|
||||
" tolerance (1e-13 1e-13 1e-13);"
|
||||
" relTol (0 0 0);"
|
||||
"}"
|
||||
)()
|
||||
)
|
||||
);
|
||||
|
||||
U3EqnpSolver->solve(U).print(Info);
|
||||
|
||||
// --- PISO loop
|
||||
|
||||
for (int corr=0; corr<nCorr; corr++)
|
||||
{
|
||||
volScalarField rAU(1.0/UEqn.A());
|
||||
|
||||
U = rAU*UEqn.H();
|
||||
phi = (fvc::interpolate(U) & mesh.Sf())
|
||||
+ fvc::ddtPhiCorr(rAU, U, phi);
|
||||
|
||||
adjustPhi(phi, U, p);
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::laplacian(rAU, p) == fvc::div(phi)
|
||||
);
|
||||
|
||||
pEqn.setReference(pRefCell, pRefValue);
|
||||
pEqn.solve();
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phi -= pEqn.flux();
|
||||
}
|
||||
}
|
||||
|
||||
# include "continuityErrs.H"
|
||||
|
||||
U -= rAU*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
}
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,56 +0,0 @@
|
||||
Info<< "Reading transportProperties\n" << endl;
|
||||
|
||||
IOdictionary transportProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"transportProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
dimensionedScalar nu
|
||||
(
|
||||
transportProperties.lookup("nu")
|
||||
);
|
||||
|
||||
|
||||
Info<< "Reading field p\n" << endl;
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
|
||||
# include "createPhi.H"
|
||||
|
||||
|
||||
label pRefCell = 0;
|
||||
scalar pRefValue = 0.0;
|
||||
setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);
|
||||
@ -1,2 +1,2 @@
|
||||
Test-pTraits.C
|
||||
EXE = $(FOAM_USER_APPBIN)/pTraits
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-pTraits
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -129,7 +129,7 @@ int main(int argc, char *argv[])
|
||||
mapDistribute map(constructSize, sendMap.xfer(), recvMap.xfer());
|
||||
|
||||
// Distribute complexData
|
||||
mapDistribute::distribute(complexData);
|
||||
map.distribute(complexData);
|
||||
|
||||
Pout<< "complexData:" << complexData << endl;
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
Test-simpleMatrix.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/simpleMatrix
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-simpleMatrix
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -522,7 +522,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
|
||||
const boundBox& bb = mesh.globalData().bb();
|
||||
const boundBox& bb = mesh.bounds();
|
||||
const vector span = bb.span();
|
||||
const scalar mergeDim = 1E-4 * bb.minDim();
|
||||
|
||||
|
||||
@ -34,22 +34,22 @@ EXE_LIBS = \
|
||||
-llaminarFlameSpeedModels \
|
||||
-lLESdeltas \
|
||||
-lLESfilters \
|
||||
-lliquidMixture \
|
||||
-lliquids \
|
||||
-lliquidMixtureProperties \
|
||||
-lliquidProperties \
|
||||
-lmeshTools \
|
||||
-lmolecularMeasurements \
|
||||
-lmolecule \
|
||||
-lODE \
|
||||
-lOpenFOAM \
|
||||
-lpdf \
|
||||
-ldistributionModels \
|
||||
-lpotential \
|
||||
-lradiation \
|
||||
-lradiationModels \
|
||||
-lrandomProcesses \
|
||||
-lreactionThermophysicalModels \
|
||||
-lsampling \
|
||||
-lpointSolidMixture \
|
||||
-lsolidMixtureProperties \
|
||||
-lsolidParticle \
|
||||
-lpointSolids \
|
||||
-lsolidProperties \
|
||||
-lspecie \
|
||||
-lsurfMesh \
|
||||
-lsystemCall \
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -44,7 +44,8 @@ inline bool writeMeshObject
|
||||
(
|
||||
const word& name,
|
||||
const fileName& meshDir,
|
||||
Time& runTime
|
||||
Time& runTime,
|
||||
bool disableHeaderChecking = false
|
||||
)
|
||||
{
|
||||
IOobject io
|
||||
@ -67,14 +68,21 @@ inline bool writeMeshObject
|
||||
|
||||
// Switch off type checking (for reading e.g. faceZones as
|
||||
// generic list of dictionaries).
|
||||
const word oldTypeName = T::typeName;
|
||||
const_cast<word&>(T::typeName) = word::null;
|
||||
word oldTypeName;
|
||||
if (disableHeaderChecking)
|
||||
{
|
||||
oldTypeName = T::typeName;
|
||||
const_cast<word&>(T::typeName) = word::null;
|
||||
}
|
||||
|
||||
T meshObject(io);
|
||||
|
||||
const_cast<word&>(T::typeName) = oldTypeName;
|
||||
// Fake type back to what was in field
|
||||
const_cast<word&>(meshObject.type()) = io.headerClassName();
|
||||
if (disableHeaderChecking)
|
||||
{
|
||||
const_cast<word&>(T::typeName) = oldTypeName;
|
||||
// Fake type back to what was in field
|
||||
const_cast<word&>(meshObject.type()) = io.headerClassName();
|
||||
}
|
||||
|
||||
Info<< " Writing " << name << endl;
|
||||
writeOk = meshObject.regIOobject::write();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -910,7 +910,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
args,
|
||||
runTime,
|
||||
mesh.globalData().bb()
|
||||
mesh.bounds()
|
||||
);
|
||||
|
||||
// Mesh distribution engine
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/pdfs/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lpdf \
|
||||
-ldistributionModels \
|
||||
-lsampling
|
||||
|
||||
@ -22,7 +22,14 @@
|
||||
|
||||
cachedRandom rndGen(label(0), -1);
|
||||
|
||||
autoPtr<pdfs::pdf> p(pdfs::pdf::New(pdfDictionary, rndGen));
|
||||
autoPtr<distributionModels::distributionModel> p
|
||||
(
|
||||
distributionModels::distributionModel::New
|
||||
(
|
||||
pdfDictionary,
|
||||
rndGen
|
||||
)
|
||||
);
|
||||
|
||||
const scalar xMin = p->minValue();
|
||||
const scalar xMax = p->maxValue();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,7 +27,7 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "pdf.H"
|
||||
#include "distributionModel.H"
|
||||
#include "makeGraph.H"
|
||||
#include "OFstream.H"
|
||||
|
||||
|
||||
@ -38,6 +38,16 @@ setFormat raw;
|
||||
// but without any values!
|
||||
surfaceFormat vtk;
|
||||
|
||||
// optionally define extra controls for the output formats
|
||||
formatOptions
|
||||
{
|
||||
ensight
|
||||
{
|
||||
format ascii;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// interpolationScheme. choice of
|
||||
// cell : use cell-centre value only; constant over cells (default)
|
||||
// cellPoint : use cell-centre and vertex values
|
||||
@ -231,6 +241,7 @@ surfaces
|
||||
// Sampling on triSurface
|
||||
type sampledTriSurfaceMesh;
|
||||
surface integrationPlane.stl;
|
||||
source boundaryFaces; // sample cells or boundaryFaces
|
||||
interpolate true;
|
||||
}
|
||||
);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -311,8 +311,9 @@ void rewriteField
|
||||
{
|
||||
IOWarningIn("rewriteField(..)", patchDict)
|
||||
<< "Cyclic patch " << patchName
|
||||
<< " has value entry. Please remove this and rerun."
|
||||
<< " has value entry. This will be removed."
|
||||
<< endl;
|
||||
patchDict.remove("value");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -208,7 +208,7 @@ int main(int argc, char *argv[])
|
||||
const scalar searchTol = args.optionLookupOrDefault("tol", 1e-3);
|
||||
|
||||
// Get search box. Anything not within this box will not be considered.
|
||||
const boundBox& meshBb = mesh.globalData().bb();
|
||||
const boundBox& meshBb = mesh.bounds();
|
||||
const vector searchSpan = searchTol * meshBb.span();
|
||||
|
||||
Info<< "All boundary faces further away than " << searchTol
|
||||
|
||||
43
bin/foamExec
43
bin/foamExec
@ -3,7 +3,7 @@
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
# \\/ M anipulation |
|
||||
#-------------------------------------------------------------------------------
|
||||
# License
|
||||
@ -59,10 +59,10 @@ USAGE
|
||||
# This script must exist in <foamInstall>/OpenFOAM-<VERSION>/bin/
|
||||
# or <foamInstall>/openfoam<VERSION>/bin/ (for the debian version)
|
||||
#
|
||||
# foamEtcFile is found in the same directory
|
||||
# foamEtcFile must be found in the same directory as this script
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
unset etcOpts
|
||||
unset etcOpts version
|
||||
# parse options
|
||||
while [ "$#" -gt 0 ]
|
||||
do
|
||||
@ -72,7 +72,13 @@ do
|
||||
;;
|
||||
-v | -version)
|
||||
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
|
||||
etcOpts="-version $2"
|
||||
version="$2"
|
||||
etcOpts="$etcOpts $1 $2" # pass-thru to foamEtcFile
|
||||
shift
|
||||
;;
|
||||
-m | -mode | -p | -prefix)
|
||||
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
|
||||
etcOpts="$etcOpts $1 $2" # pass-thru to foamEtcFile
|
||||
shift
|
||||
;;
|
||||
--)
|
||||
@ -89,19 +95,28 @@ do
|
||||
shift
|
||||
done
|
||||
|
||||
[ "$#" -ge 1 ] || usage "no application specified"
|
||||
|
||||
# find OpenFOAM settings (bashrc)
|
||||
foamDotFile="$(${0%/*}/foamEtcFile $etcOpts bashrc)" || {
|
||||
echo "Error : bashrc file could not be found for OpenFOAM-$version" 1>&2
|
||||
exit 1
|
||||
#
|
||||
# Find and source OpenFOAM settings (bashrc)
|
||||
# placed in function to preserve command-line arguments
|
||||
#
|
||||
sourceRc()
|
||||
{
|
||||
# default is the current version
|
||||
: ${version:=${WM_PROJECT_VERSION:-unknown}}
|
||||
|
||||
foamDotFile="$(${0%/*}/foamEtcFile $etcOpts bashrc)" || {
|
||||
echo "Error : bashrc file could not be found for OpenFOAM-$version" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
. $foamDotFile
|
||||
}
|
||||
|
||||
# preserve arguments (can otherwise get lost when sourcing the foamDotFile)
|
||||
args="$*"
|
||||
. $foamDotFile
|
||||
|
||||
# execute
|
||||
exec $args
|
||||
[ "$#" -ge 1 ] || usage "no application specified"
|
||||
|
||||
sourceRc
|
||||
exec "$@"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
# \\/ M anipulation |
|
||||
#-------------------------------------------------------------------------------
|
||||
# License
|
||||
@ -145,12 +145,12 @@ fi
|
||||
# use FOAM_SETTINGS to pass command-line settings
|
||||
if [ "$FOAM_INST_DIR" ]
|
||||
then
|
||||
sourceFoam='[ "$WM_PROJECT" ] || '"FOAM_INST_DIR=$FOAM_INST_DIR . $sourceFoam $FOAM_SETTINGS"
|
||||
sourceFoam="FOAM_INST_DIR=$FOAM_INST_DIR . $sourceFoam $FOAM_SETTINGS"
|
||||
else
|
||||
sourceFoam='[ "$WM_PROJECT" ] || '". $sourceFoam $FOAM_SETTINGS"
|
||||
sourceFoam=". $sourceFoam $FOAM_SETTINGS"
|
||||
fi
|
||||
|
||||
echo "**sourceFoam:$sourceFoam $FOAM_SETTINGS"
|
||||
echo "**sourceFoam:$sourceFoam"
|
||||
|
||||
rm -f $PWD/mpirun.schema
|
||||
touch $PWD/mpirun.schema
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
2010-05-28
|
||||
http://www.openfoam.com
|
||||
Copyright (c) 2011 OpenCFD Ltd.
|
||||
|
||||
Cleanup of automatic regIOobject rereading.
|
||||
|
||||
- all files (usually only IOdictionary) that need to be monitored
|
||||
|
||||
41
doc/changes/pointAndEdgeSync.txt
Normal file
41
doc/changes/pointAndEdgeSync.txt
Normal file
@ -0,0 +1,41 @@
|
||||
http://www.openfoam.com
|
||||
Copyright (c) 2011 OpenCFD Ltd.
|
||||
|
||||
Some background on the new structure to synchronise point and edge data. The
|
||||
building blocks:
|
||||
- globalIndex : globally consecutive numbering of (untransformed) data. It
|
||||
consists of a single label which starts at 0 on processor 0 and is numbered
|
||||
consecutively on consecutive processors. The globalIndex class contains
|
||||
functions to convert to/from processor and local index.
|
||||
|
||||
- globalIndexAndTransform : all the transformations in a mesh. Because the
|
||||
transformations (cyclics, processorCyclics) need to fill space there can
|
||||
be only three independent transforms. This class contains functions to encode
|
||||
local index,processor and transformation into a labelPair.
|
||||
|
||||
- mapDistribute : contains constructors from local and remote data and
|
||||
works out a compact storage scheme and returns corresponding indices into
|
||||
the local storage and calculates a scheduling to get the local and remote
|
||||
data into the local storage. The wanted data is
|
||||
- untransformed: labelList(List) in globalIndex numbering
|
||||
- transformed: labelPairList(List) in globalIndexAndTransform
|
||||
See also mapDistribute.H
|
||||
|
||||
- globalMeshData : works out and stores a mapDistribute to get hold
|
||||
of coupled point or edge data:
|
||||
- globalPointSlavesMap() : the map to get all coupled point data
|
||||
into a compact form
|
||||
- globalPointSlaves : per point (on the patch of coupled faces) the
|
||||
indices into the compact data corresponding to untransformed connected
|
||||
points
|
||||
- globalPointTransformedSlaves : same but for transformed connected
|
||||
points
|
||||
See e.g. syncPointData which applies a reduction operator to data on
|
||||
coupled points. Note that it needs to know whether the data is a position
|
||||
(since might need separation() vector).
|
||||
|
||||
These structures get used in e.g.
|
||||
- syncTools : general synchronisation on points,edges, faces. The point and
|
||||
edge synchronisation are thin wrappers around the globalMeshData functionality.
|
||||
- volPointInterpolation : uses a mix of globalMeshData (for synchronising
|
||||
collocated points) and patch-wise (for separated points).
|
||||
@ -1,3 +1,6 @@
|
||||
http://www.openfoam.com
|
||||
Copyright (c) 2011 OpenCFD Ltd.
|
||||
|
||||
Short overview of the changes to have cyclics split into two halves.
|
||||
|
||||
Cyclics
|
||||
|
||||
@ -1,5 +1,13 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
|
||||
[ -d "$WM_PROJECT_DIR" ] || {
|
||||
echo "Error: WM_PROJECT_DIR directory does not exist"
|
||||
echo " Check the OpenFOAM entries in your dot-files and source them."
|
||||
echo " WM_PROJECT_DIR=$WM_PROJECT_DIR"
|
||||
exit 1
|
||||
}
|
||||
|
||||
set -x
|
||||
|
||||
rm -rf latex man
|
||||
|
||||
@ -760,7 +760,7 @@ ALPHABETICAL_INDEX = YES
|
||||
# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
|
||||
# in which this list will be split (can be a number in the range [1..20])
|
||||
|
||||
COLS_IN_ALPHA_INDEX = 4
|
||||
COLS_IN_ALPHA_INDEX = 1
|
||||
|
||||
# In case all classes in a project start with a common prefix, all
|
||||
# classes will be put under the same header in the alphabetical index.
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
</div> <!-- main -->
|
||||
<div class="footer">
|
||||
<p>
|
||||
Copyright © 2000-2010
|
||||
Copyright © 2004-2011
|
||||
<a href="http://www.openfoam.com/about">OpenCFD Limited</a>
|
||||
| OPENFOAM® and OpenCFD® are registered trademarks of OpenCFD Ltd.
|
||||
</p>
|
||||
|
||||
@ -52,7 +52,7 @@ alias foamPV 'source `$WM_PROJECT_DIR/etc/apps/paraview3/cshrc` ParaView_VERSION
|
||||
# Change directory aliases
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
alias src 'cd $FOAM_SRC'
|
||||
alias lib 'cd $FOAM_LIB'
|
||||
alias lib 'cd $FOAM_LIBBIN'
|
||||
alias run 'cd $FOAM_RUN'
|
||||
alias foam 'cd $WM_PROJECT_DIR'
|
||||
alias foamsrc 'cd $FOAM_SRC/$WM_PROJECT'
|
||||
|
||||
@ -57,7 +57,7 @@ foamPV()
|
||||
# Change directory aliases
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
alias src='cd $FOAM_SRC'
|
||||
alias lib='cd $FOAM_LIB'
|
||||
alias lib='cd $FOAM_LIBBIN'
|
||||
alias run='cd $FOAM_RUN'
|
||||
alias foam='cd $WM_PROJECT_DIR'
|
||||
alias foamsrc='cd $FOAM_SRC/$WM_PROJECT'
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
# \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
@ -44,9 +44,5 @@
|
||||
## ~~~~~~~~~~~~~~~~~~~~~~
|
||||
#setenv WM_MPLIB SYSTEMOPENMPI
|
||||
|
||||
# Specify ParaView version
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
setenv ParaView_VERSION git # eg, cvs/git version
|
||||
setenv ParaView_MAJOR 3.7
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
# \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
@ -44,9 +44,5 @@ foamCompiler=system
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~
|
||||
export WM_MPLIB=SYSTEMOPENMPI
|
||||
|
||||
# Specify ParaView version
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export ParaView_VERSION=git # eg, cvs/git version
|
||||
export ParaView_MAJOR=3.7
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
||||
@ -65,7 +65,7 @@ setenv FOAM_USER_LIBBIN $WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib
|
||||
|
||||
# convenience
|
||||
setenv FOAM_APP $WM_PROJECT_DIR/applications
|
||||
setenv FOAM_LIB $WM_PROJECT_DIR/lib
|
||||
#setenv FOAM_LIB $WM_PROJECT_DIR/lib
|
||||
setenv FOAM_SRC $WM_PROJECT_DIR/src
|
||||
setenv FOAM_TUTORIALS $WM_PROJECT_DIR/tutorials
|
||||
setenv FOAM_UTILITIES $FOAM_APP/utilities
|
||||
|
||||
@ -88,7 +88,7 @@ export FOAM_USER_LIBBIN=$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib
|
||||
|
||||
# convenience
|
||||
export FOAM_APP=$WM_PROJECT_DIR/applications
|
||||
export FOAM_LIB=$WM_PROJECT_DIR/lib
|
||||
#export FOAM_LIB=$WM_PROJECT_DIR/lib
|
||||
export FOAM_SRC=$WM_PROJECT_DIR/src
|
||||
export FOAM_TUTORIALS=$WM_PROJECT_DIR/tutorials
|
||||
export FOAM_UTILITIES=$FOAM_APP/utilities
|
||||
|
||||
67
src/Allwmake
67
src/Allwmake
@ -1,5 +1,6 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
[ $# -ge 1 ] && makeOption=$1 || makeOption=libso
|
||||
|
||||
wmakeCheckPwd "$WM_PROJECT_DIR/src" || {
|
||||
echo "Error: Current directory is not \$WM_PROJECT_DIR/src"
|
||||
@ -17,57 +18,57 @@ wmakeCheckPwd "$WM_PROJECT_DIR/src" || {
|
||||
set -x
|
||||
|
||||
# update OpenFOAM version strings if required
|
||||
wmakePrintBuild -check || /bin/rm -f OpenFOAM/Make/$WM_OPTIONS/global.? 2>/dev/null
|
||||
wmakePrintBuild -check || /bin/rm -f OpenFOAM/Make/*/global.? 2>/dev/null
|
||||
|
||||
wmakeLnInclude OpenFOAM
|
||||
wmakeLnInclude OSspecific/$WM_OSTYPE
|
||||
Pstream/Allwmake
|
||||
wmakeLnInclude OSspecific/${WM_OSTYPE:-POSIX}
|
||||
Pstream/Allwmake $*
|
||||
|
||||
OSspecific/$WM_OSTYPE/Allwmake
|
||||
wmake libso OpenFOAM
|
||||
OSspecific/${WM_OSTYPE:-POSIX}/Allwmake
|
||||
wmake $makeOption OpenFOAM
|
||||
|
||||
wmake libso fileFormats
|
||||
wmake libso triSurface
|
||||
wmake libso meshTools
|
||||
wmake libso edgeMesh
|
||||
wmake libso surfMesh
|
||||
wmake $makeOption fileFormats
|
||||
wmake $makeOption triSurface
|
||||
wmake $makeOption meshTools
|
||||
wmake $makeOption edgeMesh
|
||||
wmake $makeOption surfMesh
|
||||
|
||||
# Decomposition methods needed by dummyThirdParty
|
||||
parallel/decompose/AllwmakeLnInclude
|
||||
# dummyThirdParty (dummy metisDecomp, scotchDecomp etc) needed by e.g. meshTools
|
||||
dummyThirdParty/Allwmake
|
||||
dummyThirdParty/Allwmake $*
|
||||
|
||||
wmake libso lagrangian/basic
|
||||
wmake libso finiteVolume
|
||||
wmake libso genericPatchFields
|
||||
wmake $makeOption lagrangian/basic
|
||||
wmake $makeOption finiteVolume
|
||||
wmake $makeOption genericPatchFields
|
||||
|
||||
# Build the proper scotchDecomp, metisDecomp etc.
|
||||
parallel/Allwmake
|
||||
parallel/Allwmake $*
|
||||
|
||||
wmake libso conversion
|
||||
wmake $makeOption conversion
|
||||
|
||||
wmake libso sampling
|
||||
wmake $makeOption sampling
|
||||
|
||||
wmake libso dynamicMesh
|
||||
wmake libso dynamicFvMesh
|
||||
wmake libso topoChangerFvMesh
|
||||
wmake $makeOption dynamicMesh
|
||||
wmake $makeOption dynamicFvMesh
|
||||
wmake $makeOption topoChangerFvMesh
|
||||
|
||||
wmake libso ODE
|
||||
wmake libso randomProcesses
|
||||
wmake $makeOption ODE
|
||||
wmake $makeOption randomProcesses
|
||||
|
||||
thermophysicalModels/Allwmake
|
||||
transportModels/Allwmake
|
||||
turbulenceModels/Allwmake
|
||||
wmake libso surfaceFilmModels
|
||||
lagrangian/Allwmake
|
||||
postProcessing/Allwmake
|
||||
mesh/Allwmake
|
||||
thermophysicalModels/Allwmake $*
|
||||
transportModels/Allwmake $*
|
||||
turbulenceModels/Allwmake $*
|
||||
wmake $makeOption surfaceFilmModels
|
||||
lagrangian/Allwmake $*
|
||||
postProcessing/Allwmake $*
|
||||
mesh/Allwmake $*
|
||||
|
||||
wmake libso errorEstimation
|
||||
wmake $makeOption errorEstimation
|
||||
|
||||
fvAgglomerationMethods/Allwmake
|
||||
fvAgglomerationMethods/Allwmake $*
|
||||
|
||||
wmake libso fvMotionSolver
|
||||
wmake libso engine
|
||||
wmake $makeOption fvMotionSolver
|
||||
wmake $makeOption engine
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
||||
@ -9,6 +9,7 @@ $(bools)/bool/bool.C
|
||||
$(bools)/bool/boolIO.C
|
||||
$(bools)/Switch/Switch.C
|
||||
$(bools)/Switch/SwitchIO.C
|
||||
$(bools)/lists/boolList.C
|
||||
|
||||
chars = primitives/chars
|
||||
$(chars)/char/charIO.C
|
||||
@ -22,10 +23,16 @@ $(ints)/longLong/longLongIO.C
|
||||
$(ints)/ulong/ulongIO.C
|
||||
$(ints)/label/label.C
|
||||
$(ints)/uLabel/uLabel.C
|
||||
$(ints)/lists/labelIOList.C
|
||||
$(ints)/lists/labelListIOList.C
|
||||
|
||||
primitives/Scalar/doubleScalar/doubleScalar.C
|
||||
primitives/Scalar/floatScalar/floatScalar.C
|
||||
primitives/Scalar/scalar/scalar.C
|
||||
primitives/Scalar/lists/scalarList.C
|
||||
primitives/Scalar/lists/scalarIOList.C
|
||||
primitives/Scalar/lists/scalarListIOList.C
|
||||
|
||||
primitives/DiagTensor/diagTensor/diagTensor.C
|
||||
primitives/SphericalTensor/sphericalTensor/sphericalTensor.C
|
||||
primitives/SphericalTensor/labelSphericalTensor/labelSphericalTensor.C
|
||||
@ -33,18 +40,33 @@ primitives/SymmTensor/labelSymmTensor/labelSymmTensor.C
|
||||
primitives/SymmTensor/symmTensor/symmTensor.C
|
||||
primitives/Tensor/labelTensor/labelTensor.C
|
||||
primitives/Tensor/tensor/tensor.C
|
||||
primitives/Tensor/lists/sphericalTensorList.C
|
||||
primitives/Tensor/lists/symmTensorList.C
|
||||
primitives/Tensor/lists/tensorList.C
|
||||
|
||||
primitives/Vector/complexVector/complexVector.C
|
||||
primitives/Vector/labelVector/labelVector.C
|
||||
primitives/Vector/vector/vector.C
|
||||
primitives/Vector/lists/vectorList.C
|
||||
primitives/Vector/lists/vectorIOList.C
|
||||
primitives/Vector/lists/vectorListIOList.C
|
||||
|
||||
primitives/Tensor2D/tensor2D/tensor2D.C
|
||||
primitives/SphericalTensor2D/sphericalTensor2D/sphericalTensor2D.C
|
||||
primitives/Vector2D/vector2D/vector2D.C
|
||||
|
||||
primitives/complex/complex.C
|
||||
primitives/globalIndexAndTransform/globalIndexAndTransform.C
|
||||
primitives/globalIndexAndTransform/vectorTensorTransform/vectorTensorTransform.C
|
||||
primitives/quaternion/quaternion.C
|
||||
primitives/septernion/septernion.C
|
||||
|
||||
/* functions, data entries */
|
||||
primitives/functions/DataEntry/makeDataEntries.C
|
||||
primitives/functions/DataEntry/polynomial/polynomial.C
|
||||
primitives/functions/DataEntry/polynomial/polynomialIO.C
|
||||
|
||||
|
||||
strings = primitives/strings
|
||||
$(strings)/string/string.C
|
||||
$(strings)/string/stringIO.C
|
||||
@ -54,6 +76,7 @@ $(strings)/fileName/fileName.C
|
||||
$(strings)/fileName/fileNameIO.C
|
||||
$(strings)/keyType/keyType.C
|
||||
$(strings)/wordRe/wordRe.C
|
||||
$(strings)/lists/hashedWordList.C
|
||||
|
||||
primitives/hashes/Hasher/Hasher.C
|
||||
|
||||
@ -80,21 +103,6 @@ containers/Lists/ListOps/ListOps.C
|
||||
containers/LinkedLists/linkTypes/SLListBase/SLListBase.C
|
||||
containers/LinkedLists/linkTypes/DLListBase/DLListBase.C
|
||||
|
||||
primitiveLists = primitives/Lists
|
||||
$(primitiveLists)/boolList.C
|
||||
$(primitiveLists)/labelIOList.C
|
||||
$(primitiveLists)/labelListIOList.C
|
||||
$(primitiveLists)/scalarList.C
|
||||
$(primitiveLists)/scalarIOList.C
|
||||
$(primitiveLists)/scalarListIOList.C
|
||||
$(primitiveLists)/vectorList.C
|
||||
$(primitiveLists)/vectorIOList.C
|
||||
$(primitiveLists)/vectorListIOList.C
|
||||
$(primitiveLists)/sphericalTensorList.C
|
||||
$(primitiveLists)/symmTensorList.C
|
||||
$(primitiveLists)/tensorList.C
|
||||
$(primitiveLists)/hashedWordList.C
|
||||
|
||||
Streams = db/IOstreams
|
||||
$(Streams)/token/tokenIO.C
|
||||
|
||||
|
||||
675
src/OpenFOAM/containers/Lists/Distribution/Distribution.C
Normal file
675
src/OpenFOAM/containers/Lists/Distribution/Distribution.C
Normal file
@ -0,0 +1,675 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "Distribution.H"
|
||||
#include "OFstream.H"
|
||||
#include "ListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::Distribution<Type>::Distribution()
|
||||
:
|
||||
List< List<scalar> >(pTraits<Type>::nComponents),
|
||||
binWidth_(pTraits<Type>::one),
|
||||
listStarts_(pTraits<Type>::nComponents, 0)
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::Distribution<Type>::Distribution(const Type& binWidth)
|
||||
:
|
||||
List< List<scalar> >(pTraits<Type>::nComponents),
|
||||
binWidth_(binWidth),
|
||||
listStarts_(pTraits<Type>::nComponents, 0)
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::Distribution<Type>::Distribution(const Distribution<Type>& d)
|
||||
:
|
||||
List< List<scalar> >(static_cast< const List< List<scalar> >& >(d)),
|
||||
binWidth_(d.binWidth()),
|
||||
listStarts_(d.listStarts())
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::Distribution<Type>::~Distribution()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::scalar Foam::Distribution<Type>::totalWeight(direction cmpt) const
|
||||
{
|
||||
const List<scalar>& cmptDistribution = (*this)[cmpt];
|
||||
|
||||
scalar sumOfWeights = 0.0;
|
||||
|
||||
forAll(cmptDistribution, i)
|
||||
{
|
||||
sumOfWeights += cmptDistribution[i];
|
||||
}
|
||||
|
||||
return sumOfWeights;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::List<Foam::label> Foam::Distribution<Type>::keys(direction cmpt) const
|
||||
{
|
||||
List<label> keys = identity((*this)[cmpt].size());
|
||||
|
||||
forAll(keys, k)
|
||||
{
|
||||
keys[k] += listStarts_[cmpt];
|
||||
}
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::label Foam::Distribution<Type>::index
|
||||
(
|
||||
direction cmpt,
|
||||
label n
|
||||
)
|
||||
{
|
||||
List<scalar>& cmptDistribution = (*this)[cmpt];
|
||||
|
||||
if (cmptDistribution.empty())
|
||||
{
|
||||
// Initialise this list with this value
|
||||
|
||||
cmptDistribution.setSize(2, 0.0);
|
||||
|
||||
listStarts_[cmpt] = n;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
label listIndex = -1;
|
||||
|
||||
label& listStart = listStarts_[cmpt];
|
||||
|
||||
label testIndex = n - listStart;
|
||||
|
||||
if (testIndex < 0)
|
||||
{
|
||||
// Underflow of this List, storage increase and remapping
|
||||
// required
|
||||
|
||||
List<scalar> newCmptDistribution(2*cmptDistribution.size(), 0.0);
|
||||
|
||||
label sOld = cmptDistribution.size();
|
||||
|
||||
forAll(cmptDistribution, i)
|
||||
{
|
||||
newCmptDistribution[i + sOld] = cmptDistribution[i];
|
||||
}
|
||||
|
||||
cmptDistribution = newCmptDistribution;
|
||||
|
||||
listStart -= sOld;
|
||||
|
||||
// Recursively call this function in case another remap is required.
|
||||
listIndex = index(cmpt, n);
|
||||
}
|
||||
else if (testIndex > cmptDistribution.size() - 1)
|
||||
{
|
||||
// Overflow of this List, storage increase required
|
||||
|
||||
cmptDistribution.setSize(2*cmptDistribution.size(), 0.0);
|
||||
|
||||
// Recursively call this function in case another storage
|
||||
// alteration is required.
|
||||
listIndex = index(cmpt, n);
|
||||
}
|
||||
else
|
||||
{
|
||||
listIndex = n - listStart;
|
||||
}
|
||||
|
||||
return listIndex;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::Pair<Foam::label> Foam::Distribution<Type>::validLimits
|
||||
(
|
||||
direction cmpt
|
||||
) const
|
||||
{
|
||||
const List<scalar>& cmptDistribution = (*this)[cmpt];
|
||||
|
||||
// limits.first(): lower bound, i.e. the first non-zero entry
|
||||
// limits.second(): upper bound, i.e. the last non-zero entry
|
||||
Pair<label> limits(-1, -1);
|
||||
|
||||
forAll(cmptDistribution, i)
|
||||
{
|
||||
if (cmptDistribution[i] > 0.0)
|
||||
{
|
||||
if (limits.first() == -1)
|
||||
{
|
||||
limits.first() = i;
|
||||
limits.second() = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
limits.second() = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return limits;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Type Foam::Distribution<Type>::mean() const
|
||||
{
|
||||
Type meanValue(pTraits<Type>::zero);
|
||||
|
||||
for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
const List<scalar>& cmptDistribution = (*this)[cmpt];
|
||||
|
||||
scalar totalCmptWeight = totalWeight(cmpt);
|
||||
|
||||
List<label> theKeys = keys(cmpt);
|
||||
|
||||
forAll(theKeys, k)
|
||||
{
|
||||
label key = theKeys[k];
|
||||
|
||||
setComponent(meanValue, cmpt) +=
|
||||
(0.5 + scalar(key))
|
||||
*component(binWidth_, cmpt)
|
||||
*cmptDistribution[k]
|
||||
/totalCmptWeight;
|
||||
}
|
||||
}
|
||||
|
||||
return meanValue;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Type Foam::Distribution<Type>::median() const
|
||||
{
|
||||
Type medianValue(pTraits<Type>::zero);
|
||||
|
||||
List< List < Pair<scalar> > > normDistribution = normalised();
|
||||
|
||||
for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
List< Pair<scalar> >& normDist = normDistribution[cmpt];
|
||||
|
||||
if (normDist.size())
|
||||
{
|
||||
if (normDist.size() == 1)
|
||||
{
|
||||
setComponent(medianValue, cmpt) = normDist[0].first();
|
||||
}
|
||||
else if
|
||||
(
|
||||
normDist.size() > 1
|
||||
&& normDist[0].second()*component(binWidth_, cmpt) > 0.5
|
||||
)
|
||||
{
|
||||
scalar xk =
|
||||
normDist[0].first()
|
||||
+ 0.5*component(binWidth_, cmpt);
|
||||
|
||||
scalar xkm1 =
|
||||
normDist[0].first()
|
||||
- 0.5*component(binWidth_, cmpt);
|
||||
|
||||
scalar Sk = (normDist[0].second())*component(binWidth_, cmpt);
|
||||
|
||||
setComponent(medianValue, cmpt) = 0.5*(xk - xkm1)/(Sk) + xkm1;
|
||||
}
|
||||
else
|
||||
{
|
||||
label previousNonZeroIndex = 0;
|
||||
|
||||
scalar cumulative = 0.0;
|
||||
|
||||
forAll(normDist, nD)
|
||||
{
|
||||
if
|
||||
(
|
||||
cumulative
|
||||
+ (normDist[nD].second()*component(binWidth_, cmpt))
|
||||
> 0.5
|
||||
)
|
||||
{
|
||||
scalar xk =
|
||||
normDist[nD].first()
|
||||
+ 0.5*component(binWidth_, cmpt);
|
||||
|
||||
scalar xkm1 =
|
||||
normDist[previousNonZeroIndex].first()
|
||||
+ 0.5*component(binWidth_, cmpt);
|
||||
|
||||
scalar Sk =
|
||||
cumulative
|
||||
+ (normDist[nD].second()*component(binWidth_, cmpt));
|
||||
|
||||
scalar Skm1 = cumulative;
|
||||
|
||||
setComponent(medianValue, cmpt) =
|
||||
(0.5 - Skm1)*(xk - xkm1)/(Sk - Skm1) + xkm1;
|
||||
|
||||
break;
|
||||
}
|
||||
else if (mag(normDist[nD].second()) > VSMALL)
|
||||
{
|
||||
cumulative +=
|
||||
normDist[nD].second()*component(binWidth_, cmpt);
|
||||
|
||||
previousNonZeroIndex = nD;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return medianValue;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::Distribution<Type>::add
|
||||
(
|
||||
const Type& valueToAdd,
|
||||
const Type& weight
|
||||
)
|
||||
{
|
||||
for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
List<scalar>& cmptDistribution = (*this)[cmpt];
|
||||
|
||||
label n =
|
||||
label(component(valueToAdd, cmpt)/component(binWidth_, cmpt))
|
||||
- label(neg(component(valueToAdd, cmpt)/component(binWidth_, cmpt)));
|
||||
|
||||
label listIndex = index(cmpt, n);
|
||||
|
||||
cmptDistribution[listIndex] += component(weight, cmpt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::List< Foam::List< Foam::Pair<Foam::scalar> > >Foam::
|
||||
Distribution<Type>::normalised() const
|
||||
{
|
||||
List< List < Pair<scalar> > > normDistribution(pTraits<Type>::nComponents);
|
||||
|
||||
for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
const List<scalar>& cmptDistribution = (*this)[cmpt];
|
||||
|
||||
if (cmptDistribution.empty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
scalar totalCmptWeight = totalWeight(cmpt);
|
||||
|
||||
List<label> cmptKeys = keys(cmpt);
|
||||
|
||||
List< Pair<scalar> >& normDist = normDistribution[cmpt];
|
||||
|
||||
Pair<label> limits = validLimits(cmpt);
|
||||
|
||||
normDist.setSize(limits.second() - limits.first() + 1);
|
||||
|
||||
for
|
||||
(
|
||||
label k = limits.first(), i = 0;
|
||||
k <= limits.second();
|
||||
k++, i++
|
||||
)
|
||||
{
|
||||
label key = cmptKeys[k];
|
||||
|
||||
normDist[i].first() =
|
||||
(0.5 + scalar(key))*component(binWidth_, cmpt);
|
||||
|
||||
normDist[i].second() =
|
||||
cmptDistribution[k]
|
||||
/totalCmptWeight
|
||||
/component(binWidth_, cmpt);
|
||||
}
|
||||
}
|
||||
|
||||
return normDistribution;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::List< Foam::List< Foam::Pair<Foam::scalar> > >Foam::
|
||||
Distribution<Type>::raw() const
|
||||
{
|
||||
List< List < Pair<scalar> > > rawDistribution(pTraits<Type>::nComponents);
|
||||
|
||||
for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
const List<scalar>& cmptDistribution = (*this)[cmpt];
|
||||
|
||||
if (cmptDistribution.empty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
List<label> cmptKeys = keys(cmpt);
|
||||
|
||||
List< Pair<scalar> >& rawDist = rawDistribution[cmpt];
|
||||
|
||||
Pair<label> limits = validLimits(cmpt);
|
||||
|
||||
rawDist.setSize(limits.second() - limits.first() + 1);
|
||||
|
||||
for
|
||||
(
|
||||
label k = limits.first(), i = 0;
|
||||
k <= limits.second();
|
||||
k++, i++
|
||||
)
|
||||
{
|
||||
label key = cmptKeys[k];
|
||||
|
||||
rawDist[i].first() = (0.5 + scalar(key))*component(binWidth_, cmpt);
|
||||
|
||||
rawDist[i].second() = cmptDistribution[k];
|
||||
}
|
||||
}
|
||||
|
||||
return rawDistribution;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::List< Foam::List< Foam::Pair<Foam::scalar> > >Foam::
|
||||
Distribution<Type>::cumulativeNormalised() const
|
||||
{
|
||||
List< List< Pair<scalar> > > normalisedDistribution = normalised();
|
||||
|
||||
List< List < Pair<scalar> > > cumulativeNormalisedDistribution =
|
||||
normalisedDistribution;
|
||||
|
||||
for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
const List< Pair<scalar> >& normalisedCmpt =
|
||||
normalisedDistribution[cmpt];
|
||||
|
||||
List< Pair<scalar> >& cumNormalisedCmpt =
|
||||
cumulativeNormalisedDistribution[cmpt];
|
||||
|
||||
scalar sum = 0.0;
|
||||
|
||||
forAll(normalisedCmpt, i)
|
||||
{
|
||||
cumNormalisedCmpt[i].first() =
|
||||
normalisedCmpt[i].first()
|
||||
+ 0.5*component(binWidth_, cmpt);
|
||||
|
||||
cumNormalisedCmpt[i].second() =
|
||||
normalisedCmpt[i].second()*component(binWidth_, cmpt) + sum;
|
||||
|
||||
sum = cumNormalisedCmpt[i].second();
|
||||
}
|
||||
}
|
||||
|
||||
return cumulativeNormalisedDistribution;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::List< Foam::List< Foam::Pair<Foam::scalar> > >Foam::
|
||||
Distribution<Type>::cumulativeRaw() const
|
||||
{
|
||||
List< List< Pair<scalar> > > rawDistribution = raw();
|
||||
|
||||
List< List < Pair<scalar> > > cumulativeRawDistribution = rawDistribution;
|
||||
|
||||
for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
const List< Pair<scalar> >& rawCmpt = rawDistribution[cmpt];
|
||||
|
||||
List< Pair<scalar> >& cumRawCmpt = cumulativeRawDistribution[cmpt];
|
||||
|
||||
scalar sum = 0.0;
|
||||
|
||||
forAll(rawCmpt, i)
|
||||
{
|
||||
cumRawCmpt[i].first() =
|
||||
rawCmpt[i].first()
|
||||
+ 0.5*component(binWidth_, cmpt);
|
||||
|
||||
cumRawCmpt[i].second() = rawCmpt[i].second() + sum;
|
||||
|
||||
sum = cumRawCmpt[i].second();
|
||||
}
|
||||
}
|
||||
|
||||
return cumulativeRawDistribution;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::Distribution<Type>::clear()
|
||||
{
|
||||
for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
(*this)[cmpt].clear();
|
||||
|
||||
listStarts_[cmpt] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::Distribution<Type>::write(const fileName& filePrefix) const
|
||||
{
|
||||
List< List< Pair<scalar> > > rawDistribution = raw();
|
||||
|
||||
List< List < Pair<scalar> > > normDistribution = normalised();
|
||||
|
||||
for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
const List< Pair<scalar> >& rawPairs = rawDistribution[cmpt];
|
||||
|
||||
const List< Pair<scalar> >& normPairs = normDistribution[cmpt];
|
||||
|
||||
OFstream os(filePrefix + '_' + pTraits<Type>::componentNames[cmpt]);
|
||||
|
||||
os << "# key normalised raw" << endl;
|
||||
|
||||
forAll(normPairs, i)
|
||||
{
|
||||
os << normPairs[i].first()
|
||||
<< ' ' << normPairs[i].second()
|
||||
<< ' ' << rawPairs[i].second()
|
||||
<< nl;
|
||||
}
|
||||
}
|
||||
|
||||
List< List< Pair<scalar> > > rawCumDist = cumulativeRaw();
|
||||
|
||||
List< List < Pair<scalar> > > normCumDist = cumulativeNormalised();
|
||||
|
||||
for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
const List< Pair<scalar> >& rawPairs = rawCumDist[cmpt];
|
||||
|
||||
const List< Pair<scalar> >& normPairs = normCumDist[cmpt];
|
||||
|
||||
OFstream os
|
||||
(
|
||||
filePrefix + "_cumulative_" + pTraits<Type>::componentNames[cmpt]
|
||||
);
|
||||
|
||||
os << "# key normalised raw" << endl;
|
||||
|
||||
forAll(normPairs, i)
|
||||
{
|
||||
os << normPairs[i].first()
|
||||
<< ' ' << normPairs[i].second()
|
||||
<< ' ' << rawPairs[i].second()
|
||||
<< nl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::Distribution<Type>::operator=
|
||||
(
|
||||
const Distribution<Type>& rhs
|
||||
)
|
||||
{
|
||||
// Check for assignment to self
|
||||
if (this == &rhs)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::Distribution<Type>::operator="
|
||||
"(const Foam::Distribution<Type>&)"
|
||||
) << "Attempted assignment to self"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
List< List<scalar> >::operator=(rhs);
|
||||
|
||||
binWidth_ = rhs.binWidth();
|
||||
|
||||
listStarts_ = rhs.listStarts();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
|
||||
|
||||
template <class Type>
|
||||
Foam::Istream& Foam::operator>>
|
||||
(
|
||||
Istream& is,
|
||||
Distribution<Type>& d
|
||||
)
|
||||
{
|
||||
is >> static_cast<List< List<scalar> >&>(d)
|
||||
>> d.binWidth_
|
||||
>> d.listStarts_;
|
||||
|
||||
// Check state of Istream
|
||||
is.check("Istream& operator>>(Istream&, Distribution<Type>&)");
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const Distribution<Type>& d
|
||||
)
|
||||
{
|
||||
os << static_cast<const List< List<scalar> >& >(d)
|
||||
<< d.binWidth_ << token::SPACE
|
||||
<< d.listStarts_;
|
||||
|
||||
// Check state of Ostream
|
||||
os.check("Ostream& operator<<(Ostream&, " "const Distribution&)");
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
||||
|
||||
template <class Type>
|
||||
Foam::Distribution<Type> Foam::operator+
|
||||
(
|
||||
const Distribution<Type>& d1,
|
||||
const Distribution<Type>& d2
|
||||
)
|
||||
{
|
||||
// The coarsest binWidth is the sensible choice
|
||||
Distribution<Type> d(max(d1.binWidth(), d2.binWidth()));
|
||||
|
||||
List< List< List < Pair<scalar> > > > rawDists(2);
|
||||
|
||||
rawDists[0] = d1.raw();
|
||||
rawDists[1] = d2.raw();
|
||||
|
||||
forAll(rawDists, rDI)
|
||||
{
|
||||
for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
|
||||
{
|
||||
List<scalar>& cmptDistribution = d[cmpt];
|
||||
|
||||
const List < Pair<scalar> >& cmptRaw = rawDists[rDI][cmpt];
|
||||
|
||||
forAll(cmptRaw, rI)
|
||||
{
|
||||
scalar valueToAdd = cmptRaw[rI].first();
|
||||
scalar cmptWeight = cmptRaw[rI].second();
|
||||
|
||||
label n =
|
||||
label
|
||||
(
|
||||
component(valueToAdd, cmpt)
|
||||
/component(d.binWidth(), cmpt)
|
||||
)
|
||||
- label
|
||||
(
|
||||
neg(component(valueToAdd, cmpt)
|
||||
/component(d.binWidth(), cmpt))
|
||||
);
|
||||
|
||||
label listIndex = d.index(cmpt, n);
|
||||
|
||||
cmptDistribution[listIndex] += cmptWeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Distribution<Type>(d);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
207
src/OpenFOAM/containers/Lists/Distribution/Distribution.H
Normal file
207
src/OpenFOAM/containers/Lists/Distribution/Distribution.H
Normal file
@ -0,0 +1,207 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::Distribution
|
||||
|
||||
Description
|
||||
Accumulating histogram of component values.
|
||||
Specified bin resolution, automatic generation of bins.
|
||||
|
||||
SourceFiles
|
||||
DistributionI.H
|
||||
Distribution.C
|
||||
DistributionIO.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Distribution_H
|
||||
#define Distribution_H
|
||||
|
||||
#include "List.H"
|
||||
#include "Pair.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
template<class Type>
|
||||
class Distribution;
|
||||
|
||||
template<class Type>
|
||||
Istream& operator>>(Istream&, Distribution<Type>&);
|
||||
|
||||
template<class Type>
|
||||
Ostream& operator<<(Ostream&, const Distribution<Type>&);
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class Distribution Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class Distribution
|
||||
:
|
||||
public List< List<scalar> >
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Width of the bin for each component
|
||||
Type binWidth_;
|
||||
|
||||
//- The start bin index of each component
|
||||
List<label> listStarts_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Component type
|
||||
typedef typename pTraits<Type>::cmptType cmptType;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
Distribution();
|
||||
|
||||
//- Construct from separate binWidth for each component
|
||||
Distribution(const Type& binWidth);
|
||||
|
||||
//- Construct as copy
|
||||
Distribution(const Distribution& d);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~Distribution();
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Sum the total weight added to the component in the
|
||||
// argument
|
||||
scalar totalWeight(direction cmpt) const;
|
||||
|
||||
List<label> keys(direction cmpt) const;
|
||||
|
||||
//- Return the appropriate List index for the given bin index.
|
||||
// Resizes the List if required
|
||||
label index(direction cmpt, label n);
|
||||
|
||||
//- Returns the indices of the first and last non-zero entries
|
||||
Pair<label> validLimits(direction cmpt) const;
|
||||
|
||||
Type mean() const;
|
||||
|
||||
// From http://mathworld.wolfram.com/StatisticalMedian.html
|
||||
// The statistical median is the value of the Distribution
|
||||
// variable where the cumulative Distribution = 0.5.
|
||||
Type median() const;
|
||||
|
||||
//- Add a value to the distribution, optionally specifying a weight
|
||||
void add
|
||||
(
|
||||
const Type& valueToAdd,
|
||||
const Type& weight = pTraits<Type>::one
|
||||
);
|
||||
|
||||
//- Return the normalised distribution (probability density)
|
||||
// and bins
|
||||
List< List<Pair<scalar> > > normalised() const;
|
||||
|
||||
//- Return the distribution of the total bin weights
|
||||
List< List < Pair<scalar> > > raw() const;
|
||||
|
||||
//- Return the cumulative normalised distribution and
|
||||
// integration locations (at end of bins)
|
||||
List< List<Pair<scalar> > > cumulativeNormalised() const;
|
||||
|
||||
//- Return the cumulative total bin weights and integration
|
||||
// locations (at end of bins)
|
||||
List< List<Pair<scalar> > > cumulativeRaw() const;
|
||||
|
||||
//- Resets the Distribution by clearing the stored lists.
|
||||
// Leaves the same number of them and the same binWidth.
|
||||
void clear();
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the bin width
|
||||
inline const Type& binWidth() const;
|
||||
|
||||
//- Return the List start bin indices
|
||||
inline const List<label>& listStarts() const;
|
||||
|
||||
// Write
|
||||
|
||||
//- Write the distribution to file: key normalised raw.
|
||||
// Produces a separate file for each component.
|
||||
void write(const fileName& filePrefix) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
void operator=(const Distribution<Type>&);
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Istream& operator>> <Type>
|
||||
(
|
||||
Istream&,
|
||||
Distribution<Type>&
|
||||
);
|
||||
|
||||
friend Ostream& operator<< <Type>
|
||||
(
|
||||
Ostream&,
|
||||
const Distribution<Type>&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Distribution<Type> operator+
|
||||
(
|
||||
const Distribution<Type>&,
|
||||
const Distribution<Type>&
|
||||
);
|
||||
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "DistributionI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "Distribution.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,21 +23,24 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "dxSurfaceWriter.H"
|
||||
#include "surfaceWriters.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
template<class Type>
|
||||
inline const Type& Foam::Distribution<Type>::binWidth() const
|
||||
{
|
||||
return binWidth_;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
makeSurfaceWriters(dxSurfaceWriter);
|
||||
template<class Type>
|
||||
inline const
|
||||
Foam::List<Foam::label>& Foam::Distribution<Type>::listStarts() const
|
||||
{
|
||||
return listStarts_;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,7 +24,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "Time.H"
|
||||
#include "PstreamReduceOps.H"
|
||||
#include "Pstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -507,13 +507,23 @@ Foam::argList::argList
|
||||
jobInfo.add("startTime", timeString);
|
||||
jobInfo.add("userName", userName());
|
||||
jobInfo.add("foamVersion", word(FOAMversion));
|
||||
jobInfo.add("foamBuild", Foam::FOAMbuild);
|
||||
jobInfo.add("code", executable_);
|
||||
jobInfo.add("argList", argListString);
|
||||
jobInfo.add("currentDir", cwd());
|
||||
jobInfo.add("PPID", ppid());
|
||||
jobInfo.add("PGID", pgid());
|
||||
|
||||
// add build information - only use the first word
|
||||
{
|
||||
std::string build(Foam::FOAMbuild);
|
||||
std::string::size_type found = build.find(' ');
|
||||
if (found != std::string::npos)
|
||||
{
|
||||
build.resize(found);
|
||||
}
|
||||
jobInfo.add("foamBuild", build);
|
||||
}
|
||||
|
||||
|
||||
// Case is a single processor run unless it is running parallel
|
||||
int nProcs = 1;
|
||||
@ -883,9 +893,10 @@ void Foam::argList::printUsage() const
|
||||
printNotes();
|
||||
|
||||
Info<< nl
|
||||
<<"Using OpenFOAM-" << Foam::FOAMversion
|
||||
<<" (build: " << Foam::FOAMbuild << ") - see www.OpenFOAM.com"
|
||||
<< nl << endl;
|
||||
<<"Using: OpenFOAM-" << Foam::FOAMversion
|
||||
<< " (see www.OpenFOAM.com)" << nl
|
||||
<<"Build: " << Foam::FOAMbuild << nl
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -260,6 +260,11 @@ void Foam::LUscalarMatrix::convert
|
||||
}
|
||||
else if (interface.myProcNo_ < interface.neighbProcNo_)
|
||||
{
|
||||
// Interface to neighbour proc. Find on neighbour proc the
|
||||
// corresponding interface. The problem is that there can
|
||||
// be multiple interfaces between two processors (from
|
||||
// processorCyclics) so also compare the communication tag
|
||||
|
||||
const PtrList<procLduInterface>& neiInterfaces =
|
||||
lduMatrices[interface.neighbProcNo_].interfaces_;
|
||||
|
||||
@ -269,8 +274,11 @@ void Foam::LUscalarMatrix::convert
|
||||
{
|
||||
if
|
||||
(
|
||||
neiInterfaces[ninti].neighbProcNo_
|
||||
== interface.myProcNo_
|
||||
(
|
||||
neiInterfaces[ninti].neighbProcNo_
|
||||
== interface.myProcNo_
|
||||
)
|
||||
&& (neiInterfaces[ninti].tag_ == interface.tag_)
|
||||
)
|
||||
{
|
||||
neiInterfacei = ninti;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -39,7 +39,8 @@ Foam::procLduInterface::procLduInterface
|
||||
faceCells_(interface.interface().faceCells()),
|
||||
coeffs_(coeffs),
|
||||
myProcNo_(-1),
|
||||
neighbProcNo_(-1)
|
||||
neighbProcNo_(-1),
|
||||
tag_(-1)
|
||||
{
|
||||
if (isA<processorLduInterface>(interface.interface()))
|
||||
{
|
||||
@ -48,6 +49,7 @@ Foam::procLduInterface::procLduInterface
|
||||
|
||||
myProcNo_ = pldui.myProcNo();
|
||||
neighbProcNo_ = pldui.neighbProcNo();
|
||||
tag_ = pldui.tag();
|
||||
}
|
||||
else if (isA<cyclicLduInterface>(interface.interface()))
|
||||
{
|
||||
@ -70,7 +72,8 @@ Foam::procLduInterface::procLduInterface(Istream& is)
|
||||
faceCells_(is),
|
||||
coeffs_(is),
|
||||
myProcNo_(readLabel(is)),
|
||||
neighbProcNo_(readLabel(is))
|
||||
neighbProcNo_(readLabel(is)),
|
||||
tag_(readLabel(is))
|
||||
{}
|
||||
|
||||
|
||||
@ -81,7 +84,8 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const procLduInterface& cldui)
|
||||
os << cldui.faceCells_
|
||||
<< cldui.coeffs_
|
||||
<< cldui.myProcNo_
|
||||
<< cldui.neighbProcNo_;
|
||||
<< cldui.neighbProcNo_
|
||||
<< cldui.tag_;
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -57,6 +57,7 @@ class procLduInterface
|
||||
scalarField coeffs_;
|
||||
label myProcNo_;
|
||||
label neighbProcNo_;
|
||||
label tag_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,52 +32,56 @@ Description
|
||||
- all processor patches to have correct ordering.
|
||||
- all processorPatches to have their transforms set.
|
||||
|
||||
The shared point addressing is quite interesting. It gives on each processor
|
||||
the vertices that cannot be set using a normal swap on processor patches.
|
||||
These are the vertices that are shared between more than 2 processors.
|
||||
The shared point and edge addressing is quite interesting.
|
||||
It calculates addressing for points and edges on coupled patches. In
|
||||
the 'old' way a distincation was made between points/edges that are
|
||||
only on two processors and those that are on multiple processors. The
|
||||
problem is that those on multiple processors do not allow any
|
||||
transformations and require a global reduction on the master processor.
|
||||
|
||||
There is an issue with these shared vertices if they originate from
|
||||
cyclics (i.e. are now separated processor patches). They will all be
|
||||
mapped to the same global point (so even though the processor points are
|
||||
not on the same location) since topologically they are one and the same.
|
||||
The alternative is to have an exchange schedule (through a 'mapDistribute')
|
||||
which sends all point/edge data (no distinction is made between
|
||||
those on two and those on more than two coupled patches) to the local
|
||||
'master'. This master then does any calculation and sends
|
||||
the result back to the 'slave' points/edges. This only needs to be done
|
||||
on points on coupled faces. Any transformation is done using a predetermined
|
||||
set of transformations - since transformations have to be space filling
|
||||
only a certain number of transformation is supported.
|
||||
|
||||
So if you ask for sharedPoints() you get only one of the coordinates of
|
||||
the topologically shared points.
|
||||
The exchange needs
|
||||
- a field of data
|
||||
- a mapDistribute which does all parallel exchange and transformations
|
||||
This appens remote data to the end of the field.
|
||||
- a set of indices which indicate where to get untransformed data in the
|
||||
field
|
||||
- a set of indices which indicate where to get transformed data in the
|
||||
field
|
||||
|
||||
All the hard work of these shared points is done by the globalPoints class.
|
||||
See also mapDistribute, globalIndexAndTransform
|
||||
|
||||
Shared edges: similar to shared points gives on all processors the edges
|
||||
that are shared between more than two patches (i.e. the edges on which
|
||||
data cannot be synchronized by a straightforward edge data swap). Note
|
||||
that shared edges will use shared points but not all edges between shared
|
||||
points need to be shared edges (e.g. there might be an edge connecting
|
||||
two disconnected regions of shared points).
|
||||
|
||||
Currently an edge is considered shared
|
||||
Notes:
|
||||
- compared to 17x nTotalFaces, nTotalPoints do not compensate for
|
||||
shared points since this would trigger full connectivity analysis
|
||||
- most calculation is demand driven and uses parallel communication
|
||||
so make sure to invoke on all processors at the same time.
|
||||
- old sharedEdge calculation: currently an edge is considered shared
|
||||
if it uses two shared points and is used more than once. This is not
|
||||
correct on processor patches but it only slightly overestimates the number
|
||||
of shared edges. Doing full analysis of how many patches use the edge
|
||||
would be too complicated.
|
||||
|
||||
Shared edge calculation is demand driven so always make sure to have
|
||||
your first call to one of the access functions synchronous amongst all
|
||||
processors!
|
||||
|
||||
|
||||
SourceFiles
|
||||
globalMeshData.C
|
||||
globalMeshDataTemplates.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef globalMeshData_H
|
||||
#define globalMeshData_H
|
||||
|
||||
#include "Switch.H"
|
||||
#include "processorTopology.H"
|
||||
#include "labelPair.H"
|
||||
#include "indirectPrimitivePatch.H"
|
||||
#include "boundBox.H"
|
||||
#include "IOobject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -86,13 +90,11 @@ namespace Foam
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
class globalMeshData;
|
||||
Ostream& operator<<(Ostream&, const globalMeshData&);
|
||||
class globalIndex;
|
||||
class polyMesh;
|
||||
class mapDistribute;
|
||||
template<class T> class EdgeMap;
|
||||
class globalPoints;
|
||||
class globalIndex;
|
||||
class globalIndexAndTransform;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class globalMeshData Declaration
|
||||
@ -126,9 +128,6 @@ class globalMeshData
|
||||
};
|
||||
|
||||
|
||||
typedef List<labelPair> labelPairList;
|
||||
|
||||
|
||||
// Private data
|
||||
|
||||
//- Reference to mesh
|
||||
@ -137,9 +136,6 @@ class globalMeshData
|
||||
|
||||
// Data related to the complete mesh
|
||||
|
||||
//- Bounding box of complete mesh
|
||||
boundBox bb_;
|
||||
|
||||
//- Total number of points in the complete mesh
|
||||
label nTotalPoints_;
|
||||
|
||||
@ -165,23 +161,70 @@ class globalMeshData
|
||||
labelList processorPatchNeighbours_;
|
||||
|
||||
|
||||
// Coupled point addressing
|
||||
// This is addressing from coupled point to coupled points/faces/cells.
|
||||
// This is a full schedule so includes points used by only two
|
||||
// coupled patches.
|
||||
|
||||
//- Patch of coupled faces. Additional patch edge to mesh edges
|
||||
// correspondence:
|
||||
// points: meshPoints(), meshPointMap()
|
||||
// edges : meshEdges(), meshEdgeMap()
|
||||
mutable autoPtr<indirectPrimitivePatch> coupledPatchPtr_;
|
||||
mutable autoPtr<labelList> coupledPatchMeshEdgesPtr_;
|
||||
mutable autoPtr<Map<label> > coupledPatchMeshEdgeMapPtr_;
|
||||
|
||||
//- Global numbering for coupledPatch points
|
||||
mutable autoPtr<globalIndex> globalPointNumberingPtr_;
|
||||
|
||||
//- Global numbering for transforms
|
||||
mutable autoPtr<globalIndexAndTransform> globalTransformsPtr_;
|
||||
|
||||
// Coupled point to coupled points
|
||||
|
||||
mutable autoPtr<labelListList> globalPointSlavesPtr_;
|
||||
mutable autoPtr<labelListList> globalPointTransformedSlavesPtr_;
|
||||
mutable autoPtr<mapDistribute> globalPointSlavesMapPtr_;
|
||||
|
||||
// Coupled edge to coupled edges
|
||||
|
||||
mutable autoPtr<globalIndex> globalEdgeNumberingPtr_;
|
||||
mutable autoPtr<labelListList> globalEdgeSlavesPtr_;
|
||||
mutable autoPtr<labelListList> globalEdgeTransformedSlavesPtr_;
|
||||
mutable autoPtr<mapDistribute> globalEdgeSlavesMapPtr_;
|
||||
|
||||
|
||||
//// Coupled point to boundary faces
|
||||
//
|
||||
//mutable autoPtr<globalIndex> globalBoundaryFaceNumberingPtr_;
|
||||
//mutable autoPtr<labelListList> globalPointBoundaryFacesPtr_;
|
||||
//mutable autoPtr<mapDistribute> globalPointBoundaryFacesMapPtr_;
|
||||
//
|
||||
//// Coupled point to collocated boundary cells
|
||||
//
|
||||
//mutable autoPtr<labelList> boundaryCellsPtr_;
|
||||
//mutable autoPtr<globalIndex> globalBoundaryCellNumberingPtr_;
|
||||
//mutable autoPtr<labelListList> globalPointBoundaryCellsPtr_;
|
||||
//mutable autoPtr<mapDistribute> globalPointBoundaryCellsMapPtr_;
|
||||
|
||||
|
||||
// Globally shared point addressing
|
||||
|
||||
//- Total number of global points
|
||||
label nGlobalPoints_;
|
||||
mutable label nGlobalPoints_;
|
||||
|
||||
//- Indices of local points that are globally shared
|
||||
labelList sharedPointLabels_;
|
||||
mutable autoPtr<labelList> sharedPointLabelsPtr_;
|
||||
|
||||
//- Indices of globally shared points in the master list
|
||||
// This list contains all the shared points in the mesh
|
||||
labelList sharedPointAddr_;
|
||||
mutable autoPtr<labelList> sharedPointAddrPtr_;
|
||||
|
||||
//- Shared point global labels.
|
||||
// Global point index for every local shared point.
|
||||
// Only valid if constructed with this information or if
|
||||
// pointProcAddressing read.
|
||||
mutable labelList* sharedPointGlobalLabelsPtr_;
|
||||
mutable autoPtr<labelList> sharedPointGlobalLabelsPtr_;
|
||||
|
||||
|
||||
// Globally shared edge addressing. Derived from shared points.
|
||||
@ -191,68 +234,11 @@ class globalMeshData
|
||||
mutable label nGlobalEdges_;
|
||||
|
||||
//- Indices of local edges that are globally shared
|
||||
mutable labelList* sharedEdgeLabelsPtr_;
|
||||
mutable autoPtr<labelList> sharedEdgeLabelsPtr_;
|
||||
|
||||
//- Indices of globally shared edge in the master list
|
||||
// This list contains all the shared edges in the mesh
|
||||
mutable labelList* sharedEdgeAddrPtr_;
|
||||
|
||||
|
||||
// Coupled point addressing
|
||||
// This is addressing from coupled point to coupled points/faces/cells.
|
||||
// Two variants:
|
||||
// - collocated (so not physically separated)
|
||||
// - also separated
|
||||
// This is a full schedule so includes points only used by two
|
||||
// coupled patches.
|
||||
|
||||
mutable autoPtr<indirectPrimitivePatch> coupledPatchPtr_;
|
||||
|
||||
mutable autoPtr<labelList> coupledPatchMeshEdgesPtr_;
|
||||
|
||||
mutable autoPtr<Map<label> > coupledPatchMeshEdgeMapPtr_;
|
||||
|
||||
// Collocated
|
||||
|
||||
// Coupled point to collocated coupled points
|
||||
|
||||
mutable autoPtr<globalIndex> globalPointNumberingPtr_;
|
||||
mutable autoPtr<labelListList> globalPointSlavesPtr_;
|
||||
mutable autoPtr<mapDistribute> globalPointSlavesMapPtr_;
|
||||
|
||||
// Coupled edge to collocated coupled edges
|
||||
|
||||
mutable autoPtr<globalIndex> globalEdgeNumberingPtr_;
|
||||
mutable autoPtr<labelListList> globalEdgeSlavesPtr_;
|
||||
mutable autoPtr<mapDistribute> globalEdgeSlavesMapPtr_;
|
||||
|
||||
// Coupled point to collocated boundary faces
|
||||
|
||||
mutable autoPtr<globalIndex> globalBoundaryFaceNumberingPtr_;
|
||||
mutable autoPtr<labelListList> globalPointBoundaryFacesPtr_;
|
||||
mutable autoPtr<mapDistribute> globalPointBoundaryFacesMapPtr_;
|
||||
|
||||
// Coupled point to collocated boundary cells
|
||||
|
||||
mutable autoPtr<labelList> boundaryCellsPtr_;
|
||||
mutable autoPtr<globalIndex> globalBoundaryCellNumberingPtr_;
|
||||
mutable autoPtr<labelListList> globalPointBoundaryCellsPtr_;
|
||||
mutable autoPtr<mapDistribute> globalPointBoundaryCellsMapPtr_;
|
||||
|
||||
|
||||
// Non-collocated as well
|
||||
|
||||
// Coupled point to all coupled points
|
||||
|
||||
mutable autoPtr<globalIndex> globalPointAllNumberingPtr_;
|
||||
mutable autoPtr<labelListList> globalPointAllSlavesPtr_;
|
||||
mutable autoPtr<mapDistribute> globalPointAllSlavesMapPtr_;
|
||||
|
||||
// Coupled edge to all coupled edges (same numbering as
|
||||
// collocated coupled edges)
|
||||
|
||||
mutable autoPtr<labelListList> globalEdgeAllSlavesPtr_;
|
||||
mutable autoPtr<mapDistribute> globalEdgeAllSlavesMapPtr_;
|
||||
mutable autoPtr<labelList> sharedEdgeAddrPtr_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
@ -268,70 +254,18 @@ class globalMeshData
|
||||
label&
|
||||
);
|
||||
|
||||
//- Calculate shared point addressing
|
||||
void calcSharedPoints() const;
|
||||
|
||||
//- Calculate shared edge addressing
|
||||
void calcSharedEdges() const;
|
||||
|
||||
//- Count coincident faces.
|
||||
static label countCoincidentFaces
|
||||
(
|
||||
const scalar tolDim,
|
||||
const vectorField& separationDist
|
||||
);
|
||||
|
||||
//- Calculate global point addressing.
|
||||
void calcGlobalPointSlaves
|
||||
(
|
||||
const globalPoints&,
|
||||
autoPtr<globalIndex>&,
|
||||
autoPtr<labelListList>&,
|
||||
autoPtr<mapDistribute>&
|
||||
) const;
|
||||
|
||||
//- Calculate global point addressing.
|
||||
//- Calculate global point addressing.
|
||||
void calcGlobalPointSlaves() const;
|
||||
|
||||
//- Calculate global edge addressing.
|
||||
void calcGlobalEdgeSlaves
|
||||
(
|
||||
const labelListList&,
|
||||
const mapDistribute&,
|
||||
const globalIndex&,
|
||||
autoPtr<labelListList>&,
|
||||
autoPtr<mapDistribute>&
|
||||
) const;
|
||||
|
||||
//- Calculate global edge addressing.
|
||||
void calcGlobalEdgeSlaves() const;
|
||||
|
||||
//- Calculate coupled point to uncoupled boundary faces. Local only.
|
||||
void calcPointBoundaryFaces(labelListList& pointBoundaryFaces) const;
|
||||
|
||||
//- Calculate global point to global boundary face addressing.
|
||||
void calcGlobalPointBoundaryFaces() const;
|
||||
|
||||
//- Calculate global point to global boundary cell addressing.
|
||||
void calcGlobalPointBoundaryCells() const;
|
||||
|
||||
|
||||
// Non-collocated
|
||||
|
||||
//- Calculate global point addressing.
|
||||
void calcGlobalPointAllSlaves() const;
|
||||
|
||||
//- Calculate global edge addressing.
|
||||
void calcGlobalEdgeAllSlaves() const;
|
||||
|
||||
|
||||
//- Synchronise pointwise data
|
||||
template<class Type, class CombineOp>
|
||||
void syncPointData
|
||||
(
|
||||
List<Type>& pointData,
|
||||
const labelListList& slaves,
|
||||
const mapDistribute& slavesMap,
|
||||
const CombineOp& cop
|
||||
) const;
|
||||
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
globalMeshData(const globalMeshData&);
|
||||
@ -348,7 +282,7 @@ public:
|
||||
|
||||
// Static data members
|
||||
|
||||
//- Geomtric tolerance (fraction of bounding box)
|
||||
//- Geomteric tolerance (fraction of bounding box)
|
||||
static const Foam::scalar matchTol_;
|
||||
|
||||
|
||||
@ -357,10 +291,6 @@ public:
|
||||
//- Construct from mesh, derive rest (does parallel communication!)
|
||||
globalMeshData(const polyMesh& mesh);
|
||||
|
||||
//- Old behaviour: read constructor given IOobject and a polyMesh
|
||||
// reference. Only use this for testing!
|
||||
globalMeshData(const IOobject& io, const polyMesh& mesh);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~globalMeshData();
|
||||
@ -386,24 +316,21 @@ public:
|
||||
return processorPatches_.size() > 0;
|
||||
}
|
||||
|
||||
const boundBox& bb() const
|
||||
{
|
||||
return bb_;
|
||||
}
|
||||
|
||||
//- Return total number of points in decomposed mesh
|
||||
//- Return total number of points in decomposed mesh. Not
|
||||
// compensated for duplicate points!
|
||||
label nTotalPoints() const
|
||||
{
|
||||
return nTotalPoints_;
|
||||
}
|
||||
|
||||
//- Return total number of faces in decomposed mesh
|
||||
//- Return total number of faces in decomposed mesh. Not
|
||||
// compensated for duplicate faces!
|
||||
label nTotalFaces() const
|
||||
{
|
||||
return nTotalFaces_;
|
||||
}
|
||||
|
||||
//- Return total number of cells in decomposed mesh
|
||||
//- Return total number of cells in decomposed mesh.
|
||||
label nTotalCells() const
|
||||
{
|
||||
return nTotalCells_;
|
||||
@ -438,16 +365,10 @@ public:
|
||||
// Globally shared point addressing
|
||||
|
||||
//- Return number of globally shared points
|
||||
label nGlobalPoints() const
|
||||
{
|
||||
return nGlobalPoints_;
|
||||
}
|
||||
label nGlobalPoints() const;
|
||||
|
||||
//- Return indices of local points that are globally shared
|
||||
const labelList& sharedPointLabels() const
|
||||
{
|
||||
return sharedPointLabels_;
|
||||
}
|
||||
const labelList& sharedPointLabels() const;
|
||||
|
||||
//- Return addressing into the complete globally shared points
|
||||
// list
|
||||
@ -457,10 +378,7 @@ public:
|
||||
// points. Shared point addressing gives the index in the
|
||||
// list of all globally shared points for each of the locally
|
||||
// shared points.
|
||||
const labelList& sharedPointAddr() const
|
||||
{
|
||||
return sharedPointAddr_;
|
||||
}
|
||||
const labelList& sharedPointAddr() const;
|
||||
|
||||
//- Return shared point global labels. Tries to read
|
||||
// 'pointProcAddressing' and returns list or -1 if none
|
||||
@ -515,70 +433,47 @@ public:
|
||||
//- Return map from mesh edges to coupledPatch edges
|
||||
const Map<label>& coupledPatchMeshEdgeMap() const;
|
||||
|
||||
//- Global transforms numbering
|
||||
const globalIndexAndTransform& globalTransforms() const;
|
||||
|
||||
// Coupled point to collocated coupled points. Coupled points are
|
||||
//- Helper: synchronise data with transforms
|
||||
template<class Type, class CombineOp>
|
||||
static void syncData
|
||||
(
|
||||
List<Type>& pointData,
|
||||
const labelListList& slaves,
|
||||
const labelListList& transformedSlaves,
|
||||
const mapDistribute& slavesMap,
|
||||
const globalIndexAndTransform&,
|
||||
const CombineOp& cop,
|
||||
const bool isPosition
|
||||
);
|
||||
|
||||
|
||||
// Coupled point to coupled points. Coupled points are
|
||||
// points on any coupled patch.
|
||||
|
||||
//- Numbering of coupled points is according to coupledPatch.
|
||||
const globalIndex& globalPointNumbering() const;
|
||||
//- For every coupled point the indices into the field
|
||||
// distributed by below map.
|
||||
const labelListList& globalPointSlaves() const;
|
||||
const labelListList& globalPointTransformedSlaves() const;
|
||||
const mapDistribute& globalPointSlavesMap() const;
|
||||
//- Helper to synchronise mesh data
|
||||
//- Helper to synchronise mesh point data
|
||||
template<class Type, class CombineOp>
|
||||
void syncPointData
|
||||
(
|
||||
List<Type>& pointData,
|
||||
const CombineOp& cop
|
||||
const CombineOp& cop,
|
||||
const bool isPosition
|
||||
) const;
|
||||
|
||||
// Coupled edge to coupled edges.
|
||||
|
||||
const globalIndex& globalEdgeNumbering() const;
|
||||
const labelListList& globalEdgeSlaves() const;
|
||||
const labelListList& globalEdgeTransformedSlaves() const;
|
||||
const mapDistribute& globalEdgeSlavesMap() const;
|
||||
|
||||
// Coupled point to boundary faces. These are uncoupled boundary
|
||||
// faces only but include empty patches.
|
||||
|
||||
//- Numbering of boundary faces is face-mesh.nInternalFaces()
|
||||
const globalIndex& globalBoundaryFaceNumbering() const;
|
||||
const labelListList& globalPointBoundaryFaces() const;
|
||||
const mapDistribute& globalPointBoundaryFacesMap() const;
|
||||
|
||||
// Coupled point to boundary cell
|
||||
|
||||
//- From boundary cell to mesh cell
|
||||
const labelList& boundaryCells() const;
|
||||
|
||||
//- Numbering of boundary cells is according to boundaryCells()
|
||||
const globalIndex& globalBoundaryCellNumbering() const;
|
||||
const labelListList& globalPointBoundaryCells() const;
|
||||
const mapDistribute& globalPointBoundaryCellsMap() const;
|
||||
|
||||
|
||||
// Collocated & non-collocated
|
||||
|
||||
// Coupled point to all coupled points (collocated and
|
||||
// non-collocated).
|
||||
|
||||
const globalIndex& globalPointAllNumbering()const;
|
||||
const labelListList& globalPointAllSlaves() const;
|
||||
const mapDistribute& globalPointAllSlavesMap() const;
|
||||
//- Helper to synchronise mesh data
|
||||
template<class Type, class CombineOp>
|
||||
void syncPointAllData
|
||||
(
|
||||
List<Type>& pointData,
|
||||
const CombineOp& cop
|
||||
) const;
|
||||
|
||||
// Coupled edge to all coupled edges (same numbering as
|
||||
// collocated)
|
||||
|
||||
const labelListList& globalEdgeAllSlaves() const;
|
||||
const mapDistribute& globalEdgeAllSlavesMap() const;
|
||||
|
||||
// Other
|
||||
|
||||
@ -617,16 +512,6 @@ public:
|
||||
// full parallel analysis to determine shared points and
|
||||
// boundaries.
|
||||
void updateMesh();
|
||||
|
||||
|
||||
// Write
|
||||
|
||||
bool write() const;
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Ostream& operator<<(Ostream&, const globalMeshData&);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,13 +29,73 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type, class CombineOp>
|
||||
void Foam::globalMeshData::syncData
|
||||
(
|
||||
List<Type>& elems,
|
||||
const labelListList& slaves,
|
||||
const labelListList& transformedSlaves,
|
||||
const mapDistribute& slavesMap,
|
||||
const globalIndexAndTransform& transforms,
|
||||
const CombineOp& cop,
|
||||
const bool isPosition
|
||||
)
|
||||
{
|
||||
// Pull slave data onto master
|
||||
slavesMap.distribute(transforms, elems, isPosition);
|
||||
|
||||
// Combine master data with slave data
|
||||
forAll(slaves, i)
|
||||
{
|
||||
Type& elem = elems[i];
|
||||
|
||||
const labelList& slavePoints = slaves[i];
|
||||
const labelList& transformSlavePoints = transformedSlaves[i];
|
||||
|
||||
if (slavePoints.size()+transformSlavePoints.size() > 0)
|
||||
{
|
||||
// Combine master with untransformed slave data
|
||||
forAll(slavePoints, j)
|
||||
{
|
||||
cop(elem, elems[slavePoints[j]]);
|
||||
}
|
||||
|
||||
// Combine master with transformed slave data
|
||||
forAll(transformSlavePoints, j)
|
||||
{
|
||||
cop(elem, elems[transformSlavePoints[j]]);
|
||||
}
|
||||
|
||||
|
||||
// Copy result back to slave slots
|
||||
forAll(slavePoints, j)
|
||||
{
|
||||
elems[slavePoints[j]] = elem;
|
||||
}
|
||||
forAll(transformSlavePoints, j)
|
||||
{
|
||||
elems[transformSlavePoints[j]] = elem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Push slave-slot data back to slaves
|
||||
slavesMap.reverseDistribute
|
||||
(
|
||||
transforms,
|
||||
elems.size(),
|
||||
elems,
|
||||
isPosition
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type, class CombineOp>
|
||||
void Foam::globalMeshData::syncPointData
|
||||
(
|
||||
List<Type>& pointData,
|
||||
const labelListList& slaves,
|
||||
const mapDistribute& slavesMap,
|
||||
const CombineOp& cop
|
||||
const CombineOp& cop,
|
||||
const bool isPosition
|
||||
) const
|
||||
{
|
||||
if (pointData.size() != mesh_.nPoints())
|
||||
@ -46,81 +106,26 @@ void Foam::globalMeshData::syncPointData
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// Transfer onto coupled patch
|
||||
const indirectPrimitivePatch& cpp = coupledPatch();
|
||||
const labelList& meshPoints = cpp.meshPoints();
|
||||
List<Type> cppFld(UIndirectList<Type>(pointData, cpp.meshPoints()));
|
||||
|
||||
// Copy mesh (point)data to coupled patch (point)data
|
||||
Field<Type> cppFld(slavesMap.constructSize());
|
||||
forAll(meshPoints, patchPointI)
|
||||
{
|
||||
cppFld[patchPointI] = pointData[meshPoints[patchPointI]];
|
||||
}
|
||||
|
||||
// Pull slave data onto master
|
||||
slavesMap.distribute(cppFld);
|
||||
|
||||
// Combine master data with slave data
|
||||
forAll(slaves, patchPointI)
|
||||
{
|
||||
const labelList& slavePoints = slaves[patchPointI];
|
||||
|
||||
// Combine master with slave data
|
||||
forAll(slavePoints, i)
|
||||
{
|
||||
cop(cppFld[patchPointI], cppFld[slavePoints[i]]);
|
||||
}
|
||||
// Copy result back to slave slots
|
||||
forAll(slavePoints, i)
|
||||
{
|
||||
cppFld[slavePoints[i]] = cppFld[patchPointI];
|
||||
}
|
||||
}
|
||||
|
||||
// Push master data back to slaves
|
||||
slavesMap.reverseDistribute(meshPoints.size(), cppFld);
|
||||
|
||||
// Update mesh (point)data from coupled patch (point)data
|
||||
forAll(meshPoints, patchPointI)
|
||||
{
|
||||
pointData[meshPoints[patchPointI]] = cppFld[patchPointI];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type, class CombineOp>
|
||||
void Foam::globalMeshData::syncPointData
|
||||
(
|
||||
List<Type>& pointData,
|
||||
const CombineOp& cop
|
||||
) const
|
||||
{
|
||||
const labelListList& slaves = globalPointSlaves();
|
||||
const mapDistribute& map = globalPointSlavesMap();
|
||||
|
||||
syncPointData
|
||||
syncData
|
||||
(
|
||||
pointData,
|
||||
slaves,
|
||||
map,
|
||||
cop
|
||||
cppFld,
|
||||
globalPointSlaves(),
|
||||
globalPointTransformedSlaves(),
|
||||
globalPointSlavesMap(),
|
||||
globalTransforms(),
|
||||
cop,
|
||||
isPosition
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type, class CombineOp>
|
||||
void Foam::globalMeshData::syncPointAllData
|
||||
(
|
||||
List<Type>& pointData,
|
||||
const CombineOp& cop
|
||||
) const
|
||||
{
|
||||
syncPointData
|
||||
(
|
||||
pointData,
|
||||
globalPointAllSlaves(),
|
||||
globalPointAllSlavesMap(),
|
||||
cop
|
||||
);
|
||||
// Extract back onto mesh
|
||||
forAll(cpp.meshPoints(), i)
|
||||
{
|
||||
pointData[cpp.meshPoints()[i]] = cppFld[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -39,17 +39,15 @@ Description
|
||||
- f[0] ordering on patch faces to be ok.
|
||||
|
||||
Works by constructing equivalence lists for all the points on processor
|
||||
patches. These list are in globalIndex numbering (so consecutively numbered
|
||||
per processor)
|
||||
patches. These list are in globalIndexAndTransform numbering
|
||||
E.g.
|
||||
@verbatim
|
||||
((7 93)(4 731)(3 114))
|
||||
@endverbatim
|
||||
|
||||
means point 93 on proc7 is connected to point 731 on proc4 and 114 on proc3.
|
||||
It then gets the lowest numbered processor (the 'master') to request a
|
||||
sharedPoint label from processor0 and it redistributes this label back to
|
||||
the other processors in the equivalence list.
|
||||
It then assigns the lowest numbered processor to be the local 'master' and
|
||||
constructs a mapDistribute to send all data to this master.
|
||||
|
||||
Algorithm:
|
||||
- get meshPoints of all my points on processor patches and initialize
|
||||
@ -64,24 +62,9 @@ Description
|
||||
endloop until nothing changes
|
||||
|
||||
At this point one will have complete point-point connectivity for all
|
||||
points on processor patches. Now
|
||||
|
||||
- (optional)remove point equivalences of size 2. These are
|
||||
just normal points shared between two neighbouring procPatches.
|
||||
- collect on each processor points for which it is the master
|
||||
- request number of sharedPointLabels from the Pstream::master.
|
||||
|
||||
This information gets redistributed to all processors in a similar way
|
||||
as that in which the equivalence lists were collected:
|
||||
|
||||
- initialize the indices of shared points I am the master for
|
||||
loop
|
||||
- send my known sharedPoints + meshPoints to all neighbours
|
||||
- receive from all neighbour. Find which meshPoint on my processor
|
||||
the sharedpoint is connected to
|
||||
- mark indices for which information has changed
|
||||
endloop until nothing changes.
|
||||
|
||||
points on processor patches. Now (optionally) remove point
|
||||
equivalences of size 2. These are just normal points shared
|
||||
between two neighbouring procPatches.
|
||||
|
||||
Note: the data held is either mesh point labels (construct from mesh only)
|
||||
or patch point labels (construct from mesh and patch).
|
||||
@ -95,12 +78,9 @@ SourceFiles
|
||||
#define globalPoints_H
|
||||
|
||||
#include "DynamicList.H"
|
||||
#include "Map.H"
|
||||
#include "primitivePatch.H"
|
||||
#include "edgeList.H"
|
||||
#include "globalIndex.H"
|
||||
#include "indirectPrimitivePatch.H"
|
||||
#include "PackedBoolList.H"
|
||||
#include "globalIndex.H"
|
||||
#include "globalIndexAndTransform.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -112,7 +92,7 @@ class polyMesh;
|
||||
class polyBoundaryMesh;
|
||||
class cyclicPolyPatch;
|
||||
class polyPatch;
|
||||
class coupledPolyPatch;
|
||||
class mapDistribute;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class globalPoints Declaration
|
||||
@ -120,91 +100,85 @@ class coupledPolyPatch;
|
||||
|
||||
class globalPoints
|
||||
{
|
||||
// Static data members
|
||||
|
||||
//- Offset to add to points (in globalIndices) originating from
|
||||
// collocated coupled points.
|
||||
static const label fromCollocated;
|
||||
|
||||
|
||||
// Private data
|
||||
|
||||
//- Mesh reference
|
||||
const polyMesh& mesh_;
|
||||
|
||||
//- Global numbering of points
|
||||
//- Global numbering of untransformed points
|
||||
globalIndex globalIndices_;
|
||||
|
||||
//- Global numbering of transformed points
|
||||
const globalIndexAndTransform globalTransforms_;
|
||||
|
||||
//- Sum of points on processor patches (unfiltered, point on 2 patches
|
||||
// counts as 2)
|
||||
const label nPatchPoints_;
|
||||
|
||||
//- All points on boundaries and their corresponding connected points
|
||||
// on other processors.
|
||||
DynamicList<labelList> procPoints_;
|
||||
DynamicList<labelPairList> procPoints_;
|
||||
|
||||
//- Map from mesh (or patch) point to index in procPoints
|
||||
Map<label> meshToProcPoint_;
|
||||
|
||||
//- Shared points used by this processor (= global point number)
|
||||
labelList sharedPointAddr_;
|
||||
|
||||
//- My mesh(or patch) points corresponding to the shared points
|
||||
labelList sharedPointLabels_;
|
||||
// Calculated mapDistribute addressing
|
||||
|
||||
//- Non-transformed connected points per point (in mapDistribute
|
||||
// indices)
|
||||
labelListList pointPoints_;
|
||||
|
||||
//- Transformed points per point (in mapDistribute indices)
|
||||
labelListList transformedPointPoints_;
|
||||
|
||||
//- Corresponding map
|
||||
autoPtr<mapDistribute> map_;
|
||||
|
||||
//- Total number of shared points.
|
||||
label nGlobalPoints_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
// Wrappers around global point numbering to add collocated bit
|
||||
|
||||
//- Convert into globalIndices and add collocated bit
|
||||
label toGlobal(const label, const bool isCollocated) const;
|
||||
|
||||
//- Is collocated bit set
|
||||
bool isCollocated(const label globalI) const;
|
||||
|
||||
//- Remove collocated bit
|
||||
label removeCollocated(const label globalI) const;
|
||||
|
||||
//- (remove collocated bit and) check if originates from local proc
|
||||
bool isLocal(const label globalI) const;
|
||||
|
||||
//- (remove collocated bit and) get originating processor
|
||||
label whichProcID(const label globalI) const;
|
||||
|
||||
//- (remove collocated bit and) convert to local number on processor
|
||||
label toLocal(const label procI, const label globalI) const;
|
||||
|
||||
//- (remove collocated bit and) convert to local number on
|
||||
// Pstream::myProcNo
|
||||
label toLocal(const label globalI) const;
|
||||
|
||||
|
||||
//- Helper function to sort according minimum proc, minimum index,
|
||||
// minimum transform
|
||||
class globalIndexAndTransformLessThan
|
||||
{
|
||||
public:
|
||||
bool operator()
|
||||
(
|
||||
const labelPair& a,
|
||||
const labelPair& b
|
||||
);
|
||||
};
|
||||
|
||||
//- Count all points on processorPatches. Is all points for which
|
||||
// information is collected.
|
||||
static label countPatchPoints(const polyBoundaryMesh&);
|
||||
|
||||
labelPairList addSendTransform
|
||||
(
|
||||
const label patchI,
|
||||
const labelPairList& info
|
||||
) const;
|
||||
|
||||
//- Add information about patchPointI in relative indices to send
|
||||
// buffers (patchFaces, indexInFace etc.)
|
||||
static void addToSend
|
||||
void addToSend
|
||||
(
|
||||
const primitivePatch&,
|
||||
const polyPatch&,
|
||||
const label patchPointI,
|
||||
const labelList&,
|
||||
const labelPairList&,
|
||||
DynamicList<label>& patchFaces,
|
||||
DynamicList<label>& indexInFace,
|
||||
DynamicList<labelList>& allInfo
|
||||
);
|
||||
DynamicList<labelPairList>& allInfo
|
||||
) const;
|
||||
|
||||
//- Merge info from neighbour into my data
|
||||
static bool mergeInfo
|
||||
(
|
||||
const labelList& nbrInfo,
|
||||
labelList& myInfo
|
||||
const labelPairList& nbrInfo,
|
||||
const label localPointI,
|
||||
labelPairList& myInfo
|
||||
);
|
||||
|
||||
//- From mesh point to 'local point'. Is the mesh point itself
|
||||
@ -223,18 +197,26 @@ class globalPoints
|
||||
);
|
||||
|
||||
//- Store (and merge) info for meshPointI
|
||||
bool storeInfo
|
||||
bool storeInitialInfo
|
||||
(
|
||||
const labelList& nbrInfo,
|
||||
const label localPointI,
|
||||
const bool isCollocated
|
||||
const labelPairList& nbrInfo,
|
||||
const label localPointI
|
||||
);
|
||||
|
||||
//- Store (and merge) info for meshPointI
|
||||
bool mergeInfo
|
||||
(
|
||||
const labelPairList& nbrInfo,
|
||||
const label localPointI
|
||||
);
|
||||
|
||||
//- Get the signs for the individual transforms
|
||||
FixedList<label, 3> transformBits(const label transformIndex) const;
|
||||
|
||||
void printProcPoints
|
||||
(
|
||||
const labelList& patchToMeshPoint,
|
||||
const labelList& pointInfo,
|
||||
Ostream& os
|
||||
const labelPairList& pointInfo
|
||||
) const;
|
||||
|
||||
//- Initialize procPoints_ to my patch points. allPoints = true:
|
||||
@ -260,6 +242,7 @@ class globalPoints
|
||||
(
|
||||
const bool mergeSeparated,
|
||||
const Map<label>&,
|
||||
const labelList&,
|
||||
PstreamBuffers&,
|
||||
labelHashSet&
|
||||
);
|
||||
@ -268,34 +251,6 @@ class globalPoints
|
||||
// Used to remove normal face-face connected points.
|
||||
void remove(const labelList& patchToMeshPoint, const Map<label>&);
|
||||
|
||||
//- Compact out unused elements of procPoints.
|
||||
void compact(const labelList& patchToMeshPoint);
|
||||
|
||||
//- Get indices of point for which I am master (lowest numbered proc)
|
||||
labelList getMasterPoints(const labelList& patchToMeshPoint) const;
|
||||
|
||||
|
||||
//- Send subset of shared points to neighbours
|
||||
void sendSharedPoints
|
||||
(
|
||||
const bool mergeSeparated,
|
||||
PstreamBuffers&,
|
||||
const DynamicList<label>&
|
||||
) const;
|
||||
|
||||
//- Take over any local shared points
|
||||
void extendSharedPoints(const Map<label>&, DynamicList<label>&);
|
||||
|
||||
//- Receive shared points and update subset.
|
||||
void receiveSharedPoints
|
||||
(
|
||||
const bool mergeSeparated,
|
||||
const Map<label>& meshToPatchPoint,
|
||||
const Map<label>& meshToShared,
|
||||
PstreamBuffers&,
|
||||
DynamicList<label>&
|
||||
);
|
||||
|
||||
//- Return mesh points of other side in same order as my meshPoints.
|
||||
static labelList reverseMeshPoints(const cyclicPolyPatch&);
|
||||
|
||||
@ -325,7 +280,7 @@ public:
|
||||
|
||||
//- Construct from mesh.
|
||||
// keepAllPoints = false : filter out points that are on two
|
||||
// neighbouring coupled patches (so can be swapped)
|
||||
// neighbouring coupled patches only (so can be swapped)
|
||||
// mergeSeparated:
|
||||
// true : merge coupled points across separated patches.
|
||||
// false : do not merge across coupled separated patches.
|
||||
@ -338,8 +293,7 @@ public:
|
||||
|
||||
//- Construct from mesh and patch of coupled faces. Difference with
|
||||
// construct from mesh only is that this stores the meshToProcPoint,
|
||||
// procPoints and sharedPointLabels as patch local point labels
|
||||
// instead of mesh point labels.
|
||||
// procPoints as patch local point labels instead of mesh point labels.
|
||||
globalPoints
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
@ -353,43 +307,68 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Global numbering of untransformed (mesh or patch) points
|
||||
const globalIndex& globalIndices() const
|
||||
{
|
||||
return globalIndices_;
|
||||
}
|
||||
|
||||
//- Global numbering of transformed (mesh or patch) points
|
||||
const globalIndexAndTransform& globalTransforms() const
|
||||
{
|
||||
return globalTransforms_;
|
||||
}
|
||||
|
||||
//- Non-transformed connected points per point (in mapDistribute
|
||||
// indices)
|
||||
const labelListList& pointPoints() const
|
||||
{
|
||||
return pointPoints_;
|
||||
}
|
||||
|
||||
//- Non-transformed connected points per point (in mapDistribute
|
||||
// indices)
|
||||
labelListList& pointPoints()
|
||||
{
|
||||
return pointPoints_;
|
||||
}
|
||||
|
||||
//- Transformed points per point (in mapDistribute indices)
|
||||
const labelListList& transformedPointPoints() const
|
||||
{
|
||||
return transformedPointPoints_;
|
||||
}
|
||||
|
||||
//- Transformed points per point (in mapDistribute indices)
|
||||
labelListList& transformedPointPoints()
|
||||
{
|
||||
return transformedPointPoints_;
|
||||
}
|
||||
|
||||
//- Corresponding map
|
||||
const mapDistribute& map() const
|
||||
{
|
||||
return map_();
|
||||
}
|
||||
|
||||
//- Corresponding map
|
||||
mapDistribute& map()
|
||||
{
|
||||
return map_();
|
||||
}
|
||||
|
||||
//- From (mesh or patch) point to index in procPoints
|
||||
const Map<label>& meshToProcPoint() const
|
||||
{
|
||||
return meshToProcPoint_;
|
||||
}
|
||||
|
||||
//- procPoints is per point the connected points (in global
|
||||
// point numbers)
|
||||
const DynamicList<labelList>& procPoints() const
|
||||
//- procPoints is per point the connected points (in
|
||||
// globalTransformAndIndex point numbers)
|
||||
const DynamicList<labelPairList>& procPoints() const
|
||||
{
|
||||
return procPoints_;
|
||||
}
|
||||
|
||||
//- Global numbering of (mesh or patch) points
|
||||
const globalIndex& globalIndices() const
|
||||
{
|
||||
return globalIndices_;
|
||||
}
|
||||
|
||||
//- shared points used by this processor (= global point number)
|
||||
const labelList& sharedPointAddr() const
|
||||
{
|
||||
return sharedPointAddr_;
|
||||
}
|
||||
|
||||
//- my (mesh or patch)points corresponding to the shared points
|
||||
const labelList& sharedPointLabels() const
|
||||
{
|
||||
return sharedPointLabels_;
|
||||
}
|
||||
|
||||
//- total number of shared points
|
||||
label nGlobalPoints() const
|
||||
{
|
||||
return nGlobalPoints_;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -35,22 +35,92 @@ Note:
|
||||
Schedule is a list of processor pairs (one send, one receive. One of
|
||||
them will be myself) which forms a scheduled (i.e. non-buffered) exchange.
|
||||
See distribute on how to use it.
|
||||
Note2: number of items send on one processor have to equal the number
|
||||
Note2: number of items sent on one processor have to equal the number
|
||||
of items received on the other processor.
|
||||
|
||||
Constructors using compact numbering: all my own elements first
|
||||
(whether used or not) followed by used-only remote elements.
|
||||
To aid constructing these maps there are the constructors from global
|
||||
numbering, either with or without transforms.
|
||||
|
||||
- without transforms:
|
||||
Constructors using compact numbering: layout is
|
||||
- all my own elements first (whether used or not)
|
||||
- followed by used-only remote elements sorted by remote processor.
|
||||
So e.g 4 procs and on proc 1 the compact
|
||||
table will first have all globalIndex.localSize() elements from proc1
|
||||
followed by used-only elements of proc0, proc2, proc3.
|
||||
The constructed mapDistribute sends the local elements from and
|
||||
receives the remote elements into their compact position.
|
||||
compactMap[procI] is the position of elements from procI in the compact
|
||||
map. compactMap[myProcNo()] is empty since trivial addressing. The indices
|
||||
into compactMap[procI] are local, not global, indices.
|
||||
map. compactMap[myProcNo()] is empty since trivial addressing.
|
||||
|
||||
It rewrites the input global indices into indices into the constructed
|
||||
data.
|
||||
|
||||
|
||||
- with transforms:
|
||||
This requires the precalculated set of possible transforms
|
||||
(globalIndexAndTransform). These are given as permutations (+, -, or none)
|
||||
of up to 3 independent transforms.
|
||||
The layout of the data is
|
||||
- all my own elements first (whether used or not)
|
||||
- followed by used-only remote elements sorted by remote processor.
|
||||
- followed by - for each transformation index - the set of local or
|
||||
remote elements with that transformation.
|
||||
The inputs for the constructor are
|
||||
- the set of untransformed local or remote indices in globalIndex
|
||||
numbering. These get rewritten to be indices into the layout of the data.
|
||||
- the set of transformed local or remote indices in globalIndexAndTransform
|
||||
encoding. These are labelPairs.
|
||||
|
||||
Any distribute with transforms is now done as:
|
||||
1. exchange data with other processors and receive these into the
|
||||
slots for that processor
|
||||
2. for all transformations transform a subset of the data according
|
||||
to transformElements_[transformI] and store this starting from
|
||||
transformStart_[transformI]
|
||||
|
||||
In the same way a reverse distribute will
|
||||
1. apply the inverse transform to the data starting at
|
||||
transformStart_[transformI] and copy the result back into the
|
||||
transformElements_[transformI]. These might be local or remote slots.
|
||||
2. the data in the remote slots will now be sent back to the correct
|
||||
location in the originating processor.
|
||||
|
||||
E.g. a map to handle
|
||||
- mesh points on a mesh with
|
||||
- 1 cyclic so 3 permutations (+,-,none) will have layout
|
||||
- on e.g. processor 1 out of 2:
|
||||
|
||||
+------+ <- transformStart[2]
|
||||
| |
|
||||
| | <- transform2 applied to data in local or remote slots
|
||||
| |
|
||||
+------+ <- transformStart[1]
|
||||
| |
|
||||
| | <- transform1 applied to data in local or remote slots
|
||||
| |
|
||||
+------+ <- transformStart[1]
|
||||
| |
|
||||
| | <- transform0 applied to data in local or remote slots
|
||||
| |
|
||||
+------+ <- transformStart[0]
|
||||
| |
|
||||
| | <- data from proc2
|
||||
| |
|
||||
+------+
|
||||
| |
|
||||
| | <- data from proc0
|
||||
| |
|
||||
+------+ <- mesh.nPoints()
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
+------+ 0
|
||||
|
||||
|
||||
SourceFiles
|
||||
mapDistribute.C
|
||||
mapDistributeTemplates.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -62,6 +132,7 @@ SourceFiles
|
||||
#include "Pstream.H"
|
||||
#include "boolList.H"
|
||||
#include "Map.H"
|
||||
#include "point.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -71,6 +142,7 @@ namespace Foam
|
||||
class mapPolyMesh;
|
||||
class globalIndex;
|
||||
class PstreamBuffers;
|
||||
class globalIndexAndTransform;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class mapDistribute Declaration
|
||||
@ -89,6 +161,16 @@ class mapDistribute
|
||||
//- Maps from subsetted data to new reconstructed data
|
||||
labelListList constructMap_;
|
||||
|
||||
// Optional transformation
|
||||
|
||||
//- For every globalIndexAndTransform::transformPermutations
|
||||
// gives the elements that need to be transformed
|
||||
labelListList transformElements_;
|
||||
|
||||
//- Destination in constructMap for transformed elements
|
||||
labelList transformStart_;
|
||||
|
||||
|
||||
//- Schedule
|
||||
mutable autoPtr<List<labelPair> > schedulePtr_;
|
||||
|
||||
@ -102,10 +184,73 @@ class mapDistribute
|
||||
const label receivedSize
|
||||
);
|
||||
|
||||
void calcCompactAddressing
|
||||
(
|
||||
const globalIndex& globalNumbering,
|
||||
const labelList& elements,
|
||||
List<Map<label> >& compactMap
|
||||
) const;
|
||||
void calcCompactAddressing
|
||||
(
|
||||
const globalIndex& globalNumbering,
|
||||
const labelListList& elements,
|
||||
List<Map<label> >& compactMap
|
||||
) const;
|
||||
|
||||
void exchangeAddressing
|
||||
(
|
||||
const globalIndex& globalNumbering,
|
||||
labelList& elements,
|
||||
List<Map<label> >& compactMap,
|
||||
labelList& compactStart
|
||||
);
|
||||
void exchangeAddressing
|
||||
(
|
||||
const globalIndex& globalNumbering,
|
||||
labelListList& elements,
|
||||
List<Map<label> >& compactMap,
|
||||
labelList& compactStart
|
||||
);
|
||||
|
||||
|
||||
//- Helper function: copy transformElements without transformation
|
||||
template<class T>
|
||||
void applyDummyTransforms(List<T>& field) const;
|
||||
|
||||
template<class T> //, class CombineOp>
|
||||
void applyTransforms
|
||||
(
|
||||
const globalIndexAndTransform& globalTransforms,
|
||||
List<T>& field,
|
||||
const bool isPosition
|
||||
//const CombineOp& cop
|
||||
) const;
|
||||
|
||||
//- Helper function: copy transformElements without transformation
|
||||
template<class T>
|
||||
void applyDummyInverseTransforms(List<T>& field) const;
|
||||
|
||||
template<class T> //, class CombineOp>
|
||||
void applyInverseTransforms
|
||||
(
|
||||
const globalIndexAndTransform& globalTransforms,
|
||||
List<T>& field,
|
||||
const bool isPosition
|
||||
//const CombineOp& cop
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Declare name of the class and its debug switch
|
||||
ClassName("mapDistribute");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
mapDistribute();
|
||||
|
||||
//- Construct from components
|
||||
mapDistribute
|
||||
(
|
||||
@ -114,6 +259,16 @@ public:
|
||||
const Xfer<labelListList>& constructMap
|
||||
);
|
||||
|
||||
//- Construct from components
|
||||
mapDistribute
|
||||
(
|
||||
const label constructSize,
|
||||
const Xfer<labelListList>& subMap,
|
||||
const Xfer<labelListList>& constructMap,
|
||||
const Xfer<labelListList>& transformElements,
|
||||
const Xfer<labelList>& transformStart
|
||||
);
|
||||
|
||||
//- Construct from reverse addressing: per data item the send
|
||||
// processor and the receive processor. All processors get same data.
|
||||
mapDistribute
|
||||
@ -143,6 +298,36 @@ public:
|
||||
List<Map<label> >& compactMap
|
||||
);
|
||||
|
||||
//- Construct from list of (possibly remote) untransformed elements
|
||||
// in globalIndex numbering (or -1) and (possibly remote)
|
||||
// transformded elements in globalIndexAndTransform numbering.
|
||||
// Determines compact numbering (see above) and
|
||||
// distribute map to get data into this ordering and renumbers the
|
||||
// elements to be in compact numbering.
|
||||
mapDistribute
|
||||
(
|
||||
const globalIndex&,
|
||||
labelList& untransformedElements,
|
||||
const globalIndexAndTransform&,
|
||||
const labelPairList& transformedElements,
|
||||
labelList& transformedIndices,
|
||||
List<Map<label> >& compactMap
|
||||
);
|
||||
|
||||
//- As above but with ListLists.
|
||||
mapDistribute
|
||||
(
|
||||
const globalIndex&,
|
||||
labelListList& cellCells,
|
||||
const globalIndexAndTransform&,
|
||||
const List<labelPairList>& transformedElements,
|
||||
labelListList& transformedIndices,
|
||||
List<Map<label> >& compactMap
|
||||
);
|
||||
|
||||
//- Construct by transferring parameter content
|
||||
mapDistribute(const Xfer<mapDistribute>&);
|
||||
|
||||
//- Construct copy
|
||||
mapDistribute(const mapDistribute&);
|
||||
|
||||
@ -187,6 +372,22 @@ public:
|
||||
return constructMap_;
|
||||
}
|
||||
|
||||
//- For every globalIndexAndTransform::transformPermutations
|
||||
// gives the elements that need to be transformed
|
||||
const labelListList& transformElements() const
|
||||
{
|
||||
return transformElements_;
|
||||
}
|
||||
|
||||
//- Destination in constructMap for transformed elements
|
||||
const labelList& transformStart() const
|
||||
{
|
||||
return transformStart_;
|
||||
}
|
||||
|
||||
//- Find transform from transformElements
|
||||
label whichTransform(const label index) const;
|
||||
|
||||
//- Calculate a schedule. See above.
|
||||
static List<labelPair> schedule
|
||||
(
|
||||
@ -200,6 +401,12 @@ public:
|
||||
|
||||
// Other
|
||||
|
||||
//- Transfer the contents of the argument and annul the argument.
|
||||
void transfer(mapDistribute&);
|
||||
|
||||
//- Transfer contents to the Xfer container
|
||||
Xfer<mapDistribute> xfer();
|
||||
|
||||
//- Helper for construct from globalIndex. Renumbers element
|
||||
// (in globalIndex numbering) into compact indices.
|
||||
static label renumber
|
||||
@ -245,88 +452,36 @@ public:
|
||||
|
||||
//- Distribute data using default commsType.
|
||||
template<class T>
|
||||
void distribute(List<T>& fld) const
|
||||
{
|
||||
if (Pstream::defaultCommsType == Pstream::nonBlocking)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
List<labelPair>(),
|
||||
constructSize_,
|
||||
subMap_,
|
||||
constructMap_,
|
||||
fld
|
||||
);
|
||||
}
|
||||
else if (Pstream::defaultCommsType == Pstream::scheduled)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
schedule(),
|
||||
constructSize_,
|
||||
subMap_,
|
||||
constructMap_,
|
||||
fld
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::blocking,
|
||||
List<labelPair>(),
|
||||
constructSize_,
|
||||
subMap_,
|
||||
constructMap_,
|
||||
fld
|
||||
);
|
||||
}
|
||||
}
|
||||
void distribute(List<T>& fld, const bool dummyTransform = true)
|
||||
const;
|
||||
|
||||
//- Same but with transforms
|
||||
template<class T>
|
||||
void distribute
|
||||
(
|
||||
const globalIndexAndTransform&,
|
||||
List<T>& fld,
|
||||
const bool isPosition
|
||||
) const;
|
||||
|
||||
//- Reverse distribute data using default commsType.
|
||||
template<class T>
|
||||
void reverseDistribute(const label constructSize, List<T>& fld)
|
||||
const
|
||||
{
|
||||
if (Pstream::defaultCommsType == Pstream::nonBlocking)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
List<labelPair>(),
|
||||
constructSize,
|
||||
constructMap_,
|
||||
subMap_,
|
||||
fld
|
||||
);
|
||||
}
|
||||
else if (Pstream::defaultCommsType == Pstream::scheduled)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
schedule(),
|
||||
constructSize,
|
||||
constructMap_,
|
||||
subMap_,
|
||||
fld
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::blocking,
|
||||
List<labelPair>(),
|
||||
constructSize,
|
||||
constructMap_,
|
||||
subMap_,
|
||||
fld
|
||||
);
|
||||
}
|
||||
}
|
||||
void reverseDistribute
|
||||
(
|
||||
const label constructSize,
|
||||
List<T>&,
|
||||
const bool dummyTransform = true
|
||||
) const;
|
||||
|
||||
//- Same but with transforms
|
||||
template<class T>
|
||||
void reverseDistribute
|
||||
(
|
||||
const globalIndexAndTransform&,
|
||||
const label constructSize,
|
||||
List<T>& fld,
|
||||
const bool isPosition
|
||||
) const;
|
||||
|
||||
//- Reverse distribute data using default commsType.
|
||||
// Since constructSize might be larger than supplied size supply
|
||||
@ -336,53 +491,20 @@ public:
|
||||
(
|
||||
const label constructSize,
|
||||
const T& nullValue,
|
||||
List<T>& fld
|
||||
)
|
||||
const
|
||||
{
|
||||
if (Pstream::defaultCommsType == Pstream::nonBlocking)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
List<labelPair>(),
|
||||
constructSize,
|
||||
constructMap_,
|
||||
subMap_,
|
||||
fld,
|
||||
eqOp<T>(),
|
||||
nullValue
|
||||
);
|
||||
}
|
||||
else if (Pstream::defaultCommsType == Pstream::scheduled)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
schedule(),
|
||||
constructSize,
|
||||
constructMap_,
|
||||
subMap_,
|
||||
fld,
|
||||
eqOp<T>(),
|
||||
nullValue
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::blocking,
|
||||
List<labelPair>(),
|
||||
constructSize,
|
||||
constructMap_,
|
||||
subMap_,
|
||||
fld,
|
||||
eqOp<T>(),
|
||||
nullValue
|
||||
);
|
||||
}
|
||||
}
|
||||
List<T>& fld,
|
||||
const bool dummyTransform = true
|
||||
) const;
|
||||
|
||||
//- Same but with transforms
|
||||
template<class T>
|
||||
void reverseDistribute
|
||||
(
|
||||
const globalIndexAndTransform&,
|
||||
const label constructSize,
|
||||
const T& nullValue,
|
||||
List<T>& fld,
|
||||
const bool isPosition
|
||||
) const;
|
||||
|
||||
//- Do all sends using PstreamBuffers
|
||||
template<class T>
|
||||
@ -391,6 +513,9 @@ public:
|
||||
template<class T>
|
||||
void receive(PstreamBuffers&, List<T>&) const;
|
||||
|
||||
//- Debug: print layout
|
||||
void printLayout(Ostream& os) const;
|
||||
|
||||
//- Correct for topo change.
|
||||
void updateMesh(const mapPolyMesh&)
|
||||
{
|
||||
@ -406,6 +531,24 @@ public:
|
||||
|
||||
};
|
||||
|
||||
//- Specialisation for transforms that can apply positional transform
|
||||
template<>
|
||||
void mapDistribute::applyTransforms
|
||||
(
|
||||
const globalIndexAndTransform& globalTransforms,
|
||||
List<point>& field,
|
||||
const bool isPosition
|
||||
//const CombineOp& cop
|
||||
) const;
|
||||
|
||||
template<> //, class CombineOp>
|
||||
void mapDistribute::applyInverseTransforms
|
||||
(
|
||||
const globalIndexAndTransform& globalTransforms,
|
||||
List<point>& field,
|
||||
const bool isPosition
|
||||
//const CombineOp& cop
|
||||
) const;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -26,6 +26,8 @@ License
|
||||
#include "Pstream.H"
|
||||
#include "PstreamBuffers.H"
|
||||
#include "PstreamCombineReduceOps.H"
|
||||
#include "globalIndexAndTransform.H"
|
||||
#include "transformField.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -774,4 +776,355 @@ void Foam::mapDistribute::receive(PstreamBuffers& pBufs, List<T>& field) const
|
||||
}
|
||||
|
||||
|
||||
// In case of no transform: copy elements
|
||||
template<class T>
|
||||
void Foam::mapDistribute::applyDummyTransforms(List<T>& field) const
|
||||
{
|
||||
forAll(transformElements_, trafoI)
|
||||
{
|
||||
const labelList& elems = transformElements_[trafoI];
|
||||
|
||||
label n = transformStart_[trafoI];
|
||||
|
||||
forAll(elems, i)
|
||||
{
|
||||
field[n++] = field[elems[i]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// In case of no transform: copy elements
|
||||
template<class T>
|
||||
void Foam::mapDistribute::applyDummyInverseTransforms(List<T>& field) const
|
||||
{
|
||||
forAll(transformElements_, trafoI)
|
||||
{
|
||||
const labelList& elems = transformElements_[trafoI];
|
||||
label n = transformStart_[trafoI];
|
||||
|
||||
forAll(elems, i)
|
||||
{
|
||||
field[elems[i]] = field[n++];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Calculate transformed elements.
|
||||
template<class T> //, class CombineOp>
|
||||
void Foam::mapDistribute::applyTransforms
|
||||
(
|
||||
const globalIndexAndTransform& globalTransforms,
|
||||
List<T>& field,
|
||||
const bool isPosition
|
||||
//const CombineOp& cop
|
||||
) const
|
||||
{
|
||||
if (isPosition)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"mapDistribute::applyTransforms\n"
|
||||
"(\n"
|
||||
" const globalIndexAndTransform&,\n"
|
||||
" List<T>&,\n"
|
||||
" const bool\n"
|
||||
") const\n"
|
||||
) << "It does not make sense to apply position transformation"
|
||||
<< " for anything else than pointFields."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
const List<vectorTensorTransform>& totalTransform =
|
||||
globalTransforms.transformPermutations();
|
||||
|
||||
forAll(totalTransform, trafoI)
|
||||
{
|
||||
const vectorTensorTransform& vt = totalTransform[trafoI];
|
||||
const labelList& elems = transformElements_[trafoI];
|
||||
label n = transformStart_[trafoI];
|
||||
|
||||
// Could be optimised to avoid memory allocations
|
||||
Field<T> transformFld(transform(vt.R(), Field<T>(field, elems)));
|
||||
|
||||
forAll(transformFld, i)
|
||||
{
|
||||
//cop(field[n++], transformFld[i]);
|
||||
field[n++] = transformFld[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Calculate transformed elements.
|
||||
template<class T> //, class CombineOp>
|
||||
void Foam::mapDistribute::applyInverseTransforms
|
||||
(
|
||||
const globalIndexAndTransform& globalTransforms,
|
||||
List<T>& field,
|
||||
const bool isPosition
|
||||
//const CombineOp& cop
|
||||
) const
|
||||
{
|
||||
if (isPosition)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"mapDistribute::applyInverseTransforms\n"
|
||||
"(\n"
|
||||
" const globalIndexAndTransform&,\n"
|
||||
" List<T>&,\n"
|
||||
" const bool\n"
|
||||
") const\n"
|
||||
) << "It does not make sense to apply position transformation"
|
||||
<< " for anything else than pointFields."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
const List<vectorTensorTransform>& totalTransform =
|
||||
globalTransforms.transformPermutations();
|
||||
|
||||
forAll(totalTransform, trafoI)
|
||||
{
|
||||
const vectorTensorTransform& vt = totalTransform[trafoI];
|
||||
const labelList& elems = transformElements_[trafoI];
|
||||
label n = transformStart_[trafoI];
|
||||
|
||||
// Could be optimised to avoid memory allocations
|
||||
Field<T> transformFld(SubField<T>(field, elems.size(), n));
|
||||
transform(transformFld, vt.R().T(), transformFld);
|
||||
|
||||
forAll(transformFld, i)
|
||||
{
|
||||
//cop(field[elems[i]], transformFld[i]);
|
||||
field[elems[i]] = transformFld[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//- Distribute data using default commsType.
|
||||
template<class T>
|
||||
void Foam::mapDistribute::distribute
|
||||
(
|
||||
List<T>& fld,
|
||||
const bool dummyTransform
|
||||
) const
|
||||
{
|
||||
if (Pstream::defaultCommsType == Pstream::nonBlocking)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
List<labelPair>(),
|
||||
constructSize_,
|
||||
subMap_,
|
||||
constructMap_,
|
||||
fld
|
||||
);
|
||||
}
|
||||
else if (Pstream::defaultCommsType == Pstream::scheduled)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
schedule(),
|
||||
constructSize_,
|
||||
subMap_,
|
||||
constructMap_,
|
||||
fld
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::blocking,
|
||||
List<labelPair>(),
|
||||
constructSize_,
|
||||
subMap_,
|
||||
constructMap_,
|
||||
fld
|
||||
);
|
||||
}
|
||||
|
||||
//- Fill in transformed slots with copies
|
||||
if (dummyTransform)
|
||||
{
|
||||
applyDummyTransforms(fld);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//- Reverse distribute data using default commsType.
|
||||
template<class T>
|
||||
void Foam::mapDistribute::reverseDistribute
|
||||
(
|
||||
const label constructSize,
|
||||
List<T>& fld,
|
||||
const bool dummyTransform
|
||||
) const
|
||||
{
|
||||
if (dummyTransform)
|
||||
{
|
||||
applyDummyInverseTransforms(fld);
|
||||
}
|
||||
|
||||
if (Pstream::defaultCommsType == Pstream::nonBlocking)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
List<labelPair>(),
|
||||
constructSize,
|
||||
constructMap_,
|
||||
subMap_,
|
||||
fld
|
||||
);
|
||||
}
|
||||
else if (Pstream::defaultCommsType == Pstream::scheduled)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
schedule(),
|
||||
constructSize,
|
||||
constructMap_,
|
||||
subMap_,
|
||||
fld
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::blocking,
|
||||
List<labelPair>(),
|
||||
constructSize,
|
||||
constructMap_,
|
||||
subMap_,
|
||||
fld
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//- Reverse distribute data using default commsType.
|
||||
// Since constructSize might be larger than supplied size supply
|
||||
// a nullValue
|
||||
template<class T>
|
||||
void Foam::mapDistribute::reverseDistribute
|
||||
(
|
||||
const label constructSize,
|
||||
const T& nullValue,
|
||||
List<T>& fld,
|
||||
const bool dummyTransform
|
||||
) const
|
||||
{
|
||||
if (dummyTransform)
|
||||
{
|
||||
applyDummyInverseTransforms(fld);
|
||||
}
|
||||
|
||||
if (Pstream::defaultCommsType == Pstream::nonBlocking)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
List<labelPair>(),
|
||||
constructSize,
|
||||
constructMap_,
|
||||
subMap_,
|
||||
fld,
|
||||
eqOp<T>(),
|
||||
nullValue
|
||||
);
|
||||
}
|
||||
else if (Pstream::defaultCommsType == Pstream::scheduled)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
schedule(),
|
||||
constructSize,
|
||||
constructMap_,
|
||||
subMap_,
|
||||
fld,
|
||||
eqOp<T>(),
|
||||
nullValue
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::blocking,
|
||||
List<labelPair>(),
|
||||
constructSize,
|
||||
constructMap_,
|
||||
subMap_,
|
||||
fld,
|
||||
eqOp<T>(),
|
||||
nullValue
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//- Distribute data using default commsType.
|
||||
template<class T>
|
||||
void Foam::mapDistribute::distribute
|
||||
(
|
||||
const globalIndexAndTransform& git,
|
||||
List<T>& fld,
|
||||
const bool isPosition
|
||||
) const
|
||||
{
|
||||
// Distribute. Leave out dummy transforms since we're doing them ourselves
|
||||
distribute(fld, false);
|
||||
// Do transforms
|
||||
applyTransforms(git, fld, isPosition); //, eqOp<T>());
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::mapDistribute::reverseDistribute
|
||||
(
|
||||
const globalIndexAndTransform& git,
|
||||
const label constructSize,
|
||||
List<T>& fld,
|
||||
const bool isPosition
|
||||
) const
|
||||
{
|
||||
// Fill slots with reverse-transformed data. Note that it also copies
|
||||
// back into the non-remote part of fld even though these values are not
|
||||
// used.
|
||||
applyInverseTransforms(git, fld, isPosition); //, eqOp<T>());
|
||||
|
||||
// And send back (the remote slots). Disable dummy transformations.
|
||||
reverseDistribute(constructSize, fld, false);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::mapDistribute::reverseDistribute
|
||||
(
|
||||
const globalIndexAndTransform& git,
|
||||
const label constructSize,
|
||||
const T& nullValue,
|
||||
List<T>& fld,
|
||||
const bool isPosition
|
||||
) const
|
||||
{
|
||||
// Fill slots with reverse-transformed data Note that it also copies
|
||||
// back into the non-remote part of fld even though these values are not
|
||||
// used.
|
||||
applyInverseTransforms(git, fld, isPosition); //, eqOp<T>());
|
||||
|
||||
// And send back (the remote slots) Disable dummy transformations.
|
||||
reverseDistribute(constructSize, nullValue, fld, false);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -673,6 +673,8 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const
|
||||
|
||||
bool hasError = false;
|
||||
|
||||
HashSet<word> patchNames(2*size());
|
||||
|
||||
forAll(bm, patchI)
|
||||
{
|
||||
if (bm[patchI].start() != nextPatchStart && !hasError)
|
||||
@ -689,6 +691,17 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const
|
||||
<< " Suppressing future warnings." << endl;
|
||||
}
|
||||
|
||||
if (!patchNames.insert(bm[patchI].name()) && !hasError)
|
||||
{
|
||||
hasError = true;
|
||||
|
||||
Info<< " ****Duplicate boundary patch " << patchI
|
||||
<< " named " << bm[patchI].name()
|
||||
<< " of type " << bm[patchI].type()
|
||||
<< "." << endl
|
||||
<< "Suppressing future warnings." << endl;
|
||||
}
|
||||
|
||||
nextPatchStart += bm[patchI].size();
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -45,7 +45,6 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
typedef List<labelPair> labelPairList;
|
||||
class polyMesh;
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
@ -276,9 +276,16 @@ void Foam::cyclicPolyPatch::calcTransforms
|
||||
|
||||
if (transform_ == ROTATIONAL && !parallel() && forwardT().size() > 1)
|
||||
{
|
||||
const_cast<tensorField&>(forwardT()).setSize(1);
|
||||
const_cast<tensorField&>(reverseT()).setSize(1);
|
||||
// Get index of maximum area face to minimise truncation errors.
|
||||
label max0I = findMaxArea(half0.points(), half0);
|
||||
|
||||
const tensor fwdT = forwardT()[max0I];
|
||||
const_cast<tensorField&>(forwardT()) = tensorField(1, fwdT);
|
||||
const tensor revT = reverseT()[max0I];
|
||||
const_cast<tensorField&>(reverseT()) = tensorField(1, revT);
|
||||
const bool coll = collocated()[max0I];
|
||||
const_cast<boolList&>(collocated()).setSize(1);
|
||||
const_cast<boolList&>(collocated())[0] = coll;
|
||||
|
||||
WarningIn
|
||||
(
|
||||
@ -293,8 +300,9 @@ void Foam::cyclicPolyPatch::calcTransforms
|
||||
) << "For patch " << name()
|
||||
<< " calculated non-uniform transform tensor even though"
|
||||
<< " the transform type is " << transformTypeNames[transform_]
|
||||
<< ". Setting the transformation tensor to be a uniform"
|
||||
<< " rotation."
|
||||
<< "." << nl
|
||||
<< " Setting the transformation tensor to be a uniform"
|
||||
<< " rotation calculated from face " << max0I
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
@ -695,9 +703,43 @@ Foam::cyclicPolyPatch::~cyclicPolyPatch()
|
||||
}
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::label Foam::cyclicPolyPatch::neighbPatchID() const
|
||||
{
|
||||
if (neighbPatchID_ == -1)
|
||||
{
|
||||
neighbPatchID_ = this->boundaryMesh().findPatchID(neighbPatchName_);
|
||||
|
||||
if (neighbPatchID_ == -1)
|
||||
{
|
||||
FatalErrorIn("cyclicPolyPatch::neighbPatchID() const")
|
||||
<< "Illegal neighbourPatch name " << neighbPatchName_
|
||||
<< endl << "Valid patch names are "
|
||||
<< this->boundaryMesh().names()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// Check that it is a cyclic
|
||||
const cyclicPolyPatch& nbrPatch = refCast<const cyclicPolyPatch>
|
||||
(
|
||||
this->boundaryMesh()[neighbPatchID_]
|
||||
);
|
||||
|
||||
if (nbrPatch.neighbPatchName() != name())
|
||||
{
|
||||
WarningIn("cyclicPolyPatch::neighbPatchID() const")
|
||||
<< "Patch " << name()
|
||||
<< " specifies neighbour patch " << neighbPatchName()
|
||||
<< endl << " but that in return specifies "
|
||||
<< nbrPatch.neighbPatchName()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
return neighbPatchID_;
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicPolyPatch::transformPosition(pointField& l) const
|
||||
{
|
||||
if (!parallel())
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -197,6 +197,10 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
//- Declare friendship with processorCyclicPolyPatch
|
||||
friend class processorCyclicPolyPatch;
|
||||
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("cyclic");
|
||||
|
||||
@ -321,25 +325,7 @@ public:
|
||||
}
|
||||
|
||||
//- Neighbour patchID.
|
||||
virtual label neighbPatchID() const
|
||||
{
|
||||
if (neighbPatchID_ == -1)
|
||||
{
|
||||
neighbPatchID_ = this->boundaryMesh().findPatchID
|
||||
(
|
||||
neighbPatchName_
|
||||
);
|
||||
if (neighbPatchID_ == -1)
|
||||
{
|
||||
FatalErrorIn("cyclicPolyPatch::neighbPatchID() const")
|
||||
<< "Illegal neighbourPatch name " << neighbPatchName_
|
||||
<< endl << "Valid patch names are "
|
||||
<< this->boundaryMesh().names()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
return neighbPatchID_;
|
||||
}
|
||||
virtual label neighbPatchID() const;
|
||||
|
||||
virtual bool owner() const
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -26,6 +26,7 @@ License
|
||||
#include "processorCyclicPolyPatch.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "SubField.H"
|
||||
#include "cyclicPolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -171,9 +172,9 @@ void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
|
||||
// - or do we not auto-calculate the transformation but
|
||||
// have option of reading it.
|
||||
|
||||
// Update underlying cyclic
|
||||
// Update underlying cyclic halves. Need to do both since only one
|
||||
// half might be present as a processorCyclic.
|
||||
coupledPolyPatch& pp = const_cast<coupledPolyPatch&>(referPatch());
|
||||
|
||||
pp.calcGeometry
|
||||
(
|
||||
*this,
|
||||
@ -184,6 +185,21 @@ void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
|
||||
neighbFaceAreas(),
|
||||
neighbFaceCellCentres()
|
||||
);
|
||||
|
||||
if (isA<cyclicPolyPatch>(pp))
|
||||
{
|
||||
const cyclicPolyPatch& cpp = refCast<const cyclicPolyPatch>(pp);
|
||||
const_cast<cyclicPolyPatch&>(cpp.neighbPatch()).calcGeometry
|
||||
(
|
||||
*this,
|
||||
neighbFaceCentres(),
|
||||
neighbFaceAreas(),
|
||||
neighbFaceCellCentres(),
|
||||
faceCentres(),
|
||||
faceAreas(),
|
||||
faceCellCentres()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,7 +24,6 @@ License
|
||||
\*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "syncTools.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -99,24 +98,6 @@ void Foam::syncTools::transform::operator()
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// Does anyone have couples? Since meshes might have 0 cells and 0 proc
|
||||
// boundaries need to reduce this info.
|
||||
bool Foam::syncTools::hasCouples(const polyBoundaryMesh& patches)
|
||||
{
|
||||
bool hasAnyCouples = false;
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
if (patches[patchI].coupled())
|
||||
{
|
||||
hasAnyCouples = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return returnReduce(hasAnyCouples, orOp<bool>());
|
||||
}
|
||||
|
||||
|
||||
// Determines for every point whether it is coupled and if so sets only one.
|
||||
Foam::PackedBoolList Foam::syncTools::getMasterPoints(const polyMesh& mesh)
|
||||
{
|
||||
@ -125,12 +106,21 @@ Foam::PackedBoolList Foam::syncTools::getMasterPoints(const polyMesh& mesh)
|
||||
|
||||
const globalMeshData& globalData = mesh.globalData();
|
||||
const labelList& meshPoints = globalData.coupledPatch().meshPoints();
|
||||
const labelListList& pointSlaves = globalData.globalPointAllSlaves();
|
||||
const labelListList& slaves = globalData.globalPointSlaves();
|
||||
const labelListList& transformedSlaves =
|
||||
globalData.globalPointTransformedSlaves();
|
||||
|
||||
forAll(meshPoints, coupledPointI)
|
||||
{
|
||||
label meshPointI = meshPoints[coupledPointI];
|
||||
if (pointSlaves[coupledPointI].size() > 0)
|
||||
if
|
||||
(
|
||||
(
|
||||
slaves[coupledPointI].size()
|
||||
+ transformedSlaves[coupledPointI].size()
|
||||
)
|
||||
> 0
|
||||
)
|
||||
{
|
||||
isMasterPoint[meshPointI] = true;
|
||||
}
|
||||
@ -161,12 +151,21 @@ Foam::PackedBoolList Foam::syncTools::getMasterEdges(const polyMesh& mesh)
|
||||
|
||||
const globalMeshData& globalData = mesh.globalData();
|
||||
const labelList& meshEdges = globalData.coupledPatchMeshEdges();
|
||||
const labelListList& edgeSlaves = globalData.globalEdgeAllSlaves();
|
||||
const labelListList& slaves = globalData.globalEdgeSlaves();
|
||||
const labelListList& transformedSlaves =
|
||||
globalData.globalEdgeTransformedSlaves();
|
||||
|
||||
forAll(meshEdges, coupledEdgeI)
|
||||
{
|
||||
label meshEdgeI = meshEdges[coupledEdgeI];
|
||||
if (edgeSlaves[coupledEdgeI].size() > 0)
|
||||
if
|
||||
(
|
||||
(
|
||||
slaves[coupledEdgeI].size()
|
||||
+ transformedSlaves[coupledEdgeI].size()
|
||||
)
|
||||
> 0
|
||||
)
|
||||
{
|
||||
isMasterEdge[meshEdgeI] = true;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -33,12 +33,6 @@ Description
|
||||
- null value which gets overridden by any valid value.
|
||||
- transform function
|
||||
|
||||
note:Can apply coordinate rotation/separation on cyclics but only for faces
|
||||
or if there is a single rotation/separation tensor.
|
||||
note:syncPointList or syncEdgeList will visit shared points/edges
|
||||
multiple times (once through patch exchange, once through shared
|
||||
points reduce). Should be replaced by pointMesh functionality.
|
||||
|
||||
SourceFiles
|
||||
syncTools.C
|
||||
syncToolsTemplates.C
|
||||
@ -48,9 +42,7 @@ SourceFiles
|
||||
#ifndef syncTools_H
|
||||
#define syncTools_H
|
||||
|
||||
#include "UList.H"
|
||||
#include "Pstream.H"
|
||||
#include "Map.H"
|
||||
#include "EdgeMap.H"
|
||||
#include "PackedBoolList.H"
|
||||
#include "polyMesh.H"
|
||||
@ -72,9 +64,6 @@ class syncTools
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Check whether uses couples.
|
||||
static bool hasCouples(const polyBoundaryMesh&);
|
||||
|
||||
//- Combine value with existing value in map.
|
||||
template <class T, class CombineOp>
|
||||
static void combine
|
||||
@ -174,41 +163,41 @@ public:
|
||||
const CombineOp& cop,
|
||||
const TransformOp& top
|
||||
);
|
||||
|
||||
//- Synchronize values on all mesh points.
|
||||
template <class T, class CombineOp, class TransformOp>
|
||||
static void syncPointList
|
||||
(
|
||||
const polyMesh&,
|
||||
UList<T>&,
|
||||
const CombineOp& cop,
|
||||
const T& nullValue,
|
||||
const TransformOp& top
|
||||
);
|
||||
|
||||
//- Synchronize values on selected mesh points.
|
||||
template <class T, class CombineOp, class TransformOp>
|
||||
static void syncPointList
|
||||
(
|
||||
const polyMesh&,
|
||||
const labelList& meshPoints,
|
||||
UList<T>&,
|
||||
const CombineOp& cop,
|
||||
const T& nullValue,
|
||||
const TransformOp& top
|
||||
);
|
||||
|
||||
//- Synchronize values on all mesh edges.
|
||||
template <class T, class CombineOp, class TransformOp>
|
||||
static void syncEdgeList
|
||||
(
|
||||
const polyMesh&,
|
||||
UList<T>&,
|
||||
const CombineOp& cop,
|
||||
const T& nullValue,
|
||||
const TransformOp& top
|
||||
);
|
||||
|
||||
//
|
||||
// //- Synchronize values on all mesh points.
|
||||
// template <class T, class CombineOp, class TransformOp>
|
||||
// static void syncPointList
|
||||
// (
|
||||
// const polyMesh&,
|
||||
// UList<T>&,
|
||||
// const CombineOp& cop,
|
||||
// const T& nullValue,
|
||||
// const TransformOp& top
|
||||
// );
|
||||
//
|
||||
// //- Synchronize values on selected mesh points.
|
||||
// template <class T, class CombineOp, class TransformOp>
|
||||
// static void syncPointList
|
||||
// (
|
||||
// const polyMesh&,
|
||||
// const labelList& meshPoints,
|
||||
// UList<T>&,
|
||||
// const CombineOp& cop,
|
||||
// const T& nullValue,
|
||||
// const TransformOp& top
|
||||
// );
|
||||
//
|
||||
// //- Synchronize values on all mesh edges.
|
||||
// template <class T, class CombineOp, class TransformOp>
|
||||
// static void syncEdgeList
|
||||
// (
|
||||
// const polyMesh&,
|
||||
// UList<T>&,
|
||||
// const CombineOp& cop,
|
||||
// const T& nullValue,
|
||||
// const TransformOp& top
|
||||
// );
|
||||
//
|
||||
//- Synchronize values on boundary faces only.
|
||||
template <class T, class CombineOp, class TransformOp>
|
||||
static void syncBoundaryFaceList
|
||||
@ -227,26 +216,20 @@ public:
|
||||
static void syncPointList
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
UList<T>& l,
|
||||
List<T>& l,
|
||||
const CombineOp& cop,
|
||||
const T& nullValue
|
||||
)
|
||||
{
|
||||
syncPointList(mesh, l, cop, nullValue, transform());
|
||||
}
|
||||
);
|
||||
|
||||
//- Synchronize locations on all mesh points.
|
||||
template <class CombineOp>
|
||||
static void syncPointPositions
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
UList<point>& l,
|
||||
List<point>& l,
|
||||
const CombineOp& cop,
|
||||
const point& nullValue
|
||||
)
|
||||
{
|
||||
syncPointList(mesh, l, cop, nullValue, transformPosition());
|
||||
}
|
||||
);
|
||||
|
||||
//- Synchronize values on selected mesh points.
|
||||
template <class T, class CombineOp>
|
||||
@ -257,18 +240,7 @@ public:
|
||||
UList<T>& l,
|
||||
const CombineOp& cop,
|
||||
const T& nullValue
|
||||
)
|
||||
{
|
||||
syncPointList
|
||||
(
|
||||
mesh,
|
||||
meshPoints,
|
||||
l,
|
||||
cop,
|
||||
nullValue,
|
||||
transform()
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
//- Synchronize locations on selected mesh points.
|
||||
template <class CombineOp>
|
||||
@ -279,18 +251,7 @@ public:
|
||||
UList<point>& l,
|
||||
const CombineOp& cop,
|
||||
const point& nullValue
|
||||
)
|
||||
{
|
||||
syncPointList
|
||||
(
|
||||
mesh,
|
||||
meshPoints,
|
||||
l,
|
||||
cop,
|
||||
nullValue,
|
||||
transformPosition()
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// Synchronise edge-wise data
|
||||
@ -303,10 +264,7 @@ public:
|
||||
UList<T>& l,
|
||||
const CombineOp& cop,
|
||||
const T& nullValue
|
||||
)
|
||||
{
|
||||
syncEdgeList(mesh, l, cop, nullValue, transform());
|
||||
}
|
||||
);
|
||||
|
||||
//- Synchronize values on all mesh edges.
|
||||
template <class CombineOp>
|
||||
@ -316,10 +274,7 @@ public:
|
||||
UList<point>& l,
|
||||
const CombineOp& cop,
|
||||
const point& nullValue
|
||||
)
|
||||
{
|
||||
syncEdgeList(mesh, l, cop, nullValue, transformPosition());
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// Synchronise face-wise data
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,8 +32,6 @@ License
|
||||
#include "transform.H"
|
||||
#include "transformList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// Combine val with existing value at index
|
||||
@ -93,11 +91,6 @@ void Foam::syncTools::syncPointMap
|
||||
{
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
if (!hasCouples(patches))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
@ -398,11 +391,6 @@ void Foam::syncTools::syncEdgeMap
|
||||
{
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
if (!hasCouples(patches))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Do synchronisation without constructing globalEdge addressing
|
||||
// (since this constructs mesh edge addressing)
|
||||
@ -767,14 +755,232 @@ void Foam::syncTools::syncEdgeMap
|
||||
}
|
||||
|
||||
|
||||
template <class T, class CombineOp, class TransformOp>
|
||||
//template <class T, class CombineOp, class TransformOp>
|
||||
//void Foam::syncTools::syncPointList
|
||||
//(
|
||||
// const polyMesh& mesh,
|
||||
// UList<T>& pointValues,
|
||||
// const CombineOp& cop,
|
||||
// const T& nullValue,
|
||||
// const TransformOp& top
|
||||
//)
|
||||
//{
|
||||
// if (pointValues.size() != mesh.nPoints())
|
||||
// {
|
||||
// FatalErrorIn
|
||||
// (
|
||||
// "syncTools<class T, class CombineOp>::syncPointList"
|
||||
// "(const polyMesh&, UList<T>&, const CombineOp&, const T&"
|
||||
// ", const bool)"
|
||||
// ) << "Number of values " << pointValues.size()
|
||||
// << " is not equal to the number of points in the mesh "
|
||||
// << mesh.nPoints() << abort(FatalError);
|
||||
// }
|
||||
//
|
||||
// const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
//
|
||||
//
|
||||
// if (Pstream::parRun())
|
||||
// {
|
||||
// PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
//
|
||||
// // Send
|
||||
//
|
||||
// forAll(patches, patchI)
|
||||
// {
|
||||
// if
|
||||
// (
|
||||
// isA<processorPolyPatch>(patches[patchI])
|
||||
// && patches[patchI].nPoints() > 0
|
||||
// )
|
||||
// {
|
||||
// const processorPolyPatch& procPatch =
|
||||
// refCast<const processorPolyPatch>(patches[patchI]);
|
||||
//
|
||||
// // Get data per patchPoint in neighbouring point numbers.
|
||||
// Field<T> patchInfo(procPatch.nPoints());
|
||||
//
|
||||
// const labelList& meshPts = procPatch.meshPoints();
|
||||
// const labelList& nbrPts = procPatch.neighbPoints();
|
||||
//
|
||||
// forAll(nbrPts, pointI)
|
||||
// {
|
||||
// label nbrPointI = nbrPts[pointI];
|
||||
// patchInfo[nbrPointI] = pointValues[meshPts[pointI]];
|
||||
// }
|
||||
//
|
||||
// UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
|
||||
// toNbr << patchInfo;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// pBufs.finishedSends();
|
||||
//
|
||||
// // Receive and combine.
|
||||
//
|
||||
// forAll(patches, patchI)
|
||||
// {
|
||||
// if
|
||||
// (
|
||||
// isA<processorPolyPatch>(patches[patchI])
|
||||
// && patches[patchI].nPoints() > 0
|
||||
// )
|
||||
// {
|
||||
// const processorPolyPatch& procPatch =
|
||||
// refCast<const processorPolyPatch>(patches[patchI]);
|
||||
//
|
||||
// Field<T> nbrPatchInfo(procPatch.nPoints());
|
||||
// {
|
||||
// UIPstream fromNbr(procPatch.neighbProcNo(), pBufs);
|
||||
// fromNbr >> nbrPatchInfo;
|
||||
// }
|
||||
//
|
||||
// // Transform to this side
|
||||
// top(procPatch, nbrPatchInfo);
|
||||
//
|
||||
// const labelList& meshPts = procPatch.meshPoints();
|
||||
//
|
||||
// forAll(meshPts, pointI)
|
||||
// {
|
||||
// label meshPointI = meshPts[pointI];
|
||||
// cop(pointValues[meshPointI], nbrPatchInfo[pointI]);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Do the cyclics.
|
||||
// forAll(patches, patchI)
|
||||
// {
|
||||
// if (isA<cyclicPolyPatch>(patches[patchI]))
|
||||
// {
|
||||
// const cyclicPolyPatch& cycPatch =
|
||||
// refCast<const cyclicPolyPatch>(patches[patchI]);
|
||||
//
|
||||
// if (cycPatch.owner())
|
||||
// {
|
||||
// // Owner does all.
|
||||
//
|
||||
// const edgeList& coupledPoints = cycPatch.coupledPoints();
|
||||
// const labelList& meshPts = cycPatch.meshPoints();
|
||||
// const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
// const labelList& nbrMeshPoints = nbrPatch.meshPoints();
|
||||
//
|
||||
// Field<T> half0Values(coupledPoints.size());
|
||||
// Field<T> half1Values(coupledPoints.size());
|
||||
//
|
||||
// forAll(coupledPoints, i)
|
||||
// {
|
||||
// const edge& e = coupledPoints[i];
|
||||
// half0Values[i] = pointValues[meshPts[e[0]]];
|
||||
// half1Values[i] = pointValues[nbrMeshPoints[e[1]]];
|
||||
// }
|
||||
//
|
||||
// //SubField<T> slice0(half0Values, half0Values.size());
|
||||
// //SubField<T> slice1(half1Values, half1Values.size());
|
||||
// //top(cycPatch, reinterpret_cast<Field<T>&>(slice1));
|
||||
// //top(nbrPatch, reinterpret_cast<Field<T>&>(slice0));
|
||||
//
|
||||
// top(cycPatch, half1Values);
|
||||
// top(nbrPatch, half0Values);
|
||||
//
|
||||
// forAll(coupledPoints, i)
|
||||
// {
|
||||
// const edge& e = coupledPoints[i];
|
||||
// cop(pointValues[meshPts[e[0]]], half1Values[i]);
|
||||
// cop(pointValues[nbrMeshPoints[e[1]]], half0Values[i]);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Synchronize multiple shared points.
|
||||
// const globalMeshData& pd = mesh.globalData();
|
||||
//
|
||||
// if (pd.nGlobalPoints() > 0)
|
||||
// {
|
||||
// // Values on shared points.
|
||||
// Field<T> sharedPts(pd.nGlobalPoints(), nullValue);
|
||||
//
|
||||
// forAll(pd.sharedPointLabels(), i)
|
||||
// {
|
||||
// label meshPointI = pd.sharedPointLabels()[i];
|
||||
// // Fill my entries in the shared points
|
||||
// sharedPts[pd.sharedPointAddr()[i]] = pointValues[meshPointI];
|
||||
// }
|
||||
//
|
||||
// // Combine on master.
|
||||
// Pstream::listCombineGather(sharedPts, cop);
|
||||
// Pstream::listCombineScatter(sharedPts);
|
||||
//
|
||||
// // Now we will all have the same information. Merge it back with
|
||||
// // my local information.
|
||||
// forAll(pd.sharedPointLabels(), i)
|
||||
// {
|
||||
// label meshPointI = pd.sharedPointLabels()[i];
|
||||
// pointValues[meshPointI] = sharedPts[pd.sharedPointAddr()[i]];
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
//template <class T, class CombineOp, class TransformOp>
|
||||
//void Foam::syncTools::syncPointList
|
||||
//(
|
||||
// const polyMesh& mesh,
|
||||
// const labelList& meshPoints,
|
||||
// UList<T>& pointValues,
|
||||
// const CombineOp& cop,
|
||||
// const T& nullValue,
|
||||
// const TransformOp& top
|
||||
//)
|
||||
//{
|
||||
// if (pointValues.size() != meshPoints.size())
|
||||
// {
|
||||
// FatalErrorIn
|
||||
// (
|
||||
// "syncTools<class T, class CombineOp>::syncPointList"
|
||||
// "(const polyMesh&, const labelList&, UList<T>&, const CombineOp&"
|
||||
// ", const T&, const bool)"
|
||||
// ) << "Number of values " << pointValues.size()
|
||||
// << " is not equal to the number of points "
|
||||
// << meshPoints.size() << abort(FatalError);
|
||||
// }
|
||||
//
|
||||
// if (!hasCouples(mesh.boundaryMesh()))
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// Field<T> meshValues(mesh.nPoints(), nullValue);
|
||||
//
|
||||
// forAll(meshPoints, i)
|
||||
// {
|
||||
// meshValues[meshPoints[i]] = pointValues[i];
|
||||
// }
|
||||
//
|
||||
// syncTools::syncPointList
|
||||
// (
|
||||
// mesh,
|
||||
// meshValues,
|
||||
// cop, // combine op
|
||||
// nullValue, // null value
|
||||
// top // position or field
|
||||
// );
|
||||
//
|
||||
// forAll(meshPoints, i)
|
||||
// {
|
||||
// pointValues[i] = meshValues[meshPoints[i]];
|
||||
// }
|
||||
//}
|
||||
|
||||
template <class T, class CombineOp>
|
||||
void Foam::syncTools::syncPointList
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
UList<T>& pointValues,
|
||||
List<T>& pointValues,
|
||||
const CombineOp& cop,
|
||||
const T& nullValue,
|
||||
const TransformOp& top
|
||||
const T& nullValue
|
||||
)
|
||||
{
|
||||
if (pointValues.size() != mesh.nPoints())
|
||||
@ -782,173 +988,48 @@ void Foam::syncTools::syncPointList
|
||||
FatalErrorIn
|
||||
(
|
||||
"syncTools<class T, class CombineOp>::syncPointList"
|
||||
"(const polyMesh&, UList<T>&, const CombineOp&, const T&"
|
||||
", const bool)"
|
||||
"(const polyMesh&, UList<T>&, const CombineOp&, const T&)"
|
||||
) << "Number of values " << pointValues.size()
|
||||
<< " is not equal to the number of points in the mesh "
|
||||
<< mesh.nPoints() << abort(FatalError);
|
||||
}
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
if (!hasCouples(patches))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
// Send
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
if
|
||||
(
|
||||
isA<processorPolyPatch>(patches[patchI])
|
||||
&& patches[patchI].nPoints() > 0
|
||||
)
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
// Get data per patchPoint in neighbouring point numbers.
|
||||
Field<T> patchInfo(procPatch.nPoints());
|
||||
|
||||
const labelList& meshPts = procPatch.meshPoints();
|
||||
const labelList& nbrPts = procPatch.neighbPoints();
|
||||
|
||||
forAll(nbrPts, pointI)
|
||||
{
|
||||
label nbrPointI = nbrPts[pointI];
|
||||
patchInfo[nbrPointI] = pointValues[meshPts[pointI]];
|
||||
}
|
||||
|
||||
UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
|
||||
toNbr << patchInfo;
|
||||
}
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
// Receive and combine.
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
if
|
||||
(
|
||||
isA<processorPolyPatch>(patches[patchI])
|
||||
&& patches[patchI].nPoints() > 0
|
||||
)
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
Field<T> nbrPatchInfo(procPatch.nPoints());
|
||||
{
|
||||
UIPstream fromNbr(procPatch.neighbProcNo(), pBufs);
|
||||
fromNbr >> nbrPatchInfo;
|
||||
}
|
||||
|
||||
// Transform to this side
|
||||
top(procPatch, nbrPatchInfo);
|
||||
|
||||
const labelList& meshPts = procPatch.meshPoints();
|
||||
|
||||
forAll(meshPts, pointI)
|
||||
{
|
||||
label meshPointI = meshPts[pointI];
|
||||
cop(pointValues[meshPointI], nbrPatchInfo[pointI]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Do the cyclics.
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
if (isA<cyclicPolyPatch>(patches[patchI]))
|
||||
{
|
||||
const cyclicPolyPatch& cycPatch =
|
||||
refCast<const cyclicPolyPatch>(patches[patchI]);
|
||||
|
||||
if (cycPatch.owner())
|
||||
{
|
||||
// Owner does all.
|
||||
|
||||
const edgeList& coupledPoints = cycPatch.coupledPoints();
|
||||
const labelList& meshPts = cycPatch.meshPoints();
|
||||
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
const labelList& nbrMeshPoints = nbrPatch.meshPoints();
|
||||
|
||||
Field<T> half0Values(coupledPoints.size());
|
||||
Field<T> half1Values(coupledPoints.size());
|
||||
|
||||
forAll(coupledPoints, i)
|
||||
{
|
||||
const edge& e = coupledPoints[i];
|
||||
half0Values[i] = pointValues[meshPts[e[0]]];
|
||||
half1Values[i] = pointValues[nbrMeshPoints[e[1]]];
|
||||
}
|
||||
|
||||
//SubField<T> slice0(half0Values, half0Values.size());
|
||||
//SubField<T> slice1(half1Values, half1Values.size());
|
||||
//top(cycPatch, reinterpret_cast<Field<T>&>(slice1));
|
||||
//top(nbrPatch, reinterpret_cast<Field<T>&>(slice0));
|
||||
|
||||
top(cycPatch, half1Values);
|
||||
top(nbrPatch, half0Values);
|
||||
|
||||
forAll(coupledPoints, i)
|
||||
{
|
||||
const edge& e = coupledPoints[i];
|
||||
cop(pointValues[meshPts[e[0]]], half1Values[i]);
|
||||
cop(pointValues[nbrMeshPoints[e[1]]], half0Values[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Synchronize multiple shared points.
|
||||
const globalMeshData& pd = mesh.globalData();
|
||||
|
||||
if (pd.nGlobalPoints() > 0)
|
||||
{
|
||||
// Values on shared points.
|
||||
Field<T> sharedPts(pd.nGlobalPoints(), nullValue);
|
||||
|
||||
forAll(pd.sharedPointLabels(), i)
|
||||
{
|
||||
label meshPointI = pd.sharedPointLabels()[i];
|
||||
// Fill my entries in the shared points
|
||||
sharedPts[pd.sharedPointAddr()[i]] = pointValues[meshPointI];
|
||||
}
|
||||
|
||||
// Combine on master.
|
||||
Pstream::listCombineGather(sharedPts, cop);
|
||||
Pstream::listCombineScatter(sharedPts);
|
||||
|
||||
// Now we will all have the same information. Merge it back with
|
||||
// my local information.
|
||||
forAll(pd.sharedPointLabels(), i)
|
||||
{
|
||||
label meshPointI = pd.sharedPointLabels()[i];
|
||||
pointValues[meshPointI] = sharedPts[pd.sharedPointAddr()[i]];
|
||||
}
|
||||
}
|
||||
mesh.globalData().syncPointData(pointValues, cop, false);
|
||||
}
|
||||
|
||||
|
||||
template <class T, class CombineOp, class TransformOp>
|
||||
template <class CombineOp>
|
||||
void Foam::syncTools::syncPointPositions
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
List<point>& pointValues,
|
||||
const CombineOp& cop,
|
||||
const point& nullValue
|
||||
)
|
||||
{
|
||||
if (pointValues.size() != mesh.nPoints())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"syncTools<class CombineOp>::syncPointPositions"
|
||||
"(const polyMesh&, List<point>&, const CombineOp&, const point&)"
|
||||
) << "Number of values " << pointValues.size()
|
||||
<< " is not equal to the number of points in the mesh "
|
||||
<< mesh.nPoints() << abort(FatalError);
|
||||
}
|
||||
|
||||
mesh.globalData().syncPointData(pointValues, cop, true);
|
||||
}
|
||||
|
||||
|
||||
template <class T, class CombineOp>
|
||||
void Foam::syncTools::syncPointList
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const labelList& meshPoints,
|
||||
UList<T>& pointValues,
|
||||
const CombineOp& cop,
|
||||
const T& nullValue,
|
||||
const TransformOp& top
|
||||
const T& nullValue
|
||||
)
|
||||
{
|
||||
if (pointValues.size() != meshPoints.size())
|
||||
@ -956,49 +1037,116 @@ void Foam::syncTools::syncPointList
|
||||
FatalErrorIn
|
||||
(
|
||||
"syncTools<class T, class CombineOp>::syncPointList"
|
||||
"(const polyMesh&, const labelList&, UList<T>&, const CombineOp&"
|
||||
", const T&, const bool)"
|
||||
"(const polyMesh&, UList<T>&, const CombineOp&, const T&)"
|
||||
) << "Number of values " << pointValues.size()
|
||||
<< " is not equal to the number of points "
|
||||
<< " is not equal to the number of meshPoints "
|
||||
<< meshPoints.size() << abort(FatalError);
|
||||
}
|
||||
const globalMeshData& gd = mesh.globalData();
|
||||
const indirectPrimitivePatch& cpp = gd.coupledPatch();
|
||||
const Map<label>& mpm = cpp.meshPointMap();
|
||||
|
||||
if (!hasCouples(mesh.boundaryMesh()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Field<T> meshValues(mesh.nPoints(), nullValue);
|
||||
List<T> cppFld(cpp.nPoints(), nullValue);
|
||||
|
||||
forAll(meshPoints, i)
|
||||
{
|
||||
meshValues[meshPoints[i]] = pointValues[i];
|
||||
label pointI = meshPoints[i];
|
||||
Map<label>::const_iterator iter = mpm.find(pointI);
|
||||
if (iter != mpm.end())
|
||||
{
|
||||
cppFld[iter()] = pointValues[i];
|
||||
}
|
||||
}
|
||||
|
||||
syncTools::syncPointList
|
||||
globalMeshData::syncData
|
||||
(
|
||||
mesh,
|
||||
meshValues,
|
||||
cop, // combine op
|
||||
nullValue, // null value
|
||||
top // position or field
|
||||
cppFld,
|
||||
gd.globalPointSlaves(),
|
||||
gd.globalPointTransformedSlaves(),
|
||||
gd.globalPointSlavesMap(),
|
||||
gd.globalTransforms(),
|
||||
cop,
|
||||
false //position?
|
||||
);
|
||||
|
||||
forAll(meshPoints, i)
|
||||
{
|
||||
pointValues[i] = meshValues[meshPoints[i]];
|
||||
label pointI = meshPoints[i];
|
||||
Map<label>::const_iterator iter = mpm.find(pointI);
|
||||
if (iter != mpm.end())
|
||||
{
|
||||
pointValues[i] = cppFld[iter()];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class T, class CombineOp, class TransformOp>
|
||||
template <class CombineOp>
|
||||
void Foam::syncTools::syncPointPositions
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const labelList& meshPoints,
|
||||
UList<point>& pointValues,
|
||||
const CombineOp& cop,
|
||||
const point& nullValue
|
||||
)
|
||||
{
|
||||
if (pointValues.size() != meshPoints.size())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"syncTools<class CombineOp>::syncPointList"
|
||||
"(const polyMesh&, UList<point>&, const CombineOp&, const point&)"
|
||||
) << "Number of values " << pointValues.size()
|
||||
<< " is not equal to the number of meshPoints "
|
||||
<< meshPoints.size() << abort(FatalError);
|
||||
}
|
||||
const globalMeshData& gd = mesh.globalData();
|
||||
const indirectPrimitivePatch& cpp = gd.coupledPatch();
|
||||
const Map<label>& mpm = cpp.meshPointMap();
|
||||
|
||||
List<point> cppFld(cpp.nPoints(), nullValue);
|
||||
|
||||
forAll(meshPoints, i)
|
||||
{
|
||||
label pointI = meshPoints[i];
|
||||
Map<label>::const_iterator iter = mpm.find(pointI);
|
||||
if (iter != mpm.end())
|
||||
{
|
||||
cppFld[iter()] = pointValues[i];
|
||||
}
|
||||
}
|
||||
|
||||
globalMeshData::syncData
|
||||
(
|
||||
cppFld,
|
||||
gd.globalPointSlaves(),
|
||||
gd.globalPointTransformedSlaves(),
|
||||
gd.globalPointSlavesMap(),
|
||||
gd.globalTransforms(),
|
||||
cop,
|
||||
true //position?
|
||||
);
|
||||
|
||||
forAll(meshPoints, i)
|
||||
{
|
||||
label pointI = meshPoints[i];
|
||||
Map<label>::const_iterator iter = mpm.find(pointI);
|
||||
if (iter != mpm.end())
|
||||
{
|
||||
pointValues[i] = cppFld[iter()];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class T, class CombineOp>
|
||||
void Foam::syncTools::syncEdgeList
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
UList<T>& edgeValues,
|
||||
const CombineOp& cop,
|
||||
const T& nullValue,
|
||||
const TransformOp& top
|
||||
const T& nullValue
|
||||
)
|
||||
{
|
||||
if (edgeValues.size() != mesh.nEdges())
|
||||
@ -1006,168 +1154,78 @@ void Foam::syncTools::syncEdgeList
|
||||
FatalErrorIn
|
||||
(
|
||||
"syncTools<class T, class CombineOp>::syncEdgeList"
|
||||
"(const polyMesh&, UList<T>&, const CombineOp&, const T&"
|
||||
", const bool)"
|
||||
"(const polyMesh&, UList<T>&, const CombineOp&, const T&)"
|
||||
) << "Number of values " << edgeValues.size()
|
||||
<< " is not equal to the number of edges in the mesh "
|
||||
<< mesh.nEdges() << abort(FatalError);
|
||||
}
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
const globalMeshData& gd = mesh.globalData();
|
||||
const labelList& meshEdges = gd.coupledPatchMeshEdges();
|
||||
const globalIndexAndTransform& git = gd.globalTransforms();
|
||||
const mapDistribute& edgeMap = gd.globalEdgeSlavesMap();
|
||||
|
||||
if (!hasCouples(patches))
|
||||
List<T> cppFld(UIndirectList<T>(edgeValues, meshEdges));
|
||||
|
||||
globalMeshData::syncData
|
||||
(
|
||||
cppFld,
|
||||
gd.globalEdgeSlaves(),
|
||||
gd.globalEdgeTransformedSlaves(),
|
||||
edgeMap,
|
||||
git,
|
||||
cop,
|
||||
false //position?
|
||||
);
|
||||
|
||||
// Extract back onto mesh
|
||||
forAll(meshEdges, i)
|
||||
{
|
||||
return;
|
||||
edgeValues[meshEdges[i]] = cppFld[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class CombineOp>
|
||||
void Foam::syncTools::syncEdgePositions
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
UList<point>& edgeValues,
|
||||
const CombineOp& cop,
|
||||
const point& nullValue
|
||||
)
|
||||
{
|
||||
if (edgeValues.size() != mesh.nEdges())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"syncTools<class CombineOp>::syncEdgePositions"
|
||||
"(const polyMesh&, UList<point>&, const CombineOp&, const point&)"
|
||||
) << "Number of values " << edgeValues.size()
|
||||
<< " is not equal to the number of edges in the mesh "
|
||||
<< mesh.nEdges() << abort(FatalError);
|
||||
}
|
||||
|
||||
if (Pstream::parRun())
|
||||
const globalMeshData& gd = mesh.globalData();
|
||||
const labelList& meshEdges = gd.coupledPatchMeshEdges();
|
||||
|
||||
List<point> cppFld(UIndirectList<point>(edgeValues, meshEdges));
|
||||
|
||||
globalMeshData::syncData
|
||||
(
|
||||
cppFld,
|
||||
gd.globalEdgeSlaves(),
|
||||
gd.globalEdgeTransformedSlaves(),
|
||||
gd.globalEdgeSlavesMap(),
|
||||
gd.globalTransforms(),
|
||||
cop,
|
||||
true //position?
|
||||
);
|
||||
|
||||
// Extract back onto mesh
|
||||
forAll(meshEdges, i)
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
// Send
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
if
|
||||
(
|
||||
isA<processorPolyPatch>(patches[patchI])
|
||||
&& patches[patchI].nEdges() > 0
|
||||
)
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
const labelList& meshEdges = procPatch.meshEdges();
|
||||
const labelList& neighbEdges = procPatch.neighbEdges();
|
||||
|
||||
// Get region per patch edge in neighbouring edge numbers.
|
||||
Field<T> patchInfo(procPatch.nEdges(), nullValue);
|
||||
|
||||
forAll(neighbEdges, edgeI)
|
||||
{
|
||||
label nbrEdgeI = neighbEdges[edgeI];
|
||||
|
||||
patchInfo[nbrEdgeI] = edgeValues[meshEdges[edgeI]];
|
||||
}
|
||||
|
||||
UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
|
||||
toNbr << patchInfo;
|
||||
}
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
// Receive and combine.
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
if
|
||||
(
|
||||
isA<processorPolyPatch>(patches[patchI])
|
||||
&& patches[patchI].nEdges() > 0
|
||||
)
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
const labelList& meshEdges = procPatch.meshEdges();
|
||||
|
||||
// Receive from neighbour. Is per patch edge the region of the
|
||||
// neighbouring patch edge.
|
||||
Field<T> nbrPatchInfo(procPatch.nEdges());
|
||||
|
||||
{
|
||||
UIPstream fromNeighb(procPatch.neighbProcNo(), pBufs);
|
||||
fromNeighb >> nbrPatchInfo;
|
||||
}
|
||||
|
||||
// Transform to this side
|
||||
top(procPatch, nbrPatchInfo);
|
||||
|
||||
forAll(meshEdges, edgeI)
|
||||
{
|
||||
label meshEdgeI = meshEdges[edgeI];
|
||||
cop(edgeValues[meshEdgeI], nbrPatchInfo[edgeI]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Do the cyclics.
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
if (isA<cyclicPolyPatch>(patches[patchI]))
|
||||
{
|
||||
const cyclicPolyPatch& cycPatch =
|
||||
refCast<const cyclicPolyPatch>(patches[patchI]);
|
||||
|
||||
if (cycPatch.owner())
|
||||
{
|
||||
// Owner does all.
|
||||
const edgeList& coupledEdges = cycPatch.coupledEdges();
|
||||
const labelList& meshEdges = cycPatch.meshEdges();
|
||||
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
const labelList& nbrMeshEdges = nbrPatch.meshEdges();
|
||||
|
||||
Field<T> half0Values(coupledEdges.size());
|
||||
Field<T> half1Values(coupledEdges.size());
|
||||
|
||||
forAll(coupledEdges, i)
|
||||
{
|
||||
const edge& e = coupledEdges[i];
|
||||
half0Values[i] = edgeValues[meshEdges[e[0]]];
|
||||
half1Values[i] = edgeValues[nbrMeshEdges[e[1]]];
|
||||
}
|
||||
|
||||
//SubField<T> slice0(half0Values, half0Values.size());
|
||||
//SubField<T> slice1(half1Values, half1Values.size());
|
||||
//top(cycPatch, reinterpret_cast<Field<T>&>(slice1));
|
||||
//top(nbrPatch, reinterpret_cast<Field<T>&>(slice0));
|
||||
|
||||
top(cycPatch, half1Values);
|
||||
top(nbrPatch, half0Values);
|
||||
|
||||
forAll(coupledEdges, i)
|
||||
{
|
||||
const edge& e = coupledEdges[i];
|
||||
cop(edgeValues[meshEdges[e[0]]], half1Values[i]);
|
||||
cop(edgeValues[nbrMeshEdges[e[1]]], half0Values[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- Note: hasTransformation is only used for warning messages so
|
||||
// reduction not strictly nessecary.
|
||||
//reduce(hasTransformation, orOp<bool>());
|
||||
|
||||
// Do the multiple shared edges
|
||||
const globalMeshData& pd = mesh.globalData();
|
||||
|
||||
if (pd.nGlobalEdges() > 0)
|
||||
{
|
||||
// Values on shared edges.
|
||||
Field<T> sharedPts(pd.nGlobalEdges(), nullValue);
|
||||
|
||||
forAll(pd.sharedEdgeLabels(), i)
|
||||
{
|
||||
label meshEdgeI = pd.sharedEdgeLabels()[i];
|
||||
|
||||
// Fill my entries in the shared edges
|
||||
sharedPts[pd.sharedEdgeAddr()[i]] = edgeValues[meshEdgeI];
|
||||
}
|
||||
|
||||
// Combine on master.
|
||||
Pstream::listCombineGather(sharedPts, cop);
|
||||
Pstream::listCombineScatter(sharedPts);
|
||||
|
||||
// Now we will all have the same information. Merge it back with
|
||||
// my local information.
|
||||
forAll(pd.sharedEdgeLabels(), i)
|
||||
{
|
||||
label meshEdgeI = pd.sharedEdgeLabels()[i];
|
||||
edgeValues[meshEdgeI] = sharedPts[pd.sharedEdgeAddr()[i]];
|
||||
}
|
||||
edgeValues[meshEdges[i]] = cppFld[i];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1197,12 +1255,6 @@ void Foam::syncTools::syncBoundaryFaceList
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
if (!hasCouples(patches))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
@ -1223,13 +1275,7 @@ void Foam::syncTools::syncBoundaryFaceList
|
||||
label patchStart = procPatch.start()-mesh.nInternalFaces();
|
||||
|
||||
UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
|
||||
toNbr <<
|
||||
SubField<T>
|
||||
(
|
||||
faceValues,
|
||||
procPatch.size(),
|
||||
patchStart
|
||||
);
|
||||
toNbr << SubField<T>(faceValues, procPatch.size(), patchStart);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1331,11 +1377,6 @@ void Foam::syncTools::syncFaceList
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
if (!hasCouples(patches))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
@ -1466,11 +1507,6 @@ void Foam::syncTools::syncPointList
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
if (!hasCouples(patches))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
@ -1630,11 +1666,6 @@ void Foam::syncTools::syncEdgeList
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
if (!hasCouples(patches))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,19 +27,26 @@ Typedef
|
||||
Description
|
||||
Label pair
|
||||
|
||||
Typedef
|
||||
Foam::labelPairList
|
||||
|
||||
Description
|
||||
List of labelPairs
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef labelPair_H
|
||||
#define labelPair_H
|
||||
|
||||
#include "label.H"
|
||||
#include "Pair.H"
|
||||
#include "List.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef Pair<label> labelPair;
|
||||
typedef List<labelPair> labelPairList;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user