diff --git a/applications/solvers/combustion/PDRFoam/Make/options b/applications/solvers/combustion/PDRFoam/Make/options
index a1469d0ef0d73671d5528eacd231844c5e7ceae9..3432f09ef79f6fa27edf4006530978c764eca252 100644
--- a/applications/solvers/combustion/PDRFoam/Make/options
+++ b/applications/solvers/combustion/PDRFoam/Make/options
@@ -20,6 +20,7 @@ EXE_INC = \
 EXE_LIBS = \
     -lengine \
     -lmeshTools \
+    -lcompressibleTurbulenceModel \
     -lcompressibleRASModels \
     -lbasicThermophysicalModels \
     -lreactionThermophysicalModels \
diff --git a/applications/solvers/combustion/XiFoam/Make/options b/applications/solvers/combustion/XiFoam/Make/options
index c328b2c1b3417b0f8df438317fbf4e0376cdbe0b..66dae7fcb34ded2b6df3a287657d2132917b3865 100644
--- a/applications/solvers/combustion/XiFoam/Make/options
+++ b/applications/solvers/combustion/XiFoam/Make/options
@@ -10,6 +10,7 @@ EXE_INC = \
 
 EXE_LIBS = \
     -lengine \
+    -lcompressibleTurbulenceModel \
     -lcompressibleRASModels \
     -lcompressibleLESModels \
     -lbasicThermophysicalModels \
diff --git a/applications/solvers/combustion/coldEngineFoam/Make/options b/applications/solvers/combustion/coldEngineFoam/Make/options
index 53aa22b25a476812ba4e06f10cf17291d7b031f2..dfd9248ded0419b53563798ce68372c9b42fb928 100644
--- a/applications/solvers/combustion/coldEngineFoam/Make/options
+++ b/applications/solvers/combustion/coldEngineFoam/Make/options
@@ -10,6 +10,7 @@ EXE_INC = \
 
 EXE_LIBS = \
     -lengine \
+    -lcompressibleTurbulenceModel \
     -lcompressibleRASModels \
     -lcompressibleLESModels \
     -lbasicThermophysicalModels \
diff --git a/applications/solvers/combustion/dieselEngineFoam/Make/options b/applications/solvers/combustion/dieselEngineFoam/Make/options
index 60558513fe28ea936712ecf14e78588ea4a4e1fe..d0a572b86fe75a654e87f7729063cd71d4d88e1b 100644
--- a/applications/solvers/combustion/dieselEngineFoam/Make/options
+++ b/applications/solvers/combustion/dieselEngineFoam/Make/options
@@ -18,6 +18,7 @@ EXE_INC = \
 
 EXE_LIBS = \
     -lengine \
+    -lcompressibleTurbulenceModel \
     -lcompressibleRASModels \
     -lcompressibleLESModels \
     -lreactionThermophysicalModels \
diff --git a/applications/solvers/combustion/dieselFoam/Make/options b/applications/solvers/combustion/dieselFoam/Make/options
index 28605eb830357a8aedb735b6d9b13a7a0c721897..9096934c2dd4fafb86625f17eb348a8c26f5fde8 100644
--- a/applications/solvers/combustion/dieselFoam/Make/options
+++ b/applications/solvers/combustion/dieselFoam/Make/options
@@ -16,6 +16,7 @@ EXE_INC = \
     -I$(LIB_SRC)/ODE/lnInclude
 
 EXE_LIBS = \
+    -lcompressibleTurbulenceModel \
     -lcompressibleRASModels \
     -lcompressibleLESModels \
     -lreactionThermophysicalModels \
diff --git a/applications/solvers/combustion/engineFoam/Make/options b/applications/solvers/combustion/engineFoam/Make/options
index 31775e03d63670129e67b82980e8aae38737f19a..cf5fa5febe38f3057fef233376bf24e30796286a 100644
--- a/applications/solvers/combustion/engineFoam/Make/options
+++ b/applications/solvers/combustion/engineFoam/Make/options
@@ -10,6 +10,7 @@ EXE_INC = \
 
 EXE_LIBS = \
     -lengine \
+    -lcompressibleTurbulenceModel \
     -lcompressibleRASModels \
     -lcompressibleLESModels \
     -lbasicThermophysicalModels \
diff --git a/applications/solvers/combustion/fireFoam/Make/options b/applications/solvers/combustion/fireFoam/Make/options
index 3b19a78173ce42e021d36d76f9546e95de7d6f48..cba08b26296a50f4a77829b18606bdee63089796 100644
--- a/applications/solvers/combustion/fireFoam/Make/options
+++ b/applications/solvers/combustion/fireFoam/Make/options
@@ -14,6 +14,7 @@ EXE_LIBS = \
     -lreactionThermophysicalModels \
     -lbasicThermophysicalModels \
     -lfiniteVolume \
+    -lcompressibleTurbulenceModel \
     -lcompressibleLESModels \
     -lcompressibleRASModels \
     -lradiation
diff --git a/applications/solvers/combustion/reactingFoam/Make/options b/applications/solvers/combustion/reactingFoam/Make/options
index d85350297af19cb8ab7f15cd023735aa2c579571..6386af8c557fcea5ace76bfe7c203c36ab85cd6e 100644
--- a/applications/solvers/combustion/reactingFoam/Make/options
+++ b/applications/solvers/combustion/reactingFoam/Make/options
@@ -8,6 +8,7 @@ EXE_INC = \
     -I$(LIB_SRC)/finiteVolume/lnInclude
 
 EXE_LIBS = \
+    -lcompressibleTurbulenceModel \
     -lcompressibleRASModels \
     -lcompressibleLESModels \
     -lreactionThermophysicalModels \
diff --git a/applications/solvers/combustion/rhoReactingFoam/Make/options b/applications/solvers/combustion/rhoReactingFoam/Make/options
index d85350297af19cb8ab7f15cd023735aa2c579571..6386af8c557fcea5ace76bfe7c203c36ab85cd6e 100644
--- a/applications/solvers/combustion/rhoReactingFoam/Make/options
+++ b/applications/solvers/combustion/rhoReactingFoam/Make/options
@@ -8,6 +8,7 @@ EXE_INC = \
     -I$(LIB_SRC)/finiteVolume/lnInclude
 
 EXE_LIBS = \
+    -lcompressibleTurbulenceModel \
     -lcompressibleRASModels \
     -lcompressibleLESModels \
     -lreactionThermophysicalModels \
diff --git a/applications/solvers/compressible/rhoPimpleFoam/Make/options b/applications/solvers/compressible/rhoPimpleFoam/Make/options
index 4858e53f307676323e027c9cff64650149209079..47a62ae92a03b39d2fa5a6b0e9e835913c806fc0 100644
--- a/applications/solvers/compressible/rhoPimpleFoam/Make/options
+++ b/applications/solvers/compressible/rhoPimpleFoam/Make/options
@@ -7,6 +7,7 @@ EXE_INC = \
 EXE_LIBS = \
     -lbasicThermophysicalModels \
     -lspecie \
+    -lcompressibleTurbulenceModel \
     -lcompressibleRASModels \
     -lcompressibleLESModels \
     -lfiniteVolume \
diff --git a/applications/solvers/compressible/rhoPorousMRFPimpleFoam/Make/options b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/Make/options
index 61c1b6fe4694070e5a5a86789da6166158151879..809b4a63a1679782436d9ffd26c7e05d45c7d9fa 100644
--- a/applications/solvers/compressible/rhoPorousMRFPimpleFoam/Make/options
+++ b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/Make/options
@@ -9,6 +9,7 @@ EXE_INC = \
 EXE_LIBS = \
     -lbasicThermophysicalModels \
     -lspecie \
+    -lcompressibleTurbulenceModel \
     -lcompressibleRASModels \
     -lcompressibleLESModels \
     -lfiniteVolume \
diff --git a/applications/solvers/compressible/rhoPorousSimpleFoam/Make/options b/applications/solvers/compressible/rhoPorousSimpleFoam/Make/options
index 4f198992b905351e4a49dcb054dd964e24008622..a4cdecf368a7e68d64f9e46a3eda99672647142f 100644
--- a/applications/solvers/compressible/rhoPorousSimpleFoam/Make/options
+++ b/applications/solvers/compressible/rhoPorousSimpleFoam/Make/options
@@ -11,6 +11,7 @@ EXE_LIBS = \
     -lbasicThermophysicalModels \
     -lthermalPorousZone \
     -lspecie \
