From dedb1c0c90edb8335ec67d5bec3dfa24778aaf44 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 20 Apr 2021 14:09:26 +0200 Subject: [PATCH] ENH: remove some "heavy" data when copying dictionary content --- .../codedFixedValuePointPatchField.C | 16 ++++++++++++++- .../codedFixedValueFvPatchField.C | 17 ++++++++++++++-- .../codedMixed/codedMixedFvPatchField.C | 16 ++++++++++++++- .../thermalShellFvPatchScalarField.C | 20 ++++++++++++++----- .../thermalShellFvPatchScalarField.H | 2 +- .../vibrationShellFvPatchScalarField.C | 17 ++++++++++++++-- .../vibrationShellFvPatchScalarField.H | 2 +- 7 files changed, 77 insertions(+), 13 deletions(-) diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C index 1b539d37ff..1d6e60bd79 100644 --- a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C @@ -31,6 +31,7 @@ License #include "pointPatchFieldMapper.H" #include "pointFields.H" #include "dynamicCode.H" +#include "dictionaryContent.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -157,7 +158,20 @@ Foam::codedFixedValuePointPatchField::codedFixedValuePointPatchField : fixedValuePointPatchField(p, iF, dict, valueRequired), codedBase(), - dict_(dict), + dict_ + ( + // Copy dictionary, but without "heavy" data chunks + dictionaryContent::copyDict + ( + dict, + wordRes(), // allow + wordRes // deny + ({ + "type", // redundant + "value" + }) + ) + ), name_(dict.getCompat("name", {{"redirectType", 1706}})), redirectPatchFieldPtr_(nullptr) { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C index 0db1fa9d39..2a3a1702f7 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C @@ -31,7 +31,7 @@ License #include "fvPatchFieldMapper.H" #include "volFields.H" #include "dynamicCode.H" -#include "dynamicCodeContext.H" +#include "dictionaryContent.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -157,7 +157,20 @@ Foam::codedFixedValueFvPatchField::codedFixedValueFvPatchField : fixedValueFvPatchField(p, iF, dict), codedBase(), - dict_(dict), + dict_ + ( + // Copy dictionary, but without "heavy" data chunks + dictionaryContent::copyDict + ( + dict, + wordRes(), // allow + wordRes // deny + ({ + "type", // redundant + "value" + }) + ) + ), name_(dict.getCompat("name", {{"redirectType", 1706}})), redirectPatchFieldPtr_(nullptr) { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C index a4440ae03c..1bb9e078ad 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C @@ -31,6 +31,7 @@ License #include "fvPatchFieldMapper.H" #include "volFields.H" #include "dynamicCode.H" +#include "dictionaryContent.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -156,7 +157,20 @@ Foam::codedMixedFvPatchField::codedMixedFvPatchField : mixedFvPatchField(p, iF, dict), codedBase(), - dict_(dict), + dict_ + ( + // Copy dictionary, but without "heavy" data chunks + dictionaryContent::copyDict + ( + dict, + wordRes(), // allow + wordRes // deny + ({ + "type", // redundant + "value", "refValue", "refGradient", "valueFraction" + }) + ) + ), name_(dict.getCompat("name", {{"redirectType", 1706}})), redirectPatchFieldPtr_(nullptr) { diff --git a/src/regionFaModels/derivedFvPatchFields/thermalShell/thermalShellFvPatchScalarField.C b/src/regionFaModels/derivedFvPatchFields/thermalShell/thermalShellFvPatchScalarField.C index a386a6b388..b8c65a61ec 100644 --- a/src/regionFaModels/derivedFvPatchFields/thermalShell/thermalShellFvPatchScalarField.C +++ b/src/regionFaModels/derivedFvPatchFields/thermalShell/thermalShellFvPatchScalarField.C @@ -27,6 +27,7 @@ License #include "thermalShellFvPatchScalarField.H" #include "addToRunTimeSelectionTable.H" +#include "dictionaryContent.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -78,7 +79,20 @@ thermalShellFvPatchScalarField::thermalShellFvPatchScalarField : fixedValueFvPatchField(p, iF, dict), baffle_(), - dict_(dict) + dict_ + ( + // Copy dictionary, but without "heavy" data chunks + dictionaryContent::copyDict + ( + dict, + wordRes(), // allow + wordRes // deny + ({ + "type", // redundant + "value" + }) + ) + ) { typedef regionModels::thermalShellModel baffle; @@ -127,10 +141,6 @@ void thermalShellFvPatchScalarField::updateCoeffs() void thermalShellFvPatchScalarField::write(Ostream& os) const { fixedValueFvPatchField::write(os); - - // Remove value and type already written by fixedValueFvPatchField - dict_.remove("value"); - dict_.remove("type"); dict_.write(os, false); } diff --git a/src/regionFaModels/derivedFvPatchFields/thermalShell/thermalShellFvPatchScalarField.H b/src/regionFaModels/derivedFvPatchFields/thermalShell/thermalShellFvPatchScalarField.H index 4a9e01b52f..60470784af 100644 --- a/src/regionFaModels/derivedFvPatchFields/thermalShell/thermalShellFvPatchScalarField.H +++ b/src/regionFaModels/derivedFvPatchFields/thermalShell/thermalShellFvPatchScalarField.H @@ -96,7 +96,7 @@ class thermalShellFvPatchScalarField autoPtr baffle_; //- Dictionary - mutable dictionary dict_; + dictionary dict_; public: diff --git a/src/regionFaModels/derivedFvPatchFields/vibrationShell/vibrationShellFvPatchScalarField.C b/src/regionFaModels/derivedFvPatchFields/vibrationShell/vibrationShellFvPatchScalarField.C index b2ab02fd72..69d224b761 100644 --- a/src/regionFaModels/derivedFvPatchFields/vibrationShell/vibrationShellFvPatchScalarField.C +++ b/src/regionFaModels/derivedFvPatchFields/vibrationShell/vibrationShellFvPatchScalarField.C @@ -27,6 +27,7 @@ License #include "vibrationShellFvPatchScalarField.H" #include "addToRunTimeSelectionTable.H" +#include "dictionaryContent.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -80,7 +81,20 @@ vibrationShellFvPatchScalarField::vibrationShellFvPatchScalarField : mixedFvPatchField(p, iF), baffle_(), - dict_(dict) + dict_ + ( + // Copy dictionary, but without "heavy" data chunks + dictionaryContent::copyDict + ( + dict, + wordRes(), // allow + wordRes // deny + ({ + "type", // redundant + "value", "refValue", "refGradient", "valueFraction" + }) + ) + ) { fvPatchScalarField::operator=(scalarField("value", dict, p.size())); @@ -148,7 +162,6 @@ void vibrationShellFvPatchScalarField::updateCoeffs() void vibrationShellFvPatchScalarField::write(Ostream& os) const { mixedFvPatchField::write(os); - dict_.write(os, false); } diff --git a/src/regionFaModels/derivedFvPatchFields/vibrationShell/vibrationShellFvPatchScalarField.H b/src/regionFaModels/derivedFvPatchFields/vibrationShell/vibrationShellFvPatchScalarField.H index ae742242c7..4bdd103b79 100644 --- a/src/regionFaModels/derivedFvPatchFields/vibrationShell/vibrationShellFvPatchScalarField.H +++ b/src/regionFaModels/derivedFvPatchFields/vibrationShell/vibrationShellFvPatchScalarField.H @@ -85,7 +85,7 @@ class vibrationShellFvPatchScalarField autoPtr baffle_; //- Dictionary - mutable dictionary dict_; + dictionary dict_; public: