diff --git a/applications/test/Distribution/Test-Distribution.C b/applications/test/Distribution/Test-Distribution.C
index f6da957fb99757df28346f4382eae8b5c21bc06e..8f84237019f14f759d44168676371364439e53ed 100644
--- a/applications/test/Distribution/Test-Distribution.C
+++ b/applications/test/Distribution/Test-Distribution.C
@@ -22,7 +22,7 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Application
-    DistributionTest
+    Test-Distribution
 
 Description
     Test the Distribution class
diff --git a/applications/test/HashTable2/Make/files b/applications/test/HashTable2/Make/files
index 2bf9c9217ddbe19c32ec49588df1d17a2f30a16c..e5bc377b8b522479d953663e513da442d2d506bc 100644
--- a/applications/test/HashTable2/Make/files
+++ b/applications/test/HashTable2/Make/files
@@ -1,3 +1,3 @@
-hashTableTest2.C
+Test-HashTable2.C
 
-EXE = $(FOAM_USER_APPBIN)/hashTableTest2
+EXE = $(FOAM_USER_APPBIN)/Test-HashTable2
diff --git a/applications/test/HashTable2/hashTableTest2.C b/applications/test/HashTable2/Test-HashTable2.C
similarity index 95%
rename from applications/test/HashTable2/hashTableTest2.C
rename to applications/test/HashTable2/Test-HashTable2.C
index f1bfd70c041509270f2425e932d0fc4ff5fc9c85..468c3960a0a5f1d197a19b75f9fdb44328c91749 100644
--- a/applications/test/HashTable2/hashTableTest2.C
+++ b/applications/test/HashTable2/Test-HashTable2.C
@@ -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
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/applications/test/HashTable3/Make/files b/applications/test/HashTable3/Make/files
index e8ec193ffa2e78cf5a570a32b4e3952096365d70..67aef16a29824c9fbfc77269fc07b4a49f1ccacd 100644
--- a/applications/test/HashTable3/Make/files
+++ b/applications/test/HashTable3/Make/files
@@ -1,3 +1,3 @@
-hashTableTest3.C
+Test-HashTable3.C
 
-EXE = $(FOAM_USER_APPBIN)/hashTableTest3
+EXE = $(FOAM_USER_APPBIN)/Test-HashTable3
diff --git a/applications/test/HashTable3/hashTableTest3.C b/applications/test/HashTable3/Test-HashTable3.C
similarity index 97%
rename from applications/test/HashTable3/hashTableTest3.C
rename to applications/test/HashTable3/Test-HashTable3.C
index e295b861dab24966d70b86584af596a8116543c4..8931084ef2e7c9d54f58841f1f371f5f688f247e 100644
--- a/applications/test/HashTable3/hashTableTest3.C
+++ b/applications/test/HashTable3/Test-HashTable3.C
@@ -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
 
 \*---------------------------------------------------------------------------*/
diff --git a/applications/test/NamedEnum/Make/files b/applications/test/NamedEnum/Make/files
index e861aaa1b29ea96f18a320b75aa25b5a2a8f65b0..755b72ba5e929e04c15dcd5f6258eb2ac88ab808 100644
--- a/applications/test/NamedEnum/Make/files
+++ b/applications/test/NamedEnum/Make/files
@@ -1,3 +1,3 @@
 Test-namedEnum.C
 
-EXE = $(FOAM_USER_APPBIN)/NamedEnum
+EXE = $(FOAM_USER_APPBIN)/Test-NamedEnum
diff --git a/applications/test/dataEntry/Test-DataEntry.C b/applications/test/dataEntry/Test-DataEntry.C
index f9b76db9f1cdb87de2cb38d454959f51bca81db6..631cc03e0297631c4d93396a1069530999448c27 100644
--- a/applications/test/dataEntry/Test-DataEntry.C
+++ b/applications/test/dataEntry/Test-DataEntry.C
@@ -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
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/applications/test/dimensionedType/Make/files b/applications/test/dimensionedType/Make/files
index 36a682e2812e3d9646538e670018fbb89f822072..38f7d4ee8d19d5c80ca6275c26e351a8982ca50b 100644
--- a/applications/test/dimensionedType/Make/files
+++ b/applications/test/dimensionedType/Make/files
@@ -1,3 +1,3 @@
 Test-dimensionedType.C
 
-EXE = $(FOAM_USER_APPBIN)/dimensionedType
+EXE = $(FOAM_USER_APPBIN)/Test-dimensionedType
diff --git a/applications/test/pTraits/Make/files b/applications/test/pTraits/Make/files
index 7cebcf09d9b0378495196ec2e41902aeb857e635..268e879af24328b2cdea25625149fdfbe0c8f908 100644
--- a/applications/test/pTraits/Make/files
+++ b/applications/test/pTraits/Make/files
@@ -1,2 +1,2 @@
 Test-pTraits.C
-EXE = $(FOAM_USER_APPBIN)/pTraits
+EXE = $(FOAM_USER_APPBIN)/Test-pTraits
diff --git a/applications/test/simpleMatrix/Make/files b/applications/test/simpleMatrix/Make/files
index 2b80bbe4f7fbfb775cd6c5b2cda26ae02cd7eee3..804d3ecefecb2ab0b9b63201d0509a56fdcd787a 100644
--- a/applications/test/simpleMatrix/Make/files
+++ b/applications/test/simpleMatrix/Make/files
@@ -1,3 +1,3 @@
 Test-simpleMatrix.C
 
-EXE = $(FOAM_USER_APPBIN)/simpleMatrix
+EXE = $(FOAM_USER_APPBIN)/Test-simpleMatrix
diff --git a/applications/utilities/postProcessing/sampling/sample/sampleDict b/applications/utilities/postProcessing/sampling/sample/sampleDict
index cd0ae63fe4df50072daaad61bde4bbaa8af8a57f..c34ce71daf915f846bcfbc35718f6845d6034613 100644
--- a/applications/utilities/postProcessing/sampling/sample/sampleDict
+++ b/applications/utilities/postProcessing/sampling/sample/sampleDict
@@ -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
diff --git a/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C b/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C
index 89cf00cd1b10e60911298a56ab7209d7fa655990..84f3c5652be94b167ee8c1c7866ebd5257d61f61 100644
--- a/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C
+++ b/applications/utilities/preProcessing/foamUpgradeCyclics/foamUpgradeCyclics.C
@@ -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");
             }
 
 
diff --git a/doc/doxygen/Allwmake b/doc/doxygen/Allwmake
index a34eb3fd7e0cce80561fd61bc768738bb5e0cd02..fbc20d93fd054d2fa63b80606e6f0e36924c027e 100755
--- a/doc/doxygen/Allwmake
+++ b/doc/doxygen/Allwmake
@@ -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
diff --git a/doc/doxygen/Doxyfile b/doc/doxygen/Doxyfile
index 51a8ae2b503a66ce1d7d4767c375d3c28e1780de..a1c4e6a5fcf8c4e26618747bb1e2df14ab3e8f89 100644
--- a/doc/doxygen/Doxyfile
+++ b/doc/doxygen/Doxyfile
@@ -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.
diff --git a/doc/doxygen/_Footer b/doc/doxygen/_Footer
index 11d8da9cb56840a3ce070bda8929d6e024111f7c..f68739e80373b5855fc475fa1e73755b24bc1e35 100644
--- a/doc/doxygen/_Footer
+++ b/doc/doxygen/_Footer
@@ -2,7 +2,7 @@
   </div> <!-- main -->
   <div class="footer">
     <p>
-      Copyright&nbsp;&copy;&nbsp;2000-2010&nbsp;
+      Copyright&nbsp;&copy;&nbsp;2004-2011&nbsp;
       <a href="http://www.openfoam.com/about">OpenCFD Limited</a>
       | OPENFOAM&reg; and OpenCFD&reg; are registered trademarks of OpenCFD Ltd.
     </p>
diff --git a/etc/aliases.csh b/etc/aliases.csh
index 6e1deee991bf5d5c3f2b97095191065cd69329ed..9005f180ddddd440ce8a92425560450a2061522e 100644
--- a/etc/aliases.csh
+++ b/etc/aliases.csh
@@ -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'
diff --git a/etc/aliases.sh b/etc/aliases.sh
index 2f049825ec5606a364d4b7e94a4c581e567e78c7..870b457f5fff62badcf56d5f8be4a28804762b4b 100644
--- a/etc/aliases.sh
+++ b/etc/aliases.sh
@@ -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'
diff --git a/etc/settings.csh b/etc/settings.csh
index a3f9a743c0cd1c82b8a411b1908b8b2dc55d18b0..27bb9563cc4d418da288c64f4c4b84c13186db45 100644
--- a/etc/settings.csh
+++ b/etc/settings.csh
@@ -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
diff --git a/etc/settings.sh b/etc/settings.sh
index 46c39f59decc3d649b1e14a60d31730a137592d6..728b197720f14a9f1eb5b7ac576051860c5e0c91 100644
--- a/etc/settings.sh
+++ b/etc/settings.sh
@@ -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
diff --git a/src/Allwmake b/src/Allwmake
index 4dbc726a213d973a9af154955f0f29280a574d84..00bbf8e5e6e91459e1c6913012629a2963c7247a 100755
--- a/src/Allwmake
+++ b/src/Allwmake
@@ -1,8 +1,6 @@
 #!/bin/sh
 cd ${0%/*} || exit 1    # run from this directory
-
-makeOption=libso
-[ $# -ge 1 ] && makeOption=$1
+[ $# -ge 1 ] && makeOption=$1 || makeOption=libso
 
 wmakeCheckPwd "$WM_PROJECT_DIR/src" || {
     echo "Error: Current directory is not \$WM_PROJECT_DIR/src"
@@ -20,13 +18,13 @@ 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
+wmakeLnInclude OSspecific/${WM_OSTYPE:-POSIX}
 Pstream/Allwmake $*
 
-OSspecific/$WM_OSTYPE/Allwmake
+OSspecific/${WM_OSTYPE:-POSIX}/Allwmake
 wmake $makeOption OpenFOAM
 
 wmake $makeOption fileFormats
diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files
index 372ce59ff268780faef92bcd1f0c89cabba7f8b4..bf4c345becf9ab4a208b55a0cdd25cd5cfb8bb51 100644
--- a/src/OpenFOAM/Make/files
+++ b/src/OpenFOAM/Make/files
@@ -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,9 +40,16 @@ 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
@@ -47,6 +61,12 @@ 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
@@ -56,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
 
@@ -82,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
 
diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C
index 370f42b2fa3567f59171ebe9df867a68d3bf9b91..1d23a86c9cb72cd37deb8cc75e205b965ae678d3 100644
--- a/src/OpenFOAM/global/argList/argList.C
+++ b/src/OpenFOAM/global/argList/argList.C
@@ -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;
 }
 
 
diff --git a/src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrix.C b/src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrix.C
index 03dc2d55366337c1e620ea70796b0e27a5d21cbb..121f016c2f3fef50d92034e3e3f310c5ac0b372e 100644
--- a/src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrix.C
+++ b/src/OpenFOAM/matrices/LUscalarMatrix/LUscalarMatrix.C
@@ -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;
diff --git a/src/OpenFOAM/matrices/LUscalarMatrix/procLduInterface.C b/src/OpenFOAM/matrices/LUscalarMatrix/procLduInterface.C
index 0a4b7132027802f08b7d877413ece016239d3c83..979ef370274934aa630144e6072b227cc77bd317 100644
--- a/src/OpenFOAM/matrices/LUscalarMatrix/procLduInterface.C
+++ b/src/OpenFOAM/matrices/LUscalarMatrix/procLduInterface.C
@@ -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;
 }
diff --git a/src/OpenFOAM/matrices/LUscalarMatrix/procLduInterface.H b/src/OpenFOAM/matrices/LUscalarMatrix/procLduInterface.H
index 0e03bfdb375511ad7482c561cd68a10e4144dc48..defaa331ffbb78821e637add8caf8144ec204d94 100644
--- a/src/OpenFOAM/matrices/LUscalarMatrix/procLduInterface.H
+++ b/src/OpenFOAM/matrices/LUscalarMatrix/procLduInterface.H
@@ -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
diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C
index 25e7727c8e4ddb2bc50e143c14a95612f11d7f23..95c2d1d2321fa152da5c1793b14dd94c49882ca5 100644
--- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C
+++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C
@@ -29,6 +29,7 @@ License
 #include "globalIndex.H"
 #include "globalIndexAndTransform.H"
 #include "transformField.H"
+#include "ListOps.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
@@ -1104,6 +1105,12 @@ Foam::mapDistribute::mapDistribute(const Xfer<mapDistribute>& map)
 
 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
 
+Foam::label Foam::mapDistribute::whichTransform(const label index) const
+{
+    return findLower(transformStart_, index+1);
+}
+
+
 void Foam::mapDistribute::transfer(mapDistribute& rhs)
 {
     constructSize_ = rhs.constructSize_;
diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H
index 6e1a26468cd4e5563e7ab4f9131fc8dad915d482..99a31d3d7d92a05d210bc9e2266693449a4b79ff 100644
--- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H
+++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H
@@ -385,6 +385,9 @@ public:
                 return transformStart_;
             }
 
+            //- Find transform from transformElements
+            label whichTransform(const label index) const;
+
             //- Calculate a schedule. See above.
             static List<labelPair> schedule
             (
diff --git a/src/OpenFOAM/primitives/Lists/scalarIOList.C b/src/OpenFOAM/primitives/Scalar/lists/scalarIOList.C
similarity index 95%
rename from src/OpenFOAM/primitives/Lists/scalarIOList.C
rename to src/OpenFOAM/primitives/Scalar/lists/scalarIOList.C
index 60fd9a55d1923225ef18d6efa4f82402218af1b1..97d4d8f94d543247108a3bf8150c65b8929e0775 100644
--- a/src/OpenFOAM/primitives/Lists/scalarIOList.C
+++ b/src/OpenFOAM/primitives/Scalar/lists/scalarIOList.C
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/scalarIOList.H b/src/OpenFOAM/primitives/Scalar/lists/scalarIOList.H
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/scalarIOList.H
rename to src/OpenFOAM/primitives/Scalar/lists/scalarIOList.H
index e27e970d3029bfd4733a440ba81512a9610d25c0..312378f8a7b66a0c87b61bc27fd9539ee2119b72 100644
--- a/src/OpenFOAM/primitives/Lists/scalarIOList.H
+++ b/src/OpenFOAM/primitives/Scalar/lists/scalarIOList.H
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/scalarList.C b/src/OpenFOAM/primitives/Scalar/lists/scalarList.C
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/scalarList.C
rename to src/OpenFOAM/primitives/Scalar/lists/scalarList.C
index bf2c6d8ac9ca01f15184d45edb3d7a55df3e406a..38871e66467fb639f859726c4d76efbbd823d551 100644
--- a/src/OpenFOAM/primitives/Lists/scalarList.C
+++ b/src/OpenFOAM/primitives/Scalar/lists/scalarList.C
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/scalarList.H b/src/OpenFOAM/primitives/Scalar/lists/scalarList.H
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/scalarList.H
rename to src/OpenFOAM/primitives/Scalar/lists/scalarList.H
index b73fb47d833b6cf45737632ddd9da8f1aae50b55..9c8c9c6a33ccc5d581039a00679bb28ac0ade331 100644
--- a/src/OpenFOAM/primitives/Lists/scalarList.H
+++ b/src/OpenFOAM/primitives/Scalar/lists/scalarList.H
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/scalarListIOList.C b/src/OpenFOAM/primitives/Scalar/lists/scalarListIOList.C
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/scalarListIOList.C
rename to src/OpenFOAM/primitives/Scalar/lists/scalarListIOList.C
index caf9e04b6a4853424210c2fb34e56626055d87c5..ce71f70703a3b28722a69d6151499be47a5bddd7 100644
--- a/src/OpenFOAM/primitives/Lists/scalarListIOList.C
+++ b/src/OpenFOAM/primitives/Scalar/lists/scalarListIOList.C
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/scalarListIOList.H b/src/OpenFOAM/primitives/Scalar/lists/scalarListIOList.H
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/scalarListIOList.H
rename to src/OpenFOAM/primitives/Scalar/lists/scalarListIOList.H
index b06c6240e23669d5dc100fb4e387132be9c5d310..63f688fc8d1d8c2d0b61bb32a3a1a188e0237a13 100644
--- a/src/OpenFOAM/primitives/Lists/scalarListIOList.H
+++ b/src/OpenFOAM/primitives/Scalar/lists/scalarListIOList.H
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/sphericalTensorList.C b/src/OpenFOAM/primitives/Tensor/lists/sphericalTensorList.C
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/sphericalTensorList.C
rename to src/OpenFOAM/primitives/Tensor/lists/sphericalTensorList.C
index 233d0d2f091b5a5791d0cba88811c3560dc66083..083c5b4c066b47598577b90a1421aa226a5b47ab 100644
--- a/src/OpenFOAM/primitives/Lists/sphericalTensorList.C
+++ b/src/OpenFOAM/primitives/Tensor/lists/sphericalTensorList.C
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/sphericalTensorList.H b/src/OpenFOAM/primitives/Tensor/lists/sphericalTensorList.H
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/sphericalTensorList.H
rename to src/OpenFOAM/primitives/Tensor/lists/sphericalTensorList.H
index 9182eb5fd1133d3f0333534690ab02f3f466709a..bb5a5e11b302030d34edb93b4ea345806210c97f 100644
--- a/src/OpenFOAM/primitives/Lists/sphericalTensorList.H
+++ b/src/OpenFOAM/primitives/Tensor/lists/sphericalTensorList.H
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/symmTensorList.C b/src/OpenFOAM/primitives/Tensor/lists/symmTensorList.C
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/symmTensorList.C
rename to src/OpenFOAM/primitives/Tensor/lists/symmTensorList.C
index a703e3cceae3085dc140a3d417ee8d94ce850366..45b3b729b0cfe25d0f94bcb7278844e23b4903c3 100644
--- a/src/OpenFOAM/primitives/Lists/symmTensorList.C
+++ b/src/OpenFOAM/primitives/Tensor/lists/symmTensorList.C
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/symmTensorList.H b/src/OpenFOAM/primitives/Tensor/lists/symmTensorList.H
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/symmTensorList.H
rename to src/OpenFOAM/primitives/Tensor/lists/symmTensorList.H
index 9691df46a904c0d7fb3a9e87990ec6a413644a69..f9b99b65f091b274bdc9921d14d51a017bfc528a 100644
--- a/src/OpenFOAM/primitives/Lists/symmTensorList.H
+++ b/src/OpenFOAM/primitives/Tensor/lists/symmTensorList.H
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/tensorList.C b/src/OpenFOAM/primitives/Tensor/lists/tensorList.C
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/tensorList.C
rename to src/OpenFOAM/primitives/Tensor/lists/tensorList.C
index 6a1b65243fa073beb6c8e69f69f63f2a49ca9e93..e65571889593054b7747ca4571e1dafdee9f789b 100644
--- a/src/OpenFOAM/primitives/Lists/tensorList.C
+++ b/src/OpenFOAM/primitives/Tensor/lists/tensorList.C
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/tensorList.H b/src/OpenFOAM/primitives/Tensor/lists/tensorList.H
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/tensorList.H
rename to src/OpenFOAM/primitives/Tensor/lists/tensorList.H
index 0139d9512bac869d65be98be85ade5561f69fd88..b08120f75855e7179379d1415bb12342d6db00cc 100644
--- a/src/OpenFOAM/primitives/Lists/tensorList.H
+++ b/src/OpenFOAM/primitives/Tensor/lists/tensorList.H
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/vectorIOList.C b/src/OpenFOAM/primitives/Vector/lists/vectorIOList.C
similarity index 95%
rename from src/OpenFOAM/primitives/Lists/vectorIOList.C
rename to src/OpenFOAM/primitives/Vector/lists/vectorIOList.C
index 95c31db6d58015ed01e1c64ba7873b2e0f832f68..16b424f589f4156697037dc2d74c93f6d62b2f63 100644
--- a/src/OpenFOAM/primitives/Lists/vectorIOList.C
+++ b/src/OpenFOAM/primitives/Vector/lists/vectorIOList.C
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/vectorIOList.H b/src/OpenFOAM/primitives/Vector/lists/vectorIOList.H
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/vectorIOList.H
rename to src/OpenFOAM/primitives/Vector/lists/vectorIOList.H
index 4410bdac149ee45d206fb8d47bf5059692f693fc..1b1d43c66586f18bb9b86e704efcf62a173d5b68 100644
--- a/src/OpenFOAM/primitives/Lists/vectorIOList.H
+++ b/src/OpenFOAM/primitives/Vector/lists/vectorIOList.H
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/vectorList.C b/src/OpenFOAM/primitives/Vector/lists/vectorList.C
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/vectorList.C
rename to src/OpenFOAM/primitives/Vector/lists/vectorList.C
index fd4c074065dbc3576e2bbd9ed123d3fcc7bd2bdf..95c804972969d559ecfd7aee21badd70a827d9f6 100644
--- a/src/OpenFOAM/primitives/Lists/vectorList.C
+++ b/src/OpenFOAM/primitives/Vector/lists/vectorList.C
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/vectorList.H b/src/OpenFOAM/primitives/Vector/lists/vectorList.H
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/vectorList.H
rename to src/OpenFOAM/primitives/Vector/lists/vectorList.H
index a60c3a81d3b1a8e0f0a3bc9c785c663606ac6584..9b93b077b110f210a2b9835e1a4c65a173e8eb89 100644
--- a/src/OpenFOAM/primitives/Lists/vectorList.H
+++ b/src/OpenFOAM/primitives/Vector/lists/vectorList.H
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/vectorListIOList.C b/src/OpenFOAM/primitives/Vector/lists/vectorListIOList.C
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/vectorListIOList.C
rename to src/OpenFOAM/primitives/Vector/lists/vectorListIOList.C
index 22e5ecc346576ba97472c688c6f2b6cd7a39f6a9..de2317e50d3e9b7c1850ea9df0ad996ec4f12e74 100644
--- a/src/OpenFOAM/primitives/Lists/vectorListIOList.C
+++ b/src/OpenFOAM/primitives/Vector/lists/vectorListIOList.C
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/vectorListIOList.H b/src/OpenFOAM/primitives/Vector/lists/vectorListIOList.H
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/vectorListIOList.H
rename to src/OpenFOAM/primitives/Vector/lists/vectorListIOList.H
index 699249c1e7b6cf237f8b8af8eed95146689cc10d..c1f371c6487f420d3727b608d5ee08910dec715b 100644
--- a/src/OpenFOAM/primitives/Lists/vectorListIOList.H
+++ b/src/OpenFOAM/primitives/Vector/lists/vectorListIOList.H
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/boolList.C b/src/OpenFOAM/primitives/bools/lists/boolList.C
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/boolList.C
rename to src/OpenFOAM/primitives/bools/lists/boolList.C
index 4663a90e1bce9d0fe0709392aea50584e869bc48..b51c228effac2ae88882612fa67ac4072c2d6a1c 100644
--- a/src/OpenFOAM/primitives/Lists/boolList.C
+++ b/src/OpenFOAM/primitives/bools/lists/boolList.C
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/boolList.H b/src/OpenFOAM/primitives/bools/lists/boolList.H
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/boolList.H
rename to src/OpenFOAM/primitives/bools/lists/boolList.H
index ab48e70453db69bc3fcf5a55b3e8ae2c8616596c..a70bbc18ddb988d8a02ffe2c2aed9e4340a71ef9 100644
--- a/src/OpenFOAM/primitives/Lists/boolList.H
+++ b/src/OpenFOAM/primitives/bools/lists/boolList.H
@@ -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
diff --git a/src/lagrangian/intermediate/submodels/IO/DataEntry/Constant/Constant.C b/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.C
similarity index 97%
rename from src/lagrangian/intermediate/submodels/IO/DataEntry/Constant/Constant.C
rename to src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.C
index 789c6a5d48d60c716b142b811181524c39677b7c..6eeafc583ba968f151193dac0200f52b97049070 100644
--- a/src/lagrangian/intermediate/submodels/IO/DataEntry/Constant/Constant.C
+++ b/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.C
@@ -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
diff --git a/src/lagrangian/intermediate/submodels/IO/DataEntry/Constant/Constant.H b/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.H
similarity index 98%
rename from src/lagrangian/intermediate/submodels/IO/DataEntry/Constant/Constant.H
rename to src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.H
index f58739afc75b00fd7215f67cb67b255ac6388a59..f7a1bb902e89fb57046849828cc5928bb9722d0c 100644
--- a/src/lagrangian/intermediate/submodels/IO/DataEntry/Constant/Constant.H
+++ b/src/OpenFOAM/primitives/functions/DataEntry/Constant/Constant.H
@@ -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
diff --git a/src/lagrangian/intermediate/submodels/IO/DataEntry/Constant/ConstantIO.C b/src/OpenFOAM/primitives/functions/DataEntry/Constant/ConstantIO.C
similarity index 96%
rename from src/lagrangian/intermediate/submodels/IO/DataEntry/Constant/ConstantIO.C
rename to src/OpenFOAM/primitives/functions/DataEntry/Constant/ConstantIO.C
index de383f970716c28698d65cbd1e3d53819425ab14..eca4a677a2644867ebf52f9bc8425c20afb31259 100644
--- a/src/lagrangian/intermediate/submodels/IO/DataEntry/Constant/ConstantIO.C
+++ b/src/OpenFOAM/primitives/functions/DataEntry/Constant/ConstantIO.C
@@ -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
diff --git a/src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntry.C b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.C
similarity index 97%
rename from src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntry.C
rename to src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.C
index 7e13f4bddd16862386fecfb4f3fa483988af09d6..825d8c840031eae079a6229143223c3e66f39699 100644
--- a/src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntry.C
+++ b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.C
@@ -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
diff --git a/src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntry.H b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H
similarity index 98%
rename from src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntry.H
rename to src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H
index 4cb66725a68b0384276fe1785f4976e18c2e7180..405b8889a40b5f2f3a4159e3aad878bcafbeecf0 100644
--- a/src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntry.H
+++ b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntry.H
@@ -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
diff --git a/src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntryIO.C b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryIO.C
similarity index 95%
rename from src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntryIO.C
rename to src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryIO.C
index cbe3fe87cffa1849a130984597524cd5e939cd47..99a781a937cc0aab79d10343e7681a48b449c763 100644
--- a/src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntryIO.C
+++ b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryIO.C
@@ -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
diff --git a/src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntryNew.C b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryNew.C
similarity index 97%
rename from src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntryNew.C
rename to src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryNew.C
index 947d86753f9f549a1ecd48dfdd6576a66f78ccbf..fac7d6c4defc0af3922bf126e22b07e0cf04508e 100644
--- a/src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntryNew.C
+++ b/src/OpenFOAM/primitives/functions/DataEntry/DataEntry/DataEntryNew.C
@@ -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
diff --git a/src/lagrangian/intermediate/submodels/IO/DataEntry/Table/Table.C b/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.C
similarity index 98%
rename from src/lagrangian/intermediate/submodels/IO/DataEntry/Table/Table.C
rename to src/OpenFOAM/primitives/functions/DataEntry/Table/Table.C
index 3e14479f35e0f3b6c92e3c0882a40c369e57ec1e..71212250ffb1a06fdd7d3d5406c4e7145ca0fe62 100644
--- a/src/lagrangian/intermediate/submodels/IO/DataEntry/Table/Table.C
+++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.C
@@ -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
diff --git a/src/lagrangian/intermediate/submodels/IO/DataEntry/Table/Table.H b/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.H
similarity index 98%
rename from src/lagrangian/intermediate/submodels/IO/DataEntry/Table/Table.H
rename to src/OpenFOAM/primitives/functions/DataEntry/Table/Table.H
index ef58482c80c8c8d08db4f78fadd00e108928f98a..5fe73deccbf9d83859019cad01c49d9505845d66 100644
--- a/src/lagrangian/intermediate/submodels/IO/DataEntry/Table/Table.H
+++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/Table.H
@@ -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
diff --git a/src/lagrangian/intermediate/submodels/IO/DataEntry/Table/TableIO.C b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableIO.C
similarity index 96%
rename from src/lagrangian/intermediate/submodels/IO/DataEntry/Table/TableIO.C
rename to src/OpenFOAM/primitives/functions/DataEntry/Table/TableIO.C
index c32e673f38818ef229c93f92b0ebf65e3861f087..b312469b6bb81fa5fb7df6f060b772868697a31b 100644
--- a/src/lagrangian/intermediate/submodels/IO/DataEntry/Table/TableIO.C
+++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableIO.C
@@ -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
diff --git a/src/lagrangian/intermediate/submodels/IO/DataEntry/makeDataEntries.C b/src/OpenFOAM/primitives/functions/DataEntry/makeDataEntries.C
similarity index 96%
rename from src/lagrangian/intermediate/submodels/IO/DataEntry/makeDataEntries.C
rename to src/OpenFOAM/primitives/functions/DataEntry/makeDataEntries.C
index 39d164a68124dc81851b1fdd9ad33d6cccae333a..114658753acc4b8a0ea9f870e9a3151b19240876 100644
--- a/src/lagrangian/intermediate/submodels/IO/DataEntry/makeDataEntries.C
+++ b/src/OpenFOAM/primitives/functions/DataEntry/makeDataEntries.C
@@ -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
diff --git a/src/lagrangian/intermediate/submodels/IO/DataEntry/polynomial/polynomial.C b/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.C
similarity index 97%
rename from src/lagrangian/intermediate/submodels/IO/DataEntry/polynomial/polynomial.C
rename to src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.C
index f142458397568f18635e9408adf95df5df2d53a1..859440c6dcb7a06154b006c6458d34b20d74feeb 100644
--- a/src/lagrangian/intermediate/submodels/IO/DataEntry/polynomial/polynomial.C
+++ b/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2008-2010 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/lagrangian/intermediate/submodels/IO/DataEntry/polynomial/polynomial.H b/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.H
similarity index 98%
rename from src/lagrangian/intermediate/submodels/IO/DataEntry/polynomial/polynomial.H
rename to src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.H
index 78c55c7870446b4df6cd4d7830c937a34908d245..0b4d18a4bb4b854a66798c0c492cb8447b5b39b0 100644
--- a/src/lagrangian/intermediate/submodels/IO/DataEntry/polynomial/polynomial.H
+++ b/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomial.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2008-2010 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/lagrangian/intermediate/submodels/IO/DataEntry/polynomial/polynomialIO.C b/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomialIO.C
similarity index 96%
rename from src/lagrangian/intermediate/submodels/IO/DataEntry/polynomial/polynomialIO.C
rename to src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomialIO.C
index e50f08bb1ee96d3daa1646e440768f9649a47948..ab5c0c2e9031c4ed884efd8aaa2522c5f1f759f2 100644
--- a/src/lagrangian/intermediate/submodels/IO/DataEntry/polynomial/polynomialIO.C
+++ b/src/OpenFOAM/primitives/functions/DataEntry/polynomial/polynomialIO.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2008-2010 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.C b/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.C
index d8569a536c494b418614a87cf45783e97e18b667..7f9ae731f6bec8c6616e3213346855c17f6e5735 100644
--- a/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.C
+++ b/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2008-2010 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 2009-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -149,7 +149,7 @@ Foam::scalar& Foam::Polynomial<PolySize>::logCoeff()
 
 
 template<int PolySize>
-Foam::scalar Foam::Polynomial<PolySize>::evaluate(const scalar x) const
+Foam::scalar Foam::Polynomial<PolySize>::value(const scalar x) const
 {
     scalar y = this->v_[0];
 
@@ -192,7 +192,7 @@ Foam::scalar Foam::Polynomial<PolySize>::integrateLimits
 
     intPolyType poly = this->integrate();
 
-    return poly.evaluate(x2) - poly.evaluate(x1);
+    return poly.value(x2) - poly.value(x1);
 }
 
 
diff --git a/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.H b/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.H
index ace90a0bc8d0bc7e4edc23515864aba51452d7a4..06511b0003edb911e9c7965964f2227f487d352a 100644
--- a/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.H
+++ b/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2008-2010 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 2009-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -32,7 +32,7 @@ Description
     where 0 \<= i \<= n
 
     - integer powers, starting at zero
-    - evaluate(x) to evaluate the poly for a given value
+    - value(x) to evaluate the poly for a given value
     - integrate(x1, x2) between two scalar values
     - integrate() to return a new, intergated coeff polynomial
       - increases the size (order)
@@ -134,7 +134,7 @@ public:
         // Evaluation
 
             //- Return polynomial value
-            scalar evaluate(const scalar x) const;
+            scalar value(const scalar x) const;
 
             //- Return integrated polynomial coefficients
             //  argument becomes zeroth element (constant of integration)
diff --git a/src/OpenFOAM/primitives/functions/Polynomial/PolynomialIO.C b/src/OpenFOAM/primitives/functions/Polynomial/PolynomialIO.C
index f3fad20edd6e7eb6136b04b67e69a5fef7b8af08..9b99c7a483f5f912f05311f4dd74dc00c6e77ecb 100644
--- a/src/OpenFOAM/primitives/functions/Polynomial/PolynomialIO.C
+++ b/src/OpenFOAM/primitives/functions/Polynomial/PolynomialIO.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2008-2010 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 2009-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/OpenFOAM/primitives/Lists/labelIOList.C b/src/OpenFOAM/primitives/ints/lists/labelIOList.C
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/labelIOList.C
rename to src/OpenFOAM/primitives/ints/lists/labelIOList.C
index 1f98f572971562eac46156123129cc3830b57b04..bb833f786189cc22e93a890e974cb5cf23310541 100644
--- a/src/OpenFOAM/primitives/Lists/labelIOList.C
+++ b/src/OpenFOAM/primitives/ints/lists/labelIOList.C
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/labelIOList.H b/src/OpenFOAM/primitives/ints/lists/labelIOList.H
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/labelIOList.H
rename to src/OpenFOAM/primitives/ints/lists/labelIOList.H
index 56447682ebf0c0065e6dd2a82bd7d68011ec6f76..176ad339fd7581bfb0cb809c2d3662bfa08d72a6 100644
--- a/src/OpenFOAM/primitives/Lists/labelIOList.H
+++ b/src/OpenFOAM/primitives/ints/lists/labelIOList.H
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/labelList.H b/src/OpenFOAM/primitives/ints/lists/labelList.H
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/labelList.H
rename to src/OpenFOAM/primitives/ints/lists/labelList.H
index 694b923b4b08bcabe0e5211f406ac60c6a4fba97..01d006af0f116d743580a9d0ae02d6781a7e0ead 100644
--- a/src/OpenFOAM/primitives/Lists/labelList.H
+++ b/src/OpenFOAM/primitives/ints/lists/labelList.H
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/labelListIOList.C b/src/OpenFOAM/primitives/ints/lists/labelListIOList.C
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/labelListIOList.C
rename to src/OpenFOAM/primitives/ints/lists/labelListIOList.C
index 7a06638a53fa1b0302d79494b9e3023708e8ca7e..90095022c8a2d57f59845be9a62a61b2fc666b3d 100644
--- a/src/OpenFOAM/primitives/Lists/labelListIOList.C
+++ b/src/OpenFOAM/primitives/ints/lists/labelListIOList.C
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/labelListIOList.H b/src/OpenFOAM/primitives/ints/lists/labelListIOList.H
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/labelListIOList.H
rename to src/OpenFOAM/primitives/ints/lists/labelListIOList.H
index 2ca6d5350e309851fcdcac6330b50bdfb06c6ef7..98610c5563d3a0f0b031d06e19ea728fd162cb56 100644
--- a/src/OpenFOAM/primitives/Lists/labelListIOList.H
+++ b/src/OpenFOAM/primitives/ints/lists/labelListIOList.H
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/fileNameList.H b/src/OpenFOAM/primitives/strings/lists/fileNameList.H
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/fileNameList.H
rename to src/OpenFOAM/primitives/strings/lists/fileNameList.H
index a8e3d40c52bc32d06f184881227d44a6783b341b..13e77381c8072e9d9c1bdb4364f9cdfbcf3246bd 100644
--- a/src/OpenFOAM/primitives/Lists/fileNameList.H
+++ b/src/OpenFOAM/primitives/strings/lists/fileNameList.H
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/hashedWordList.C b/src/OpenFOAM/primitives/strings/lists/hashedWordList.C
similarity index 98%
rename from src/OpenFOAM/primitives/Lists/hashedWordList.C
rename to src/OpenFOAM/primitives/strings/lists/hashedWordList.C
index e9206bda8e00bf05c468a9be718c4b80664f108d..332ecbcf96ab124fa304d0a230a69e09193e74d5 100644
--- a/src/OpenFOAM/primitives/Lists/hashedWordList.C
+++ b/src/OpenFOAM/primitives/strings/lists/hashedWordList.C
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/hashedWordList.H b/src/OpenFOAM/primitives/strings/lists/hashedWordList.H
similarity index 98%
rename from src/OpenFOAM/primitives/Lists/hashedWordList.H
rename to src/OpenFOAM/primitives/strings/lists/hashedWordList.H
index f0c51da1d63db8033895043e5f3ac9fd607497a2..4c5c1c43fdb92e085c171bee5cf821c4fe979cb7 100644
--- a/src/OpenFOAM/primitives/Lists/hashedWordList.H
+++ b/src/OpenFOAM/primitives/strings/lists/hashedWordList.H
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/hashedWordListI.H b/src/OpenFOAM/primitives/strings/lists/hashedWordListI.H
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/hashedWordListI.H
rename to src/OpenFOAM/primitives/strings/lists/hashedWordListI.H
index 1e736aa6c58217d95b6b56f94883b769a764bd94..e4585e85bc3360056e642e6b2b5998d6a32eb231 100644
--- a/src/OpenFOAM/primitives/Lists/hashedWordListI.H
+++ b/src/OpenFOAM/primitives/strings/lists/hashedWordListI.H
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/stringList.H b/src/OpenFOAM/primitives/strings/lists/stringList.H
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/stringList.H
rename to src/OpenFOAM/primitives/strings/lists/stringList.H
index b87495911c3ea1e701c37b2581880c140f5333dd..109c526535ba5eca5cb63818bee599c745f46f7d 100644
--- a/src/OpenFOAM/primitives/Lists/stringList.H
+++ b/src/OpenFOAM/primitives/strings/lists/stringList.H
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/stringListOps.H b/src/OpenFOAM/primitives/strings/lists/stringListOps.H
similarity index 99%
rename from src/OpenFOAM/primitives/Lists/stringListOps.H
rename to src/OpenFOAM/primitives/strings/lists/stringListOps.H
index 12143b43176de2c5fd4a3912161d5c5bc6d84696..3bfbc7ade68a62b38cf3afe7fa63c26400c11928 100644
--- a/src/OpenFOAM/primitives/Lists/stringListOps.H
+++ b/src/OpenFOAM/primitives/strings/lists/stringListOps.H
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/stringListOpsTemplates.C b/src/OpenFOAM/primitives/strings/lists/stringListOpsTemplates.C
similarity index 97%
rename from src/OpenFOAM/primitives/Lists/stringListOpsTemplates.C
rename to src/OpenFOAM/primitives/strings/lists/stringListOpsTemplates.C
index 28bd3a31a8b97bfa4e6e2e02ee395c907ced19fc..34d1268432469a6a249f3336eadbace686436439 100644
--- a/src/OpenFOAM/primitives/Lists/stringListOpsTemplates.C
+++ b/src/OpenFOAM/primitives/strings/lists/stringListOpsTemplates.C
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/wordList.H b/src/OpenFOAM/primitives/strings/lists/wordList.H
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/wordList.H
rename to src/OpenFOAM/primitives/strings/lists/wordList.H
index ce46a9e357345ad51e5ab5d19f77ba367423ef26..f7b7dbff4d6048288dbed9a4fd032454dba392f0 100644
--- a/src/OpenFOAM/primitives/Lists/wordList.H
+++ b/src/OpenFOAM/primitives/strings/lists/wordList.H
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/wordReList.H b/src/OpenFOAM/primitives/strings/lists/wordReList.H
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/wordReList.H
rename to src/OpenFOAM/primitives/strings/lists/wordReList.H
index 31a4793655fdc6ee359fea1be81115b5724b6c48..33b557c1266c1c0cd498859a2d5ff70919e63820 100644
--- a/src/OpenFOAM/primitives/Lists/wordReList.H
+++ b/src/OpenFOAM/primitives/strings/lists/wordReList.H
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/wordReListMatcher.H b/src/OpenFOAM/primitives/strings/lists/wordReListMatcher.H
similarity index 97%
rename from src/OpenFOAM/primitives/Lists/wordReListMatcher.H
rename to src/OpenFOAM/primitives/strings/lists/wordReListMatcher.H
index a2afd0c2d22856b7870ae090500567015a2d3b85..580f888014457c07d17415b47da0b583d78dbfb0 100644
--- a/src/OpenFOAM/primitives/Lists/wordReListMatcher.H
+++ b/src/OpenFOAM/primitives/strings/lists/wordReListMatcher.H
@@ -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
diff --git a/src/OpenFOAM/primitives/Lists/wordReListMatcherI.H b/src/OpenFOAM/primitives/strings/lists/wordReListMatcherI.H
similarity index 96%
rename from src/OpenFOAM/primitives/Lists/wordReListMatcherI.H
rename to src/OpenFOAM/primitives/strings/lists/wordReListMatcherI.H
index ec41a80c35c186ad4deb568be9eeb0d5fcb42077..ae2065bc12e1dde3a662dfee34c7267ac436e19a 100644
--- a/src/OpenFOAM/primitives/Lists/wordReListMatcherI.H
+++ b/src/OpenFOAM/primitives/strings/lists/wordReListMatcherI.H
@@ -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
diff --git a/src/Pstream/Allwmake b/src/Pstream/Allwmake
index 7a2f2cd308aa275cf67e67a22cd2a400259c19e3..742d3d4478eaf475cf4d7f7174a8a5cb8041a8e3 100755
--- a/src/Pstream/Allwmake
+++ b/src/Pstream/Allwmake
@@ -1,10 +1,8 @@
 #!/bin/sh
 cd ${0%/*} || exit 1    # run from this directory
+[ $# -ge 1 ] && makeOption=$1 || makeOption=libso
 set -x
 
-makeOption=libso
-[ $# -ge 1 ] && makeOption=$1
-
 wmake $makeOption dummy
 
 case "$WM_MPLIB" in
@@ -12,6 +10,7 @@ case "$WM_MPLIB" in
     set +x
     echo
     echo "Note: ignore spurious warnings about missing mpicxx.h headers"
+    echo
     set -x
     # force compilation into qualified directory
     WM_OPTIONS=${WM_OPTIONS}$WM_MPLIB  wmake $makeOption mpi
diff --git a/src/conversion/Allwmake b/src/conversion/Allwmake
index cf1e61d47d05584465858dc494c71a97c4a3be20..444d3f654914f34ac8b85f9fb9ab7494dc57437a 100755
--- a/src/conversion/Allwmake
+++ b/src/conversion/Allwmake
@@ -1,10 +1,8 @@
 #!/bin/sh
 cd ${0%/*} || exit 1    # run from this directory
+[ $# -ge 1 ] && makeOption=$1 || makeOption=libso
 set -x
 
-makeOption=libso
-[ $# -ge 1 ] && makeOption=$1
-
 wmake $makeOption
 
 # ----------------------------------------------------------------- end-of-file
diff --git a/src/conversion/Make/files b/src/conversion/Make/files
index 563d177682b741fc44e7cb34b3dd3fd5db023281..7c5a0aa91c070a5903667e22ed7a76f864bfee0e 100644
--- a/src/conversion/Make/files
+++ b/src/conversion/Make/files
@@ -4,7 +4,6 @@ ensight/part/ensightPart.C
 ensight/part/ensightPartIO.C
 ensight/part/ensightPartCells.C
 ensight/part/ensightPartFaces.C
-ensight/part/ensightPartNonMeshFaces.C
 ensight/part/ensightParts.C
 
 meshTables/boundaryRegion.C
diff --git a/src/conversion/ensight/file/ensightFile.C b/src/conversion/ensight/file/ensightFile.C
index e5f1b18f9c3f569bd28583ab885a459d06917ecb..23ae7a1e3733a8d457d428f08f86eeb138d09b9e 100644
--- a/src/conversion/ensight/file/ensightFile.C
+++ b/src/conversion/ensight/file/ensightFile.C
@@ -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) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/conversion/ensight/file/ensightFile.H b/src/conversion/ensight/file/ensightFile.H
index 46e10ce61f22c8fae687d6cf8c24dc34c4f898c6..59b28ebb9ed7c88ba33aa15df2d923689e0e79aa 100644
--- a/src/conversion/ensight/file/ensightFile.H
+++ b/src/conversion/ensight/file/ensightFile.H
@@ -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) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/conversion/ensight/file/ensightGeoFile.C b/src/conversion/ensight/file/ensightGeoFile.C
index f7a7adceb874630b58183705800e932cd01ee8f4..dffcd07891dc8785cc99bc1ce1567e5850620152 100644
--- a/src/conversion/ensight/file/ensightGeoFile.C
+++ b/src/conversion/ensight/file/ensightGeoFile.C
@@ -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) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/conversion/ensight/file/ensightGeoFile.H b/src/conversion/ensight/file/ensightGeoFile.H
index 7b59b111a95a7427b95b01ccf4388104e3dac915..eae4a0b4d5da0ef9871414bf97ee82d5cfc33234 100644
--- a/src/conversion/ensight/file/ensightGeoFile.H
+++ b/src/conversion/ensight/file/ensightGeoFile.H
@@ -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) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/src/conversion/ensight/part/ensightPart.C b/src/conversion/ensight/part/ensightPart.C
index 4c071a4220494c45957cef781bdb5750777f3c57..303c417ac753e51caabd0beefd0ee5d23c0d44eb 100644
--- a/src/conversion/ensight/part/ensightPart.C
+++ b/src/conversion/ensight/part/ensightPart.C
@@ -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) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -24,31 +24,32 @@ License
 \*----------------------------------------------------------------------------*/
 
 #include "ensightPart.H"
-#include "addToRunTimeSelectionTable.H"
 #include "dictionary.H"
 #include "ListOps.H"
+#include "addToRunTimeSelectionTable.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 namespace Foam
 {
-   defineTypeNameAndDebug(ensightPart, 0);
-   defineTemplateTypeNameAndDebug(IOPtrList<ensightPart>, 0);
-   defineRunTimeSelectionTable(ensightPart, istream);
+    defineTypeNameAndDebug(ensightPart, 0);
+    defineTemplateTypeNameAndDebug(IOPtrList<ensightPart>, 0);
+    defineRunTimeSelectionTable(ensightPart, istream);
 }
 
-Foam::List<Foam::word> Foam::ensightPart::elemTypes_(0);
+const Foam::List<Foam::word> Foam::ensightPart::elemTypes_(0);
 
-// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
+// * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * //
 
 bool Foam::ensightPart::isFieldDefined(const List<scalar>& field) const
 {
     forAll(elemLists_, elemI)
     {
-        const labelList& idList = elemLists_[elemI];
+        const labelUList& idList = elemLists_[elemI];
 
         forAll(idList, i)
         {
-            label id = idList[i];
+            const label id = idList[i];
 
             if (id >= field.size() || isnan(field[id]))
             {
@@ -72,7 +73,7 @@ Foam::ensightPart::ensightPart
     size_(0),
     isCellData_(true),
     matId_(0),
-    meshPtr_(0)
+    points_(pointField::null())
 {}
 
 
@@ -89,7 +90,7 @@ Foam::ensightPart::ensightPart
     size_(0),
     isCellData_(true),
     matId_(0),
-    meshPtr_(0)
+    points_(pointField::null())
 {}
 
 
@@ -97,7 +98,7 @@ Foam::ensightPart::ensightPart
 (
     label partNumber,
     const string& partDescription,
-    const polyMesh& pMesh
+    const pointField& points
 )
 :
     number_(partNumber),
@@ -107,7 +108,7 @@ Foam::ensightPart::ensightPart
     size_(0),
     isCellData_(true),
     matId_(0),
-    meshPtr_(&pMesh)
+    points_(points)
 {}
 
 
@@ -120,7 +121,7 @@ Foam::ensightPart::ensightPart(const ensightPart& part)
     size_(part.size_),
     isCellData_(part.isCellData_),
     matId_(part.matId_),
-    meshPtr_(part.meshPtr_)
+    points_(part.points_)
 {}
 
 
@@ -158,31 +159,7 @@ Foam::ensightPart::~ensightPart()
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-void Foam::ensightPart::reconstruct(Istream& is)
-{
-    dictionary dict(is);
-    dict.lookup("id") >> number_;
-    dict.lookup("name") >> name_;
-    dict.readIfPresent("offset", offset_);
-
-    // populate elemLists_
-    elemLists_.setSize(elementTypes().size());
-
-    forAll(elementTypes(), elemI)
-    {
-        word key(elementTypes()[elemI]);
-
-        elemLists_[elemI].clear();
-        dict.readIfPresent(key, elemLists_[elemI]);
-
-        size_ += elemLists_[elemI].size();
-    }
-
-    is.check("ensightPart::reconstruct(Istream&)");
-}
-
-
-void Foam::ensightPart::renumber(labelList const& origId)
+void Foam::ensightPart::renumber(const labelUList& origId)
 {
     // transform to global values first
     if (offset_)
diff --git a/src/conversion/ensight/part/ensightPart.H b/src/conversion/ensight/part/ensightPart.H
index b335ef86324db09f41722011db2834e24b0e414c..0d1770f4126544600e71ee56de0a9480e3a49e30 100644
--- a/src/conversion/ensight/part/ensightPart.H
+++ b/src/conversion/ensight/part/ensightPart.H
@@ -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) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -30,7 +30,7 @@ Description
 SourceFiles
     ensightPart.C
     ensightPartIO.C
-    ensightPartI.H
+    ensightPartTemplates.C
 
 \*---------------------------------------------------------------------------*/
 
@@ -52,7 +52,7 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                           Class ensightPart Declaration
+                         Class ensightPart Declaration
 \*---------------------------------------------------------------------------*/
 
 class ensightPart
@@ -60,7 +60,7 @@ class ensightPart
     // Private data
 
         // Static data members
-        static List<word> elemTypes_;
+        static const List<word> elemTypes_;
 
 
 protected:
@@ -88,8 +88,8 @@ protected:
         //- material id (numeric)
         label matId_;
 
-        //- mesh reference used
-        const polyMesh* meshPtr_;
+        //- pointField referenced
+        const pointField& points_;
 
 
     // Protected Classes
@@ -104,25 +104,27 @@ protected:
             //- map global to local indices
             labelList list;
 
-            // null constructor
+            //- null constructor
             localPoints()
             :
                 nPoints(0),
                 list(0)
             {}
 
-            // construct for mesh points
-            localPoints(const polyMesh& pMesh)
+            //- construct for mesh points
+            localPoints(const pointField& pts)
             :
                 nPoints(0),
-                list(pMesh.points().size(), -1)
+                list(pts.size(), -1)
             {}
         };
 
 
     // Protected Member Functions
 
-        //- reconstruct contents from Istream
+        //- Reconstruct part characteristics (eg, element types) from Istream
+        //  A part reconstructed in this manner can be used when writing fields,
+        //  but cannot be used to write a new geometry
         void reconstruct(Istream&);
 
         //- check for fully defined fields
@@ -132,6 +134,7 @@ protected:
         void writeHeader(ensightFile&, bool withDescription=false) const;
 
         //- write a scalar field for idList
+        //  A null reference for idList writes the perNode values
         void writeFieldList
         (
             ensightFile& os,
@@ -148,10 +151,10 @@ protected:
         //- write connectivities
         virtual void writeConnectivity
         (
-            ensightGeoFile& os,
+            ensightGeoFile&,
             const word& key,
-            const labelList& idList,
-            const labelList& pointMap
+            const labelUList& idList,
+            const labelUList& pointMap
         ) const
         {}
 
@@ -170,12 +173,12 @@ public:
         //- Construct empty part with number and description
         ensightPart(label partNumber, const string& partDescription);
 
-        //- Construct empty part with number and description
+        //- Construct part with number, description and points reference
         ensightPart
         (
             label partNumber,
             const string& partDescription,
-            const polyMesh& pMesh
+            const pointField& points
         );
 
         //- Construct as copy
@@ -202,8 +205,9 @@ public:
             return autoPtr<ensightPart>(new ensightPart(*this));
         };
 
-        //- Construct on freestore from Istream
-        static autoPtr<ensightPart> New(Istream& is);
+        //- Reconstruct part characteristics on freestore from Istream
+        //  @sa reconstruct
+        static autoPtr<ensightPart> New(Istream&);
 
 
     //- Destructor
@@ -212,7 +216,7 @@ public:
 
     // Static members
 
-        virtual List<word> const& elementTypes() const
+        virtual const List<word>& elementTypes() const
         {
             return elemTypes_;
         }
@@ -256,12 +260,13 @@ public:
             return matId_;
         }
 
-        //- non-const access
+        //- non-const access to part name or description
         void name(const string& value)
         {
             name_ = value;
         }
 
+        //- non-const access to material id
         void materialId(const label value)
         {
             matId_ = value;
@@ -283,7 +288,7 @@ public:
     // Edit
 
         //- renumber elements
-        void renumber(labelList const&);
+        void renumber(const labelUList&);
 
         //- write summary information about the object
         bool writeSummary(Ostream&) const;
@@ -296,31 +301,37 @@ public:
         {}
 
         //- Helper: write geometry given the pointField
-        void writeGeometry(ensightGeoFile&, const pointField& points) const;
+        void writeGeometry(ensightGeoFile&, const pointField&) const;
 
         //- write scalar field
+        //  optionally write data per node
         void writeScalarField
         (
             ensightFile&,
-            const List<scalar>& field
+            const List<scalar>& field,
+            const bool perNode = false
         ) const;
 
         //- write vector field components
+        //  optionally write data per node
         void writeVectorField
         (
             ensightFile&,
             const List<scalar>& field0,
             const List<scalar>& field1,
-            const List<scalar>& field2
+            const List<scalar>& field2,
+            const bool perNode = false
         ) const;
 
 
         //- write generalized field components
-        template <class Type>
+        //  optionally write data per node
+        template<class Type>
         void writeField
         (
             ensightFile&,
-            const Field<Type>&
+            const Field<Type>&,
+            const bool perNode = false
         ) const;
 
 
@@ -339,11 +350,8 @@ public:
         friend Ostream& operator<<(Ostream&, const ensightPart&);
 
         //- write geometry
-        friend ensightGeoFile& operator<<
-        (
-            ensightGeoFile&,
-            const ensightPart&
-        );
+        friend ensightGeoFile& operator<<(ensightGeoFile&, const ensightPart&);
+
 };
 
 
@@ -354,7 +362,7 @@ public:
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 #ifdef NoRepository
-#   include "ensightPartI.H"
+#   include "ensightPartTemplates.C"
 #endif
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/conversion/ensight/part/ensightPartCells.C b/src/conversion/ensight/part/ensightPartCells.C
index d00e9b6f4b868fedcb22c25196ce580f5570b856..a05b70bcef68b36fda8eacbe38bcf33f98485565 100644
--- a/src/conversion/ensight/part/ensightPartCells.C
+++ b/src/conversion/ensight/part/ensightPartCells.C
@@ -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) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -24,22 +24,21 @@ License
 \*----------------------------------------------------------------------------*/
 
 #include "ensightPartCells.H"
-#include "addToRunTimeSelectionTable.H"
 #include "IOstream.H"
 #include "IStringStream.H"
 #include "dictionary.H"
 #include "cellModeller.H"
-
+#include "addToRunTimeSelectionTable.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
 namespace Foam
 {
-   defineTypeNameAndDebug(ensightPartCells, 0);
-   addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream);
+    defineTypeNameAndDebug(ensightPartCells, 0);
+    addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream);
 }
 