+    -lcompressibleTurbulenceModel \
     -lcompressibleRASModels \
     -lfiniteVolume \
     -lmeshTools
diff --git a/applications/solvers/compressible/rhoSimpleFoam/Make/options b/applications/solvers/compressible/rhoSimpleFoam/Make/options
index d51be54abfcc8ce1857d6389e65e5578f808b9d9..700a6a67535022ddcaa5f28f4d9eb721b3d30ba3 100644
--- a/applications/solvers/compressible/rhoSimpleFoam/Make/options
+++ b/applications/solvers/compressible/rhoSimpleFoam/Make/options
@@ -8,6 +8,7 @@ EXE_INC = \
 EXE_LIBS = \
     -lbasicThermophysicalModels \
     -lspecie \
+    -lcompressibleTurbulenceModel \
     -lcompressibleRASModels \
     -lfiniteVolume \
     -lmeshTools
diff --git a/applications/solvers/compressible/sonicDyMFoam/Make/options b/applications/solvers/compressible/sonicDyMFoam/Make/options
index f05f52d42778473c33504a669850f1ee956ba53f..81495fb1f65aa9f1d4bfb84be4ce4be23017b8ee 100644
--- a/applications/solvers/compressible/sonicDyMFoam/Make/options
+++ b/applications/solvers/compressible/sonicDyMFoam/Make/options
@@ -9,6 +9,7 @@ EXE_INC = \
 EXE_LIBS = \
     -lbasicThermophysicalModels \
     -lspecie \
+    -lcompressibleTurbulenceModel \
     -lcompressibleRASModels \
     -lcompressibleLESModels \
     -lfiniteVolume \
diff --git a/applications/solvers/compressible/sonicFoam/Make/options b/applications/solvers/compressible/sonicFoam/Make/options
index ecfde60eee8bed46c7f2e6bd52b1a4da0c5419ea..a5b9436ac6e288f4f31f7ae6fdf29c7272af5357 100644
--- a/applications/solvers/compressible/sonicFoam/Make/options
+++ b/applications/solvers/compressible/sonicFoam/Make/options
@@ -6,6 +6,7 @@ EXE_INC = \
 EXE_LIBS = \
     -lbasicThermophysicalModels \
     -lspecie \
+    -lcompressibleTurbulenceModel \
     -lcompressibleRASModels \
     -lcompressibleLESModels \
     -lfiniteVolume \
diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/Make/options b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/Make/options
index 041d2e0605468bb86b7eee749a4be8de8076f910..cadaf0850daaa9242d22a22b7b5276a6f9751f6e 100644
--- a/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/Make/options
+++ b/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/Make/options
@@ -9,5 +9,6 @@ EXE_INC = \
 EXE_LIBS = \
     -lfiniteVolume \
     -lmeshTools \
+    -lincompressibleTurbulenceModel \
     -lincompressibleRASModels \
     -lincompressibleTransportModels
diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/Make/options b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/Make/options
index a53061a93cc503d9368d9d3a900ac6ef801015ba..6905967f04ab0b07f7601937dec50540637ba628 100644
--- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/Make/options
+++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/Make/options
@@ -8,5 +8,6 @@ EXE_INC = \
 EXE_LIBS = \
     -lfiniteVolume \
     -lmeshTools \
+    -lincompressibleTurbulenceModel \
     -lincompressibleRASModels \
     -lincompressibleTransportModels
diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options b/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options
index f26563fc0fbdcff74dec668f5489bf159778d9ab..8d01214e6cf4ab096cb34b4ee3d4cc4694420798 100644
--- a/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options
+++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options
@@ -7,6 +7,7 @@ EXE_LIBS = \
     -lmeshTools \
     -lbasicThermophysicalModels \
     -lspecie \
+    -lcompressibleTurbulenceModel \
     -lcompressibleRASModels \
     -lcompressibleLESModels \
     -lfiniteVolume
diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/Make/options b/applications/solvers/heatTransfer/buoyantSimpleFoam/Make/options
index ec604cf28cd4c9d764e745b5947a08c0b47449bf..c8a3b02a0fab2ece7d783785b0805e92e1d1f15d 100644
--- a/applications/solvers/heatTransfer/buoyantSimpleFoam/Make/options
+++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/Make/options
@@ -9,5 +9,6 @@ EXE_LIBS = \
     -lmeshTools \
     -lbasicThermophysicalModels \
     -lspecie \
+    -lcompressibleTurbulenceModel \
     -lcompressibleRASModels \
     -lfiniteVolume
diff --git a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/Make/options b/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/Make/options
index 89d7787af65e02bc13f8411df8b37fb8d41e7fda..7058e8a503e189caeb52b4c1547a92252f196da6 100644
--- a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/Make/options
+++ b/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/Make/options
@@ -12,6 +12,7 @@ EXE_LIBS = \
     -lbasicThermophysicalModels \
     -lspecie \
     -lradiation \
+    -lcompressibleTurbulenceModel \
     -lcompressibleRASModels \
     -lfiniteVolume \
     -lmeshTools
diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options b/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options
index e7a1103a4fdb8033301e52cc03836ada6e96a84a..7edc67dc751532c27671320cf72af0d22fad1dec 100644
--- a/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options
+++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options
@@ -13,6 +13,8 @@ EXE_LIBS = \
     -lbasicThermophysicalModels \
     -lbasicSolidThermo \
     -lspecie \
+    -lcompressibleTurbulenceModel \
     -lcompressibleRASModels \
     -lcompressibleLESModels \
+    -lmeshTools \
     -lfiniteVolume
diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options
index 166480807990dc3f456f9a720b8d1add2a93dfdf..a255d65f6c7fa11c6946a97f7382ff29ee550a0d 100644
--- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options
+++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options
@@ -17,4 +17,6 @@ EXE_LIBS = \
     -lbasicThermophysicalModels \
     -lbasicSolidThermo \
     -lspecie \
