STYLE: use ListOps::appendEqOp instead of local version

BUG: bad buffer size in globalMeshData::sharedPoints()

- introduced by vector::zero -> Zero replacement (commit 683cfb9d97)
This commit is contained in:
Mark Olesen
2020-02-05 09:56:14 +01:00
parent 44e3860888
commit e693f21d69
4 changed files with 9 additions and 41 deletions

View File

@ -1940,7 +1940,7 @@ Foam::pointField Foam::globalMeshData::sharedPoints() const
( (
Pstream::commsTypes::blocking, Pstream::commsTypes::blocking,
slave, slave,
sharedPoints.size()*sizeof(Zero) sharedPoints.size()*sizeof(Foam::vector) // byteSize()
); );
toSlave << sharedPoints; toSlave << sharedPoints;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2014-2015 OpenFOAM Foundation Copyright (C) 2014-2015 OpenFOAM Foundation
Copyright (C) 2015-2019 OpenCFD Ltd. Copyright (C) 2015-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -914,7 +914,7 @@ handleFeatureAngleLayerTerminations
mesh(), mesh(),
meshEdges, meshEdges,
edgeFaceNormals, edgeFaceNormals,
globalMeshData::ListPlusEqOp<List<point>>(), // combine operator ListOps::appendEqOp<point>(),
List<point>() // null value List<point>() // null value
); );
@ -923,7 +923,7 @@ handleFeatureAngleLayerTerminations
mesh(), mesh(),
meshEdges, meshEdges,
edgeFaceExtrude, edgeFaceExtrude,
globalMeshData::ListPlusEqOp<List<bool>>(), // combine operator ListOps::appendEqOp<bool>(),
List<bool>() // null value List<bool>() // null value
); );

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2015-2019 OpenCFD Ltd. Copyright (C) 2015-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -543,7 +543,7 @@ void Foam::meshToMesh::calculate(const word& methodName, const bool normalise)
globalSrcCells.inplaceToGlobal(addressing); globalSrcCells.inplaceToGlobal(addressing);
} }
// set up as a reverse distribute // Set up as a reverse distribute
mapDistributeBase::distribute mapDistributeBase::distribute
( (
Pstream::commsTypes::nonBlocking, Pstream::commsTypes::nonBlocking,
@ -554,12 +554,12 @@ void Foam::meshToMesh::calculate(const word& methodName, const bool normalise)
map.subMap(), map.subMap(),
false, false,
tgtToSrcCellAddr_, tgtToSrcCellAddr_,
ListPlusEqOp<label>(), ListOps::appendEqOp<label>(),
flipOp(), flipOp(),
labelList() labelList()
); );
// set up as a reverse distribute // Set up as a reverse distribute
mapDistributeBase::distribute mapDistributeBase::distribute
( (
Pstream::commsTypes::nonBlocking, Pstream::commsTypes::nonBlocking,
@ -570,7 +570,7 @@ void Foam::meshToMesh::calculate(const word& methodName, const bool normalise)
map.subMap(), map.subMap(),
false, false,
tgtToSrcCellWght_, tgtToSrcCellWght_,
ListPlusEqOp<scalar>(), ListOps::appendEqOp<scalar>(),
flipOp(), flipOp(),
scalarList() scalarList()
); );

View File

@ -33,38 +33,6 @@ License
#include "fvcGrad.H" #include "fvcGrad.H"
#include "distributedWeightedFvPatchFieldMapper.H" #include "distributedWeightedFvPatchFieldMapper.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
//- Helper class for list
template<class Type>
class ListPlusEqOp
{
public:
void operator()(List<Type>& x, const List<Type> y) const
{
if (y.size())
{
if (x.size())
{
label sz = x.size();
x.setSize(sz + y.size());
forAll(y, i)
{
x[sz++] = y[i];
}
}
else
{
x = y;
}
}
}
};
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class Type> template<class Type>