-Foam::List<Foam::word> Foam::ensightPartCells::elemTypes_
+const Foam::List<Foam::word> Foam::ensightPartCells::elemTypes_
 (
     IStringStream
     (
@@ -50,7 +49,11 @@ Foam::List<Foam::word> Foam::ensightPartCells::elemTypes_
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-void Foam::ensightPartCells::classify(const labelList& idList)
+void Foam::ensightPartCells::classify
+(
+    const polyMesh& mesh,
+    const labelUList& idList
+)
 {
     // References to cell shape models
     const cellModel& tet   = *(cellModeller::lookup("tet"));
@@ -58,7 +61,6 @@ void Foam::ensightPartCells::classify(const labelList& idList)
     const cellModel& prism = *(cellModeller::lookup("prism"));
     const cellModel& hex   = *(cellModeller::lookup("hex"));
 
-    const polyMesh& mesh = *meshPtr_;
     const cellShapeList& cellShapes = mesh.cellShapes();
 
     offset_ = 0;
@@ -78,13 +80,6 @@ void Foam::ensightPartCells::classify(const labelList& idList)
     label nHex   = 0;
     label nPoly  = 0;
 
-
-    // TODO: allow tet-decomposition of polyhedral cells
-#if 0
-    label nTetDecomp = 0;
-    label nPyrDecomp = 0;
-#endif
-
     for (label listI = 0; listI < size_; ++listI)
     {
         label cellId = listI;
@@ -115,26 +110,6 @@ void Foam::ensightPartCells::classify(const labelList& idList)
         else
         {
             nPoly++;
-
-            // TODO: allow tet-decomposition of polyhedral cells
-#if 0
-            const cell& cFaces = mesh.cells()[cellI];
-
-            forAll(cFaces, cFaceI)
-            {
-                const face& f = mesh.faces()[cFaces[cFaceI]];
-
-                label nQuads = 0;
-                label nTris = 0;
-                f.nTrianglesQuads(mesh.points(), nTris, nQuads);
-
-                nTetDecomp += nTris;
-                nPyrDecomp += nQuads;
-            }
-
-            nAddCells--;
-            nAddPoints++;
-#endif
         }
     }
 
@@ -183,29 +158,6 @@ void Foam::ensightPartCells::classify(const labelList& idList)
         else
         {
             polyCells[nPoly++] = cellId;
-
-            // TODO: allow tet-decomposition of polyhedral cells
-#if 0
-            // Mapping from additional point to cell
-            addPointCellLabels_[api] = cellId;
-
-            const cell& cFaces = mesh.cells()[cellId];
-
-            forAll(cFaces, cFaceI)
-            {
-                const face& f = mesh.faces()[cFaces[cFaceI]];
-
-                label nQuads = 0;
-                label nTris = 0;
-                f.nTrianglesQuads(mesh.points(), nTris, nQuads);
-
-                nTetDecomp += nTris;
-                nPyrDecomp += nQuads;
-            }
-
-            nAddCells--;
-            nAddPoints++;
-#endif
         }
     }
 
@@ -213,11 +165,11 @@ void Foam::ensightPartCells::classify(const labelList& idList)
     // MUST match with elementTypes
     elemLists_.setSize(elementTypes().size());
 
-    elemLists_[tetra4Elements].transfer( tetCells );
-    elemLists_[pyramid5Elements].transfer( pyramidCells );
-    elemLists_[penta6Elements].transfer( prismCells );
-    elemLists_[hexa8Elements].transfer( hexCells );
-    elemLists_[nfacedElements].transfer( polyCells );
+    elemLists_[tetra4Elements].transfer(tetCells);
+    elemLists_[pyramid5Elements].transfer(pyramidCells);
+    elemLists_[penta6Elements].transfer(prismCells);
+    elemLists_[hexa8Elements].transfer(hexCells);
+    elemLists_[nfacedElements].transfer(polyCells);
 }
 
 
@@ -229,57 +181,63 @@ Foam::ensightPartCells::ensightPartCells
     const string& partDescription
 )
 :
-    ensightPart(partNumber, partDescription)
+    ensightPart(partNumber, partDescription),
+    mesh_(*reinterpret_cast<polyMesh*>(0))
 {}
 
 
 Foam::ensightPartCells::ensightPartCells
 (
     label partNumber,
-    const polyMesh& pMesh
+    const polyMesh& mesh
 )
 :
-    ensightPart(partNumber, "cells", pMesh)
+    ensightPart(partNumber, "cells", mesh.points()),
+    mesh_(mesh)
 {
-    classify();
+    classify(mesh);
 }
 
 
 Foam::ensightPartCells::ensightPartCells
 (
     label partNumber,
-    const polyMesh& pMesh,
-    const labelList& idList
+    const polyMesh& mesh,
+    const labelUList& idList
 )
 :
-    ensightPart(partNumber, "cells", pMesh)
+    ensightPart(partNumber, "cells", mesh.points()),
+    mesh_(mesh)
 {
-    classify(idList);
+    classify(mesh, idList);
 }
 
 
 Foam::ensightPartCells::ensightPartCells
 (
     label partNumber,
-    const polyMesh& pMesh,
+    const polyMesh& mesh,
     const cellZone& cZone
 )
 :
-    ensightPart(partNumber, cZone.name(), pMesh)
+    ensightPart(partNumber, cZone.name(), mesh.points()),
+    mesh_(mesh)
 {
-    classify(cZone);
+    classify(mesh, cZone);
 }
 
 
 Foam::ensightPartCells::ensightPartCells(const ensightPartCells& part)
 :
-    ensightPart(part)
+    ensightPart(part),
+    mesh_(part.mesh_)
 {}
 
 
 Foam::ensightPartCells::ensightPartCells(Istream& is)
 :
-    ensightPart()
+    ensightPart(),
+    mesh_(*reinterpret_cast<polyMesh*>(0))
 {
     reconstruct(is);
 }
@@ -295,25 +253,23 @@ Foam::ensightPartCells::~ensightPartCells()
 
 Foam::ensightPart::localPoints Foam::ensightPartCells::calcLocalPoints() const
 {
-    const polyMesh& mesh = *meshPtr_;
-
-    localPoints ptList(mesh);
+    localPoints ptList(points_);
     labelList& usedPoints = ptList.list;
     label nPoints = 0;
 
     forAll(elemLists_, typeI)
     {
-        const labelList& idList = elemLists_[typeI];
+        const labelUList& idList = elemLists_[typeI];
 
         // add all points from cells
         forAll(idList, i)
         {
-            label id = idList[i] + offset_;
-            const labelList& cFaces = mesh.cells()[id];
+            const label id = idList[i] + offset_;
+            const labelUList& cFaces = mesh_.cells()[id];
 
             forAll(cFaces, cFaceI)
             {
-                const face& f = mesh.faces()[cFaces[cFaceI]];
+                const face& f = mesh_.faces()[cFaces[cFaceI]];
 
                 forAll(f, fp)
                 {
@@ -345,42 +301,40 @@ void Foam::ensightPartCells::writeConnectivity
 (
     ensightGeoFile& os,
     const word& key,
-    const labelList& idList,
-    const labelList& pointMap
+    const labelUList& idList,
+    const labelUList& pointMap
 ) const
 {
     os.writeKeyword(key);
     os.write(idList.size());
     os.newline();
 
-    const polyMesh& mesh = *meshPtr_;
-
     // write polyhedral
     if (key == "nfaced")
     {
-        const faceList& meshFaces = mesh.faces();
+        const faceList& meshFaces = mesh_.faces();
 
         // write the number of faces per element
         forAll(idList, i)
         {
-            label id = idList[i] + offset_;
-            const labelList& cFace = mesh.cells()[id];
+            const label id = idList[i] + offset_;
+            const labelUList& cFace = mesh_.cells()[id];
 
-            os.write( cFace.size() );
+            os.write(cFace.size());
             os.newline();
         }
 
         // write the number of points per element face
         forAll(idList, i)
         {
-            label id = idList[i] + offset_;
-            const labelList& cFace = mesh.cells()[id];
+            const label id = idList[i] + offset_;
+            const labelUList& cFace = mesh_.cells()[id];
 
             forAll(cFace, faceI)
             {
                 const face& cf = meshFaces[cFace[faceI]];
 
-                os.write( cf.size() );
+                os.write(cf.size());
                 os.newline();
             }
         }
@@ -388,8 +342,8 @@ void Foam::ensightPartCells::writeConnectivity
         // write the points describing each element face
         forAll(idList, i)
         {
-            label id = idList[i] + offset_;
-            const labelList& cFace = mesh.cells()[id];
+            const label id = idList[i] + offset_;
+            const labelUList& cFace = mesh_.cells()[id];
 
             forAll(cFace, faceI)
             {
@@ -399,7 +353,7 @@ void Foam::ensightPartCells::writeConnectivity
                 {
                     // convert global -> local index
                     // (note: Ensight indices start with 1)
-                    os.write( pointMap[cf[ptI]] + 1);
+                    os.write(pointMap[cf[ptI]] + 1);
                 }
                 os.newline();
             }
@@ -408,18 +362,18 @@ void Foam::ensightPartCells::writeConnectivity
     else
     {
         // write primitive
-        const cellShapeList& cellShapes = mesh.cellShapes();
+        const cellShapeList& cellShapes = mesh_.cellShapes();
 
         forAll(idList, i)
         {
-            label id = idList[i] + offset_;
+            const label id = idList[i] + offset_;
             const cellShape& cellPoints = cellShapes[id];
 
             // convert global -> local index
             // (note: Ensight indices start with 1)
             forAll(cellPoints, ptI)
             {
-                os.write( pointMap[cellPoints[ptI]] + 1 );
+                os.write(pointMap[cellPoints[ptI]] + 1);
             }
             os.newline();
         }
@@ -429,8 +383,7 @@ void Foam::ensightPartCells::writeConnectivity
 
 void Foam::ensightPartCells::writeGeometry(ensightGeoFile& os) const
 {
-    const polyMesh& mesh = *meshPtr_;
-    ensightPart::writeGeometry(os, mesh.points());
+    ensightPart::writeGeometry(os, points_);
 }
 
 
diff --git a/src/conversion/ensight/part/ensightPartCells.H b/src/conversion/ensight/part/ensightPartCells.H
index 82b0f80d890cc441ad5e2340b48e99b6caf612b3..cd79c029b6ca18177cdb98354a70ad03c7392df3 100644
--- a/src/conversion/ensight/part/ensightPartCells.H
+++ b/src/conversion/ensight/part/ensightPartCells.H
@@ -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) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -56,8 +56,12 @@ class ensightPartCells
         //- Disallow default bitwise assignment
         void operator=(const ensightPartCells&);
 
-        //- classify the cell types
-        void classify(const labelList& idLabels = labelList::null());
+        //- Classify the cell types, set elemLists.
+        void classify
+        (
+            const polyMesh&,
+            const labelUList& idLabels = labelUList::null()
+        );
 
         //- track points used
         virtual localPoints calcLocalPoints() const;
@@ -68,30 +72,35 @@ class ensightPartCells
         //- element connectivity
         virtual void writeConnectivity
         (
-            ensightGeoFile& os,
+            ensightGeoFile&,
             const word& key,
-            const labelList& idList,
-            const labelList& pointMap
+            const labelUList& idList,
+            const labelUList& pointMap
         ) const;
 
-        //- write geometry
-        virtual void writeGeometry(ensightGeoFile& os) const;
-
 
 protected:
 
-    //- addressable Ensight element types
-    enum elemType
-    {
-        tetra4Elements,
-        pyramid5Elements,
-        penta6Elements,
-        hexa8Elements,
-        nfacedElements
-    };
+        //- addressable ensight element types
+        enum elemType
+        {
+            tetra4Elements,
+            pyramid5Elements,
+            penta6Elements,
+            hexa8Elements,
+            nfacedElements
+        };
+
 
     // Static data members
-    static List<word> elemTypes_;
+
+        static const List<word> elemTypes_;
+
+
+    // Protected data
+
+        //- mesh referenced
+        const polyMesh& mesh_;
 
 
 public:
@@ -112,7 +121,7 @@ public:
         (
             label partNumber,
             const polyMesh&,
-            const labelList&
+            const labelUList&
         );
 
         //- Construct from polyMesh and cellZone
@@ -126,10 +135,13 @@ public:
         //- Construct as copy
         ensightPartCells(const ensightPartCells&);
 
-        //- Construct from Istream
+        //- Reconstruct part characteristics (eg, element types) from Istream
+        //  A part reconstructed in this manner can be used when writing fields,
+        //  but cannot be used to write a new geometry
+        //  @sa Foam::ensightPart::reconstruct
         ensightPartCells(Istream&);
 
-        //- Construct on freestore from Istream
+        //- Reconstruct part characteristics on freestore from Istream
         static autoPtr<ensightPartCells> New(Istream& is)
         {
             return autoPtr<ensightPartCells>(new ensightPartCells(is));
@@ -142,8 +154,11 @@ public:
 
     // Member Functions
 
+        //- write geometry
+        virtual void writeGeometry(ensightGeoFile&) const;
+
         //- static listing of the element types
-        virtual List<word> const& elementTypes() const
+        virtual const List<word>& elementTypes() const
         {
             return elemTypes_;
         }
diff --git a/src/conversion/ensight/part/ensightPartFaces.C b/src/conversion/ensight/part/ensightPartFaces.C
index 46169cd90f2e7d6adfa7387cd416c32d59a61ff2..c8bfaa00df39620f0c4c33c8a7ce486ef5004f43 100644
--- a/src/conversion/ensight/part/ensightPartFaces.C
+++ b/src/conversion/ensight/part/ensightPartFaces.C
@@ -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) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -24,21 +24,21 @@ License
 \*----------------------------------------------------------------------------*/
 
 #include "ensightPartFaces.H"
-#include "addToRunTimeSelectionTable.H"
 #include "IOstreams.H"
 #include "IStringStream.H"
 #include "dictionary.H"
+#include "addToRunTimeSelectionTable.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
 namespace Foam
 {
-   defineTypeNameAndDebug(ensightPartFaces, 0);
-   addToRunTimeSelectionTable(ensightPart, ensightPartFaces, istream);
+    defineTypeNameAndDebug(ensightPartFaces, 0);
+    addToRunTimeSelectionTable(ensightPart, ensightPartFaces, istream);
 }
 
 
-Foam::List<Foam::word> Foam::ensightPartFaces::elemTypes_
+const Foam::List<Foam::word> Foam::ensightPartFaces::elemTypes_
 (
     IStringStream
     (
@@ -49,7 +49,7 @@ Foam::List<Foam::word> Foam::ensightPartFaces::elemTypes_
 
 // * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * //
 
-void Foam::ensightPartFaces::binShapes(const faceList& faces)
+void Foam::ensightPartFaces::classify(const faceList& faces)
 {
     // count the shapes
     label nTri  = 0;
@@ -107,9 +107,9 @@ void Foam::ensightPartFaces::binShapes(const faceList& faces)
     // MUST match with elementTypes
     elemLists_.setSize(elementTypes().size());
 
-    elemLists_[tria3Elements].transfer( triCells );
-    elemLists_[quad4Elements].transfer( quadCells );
-    elemLists_[nsidedElements].transfer( polygonCells );
+    elemLists_[tria3Elements].transfer(triCells);
+    elemLists_[quad4Elements].transfer(quadCells);
+    elemLists_[nsidedElements].transfer(polygonCells);
 
     size_ = faces.size();
 }
@@ -123,7 +123,9 @@ Foam::ensightPartFaces::ensightPartFaces
     const string& partDescription
 )
 :
-    ensightPart(partNumber, partDescription)
+    ensightPart(partNumber, partDescription),
+    faces_(faceList::null()),
+    contiguousPoints_(false)
 {
     isCellData_ = false;
     offset_ = 0;
@@ -134,29 +136,57 @@ Foam::ensightPartFaces::ensightPartFaces
 Foam::ensightPartFaces::ensightPartFaces
 (
     label partNumber,
-    const polyMesh& pMesh,
-    const polyPatch& pPatch
+    const string& partDescription,
+    const pointField& points,
+    const faceList& faces,
+    const bool contiguousPoints
 )
 :
-    ensightPart(partNumber, pPatch.name(), pMesh)
+    ensightPart(partNumber, partDescription, points),
+    faces_(faces),
+    contiguousPoints_(contiguousPoints)
 {
     isCellData_ = false;
-    offset_ = pPatch.start();
+    offset_ = 0;
+    size_ = 0;
 
-    // count the shapes
-    binShapes(pPatch);
+    // classify the face shapes
+    classify(faces);
+}
+
+
+Foam::ensightPartFaces::ensightPartFaces
+(
+    label partNumber,
+    const polyMesh& mesh,
+    const polyPatch& patch
+)
+:
+    ensightPart(partNumber, patch.name(), mesh.points()),
+    faces_(mesh.faces()),
+    contiguousPoints_(false)
+{
+    isCellData_ = false;
+    offset_ = patch.start();
+
+    // classify the face shapes
+    classify(patch);
 }
 
 
 Foam::ensightPartFaces::ensightPartFaces(const ensightPartFaces& part)
 :
-    ensightPart(part)
+    ensightPart(part),
+    faces_(part.faces_),
+    contiguousPoints_(part.contiguousPoints_)
 {}
 
 
 Foam::ensightPartFaces::ensightPartFaces(Istream& is)
 :
-    ensightPart()
+    ensightPart(),
+    faces_(faceList::null()),
+    contiguousPoints_(false)
 {
     isCellData_ = false;
     reconstruct(is);
@@ -173,21 +203,27 @@ Foam::ensightPartFaces::~ensightPartFaces()
 
 Foam::ensightPart::localPoints Foam::ensightPartFaces::calcLocalPoints() const
 {
-    const polyMesh& mesh = *meshPtr_;
+    if (contiguousPoints_)
+    {
+        localPoints ptList;
+        ptList.list = identity(points_.size());
+        ptList.nPoints = points_.size();
+        return ptList;
+    }
 
-    localPoints ptList(mesh);
+    localPoints ptList(points_);
     labelList& usedPoints = ptList.list;
     label nPoints = 0;
 
     forAll(elemLists_, typeI)
     {
-        const labelList& idList = elemLists_[typeI];
+        const labelUList& idList = elemLists_[typeI];
 
         // add all points from faces
         forAll(idList, i)
         {
-            label id = idList[i] + offset_;
-            const face& f = mesh.faces()[id];
+            const label id = idList[i] + offset_;
+            const face& f = faces_[id];
 
             forAll(f, fp)
             {
@@ -219,8 +255,8 @@ void Foam::ensightPartFaces::writeConnectivity
     ensightGeoFile& os,
     const word& key,
     const faceList& faces,
-    const labelList& idList,
-    const labelList& pointMap
+    const labelUList& idList,
+    const labelUList& pointMap
 ) const
 {
     os.writeKeyword(key);
@@ -233,10 +269,10 @@ void Foam::ensightPartFaces::writeConnectivity
         // write the number of points per face
         forAll(idList, i)
         {
-            label id = idList[i] + offset_;
+            const label id = idList[i] + offset_;
             const face& f = faces[id];
 
-            os.write( f.size() );
+            os.write(f.size());
             os.newline();
         }
     }
@@ -244,14 +280,14 @@ void Foam::ensightPartFaces::writeConnectivity
     // write the points describing the face
     forAll(idList, i)
     {
-        label id = idList[i] + offset_;
+        const label id = idList[i] + offset_;
         const face& f = faces[id];
 
         // convert global -> local index
         // (note: Ensight indices start with 1)
         forAll(f, fp)
         {
-            os.write( pointMap[f[fp]] + 1 );
+            os.write(pointMap[f[fp]] + 1);
         }
         os.newline();
     }
@@ -262,15 +298,15 @@ void Foam::ensightPartFaces::writeConnectivity
 (
     ensightGeoFile& os,
     const word& key,
-    const labelList& idList,
-    const labelList& pointMap
+    const labelUList& idList,
+    const labelUList& pointMap
 ) const
 {
     writeConnectivity
     (
         os,
         key,
-        meshPtr_->faces(),
+        faces_,
         idList,
         pointMap
     );
@@ -279,9 +315,7 @@ void Foam::ensightPartFaces::writeConnectivity
 
 void Foam::ensightPartFaces::writeGeometry(ensightGeoFile& os) const
 {
-    const polyMesh& mesh = *meshPtr_;
-    const pointField& points = mesh.points();
-    ensightPart::writeGeometry(os, points);
+    ensightPart::writeGeometry(os, points_);
 }
 
 
diff --git a/src/conversion/ensight/part/ensightPartFaces.H b/src/conversion/ensight/part/ensightPartFaces.H
index 3871300b5c6a464085363954d08ea92a3d6ce261..1b64688d9c56d3417b0b0dbf8450717cd06a2462 100644
--- a/src/conversion/ensight/part/ensightPartFaces.H
+++ b/src/conversion/ensight/part/ensightPartFaces.H
@@ -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) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -61,41 +61,52 @@ class ensightPartFaces
         //- element connectivity
         virtual void writeConnectivity
         (
-            ensightGeoFile& os,
+            ensightGeoFile&,
             const word& key,
-            const labelList& idList,
-            const labelList& pointMap
+            const labelUList& idList,
+            const labelUList& pointMap
         ) const;
 
-        //- write geometry
-        virtual void writeGeometry(ensightGeoFile& os) const;
-
 
 protected:
 
-    //- addressable ensight element types
-    enum elemType
-    {
-        tria3Elements,
-        quad4Elements,
-        nsidedElements
-    };
+        //- addressable ensight element types
+        enum elemType
+        {
+            tria3Elements,
+            quad4Elements,
+            nsidedElements
+        };
+
 
     // Static data members
-    static List<word> elemTypes_;
 
-    //- Divide the shapes, set elemLists.
-    void binShapes(const faceList& faces);
+        static const List<word> elemTypes_;
+
+
+    // Protected data
 
-    //- Helper: write connectivity
-    void writeConnectivity
-    (
-        ensightGeoFile& os,
-        const word& key,
-        const faceList& faces,
-        const labelList& idList,
-        const labelList& pointMap
-    ) const;
+        //- faces referenced
+        const faceList& faces_;
+
+        //- Can skip local point renumbering when points are contiguous
+        const bool contiguousPoints_;
+
+
+    // Protected Member Functions
+
+        //- Classify the face shapes, set elemLists.
+        void classify(const faceList&);
+
+        //- Helper: write connectivity
+        void writeConnectivity
+        (
+            ensightGeoFile&,
+            const word& key,
+            const faceList&,
+            const labelUList& idList,
+            const labelUList& pointMap
+        ) const;
 
 
 public:
@@ -108,6 +119,17 @@ public:
         //- Construct empty part with number and description
         ensightPartFaces(label partNumber, const string& partDescription);
 
+        //- Construct part with number, description, points and faces
+        //  Can skip local point renumbering when points are contiguous
+        ensightPartFaces
+        (
+            label partNumber,
+            const string& partDescription,
+            const pointField&,
+            const faceList&,
+            const bool contiguousPoints = false
+        );
+
         //- Construct from polyMesh and polyPatch
         ensightPartFaces
         (
@@ -119,10 +141,13 @@ public:
         //- Construct as copy
         ensightPartFaces(const ensightPartFaces&);
 
-        //- Construct from Istream
+        //- Reconstruct part characteristics (eg, element types) from Istream
+        //  A part reconstructed in this manner can be used when writing fields,
+        //  but cannot be used to write a new geometry
+        //  @sa Foam::ensightPart::reconstruct
         ensightPartFaces(Istream&);
 
-        //- Construct on freestore from Istream
+        //- Reconstruct part characteristics on freestore from Istream
         static autoPtr<ensightPartFaces> New(Istream& is)
         {
             return autoPtr<ensightPartFaces>(new ensightPartFaces(is));
@@ -135,8 +160,11 @@ public:
 
     // Member Functions
 
+        //- write geometry
+        virtual void writeGeometry(ensightGeoFile&) const;
+
         //- static listing of the element types
-        virtual List<word> const& elementTypes() const
+        virtual const List<word>& elementTypes() const
         {
             return elemTypes_;
         }
diff --git a/src/conversion/ensight/part/ensightPartIO.C b/src/conversion/ensight/part/ensightPartIO.C
index ac903bdf99800546e936a513924aeef51481f615..bc893b84118a16645fd26a1d43cc3f8aa3b48021 100644
--- a/src/conversion/ensight/part/ensightPartIO.C
+++ b/src/conversion/ensight/part/ensightPartIO.C
@@ -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) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -59,24 +59,71 @@ void Foam::ensightPart::writeFieldList
     const labelUList& idList
 ) const
 {
-    forAll(idList, i)
+    if (&idList)
     {
-        if (idList[i] >= field.size() || isnan(field[idList[i]]))
+        forAll(idList, i)
         {
-            os.writeUndef();
+            if (idList[i] >= field.size() || isnan(field[idList[i]]))
+            {
+                os.writeUndef();
+            }
+            else
+            {
+                os.write(field[idList[i]]);
+            }
+
+            os.newline();
         }
-        else
+    }
+    else
+    {
+        // no idList => perNode
+        forAll(field, i)
         {
-            os.write(field[idList[i]]);
-        }
+            if (isnan(field[i]))
+            {
+                os.writeUndef();
+            }
+            else
+            {
+                os.write(field[i]);
+            }
 
-        os.newline();
+            os.newline();
+        }
     }
 }
 
 
+
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
+void Foam::ensightPart::reconstruct(Istream& is)
+{
+    dictionary dict(is);
+    dict.lookup("id") >> number_;
+    dict.lookup("name") >> name_;
+
+    offset_ = 0;
+    dict.readIfPresent("offset", offset_);
+
+    // populate elemLists_
+    elemLists_.setSize(elementTypes().size());
+
+    forAll(elementTypes(), elemI)
+    {
+        word key(elementTypes()[elemI]);
+
+        elemLists_[elemI].clear();
+        dict.readIfPresent(key, elemLists_[elemI]);
+
+        size_ += elemLists_[elemI].size();
+    }
+
+    is.check("ensightPart::reconstruct(Istream&)");
+}
+
+
 bool Foam::ensightPart::writeSummary(Ostream& os) const
 {
     os  << indent << type() << nl
@@ -88,7 +135,7 @@ bool Foam::ensightPart::writeSummary(Ostream& os) const
     os.writeKeyword("offset") << offset() << token::END_STATEMENT << nl;
     os.writeKeyword("size") << size() << token::END_STATEMENT << nl;
 
-    os   << decrIndent << indent << token::END_BLOCK << nl << endl;
+    os  << decrIndent << indent << token::END_BLOCK << nl << endl;
 
     return true;
 }
@@ -112,7 +159,7 @@ bool Foam::ensightPart::writeData(Ostream& os) const
         }
     }
 
-    os   << decrIndent << indent << token::END_BLOCK << nl << endl;
+    os  << decrIndent << indent << token::END_BLOCK << nl << endl;
 
     return true;
 }
@@ -127,7 +174,7 @@ void Foam::ensightPart::writeGeometry
     if (size())
     {
         const localPoints ptList = calcLocalPoints();
-        const labelList& pointMap = ptList.list;
+        const labelUList& pointMap = ptList.list;
 
         writeHeader(os, true);
 
@@ -136,13 +183,13 @@ void Foam::ensightPart::writeGeometry
         os.write(ptList.nPoints);
         os.newline();
 
-        for (direction cmpt=0; cmpt < vector::nComponents; cmpt++)
+        for (direction cmpt=0; cmpt < point::nComponents; ++cmpt)
         {
             forAll(pointMap, ptI)
             {
                 if (pointMap[ptI] > -1)
                 {
-                    os.write( points[ptI].component(cmpt) );
+                    os.write(points[ptI].component(cmpt));
                     os.newline();
                 }
             }
@@ -169,21 +216,30 @@ void Foam::ensightPart::writeGeometry
 void Foam::ensightPart::writeScalarField
 (
     ensightFile& os,
-    const List<scalar>& field
+    const List<scalar>& field,
+    const bool perNode
 ) const
 {
     if (size() && field.size() && (os.allowUndef() || isFieldDefined(field)))
     {
         writeHeader(os);
 
-        forAll(elementTypes(), elemI)
+        if (perNode)
         {
-            const labelList& idList = elemLists_[elemI];
-
-            if (idList.size())
+            os.writeKeyword("coordinates");
+            writeFieldList(os, field, labelUList::null());
+        }
+        else
+        {
+            forAll(elementTypes(), elemI)
             {
-                os.writeKeyword( elementTypes()[elemI] );
-                writeFieldList(os, field, idList);
+                const labelUList& idList = elemLists_[elemI];
+
+                if (idList.size())
+                {
+                    os.writeKeyword(elementTypes()[elemI]);
+                    writeFieldList(os, field, idList);
+                }
             }
         }
     }
@@ -195,23 +251,34 @@ void Foam::ensightPart::writeVectorField
     ensightFile& os,
     const List<scalar>& field0,
     const List<scalar>& field1,
-    const List<scalar>& field2
+    const List<scalar>& field2,
+    const bool perNode
 ) const
 {
     if (size() && field0.size() && (os.allowUndef() || isFieldDefined(field0)))
     {
         writeHeader(os);
 
-        forAll(elementTypes(), elemI)
+        if (perNode)
         {
-            const labelList& idList = elemLists_[elemI];
-
-            if (idList.size())
+            os.writeKeyword("coordinates");
+            writeFieldList(os, field0, labelUList::null());
+            writeFieldList(os, field1, labelUList::null());
+            writeFieldList(os, field2, labelUList::null());
+        }
+        else
+        {
+            forAll(elementTypes(), elemI)
             {
-                os.writeKeyword( elementTypes()[elemI] );
-                writeFieldList(os, field0, idList);
-                writeFieldList(os, field1, idList);
-                writeFieldList(os, field2, idList);
+                const labelUList& idList = elemLists_[elemI];
+
+                if (idList.size())
+                {
+                    os.writeKeyword(elementTypes()[elemI]);
+                    writeFieldList(os, field0, idList);
+                    writeFieldList(os, field1, idList);
+                    writeFieldList(os, field2, idList);
+                }
             }
         }
     }
diff --git a/src/conversion/ensight/part/ensightPartNonMeshFaces.C b/src/conversion/ensight/part/ensightPartNonMeshFaces.C
deleted file mode 100644
index e991844bf008f5e4248e4cf4c5d54b4ac114dfe9..0000000000000000000000000000000000000000
--- a/src/conversion/ensight/part/ensightPartNonMeshFaces.C
+++ /dev/null
@@ -1,122 +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 "ensightPartNonMeshFaces.H"
-#include "addToRunTimeSelectionTable.H"
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-namespace Foam
-{
-   defineTypeNameAndDebug(ensightPartNonMeshFaces, 0);
-   addToRunTimeSelectionTable(ensightPart, ensightPartNonMeshFaces, istream);
-}
-
-
-// * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * //
-
-Foam::ensightPart::localPoints
-Foam::ensightPartNonMeshFaces::calcLocalPoints() const
-{
-    localPoints ptList;
-    ptList.list = identity(points_.size());
-    ptList.nPoints = points_.size();
-    return ptList;
-}
-
-
-// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
-
-Foam::ensightPartNonMeshFaces::ensightPartNonMeshFaces
-(
-    label partNumber,
-    const string& partDescription,
-    const faceList& faces,
-    const pointField& points
-)
-:
-    ensightPartFaces(partNumber, partDescription),
-    faces_(faces),
-    points_(points)
-{
-    binShapes(faces);
-}
-
-
-//- Construct as copy
-Foam::ensightPartNonMeshFaces::ensightPartNonMeshFaces
-(
-    const ensightPartNonMeshFaces& part
-)
-:
-    ensightPartFaces(part),
-    faces_(part.faces_),
-    points_(part.points_)
-{}
-
-
-//- Construct from Istream
-Foam::ensightPartNonMeshFaces::ensightPartNonMeshFaces(Istream& is)
-:
-    ensightPartFaces(is),
-    faces_(is),
-    points_(is)
-{}
-
-
-// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
-
-Foam::ensightPartNonMeshFaces::~ensightPartNonMeshFaces()
-{}
-
-
-// * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
-
-void Foam::ensightPartNonMeshFaces::writeConnectivity
-(
-    ensightGeoFile& os,
-    const word& key,
-    const labelList& idList,
-    const labelList& pointMap
-) const
-{
-    ensightPartFaces::writeConnectivity
-    (
-        os,
-        key,
-        faces_,
-        idList,
-        pointMap
-    );
-}
-
-
-void Foam::ensightPartNonMeshFaces::writeGeometry(ensightGeoFile& os) const
-{
-    ensightPart::writeGeometry(os, points_);
-}
-
-
-// ************************************************************************* //
diff --git a/src/conversion/ensight/part/ensightPartNonMeshFaces.H b/src/conversion/ensight/part/ensightPartNonMeshFaces.H
deleted file mode 100644
index ab7f4a782a696085332a46ae426abe41c321b924..0000000000000000000000000000000000000000
--- a/src/conversion/ensight/part/ensightPartNonMeshFaces.H
+++ /dev/null
@@ -1,131 +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/>.
-
-Class
-    Foam::ensightPartNonMeshFaces
-
-Description
-    An implementation of ensightPart to work on self-contained faces and points
-    (without a mesh).
-
-SourceFiles
-    ensightPartNonMeshFaces.C
-
-\*---------------------------------------------------------------------------*/
-
-#ifndef ensightPartNonMeshFaces_H
-#define ensightPartNonMeshFaces_H
-
-#include "ensightPartFaces.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-/*---------------------------------------------------------------------------*\
-                     Class ensightPartNonMeshFaces Declaration
-\*---------------------------------------------------------------------------*/
-
-class ensightPartNonMeshFaces
-:
-    public ensightPartFaces
-{
-    // Private data
-
-        //- faces (reference)
-        const faceList& faces_;
-
-        //- points (reference)
-        const pointField& points_;
-
-
-    // Private Member Functions
-
-        //- Disallow default bitwise assignment
-        void operator=(const ensightPartNonMeshFaces&);
-
-        //- track points used
-        virtual localPoints calcLocalPoints() const;
-
-public:
-
-    //- Runtime type information
-    TypeName("ensightNonMeshFaces");
-
-    // Constructors
-
-        //- Construct from faces and points
-        ensightPartNonMeshFaces
-        (
-            label partNumber,
-            const string& partDescription,
-            const faceList& faces,
-            const pointField& points
-        );
-
-        //- Construct as copy
-        ensightPartNonMeshFaces(const ensightPartNonMeshFaces& part);
-
-        //- Construct from Istream
-        ensightPartNonMeshFaces(Istream& is);
-
-        //- Construct on freestore from Istream
-        static autoPtr<ensightPartNonMeshFaces> New(Istream& is)
-        {
-            return autoPtr<ensightPartNonMeshFaces>
-            (
-                new ensightPartNonMeshFaces(is)
-            );
-        }
-
-
-    //- Destructor
-    virtual ~ensightPartNonMeshFaces();
-
-
-    // Member Functions
-
-        //- element connectivity
-        virtual void writeConnectivity
-        (
-            ensightGeoFile& os,
-            const word& key,
-            const labelList& idList,
-            const labelList& pointMap
-        ) const;
-
-        virtual void writeGeometry(ensightGeoFile& os) const;
-
-};
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#endif
-
-// ************************************************************************* //
diff --git a/src/conversion/ensight/part/ensightPartI.H b/src/conversion/ensight/part/ensightPartTemplates.C
similarity index 59%
rename from src/conversion/ensight/part/ensightPartI.H
rename to src/conversion/ensight/part/ensightPartTemplates.C
index 9286273276c9b80ef23e2e3a92a8b9f251e1bfff..2f3f4a599455127a2b98fd8ba86f8da38b3d5077 100644
--- a/src/conversion/ensight/part/ensightPartI.H
+++ b/src/conversion/ensight/part/ensightPartTemplates.C
@@ -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) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -30,33 +30,50 @@ Description
 
 // * * * * * * * * * * * * * * * Global Functions  * * * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 void Foam::ensightPart::writeField
 (
     ensightFile& os,
-    const Field<Type>& field
+    const Field<Type>& field,
+    const bool perNode
 ) const
 {
-    if (size() && field.size())
+    if (this->size() && field.size())
     {
         writeHeader(os);
 
-        forAll(elementTypes(), elemI)
+        if (perNode)
         {
-            const labelList& idList = elemLists_[elemI];
-
-            if (idList.size())
+            os.writeKeyword("coordinates");
+            for
+            (
+                direction cmpt=0;
+                cmpt < pTraits<Type>::nComponents;
+                ++cmpt
+            )
+            {
+                writeFieldList(os, field.component(cmpt), labelUList::null());
+            }
+        }
+        else
+        {
+            forAll(elementTypes(), elemI)
             {
-                os.writeKeyword( elementTypes()[elemI] );
+                const labelUList& idList = elemLists_[elemI];
 
-                for
-                (
-                    direction cmpt=0;
-                    cmpt < pTraits<Type>::nComponents;
-                    cmpt++
-                )
+                if (idList.size())
                 {
-                    writeFieldList(os, field.component(cmpt), idList);
+                    os.writeKeyword(elementTypes()[elemI]);
+
+                    for
+                    (
+                        direction cmpt=0;
+                        cmpt < pTraits<Type>::nComponents;
+                        ++cmpt
+                    )
+                    {
+                        writeFieldList(os, field.component(cmpt), idList);
+                    }
                 }
             }
         }
diff --git a/src/conversion/ensight/part/ensightParts.C b/src/conversion/ensight/part/ensightParts.C
index 76179b4a11687de3f8e4e756ee221b0991c13a13..240b9fb859f12829b65ef2d7ce449f1d0ad0bfa4 100644
--- a/src/conversion/ensight/part/ensightParts.C
+++ b/src/conversion/ensight/part/ensightParts.C
@@ -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) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -27,11 +27,11 @@ License
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-Foam::ensightParts::ensightParts(const polyMesh& pMesh)
+Foam::ensightParts::ensightParts(const polyMesh& mesh)
 :
     partsList_()
 {
-    recalculate(pMesh);
+    recalculate(mesh);
 }
 
 
@@ -52,15 +52,15 @@ Foam::ensightParts::~ensightParts()
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-void Foam::ensightParts::recalculate(const polyMesh& pMesh)
+void Foam::ensightParts::recalculate(const polyMesh& mesh)
 {
     partsList_.clear();
 
     // extra space for unzoned cells
     label nPart =
     (
-        pMesh.cellZones().size()
-      + pMesh.boundaryMesh().size()
+        mesh.cellZones().size()
+      + mesh.boundaryMesh().size()
       + 1
     );
 
@@ -70,9 +70,9 @@ void Foam::ensightParts::recalculate(const polyMesh& pMesh)
     label nZoneCells = 0;
 
     // do cell zones
-    forAll(pMesh.cellZones(), zoneI)
+    forAll(mesh.cellZones(), zoneI)
     {
-        const cellZone& cZone = pMesh.cellZones()[zoneI];
+        const cellZone& cZone = mesh.cellZones()[zoneI];
         nZoneCells += cZone.size();
 
         if (cZone.size())
@@ -80,12 +80,7 @@ void Foam::ensightParts::recalculate(const polyMesh& pMesh)
             partsList_.set
             (
                 nPart,
-                new ensightPartCells
-                (
-                    nPart,
-                    pMesh,
-                    cZone
-                )
+                new ensightPartCells(nPart, mesh, cZone)
             );
 
             nPart++;
@@ -100,23 +95,19 @@ void Foam::ensightParts::recalculate(const polyMesh& pMesh)
         partsList_.set
         (
             nPart,
-            new ensightPartCells
-            (
-                nPart,
-                pMesh
-            )
+            new ensightPartCells(nPart, mesh)
         );
 
         nPart++;
     }
-    else if (pMesh.nCells() > nZoneCells)
+    else if (mesh.nCells() > nZoneCells)
     {
         // determine which cells are not in a cellZone
-        labelList unzoned(pMesh.nCells(), -1);
+        labelList unzoned(mesh.nCells(), -1);
 
-        forAll(pMesh.cellZones(), zoneI)
+        forAll(mesh.cellZones(), zoneI)
         {
-            const labelList& idList = pMesh.cellZones()[zoneI];
+            const labelUList& idList = mesh.cellZones()[zoneI];
 
             forAll(idList, i)
             {
@@ -140,12 +131,7 @@ void Foam::ensightParts::recalculate(const polyMesh& pMesh)
             partsList_.set
             (
                 nPart,
-                new ensightPartCells
-                (
-                    nPart,
-                    pMesh,
-                    unzoned
-                )
+                new ensightPartCells(nPart, mesh, unzoned)
             );
 
             nPart++;
@@ -154,20 +140,15 @@ void Foam::ensightParts::recalculate(const polyMesh& pMesh)
 
 
     // do boundaries, skipping empty and processor patches
-    forAll(pMesh.boundaryMesh(), patchI)
+    forAll(mesh.boundaryMesh(), patchI)
     {
-        const polyPatch& pPatch = pMesh.boundaryMesh()[patchI];
-        if (pPatch.size() && !isA<processorPolyPatch>(pPatch))
+        const polyPatch& patch = mesh.boundaryMesh()[patchI];
+        if (patch.size() && !isA<processorPolyPatch>(patch))
         {
             partsList_.set
             (
                 nPart,
-                new ensightPartFaces
-                (
-                    nPart,
-                    pMesh,
-                    pPatch
-                )
+                new ensightPartFaces(nPart, mesh, patch)
             );
 
             nPart++;
@@ -181,8 +162,8 @@ void Foam::ensightParts::recalculate(const polyMesh& pMesh)
 
 void Foam::ensightParts::renumber
 (
-    const labelList& origCellId,
-    const labelList& origFaceId
+    const labelUList& origCellId,
+    const labelUList& origFaceId
 )
 {
     forAll(partsList_, partI)
@@ -199,7 +180,7 @@ void Foam::ensightParts::renumber
 }
 
 
-void Foam::ensightParts::writeGeometry( ensightGeoFile& os) const
+void Foam::ensightParts::writeGeometry(ensightGeoFile& os) const
 {
     // with some feedback
     Info<< "write geometry part:" << nl << flush;
@@ -225,23 +206,21 @@ bool Foam::ensightParts::writeSummary(Ostream& os) const
 
 void Foam::ensightParts::writeData(Ostream& os) const
 {
-    // Write size of list
-    os << nl << partsList_.size();
-
-    // Write beginning of contents
-    os << nl << token::BEGIN_LIST;
+    // Begin write list
+    os  << nl << partsList_.size()
+        << nl << token::BEGIN_LIST;
 
     // Write list contents
     forAll(partsList_, i)
     {
-        os << nl << partsList_[i];
+        os  << nl << partsList_[i];
     }
 
-    // Write end of contents
-    os << nl << token::END_LIST << nl;
+    // End write list
+    os  << nl << token::END_LIST << nl;
 
     // Check state of IOstream
-    os.check("Ostream& operator<<(Ostream&, const PtrList&)");
+    os.check("ensightParts::writeData(Ostream&)");
 }
 
 
@@ -249,7 +228,8 @@ void Foam::ensightParts::writeScalarField
 (
     ensightFile& os,
     const List<scalar>& field,
-    bool useFaceData
+    const bool useFaceData,
+    const bool perNode
 ) const
 {
     forAll(partsList_, partI)
@@ -261,7 +241,7 @@ void Foam::ensightParts::writeScalarField
           : partsList_[partI].isCellData()
         )
         {
-            partsList_[partI].writeScalarField(os,field);
+            partsList_[partI].writeScalarField(os, field, perNode);
         }
     }
 }
@@ -273,7 +253,8 @@ void Foam::ensightParts::writeVectorField
     const List<scalar>& field0,
     const List<scalar>& field1,
     const List<scalar>& field2,
-    bool useFaceData
+    const bool useFaceData,
+    const bool perNode
 ) const
 {
     forAll(partsList_, partI)
@@ -285,7 +266,12 @@ void Foam::ensightParts::writeVectorField
           : partsList_[partI].isCellData()
         )
         {
-            partsList_[partI].writeVectorField(os, field0, field1, field2);
+            partsList_[partI].writeVectorField
+            (
+                os,
+                field0, field1, field2,
+                perNode
+            );
         }
     }
 }
diff --git a/src/conversion/ensight/part/ensightParts.H b/src/conversion/ensight/part/ensightParts.H
index 3d620192b5c67d3b0ae6a63df461cca22fece9f7..6b4f49eef9a1b79e3d19d86ae3db2dcccb9fc6e7 100644
--- a/src/conversion/ensight/part/ensightParts.H
+++ b/src/conversion/ensight/part/ensightParts.H
@@ -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) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -29,7 +29,7 @@ Description
 
 SourceFiles
     ensightParts.C
-    ensightPartsI.H
+    ensightPartsTemplates.C
 
 \*---------------------------------------------------------------------------*/
 
@@ -89,8 +89,8 @@ public:
         //- renumber elements
         void renumber
         (
-            const labelList& origCellId,
-            const labelList& origFaceId
+            const labelUList& origCellId,
+            const labelUList& origFaceId
         );
 
         //- number of parts
@@ -108,27 +108,33 @@ public:
         //- write the lists
         void writeData(Ostream&) const;
 
-        //- write scalar field
+        //- write (volume) scalar field
+        //  optionally write data for face parts
+        //  optionally write data per node
         void writeScalarField
         (
             ensightFile&,
             const List<scalar>& field,
-            bool useFaceData = false
+            const bool useFaceData = false,
+            const bool perNode = false
         ) const;
 
-        //- write vector field components
+        //- write (volume) vector field components
+        //  optionally write data for face parts
+        //  optionally write data per node
         void writeVectorField
         (
             ensightFile&,
             const List<scalar>& field0,
             const List<scalar>& field1,
             const List<scalar>& field2,
-            bool useFaceData = false
+            const bool useFaceData = false,
+            const bool perNode = false
         ) const;
 
 
-        //- write generalized field components
-        template <class Type>
+        //- write generalized volume field components
+        template<class Type>
         void writeField
         (
             ensightFile&,
@@ -138,11 +144,8 @@ public:
 
     // Friend Operators
 
-        friend ensightGeoFile& operator<<
-        (
-            ensightGeoFile&,
-            const ensightParts&
-        );
+        //- write geometry
+        friend ensightGeoFile& operator<<(ensightGeoFile&, const ensightParts&);
 };
 
 
@@ -153,7 +156,7 @@ public:
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 #ifdef NoRepository
-#   include "ensightPartsI.H"
+#   include "ensightPartsTemplates.C"
 #endif
 
 #endif
diff --git a/src/conversion/ensight/part/ensightPartsI.H b/src/conversion/ensight/part/ensightPartsTemplates.C
similarity index 96%
rename from src/conversion/ensight/part/ensightPartsI.H
rename to src/conversion/ensight/part/ensightPartsTemplates.C
index c4848faf2a2af3e30dd70b1a767d586130cd8506..5eb8a7aec8ca8c84c84d09915eb2b473ab8e3cf1 100644
--- a/src/conversion/ensight/part/ensightPartsI.H
+++ b/src/conversion/ensight/part/ensightPartsTemplates.C
@@ -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) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -30,7 +30,7 @@ Description
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-template <class Type>
+template<class Type>
 void Foam::ensightParts::writeField
 (
     ensightFile& os,
diff --git a/src/dummyThirdParty/Allwmake b/src/dummyThirdParty/Allwmake
index afd49cd5d9db41c233d85b5e2f4b903ba4c56bde..5076d8d2b72e19cf8ef9d71a6962fc0a75db8cd0 100755
--- a/src/dummyThirdParty/Allwmake
+++ b/src/dummyThirdParty/Allwmake
@@ -1,10 +1,8 @@
 #!/bin/sh
 cd ${0%/*} || exit 1    # run from this directory
+[ $# -ge 1 ] && makeOption=$1 || makeOption=libso
 set -x
 
-makeOption=libso
-[ $# -ge 1 ] && makeOption=$1
-
 wmake $makeOption scotchDecomp
 wmake $makeOption ptscotchDecomp
 wmake $makeOption metisDecomp
diff --git a/src/fvAgglomerationMethods/Allwmake b/src/fvAgglomerationMethods/Allwmake
index 27f2fea53aef043f14cf3a6dd7b7363cbfd9499f..fcccbcbe9aac79c069fec77b1c5d3339d2a4a72e 100755
--- a/src/fvAgglomerationMethods/Allwmake
+++ b/src/fvAgglomerationMethods/Allwmake
@@ -1,10 +1,8 @@
 #!/bin/sh
 cd ${0%/*} || exit 1    # run from this directory
+[ $# -ge 1 ] && makeOption=$1 || makeOption=libso
 set -x
 
-makeOption=libso
-[ $# -ge 1 ] && makeOption=$1
-
 wmake $makeOption MGridGenGamgAgglomeration
 
 # ----------------------------------------------------------------- end-of-file
diff --git a/src/lagrangian/Allwmake b/src/lagrangian/Allwmake
index 26fd814f633d4e1da9b484a5f0d38535cb57f805..e04d7480fbfa02bfd0c352b63c2a138a6ea337ee 100755
--- a/src/lagrangian/Allwmake
+++ b/src/lagrangian/Allwmake
@@ -1,10 +1,8 @@
 #!/bin/sh
 cd ${0%/*} || exit 1    # run from this directory
+[ $# -ge 1 ] && makeOption=$1 || makeOption=libso
 set -x
 
-makeOption=libso
-[ $# -ge 1 ] && makeOption=$1
-
 wmake $makeOption basic
 wmake $makeOption solidParticle
 wmake $makeOption intermediate
diff --git a/src/lagrangian/intermediate/Make/files b/src/lagrangian/intermediate/Make/files
index 068400f0d7e530d60abad932fb1c2dfa6f18f83a..63fa90db0d1b6862dbfa403e0f81128cf8690e6d 100644
--- a/src/lagrangian/intermediate/Make/files
+++ b/src/lagrangian/intermediate/Make/files
@@ -74,12 +74,6 @@ $(REACTINGMPINJECTION)/ReactingMultiphaseLookupTableInjection/reactingMultiphase
 $(REACTINGMPINJECTION)/ReactingMultiphaseLookupTableInjection/reactingMultiphaseParcelInjectionDataIOList.C
 
 
-/* data entries */
-submodels/IO/DataEntry/makeDataEntries.C
-submodels/IO/DataEntry/polynomial/polynomial.C
-submodels/IO/DataEntry/polynomial/polynomialIO.C
-
-
 /* integration schemes */
 IntegrationScheme/makeIntegrationSchemes.C
 
diff --git a/src/lagrangian/molecularDynamics/Allwmake b/src/lagrangian/molecularDynamics/Allwmake
index 131ec5d458ef870b55484ecd58147220f597189a..60b24dea4dd310a0ef7cadcd5e23655dc5897234 100755
--- a/src/lagrangian/molecularDynamics/Allwmake
+++ b/src/lagrangian/molecularDynamics/Allwmake
@@ -1,10 +1,8 @@
 #!/bin/sh
 cd ${0%/*} || exit 1    # run from this directory
+[ $# -ge 1 ] && makeOption=$1 || makeOption=libso
 set -x
 
-makeOption=libso
-[ $# -ge 1 ] && makeOption=$1
-
 wmake $makeOption potential
 wmake $makeOption molecularMeasurements
 wmake $makeOption molecule
diff --git a/src/mesh/Allwmake b/src/mesh/Allwmake
index 57df2d57bf013b28e2c1040ff1d1d0cc87f0e34c..f980e0e73fa960191080511b80ab2d7571c5bafc 100755
--- a/src/mesh/Allwmake
+++ b/src/mesh/Allwmake
@@ -1,10 +1,8 @@
 #!/bin/sh
 cd ${0%/*} || exit 1    # run from this directory
+[ $# -ge 1 ] && makeOption=$1 || makeOption=libso
 set -x
 
-makeOption=libso
-[ $# -ge 1 ] && makeOption=$1
-
 wmake $makeOption autoMesh
 wmake $makeOption blockMesh
 
diff --git a/src/parallel/Allwmake b/src/parallel/Allwmake
index 92d80e20a8ca4e0941b55cff79f514da8ae3dbd7..d3600e13b1992a63eef07282165b8f7cbe778170 100755
--- a/src/parallel/Allwmake
+++ b/src/parallel/Allwmake
@@ -1,10 +1,8 @@
 #!/bin/sh
 cd ${0%/*} || exit 1    # run from this directory
+[ $# -ge 1 ] && makeOption=$1 || makeOption=libso
 set -x
 
-makeOption=libso
-[ $# -ge 1 ] && makeOption=$1
-
 decompose/Allwmake $*
 reconstruct/Allwmake $*
 wmake $makeOption distributed
diff --git a/src/parallel/decompose/Allwmake b/src/parallel/decompose/Allwmake
index 93835f6a244878bbb3c31a65264c9f25bf0399f6..3848e66478cae3ba36776daf1a247ce390b1c3cc 100755
--- a/src/parallel/decompose/Allwmake
+++ b/src/parallel/decompose/Allwmake
@@ -1,8 +1,6 @@
 #!/bin/sh
 cd ${0%/*} || exit 1    # run from this directory
-
-makeOption=libso
-[ $# -ge 1 ] && makeOption=$1
+[ $# -ge 1 ] && makeOption=$1 || makeOption=libso
 
 # get SCOTCH_VERSION, SCOTCH_ARCH_PATH
 settings=`$WM_PROJECT_DIR/bin/foamEtcFile apps/scotch/bashrc`
diff --git a/src/parallel/reconstruct/Allwmake b/src/parallel/reconstruct/Allwmake
index 453d88f50b355df4aca3c151fa808defccc1ee8f..3d651d5a0033915818890a2779600473d095c330 100755
--- a/src/parallel/reconstruct/Allwmake
+++ b/src/parallel/reconstruct/Allwmake
@@ -1,11 +1,8 @@
 #!/bin/sh
 cd ${0%/*} || exit 1    # run from this directory
+[ $# -ge 1 ] && makeOption=$1 || makeOption=libso
 set -x
 
-makeOption=libso
-[ $# -ge 1 ] && makeOption=$1
-
 wmake $makeOption reconstruct
 
-
 # ----------------------------------------------------------------- end-of-file
diff --git a/src/postProcessing/Allwmake b/src/postProcessing/Allwmake
index d543c26fe1c6883fc011fd4bc540ca3053b19032..5a1caf16606eebdd3108560d15698654b66616ff 100755
--- a/src/postProcessing/Allwmake
+++ b/src/postProcessing/Allwmake
@@ -1,10 +1,8 @@
 #!/bin/sh
 cd ${0%/*} || exit 1    # run from this directory
+[ $# -ge 1 ] && makeOption=$1 || makeOption=libso
 set -x
 
-makeOption=libso
-[ $# -ge 1 ] && makeOption=$1
-
 wmake libo postCalc
 wmake $makeOption foamCalcFunctions
 
diff --git a/src/postProcessing/functionObjects/Allwmake b/src/postProcessing/functionObjects/Allwmake
index 14bdd330e1e8060621cb43182acfd67fefb79f47..9ae9bd3dca12085fc47258507e4c6189b43eb81e 100755
--- a/src/postProcessing/functionObjects/Allwmake
+++ b/src/postProcessing/functionObjects/Allwmake
@@ -1,10 +1,8 @@
 #!/bin/sh
 cd ${0%/*} || exit 1    # run from this directory
+[ $# -ge 1 ] && makeOption=$1 || makeOption=libso
 set -x
 
-makeOption=libso
-[ $# -ge 1 ] && makeOption=$1
-
 wmake $makeOption field
 wmake $makeOption forces
 wmake $makeOption IO
diff --git a/src/sampling/Make/files b/src/sampling/Make/files
index 3c61e371b6d9878decae938cdceb5eae091875a0..c9b26376d09db5931b086a32e7f8e0c41e76f3f5 100644
--- a/src/sampling/Make/files
+++ b/src/sampling/Make/files
@@ -46,14 +46,14 @@ sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.C
 
 surfWriters = sampledSurface/writers
 
-$(surfWriters)/surfaceWriters.C
-$(surfWriters)/dx/dxSurfaceWriterRunTime.C
-$(surfWriters)/ensight/ensightSurfaceWriterRunTime.C
-$(surfWriters)/foamFile/foamFileSurfaceWriterRunTime.C
-$(surfWriters)/null/nullSurfaceWriterRunTime.C
-$(surfWriters)/proxy/proxySurfaceWriterRunTime.C
-$(surfWriters)/raw/rawSurfaceWriterRunTime.C
-$(surfWriters)/vtk/vtkSurfaceWriterRunTime.C
+$(surfWriters)/surfaceWriter.C
+$(surfWriters)/dx/dxSurfaceWriter.C
+$(surfWriters)/ensight/ensightSurfaceWriter.C
+$(surfWriters)/foamFile/foamFileSurfaceWriter.C
+$(surfWriters)/proxy/proxySurfaceWriter.C
+$(surfWriters)/raw/rawSurfaceWriter.C
+$(surfWriters)/starcd/starcdSurfaceWriter.C
+$(surfWriters)/vtk/vtkSurfaceWriter.C
 
 graphField/writePatchGraph.C
 graphField/writeCellGraph.C
diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C
index 82038ddcd7e52fe32352cdfa99dcd1a731e40b0a..581b7e206bb33cd8fa44716e1fa7f0d67401ffc9 100644
--- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C
+++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C
@@ -83,7 +83,7 @@ void Foam::sampledSurfaces::writeGeometry() const
         {
             if (Pstream::master() && mergeList_[surfI].faces.size())
             {
-                genericFormatter_->write
+                formatter_->write
                 (
                     outputDir,
                     s.name(),
@@ -94,7 +94,7 @@ void Foam::sampledSurfaces::writeGeometry() const
         }
         else if (s.faces().size())
         {
-            genericFormatter_->write
+            formatter_->write
             (
                 outputDir,
                 s.name(),
@@ -123,9 +123,8 @@ Foam::sampledSurfaces::sampledSurfaces
     outputPath_(fileName::null),
     fieldSelection_(),
     interpolationScheme_(word::null),
-    writeFormat_(word::null),
     mergeList_(),
-    genericFormatter_(NULL),
+    formatter_(NULL),
     scalarFields_(),
     vectorFields_(),
     sphericalTensorFields_(),
@@ -201,7 +200,7 @@ void Foam::sampledSurfaces::write()
 
         // write geometry first if required,
         // or when no fields would otherwise be written
-        if (nFields == 0 || genericFormatter_->separateFiles())
+        if (nFields == 0 || formatter_->separateGeometry())
         {
             writeGeometry();
         }
@@ -221,11 +220,15 @@ void Foam::sampledSurfaces::read(const dictionary& dict)
     clearFieldGroups();
 
     dict.lookup("interpolationScheme") >> interpolationScheme_;
-    dict.lookup("surfaceFormat") >> writeFormat_;
-
-    // define the generic (geometry) writer
-    genericFormatter_ = surfaceWriter<bool>::New(writeFormat_);
+    const word writeType(dict.lookup("surfaceFormat"));
 
+    // define the surface formatter
+    // optionally defined extra controls for the output formats
+    formatter_ = surfaceWriter::New
+    (
+        writeType,
+        dict.subOrEmptyDict("formatOptions").subOrEmptyDict(writeType)
+    );
 
     PtrList<sampledSurface> newList
     (
diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H
index 0c2084507a8dcdecaad9674c621cee1e1add3b69..4293cf9e628c4062c496f77372c4ce3ed9b35b8a 100644
--- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H
+++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H
@@ -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
@@ -68,36 +68,11 @@ class sampledSurfaces
         {
         public:
 
-            //- The surface formatter
-            autoPtr< surfaceWriter<Type> > formatter;
-
             //- Construct null
             fieldGroup()
             :
-                DynamicList<word>(0),
-                formatter(NULL)
+                DynamicList<word>(0)
             {}
-
-            //- Construct for a particular surface format
-            fieldGroup(const word& writeFormat)
-            :
-                DynamicList<word>(0),
-                formatter(surfaceWriter<Type>::New(writeFormat))
-            {}
-
-            //- Reset format and field list
-            void clear()
-            {
-                DynamicList<word>::clear();
-                formatter.clear();
-            }
-
-            //- Assign a new formatter
-            void operator=(const word& writeFormat)
-            {
-                formatter = surfaceWriter<Type>::New(writeFormat);
-            }
-
         };
 
 
@@ -151,10 +126,6 @@ class sampledSurfaces
             //- Interpolation scheme to use
             word interpolationScheme_;
 
-            //- Output format to use
-            word writeFormat_;
-
-
         // surfaces
 
             //- Information for merging surfaces
@@ -163,8 +134,8 @@ class sampledSurfaces
 
         // Calculated
 
-            //- Generic surface formatter
-            autoPtr< surfaceWriter<bool> > genericFormatter_;
+            //- Surface formatter
+            autoPtr<surfaceWriter> formatter_;
 
             //- Categorized scalar/vector/tensor fields
             fieldGroup<scalar> scalarFields_;
@@ -190,14 +161,10 @@ class sampledSurfaces
 
         //- Sample and write a particular volume field
         template<class Type>
-        void sampleAndWrite
-        (
-            const GeometricField<Type, fvPatchField, volMesh>&,
-            const surfaceWriter<Type>& formatter
-        );
+        void sampleAndWrite(const GeometricField<Type, fvPatchField, volMesh>&);
 
         //- Sample and write all the fields of the given type
-        template <class Type>
+        template<class Type>
         void sampleAndWrite(fieldGroup<Type>&);
 
         //- Disallow default bitwise copy construct and assignment
diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C
index 578212ba3fe53819cc38b9a02cd556faea3d5696..13518214190bb7237dd047842d6c8cd974c3a695 100644
--- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C
+++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C
@@ -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,7 @@ License
 template<class Type>
 void Foam::sampledSurfaces::sampleAndWrite
 (
-    const GeometricField<Type, fvPatchField, volMesh>& vField,
-    const surfaceWriter<Type>& formatter
+    const GeometricField<Type, fvPatchField, volMesh>& vField
 )
 {
     // interpolator for this field
@@ -96,7 +95,7 @@ void Foam::sampledSurfaces::sampleAndWrite
                 // skip surface without faces (eg, a failed cut-plane)
                 if (mergeList_[surfI].faces.size())
                 {
-                    formatter.write
+                    formatter_->write
                     (
                         outputDir,
                         s.name(),
@@ -115,7 +114,7 @@ void Foam::sampledSurfaces::sampleAndWrite
             // skip surface without faces (eg, a failed cut-plane)
             if (s.faces().size())
             {
-                formatter.write
+                formatter_->write
                 (
                     outputDir,
                     s.name(),
@@ -139,12 +138,6 @@ void Foam::sampledSurfaces::sampleAndWrite
 {
     if (fields.size())
     {
-        // create or use existing surfaceWriter
-        if (fields.formatter.empty())
-        {
-            fields.formatter = surfaceWriter<Type>::New(writeFormat_);
-        }
-
         forAll(fields, fieldI)
         {
             if (Pstream::master() && verbose_)
@@ -168,8 +161,7 @@ void Foam::sampledSurfaces::sampleAndWrite
                             false
                         ),
                         mesh_
-                    ),
-                    fields.formatter()
+                    )
                 );
             }
             else
@@ -190,8 +182,7 @@ void Foam::sampledSurfaces::sampleAndWrite
                        <GeometricField<Type, fvPatchField, volMesh> >
                        (
                            fields[fieldI]
-                       ),
-                       fields.formatter()
+                       )
                    );
                 }
             }
diff --git a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.C b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.C
index 6bdb3e63e9b60fe64da243ba66240ba6ea61cf32..3d477daf9a9fc7fb2bf394bed60d4fa2e503bb3e 100644
--- a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.C
+++ b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.C
@@ -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
@@ -28,10 +28,19 @@ License
 #include "OFstream.H"
 #include "OSspecific.H"
 
+#include "makeSurfaceWriterMethods.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    makeSurfaceWriterType(dxSurfaceWriter);
+}
+
+
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-template<class Type>
-void Foam::dxSurfaceWriter<Type>::writeGeometry
+void Foam::dxSurfaceWriter::writeGeometry
 (
     Ostream& os,
     const pointField& points,
@@ -54,7 +63,6 @@ void Foam::dxSurfaceWriter<Type>::writeGeometry
     os  << nl;
 
     // Write triangles
-
     os  << "# The irregular connections (triangles)" << nl
         << "object 2 class array type int rank 1 shape 3 items "
         << faces.size() << " data follows" << nl;
@@ -80,17 +88,41 @@ void Foam::dxSurfaceWriter<Type>::writeGeometry
 }
 
 
+void Foam::dxSurfaceWriter::writeTrailer(Ostream& os, const bool isNodeValues)
+{
+    if (isNodeValues)
+    {
+        os  << nl << "attribute \"dep\" string \"positions\""
+            << nl << nl;
+    }
+    else
+    {
+        os  << nl << "attribute \"dep\" string \"connections\""
+            << nl << nl;
+    }
+
+    os  << "# the field, with three components: \"positions\","
+        << " \"connections\", and \"data\"" << nl
+        << "object \"irregular positions irregular "
+        << "connections\" class field"
+        << nl
+        << "component \"positions\" value 1" << nl
+        << "component \"connections\" value 2" << nl
+        << "component \"data\" value 3" << nl;
+
+    os  << "end" << endl;
+}
+
+
 namespace Foam
 {
-    // Write scalarField in DX format
     template<>
-    void Foam::dxSurfaceWriter<Foam::scalar>::writeData
+    void Foam::dxSurfaceWriter::writeData
     (
         Ostream& os,
         const Field<scalar>& values
     )
     {
-        // Write data
         os  << "object 3 class array type float rank 0 items "
             << values.size() << " data follows" << nl;
 
@@ -101,15 +133,13 @@ namespace Foam
     }
 
 
-    // Write vectorField in DX format
     template<>
-    void Foam::dxSurfaceWriter<Foam::vector>::writeData
+    void Foam::dxSurfaceWriter::writeData
     (
         Ostream& os,
         const Field<vector>& values
     )
     {
-        // Write data
         os  << "object 3 class array type float rank 1 shape 3 items "
             << values.size() << " data follows" << nl;
 
@@ -122,15 +152,13 @@ namespace Foam
     }
 
 
-    // Write sphericalTensorField in DX format
     template<>
-    void Foam::dxSurfaceWriter<Foam::sphericalTensor>::writeData
+    void Foam::dxSurfaceWriter::writeData
     (
         Ostream& os,
         const Field<sphericalTensor>& values
     )
     {
-        // Write data
         os  << "object 3 class array type float rank 0 items "
             << values.size() << " data follows" << nl;
 
@@ -141,15 +169,13 @@ namespace Foam
     }
 
 
-    // Write symmTensorField in DX format
     template<>
-    void Foam::dxSurfaceWriter<Foam::symmTensor>::writeData
+    void Foam::dxSurfaceWriter::writeData
     (
         Ostream& os,
         const Field<symmTensor>& values
     )
     {
-        // Write data
         os  << "object 3 class array type float rank 2 shape 3 items "
             << values.size() << " data follows" << nl;
 
@@ -165,15 +191,14 @@ namespace Foam
     }
 
 
-    // Write tensorField in DX format
+    // Write Field<tensor> in DX format
     template<>
-    void Foam::dxSurfaceWriter<Foam::tensor>::writeData
+    inline void Foam::dxSurfaceWriter::writeData
     (
         Ostream& os,
         const Field<tensor>& values
     )
     {
-        // Write data
         os  << "object 3 class array type float rank 2 shape 3 items "
             << values.size() << " data follows" << nl;
 
@@ -189,15 +214,15 @@ namespace Foam
     }
 }
 
-// Write tensorField in DX format
+
+// arbitrary field
 template<class Type>
-void Foam::dxSurfaceWriter<Type>::writeData
+inline void Foam::dxSurfaceWriter::writeData
 (
     Ostream& os,
     const Field<Type>& values
 )
 {
-    // Write data
     os  << "object 3 class array type float rank 0 items "
         << values.size() << " data follows" << nl;
 
@@ -208,41 +233,8 @@ void Foam::dxSurfaceWriter<Type>::writeData
 }
 
 
-// Write trailer in DX format
 template<class Type>
-void Foam::dxSurfaceWriter<Type>::writeTrailer(Ostream& os)
-{
-    os  << "# the field, with three components: \"positions\","
-        << " \"connections\", and \"data\"" << nl
-        << "object \"irregular positions irregular "
-        << "connections\" class field"
-        << nl
-        << "component \"positions\" value 1" << nl
-        << "component \"connections\" value 2" << nl
-        << "component \"data\" value 3" << nl;
-}
-
-
-// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
-
-template<class Type>
-Foam::dxSurfaceWriter<Type>::dxSurfaceWriter()
-:
-    surfaceWriter<Type>()
-{}
-
-
-// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
-
-template<class Type>
-Foam::dxSurfaceWriter<Type>::~dxSurfaceWriter()
-{}
-
-
-// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
-
-template<class Type>
-void Foam::dxSurfaceWriter<Type>::write
+void Foam::dxSurfaceWriter::writeTemplate
 (
     const fileName& outputDir,
     const fileName& surfaceName,
@@ -270,24 +262,29 @@ void Foam::dxSurfaceWriter<Type>::write
     }
 
     writeGeometry(os, points, faces);
-
     writeData(os, values);
+    writeTrailer(os, isNodeValues);
+}
 
-    if (isNodeValues)
-    {
-        os  << nl << "attribute \"dep\" string \"positions\""
-            << nl << nl;
-    }
-    else
-    {
-        os  << nl << "attribute \"dep\" string \"connections\""
-            << nl << nl;
-    }
 
-    writeTrailer(os);
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-    os << "end" << nl;
-}
+Foam::dxSurfaceWriter::dxSurfaceWriter()
+:
+    surfaceWriter()
+{}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::dxSurfaceWriter::~dxSurfaceWriter()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+// create write methods
+defineSurfaceWriterWriteFields(Foam::dxSurfaceWriter);
 
 
 // ************************************************************************* //
diff --git a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H
index feccf33be1df14b85609038e2acdc055c8001965..e4e3af67e6bd4e6082b683b096e3bca26ab12dc5 100644
--- a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H
+++ b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H
@@ -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,6 +25,7 @@ Class
     Foam::dxSurfaceWriter
 
 Description
+    A surfaceWriter for OpenDX format.
 
 SourceFiles
     dxSurfaceWriter.C
@@ -42,22 +43,36 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                      Class dxSurfaceWriter Declaration
+                       Class dxSurfaceWriter Declaration
 \*---------------------------------------------------------------------------*/
 
-template<class Type>
 class dxSurfaceWriter
 :
-    public surfaceWriter<Type>
+    public surfaceWriter
 {
 
     // Private Member Functions
 
         static void writeGeometry(Ostream&, const pointField&, const faceList&);
+        static void writeTrailer(Ostream&, const bool isNodeValues);
 
-        static void writeData(Ostream&, const Field<Type>& values);
+        template<class Type>
+        static void writeData(Ostream&, const Field<Type>&);
+
+        //- Templated write operation
+        template<class Type>
+        void writeTemplate
+        (
+            const fileName& outputDir,
+            const fileName& surfaceName,
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,
+            const Field<Type>& values,
+            const bool isNodeValues,
+            const bool verbose
+        ) const;
 
-        static void writeTrailer(Ostream&);
 
 public:
 
@@ -77,32 +92,82 @@ public:
 
     // Member Functions
 
-        // Write
+        //- Write scalarField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<scalar>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const;
 
-        //- Writes single surface to file.
+        //- Write vectorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
         virtual void write
         (
-            const fileName& outputDir,
-            const fileName& surfaceName,
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
             const pointField& points,
             const faceList& faces,
-            const word& fieldName,
-            const Field<Type>& values,
+            const word& fieldName,          // name of field
+            const Field<vector>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const;
+
+        //- Write sphericalTensorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<sphericalTensor>& values,
             const bool isNodeValues,
             const bool verbose = false
         ) const;
-};
 
+        //- Write symmTensorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<symmTensor>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const;
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+        //- Write tensorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<tensor>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const;
+
+};
 
-} // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-#ifdef NoRepository
-#   include "dxSurfaceWriter.C"
-#endif
+} // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriterRunTime.C b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriterRunTime.C
deleted file mode 100644
index a53ba0f34fc63a7c2bdd5218ea25092c28fa9738..0000000000000000000000000000000000000000
--- a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriterRunTime.C
+++ /dev/null
@@ -1,43 +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 "dxSurfaceWriter.H"
-#include "surfaceWriters.H"
-#include "addToRunTimeSelectionTable.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-makeSurfaceWriters(dxSurfaceWriter);
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// ************************************************************************* //
diff --git a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C
index cde2d597a839a8a951554539f700afb481a4990c..d83ec611a1015be98df590641daabff6d1582449 100644
--- a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C
+++ b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C
@@ -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
@@ -28,120 +28,71 @@ License
 #include "OFstream.H"
 #include "OSspecific.H"
 #include "IOmanip.H"
-#include "ensightGeoFile.H"
-#include "ensightPartNonMeshFaces.H"
+#include "ensightPartFaces.H"
 
-// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
-
-namespace Foam
-{
+#include "makeSurfaceWriterMethods.H"
 
-    // Write scalarField in ensight format
-    template<>
-    void Foam::ensightSurfaceWriter<Foam::scalar>::writeData
-    (
-        Ostream& os,
-        const Field<Foam::scalar>& values
-    )
-    {
-        forAll(values, i)
-        {
-            os << values[i] << nl;
-        }
-    }
-
-
-    // Write booField in ensight format
-    template<>
-    void Foam::ensightSurfaceWriter<bool>::writeData
-    (
-        Ostream& os,
-        const Field<bool>& values
-    )
-    {
-        forAll(values, i)
-        {
-            os << values[i] << nl;
-        }
-    }
-}
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
-
-// Write generic field in ensight format
-template<class Type>
-void Foam::ensightSurfaceWriter<Type>::writeData
-(
-    Ostream& os,
-    const Field<Type>& values
-)
+namespace Foam
 {
-    for (direction cmpt = 0; cmpt < vector::nComponents; cmpt++)
-    {
-        scalarField v(values.component(cmpt));
-        forAll(v, i)
-        {
-            os << v[i] << nl;
-        }
-    }
+    makeSurfaceWriterType(ensightSurfaceWriter);
+    addToRunTimeSelectionTable(surfaceWriter, ensightSurfaceWriter, wordDict);
 }
 
 
-// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
-
-// Construct from components
-template<class Type>
-Foam::ensightSurfaceWriter<Type>::ensightSurfaceWriter()
-:
-    surfaceWriter<Type>()
-{}
-
-
-// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
-
-template<class Type>
-Foam::ensightSurfaceWriter<Type>::~ensightSurfaceWriter()
-{}
-
-
-// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
 template<class Type>
-void Foam::ensightSurfaceWriter<Type>::write
+void Foam::ensightSurfaceWriter::writeTemplate
 (
     const fileName& outputDir,
     const fileName& surfaceName,
     const pointField& points,
     const faceList& faces,
+    const word& fieldName,
+    const Field<Type>& values,
+    const bool isNodeValues,
     const bool verbose
 ) const
 {
-    if (!isDir(outputDir))
+    if (!isDir(outputDir/fieldName))
     {
-        mkDir(outputDir);
+        mkDir(outputDir/fieldName);
     }
 
-    //const scalar timeValue = Foam::name(this->mesh().time().timeValue());
+    // const scalar timeValue = Foam::name(this->mesh().time().timeValue());
     const scalar timeValue = 0.0;
 
-
-    OFstream caseStr(outputDir/surfaceName + ".case");
-    ensightGeoFile geomStr
+    OFstream osCase(outputDir/fieldName/surfaceName + ".case");
+    ensightGeoFile osGeom
     (
-        outputDir/surfaceName + ".000.mesh",
-        IOstream::ASCII
+        outputDir/fieldName/surfaceName + ".000.mesh",
+        writeFormat_
+    );
+    ensightFile osField
+    (
+        outputDir/fieldName/surfaceName + ".000." + fieldName,
+        writeFormat_
     );
 
     if (verbose)
     {
-        Info<< "Writing case file to " << caseStr.name() << endl;
+        Info<< "Writing case file to " << osCase.name() << endl;
     }
 
-    caseStr
+    osCase
         << "FORMAT" << nl
         << "type: ensight gold" << nl
         << nl
         << "GEOMETRY" << nl
-        << "model:        1     " << geomStr.name().name() << nl
+        << "model:        1     " << osGeom.name().name() << nl
+        << nl
+        << "VARIABLE" << nl
+        << pTraits<Type>::typeName << " per "
+        << word(isNodeValues ? "node:" : "element:") << setw(10) << 1
+        << "       " << fieldName
+        << "       " << surfaceName.c_str() << ".***." << fieldName << nl
         << nl
         << "TIME" << nl
         << "time set:                      1" << nl
@@ -152,74 +103,80 @@ void Foam::ensightSurfaceWriter<Type>::write
         << timeValue << nl
         << nl;
 
-    ensightPartNonMeshFaces faceWriter(0, geomStr.name().name(), faces, points);
-    faceWriter.writeGeometry(geomStr);
+    ensightPartFaces ensPart(0, osGeom.name().name(), points, faces, true);
+    osGeom << ensPart;
+
+    // Write field
+    osField.writeKeyword(pTraits<Type>::typeName);
+    ensPart.writeField(osField, values, isNodeValues);
 }
 
 
-template<class Type>
-void Foam::ensightSurfaceWriter<Type>::write
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::ensightSurfaceWriter::ensightSurfaceWriter()
+:
+    surfaceWriter(),
+    writeFormat_(IOstream::ASCII)
+{}
+
+
+Foam::ensightSurfaceWriter::ensightSurfaceWriter(const dictionary& options)
+:
+    surfaceWriter(),
+    writeFormat_(IOstream::ASCII)
+{
+    // choose ascii or binary format
+    if (options.found("format"))
+    {
+        writeFormat_ = IOstream::formatEnum(options.lookup("format"));
+    }
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::ensightSurfaceWriter::~ensightSurfaceWriter()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+void Foam::ensightSurfaceWriter::write
 (
     const fileName& outputDir,
     const fileName& surfaceName,
     const pointField& points,
     const faceList& faces,
-    const word& fieldName,
-    const Field<Type>& values,
-    const bool isNodeValues,
     const bool verbose
 ) const
 {
-    if (!isDir(outputDir/fieldName))
+    if (!isDir(outputDir))
     {
-        mkDir(outputDir/fieldName);
+        mkDir(outputDir);
     }
 
-    //const scalar timeValue = Foam::name(this->mesh().time().timeValue());
+    // const scalar timeValue = Foam::name(this->mesh().time().timeValue());
     const scalar timeValue = 0.0;
 
-
-    OFstream caseStr(outputDir/fieldName/surfaceName + ".case");
-    ensightGeoFile geomStr
+    OFstream osCase(outputDir/surfaceName + ".case");
+    ensightGeoFile osGeom
     (
-        outputDir/fieldName/surfaceName + ".000.mesh",
-        IOstream::ASCII
-    );
-    ensightFile fieldStr
-    (
-        outputDir/fieldName/surfaceName + ".000." + fieldName,
-        IOstream::ASCII
+        outputDir/surfaceName + ".000.mesh",
+        writeFormat_
     );
 
     if (verbose)
     {
-        Info<< "Writing case file to " << caseStr.name() << endl;
+        Info<< "Writing case file to " << osCase.name() << endl;
     }
 
-    caseStr
+    osCase
         << "FORMAT" << nl
         << "type: ensight gold" << nl
         << nl
         << "GEOMETRY" << nl
-        << "model:        1     " << geomStr.name().name() << nl
-        << nl
-        << "VARIABLE" << nl;
-    if (isNodeValues)
-    {
-        caseStr
-            << pTraits<Type>::typeName << " per node:" << setw(10) << 1
-            << "       " << fieldName
-            << "       " << surfaceName.c_str() << ".***." << fieldName << nl;
-    }
-    else
-    {
-        caseStr
-            << pTraits<Type>::typeName << " per element:" << setw(10) << 1
-            << "       " << fieldName
-            << "       " << surfaceName.c_str() << ".***." << fieldName << nl;
-    }
-
-    caseStr
+        << "model:        1     " << osGeom.name().name() << nl
         << nl
         << "TIME" << nl
         << "time set:                      1" << nl
@@ -230,41 +187,13 @@ void Foam::ensightSurfaceWriter<Type>::write
         << timeValue << nl
         << nl;
 
-    ensightPartNonMeshFaces faceWriter(0, geomStr.name().name(), faces, points);
-    faceWriter.writeGeometry(geomStr);
+    ensightPartFaces ensPart(0, osGeom.name().name(), points, faces, true);
+    osGeom << ensPart;
+}
 
-    // Write field
-    fieldStr
-        << pTraits<Type>::typeName << nl
-        << "part" << nl
-        << setw(10) << 1 << nl;
 
-    if (isNodeValues)
-    {
-        fieldStr << "coordinates" << nl;
-        writeData(fieldStr, values);
-    }
-    else
-    {
-        //faceWriter.writeField(fieldStr, values);
-        forAll(faceWriter.elementTypes(), elemI)
-        {
-            if (faceWriter.elemLists()[elemI].size())
-            {
-                fieldStr.writeKeyword(faceWriter.elementTypes()[elemI]);
-                writeData
-                (
-                    fieldStr,
-                    Field<Type>
-                    (
-                        values,
-                        faceWriter.elemLists()[elemI]
-                    )
-                );
-            }
-        }
-    }
-}
+// create write methods
+defineSurfaceWriterWriteFields(Foam::ensightSurfaceWriter);
 
 
 // ************************************************************************* //
diff --git a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H
index d2f01c6479be562a6b2c5a6f7cca41952b4067d7..628c178d4e6f5b7db109af0d2faeee32530a8ccf 100644
--- a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H
+++ b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H
@@ -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
@@ -25,6 +25,7 @@ Class
     Foam::ensightSurfaceWriter
 
 Description
+    A surfaceWriter for Ensight format.
 
 SourceFiles
     ensightSurfaceWriter.C
@@ -41,29 +42,35 @@ SourceFiles
 namespace Foam
 {
 
-class ensightGeoFile;
-
 /*---------------------------------------------------------------------------*\
                      Class ensightSurfaceWriter Declaration
 \*---------------------------------------------------------------------------*/
 
-template<class Type>
 class ensightSurfaceWriter
 :
-    public surfaceWriter<Type>
+    public surfaceWriter
 {
     // Private data
 
-        fileName caseFileName_;
-        fileName surfaceName_;
-        fileName geomName_;
-        DynamicList<word> varNames_;
-        DynamicList<fileName> varFileNames_;
+        //- Write option (default is IOstream::ASCII
+        IOstream::streamFormat writeFormat_;
 
 
     // Private Member Functions
 
-        static void writeData(Ostream&, const Field<Type>& values);
+        //- Templated write operation
+        template<class Type>
+        void writeTemplate
+        (
+            const fileName& outputDir,
+            const fileName& surfaceName,
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,
+            const Field<Type>& values,
+            const bool isNodeValues,
+            const bool verbose
+        ) const;
 
 
 public:
@@ -77,6 +84,9 @@ public:
         //- Construct null
         ensightSurfaceWriter();
 
+        //- Construct with some output options
+        ensightSurfaceWriter(const dictionary& options);
+
 
     //- Destructor
     virtual ~ensightSurfaceWriter();
@@ -84,9 +94,15 @@ public:
 
     // Member Functions
 
-        // Write
+        //- True if the surface format supports geometry in a separate file.
+        //  False if geometry and field must be in a single file
+        virtual bool separateGeometry()
+        {
+            return true;
+        }
 
-        //- Write geometry to file.
+
+        //- Write single surface geometry to file.
         virtual void write
         (
             const fileName& outputDir,
@@ -97,30 +113,82 @@ public:
         ) const;
 
 
-        //- Writes single surface to file.
+        //- Write scalarField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
         virtual void write
         (
-            const fileName& outputDir,
-            const fileName& surfaceName,
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
             const pointField& points,
             const faceList& faces,
-            const word& fieldName,
-            const Field<Type>& values,
+            const word& fieldName,          // name of field
+            const Field<scalar>& values,
             const bool isNodeValues,
             const bool verbose = false
         ) const;
-};
 
+        //- Write vectorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<vector>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const;
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+        //- Write sphericalTensorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<sphericalTensor>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const;
+
+        //- Write symmTensorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<symmTensor>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const;
+
+        //- Write tensorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<tensor>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const;
+
+};
 
-} // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-#ifdef NoRepository
-#   include "ensightSurfaceWriter.C"
-#endif
+} // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriterRunTime.C b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriterRunTime.C
deleted file mode 100644
index 8355a6d991b5bbcf791a5214271fb9d706eca17f..0000000000000000000000000000000000000000
--- a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriterRunTime.C
+++ /dev/null
@@ -1,44 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2010-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 "ensightSurfaceWriter.H"
-#include "surfaceWriters.H"
-#include "addToRunTimeSelectionTable.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-makeSurfaceWriterType(ensightSurfaceWriter, bool);
-makeSurfaceWriters(ensightSurfaceWriter);
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// ************************************************************************* //
diff --git a/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.C b/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.C
index 747a79f39a959f2a848bb31a8d9f40c72ef0bc52..06005b5c0aea7af1c4fd914a7126b9bd76ba6c62 100644
--- a/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.C
+++ b/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.C
@@ -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) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -28,31 +28,28 @@ License
 #include "OFstream.H"
 #include "OSspecific.H"
 
-// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
-
-template<class Type>
-Foam::foamFileSurfaceWriter<Type>::foamFileSurfaceWriter()
-:
-    surfaceWriter<Type>()
-{}
+#include "makeSurfaceWriterMethods.H"
 
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
-// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
-
-template<class Type>
-Foam::foamFileSurfaceWriter<Type>::~foamFileSurfaceWriter()
-{}
+namespace Foam
+{
+    makeSurfaceWriterType(foamFileSurfaceWriter);
+}
 
 
-// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
 template<class Type>
-void Foam::foamFileSurfaceWriter<Type>::write
+void Foam::foamFileSurfaceWriter::writeTemplate
 (
     const fileName& outputDir,
     const fileName& surfaceName,
     const pointField& points,
     const faceList& faces,
+    const word& fieldName,
+    const Field<Type>& values,
+    const bool isNodeValues,
     const bool verbose
 ) const
 {
@@ -65,38 +62,47 @@ void Foam::foamFileSurfaceWriter<Type>::write
 
     if (verbose)
     {
-        Info<< "Writing geometry to " << surfaceDir << endl;
+        Info<< "Writing field " << fieldName << " to " << surfaceDir << endl;
     }
 
-    // Points
-    OFstream(surfaceDir/"points")() << points;
-
-    // Faces
-    OFstream(surfaceDir/"faces")() << faces;
+    // geometry should already have been written
+    // Values to separate directory (e.g. "scalarField/p")
 
-    // Face centers. Not really necessary but very handy when reusing as inputs
-    // for e.g. timeVaryingMapped bc.
-    pointField faceCentres(faces.size(),point::zero);
+    fileName foamName(pTraits<Type>::typeName);
+    fileName valuesDir(surfaceDir  / (foamName + Field<Type>::typeName));
 
-    forAll (faces, faceI)
+    if (!isDir(valuesDir))
     {
-        faceCentres[faceI] = faces[faceI].centre(points);
+        mkDir(valuesDir);
     }
 
-    OFstream(surfaceDir/"faceCentres")() << faceCentres;
+    // values
+    OFstream(valuesDir/fieldName)()  << values;
 }
 
 
-template<class Type>
-void Foam::foamFileSurfaceWriter<Type>::write
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::foamFileSurfaceWriter::foamFileSurfaceWriter()
+:
+    surfaceWriter()
+{}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::foamFileSurfaceWriter::~foamFileSurfaceWriter()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+void Foam::foamFileSurfaceWriter::write
 (
     const fileName& outputDir,
     const fileName& surfaceName,
     const pointField& points,
     const faceList& faces,
-    const word& fieldName,
-    const Field<Type>& values,
-    const bool isNodeValues,
     const bool verbose
 ) const
 {
@@ -109,24 +115,31 @@ void Foam::foamFileSurfaceWriter<Type>::write
 
     if (verbose)
     {
-        Info<< "Writing field " << fieldName << " to " << surfaceDir << endl;
+        Info<< "Writing geometry to " << surfaceDir << endl;
     }
 
-    // geometry should already have been written
 
-    // Values to separate directory (e.g. "scalarField/p")
+    // Points
+    OFstream(surfaceDir/"points")() << points;
 
-    fileName foamName(pTraits<Type>::typeName);
-    fileName valuesDir(surfaceDir  / (foamName + Field<Type>::typeName));
+    // Faces
+    OFstream(surfaceDir/"faces")() << faces;
 
-    if (!isDir(valuesDir))
+    // Face centers. Not really necessary but very handy when reusing as inputs
+    // for e.g. timeVaryingMapped bc.
+    pointField faceCentres(faces.size(),point::zero);
+
+    forAll(faces, faceI)
     {
-        mkDir(valuesDir);
+        faceCentres[faceI] = faces[faceI].centre(points);
     }
 
-    // values
-    OFstream(valuesDir/fieldName)() << values;
+    OFstream(surfaceDir/"faceCentres")() << faceCentres;
 }
 
 
+// create write methods
+defineSurfaceWriterWriteFields(Foam::foamFileSurfaceWriter);
+
+
 // ************************************************************************* //
diff --git a/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.H b/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.H
index 0076abdc88a27d51a1602f76d44a711bcecb9516..ce19c21455acb7364db57c1ae82a601067716f3a 100644
--- a/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.H
+++ b/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.H
@@ -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) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -43,14 +43,29 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                   Class foamFileSurfaceWriter Declaration
+                    Class foamFileSurfaceWriter Declaration
 \*---------------------------------------------------------------------------*/
 
-template<class Type>
 class foamFileSurfaceWriter
 :
-    public surfaceWriter<Type>
+    public surfaceWriter
 {
+    // Private Member Functions
+
+        //- Templated write operation
+        template<class Type>
+        void writeTemplate
+        (
+            const fileName& outputDir,
+            const fileName& surfaceName,
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,
+            const Field<Type>& values,
+            const bool isNodeValues,
+            const bool verbose
+        ) const;
+
 
 public:
 
@@ -70,13 +85,14 @@ public:
 
     // Member Functions
 
-        //- Return true if the surface format supports separate files
-        virtual bool separateFiles()
+        //- True if the surface format supports geometry in a separate file.
+        //  False if geometry and field must be in a single file
+        virtual bool separateGeometry()
         {
             return true;
         }
 
-        //- Write geometry to file.
+        //- Write single surface geometry to file.
         virtual void write
         (
             const fileName& outputDir,
@@ -86,30 +102,83 @@ public:
             const bool verbose = false
         ) const;
 
-        //- Writes single surface to file.
+
+        //- Write scalarField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
         virtual void write
         (
-            const fileName& outputDir,
-            const fileName& surfaceName,
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
             const pointField& points,
             const faceList& faces,
-            const word& fieldName,
-            const Field<Type>& values,
+            const word& fieldName,          // name of field
+            const Field<scalar>& values,
             const bool isNodeValues,
             const bool verbose = false
         ) const;
-};
 
+        //- Write vectorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<vector>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const;
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+        //- Write sphericalTensorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<sphericalTensor>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const;
+
+        //- Write symmTensorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<symmTensor>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const;
+
+        //- Write tensorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<tensor>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const;
+
+};
 
-} // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-#ifdef NoRepository
-#   include "foamFileSurfaceWriter.C"
-#endif
+} // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriterRunTime.C b/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriterRunTime.C
deleted file mode 100644
index c8a40e736ca8b92073280defdaae88d6baa5cc83..0000000000000000000000000000000000000000
--- a/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriterRunTime.C
+++ /dev/null
@@ -1,44 +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 "foamFileSurfaceWriter.H"
-#include "surfaceWriters.H"
-#include "addToRunTimeSelectionTable.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-makeSurfaceWriterType(foamFileSurfaceWriter, bool);
-makeSurfaceWriters(foamFileSurfaceWriter);
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// ************************************************************************* //
diff --git a/src/sampling/sampledSurface/writers/makeSurfaceWriterMethods.H b/src/sampling/sampledSurface/writers/makeSurfaceWriterMethods.H
new file mode 100644
index 0000000000000000000000000000000000000000..b748a32c6c06992454102c4debd6a05b017db555
--- /dev/null
+++ b/src/sampling/sampledSurface/writers/makeSurfaceWriterMethods.H
@@ -0,0 +1,92 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2011-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/>.
+
+InClass
+    Foam::makeSurfaceWriterMethods
+
+Description
+    Convenience macros for instantiating writer methods for surfaceWriter
+    classes.
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef makeSurfaceWriterMethods_H
+#define makeSurfaceWriterMethods_H
+
+#include "surfaceWriter.H"
+#include "addToRunTimeSelectionTable.H"
+
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#define makeSurfaceWriterType(ThisClass)                                      \
+    defineTypeNameAndDebug(ThisClass, 0);                                     \
+    addToRunTimeSelectionTable(surfaceWriter, ThisClass, word)
+
+
+#define defineSurfaceWriterWriteField(ThisClass, FieldType)                   \
+    void ThisClass::write                                                     \
+    (                                                                         \
+        const fileName& outputDir,                                            \
+        const fileName& surfaceName,                                          \
+        const pointField& points,                                             \
+        const faceList& faces,                                                \
+        const word& fieldName,                                                \
+        const Field<FieldType>& values,                                       \
+        const bool isNodeValues,                                              \
+        const bool verbose                                                    \
+    ) const                                                                   \
+    {                                                                         \
+        writeTemplate                                                         \
+        (                                                                     \
+            outputDir,                                                        \
+            surfaceName,                                                      \
+            points,                                                           \
+            faces,                                                            \
+            fieldName,                                                        \
+            values,                                                           \
+            isNodeValues,                                                     \
+            verbose                                                           \
+        );                                                                    \
+    }
+
+
+#define defineSurfaceWriterWriteFields(ThisClass)                             \
+    defineSurfaceWriterWriteField(ThisClass, scalar);                         \
+    defineSurfaceWriterWriteField(ThisClass, vector);                         \
+    defineSurfaceWriterWriteField(ThisClass, sphericalTensor);                \
+    defineSurfaceWriterWriteField(ThisClass, symmTensor);                     \
+    defineSurfaceWriterWriteField(ThisClass, tensor)
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/sampling/sampledSurface/writers/null/nullSurfaceWriter.C b/src/sampling/sampledSurface/writers/null/nullSurfaceWriter.C
deleted file mode 100644
index 85d4fcbb62c0b6d7c91823417062e6b41af6ccbe..0000000000000000000000000000000000000000
--- a/src/sampling/sampledSurface/writers/null/nullSurfaceWriter.C
+++ /dev/null
@@ -1,63 +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 "nullSurfaceWriter.H"
-
-// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
-
-// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
-
-template<class Type>
-Foam::nullSurfaceWriter<Type>::nullSurfaceWriter()
-:
-    surfaceWriter<Type>()
-{}
-
-
-// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
-
-template<class Type>
-Foam::nullSurfaceWriter<Type>::~nullSurfaceWriter()
-{}
-
-
-// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
-
-template<class Type>
-void Foam::nullSurfaceWriter<Type>::write
-(
-    const fileName& outputDir,
-    const fileName& surfaceName,
-    const pointField& points,
-    const faceList& faces,
-    const word& fieldName,
-    const Field<Type>& values,
-    const bool isNodeValues,
-    const bool verbose
-) const
-{}
-
-
-// ************************************************************************* //
diff --git a/src/sampling/sampledSurface/writers/null/nullSurfaceWriter.H b/src/sampling/sampledSurface/writers/null/nullSurfaceWriter.H
deleted file mode 100644
index aef12a76cea9eaa828b87bab7e2aa9565e8fb72a..0000000000000000000000000000000000000000
--- a/src/sampling/sampledSurface/writers/null/nullSurfaceWriter.H
+++ /dev/null
@@ -1,103 +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/>.
-
-Class
-    Foam::nullSurfaceWriter
-
-Description
-
-SourceFiles
-    nullSurfaceWriter.C
-
-\*---------------------------------------------------------------------------*/
-
-#ifndef nullSurfaceWriter_H
-#define nullSurfaceWriter_H
-
-#include "surfaceWriter.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-/*---------------------------------------------------------------------------*\
-                     Class nullSurfaceWriter Declaration
-\*---------------------------------------------------------------------------*/
-
-template<class Type>
-class nullSurfaceWriter
-:
-    public surfaceWriter<Type>
-{
-
-public:
-
-    //- Runtime type information
-    TypeName("null");
-
-
-    // Constructors
-
-        //- Construct null
-        nullSurfaceWriter();
-
-
-    //- Destructor
-    virtual ~nullSurfaceWriter();
-
-
-    // Member Functions
-
-        // Write
-
-        //- Writes single surface to file.
-        virtual void write
-        (
-            const fileName& outputDir,
-            const fileName& surfaceName,
-            const pointField& points,
-            const faceList& faces,
-            const word& fieldName,
-            const Field<Type>& values,
-            const bool isNodeValues,
-            const bool verbose = false
-        ) const;
-};
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#ifdef NoRepository
-#   include "nullSurfaceWriter.C"
-#endif
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#endif
-
-// ************************************************************************* //
diff --git a/src/sampling/sampledSurface/writers/null/nullSurfaceWriterRunTime.C b/src/sampling/sampledSurface/writers/null/nullSurfaceWriterRunTime.C
deleted file mode 100644
index c9fd6af9d948714df95609742ffafdf87ac203ee..0000000000000000000000000000000000000000
--- a/src/sampling/sampledSurface/writers/null/nullSurfaceWriterRunTime.C
+++ /dev/null
@@ -1,44 +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 "nullSurfaceWriter.H"
-#include "surfaceWriters.H"
-#include "addToRunTimeSelectionTable.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-makeSurfaceWriterType(nullSurfaceWriter, bool);
-makeSurfaceWriters(nullSurfaceWriter);
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// ************************************************************************* //
diff --git a/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.C b/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.C
index 11990cfd83a72e2ef9ebe2cce37cd229354fd876..d598754b3846dc617e13383c2d45423f3a472fcd 100644
--- a/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.C
+++ b/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.C
@@ -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
@@ -29,27 +29,34 @@ License
 #include "OFstream.H"
 #include "OSspecific.H"
 
+#include "makeSurfaceWriterMethods.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    defineTypeNameAndDebug(proxySurfaceWriter, 0);
+}
+
+
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template<class Type>
-Foam::proxySurfaceWriter<Type>::proxySurfaceWriter(const word& ext)
+Foam::proxySurfaceWriter::proxySurfaceWriter(const word& ext)
 :
-    surfaceWriter<Type>(),
+    surfaceWriter(),
     ext_(ext)
 {}
 
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template<class Type>
-Foam::proxySurfaceWriter<Type>::~proxySurfaceWriter()
+Foam::proxySurfaceWriter::~proxySurfaceWriter()
 {}
 
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template<class Type>
-void Foam::proxySurfaceWriter<Type>::write
+void Foam::proxySurfaceWriter::write
 (
     const fileName& outputDir,
     const fileName& surfaceName,
@@ -69,19 +76,14 @@ void Foam::proxySurfaceWriter<Type>::write
         mkDir(outputDir);
     }
 
-    fileName fName(outputDir/surfaceName + "." + ext_);
+    fileName outName(outputDir/surfaceName + "." + ext_);
 
     if (verbose)
     {
-        Info<< "Writing geometry to " << fName << endl;
+        Info<< "Writing geometry to " << outName << endl;
     }
 
-    MeshedSurfaceProxy<face>
-    (
-        points,
-        faces
-    ).write(fName);
-
+    MeshedSurfaceProxy<face>(points, faces).write(outName);
 }
 
 
diff --git a/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.H b/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.H
index 2cbc6c30ac27042b39841f4271f4558580c01dea..ad134b7b6e54a1353867380ee610ac7591987fdd 100644
--- a/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.H
+++ b/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.H
@@ -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
@@ -25,6 +25,8 @@ Class
     Foam::proxySurfaceWriter
 
 Description
+    A surfaceWriter that writes the geometry via the MeshedSurfaceProxy, but
+    which does not support any fields.
 
 SourceFiles
     proxySurfaceWriter.C
@@ -42,13 +44,12 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                      Class proxySurfaceWriter Declaration
+                     Class proxySurfaceWriter Declaration
 \*---------------------------------------------------------------------------*/
 
-template<class Type>
 class proxySurfaceWriter
 :
-    public surfaceWriter<Type>
+    public surfaceWriter
 {
 
     // Private data
@@ -74,15 +75,16 @@ public:
 
     // Member Functions
 
-        //- Always write separate geometry file
-        virtual bool separateFiles()
+
+        //- True if the surface format supports geometry in a separate file.
+        //  False if geometry and field must be in a single file
+        virtual bool separateGeometry()
         {
             return true;
         }
 
-        // Write
 
-        //- Write geometry to file.
+        //- Write single surface geometry to file.
         virtual void write
         (
             const fileName& outputDir,
@@ -92,20 +94,6 @@ public:
             const bool verbose = false
         ) const;
 
-
-        //- Writes single surface to file.
-        virtual void write
-        (
-            const fileName& outputDir,
-            const fileName& surfaceName,
-            const pointField& points,
-            const faceList& faces,
-            const word& fieldName,
-            const Field<Type>& values,
-            const bool isNodeValues,
-            const bool verbose = false
-        ) const
-        {}
 };
 
 
@@ -115,12 +103,6 @@ public:
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-#ifdef NoRepository
-#   include "proxySurfaceWriter.C"
-#endif
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
 #endif
 
 // ************************************************************************* //
diff --git a/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriterRunTime.C b/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriterRunTime.C
deleted file mode 100644
index 508b41c1b60b56b092eacfe90abc3a0ab78a35f8..0000000000000000000000000000000000000000
--- a/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriterRunTime.C
+++ /dev/null
@@ -1,45 +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 "proxySurfaceWriter.H"
-#include "surfaceWriters.H"
-#include "addToRunTimeSelectionTable.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-// create type names, but do not register with run-time tables
-makeTypeSurfaceWritersTypeName(proxySurfaceWriter, bool);
-makeSurfaceWritersTypeName(proxySurfaceWriter);
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// ************************************************************************* //
diff --git a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C
index 46b8a188eccd1eb7addb9cd9f0e749c9945d45ef..90e42c0c074602a645416315bf730c7c8852e0fe 100644
--- a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C
+++ b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C
@@ -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) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -29,274 +29,262 @@ License
 #include "OSspecific.H"
 #include "IOmanip.H"
 
+#include "makeSurfaceWriterMethods.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    makeSurfaceWriterType(rawSurfaceWriter);
+}
+
+
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-template<class Type>
-void Foam::rawSurfaceWriter<Type>::writeGeometry
+inline void Foam::rawSurfaceWriter::writeLocation
 (
+    Ostream& os,
     const pointField& points,
-    const label pointI,
-    Ostream& os
+    const label pointI
 )
 {
     const point& pt = points[pointI];
-
-    os << pt.x() << ' ' << pt.y() << ' ' << pt.z() << ' ';
+    os  << pt.x() << ' ' << pt.y() << ' ' << pt.z() << ' ';
 }
 
 
-template<class Type>
-void Foam::rawSurfaceWriter<Type>::writeGeometry
+inline void Foam::rawSurfaceWriter::writeLocation
 (
+    Ostream& os,
     const pointField& points,
     const faceList& faces,
-    const label faceI,
-    Ostream& os
+    const label faceI
 )
 {
     const point& ct = faces[faceI].centre(points);
-
-    os << ct.x() << ' ' << ct.y() << ' ' << ct.z() << ' ';
+    os  << ct.x() << ' ' << ct.y() << ' ' << ct.z() << ' ';
 }
 
 
-// Write scalarField in raw format
-template<class Type>
-void Foam::rawSurfaceWriter<Type>::writeData
-(
-    const word& fieldName,
-    const pointField& points,
-    const faceList& faces,
-    const scalarField& values,
-    const bool isNodeValues,
-    Ostream& os
-)
+namespace Foam
 {
-    // header
-    os  << "#  x  y  z  " << fieldName << endl;
-
-    // Write data
-    if (isNodeValues)
+    template<>
+    void Foam::rawSurfaceWriter::writeHeader
+    (
+        Ostream& os,
+        const word& fieldName,
+        const Field<scalar>& values
+    )
     {
-        forAll(values, elemI)
-        {
-            writeGeometry(points, elemI, os);
-            os << values[elemI] << nl;
-        }
+        os  << values.size() << nl
+            << "#  x  y  z  " << fieldName << nl;
     }
-    else
+
+
+    template<>
+    void Foam::rawSurfaceWriter::writeHeader
+    (
+        Ostream& os,
+        const word& fieldName,
+        const Field<vector>& values
+    )
     {
-        forAll(values, elemI)
-        {
-            writeGeometry(points, faces, elemI, os);
-            os << values[elemI] << nl;
-        }
+        os  << values.size() << nl
+            << "#  x  y  z  "
+            << fieldName << "_x  "
+            << fieldName << "_y  "
+            << fieldName << "_z  "
+            << endl;
     }
 
-    os << nl;
-}
 
+    template<>
+    void Foam::rawSurfaceWriter::writeHeader
+    (
+        Ostream& os,
+        const word& fieldName,
+        const Field<sphericalTensor>& values
+    )
+    {
+        os  << values.size() << nl
+            << "#  ii  "
+            << fieldName << "_ii" << nl;
+    }
 
-// Write vectorField in raw format
-template<class Type>
-void Foam::rawSurfaceWriter<Type>::writeData
-(
-    const word& fieldName,
-    const pointField& points,
-    const faceList& faces,
-    const vectorField& values,
-    const bool isNodeValues,
-    Ostream& os
-)
-{
-    // header
-    os  << "#  x  y  z  "
-        << fieldName << "_x  "
-        << fieldName << "_y  "
-        << fieldName << "_z  "
-        << endl;
 
-    // Write data
-    if (isNodeValues)
+    template<>
+    void Foam::rawSurfaceWriter::writeHeader
+    (
+        Ostream& os,
+        const word& fieldName,
+        const Field<symmTensor>& values
+    )
     {
-        forAll(values, elemI)
+        os  << values.size() << nl
+            << "#  xx  xy  xz  yy  yz ";
+        for (int i=0; i<6; ++i)
         {
-            writeGeometry(points, elemI, os);
-
-            const vector& v = values[elemI];
-            os << v[0] << ' ' << v[1] << ' ' << v[2] << nl;
+            os  << fieldName << "_" << i << "  ";
         }
+        os  << endl;
     }
-    else
+
+
+    template<>
+    void Foam::rawSurfaceWriter::writeHeader
+    (
+        Ostream& os,
+        const word& fieldName,
+        const Field<tensor>& values
+    )
     {
-        forAll(values, elemI)
+        os  << values.size() << nl
+            << "#  xx  xy  xz  yx  yy  yz  zx  zy  zz";
+        for (int i=0; i<9; ++i)
         {
-            writeGeometry(points, faces, elemI, os);
-
-            const vector& v = values[elemI];
-            os << v[0] << ' ' << v[1] << ' ' << v[2] << nl;
+            os  << fieldName << "_" << i << "  ";
         }
+        os  << nl;
     }
 
-}
 
+    template<>
+    inline void Foam::rawSurfaceWriter::writeData
+    (
+        Ostream& os,
+        const scalar& v
+    )
+    {
+        os  << v << nl;
+    }
 
-// Write sphericalTensorField in raw format
-template<class Type>
-void Foam::rawSurfaceWriter<Type>::writeData
-(
-    const word& fieldName,
-    const pointField& points,
-    const faceList& faces,
-    const sphericalTensorField& values,
-    const bool isNodeValues,
-    Ostream& os
-)
-{
-    // header
-    os  << "#  ii  ";
-    os << fieldName << "_ii" << endl;
 
-    // Write data
-    if (isNodeValues)
+    template<>
+    inline void Foam::rawSurfaceWriter::writeData
+    (
+        Ostream& os,
+        const vector& v
+    )
     {
-        forAll(values, elemI)
-        {
-            writeGeometry(points, elemI, os);
+        os  << v[0] << ' ' << v[1] << ' ' << v[2] << nl;
+    }
 
-            const sphericalTensor& v = values[elemI];
-            os  << v[0] << nl;
-        }
+
+    template<>
+    inline void Foam::rawSurfaceWriter::writeData
+    (
+        Ostream& os,
+        const sphericalTensor& v
+    )
+    {
+        os  << v[0] << nl;
     }
-    else
+
+
+    template<>
+    inline void Foam::rawSurfaceWriter::writeData
+    (
+        Ostream& os,
+        const symmTensor& v
+    )
     {
-        forAll(values, elemI)
-        {
-            writeGeometry(points, faces, elemI, os);
+        os  << v[0] << ' ' << v[1] << ' ' << v[2] << ' '
+            << v[3] << ' ' << v[4] << ' ' << v[5] << nl;
+    }
 
-            const sphericalTensor& v = values[elemI];
-            os  << v[0] << nl;
-        }
+
+    template<>
+    inline void Foam::rawSurfaceWriter::writeData
+    (
+        Ostream& os,
+        const tensor& v
+    )
+    {
+        os  << v[0] << ' ' << v[1] << ' ' << v[2] << ' '
+            << v[3] << ' ' << v[4] << ' ' << v[5] << ' '
+            << v[6] << ' ' << v[7] << ' ' << v[8] << nl;
     }
+
 }
 
 
-// Write symmTensorField in raw format
 template<class Type>
-void Foam::rawSurfaceWriter<Type>::writeData
+void Foam::rawSurfaceWriter::writeTemplate
 (
-    const word& fieldName,
+    const fileName& outputDir,
+    const fileName& surfaceName,
     const pointField& points,
     const faceList& faces,
-    const symmTensorField& values,
+    const word& fieldName,
+    const Field<Type>& values,
     const bool isNodeValues,
-    Ostream& os
-)
+    const bool verbose
+) const
 {
-    // header
-    os  << "#  xx  xy  xz  yy  yz ";
-    for (int i=0; i<6; i++)
+    if (!isDir(outputDir))
     {
-        os << fieldName << "_" << i << "  ";
+        mkDir(outputDir);
     }
-    os << endl;
 
-    // Write data
-    if (isNodeValues)
-    {
-        forAll(values, elemI)
-        {
-            writeGeometry(points, elemI, os);
+    OFstream os(outputDir/fieldName + '_' + surfaceName + ".raw");
 
-            const symmTensor& v = values[elemI];
+    if (verbose)
+    {
+        Info<< "Writing field " << fieldName << " to " << os.name() << endl;
+    }
 
-            os  << v[0] << ' ' << v[1] << ' ' << v[2] << ' '
-                << v[3] << ' ' << v[4] << ' ' << v[5] << nl;
-        }
+    // header
+    os  << "# " << fieldName;
+    if (isNodeValues)
+    {
+        os  << "  POINT_DATA ";
     }
     else
     {
-        forAll(values, elemI)
-        {
-            writeGeometry(points, faces, elemI, os);
-
-            const symmTensor& v = values[elemI];
-
-            os  << v[0] << ' ' << v[1] << ' ' << v[2] << ' '
-                << v[3] << ' ' << v[4] << ' ' << v[5] << nl;
-        }
+        os  << "  FACE_DATA ";
     }
-}
-
 
-// Write tensorField in raw format
-template<class Type>
-void Foam::rawSurfaceWriter<Type>::writeData
-(
-    const word& fieldName,
-    const pointField& points,
-    const faceList& faces,
-    const tensorField& values,
-    const bool isNodeValues,
-    Ostream& os
-)
-{
     // header
-    os  << "#  xx  xy  xz  yx  yy  yz  zx  zy  zz";
-    for (int i=0; i<9; ++i)
-    {
-        os << fieldName << "_" << i << "  ";
-    }
-    os << endl;
+    writeHeader(os, fieldName, values);
 
-    // Write data
+    // values
     if (isNodeValues)
     {
         forAll(values, elemI)
         {
-            writeGeometry(points, elemI, os);
-
-            const tensor& v = values[elemI];
-            os  << v[0] << ' ' << v[1] << ' ' << v[2] << ' '
-                << v[3] << ' ' << v[4] << ' ' << v[5] << ' '
-                << v[6] << ' ' << v[7] << ' ' << v[8] << nl;
+            writeLocation(os, points, elemI);
+            writeData(os, values[elemI]);
         }
     }
     else
     {
         forAll(values, elemI)
         {
-            writeGeometry(points, faces, elemI, os);
-
-            const tensor& v = values[elemI];
-            os  << v[0] << ' ' << v[1] << ' ' << v[2] << ' '
-                << v[3] << ' ' << v[4] << ' ' << v[5] << ' '
-                << v[6] << ' ' << v[7] << ' ' << v[8] << nl;
+            writeLocation(os, points, faces, elemI);
+            writeData(os, values[elemI]);
         }
     }
 }
 
 
+
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template<class Type>
-Foam::rawSurfaceWriter<Type>::rawSurfaceWriter()
+Foam::rawSurfaceWriter::rawSurfaceWriter()
 :
-    surfaceWriter<Type>()
+    surfaceWriter()
 {}
 
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template<class Type>
-Foam::rawSurfaceWriter<Type>::~rawSurfaceWriter()
+Foam::rawSurfaceWriter::~rawSurfaceWriter()
 {}
 
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template<class Type>
-void Foam::rawSurfaceWriter<Type>::write
+void Foam::rawSurfaceWriter::write
 (
     const fileName& outputDir,
     const fileName& surfaceName,
@@ -310,10 +298,7 @@ void Foam::rawSurfaceWriter<Type>::write
         mkDir(outputDir);
     }
 
-    OFstream os
-    (
-        outputDir/surfaceName + ".raw"
-    );
+    OFstream os(outputDir/surfaceName + ".raw");
 
     if (verbose)
     {
@@ -323,82 +308,21 @@ void Foam::rawSurfaceWriter<Type>::write
 
     // header
     os  << "# geometry NO_DATA " << faces.size() << nl
-        << "#  x  y  z" << endl;
+        << "#  x  y  z" << nl;
 
-    // Write faces
+    // Write faces centres
     forAll(faces, elemI)
     {
-        writeGeometry(points, faces, elemI, os);
-        os << nl;
+        writeLocation(os, points, faces, elemI);
+        os  << nl;
     }
 
-    os << nl;
+    os  << nl;
 }
 
 
-namespace Foam
-{
-    // bool fields aren't supported
-    template<>
-    void Foam::rawSurfaceWriter<bool>::write
-    (
-        const fileName& outputDir,
-        const fileName& surfaceName,
-        const pointField& points,
-        const faceList& faces,
-        const word& fieldName,
-        const Field<bool>& values,
-        const bool isNodeValues,
-        const bool verbose
-    ) const
-    {}
-}
-
-
-template<class Type>
-void Foam::rawSurfaceWriter<Type>::write
-(
-    const fileName& outputDir,
-    const fileName& surfaceName,
-    const pointField& points,
-    const faceList& faces,
-    const word& fieldName,
-    const Field<Type>& values,
-    const bool isNodeValues,
-    const bool verbose
-) const
-{
-    if (!isDir(outputDir))
-    {
-        mkDir(outputDir);
-    }
-
-    OFstream os
-    (
-        outputDir/fieldName + '_' + surfaceName + ".raw"
-    );
-
-    if (verbose)
-    {
-        Info<< "Writing field " << fieldName << " to " << os.name() << endl;
-    }
-
-
-    // header
-    os  << "# " << fieldName;
-    if (isNodeValues)
-    {
-        os  << "  POINT_DATA ";
-    }
-    else
-    {
-        os  << "  FACE_DATA ";
-    }
-
-    os  << values.size() << nl;
-
-    writeData(fieldName, points, faces, values, isNodeValues, os);
-}
+// create write methods
+defineSurfaceWriterWriteFields(Foam::rawSurfaceWriter);
 
 
 // ************************************************************************* //
diff --git a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H
index 771824bd89391af49fc1253d90db1a016ab8503b..5ec4d1ac3054b20973eb04d235cb29b21035e39f 100644
--- a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H
+++ b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H
@@ -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) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -25,6 +25,7 @@ Class
     Foam::rawSurfaceWriter
 
 Description
+    A surfaceWriter for raw output.
 
 SourceFiles
     rawSurfaceWriter.C
@@ -36,86 +37,62 @@ SourceFiles
 
 #include "surfaceWriter.H"
 
+
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                           Class raw Declaration
+                      Class rawSurfaceWriter Declaration
 \*---------------------------------------------------------------------------*/
 
-template<class Type>
 class rawSurfaceWriter
 :
-    public surfaceWriter<Type>
+    public surfaceWriter
 {
     // Private Member Functions
 
-        static void writeGeometry
+        static inline void writeLocation
         (
-            const pointField& points,
-            const label pointI,
-            Ostream& os
+            Ostream&,
+            const pointField&,
+            const label pointI
         );
 
-        static void writeGeometry
+        static inline void writeLocation
         (
-            const pointField& points,
-            const faceList& faces,
-            const label faceI,
-            Ostream& os
+            Ostream&,
+            const pointField&,
+            const faceList&,
+            const label faceI
         );
 
-        static void writeData
+        template<class Type>
+        static void writeHeader
         (
+            Ostream&,
             const word& fieldName,
-            const pointField& points,
-            const faceList& faces,
-            const scalarField& values,
-            const bool isNodeValues,
-            Ostream& os
+            const Field<Type>&
         );
 
-        static void writeData
-        (
-            const word& fieldName,
-            const pointField& points,
-            const faceList& faces,
-            const vectorField& values,
-            const bool isNodeValues,
-            Ostream& os
-        );
+        template<class Type>
+        static inline void writeData(Ostream&, const Type&);
 
-        static void writeData
-        (
-            const word& fieldName,
-            const pointField& points,
-            const faceList& faces,
-            const sphericalTensorField& values,
-            const bool isNodeValues,
-            Ostream& os
-        );
 
-        static void writeData
+        //- Templated write operation
+        template<class Type>
+        void writeTemplate
         (
-            const word& fieldName,
+            const fileName& outputDir,
+            const fileName& surfaceName,
             const pointField& points,
             const faceList& faces,
-            const symmTensorField& values,
-            const bool isNodeValues,
-            Ostream& os
-        );
-
-        static void writeData
-        (
             const word& fieldName,
-            const pointField& points,
-            const faceList& faces,
-            const tensorField& values,
+            const Field<Type>& values,
             const bool isNodeValues,
-            Ostream& os
-        );
+            const bool verbose
+        ) const;
 
 
 public:
@@ -136,9 +113,7 @@ public:
 
     // Member Functions
 
-        // Write
-
-        //- Write geometry to file.
+        //- Write single surface geometry to file.
         virtual void write
         (
             const fileName& outputDir,
@@ -148,30 +123,83 @@ public:
             const bool verbose = false
         ) const;
 
-        //- Writes single surface to file.
+
+        //- Write scalarField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
         virtual void write
         (
-            const fileName& outputDir,
-            const fileName& surfaceName,
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
             const pointField& points,
             const faceList& faces,
-            const word& fieldName,
-            const Field<Type>& values,
+            const word& fieldName,          // name of field
+            const Field<scalar>& values,
             const bool isNodeValues,
             const bool verbose = false
         ) const;
-};
 