-    -lcompressibleRASModels
+    -lcompressibleTurbulenceModel \
+    -lcompressibleRASModels \
+    -lcompressibleLESModels
diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/include/setInitialMultiRegionDeltaT.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/include/setInitialMultiRegionDeltaT.H
index cfb9592a2baf207fc37a80d4916364b3baa7b575..16ebfdfb8236a6af9c5aabd4e81e0f777c89671f 100644
--- a/applications/solvers/heatTransfer/chtMultiRegionFoam/include/setInitialMultiRegionDeltaT.H
+++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/include/setInitialMultiRegionDeltaT.H
@@ -33,13 +33,12 @@ if (adjustTimeStep)
 {
     if ((runTime.timeIndex() == 0) && ((CoNum > SMALL) || (DiNum > SMALL)))
     {
-
-        if (CoNum == -GREAT)
+        if (CoNum < SMALL)
         {
             CoNum = SMALL;
         }
 
-        if (DiNum == -GREAT)
+        if (DiNum < SMALL)
         {
             DiNum = SMALL;
         }
diff --git a/applications/solvers/incompressible/boundaryFoam/Make/options b/applications/solvers/incompressible/boundaryFoam/Make/options
index b5a6f5b4068ef0a25eec87313e7f67c38a0f02de..d993beac0a2734e0ca4c8f3a5d39370cb93f867b 100644
--- a/applications/solvers/incompressible/boundaryFoam/Make/options
+++ b/applications/solvers/incompressible/boundaryFoam/Make/options
@@ -7,6 +7,7 @@ EXE_INC = \
     -I$(LIB_SRC)/sampling/lnInclude
 
 EXE_LIBS = \
+    -lincompressibleTurbulenceModel \
     -lincompressibleRASModels \
     -lincompressibleTransportModels \
     -lfiniteVolume \
diff --git a/applications/solvers/incompressible/pimpleFoam/Make/options b/applications/solvers/incompressible/pimpleFoam/Make/options
index d0e8dd740d8754dec86e6d877cfb141e0be13c1d..47d95d97ce91d5c824f02607061a438ec6061073 100644
--- a/applications/solvers/incompressible/pimpleFoam/Make/options
+++ b/applications/solvers/incompressible/pimpleFoam/Make/options
@@ -6,6 +6,7 @@ EXE_INC = \
 
 EXE_LIBS = \
     -lincompressibleTransportModels \
+    -lincompressibleTurbulenceModel \
     -lincompressibleRASModels \
     -lincompressibleLESModels \
     -lfiniteVolume \
diff --git a/applications/solvers/incompressible/pisoFoam/Make/options b/applications/solvers/incompressible/pisoFoam/Make/options
index 419f1ffcbab4ac08ac3eb10937a66ce49e355dd3..259f95f7b93158e2925f06bb839bba3ffb502079 100644
--- a/applications/solvers/incompressible/pisoFoam/Make/options
+++ b/applications/solvers/incompressible/pisoFoam/Make/options
@@ -5,6 +5,7 @@ EXE_INC = \
     -I$(LIB_SRC)/finiteVolume/lnInclude
 
 EXE_LIBS = \
+    -lincompressibleTurbulenceModel \
     -lincompressibleRASModels \
     -lincompressibleLESModels \
     -lincompressibleTransportModels \
diff --git a/applications/solvers/incompressible/porousSimpleFoam/Make/options b/applications/solvers/incompressible/porousSimpleFoam/Make/options
index f490133ba67a4764a473d9a150b2b06f839a3790..c658bfe518c8a578980996897f40f648f4c6faa1 100644
--- a/applications/solvers/incompressible/porousSimpleFoam/Make/options
+++ b/applications/solvers/incompressible/porousSimpleFoam/Make/options
@@ -8,6 +8,7 @@ EXE_INC = \
     -I$(LIB_SRC)/meshTools/lnInclude
 
 EXE_LIBS = \
+    -lincompressibleTurbulenceModel \
     -lincompressibleRASModels \
     -lincompressibleTransportModels \
     -lfiniteVolume \
diff --git a/applications/solvers/incompressible/simpleFoam/Make/options b/applications/solvers/incompressible/simpleFoam/Make/options
index 1223bdd06f48178f0b2eee8032d29c936634f328..dbc45d38441620ef301c2b2830ae57fd7fb80773 100644
--- a/applications/solvers/incompressible/simpleFoam/Make/options
+++ b/applications/solvers/incompressible/simpleFoam/Make/options
@@ -6,6 +6,7 @@ EXE_INC = \
     -I$(LIB_SRC)/finiteVolume/lnInclude
 
 EXE_LIBS = \
+    -lincompressibleTurbulenceModel \
     -lincompressibleRASModels \
     -lincompressibleTransportModels \
     -lfiniteVolume
diff --git a/applications/solvers/lagrangian/coalChemistryFoam/Make/options b/applications/solvers/lagrangian/coalChemistryFoam/Make/options
index 22f2dd7fe2ede8a3f1518836e2530b3bfe13e249..b4758dace7856373104298d1a3ab5568d853af1f 100644
--- a/applications/solvers/lagrangian/coalChemistryFoam/Make/options
+++ b/applications/solvers/lagrangian/coalChemistryFoam/Make/options
@@ -22,6 +22,7 @@ EXE_INC = \
 EXE_LIBS = \
     -lfiniteVolume \
     -lmeshTools \
+    -lcompressibleTurbulenceModel \
     -lcompressibleRASModels \
     -lcompressibleLESModels \
     -llagrangian \
diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/Make/options b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/Make/options
index c2ffc71a789f2c8a9397baafb7fe44ed498416a5..3639d884a246b0b20ba31b057e5651237de5c2d3 100644
--- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/Make/options
+++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/Make/options
@@ -22,6 +22,7 @@ EXE_INC = \
 EXE_LIBS = \
     -lfiniteVolume \
     -lmeshTools \
+    -lcompressibleTurbulenceModel \
     -lcompressibleRASModels \
     -lcompressibleLESModels \
     -llagrangian \
diff --git a/applications/solvers/lagrangian/reactingParcelFoam/Make/options b/applications/solvers/lagrangian/reactingParcelFoam/Make/options
index b007da1d1b5395503448153c61ef33ed07610f1f..33d575609bafa574a739767cdfdafe11c5573b86 100644
--- a/applications/solvers/lagrangian/reactingParcelFoam/Make/options
+++ b/applications/solvers/lagrangian/reactingParcelFoam/Make/options
@@ -21,6 +21,7 @@ EXE_INC = \
 EXE_LIBS = \
     -lfiniteVolume \
     -lmeshTools \
+    -lcompressibleTurbulenceModel \
     -lcompressibleRASModels \
     -lcompressibleLESModels \
     -llagrangian \
diff --git a/applications/solvers/lagrangian/uncoupledKinematicParcelFoam/Make/options b/applications/solvers/lagrangian/uncoupledKinematicParcelFoam/Make/options
index 34d4d29c1fbf99a4b0dac82e28c30db4e21d73cd..35a21df21a69c9bc500c75cf686a11e29da03815 100644
--- a/applications/solvers/lagrangian/uncoupledKinematicParcelFoam/Make/options
+++ b/applications/solvers/lagrangian/uncoupledKinematicParcelFoam/Make/options
@@ -17,6 +17,7 @@ EXE_LIBS = \
     -lbasicThermophysicalModels \
     -lspecie \
     -lradiation \
+    -lcompressibleTurbulenceModel \
     -lcompressibleRASModels \
     -lcompressibleLESModels \
     -lfiniteVolume \
diff --git a/applications/solvers/multiphase/cavitatingFoam/Make/options b/applications/solvers/multiphase/cavitatingFoam/Make/options
index 9cb749d63c1f5fe2cbfb1a83cff5a62049e4373a..836301986d7683136b51b40ee42504c18b6ed2f9 100644
--- a/applications/solvers/multiphase/cavitatingFoam/Make/options
+++ b/applications/solvers/multiphase/cavitatingFoam/Make/options
@@ -7,6 +7,7 @@ EXE_INC = \
     -I$(LIB_SRC)/thermophysicalModels/barotropicCompressibilityModel/lnInclude
 
 EXE_LIBS = \
+    -lincompressibleTurbulenceModel \
     -lincompressibleTransportModels \
     -lincompressibleRASModels \
     -lincompressibleLESModels \
diff --git a/applications/solvers/multiphase/compressibleInterDyMFoam/Make/options b/applications/solvers/multiphase/compressibleInterDyMFoam/Make/options
index 75094c8b16b2f795b9c4b9f940f7dcb1dded7ed6..2a732d1a72f968f46274391ba7bde66aa8d503be 100644
--- a/applications/solvers/multiphase/compressibleInterDyMFoam/Make/options
+++ b/applications/solvers/multiphase/compressibleInterDyMFoam/Make/options
@@ -11,6 +11,7 @@ EXE_INC = \
 EXE_LIBS = \
     -linterfaceProperties \
     -lincompressibleTransportModels \
+    -lincompressibleTurbulenceModel \
     -lincompressibleRASModels \
     -lincompressibleLESModels \
     -lfiniteVolume \
diff --git a/applications/solvers/multiphase/compressibleInterFoam/Make/options b/applications/solvers/multiphase/compressibleInterFoam/Make/options
index d7a537fc109e8b2fea28f027d340ec7584ceaef2..93098736927e4d08efde0cb169499b1dedca1cec 100644
--- a/applications/solvers/multiphase/compressibleInterFoam/Make/options
+++ b/applications/solvers/multiphase/compressibleInterFoam/Make/options
@@ -1,4 +1,4 @@
-EXE_INC = -ggdb3 \
+EXE_INC = \
     -I$(LIB_SRC)/transportModels \
     -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
     -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
@@ -8,6 +8,7 @@ EXE_INC = -ggdb3 \
 EXE_LIBS = \
     -linterfaceProperties \
     -lincompressibleTransportModels \
+    -lincompressibleTurbulenceModel \
     -lincompressibleRASModels \
     -lincompressibleLESModels \
     -lfiniteVolume
diff --git a/applications/solvers/multiphase/interDyMFoam/Make/options b/applications/solvers/multiphase/interDyMFoam/Make/options
index 6bbea18fd60c3931bb69bde7cbf3fb887c244032..dd6e8ee57c24f96342f91a325cf53f6bc1a658cf 100644
--- a/applications/solvers/multiphase/interDyMFoam/Make/options
+++ b/applications/solvers/multiphase/interDyMFoam/Make/options
@@ -12,6 +12,7 @@ EXE_INC = \
 EXE_LIBS = \
     -linterfaceProperties \
     -lincompressibleTransportModels \
+    -lincompressibleTurbulenceModel \
     -lincompressibleRASModels \
     -lincompressibleLESModels \
     -lfiniteVolume \
diff --git a/applications/solvers/multiphase/interFoam/Make/options b/applications/solvers/multiphase/interFoam/Make/options
index 0e21fc2d6423b4febd7dc39a0973924b33bf6446..93098736927e4d08efde0cb169499b1dedca1cec 100644
--- a/applications/solvers/multiphase/interFoam/Make/options
+++ b/applications/solvers/multiphase/interFoam/Make/options
@@ -8,6 +8,7 @@ EXE_INC = \
 EXE_LIBS = \
     -linterfaceProperties \
     -lincompressibleTransportModels \
+    -lincompressibleTurbulenceModel \
     -lincompressibleRASModels \
     -lincompressibleLESModels \
     -lfiniteVolume
diff --git a/applications/solvers/multiphase/interMixingFoam/Make/options b/applications/solvers/multiphase/interMixingFoam/Make/options
index d8e4da2313e4343d0c6200c7fe9c7e8d2c090d48..62271c2bb7e22cca0a814450bbe541cb5de6d4e4 100644
--- a/applications/solvers/multiphase/interMixingFoam/Make/options
+++ b/applications/solvers/multiphase/interMixingFoam/Make/options
@@ -12,6 +12,7 @@ EXE_INC = \
 EXE_LIBS = \
     -linterfaceProperties \
     -lincompressibleTransportModels \
+    -lincompressibleTurbulenceModel \
     -lincompressibleRASModels \
     -lincompressibleLESModels \
     -lfiniteVolume
diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/Make/options b/applications/solvers/multiphase/interPhaseChangeFoam/Make/options
index 24e523f2496bbf2c588af4dce0eecdf770418d6d..fb77739916159a1973054dae1b8cafc7e353e853 100644
--- a/applications/solvers/multiphase/interPhaseChangeFoam/Make/options
+++ b/applications/solvers/multiphase/interPhaseChangeFoam/Make/options
@@ -9,6 +9,7 @@ EXE_INC = \
 EXE_LIBS = \
     -linterfaceProperties \
     -lincompressibleTransportModels \
+    -lincompressibleTurbulenceModel \
     -lincompressibleRASModels \
     -lincompressibleLESModels \
     -lfiniteVolume
diff --git a/applications/solvers/multiphase/multiphaseInterFoam/Make/options b/applications/solvers/multiphase/multiphaseInterFoam/Make/options
index 6e9363f13f8c2a2553afadfb7a61600a1d8ebf39..92c738c687ab920d649f0e16d222aeaa93928bff 100644
--- a/applications/solvers/multiphase/multiphaseInterFoam/Make/options
+++ b/applications/solvers/multiphase/multiphaseInterFoam/Make/options
@@ -11,6 +11,7 @@ EXE_INC = \
 EXE_LIBS = \
     -linterfaceProperties \
     -lincompressibleTransportModels \
+    -lincompressibleTurbulenceModel \
     -lincompressibleRASModels \
     -lincompressibleLESModels \
     -lfiniteVolume
\ No newline at end of file
diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/Make/options b/applications/solvers/multiphase/twoLiquidMixingFoam/Make/options
index 0e21fc2d6423b4febd7dc39a0973924b33bf6446..93098736927e4d08efde0cb169499b1dedca1cec 100644
--- a/applications/solvers/multiphase/twoLiquidMixingFoam/Make/options
+++ b/applications/solvers/multiphase/twoLiquidMixingFoam/Make/options
@@ -8,6 +8,7 @@ EXE_INC = \
 EXE_LIBS = \
     -linterfaceProperties \
     -lincompressibleTransportModels \
+    -lincompressibleTurbulenceModel \
     -lincompressibleRASModels \
     -lincompressibleLESModels \
     -lfiniteVolume
diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C
index c04d87bc91c552a60b994134acac8aaf676993f9..00913b8817359b4fb751b683d6870f011d61d7f8 100644
--- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C
+++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C
@@ -742,6 +742,27 @@ int main(int argc, char *argv[])
     Info<< "Writing mesh to " << mesh.facesInstance() << endl;
 
     mesh.write();
+    if (cellProcAddressing.headerOk())
+    {
+        cellProcAddressing.instance() = mesh.facesInstance();
+        cellProcAddressing.write();
+    }
+    if (faceProcAddressing.headerOk())
+    {
+        faceProcAddressing.instance() = mesh.facesInstance();
+        faceProcAddressing.write();
+    }
+    if (pointProcAddressing.headerOk())
+    {
+        pointProcAddressing.instance() = mesh.facesInstance();
+        pointProcAddressing.write();
+    }
+    if (boundaryProcAddressing.headerOk())
+    {
+        boundaryProcAddressing.instance() = mesh.facesInstance();
+        boundaryProcAddressing.write();
+    }
+
 
     if (writeMaps)
     {
diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C
index 2009375040dadefa4263cc642b063a73c30530e6..91a51e2ae57a1a48e0682be250d32dc0ef251a3e 100644
--- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C
+++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -42,6 +42,9 @@ Usage
     @param -copyUniform \n
     Copy any @a uniform directories too.
 
+    @param -constant \n
+    Override controlDict settings and use constant directory.
+
     @param -fields \n
     Use existing geometry decomposition and convert fields only.
 
@@ -119,6 +122,11 @@ int main(int argc, char *argv[])
         "ifRequired",
         "only decompose geometry if the number of domains has changed"
     );
+    argList::addBoolOption
+    (
+        "constant",
+        "include the 'constant/' dir in the times list"
+    );
 
     #include "setRootCase.H"
 
@@ -139,6 +147,20 @@ int main(int argc, char *argv[])
 
     #include "createTime.H"
 
+    // Allow -constant to override controlDict settings.
+    if (args.optionFound("constant"))
+    {
+        instantList timeDirs = timeSelector::select0(runTime, args);
+        if (runTime.timeName() != runTime.constant())
+        {
+            FatalErrorIn(args.executable())
+                << "No '" << runTime.constant() << "' time present." << endl
+                << "Valid times are " << runTime.times()
+                << exit(FatalError);
+        }
+    }
+
+
     Info<< "Time = " << runTime.timeName() << endl;
 
     // determine the existing processor count directly
diff --git a/applications/utilities/surface/surfaceInertia/surfaceInertia.C b/applications/utilities/surface/surfaceInertia/surfaceInertia.C
index c68608feda20f82c1ace1309a39a108c40fae517..380f7fb9316f7d7b2130ed60f5daabc7dedff992 100644
--- a/applications/utilities/surface/surfaceInertia/surfaceInertia.C
+++ b/applications/utilities/surface/surfaceInertia/surfaceInertia.C
@@ -360,7 +360,7 @@ int main(int argc, char *argv[])
     if (m < 0)
     {
         WarningIn(args.executable() + "::main")
-            << "Negative mass detected" << endl;
+            << "Negative mass detected, the surface may be inside-out." << endl;
     }
 
     vector eVal = eigenValues(J);
diff --git a/src/OSspecific/POSIX/fileMonitor.C b/src/OSspecific/POSIX/fileMonitor.C
index a812dec9429b112fde68be45fe65b709dd76e8db..adeebbdcb68447edb8408b485a3950aa6ba21f30 100644
--- a/src/OSspecific/POSIX/fileMonitor.C
+++ b/src/OSspecific/POSIX/fileMonitor.C
@@ -257,24 +257,21 @@ void Foam::fileMonitor::checkFiles() const
             //     << "watchFd:" << inotifyEvent.wd << nl
             //     << "watchName:" << watchFile_[inotifyEvent.wd] << endl;
 
-            switch (inotifyEvent.mask)
+            if (inotifyEvent.mask % IN_DELETE_SELF)
             {
-                case IN_DELETE_SELF:
-                {
-                    Map<fileState>::iterator iter =
-                        state_.find(label(inotifyEvent.wd));
-                    iter() = DELETED;
-                }
-                break;
-
-                case IN_MODIFY:
-                case IN_CLOSE_WRITE:
-                {
-                    Map<fileState>::iterator iter =
-                        state_.find(label(inotifyEvent.wd));
-                    iter() = MODIFIED;
-                }
-                break;
+                Map<fileState>::iterator iter =
+                    state_.find(label(inotifyEvent.wd));
+                iter() = DELETED;
+            }
+            else if
+            (
+                (inotifyEvent.mask % IN_MODIFY)
+             || (inotifyEvent.mask % IN_CLOSE_WRITE)
+            )
+            {
+                Map<fileState>::iterator iter =
+                    state_.find(label(inotifyEvent.wd));
+                iter() = MODIFIED;
             }
         }
         else
diff --git a/src/OpenFOAM/containers/Lists/ListOps/ListOps.C b/src/OpenFOAM/containers/Lists/ListOps/ListOps.C
index 47fc409a2a032633f882f137018a873f7e48fcda..96b1b301828acdaaa170148db703344c034a2c45 100644
--- a/src/OpenFOAM/containers/Lists/ListOps/ListOps.C
+++ b/src/OpenFOAM/containers/Lists/ListOps/ListOps.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -25,6 +25,12 @@ License
 
 #include "ListOps.H"
 
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+const Foam::labelList Foam::emptyLabelList = Foam::labelList(0);
+
+
 // * * * * * * * * * * * * * * * Global Functions  * * * * * * * * * * * * * //
 
 Foam::labelList Foam::invert
diff --git a/src/OpenFOAM/containers/Lists/ListOps/ListOps.H b/src/OpenFOAM/containers/Lists/ListOps/ListOps.H
index 98cb8cf89ec7b884188179c1279911fccc142df6..ce16f5431a63823ca51c8bf8886f80f202068550 100644
--- a/src/OpenFOAM/containers/Lists/ListOps/ListOps.H
+++ b/src/OpenFOAM/containers/Lists/ListOps/ListOps.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -43,6 +43,16 @@ SourceFiles
 namespace Foam
 {
 
+extern const labelList emptyLabelList;
+
+//- Return reference to zero-sized list. Compare to List::null() which returns
+//  null pointer cast as list reference.
+template<class Type>
+static const List<Type>& emptyList()
+{
+    return *reinterpret_cast<const List<Type>* >(&emptyLabelList);
+}
+
 //- Renumber the values (not the indices) of a list.
 //  Negative ListType elements are left as is.
 template<class ListType>
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/wedge/wedgePolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/wedge/wedgePolyPatch.C
index 7cbf7a5534f15e8d1b9b15af59a65f93cc09efbd..0e2c4e962028683040ea3ddcebde2fecb654c2d9 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/wedge/wedgePolyPatch.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/wedge/wedgePolyPatch.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -42,59 +42,62 @@ namespace Foam
 
 void Foam::wedgePolyPatch::initTransforms()
 {
-    const pointField& points = this->points();
-
-    patchNormal_ = operator[](0).normal(points);
-    patchNormal_ /= mag(patchNormal_);
-
-    centreNormal_ =
-        vector
-        (
-            sign(patchNormal_.x())*(max(mag(patchNormal_.x()), 0.5) - 0.5),
-            sign(patchNormal_.y())*(max(mag(patchNormal_.y()), 0.5) - 0.5),
-            sign(patchNormal_.z())*(max(mag(patchNormal_.z()), 0.5) - 0.5)
-        );
-    centreNormal_ /= mag(centreNormal_);
-
-    if
-    (
-        mag(centreNormal_.x() + centreNormal_.y() + centreNormal_.z())
-        < (1 - SMALL)
-    )
+    if (size() > 0)
     {
-        FatalErrorIn
-        (
-            "wedgePolyPatch::wedgePolyPatch(const polyPatch&, "
-            "const fvBoundaryMesh&)"
-        )   << "wedge " << name()
-            << " centre plane does not align with a coordinate plane by "
-            << 1
-             - mag(centreNormal_.x() + centreNormal_.y() + centreNormal_.z())
-            << exit(FatalError);
-    }
+        const pointField& points = this->points();
 
-    axis_ = centreNormal_ ^ patchNormal_;
-    scalar magAxis = mag(axis_);
-    axis_ /= magAxis;
+        patchNormal_ = operator[](0).normal(points);
+        patchNormal_ /= mag(patchNormal_);
 
-    if (magAxis < SMALL)
-    {
-        FatalErrorIn
+        centreNormal_ =
+            vector
+            (
+                sign(patchNormal_.x())*(max(mag(patchNormal_.x()), 0.5) - 0.5),
+                sign(patchNormal_.y())*(max(mag(patchNormal_.y()), 0.5) - 0.5),
+                sign(patchNormal_.z())*(max(mag(patchNormal_.z()), 0.5) - 0.5)
+            );
+        centreNormal_ /= mag(centreNormal_);
+
+        if
         (
-            "wedgePolyPatch::initTransforms()"
-        )   << "wedge " << name()
-            << " plane aligns with a coordinate plane." << nl
-            << "    The wedge plane should make a small angle (~2.5deg)"
-               " with the coordinate plane" << nl
-            << "    and the the pair of wedge planes should be symmetric"
-            << " about the coordinate plane." << nl
-            << "    Normal of face " << 0 << " is " << patchNormal_
-            << " , implied coordinate plane direction is " << centreNormal_
-            << exit(FatalError);
+            mag(centreNormal_.x() + centreNormal_.y() + centreNormal_.z())
+            < (1 - SMALL)
+        )
+        {
+            FatalErrorIn
+            (
+                "wedgePolyPatch::wedgePolyPatch(const polyPatch&, "
+                "const fvBoundaryMesh&)"
+            )   << "wedge " << name()
+                << " centre plane does not align with a coordinate plane by "
+                << 1
+                 - mag(centreNormal_.x()+centreNormal_.y()+centreNormal_.z())
+                << exit(FatalError);
+        }
+
+        axis_ = centreNormal_ ^ patchNormal_;
+        scalar magAxis = mag(axis_);
+        axis_ /= magAxis;
+
+        if (magAxis < SMALL)
+        {
+            FatalErrorIn
+            (
+                "wedgePolyPatch::initTransforms()"
+            )   << "wedge " << name()
+                << " plane aligns with a coordinate plane." << nl
+                << "    The wedge plane should make a small angle (~2.5deg)"
+                   " with the coordinate plane" << nl
+                << "    and the the pair of wedge planes should be symmetric"
+                << " about the coordinate plane." << nl
+                << "    Normal of face " << 0 << " is " << patchNormal_
+                << " , implied coordinate plane direction is " << centreNormal_
+                << exit(FatalError);
+        }
+
+        faceT_ = rotationTensor(centreNormal_, patchNormal_);
+        cellT_ = faceT_ & faceT_;
     }
-
-    faceT_ = rotationTensor(centreNormal_, patchNormal_);
-    cellT_ = faceT_ & faceT_;
 }
 
 
diff --git a/src/OpenFOAM/meshes/primitiveShapes/plane/plane.C b/src/OpenFOAM/meshes/primitiveShapes/plane/plane.C
index 5cdc5e9d897a410ec1daba05d2815ab613860481..d4407a7d6881ebcb0195bcc7574343e5c0aad733 100644
--- a/src/OpenFOAM/meshes/primitiveShapes/plane/plane.C
+++ b/src/OpenFOAM/meshes/primitiveShapes/plane/plane.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -440,6 +440,19 @@ Foam::point Foam::plane::planePlaneIntersect
 }
 
 
+void Foam::plane::writeDict(Ostream& os) const
+{
+    os.writeKeyword("planeType") << "pointAndNormal"
+        << token::END_STATEMENT << nl;
+    os  << indent << "pointAndNormalDict" << nl
+        << indent << token::BEGIN_BLOCK << incrIndent << nl;
+    os.writeKeyword("basePoint") << basePoint_ << token::END_STATEMENT << nl;
+    os.writeKeyword("normalVector") << unitVector_ << token::END_STATEMENT
+        << nl;
+    os << decrIndent << indent << token::END_BLOCK << endl;
+}
+
+
 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
 
 bool Foam::operator==(const plane& a, const plane& b)
diff --git a/src/OpenFOAM/meshes/primitiveShapes/plane/plane.H b/src/OpenFOAM/meshes/primitiveShapes/plane/plane.H
index 36dac89224c6535c4d9708cb52a2ff2902f260ab..44eb20cbc07a2d3178dbbd9b4a2d9b947688375f 100644
--- a/src/OpenFOAM/meshes/primitiveShapes/plane/plane.H
+++ b/src/OpenFOAM/meshes/primitiveShapes/plane/plane.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -182,6 +182,9 @@ public:
         //- Return the cutting point between this plane and two other planes
         point planePlaneIntersect(const plane&, const plane&) const;
 
