From 31410347aa1bcee0f583d8404d1f7d15a5858a36 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Tue, 7 Feb 2012 15:02:40 +0000
Subject: [PATCH] BUG: codedFixed/codedMixed: were only writing out code
 section so restarts did not work

---
 .../codedFixedValueFvPatchField.C             | 43 +++++++++++++++++--
 .../codedMixed/codedMixedFvPatchField.C       | 42 +++++++++++++++++-
 2 files changed, 81 insertions(+), 4 deletions(-)

diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C
index acffe1a9b37..cfd69454203 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -329,6 +329,26 @@ void Foam::codedFixedValueFvPatchField<Type>::write(Ostream& os) const
     os.writeKeyword("redirectType") << redirectType_
         << token::END_STATEMENT << nl;
 
+    if (dict_.found("codeInclude"))
+    {
+        os.writeKeyword("codeInclude")
+            << token::HASH << token::BEGIN_BLOCK;
+
+        os.writeQuoted(string(dict_["codeInclude"]), false)
+            << token::HASH << token::END_BLOCK
+            << token::END_STATEMENT << nl;
+    }
+
+    if (dict_.found("localCode"))
+    {
+        os.writeKeyword("localCode")
+            << token::HASH << token::BEGIN_BLOCK;
+
+        os.writeQuoted(string(dict_["localCode"]), false)
+            << token::HASH << token::END_BLOCK
+            << token::END_STATEMENT << nl;
+    }
+
     if (dict_.found("code"))
     {
         os.writeKeyword("code")
@@ -338,10 +358,27 @@ void Foam::codedFixedValueFvPatchField<Type>::write(Ostream& os) const
             << token::HASH << token::END_BLOCK
             << token::END_STATEMENT << nl;
     }
-}
 
+    if (dict_.found("codeOptions"))
+    {
+        os.writeKeyword("codeOptions")
+            << token::HASH << token::BEGIN_BLOCK;
+
+        os.writeQuoted(string(dict_["codeOptions"]), false)
+            << token::HASH << token::END_BLOCK
+            << token::END_STATEMENT << nl;
+    }
+
+    if (dict_.found("codeLibs"))
+    {
+        os.writeKeyword("codeLibs")
+            << token::HASH << token::BEGIN_BLOCK;
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+        os.writeQuoted(string(dict_["codeLibs"]), false)
+            << token::HASH << token::END_BLOCK
+            << token::END_STATEMENT << nl;
+    }
+}
 
 
 // ************************************************************************* //
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C
index 80ff420632f..d1b53e144db 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -341,6 +341,26 @@ void Foam::codedMixedFvPatchField<Type>::write(Ostream& os) const
     os.writeKeyword("redirectType") << redirectType_
         << token::END_STATEMENT << nl;
 
+    if (dict_.found("codeInclude"))
+    {
+        os.writeKeyword("codeInclude")
+            << token::HASH << token::BEGIN_BLOCK;
+
+        os.writeQuoted(string(dict_["codeInclude"]), false)
+            << token::HASH << token::END_BLOCK
+            << token::END_STATEMENT << nl;
+    }
+
+    if (dict_.found("localCode"))
+    {
+        os.writeKeyword("localCode")
+            << token::HASH << token::BEGIN_BLOCK;
+
+        os.writeQuoted(string(dict_["localCode"]), false)
+            << token::HASH << token::END_BLOCK
+            << token::END_STATEMENT << nl;
+    }
+
     if (dict_.found("code"))
     {
         os.writeKeyword("code")
@@ -350,6 +370,26 @@ void Foam::codedMixedFvPatchField<Type>::write(Ostream& os) const
             << token::HASH << token::END_BLOCK
             << token::END_STATEMENT << nl;
     }
+
+    if (dict_.found("codeOptions"))
+    {
+        os.writeKeyword("codeOptions")
+            << token::HASH << token::BEGIN_BLOCK;
+
+        os.writeQuoted(string(dict_["codeOptions"]), false)
+            << token::HASH << token::END_BLOCK
+            << token::END_STATEMENT << nl;
+    }
+
+    if (dict_.found("codeLibs"))
+    {
+        os.writeKeyword("codeLibs")
+            << token::HASH << token::BEGIN_BLOCK;
+
+        os.writeQuoted(string(dict_["codeLibs"]), false)
+            << token::HASH << token::END_BLOCK
+            << token::END_STATEMENT << nl;
+    }
 }
 
 
-- 
GitLab