+        //- Write vectorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<vector>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const;
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+        //- Write sphericalTensorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<sphericalTensor>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const;
+
+        //- Write symmTensorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<symmTensor>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const;
+
+        //- Write tensorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<tensor>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const;
+
+};
 
-} // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-#ifdef NoRepository
-#   include "rawSurfaceWriter.C"
-#endif
+} // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriterRunTime.C b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriterRunTime.C
deleted file mode 100644
index d6a1a89cc91e72906df1c61eb463250299295d51..0000000000000000000000000000000000000000
--- a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriterRunTime.C
+++ /dev/null
@@ -1,44 +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 "rawSurfaceWriter.H"
-#include "surfaceWriters.H"
-#include "addToRunTimeSelectionTable.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-makeSurfaceWriterType(rawSurfaceWriter, bool);
-makeSurfaceWriters(rawSurfaceWriter);
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// ************************************************************************* //
diff --git a/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.C b/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.C
new file mode 100644
index 0000000000000000000000000000000000000000..5ab7290218d6595474675da463d8dbe00adef679
--- /dev/null
+++ b/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.C
@@ -0,0 +1,172 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2011-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 "starcdSurfaceWriter.H"
+
+#include "MeshedSurfaceProxy.H"
+#include "OFstream.H"
+#include "OSspecific.H"
+
+#include "makeSurfaceWriterMethods.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    makeSurfaceWriterType(starcdSurfaceWriter);
+}
+
+
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
+namespace Foam
+{
+    template<>
+    inline void Foam::starcdSurfaceWriter::writeData
+    (
+        Ostream& os,
+        const scalar& v
+    )
+    {
+        os  << v << nl;
+    }
+
+
+    template<>
+    inline void Foam::starcdSurfaceWriter::writeData
+    (
+        Ostream& os,
+        const vector& v
+    )
+    {
+        os  << v[0] << ' ' << v[1] << ' ' << v[2] << nl;
+    }
+
+
+    template<>
+    inline void Foam::starcdSurfaceWriter::writeData
+    (
+        Ostream& os,
+        const sphericalTensor& v
+    )
+    {
+        os  << v[0] << nl;
+    }
+
+}
+
+
+template<class Type>
+inline void Foam::starcdSurfaceWriter::writeData
+(
+    Ostream& os,
+    const Type& v
+)
+{}
+
+
+template<class Type>
+void Foam::starcdSurfaceWriter::writeTemplate
+(
+    const fileName& outputDir,
+    const fileName& surfaceName,
+    const pointField& points,
+    const faceList& faces,
+    const word& fieldName,
+    const Field<Type>& values,
+    const bool isNodeValues,
+    const bool verbose
+) const
+{
+    if (!isDir(outputDir))
+    {
+        mkDir(outputDir);
+    }
+
+    OFstream os(outputDir/fieldName + '_' + surfaceName + ".usr");
+
+    if (verbose)
+    {
+        Info<< "Writing field " << fieldName << " to " << os.name() << endl;
+    }
+
+    // no header, just write values
+    forAll(values, elemI)
+    {
+        os  << elemI+1 << ' ';
+        writeData(os, values[elemI]);
+    }
+}
+
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::starcdSurfaceWriter::starcdSurfaceWriter()
+:
+    surfaceWriter()
+{}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::starcdSurfaceWriter::~starcdSurfaceWriter()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+void Foam::starcdSurfaceWriter::write
+(
+    const fileName& outputDir,
+    const fileName& surfaceName,
+    const pointField& points,
+    const faceList& faces,
+    const bool verbose
+) const
+{
+    if (!isDir(outputDir))
+    {
+        mkDir(outputDir);
+    }
+
+    fileName outName(outputDir/surfaceName + ".inp");
+
+    if (verbose)
+    {
+        Info<< "Writing geometry to " << outName << endl;
+    }
+
+    MeshedSurfaceProxy<face>(points, faces).write(outName);
+}
+
+
+// create write methods
+defineSurfaceWriterWriteField(Foam::starcdSurfaceWriter, scalar);
+defineSurfaceWriterWriteField(Foam::starcdSurfaceWriter, vector);
+defineSurfaceWriterWriteField(Foam::starcdSurfaceWriter, sphericalTensor);
+
+
+// ************************************************************************* //
diff --git a/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.H b/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.H
new file mode 100644
index 0000000000000000000000000000000000000000..bf0a0eb82454585182535772d479364f00b704c9
--- /dev/null
+++ b/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.H
@@ -0,0 +1,181 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2008-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::starcdSurfaceWriter
+
+Description
+    A surfaceWriter for STARCD files.
+
+    The geometry is written via the MeshedSurfaceProxy, the fields
+    are written in a trivial ASCII format with ID and VALUE as
+    so-called user data. These @c .usr files can be read into proSTAR
+    with these types of commands. For element data:
+     @verbatim
+        getuser FILENAME.usr cell scalar free
+        getuser FILENAME.usr cell vector free
+    @endverbatim
+    and for vertex data:
+    @verbatim
+        getuser FILENAME.usr vertex scalar free
+        getuser FILENAME.usr vertex vector free
+    @endverbatim
+
+Note
+    Only scalar and vector fields are supported directly.
+    A sphericalTensor is written as a scalar.
+    Other field types are not written.
+
+SourceFiles
+    starcdSurfaceWriter.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef starcdSurfaceWriter_H
+#define starcdSurfaceWriter_H
+
+#include "surfaceWriter.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+                     Class starcdSurfaceWriter Declaration
+\*---------------------------------------------------------------------------*/
+
+class starcdSurfaceWriter
+:
+    public surfaceWriter
+{
+    // Private Member Functions
+
+        template<class Type>
+        static inline void writeData(Ostream&, const Type&);
+
+
+        //- Templated write operation
+        template<class Type>
+        void writeTemplate
+        (
+            const fileName& outputDir,
+            const fileName& surfaceName,
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,
+            const Field<Type>& values,
+            const bool isNodeValues,
+            const bool verbose
+        ) const;
+
+
+public:
+
+    //- Runtime type information
+    TypeName("starcd");
+
+
+    // Constructors
+
+        //- Construct null
+        starcdSurfaceWriter();
+
+
+    //- Destructor
+    virtual ~starcdSurfaceWriter();
+
+
+    // Member Functions
+
+        //- True if the surface format supports geometry in a separate file.
+        //  False if geometry and field must be in a single file
+        virtual bool separateGeometry()
+        {
+            return true;
+        }
+
+        //- Write single surface geometry to file.
+        virtual void write
+        (
+            const fileName& outputDir,
+            const fileName& surfaceName,
+            const pointField& points,
+            const faceList& faces,
+            const bool verbose = false
+        ) const;
+
+        //- Write scalarField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<scalar>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const;
+
+        //- Write vectorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<vector>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const;
+
+        //- Write sphericalTensorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<sphericalTensor>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const;
+
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/sampling/sampledSurface/writers/surfaceWriter.C b/src/sampling/sampledSurface/writers/surfaceWriter.C
index d4ebc9c2222ca06addfcb38a94ecfd909bc0c8f1..f297e0934fa86ab1cb07a247688722c48a1495c6 100644
--- a/src/sampling/sampledSurface/writers/surfaceWriter.C
+++ b/src/sampling/sampledSurface/writers/surfaceWriter.C
@@ -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,47 +26,44 @@ License
 #include "surfaceWriter.H"
 
 #include "MeshedSurfaceProxy.H"
-#include "nullSurfaceWriter.H"
 #include "proxySurfaceWriter.H"
 
 #include "HashTable.H"
 #include "word.H"
+#include "addToRunTimeSelectionTable.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
-template<class Type>
-Foam::autoPtr< Foam::surfaceWriter<Type> >
-Foam::surfaceWriter<Type>::New(const word& writeType)
+namespace Foam
 {
-    typename wordConstructorTable::iterator cstrIter =
+    defineTypeNameAndDebug(surfaceWriter, 0);
+    defineRunTimeSelectionTable(surfaceWriter, word);
+    defineRunTimeSelectionTable(surfaceWriter, wordDict);
+    addNamedToRunTimeSelectionTable
+    (
+        surfaceWriter,
+        surfaceWriter,
+        word,
+        null
+    );
+}
+
+
+// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
+
+Foam::autoPtr<Foam::surfaceWriter>
+Foam::surfaceWriter::New(const word& writeType)
+{
+    wordConstructorTable::iterator cstrIter =
         wordConstructorTablePtr_->find(writeType);
 
     if (cstrIter == wordConstructorTablePtr_->end())
     {
-        // not supported for this data type, but it generally does work
-        // (it handles the 'bool' specialization - ie, geometry write)
-        if
-        (
-            Foam::surfaceWriter<bool>::wordConstructorTablePtr_->found
-            (
-                writeType
-            )
-        )
-        {
-            // use 'null' handler instead
-            return autoPtr< surfaceWriter<Type> >
-            (
-                new nullSurfaceWriter<Type>()
-            );
-        }
-        else if (MeshedSurfaceProxy<face>::canWriteType(writeType))
+        if (MeshedSurfaceProxy<face>::canWriteType(writeType))
         {
             // generally unknown, but can be written via MeshedSurfaceProxy
             // use 'proxy' handler instead
-            return autoPtr< surfaceWriter<Type> >
-            (
-                new proxySurfaceWriter<Type>(writeType)
-            );
+            return autoPtr<surfaceWriter>(new proxySurfaceWriter(writeType));
         }
 
         if (cstrIter == wordConstructorTablePtr_->end())
@@ -83,24 +80,37 @@ Foam::surfaceWriter<Type>::New(const word& writeType)
         }
     }
 
-    return autoPtr< surfaceWriter<Type> >(cstrIter()());
+    return autoPtr<surfaceWriter>(cstrIter()());
+}
+
+
+Foam::autoPtr<Foam::surfaceWriter>
+Foam::surfaceWriter::New(const word& writeType, const dictionary& optDict)
+{
+    // find constructors with dictionary options
+    wordDictConstructorTable::iterator cstrIter =
+        wordDictConstructorTablePtr_->find(writeType);
+
+    if (cstrIter == wordDictConstructorTablePtr_->end())
+    {
+        // revert to versions without options
+        return Foam::surfaceWriter::New(writeType);
+    }
+
+    return autoPtr<surfaceWriter>(cstrIter()(optDict));
 }
 
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template<class Type>
-Foam::surfaceWriter<Type>::surfaceWriter()
+Foam::surfaceWriter::surfaceWriter()
 {}
 
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-template<class Type>
-Foam::surfaceWriter<Type>::~surfaceWriter()
+Foam::surfaceWriter::~surfaceWriter()
 {}
 
 
-// * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
-
 // ************************************************************************* //
diff --git a/src/sampling/sampledSurface/writers/surfaceWriter.H b/src/sampling/sampledSurface/writers/surfaceWriter.H
index d17db7a3f3a2bcfbf867ce6a8c5a5bb149f7b69a..be265178499d6905c47b45409f1963841106c9ce 100644
--- a/src/sampling/sampledSurface/writers/surfaceWriter.H
+++ b/src/sampling/sampledSurface/writers/surfaceWriter.H
@@ -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
@@ -34,7 +34,7 @@ SourceFiles
 #ifndef surfaceWriter_H
 #define surfaceWriter_H
 
-#include "Field.H"
+#include "volFields.H"
 #include "typeInfo.H"
 #include "autoPtr.H"
 #include "pointField.H"
@@ -48,22 +48,12 @@ SourceFiles
 namespace Foam
 {
 
-// Forward declaration of friend functions and operators
-
-template<class Type> class surfaceWriter;
-template<class Type> class nullSurfaceWriter;
-template<class Type> class proxySurfaceWriter;
-
 /*---------------------------------------------------------------------------*\
                         Class surfaceWriter Declaration
 \*---------------------------------------------------------------------------*/
 
-template<class Type>
 class surfaceWriter
 {
-    //- friendship between writer data types
-    template<class Type2> friend class surfaceWriter;
-
 public:
 
     //- Runtime type information
@@ -80,11 +70,30 @@ public:
             ()
         );
 
+        declareRunTimeSelectionTable
+        (
+            autoPtr,
+            surfaceWriter,
+            wordDict,
+            (
+                const dictionary& optDict
+            ),
+            (optDict)
+        );
+
 
     // Selectors
 
         //- Return a reference to the selected surfaceWriter
-        static autoPtr<surfaceWriter> New(const word& writeFormat);
+        static autoPtr<surfaceWriter> New(const word& writeType);
+
+        //- Return a reference to the selected surfaceWriter
+        //  Select with extra write option
+        static autoPtr<surfaceWriter> New
+        (
+            const word& writeType,
+            const dictionary& writeOptions
+        );
 
 
     // Constructors
@@ -99,14 +108,15 @@ public:
 
     // Member Functions
 
-        //- Return true if the surface format supports separate files
-        virtual bool separateFiles()
+        //- True if the surface format supports geometry in a separate file.
+        //  False if geometry and field must be in a single file
+        virtual bool separateGeometry()
         {
             return false;
         }
 
 
-        //- Writes single surface geometry to file.
+        //- Write single surface geometry to file.
         virtual void write
         (
             const fileName& outputDir,      // <root>/<case>/surface/TIME
@@ -118,8 +128,8 @@ public:
         {}
 
 
-        //- Writes single surface to file. Either one value per vertex or
-        //  one value per face (isNodeValues = false)
+        //- Write scalarField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
         virtual void write
         (
             const fileName& outputDir,      // <root>/<case>/surface/TIME
@@ -127,22 +137,79 @@ public:
             const pointField& points,
             const faceList& faces,
             const word& fieldName,          // name of field
-            const Field<Type>& values,
+            const Field<scalar>& values,
             const bool isNodeValues,
             const bool verbose = false
-        ) const = 0;
-};
+        ) const
+        {}
 