+        //- Write to dictionary
+        void writeDict(Ostream&) const;
+
 
     // friend Operators
 
diff --git a/src/mesh/blockMesh/blockMesh/blockMeshTopology.C b/src/mesh/blockMesh/blockMesh/blockMeshTopology.C
index 9a962483681826ed40c7855855e397b8895527b3..d1fe81c2f17deda8dfce6aec97b5541246cbb8f8 100644
--- a/src/mesh/blockMesh/blockMesh/blockMeshTopology.C
+++ b/src/mesh/blockMesh/blockMesh/blockMeshTopology.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -208,6 +208,13 @@ bool Foam::blockMesh::readBoundary
     {
         const entry& patchInfo = patchesInfo[patchI];
 
+        if (!patchInfo.isDict())
+        {
+            FatalIOErrorIn("blockMesh::readBoundary(..)", meshDescription)
+                << "Entry " << patchInfo << " in boundary section is not a"
+                << " valid dictionary." << exit(FatalIOError);
+        }
+
         // Construct dictionary and add name
         patchDicts.set(patchI, new dictionary(patchInfo.dict()));
         patchDicts[patchI].set("name", patchInfo.keyword());
diff --git a/src/meshTools/cellClassification/cellClassification.C b/src/meshTools/cellClassification/cellClassification.C
index dbc8bf29fb8a891c937624fb8af1f6286e5f16be..a7236654777262149c8ddff3918ee314f188ddd2 100644
--- a/src/meshTools/cellClassification/cellClassification.C
+++ b/src/meshTools/cellClassification/cellClassification.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -33,6 +33,8 @@ License
 #include "MeshWave.H"
 #include "ListOps.H"
 #include "meshTools.H"
+#include "cpuTime.H"
+#include "globalMeshData.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
diff --git a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C
index e5d6a0d71355a7ae077988bbccac92f536a092b1..f48abc08eb24e6bf75875766d6764ef18f3398bd 100644
--- a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C
+++ b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -32,6 +32,9 @@ License
 #include "Random.H"
 #include "treeDataFace.H"
 #include "indexedOctree.H"
+#include "polyMesh.H"
+#include "polyPatch.H"
+#include "Time.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/meshTools/indexedOctree/indexedOctree.C b/src/meshTools/indexedOctree/indexedOctree.C
index e6b77b1d9d15e022e621fcd8194a3e0bffe4f64d..2f1e13648bca18f1bc684e5ea74e6ac74429b33a 100644
--- a/src/meshTools/indexedOctree/indexedOctree.C
+++ b/src/meshTools/indexedOctree/indexedOctree.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -1046,7 +1046,8 @@ Foam::point Foam::indexedOctree<Type>::pushPointIntoFace
 }
 
 
