diff --git a/src/OpenFOAM/fields/Fields/Field/PrecisionAdaptor/PrecisionAdaptor.H b/src/OpenFOAM/fields/Fields/Field/PrecisionAdaptor/PrecisionAdaptor.H index 24ea766840..75e6eface2 100644 --- a/src/OpenFOAM/fields/Fields/Field/PrecisionAdaptor/PrecisionAdaptor.H +++ b/src/OpenFOAM/fields/Fields/Field/PrecisionAdaptor/PrecisionAdaptor.H @@ -169,11 +169,14 @@ class PrecisionAdaptor // Private Member Functions //- Copy in field - void copyInput(const Container& input) + void copyInput(const Container& input, const bool copy) { Container* p = new Container(input.size()); this->reset(p); - std::copy(input.cbegin(), input.cend(), p->begin()); + if (copy) + { + std::copy(input.cbegin(), input.cend(), p->begin()); + } } @@ -185,8 +188,8 @@ public: // Constructors - //- Construct from Container, copying on input as required - PrecisionAdaptor(Container& input) + //- Construct from Container, copying on input if required + PrecisionAdaptor(Container& input, const bool copy = true) : tmpNrc>(), ref_(input) @@ -197,7 +200,7 @@ public: } else { - this->copyInput(input); + this->copyInput(input, copy); } } diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellCentresAndVols.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellCentresAndVols.C index 70c9afd550..5f0ff8bcef 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellCentresAndVols.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellCentresAndVols.C @@ -82,18 +82,14 @@ void Foam::primitiveMesh::makeCellCentresAndVols { typedef Vector solveVector; - // Clear the fields for accumulation. Note1: we're doing this before - // any precision conversion since this might complain about illegal numbers. - // Note2: zero is a special value which is perfectly converted into zero - // in the new precision - cellCtrs_s = Zero; - cellVols_s = 0.0; - - PrecisionAdaptor tcellCtrs(cellCtrs_s); + PrecisionAdaptor tcellCtrs(cellCtrs_s, false); Field& cellCtrs = tcellCtrs.ref(); - PrecisionAdaptor tcellVols(cellVols_s); + PrecisionAdaptor tcellVols(cellVols_s, false); Field& cellVols = tcellVols.ref(); + cellCtrs = Zero; + cellVols = 0.0; + const labelList& own = faceOwner(); const labelList& nei = faceNeighbour(); diff --git a/src/parallel/decompose/kahipDecomp/kahipDecomp.C b/src/parallel/decompose/kahipDecomp/kahipDecomp.C index ae5f48b80b..fae238165e 100644 --- a/src/parallel/decompose/kahipDecomp/kahipDecomp.C +++ b/src/parallel/decompose/kahipDecomp/kahipDecomp.C @@ -229,7 +229,7 @@ Foam::label Foam::kahipDecomp::decomposeSerial // Output: cell -> processor addressing decomp.resize(numCells); - PrecisionAdaptor decomp_param(decomp); + PrecisionAdaptor decomp_param(decomp, false); #if 0 // WIP: #ifdef KAFFPA_CPP_INTERFACE diff --git a/src/parallel/decompose/metisDecomp/metisDecomp.C b/src/parallel/decompose/metisDecomp/metisDecomp.C index d2a0e9dae3..a6f62510cd 100644 --- a/src/parallel/decompose/metisDecomp/metisDecomp.C +++ b/src/parallel/decompose/metisDecomp/metisDecomp.C @@ -196,7 +196,7 @@ Foam::label Foam::metisDecomp::decomposeSerial // Output: cell -> processor addressing decomp.resize(numCells); - PrecisionAdaptor decomp_param(decomp); + PrecisionAdaptor decomp_param(decomp, false); // Output: number of cut edges idx_t edgeCut = 0;