+        //- Write vectorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<vector>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const
+        {}
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+        //- Write sphericalTensorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<sphericalTensor>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const
+        {}
+
+        //- Write symmTensorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<symmTensor>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const
+        {}
+
+        //- Write tensorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<tensor>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const
+        {}
+
+
+};
 
-} // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-#ifdef NoRepository
-#   include "surfaceWriter.C"
-#endif
+} // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/sampling/sampledSurface/writers/surfaceWriters.C b/src/sampling/sampledSurface/writers/surfaceWriters.C
deleted file mode 100644
index 5a677c793ee281d2d4f04ad048da406636351f14..0000000000000000000000000000000000000000
--- a/src/sampling/sampledSurface/writers/surfaceWriters.C
+++ /dev/null
@@ -1,50 +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 "surfaceWriters.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-#define defineSurfaceWriterType(dataType)                                     \
-    defineNamedTemplateTypeNameAndDebug(surfaceWriter< dataType >, 0);        \
-    defineTemplatedRunTimeSelectionTable(surfaceWriter, word, dataType)
-
-defineSurfaceWriterType(bool);
-
-defineSurfaceWriterType(scalar);
-defineSurfaceWriterType(vector);
-defineSurfaceWriterType(sphericalTensor);
-defineSurfaceWriterType(symmTensor);
-defineSurfaceWriterType(tensor);
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// ************************************************************************* //
diff --git a/src/sampling/sampledSurface/writers/surfaceWriters.H b/src/sampling/sampledSurface/writers/surfaceWriters.H
deleted file mode 100644
index 0369d2e993748ef5d968cd215ff3e87714e83b20..0000000000000000000000000000000000000000
--- a/src/sampling/sampledSurface/writers/surfaceWriters.H
+++ /dev/null
@@ -1,76 +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/>.
-
-InClass
-    Foam::surfaceWriters
-
-Description
-
-\*---------------------------------------------------------------------------*/
-
-#ifndef surfaceWriters_H
-#define surfaceWriters_H
-
-#include "surfaceWriter.H"
-#include "fieldTypes.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Only used internally
-#define makeTypeSurfaceWritersTypeName(typeWriter, dataType)                 \
-                                                                             \
-    defineNamedTemplateTypeNameAndDebug(typeWriter< dataType >, 0)
-
-// Sometimes used externally
-#define makeSurfaceWritersTypeName(typeWriter)                               \
-                                                                             \
-    makeTypeSurfaceWritersTypeName(typeWriter, scalar);                      \
-    makeTypeSurfaceWritersTypeName(typeWriter, vector);                      \
-    makeTypeSurfaceWritersTypeName(typeWriter, sphericalTensor);             \
-    makeTypeSurfaceWritersTypeName(typeWriter, symmTensor);                  \
-    makeTypeSurfaceWritersTypeName(typeWriter, tensor)
-
-// Define type info for single dataType template instantiation (eg, vector)
-#define makeSurfaceWriterType(typeWriter, dataType)                          \
-                                                                             \
-    defineNamedTemplateTypeNameAndDebug(typeWriter< dataType >, 0);          \
-    addTemplatedToRunTimeSelectionTable                                      \
-    (                                                                        \
-        surfaceWriter, typeWriter, dataType, word                            \
-    )
-
-
-// Define type info for scalar, vector etc. instantiations
-#define makeSurfaceWriters(typeWriter)                                       \
-                                                                             \
-    makeSurfaceWriterType(typeWriter, scalar);                               \
-    makeSurfaceWriterType(typeWriter, vector);                               \
-    makeSurfaceWriterType(typeWriter, sphericalTensor);                      \
-    makeSurfaceWriterType(typeWriter, symmTensor);                           \
-    makeSurfaceWriterType(typeWriter, tensor)
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#endif
-
-// ************************************************************************* //
diff --git a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.C b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.C
index 085dbd67d09e749297719392b23f026005472f92..2f333a95158cf489397383d1e046c26395bd30ed 100644
--- a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.C
+++ b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.C
@@ -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) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -28,10 +28,19 @@ License
 #include "OFstream.H"
 #include "OSspecific.H"
 