-//// Takes a bb and a point on the outside of the bb. Checks if on multiple faces
+//// Takes a bb and a point on the outside of the bb. Checks if on multiple
+// faces
 //// and if so perturbs point so it is only on one face.
 //template <class Type>
 //void Foam::indexedOctree<Type>::checkMultipleFaces
@@ -2495,6 +2496,59 @@ Foam::labelBits Foam::indexedOctree<Type>::findNode
 }
 
 
+template <class Type>
+Foam::label Foam::indexedOctree<Type>::findInside(const point& sample) const
+{
+    labelBits index = findNode(0, sample);
+
+    const node& nod = nodes_[getNode(index)];
+
+    labelBits contentIndex = nod.subNodes_[getOctant(index)];
+
+    // Need to check for the presence of content, in-case the node is empty
+    if (isContent(contentIndex))
+    {
+        labelList indices = contents_[getContent(contentIndex)];
+
+        forAll(indices, elemI)
+        {
+            label shapeI = indices[elemI];
+
+            if (shapes_.contains(shapeI, sample))
+            {
+                return shapeI;
+            }
+        }
+    }
+
+    return -1;
+}
+
+
+template <class Type>
+const Foam::labelList& Foam::indexedOctree<Type>::findIndices
+(
+    const point& sample
+) const
+{
+    labelBits index = findNode(0, sample);
+
+    const node& nod = nodes_[getNode(index)];
+
+    labelBits contentIndex = nod.subNodes_[getOctant(index)];
+
+    // Need to check for the presence of content, in-case the node is empty
+    if (isContent(contentIndex))
+    {
+        return contents_[getContent(contentIndex)];
+    }
+    else
+    {
+        return emptyList<label>();
+    }
+}
+
+
 // Determine type (inside/outside/mixed) per node.
 template <class Type>
 typename Foam::indexedOctree<Type>::volumeType
diff --git a/src/meshTools/indexedOctree/indexedOctree.H b/src/meshTools/indexedOctree/indexedOctree.H
index d72d8de4abb5d60f366e1f59cc53cb3949a9fbf5..6d7f42517693e59451720fe768eafb6a51ce463c 100644
--- a/src/meshTools/indexedOctree/indexedOctree.H
+++ b/src/meshTools/indexedOctree/indexedOctree.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -549,9 +549,16 @@ public:
 
             //- Find deepest node (as parent+octant) containing point. Starts
             //  off from starting index in nodes_ (use 0 to start from top)
-            //  Use getNode, getOctant to extract info.
+            //  Use getNode and getOctant to extract info, or call findIndices.
             labelBits findNode(const label nodeI, const point&) const;
 
+            //- Find shape containing point. Only implemented for certain
+            //  shapes.
+            label findInside(const point&) const;
+
+            //- Find the shape indices that occupy the result of findNode
+            const labelList& findIndices(const point&) const;
+
             //- Determine type (inside/outside/mixed) for point. unknown if
             //  cannot be determined (e.g. non-manifold surface)
             volumeType getVolumeType(const point&) const;
diff --git a/src/meshTools/indexedOctree/treeDataCell.C b/src/meshTools/indexedOctree/treeDataCell.C
index 7988d55301f90a9dcf50b945bd87f2aac20288dc..87b5dde12388bde1b1fa3c120c266792f8ed016f 100644
--- a/src/meshTools/indexedOctree/treeDataCell.C
+++ b/src/meshTools/indexedOctree/treeDataCell.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -145,6 +145,16 @@ bool Foam::treeDataCell::overlaps
 }
 
 
+bool Foam::treeDataCell::contains
+(
+    const label index,
+    const point& sample
+) const
+{
+    return mesh_.pointInCell(sample, cellLabels_[index]);
+}
+
+
 // Calculate nearest point to sample. Updates (if any) nearestDistSqr, minIndex,
 // nearestPoint.
 void Foam::treeDataCell::findNearest
diff --git a/src/meshTools/indexedOctree/treeDataCell.H b/src/meshTools/indexedOctree/treeDataCell.H
index f6371198a2bd89de07b8ab10dea3a184579c39a8..7e42a6d9066a3e0dcc4b092674d92c9620a5fb07 100644
--- a/src/meshTools/indexedOctree/treeDataCell.H
+++ b/src/meshTools/indexedOctree/treeDataCell.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -142,6 +142,13 @@ public:
                 const treeBoundBox& sampleBb
             ) const;
 
+            //- Does shape at index contain sample
+            bool contains
+            (
+                const label index,
+                const point& sample
+            ) const;
+
             //- Calculates nearest (to sample) point in shape.
             //  Returns actual point and distance (squared)
             void findNearest
diff --git a/src/meshTools/indexedOctree/treeDataEdge.H b/src/meshTools/indexedOctree/treeDataEdge.H
index 30ef2329bae6a0f30d88e17102d70681239e5b5a..68f3a5924a3602900dfd2fafd735c05b329ee453 100644
--- a/src/meshTools/indexedOctree/treeDataEdge.H
+++ b/src/meshTools/indexedOctree/treeDataEdge.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -103,6 +103,11 @@ public:
 
         // Access
 
+            const labelList& edgeLabels() const
+            {
+                return edgeLabels_;
+            }
+
             label size() const
             {
                 return edgeLabels_.size();
diff --git a/src/meshTools/meshSearch/meshSearch.C b/src/meshTools/meshSearch/meshSearch.C
index 4ae5ffc616e98af4193d215caff8233d67a523c3..84315fa869f3dac078da406da92f8380d1f9ddd8 100644
--- a/src/meshTools/meshSearch/meshSearch.C
+++ b/src/meshTools/meshSearch/meshSearch.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -99,7 +99,7 @@ bool Foam::meshSearch::findNearer
 // tree based searching
 Foam::label Foam::meshSearch::findNearestCellTree(const point& location) const
 {
-    const indexedOctree<treeDataPoint>& tree = cellCentreTree();
+    const indexedOctree<treeDataCell>& tree = cellTree();
 
     scalar span = tree.bb().mag();
 
@@ -176,7 +176,7 @@ Foam::label Foam::meshSearch::findNearestCellWalk
 Foam::label Foam::meshSearch::findNearestFaceTree(const point& location) const
 {
     // Search nearest cell centre.
-    const indexedOctree<treeDataPoint>& tree = cellCentreTree();
+    const indexedOctree<treeDataCell>& tree = cellTree();
 
     scalar span = tree.bb().mag();
 
@@ -320,6 +320,80 @@ Foam::label Foam::meshSearch::findCellLinear(const point& location) const
 }
 
 
+// walking from seed
+Foam::label Foam::meshSearch::findCellWalk
+(
+    const point& location,
+    const label seedCellI
+) const
+{
+    if (seedCellI < 0)
+    {
+        FatalErrorIn
+        (
+            "meshSearch::findCellWalk(const point&, const label)"
+        )   << "illegal seedCell:" << seedCellI << exit(FatalError);
+    }
+
+    if (pointInCell(location, seedCellI))
+    {
+        return seedCellI;
+    }
+
+    // Walk in direction of face that decreases distance
+    label curCellI = seedCellI;
+    scalar nearestDistSqr = magSqr(mesh_.cellCentres()[curCellI] - location);
+
+    while(true)
+    {
+        // Try neighbours of curCellI
+
+        const cell& cFaces = mesh_.cells()[curCellI];
+
+        label nearestCellI = -1;
+
+        forAll(cFaces, i)
+        {
+            label faceI = cFaces[i];
+
+            if (mesh_.isInternalFace(faceI))
+            {
+                label cellI = mesh_.faceOwner()[faceI];
+                if (cellI == curCellI)
+                {
+                    cellI = mesh_.faceNeighbour()[faceI];
+                }
+
+                // Check if this is the correct cell
+                if (pointInCell(location, cellI))
+                {
+                    return cellI;
+                }
+
+                // Also calculate the nearest cell
+                scalar distSqr = magSqr(mesh_.cellCentres()[cellI] - location);
+
+                if (distSqr < nearestDistSqr)
+                {
+                    nearestDistSqr = distSqr;
+                    nearestCellI = cellI;
+                }
+            }
+        }
+
+        if (nearestCellI == -1)
+        {
+            return -1;
+        }
+
+        // Continue with the nearest cell
+        curCellI = nearestCellI;
+    }
+
+    return -1;
+}
+
+
 Foam::label Foam::meshSearch::findNearestBoundaryFaceWalk
 (
     const point& location,
@@ -426,11 +500,7 @@ Foam::vector Foam::meshSearch::offset
 Foam::meshSearch::meshSearch(const polyMesh& mesh, const bool faceDecomp)
 :
     mesh_(mesh),
-    faceDecomp_(faceDecomp),
-    cloud_(mesh_, "meshSearchCloud", IDLList<passiveParticle>()),
-    boundaryTreePtr_(NULL),
-    cellTreePtr_(NULL),
-    cellCentreTreePtr_(NULL)
+    faceDecomp_(faceDecomp)
 {}
 
 
@@ -447,7 +517,7 @@ Foam::meshSearch::~meshSearch()
 const Foam::indexedOctree<Foam::treeDataFace>& Foam::meshSearch::boundaryTree()
  const
 {
-    if (!boundaryTreePtr_)
+    if (!boundaryTreePtr_.valid())
     {
         //
         // Construct tree
@@ -466,85 +536,59 @@ const Foam::indexedOctree<Foam::treeDataFace>& Foam::meshSearch::boundaryTree()
         overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
         overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
 
-        boundaryTreePtr_ = new indexedOctree<treeDataFace>
+        boundaryTreePtr_.reset
         (
-            treeDataFace    // all information needed to search faces
+            new indexedOctree<treeDataFace>
             (
-                false,                      // do not cache bb
-                mesh_,
-                bndFaces                    // boundary faces only
-            ),
-            overallBb,                      // overall search domain
-            8,                              // maxLevel
-            10,                             // leafsize
-            3.0                             // duplicity
+                treeDataFace    // all information needed to search faces
+                (
+                    false,                      // do not cache bb
+                    mesh_,
+                    bndFaces                    // boundary faces only
+                ),
+                overallBb,                      // overall search domain
+                8,                              // maxLevel
+                10,                             // leafsize
+                3.0                             // duplicity
+            )
         );
     }
 
-    return *boundaryTreePtr_;
+    return boundaryTreePtr_();
 }
 
 
 const Foam::indexedOctree<Foam::treeDataCell>& Foam::meshSearch::cellTree()
- const
+const
 {
-    if (!cellTreePtr_)
+    if (!cellTreePtr_.valid())
     {
-        //
-        // Construct tree
-        //
-
         treeBoundBox overallBb(mesh_.points());
-        Random rndGen(123456);
-        overallBb = overallBb.extend(rndGen, 1E-4);
-        overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
-        overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
-
-        cellTreePtr_ = new indexedOctree<treeDataCell>
-        (
-            treeDataCell
-            (
-                false,  // not cache bb
-                mesh_
-            ),
-            overallBb,  // overall search domain
-            8,      // maxLevel
-            10,     // leafsize
-            3.0     // duplicity
-        );
-    }
-
-    return *cellTreePtr_;
-
-}
 
+        Random rndGen(261782);
 
-const Foam::indexedOctree<Foam::treeDataPoint>&
- Foam::meshSearch::cellCentreTree() const
-{
-    if (!cellCentreTreePtr_)
-    {
-        //
-        // Construct tree
-        //
-
-        treeBoundBox overallBb(mesh_.cellCentres());
-        Random rndGen(123456);
         overallBb = overallBb.extend(rndGen, 1E-4);
         overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
         overallBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
 
-        cellCentreTreePtr_ = new indexedOctree<treeDataPoint>
+        cellTreePtr_.reset
         (
-            treeDataPoint(mesh_.cellCentres()),
-            overallBb,  // overall search domain
-            10,         // max levels
-            10.0,       // maximum ratio of cubes v.s. cells
-            100.0       // max. duplicity; n/a since no bounding boxes.
+            new indexedOctree<treeDataCell>
+            (
+                treeDataCell
+                (
+                    false,  // not cache bb
+                    mesh_
+                ),
+                overallBb,
+                8,              // maxLevel
+                10,             // leafsize
+                3.0             // duplicity
+            )
         );
     }
 
-    return *cellCentreTreePtr_;
+    return cellTreePtr_();
 }
 
 
@@ -697,107 +741,21 @@ Foam::label Foam::meshSearch::findCell
 ) const
 {
     // Find the nearest cell centre to this location
-    label nearCellI = findNearestCell(location, seedCellI, useTreeSearch);
-
-    if (debug)
-    {
-        Pout<< "findCell : nearCellI:" << nearCellI
-            << " ctr:" << mesh_.cellCentres()[nearCellI]
-            << endl;
-    }
-
-    if (pointInCell(location, nearCellI))
-    {
-        return nearCellI;
-    }
-    else
+    if (seedCellI == -1)
     {
         if (useTreeSearch)
         {
-            // Start searching from cell centre of nearCell
-            point curPoint = mesh_.cellCentres()[nearCellI];
-
-            vector edgeVec = location - curPoint;
-            edgeVec /= mag(edgeVec);
-
-            do
-            {
-                // Walk neighbours (using tracking) to get closer
-                passiveParticle tracker(cloud_, curPoint, nearCellI);
-
-                if (debug)
-                {
-                    Pout<< "findCell : tracked from curPoint:" << curPoint
-                        << " nearCellI:" << nearCellI;
-                }
-
-                tracker.track(location);
-
-                if (debug)
-                {
-                    Pout<< " to " << tracker.position()
-                        << " need:" << location
-                        << " onB:" << tracker.onBoundary()
-                        << " cell:" << tracker.cell()
-                        << " face:" << tracker.face() << endl;
-                }
-
-                if (!tracker.onBoundary())
-                {
-                    // stopped not on boundary -> reached location
-                    return tracker.cell();
-                }
-
-                // stopped on boundary face. Compare positions
-                scalar typDim = sqrt(mag(mesh_.faceAreas()[tracker.face()]));
-
-                if ((mag(tracker.position() - location)/typDim) < SMALL)
-                {
-                    return tracker.cell();
-                }
-
-                // tracking stopped at boundary. Find next boundary
-                // intersection from current point (shifted out a little bit)
-                // in the direction of the destination
-
-                curPoint =
-                    tracker.position()
-                  + offset(tracker.position(), tracker.face(), edgeVec);
-
-                if (debug)
-                {
-                    Pout<< "Searching for next boundary from curPoint:"
-                        << curPoint
-                        << " to location:" << location  << endl;
-                }
-                pointIndexHit curHit = intersection(curPoint, location);
-                if (debug)
-                {
-                    Pout<< "Returned from line search with ";
-                    curHit.write(Pout);
-                    Pout<< endl;
-                }
-
-                if (!curHit.hit())
-                {
-                    return -1;
-                }
-                else
-                {
-                    nearCellI = mesh_.faceOwner()[curHit.index()];
-                    curPoint =
-                        curHit.hitPoint()
-                      + offset(curHit.hitPoint(), curHit.index(), edgeVec);
-                }
-            }
-            while (true);
+            return cellTree().findInside(location);
         }
         else
         {
              return findCellLinear(location);
         }
     }
-    return -1;
+    else
+    {
+        return findCellWalk(location, seedCellI);
+    }
 }
 
 
@@ -947,9 +905,8 @@ bool Foam::meshSearch::isInside(const point& p) const
 // Delete all storage
 void Foam::meshSearch::clearOut()
 {
-    deleteDemandDrivenData(boundaryTreePtr_);
-    deleteDemandDrivenData(cellTreePtr_);
-    deleteDemandDrivenData(cellCentreTreePtr_);
+    boundaryTreePtr_.clear();
+    cellTreePtr_.clear();
 }
 
 
diff --git a/src/meshTools/meshSearch/meshSearch.H b/src/meshTools/meshSearch/meshSearch.H
index dfaf71229b8546e37a303875eec7f38ce46e9c67..e39d2b75cd4e0980cbb28851cb51683f2a53258c 100644
--- a/src/meshTools/meshSearch/meshSearch.H
+++ b/src/meshTools/meshSearch/meshSearch.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -37,7 +37,7 @@ SourceFiles
 #define meshSearch_H
 
 #include "pointIndexHit.H"
-#include "passiveParticleCloud.H"
+#include "pointField.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -48,7 +48,6 @@ namespace Foam
 class polyMesh;
 class treeDataCell;
 class treeDataFace;
-class treeDataPoint;
 template<class Type> class indexedOctree;
 
 /*---------------------------------------------------------------------------*\
@@ -65,14 +64,10 @@ class meshSearch
         //- Whether to use face decomposition for all geometric tests
         const bool faceDecomp_;
 
-        //- Dummy cloud to put particles on for tracking.
-        passiveParticleCloud cloud_;
-
         //- demand driven octrees
 
-        mutable indexedOctree<treeDataFace>* boundaryTreePtr_;
-        mutable indexedOctree<treeDataCell>* cellTreePtr_;
-        mutable indexedOctree<treeDataPoint>* cellCentreTreePtr_;
+        mutable autoPtr<indexedOctree<treeDataFace> > boundaryTreePtr_;
+        mutable autoPtr<indexedOctree<treeDataCell> > cellTreePtr_;
 
 
     // Private Member Functions
@@ -112,8 +107,12 @@ class meshSearch
             //- cell containing location. Linear search.
             label findCellLinear(const point&) const;
 
+            //- walk from seed. Does not 'go around' boundary, just returns
+            //  last cell before boundary.
+            label findCellWalk(const point&, const label) const;
+
 
-        // Cells
+        // Faces
 
             label findNearestFaceTree(const point&) const;
 
@@ -188,9 +187,6 @@ public:
             //- Get (demand driven) reference to octree holding all cells
             const indexedOctree<treeDataCell>& cellTree() const;
 
-            //- Get (demand driven) reference to octree holding all cell centres
-            const indexedOctree<treeDataPoint>& cellCentreTree() const;
-
 
         // Queries
 
diff --git a/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.C b/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.C
index cd7f0305dbf4ee4f361e7a90545fb5ee20b5ecae..f060a3f078c2b3c71093a2d3459eca78c7a2fd78 100644
--- a/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.C
+++ b/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -29,6 +29,7 @@ License
 #include "triSurface.H"
 #include "triSurfaceSearch.H"
 #include "cellClassification.H"
+#include "cpuTime.H"
 
 #include "addToRunTimeSelectionTable.H"
 
diff --git a/src/meshTools/sets/pointSources/surfaceToPoint/surfaceToPoint.C b/src/meshTools/sets/pointSources/surfaceToPoint/surfaceToPoint.C
index 173f771f73c3b8ecfe308e009487dfbe0f0e6a60..2dadffa9b16c9091988eba2304cb69db081655a2 100644
--- a/src/meshTools/sets/pointSources/surfaceToPoint/surfaceToPoint.C
+++ b/src/meshTools/sets/pointSources/surfaceToPoint/surfaceToPoint.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -27,6 +27,7 @@ License
 #include "polyMesh.H"
 #include "meshSearch.H"
 #include "triSurfaceSearch.H"
+#include "cpuTime.H"
 
 #include "addToRunTimeSelectionTable.H"
 
diff --git a/src/sampling/sampledSet/triSurfaceMeshPointSet/triSurfaceMeshPointSet.C b/src/sampling/sampledSet/triSurfaceMeshPointSet/triSurfaceMeshPointSet.C
index 7cfa11de2180d0a6dfa69155aeb355869c90d90a..ebf4a7978c0f8255520cb43a1026c074058b985d 100644
--- a/src/sampling/sampledSet/triSurfaceMeshPointSet/triSurfaceMeshPointSet.C
+++ b/src/sampling/sampledSet/triSurfaceMeshPointSet/triSurfaceMeshPointSet.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -29,6 +29,7 @@ License
 #include "polyMesh.H"
 #include "addToRunTimeSelectionTable.H"
 #include "triSurfaceMesh.H"
+#include "Time.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
diff --git a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C
index 2619818647b1db6a811f0e25e319e3fda856f8b9..fc5c31911e851d4b347b4c7d379f484077a9cb9d 100644
--- a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C
+++ b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C
@@ -28,6 +28,7 @@ License
 #include "meshSearch.H"
 #include "Tuple2.H"
 #include "globalIndex.H"
+#include "treeDataCell.H"
 
 #include "addToRunTimeSelectionTable.H"
 
@@ -166,8 +167,7 @@ bool Foam::sampledTriSurfaceMesh::update()
 
     meshSearch meshSearcher(mesh(), false);
 
-    const indexedOctree<treeDataPoint>& cellCentreTree =
-        meshSearcher.cellCentreTree();
+    const indexedOctree<treeDataCell>& cellTree = meshSearcher.cellTree();
 
 
     // Global numbering for cells - only used to uniquely identify local cells.
@@ -182,7 +182,7 @@ bool Foam::sampledTriSurfaceMesh::update()
     // Search triangles using nearest on local mesh
     forAll(fc, triI)
     {
-        pointIndexHit nearInfo = cellCentreTree.findNearest
+        pointIndexHit nearInfo = cellTree.findNearest
         (
             fc[triI],
             sqr(GREAT)