+#include "makeSurfaceWriterMethods.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    makeSurfaceWriterType(vtkSurfaceWriter);
+}
+
+
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-template<class Type>
-void Foam::vtkSurfaceWriter<Type>::writeGeometry
+void Foam::vtkSurfaceWriter::writeGeometry
 (
     Ostream& os,
     const pointField& points,
@@ -71,12 +80,12 @@ void Foam::vtkSurfaceWriter<Type>::writeGeometry
     {
         const face& f = faces[faceI];
 
-        os << f.size();
+        os  << f.size();
         forAll(f, fp)
         {
-            os << ' ' << f[fp];
+            os  << ' ' << f[fp];
         }
-        os << nl;
+        os  << nl;
     }
 }
 
@@ -84,15 +93,14 @@ void Foam::vtkSurfaceWriter<Type>::writeGeometry
 namespace Foam
 {
 
-    // Write scalarField in vtk format
     template<>
-    void Foam::vtkSurfaceWriter<Foam::scalar>::writeData
+    void Foam::vtkSurfaceWriter::writeData
     (
         Ostream& os,
-        const Field<Foam::scalar>& values
+        const Field<scalar>& values
     )
     {
-        os << "1 " << values.size() << " float" << nl;
+        os  << "1 " << values.size() << " float" << nl;
 
         forAll(values, elemI)
         {
@@ -100,29 +108,28 @@ namespace Foam
             {
                 if (elemI % 10)
                 {
-                    os << ' ';
+                    os  << ' ';
                 }
                 else
                 {
-                    os << nl;
+                    os  << nl;
                 }
             }
 
-            const scalar v = values[elemI];
-            os << float(v);
+            os  << float(values[elemI]);
         }
-        os << nl;
+        os  << nl;
     }
 
-    // Write vectorField in vtk format
+
     template<>
-    void Foam::vtkSurfaceWriter<Foam::vector>::writeData
+    void Foam::vtkSurfaceWriter::writeData
     (
         Ostream& os,
-        const Field<Foam::vector>& values
+        const Field<vector>& values
     )
     {
-        os << "3 " << values.size() << " float" << nl;
+        os  << "3 " << values.size() << " float" << nl;
 
         forAll(values, elemI)
         {
@@ -133,33 +140,31 @@ namespace Foam
     }
 
 
-    // Write sphericalTensorField in vtk format
     template<>
-    void Foam::vtkSurfaceWriter<Foam::sphericalTensor>::writeData
+    void Foam::vtkSurfaceWriter::writeData
     (
         Ostream& os,
         const Field<sphericalTensor>& values
     )
     {
-        os << "1 " << values.size() << " float" << nl;
+        os  << "1 " << values.size() << " float" << nl;
 
         forAll(values, elemI)
         {
             const sphericalTensor& v = values[elemI];
-            os << float(v[0]) << nl;
+            os  << float(v[0]) << nl;
         }
     }
 
 
-    // Write symmTensorField in vtk format
     template<>
-    void Foam::vtkSurfaceWriter<Foam::symmTensor>::writeData
+    void Foam::vtkSurfaceWriter::writeData
     (
         Ostream& os,
         const Field<symmTensor>& values
     )
     {
-        os << "6 " << values.size() << " float" << nl;
+        os  << "6 " << values.size() << " float" << nl;
 
         forAll(values, elemI)
         {
@@ -172,15 +177,14 @@ namespace Foam
     }
 
 
-    // Write tensorField in vtk format
     template<>
-    void Foam::vtkSurfaceWriter<Foam::tensor>::writeData
+    void Foam::vtkSurfaceWriter::writeData
     (
         Ostream& os,
         const Field<tensor>& values
     )
     {
-        os << "9 " << values.size() << " float" << nl;
+        os  << "9 " << values.size() << " float" << nl;
 
         forAll(values, elemI)
         {
@@ -197,47 +201,31 @@ namespace Foam
 
 // Write generic field in vtk format
 template<class Type>
-void Foam::vtkSurfaceWriter<Type>::writeData
+void Foam::vtkSurfaceWriter::writeData
 (
     Ostream& os,
     const Field<Type>& values
 )
 {
-    os << "1 " << values.size() << " float" << nl;
+    os  << "1 " << values.size() << " float" << nl;
 
     forAll(values, elemI)
     {
-        os << float(0) << nl;
+        os  << float(0) << nl;
     }
 }
 
 
-// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
-
-// Construct from components
 template<class Type>
-Foam::vtkSurfaceWriter<Type>::vtkSurfaceWriter()
-:
-    surfaceWriter<Type>()
-{}
-
-
-// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
-
-template<class Type>
-Foam::vtkSurfaceWriter<Type>::~vtkSurfaceWriter()
-{}
-
-
-// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
-
-template<class Type>
-void Foam::vtkSurfaceWriter<Type>::write
+void Foam::vtkSurfaceWriter::writeTemplate
 (
     const fileName& outputDir,
     const fileName& surfaceName,
     const pointField& points,
     const faceList& faces,
+    const word& fieldName,
+    const Field<Type>& values,
+    const bool isNodeValues,
     const bool verbose
 ) const
 {
@@ -246,28 +234,56 @@ void Foam::vtkSurfaceWriter<Type>::write
         mkDir(outputDir);
     }
 
-    fileName fName(outputDir/surfaceName + ".vtk");
+    OFstream os(outputDir/fieldName + '_' + surfaceName + ".vtk");
 
     if (verbose)
     {
-        Info<< "Writing geometry to " << fName << endl;
+        Info<< "Writing field " << fieldName << " to " << os.name() << endl;
     }
 
-    OFstream os(fName);
     writeGeometry(os, points, faces);
+
+    // start writing data
+    if (isNodeValues)
+    {
+        os  << "POINT_DATA ";
+    }
+    else
+    {
+        os  << "CELL_DATA ";
+    }
+
+    os  << values.size() << nl
+        << "FIELD attributes 1" << nl
+        << fieldName << " ";
+
+    // Write data
+    writeData(os, values);
 }
 
 
-template<class Type>
-void Foam::vtkSurfaceWriter<Type>::write
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::vtkSurfaceWriter::vtkSurfaceWriter()
+:
+    surfaceWriter()
+{}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::vtkSurfaceWriter::~vtkSurfaceWriter()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+void Foam::vtkSurfaceWriter::write
 (
     const fileName& outputDir,
     const fileName& surfaceName,
     const pointField& points,
     const faceList& faces,
-    const word& fieldName,
-    const Field<Type>& values,
-    const bool isNodeValues,
     const bool verbose
 ) const
 {
@@ -276,36 +292,19 @@ void Foam::vtkSurfaceWriter<Type>::write
         mkDir(outputDir);
     }
 
-    OFstream os
-    (
-        outputDir/fieldName + '_' + surfaceName + ".vtk"
-    );
+    OFstream os(outputDir/surfaceName + ".vtk");
 
     if (verbose)
     {
-        Info<< "Writing field " << fieldName << " to " << os.name() << endl;
+        Info<< "Writing geometry to " << os.name() << endl;
     }
 
     writeGeometry(os, points, faces);
+}
 
-    // start writing data
-    if (isNodeValues)
-    {
-        os  << "POINT_DATA ";
-    }
-    else
-    {
-        os  << "CELL_DATA ";
-    }
-
-    os  << values.size() << nl
-        << "FIELD attributes 1" << nl
-        << fieldName << " ";
-
-    // Write data
-    writeData(os, values);
 
-}
+// create write methods
+defineSurfaceWriterWriteFields(Foam::vtkSurfaceWriter);
 
 
 // ************************************************************************* //
diff --git a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.H b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.H
index bc13be23c2a29c46706d44e849dad190d32a345d..322159094b7ff918e376888b6bb4891cc6b76d4e 100644
--- a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.H
+++ b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.H
@@ -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) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -25,6 +25,7 @@ Class
     Foam::vtkSurfaceWriter
 
 Description
+    A surfaceWriter for VTK legacy format.
 
 SourceFiles
     vtkSurfaceWriter.C
@@ -42,21 +43,35 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                     Class vtkSurfaceWriter Declaration
+                      Class vtkSurfaceWriter Declaration
 \*---------------------------------------------------------------------------*/
 
-template<class Type>
 class vtkSurfaceWriter
 :
-    public surfaceWriter<Type>
+    public surfaceWriter
 {
     // Private Member Functions
 
         static void writeGeometry(Ostream&, const pointField&, const faceList&);
 
-        static void writeData(Ostream&, const Field<Type>& values);
+        template<class Type>
+        static void writeData(Ostream&, const Field<Type>&);
 
 
+        //- Templated write operation
+        template<class Type>
+        void writeTemplate
+        (
+            const fileName& outputDir,
+            const fileName& surfaceName,
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,
+            const Field<Type>& values,
+            const bool isNodeValues,
+            const bool verbose
+        ) const;
+
 public:
 
     //- Runtime type information
@@ -75,9 +90,7 @@ public:
 
     // Member Functions
 
-        // Write
-
-        //- Write geometry to file.
+        //- Write single surface geometry to file.
         virtual void write
         (
             const fileName& outputDir,
@@ -88,30 +101,82 @@ public:
         ) const;
 
 
-        //- Writes single surface to file.
+        //- Write scalarField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
         virtual void write
         (
-            const fileName& outputDir,
-            const fileName& surfaceName,
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
             const pointField& points,
             const faceList& faces,
-            const word& fieldName,
-            const Field<Type>& values,
+            const word& fieldName,          // name of field
+            const Field<scalar>& values,
             const bool isNodeValues,
             const bool verbose = false
         ) const;
-};
 
+        //- Write vectorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<vector>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const;
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+        //- Write sphericalTensorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<sphericalTensor>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const;
+
+        //- Write symmTensorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<symmTensor>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const;
+
+        //- Write tensorField for a single surface to file.
+        //  One value per face or vertex (isNodeValues = true)
+        virtual void write
+        (
+            const fileName& outputDir,      // <root>/<case>/surface/TIME
+            const fileName& surfaceName,    // name of surface
+            const pointField& points,
+            const faceList& faces,
+            const word& fieldName,          // name of field
+            const Field<tensor>& values,
+            const bool isNodeValues,
+            const bool verbose = false
+        ) const;
+
+};
 
-} // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-#ifdef NoRepository
-#   include "vtkSurfaceWriter.C"
-#endif
+} // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriterRunTime.C b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriterRunTime.C
deleted file mode 100644
index 1901acfef6888d890ac54f77e59003b847d5289a..0000000000000000000000000000000000000000
--- a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriterRunTime.C
+++ /dev/null
@@ -1,44 +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 "vtkSurfaceWriter.H"
-#include "surfaceWriters.H"
-#include "addToRunTimeSelectionTable.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-makeSurfaceWriterType(vtkSurfaceWriter, bool);
-makeSurfaceWriters(vtkSurfaceWriter);
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// ************************************************************************* //
diff --git a/src/thermophysicalModels/Allwmake b/src/thermophysicalModels/Allwmake
index 9af7348683a94ef7ab977d097dd14d029390bec3..b62c36aa5de3239cc699f7739b9e8e1c68a61dac 100755
--- a/src/thermophysicalModels/Allwmake
+++ b/src/thermophysicalModels/Allwmake
@@ -1,10 +1,8 @@
 #!/bin/sh
 cd ${0%/*} || exit 1    # run from this directory
+[ $# -ge 1 ] && makeOption=$1 || makeOption=libso
 set -x
 
-makeOption=libso
-[ $# -ge 1 ] && makeOption=$1
-
 wmake $makeOption specie
 wmake $makeOption solid
 wmake $makeOption thermophysicalFunctions
diff --git a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomialI.H b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomialI.H
index f1eeacef9eccb973971bf9273d80c2e2fc89b429..b81ab6f80d1d2cbb82da8097fac4cdc09cd3d2b5 100644
--- a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomialI.H
+++ b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomialI.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2008-2010 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -99,7 +99,7 @@ Foam::icoPolynomial<PolySize>::New(const dictionary& dict)
 template<int PolySize>
 inline Foam::scalar Foam::icoPolynomial<PolySize>::rho(scalar, scalar T) const
 {
-    return rhoCoeffs_.evaluate(T)/this->W();
+    return rhoCoeffs_.value(T)/this->W();
 }
 
 
diff --git a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C
index 1b04a9d47c1b0a6bb71979b959590f6afff0acd6..15269f6ce2c7c625819006e7dbff30f6ccf1665d 100644
--- a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C
+++ b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2008-2010 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -49,10 +49,10 @@ Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo
     sCoeffs_ = CpCoeffs_.integrateMinus1();
 
     // Offset h poly so that it is relative to the enthalpy at Tstd
-    hCoeffs_[0] += Hf_ - hCoeffs_.evaluate(specie::Tstd);
+    hCoeffs_[0] += Hf_ - hCoeffs_.value(specie::Tstd);
 
     // Offset s poly so that it is relative to the entropy at Tstd
-    sCoeffs_[0] += Sf_ - sCoeffs_.evaluate(specie::Tstd);
+    sCoeffs_[0] += Sf_ - sCoeffs_.value(specie::Tstd);
 }
 
 
@@ -77,10 +77,10 @@ Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo
     sCoeffs_ = CpCoeffs_.integrateMinus1();
 
     // Offset h poly so that it is relative to the enthalpy at Tstd
-    hCoeffs_[0] += Hf_ - hCoeffs_.evaluate(specie::Tstd);
+    hCoeffs_[0] += Hf_ - hCoeffs_.value(specie::Tstd);
 
     // Offset s poly so that it is relative to the entropy at Tstd
-    sCoeffs_[0] += Sf_ - sCoeffs_.evaluate(specie::Tstd);
+    sCoeffs_[0] += Sf_ - sCoeffs_.value(specie::Tstd);
 }
 
 
diff --git a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermoI.H b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermoI.H
index 1576c646d0b7318514b04826fb246e6e7ad69a72..b41de9b877f04ddb5caeae7ebc2f9e4bc25b5c3c 100644
--- a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermoI.H
+++ b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermoI.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2008-2010 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -88,7 +88,7 @@ inline Foam::scalar Foam::hPolynomialThermo<EquationOfState, PolySize>::cp
     const scalar T
 ) const
 {
-    return CpCoeffs_.evaluate(T);
+    return CpCoeffs_.value(T);
 }
 
 
@@ -98,7 +98,7 @@ inline Foam::scalar Foam::hPolynomialThermo<EquationOfState, PolySize>::h
     const scalar T
 ) const
 {
-    return hCoeffs_.evaluate(T);
+    return hCoeffs_.value(T);
 }
 
 
@@ -126,7 +126,7 @@ inline Foam::scalar Foam::hPolynomialThermo<EquationOfState, PolySize>::s
     const scalar T
 ) const
 {
-    return sCoeffs_.evaluate(T);
+    return sCoeffs_.value(T);
 }
 
 
diff --git a/src/thermophysicalModels/specie/transport/polynomial/polynomialTransportI.H b/src/thermophysicalModels/specie/transport/polynomial/polynomialTransportI.H
index 52094247fb7f7b531cd7d47fedeb8a1fb0dc37a1..d87dcd5657e2a2330dedc99dd009f422d980071c 100644
--- a/src/thermophysicalModels/specie/transport/polynomial/polynomialTransportI.H
+++ b/src/thermophysicalModels/specie/transport/polynomial/polynomialTransportI.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2008-2010 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 2008-2011 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -107,7 +107,7 @@ inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::mu
     const scalar T
 ) const
 {
-    return muCoeffs_.evaluate(T)/this->W();
+    return muCoeffs_.value(T)/this->W();
 }
 
 
@@ -117,7 +117,7 @@ inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::kappa
     const scalar T
 ) const
 {
-    return kappaCoeffs_.evaluate(T)/this->W();
+    return kappaCoeffs_.value(T)/this->W();
 }
 
 
diff --git a/src/transportModels/Allwmake b/src/transportModels/Allwmake
index 703920418da6924072095e237d64793d8c64401e..f0eba94263ea1be6267d34f1dc7781621c5466e9 100755
--- a/src/transportModels/Allwmake
+++ b/src/transportModels/Allwmake
@@ -1,10 +1,8 @@
 #!/bin/sh
 cd ${0%/*} || exit 1    # run from this directory
+[ $# -ge 1 ] && makeOption=$1 || makeOption=libso
 set -x
 
-makeOption=libso
-[ $# -ge 1 ] && makeOption=$1
-
 wmake $makeOption incompressible
 wmake $makeOption interfaceProperties
 wmake $makeOption twoPhaseInterfaceProperties
diff --git a/src/turbulenceModels/LES/Allwmake b/src/turbulenceModels/LES/Allwmake
index 107251b4221630bc1ff43cba97bf08dabd3950f0..d24309692e25aa1d0b6b6489dfc5d1bd8c18608f 100755
--- a/src/turbulenceModels/LES/Allwmake
+++ b/src/turbulenceModels/LES/Allwmake
@@ -1,10 +1,8 @@
 #!/bin/sh
 cd ${0%/*} || exit 1    # run from this directory
+[ $# -ge 1 ] && makeOption=$1 || makeOption=libso
 set -x
 
-makeOption=libso
-[ $# -ge 1 ] && makeOption=$1
-
 wmakeLnInclude ../incompressible/LES
 
 wmake $makeOption LESfilters
diff --git a/src/turbulenceModels/compressible/Allwmake b/src/turbulenceModels/compressible/Allwmake
index a16b5f9c81fb05c199c7640d60fd779896e6516b..60605f926d6781f193ed657f261c8a3f7838a271 100755
--- a/src/turbulenceModels/compressible/Allwmake
+++ b/src/turbulenceModels/compressible/Allwmake
@@ -1,10 +1,8 @@
 #!/bin/sh
 cd ${0%/*} || exit 1    # run from this directory
+[ $# -ge 1 ] && makeOption=$1 || makeOption=libso
 set -x
 
-makeOption=libso
-[ $# -ge 1 ] && makeOption=$1
-
 wmake $makeOption turbulenceModel
 wmake $makeOption RAS
 wmake $makeOption LES
diff --git a/src/turbulenceModels/compressible/LES/Smagorinsky/Smagorinsky.C b/src/turbulenceModels/compressible/LES/Smagorinsky/Smagorinsky.C
index 519637719719eaf9d5ccd1d0d6cbfc1a0eb64e17..12dae220d8046e73b180f51e26004d13d47833f8 100644
--- a/src/turbulenceModels/compressible/LES/Smagorinsky/Smagorinsky.C
+++ b/src/turbulenceModels/compressible/LES/Smagorinsky/Smagorinsky.C
@@ -51,7 +51,7 @@ void Smagorinsky::updateSubGridScaleFields(const volTensorField& gradU)
     volScalarField b((2.0/3.0)*tr(D));
     volScalarField c(2*ck_*delta()*(dev(D) && D));
 
-    volScalarField k = sqr((-b + sqrt(sqr(b) + 4*a*c))/(2*a));
+    volScalarField k(sqr((-b + sqrt(sqr(b) + 4*a*c))/(2*a)));
 
     muSgs_ = ck_*rho()*delta()*sqrt(k);
     muSgs_.correctBoundaryConditions();
diff --git a/src/turbulenceModels/incompressible/Allwmake b/src/turbulenceModels/incompressible/Allwmake
index a16b5f9c81fb05c199c7640d60fd779896e6516b..60605f926d6781f193ed657f261c8a3f7838a271 100755
--- a/src/turbulenceModels/incompressible/Allwmake
+++ b/src/turbulenceModels/incompressible/Allwmake
@@ -1,10 +1,8 @@
 #!/bin/sh
 cd ${0%/*} || exit 1    # run from this directory
+[ $# -ge 1 ] && makeOption=$1 || makeOption=libso
 set -x
 
-makeOption=libso
-[ $# -ge 1 ] && makeOption=$1
-
 wmake $makeOption turbulenceModel
 wmake $makeOption RAS
 wmake $makeOption LES
diff --git a/wmake/rules/General/version b/wmake/rules/General/version
index 11f83c7b746d942212da652b728f82a181a26948..19633ffc9dca7796939cdd4fe33b7ae9a1f4fd18 100644
--- a/wmake/rules/General/version
+++ b/wmake/rules/General/version
@@ -4,8 +4,8 @@
 # update version strings in C++ file and in $WM_PROJECT_DIR/.build file
 #
 Cvertoo = \
-    sed -e 's/VERSION_STRING/$(shell wmakePrintBuild -major)/' \
-        -e 's/BUILD_STRING/$(shell wmakePrintBuild -update)/' \
+    sed -e 's!VERSION_STRING!$(shell wmakePrintBuild -major)!' \
+        -e 's!BUILD_STRING!$(shell wmakePrintBuild -update)!' \
         $$SOURCE > $*.C; \
     $(CC) $(c++FLAGS) -c $*.C -o $@
 
diff --git a/wmake/wmakePrintBuild b/wmake/wmakePrintBuild
index 4b705036875a37cad1c73d40a2ab5b778b940c6d..3812bece3e9e2cfbf9bc26d4d8dc85ba52a81104 100755
--- a/wmake/wmakePrintBuild
+++ b/wmake/wmakePrintBuild
@@ -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) 2008-2011 OpenCFD Ltd.
 #    \\/     M anipulation  |
 #-------------------------------------------------------------------------------
 # License
@@ -30,6 +30,8 @@
 #
 #------------------------------------------------------------------------------
 usage() {
+    exec 1>&2
+
     while [ "$#" -ge 1 ]; do echo "$1"; shift; done
     cat<<USAGE
 usage: ${0##*/} [OPTION]
@@ -38,6 +40,7 @@ options:
                   (exit code 0 for no changes)
   -major          report \$WM_PROJECT_VERSION only and exit
   -update         update \$WM_PROJECT_DIR/.build from the git information
+  -pkg TAG        specify packager/release tag ('none' marks an empty packager)
   -version VER    specify an alternative version
 
 Print the version used when building the project, in this order of precedence:
@@ -50,7 +53,7 @@ USAGE
 }
 #------------------------------------------------------------------------------
 
-unset checkOnly update version
+unset checkOnly update package version oldPackage oldVersion
 
 # parse options
 while [ "$#" -gt 0 ]
@@ -71,6 +74,12 @@ do
         update=true
         shift
         ;;
+    -pkg | -package)
+        [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
+        # mark empty as 'none', disallow '!' and spaces in string
+        package=$(echo "${2:-none}" | sed -e 's/!//g' -e 's/ //g')
+        shift 2
+        ;;
     -v | -version)
         [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
         version="$2"
@@ -88,7 +97,31 @@ done
 # persistent build tag
 #
 build="$WM_PROJECT_DIR/.build"
-previous=$(tail -1 $build 2>/dev/null)
+
+# retrieve old values from the $WM_PROJECT_DIR/.build cache, stored as
+#     version [packager]
+set -- $(tail -1 $build 2>/dev/null)
+
+oldVersion="$1"; shift
+oldPackage="$@"
+[ "${oldPackage:-none}" = none ] && unset oldPackage
+
+
+#
+# printTag - output the build tag
+# reuses the old -package tag if needed
+#
+printTag()
+{
+    if [ "${package:-${oldPackage:-none}}" = none ]
+    then
+        echo "$version"
+    else
+        echo "$version ${package:-$oldPackage}"
+    fi
+}
+
+
 
 if [ -n "$version" ]
 then
@@ -115,12 +148,17 @@ else
 fi
 
 
+#
 # update persistent build tag if possible
-if [ $rc -eq 0 -a -n "$update" -a "$version" != "$previous" ]
+#
+if [ $rc -eq 0 -a -n "$update" ]
 then
-    if [ -w "$build" -o \( -w "$WM_PROJECT_DIR" -a ! -e "$build" \) ]
+    if [ "$version:$package" != "$oldVersion:$oldPackage" ]
     then
-        echo $version >| "$build" 2>/dev/null
+        if [ -w "$build" -o \( -w "$WM_PROJECT_DIR" -a ! -e "$build" \) ]
+        then
+            printTag >| "$build" 2>/dev/null
+        fi
     fi
 fi
 
@@ -130,32 +168,38 @@ if [ -n "$checkOnly" ]
 then
     if [ $rc -eq 0 ]
     then
-        test "$version" = "$previous"
+        test "$version:${package:-$oldPackage}" = "$oldVersion:$oldPackage"
         rc=$?
         if [ $rc -eq 0 ]
         then
-            echo "same version as previous build"
+            echo "same version as previous build" 1>&2
         else
-            echo "version changed from previous build"
+            echo "version changed from previous build" 1>&2
         fi
     else
-        echo "no git description found"
+        echo "no git description found" 1>&2
     fi
     exit $rc
 fi
 
 
-if [ $rc -eq 0 ]
-then
-    # output the git information or the -version version
-    echo $version
-elif [ -n "$previous" ]
+#
+# cannot get git information or  -version version
+#
+if [ $rc -ne 0 ]
 then
-    # use previous build tag
-    echo $previous
-else
-    # fallback to WM_PROJECT_VERSION alone
-    echo ${WM_PROJECT_VERSION:-unknown}
+    if [ -n "$oldVersion" ]
+    then
+        # use previous version info
+        version="$oldVersion"
+    else
+        # fallback to WM_PROJECT_VERSION alone
+        version="${WM_PROJECT_VERSION:-unknown}"
+    fi
 fi
 
+
+# output the tag
+printTag
+
 #------------------------------------------------------------------------------