diff --git a/applications/test/ListOps/Test-ListOps.C b/applications/test/ListOps/Test-ListOps.C index e2739021b3..926d6e90f8 100644 --- a/applications/test/ListOps/Test-ListOps.C +++ b/applications/test/ListOps/Test-ListOps.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2013 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -124,7 +124,7 @@ int main(int argc, char *argv[]) std::for_each(test6.begin(), test6.end(), [](label& x){ x *= 3; }); // Randomize the list - std::random_shuffle(test6.begin(), test6.end()); + Foam::shuffle(test6); Info<< "randomized input list: " << flatOutput(test6) << nl; @@ -160,7 +160,7 @@ int main(int argc, char *argv[]) // List reorder labelList oldToNew(identity(40)); - std::random_shuffle(oldToNew.begin(), oldToNew.end()); + Foam::shuffle(oldToNew); // Force a few -1: oldToNew[4] = oldToNew[8] = -1; @@ -192,9 +192,9 @@ int main(int argc, char *argv[]) ) ); - Info<<"packed input: " << flatOutput(packed) << nl; + Info<< "packed input: " << packed << nl; inplaceReorder(oldToNew, packed); - Info<<" reorder: " << flatOutput(packed) << nl << nl; + Info<<" reorder: " << packed << nl << nl; Info<< "\nEnd\n" << endl; diff --git a/applications/test/vector/Test-vector.C b/applications/test/vector/Test-vector.C index 2a1e0675d5..2cfebcd81d 100644 --- a/applications/test/vector/Test-vector.C +++ b/applications/test/vector/Test-vector.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2019 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -34,6 +34,7 @@ Description #include "vector.H" #include "IOstreams.H" #include +#include using namespace Foam; @@ -115,9 +116,8 @@ void testData(const VecSpace& vs) int main(int argc, char *argv[]) { Info<<"normalised: " << vector(1,2,3).normalise() << nl; - Info<<"normalised: " << vector(VSMALL,VSMALL,VSMALL).normalise() << nl; - Info<<"normalised: " << - vector(ROOTVSMALL,ROOTVSMALL,ROOTVSMALL).normalise() << nl; + Info<<"normalised: " << vector::uniform(VSMALL).normalise() << nl; + Info<<"normalised: " << vector::uniform(ROOTVSMALL).normalise() << nl; { vector vec1(0.5, 0.5, 0.5); @@ -134,7 +134,7 @@ int main(int argc, char *argv[]) std::sort(vec2.begin(), vec2.end()); Info<< "sorted: " << vec2 << nl; - std::random_shuffle(vec2.begin(), vec2.end()); + std::shuffle(vec2.begin(), vec2.end(), std::default_random_engine()); Info<< "shuffled: " << vec2 << nl; } diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.C index 9ae95d5db8..192a7e4034 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2015 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -33,6 +34,8 @@ License #include "scalarIOField.H" #include "labelIOField.H" #include "pointConversion.H" +#include +#include // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -304,7 +307,7 @@ Foam::Map Foam::DelaunayMesh::rangeInsertWithInfo ); } - std::random_shuffle(points.begin(), points.end()); + std::shuffle(points.begin(), points.end(), std::default_random_engine()); spatial_sort ( diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C index 56b18a898a..3a93a47583 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2016 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -33,6 +33,8 @@ License #include "pointConversion.H" #include "indexedVertexEnum.H" #include "IOmanip.H" +#include +#include // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // @@ -880,7 +882,12 @@ Foam::DistributedDelaunayMesh::rangeInsertReferredWithInfo ); } - std::random_shuffle(pointsBbDistSqr.begin(), pointsBbDistSqr.end()); + std::shuffle + ( + pointsBbDistSqr.begin(), + pointsBbDistSqr.end(), + std::default_random_engine() + ); // Sort in ascending order by the distance of the point from the centre // of the processor bounding box diff --git a/src/OpenFOAM/containers/Bits/PackedList/PackedList.H b/src/OpenFOAM/containers/Bits/PackedList/PackedList.H index 7c2bf50a77..c27a442ece 100644 --- a/src/OpenFOAM/containers/Bits/PackedList/PackedList.H +++ b/src/OpenFOAM/containers/Bits/PackedList/PackedList.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -401,6 +401,10 @@ public: //- A pointer to the raw storage inline unsigned int* data() noexcept; + //- The number of bytes used in the raw storage + //- including any unused padding. + inline std::streamsize size_bytes() const noexcept; + //- The number of bytes used in the raw storage //- including any unused padding. inline std::streamsize byteSize() const noexcept; diff --git a/src/OpenFOAM/containers/Bits/PackedList/PackedListI.H b/src/OpenFOAM/containers/Bits/PackedList/PackedListI.H index d52fc32eff..98e179b9cd 100644 --- a/src/OpenFOAM/containers/Bits/PackedList/PackedListI.H +++ b/src/OpenFOAM/containers/Bits/PackedList/PackedListI.H @@ -562,12 +562,19 @@ inline unsigned int* Foam::PackedList::data() noexcept template -inline std::streamsize Foam::PackedList::byteSize() const noexcept +inline std::streamsize Foam::PackedList::size_bytes() const noexcept { return num_blocks(size()) * sizeof(block_type); } +template +inline std::streamsize Foam::PackedList::byteSize() const noexcept +{ + return this->size_bytes(); +} + + template inline void Foam::PackedList::swap(PackedList& rhs) { diff --git a/src/OpenFOAM/containers/Bits/PackedList/PackedListIO.C b/src/OpenFOAM/containers/Bits/PackedList/PackedListIO.C index 45bb1c1fea..9bcf609c53 100644 --- a/src/OpenFOAM/containers/Bits/PackedList/PackedListIO.C +++ b/src/OpenFOAM/containers/Bits/PackedList/PackedListIO.C @@ -128,7 +128,7 @@ Foam::Istream& Foam::PackedList::read(Istream& is) is.read ( reinterpret_cast(list.data()), - list.byteSize() + list.size_bytes() ); is.fatalCheck @@ -230,7 +230,7 @@ Foam::Ostream& Foam::PackedList::writeList os.write ( reinterpret_cast(list.cdata()), - list.byteSize() + list.size_bytes() ); } } diff --git a/src/OpenFOAM/containers/Bits/bitSet/bitSetIO.C b/src/OpenFOAM/containers/Bits/bitSet/bitSetIO.C index 597e40ba0d..64032740d1 100644 --- a/src/OpenFOAM/containers/Bits/bitSet/bitSetIO.C +++ b/src/OpenFOAM/containers/Bits/bitSet/bitSetIO.C @@ -88,7 +88,7 @@ Foam::Ostream& Foam::bitSet::writeList os.write ( reinterpret_cast(list.cdata()), - list.byteSize() + list.size_bytes() ); } } diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedList.C b/src/OpenFOAM/containers/Lists/FixedList/FixedList.C index 6d0f5703d4..d0570f2a98 100644 --- a/src/OpenFOAM/containers/Lists/FixedList/FixedList.C +++ b/src/OpenFOAM/containers/Lists/FixedList/FixedList.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2015 OpenFOAM Foundation - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -40,8 +40,7 @@ std::streamsize Foam::FixedList::byteSize() const << "Invalid for non-contiguous data types" << abort(FatalError); } - - return N*sizeof(T); + return this->size_bytes(); } diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedList.H b/src/OpenFOAM/containers/Lists/FixedList/FixedList.H index 2378f152bc..a4406b5861 100644 --- a/src/OpenFOAM/containers/Lists/FixedList/FixedList.H +++ b/src/OpenFOAM/containers/Lists/FixedList/FixedList.H @@ -216,7 +216,12 @@ public: //- The last element of the list, position [N-1] inline const T& last() const noexcept; - //- The number of bytes stored by the list data for contiguous types + //- Number of contiguous bytes for the list data, + //- no runtime check that the type is actually contiguous + inline static std::streamsize size_bytes() noexcept; + + //- Number of contiguous bytes for the list data, + //- with runtime check that the type is actually contiguous std::streamsize byteSize() const; //- Return the forward circular index, i.e. next index diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H b/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H index 5bdcf55eb5..4f7d544e46 100644 --- a/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H +++ b/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H @@ -184,6 +184,13 @@ Foam::FixedList::data() noexcept } +template +inline std::streamsize Foam::FixedList::size_bytes() noexcept +{ + return N*sizeof(T); +} + + template inline T& Foam::FixedList::first() noexcept { diff --git a/src/OpenFOAM/containers/Lists/List/List.C b/src/OpenFOAM/containers/Lists/List/List.C index 302529f81f..c39f993934 100644 --- a/src/OpenFOAM/containers/Lists/List/List.C +++ b/src/OpenFOAM/containers/Lists/List/List.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -199,7 +199,7 @@ Foam::List::List(const UList& a) { std::memcpy ( - static_cast(this->v_), a.v_, this->byteSize() + static_cast(this->v_), a.v_, this->size_bytes() ); } else @@ -232,7 +232,7 @@ Foam::List::List(const List& a) { std::memcpy ( - static_cast(this->v_), a.v_, this->byteSize() + static_cast(this->v_), a.v_, this->size_bytes() ); } else @@ -274,7 +274,7 @@ Foam::List::List(List& a, bool reuse) { std::memcpy ( - static_cast(this->v_), a.v_, this->byteSize() + static_cast(this->v_), a.v_, this->size_bytes() ); } else @@ -516,7 +516,7 @@ void Foam::List::operator=(const UList& a) { std::memcpy ( - static_cast(this->v_), a.v_, this->byteSize() + static_cast(this->v_), a.v_, this->size_bytes() ); } else diff --git a/src/OpenFOAM/containers/Lists/UList/UList.C b/src/OpenFOAM/containers/Lists/UList/UList.C index 267a7b3269..41dbb8f036 100644 --- a/src/OpenFOAM/containers/Lists/UList/UList.C +++ b/src/OpenFOAM/containers/Lists/UList/UList.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -32,6 +32,7 @@ License #include "labelRange.H" #include +#include // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -120,7 +121,7 @@ void Foam::UList::deepCopy(const UList& list) { std::memcpy ( - static_cast(this->v_), list.v_, this->byteSize() + static_cast(this->v_), list.v_, this->size_bytes() ); } else @@ -196,8 +197,7 @@ std::streamsize Foam::UList::byteSize() const << "Invalid for non-contiguous data types" << abort(FatalError); } - - return this->size_*sizeof(T); + return this->size_bytes(); } @@ -281,7 +281,7 @@ void Foam::stableSort(UList& a, const Compare& comp) template void Foam::shuffle(UList& a) { - std::random_shuffle(a.begin(), a.end()); + std::shuffle(a.begin(), a.end(), std::default_random_engine()); } diff --git a/src/OpenFOAM/containers/Lists/UList/UList.H b/src/OpenFOAM/containers/Lists/UList/UList.H index fcdbc3d75a..c7b6a0cf1e 100644 --- a/src/OpenFOAM/containers/Lists/UList/UList.H +++ b/src/OpenFOAM/containers/Lists/UList/UList.H @@ -274,8 +274,12 @@ public: //- Return the last element of the list inline const T& last() const; - //- The number of bytes stored by the list data for contiguous types - // \note is a std::streamsize since it is used in stream ops + //- Number of contiguous bytes for the List data, + //- no runtime check that the type is actually contiguous + inline std::streamsize size_bytes() const noexcept; + + //- Number of contiguous bytes for the List data, + //- with runtime check that the type is actually contiguous std::streamsize byteSize() const; @@ -530,7 +534,7 @@ public: { if (is_contiguous::value) { - return Hasher(obj.cdata(), obj.size()*sizeof(T), seed); + return Hasher(obj.cdata(), obj.size_bytes(), seed); } for (const T& val : obj) @@ -600,7 +604,7 @@ struct Hash> { if (is_contiguous::value) { - return Hasher(obj.cdata(), obj.size()*sizeof(T), seed); + return Hasher(obj.cdata(), obj.size_bytes(), seed); } for (const T& val : obj) { diff --git a/src/OpenFOAM/containers/Lists/UList/UListI.H b/src/OpenFOAM/containers/Lists/UList/UListI.H index 9edb72fc6a..923e896f23 100644 --- a/src/OpenFOAM/containers/Lists/UList/UListI.H +++ b/src/OpenFOAM/containers/Lists/UList/UListI.H @@ -207,6 +207,13 @@ inline T* Foam::UList::data() noexcept } +template +inline std::streamsize Foam::UList::size_bytes() const noexcept +{ + return std::streamsize(size_)*sizeof(T); +} + + template inline bool Foam::UList::found(const T& val, label pos) const { diff --git a/src/OpenFOAM/containers/Lists/UList/UListIO.C b/src/OpenFOAM/containers/Lists/UList/UListIO.C index c77d98c0cf..6fc94df561 100644 --- a/src/OpenFOAM/containers/Lists/UList/UListIO.C +++ b/src/OpenFOAM/containers/Lists/UList/UListIO.C @@ -146,7 +146,7 @@ Foam::Ostream& Foam::UList::writeList os.write ( reinterpret_cast(list.cdata()), - list.byteSize() + list.size_bytes() ); } } diff --git a/src/OpenFOAM/db/IOobjects/decomposedBlockData/decomposedBlockData.C b/src/OpenFOAM/db/IOobjects/decomposedBlockData/decomposedBlockData.C index 41234f7509..b4388efb1c 100644 --- a/src/OpenFOAM/db/IOobjects/decomposedBlockData/decomposedBlockData.C +++ b/src/OpenFOAM/db/IOobjects/decomposedBlockData/decomposedBlockData.C @@ -609,7 +609,7 @@ void Foam::decomposedBlockData::gather const label nProcs = UPstream::nProcs(comm); datas.setSize(nProcs); - char* data0Ptr = reinterpret_cast(datas.begin()); + char* data0Ptr = reinterpret_cast(datas.data()); List recvOffsets; List recvSizes; @@ -682,15 +682,15 @@ void Foam::decomposedBlockData::gatherSlaveData ) { // Note: UPstream::gather limited to int - nSend = int(data.byteSize()); + nSend = int(data.size_bytes()); } UPstream::gather ( - data.begin(), + data.cdata(), nSend, - recvData.begin(), + recvData.data(), sliceSizes, sliceOffsets, comm @@ -822,8 +822,8 @@ bool Foam::decomposedBlockData::writeBlocks ( UPstream::commsTypes::scheduled, proci, - elems.begin(), - elems.size(), + elems.data(), + elems.size_bytes(), Pstream::msgType(), comm ); @@ -841,8 +841,8 @@ bool Foam::decomposedBlockData::writeBlocks ( UPstream::commsTypes::scheduled, UPstream::masterNo(), - data.begin(), - data.byteSize(), + data.cdata(), + data.size_bytes(), Pstream::msgType(), comm ); @@ -1015,12 +1015,12 @@ bool Foam::decomposedBlockData::writeData(Ostream& os) const if (isA(os)) { // Serial file output - can use writeRaw() - os.writeRaw(data.cdata(), data.byteSize()); + os.writeRaw(data.cdata(), data.size_bytes()); } else { // Other cases are less fortunate, and no std::string_view - std::string str(data.cdata(), data.byteSize()); + std::string str(data.cdata(), data.size_bytes()); os.writeQuoted(str, false); } @@ -1052,7 +1052,7 @@ bool Foam::decomposedBlockData::writeObject } labelList recvSizes; - gather(comm_, label(this->byteSize()), recvSizes); + gather(comm_, label(this->size_bytes()), recvSizes); List start; PtrList> slaveData; // dummy slave data diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.C index e70e9cc1c0..82f72e866b 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UOPstream.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -170,7 +170,7 @@ Foam::UOPstream::~UOPstream() ( commsType_, toProcNo_, - sendBuf_.begin(), + sendBuf_.cdata(), sendBuf_.size(), tag_, comm_ diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/combineGatherScatter.C b/src/OpenFOAM/db/IOstreams/Pstreams/combineGatherScatter.C index da30e43862..2e7627db90 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/combineGatherScatter.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/combineGatherScatter.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -314,7 +314,7 @@ void Foam::Pstream::listCombineGather UPstream::commsTypes::scheduled, belowID, reinterpret_cast(receivedValues.data()), - receivedValues.byteSize(), + receivedValues.size_bytes(), tag, comm ); @@ -371,7 +371,7 @@ void Foam::Pstream::listCombineGather UPstream::commsTypes::scheduled, myComm.above(), reinterpret_cast(Values.cdata()), - Values.byteSize(), + Values.size_bytes(), tag, comm ); @@ -451,7 +451,7 @@ void Foam::Pstream::listCombineScatter UPstream::commsTypes::scheduled, myComm.above(), reinterpret_cast(Values.data()), - Values.byteSize(), + Values.size_bytes(), tag, comm ); @@ -493,7 +493,7 @@ void Foam::Pstream::listCombineScatter UPstream::commsTypes::scheduled, belowID, reinterpret_cast(Values.cdata()), - Values.byteSize(), + Values.size_bytes(), tag, comm ); diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/gatherScatterList.C b/src/OpenFOAM/db/IOstreams/Pstreams/gatherScatterList.C index 5e392eba3b..a3282d1ece 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/gatherScatterList.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/gatherScatterList.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -85,7 +85,7 @@ void Pstream::gatherList UPstream::commsTypes::scheduled, belowID, reinterpret_cast(receivedValues.data()), - receivedValues.byteSize(), + receivedValues.size_bytes(), tag, comm ); @@ -161,7 +161,7 @@ void Pstream::gatherList UPstream::commsTypes::scheduled, myComm.above(), reinterpret_cast(sendingValues.cdata()), - sendingValues.byteSize(), + sendingValues.size_bytes(), tag, comm ); @@ -247,7 +247,7 @@ void Pstream::scatterList UPstream::commsTypes::scheduled, myComm.above(), reinterpret_cast(receivedValues.data()), - receivedValues.byteSize(), + receivedValues.size_bytes(), tag, comm ); @@ -303,7 +303,7 @@ void Pstream::scatterList UPstream::commsTypes::scheduled, belowID, reinterpret_cast(sendingValues.cdata()), - sendingValues.byteSize(), + sendingValues.size_bytes(), tag, comm ); diff --git a/src/OpenFOAM/global/fileOperations/collatedFileOperation/OFstreamCollator.C b/src/OpenFOAM/global/fileOperations/collatedFileOperation/OFstreamCollator.C index fc3480bd80..2f146ea2eb 100644 --- a/src/OpenFOAM/global/fileOperations/collatedFileOperation/OFstreamCollator.C +++ b/src/OpenFOAM/global/fileOperations/collatedFileOperation/OFstreamCollator.C @@ -465,7 +465,7 @@ bool Foam::OFstreamCollator::write UPstream::commsTypes::nonBlocking, proci, reinterpret_cast(slaveData[proci].data()), - slaveData[proci].byteSize(), + slaveData[proci].size_bytes(), Pstream::msgType(), localComm_ ); @@ -480,7 +480,7 @@ bool Foam::OFstreamCollator::write UPstream::commsTypes::nonBlocking, 0, reinterpret_cast(slice.cdata()), - slice.byteSize(), + slice.size_bytes(), Pstream::msgType(), localComm_ ) @@ -489,7 +489,7 @@ bool Foam::OFstreamCollator::write FatalErrorInFunction << "Cannot send outgoing message. " << "to:" << 0 << " nBytes:" - << label(slice.byteSize()) + << label(slice.size_bytes()) << Foam::abort(FatalError); } } diff --git a/src/OpenFOAM/matrices/Matrix/Matrix.C b/src/OpenFOAM/matrices/Matrix/Matrix.C index 84a089b8cd..1a45c0460e 100644 --- a/src/OpenFOAM/matrices/Matrix/Matrix.C +++ b/src/OpenFOAM/matrices/Matrix/Matrix.C @@ -469,8 +469,7 @@ std::streamsize Foam::Matrix::byteSize() const << "Invalid for non-contiguous data types" << abort(FatalError); } - - return mRows_*nCols_*sizeof(Type); + return this->size_bytes(); } diff --git a/src/OpenFOAM/matrices/Matrix/Matrix.H b/src/OpenFOAM/matrices/Matrix/Matrix.H index e77be53016..e6882cbbe7 100644 --- a/src/OpenFOAM/matrices/Matrix/Matrix.H +++ b/src/OpenFOAM/matrices/Matrix/Matrix.H @@ -204,7 +204,12 @@ public: //- be used to address into Matrix contents inline Type* data() noexcept; - //- The number of bytes stored by the Matrix data for contiguous types + //- Number of contiguous bytes for the Matrix data, + //- no runtime check that the type is actually contiguous + inline std::streamsize size_bytes() const noexcept; + + //- Number of contiguous bytes for the Matrix data, + //- with runtime check that the type is actually contiguous std::streamsize byteSize() const; //- Return const pointer to data in the specified row diff --git a/src/OpenFOAM/matrices/Matrix/MatrixI.H b/src/OpenFOAM/matrices/Matrix/MatrixI.H index 29f988881e..4f0a269412 100644 --- a/src/OpenFOAM/matrices/Matrix/MatrixI.H +++ b/src/OpenFOAM/matrices/Matrix/MatrixI.H @@ -211,6 +211,13 @@ inline Type* Foam::Matrix::data() noexcept } +template +inline std::streamsize Foam::Matrix::size_bytes() const noexcept +{ + return mRows_*nCols_*sizeof(Type); +} + + template inline const Type* Foam::Matrix::rowData(const label irow) const { diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/PPCG/PPCG.C b/src/OpenFOAM/matrices/lduMatrix/solvers/PPCG/PPCG.C index 0f9a0ad748..d231a2daac 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/PPCG/PPCG.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/PPCG/PPCG.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2019-2020 Mattijs Janssens - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -67,7 +67,7 @@ void Foam::PPCG::gSumMagProd { Foam::reduce ( - globalSum.begin(), + globalSum.data(), globalSum.size(), sumOp(), Pstream::msgType(), diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndexTemplates.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndexTemplates.C index 7b995adfa6..127d3688eb 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndexTemplates.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndexTemplates.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2017 OpenFOAM Foundation - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -66,7 +66,7 @@ void Foam::globalIndex::gather commsType, procIDs[i], reinterpret_cast(procSlot.data()), - procSlot.byteSize(), + procSlot.size_bytes(), tag, comm ); @@ -133,7 +133,7 @@ void Foam::globalIndex::gather commsType, procIDs[0], reinterpret_cast(fld.cdata()), - fld.byteSize(), + fld.size_bytes(), tag, comm ); @@ -170,7 +170,7 @@ void Foam::globalIndex::gather commsType, procIDs[0], reinterpret_cast(fld.cdata()), - fld.byteSize(), + fld.size_bytes(), tag, comm ); @@ -319,7 +319,7 @@ void Foam::globalIndex::scatter commsType, procIDs[i], reinterpret_cast(procSlot.cdata()), - procSlot.byteSize(), + procSlot.size_bytes(), tag, comm ); @@ -366,7 +366,7 @@ void Foam::globalIndex::scatter commsType, procIDs[i], reinterpret_cast(procSlot.cdata()), - procSlot.byteSize(), + procSlot.size_bytes(), tag, comm ); @@ -391,7 +391,7 @@ void Foam::globalIndex::scatter commsType, procIDs[0], reinterpret_cast(fld.data()), - fld.byteSize(), + fld.size_bytes(), tag, comm ); @@ -428,7 +428,7 @@ void Foam::globalIndex::scatter commsType, procIDs[0], reinterpret_cast(fld.data()), - fld.byteSize(), + fld.size_bytes(), tag, comm ); diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C index b3f7aed676..3b98b0c996 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -1920,7 +1920,7 @@ Foam::pointField Foam::globalMeshData::sharedPoints() const ( Pstream::commsTypes::blocking, slave, - sharedPoints.size()*sizeof(Foam::vector) // byteSize() + sharedPoints.size_bytes() ); toSlave << sharedPoints; } diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBaseTemplates.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBaseTemplates.C index 43c2e6c29a..61813efd66 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBaseTemplates.C +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBaseTemplates.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2015-2017 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -536,7 +536,7 @@ void Foam::mapDistributeBase::distribute Pstream::commsTypes::nonBlocking, domain, reinterpret_cast(subField.cdata()), - subField.byteSize(), + subField.size_bytes(), tag, comm ); @@ -559,7 +559,7 @@ void Foam::mapDistributeBase::distribute Pstream::commsTypes::nonBlocking, domain, reinterpret_cast(recvFields[domain].data()), - recvFields[domain].byteSize(), + recvFields[domain].size_bytes(), tag, comm ); @@ -1061,7 +1061,7 @@ void Foam::mapDistributeBase::distribute Pstream::commsTypes::nonBlocking, domain, reinterpret_cast(subField.cdata()), - subField.size()*sizeof(T), + subField.size_bytes(), tag, comm ); @@ -1084,7 +1084,7 @@ void Foam::mapDistributeBase::distribute Pstream::commsTypes::nonBlocking, domain, reinterpret_cast(recvFields[domain].data()), - recvFields[domain].size()*sizeof(T), + recvFields[domain].size_bytes(), tag, comm ); diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C b/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C index 0392a0f0cc..8e9d91dfd0 100644 --- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C +++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C @@ -1053,7 +1053,7 @@ void Foam::syncTools::syncBoundaryFaceList Pstream::commsTypes::nonBlocking, procPatch.neighbProcNo(), reinterpret_cast(fld.data()), - fld.byteSize() + fld.size_bytes() ); } } @@ -1079,7 +1079,7 @@ void Foam::syncTools::syncBoundaryFaceList Pstream::commsTypes::nonBlocking, procPatch.neighbProcNo(), reinterpret_cast(fld.cdata()), - fld.byteSize() + fld.size_bytes() ); } } @@ -1280,7 +1280,7 @@ void Foam::syncTools::syncFaceList Pstream::commsTypes::nonBlocking, procPatch.neighbProcNo(), reinterpret_cast(recvInfo.data()), - recvInfo.byteSize() + recvInfo.size_bytes() ); } } @@ -1315,7 +1315,7 @@ void Foam::syncTools::syncFaceList Pstream::commsTypes::nonBlocking, procPatch.neighbProcNo(), reinterpret_cast(sendInfo.cdata()), - sendInfo.byteSize() + sendInfo.size_bytes() ); } } diff --git a/src/OpenFOAM/primitives/Pair/Pair.H b/src/OpenFOAM/primitives/Pair/Pair.H index 5b9dd491fc..7420d1bfc5 100644 --- a/src/OpenFOAM/primitives/Pair/Pair.H +++ b/src/OpenFOAM/primitives/Pair/Pair.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -200,7 +200,7 @@ struct Hash> { if (is_contiguous::value) { - return Hasher(obj.cdata(), sizeof(obj), seed); + return Hasher(obj.cdata(), obj.size_bytes(), seed); } seed = Hash()(obj.first(), seed); diff --git a/src/OpenFOAM/primitives/Scalar/doubleFloat.H b/src/OpenFOAM/primitives/Scalar/doubleFloat.H index 945b08fc13..7767088e51 100644 --- a/src/OpenFOAM/primitives/Scalar/doubleFloat.H +++ b/src/OpenFOAM/primitives/Scalar/doubleFloat.H @@ -73,6 +73,8 @@ MAXMINPOW(float, int, float) MAXMINPOW(float, float, long) MAXMINPOW(float, long, float) #if defined(__APPLE__) && WM_LABEL_SIZE == 64 +MAXMINPOW(double, double, int64_t) +MAXMINPOW(double, int64_t, double) MAXMINPOW(float, float, int64_t) MAXMINPOW(float, int64_t, float) #endif diff --git a/src/Pstream/mpi/UIPread.C b/src/Pstream/mpi/UIPread.C index 4761b813b9..5fed1729e3 100644 --- a/src/Pstream/mpi/UIPread.C +++ b/src/Pstream/mpi/UIPread.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -115,7 +115,7 @@ Foam::UIPstream::UIPstream ( commsType, fromProcNo_, - externalBuf_.begin(), + externalBuf_.data(), wantedSize, tag_, comm_ @@ -221,7 +221,7 @@ Foam::UIPstream::UIPstream(const int fromProcNo, PstreamBuffers& buffers) ( commsType(), fromProcNo_, - externalBuf_.begin(), + externalBuf_.data(), wantedSize, tag_, comm_ diff --git a/src/Pstream/mpi/UPstream.C b/src/Pstream/mpi/UPstream.C index 0964e754cc..c19ee6bad0 100644 --- a/src/Pstream/mpi/UPstream.C +++ b/src/Pstream/mpi/UPstream.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -770,10 +770,10 @@ void Foam::UPstream::allToAll ( // NOTE: const_cast is a temporary hack for // backward-compatibility with versions of OpenMPI < 1.7.4 - const_cast(sendData.begin()), + const_cast(sendData.cdata()), sizeof(label), MPI_BYTE, - recvData.begin(), + recvData.data(), sizeof(label), MPI_BYTE, PstreamGlobals::MPICommunicators_[communicator] @@ -1090,7 +1090,7 @@ void Foam::UPstream::allocatePstreamCommunicator ( PstreamGlobals::MPIGroups_[parentIndex], procIDs_[index].size(), - procIDs_[index].begin(), + procIDs_[index].cdata(), &PstreamGlobals::MPIGroups_[index] ); @@ -1188,7 +1188,7 @@ void Foam::UPstream::waitRequests(const label start) MPI_Waitall ( waitRequests.size(), - waitRequests.begin(), + waitRequests.data(), MPI_STATUSES_IGNORE ) ) diff --git a/src/conversion/ccm/reader/ccmReader.C b/src/conversion/ccm/reader/ccmReader.C index 845735eee1..4a36f83921 100644 --- a/src/conversion/ccm/reader/ccmReader.C +++ b/src/conversion/ccm/reader/ccmReader.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -184,7 +184,7 @@ void Foam::ccm::reader::readMap ( &(globalState_->error), mapId, - data.begin(), + data.data(), kCCMIOStart, kCCMIOEnd ); diff --git a/src/conversion/ccm/reader/ccmReaderMesh.C b/src/conversion/ccm/reader/ccmReaderMesh.C index f621a5cadc..7b8279afed 100644 --- a/src/conversion/ccm/reader/ccmReaderMesh.C +++ b/src/conversion/ccm/reader/ccmReaderMesh.C @@ -42,7 +42,6 @@ License #include "ccmInternal.H" // include last to avoid any strange interactions - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // Foam::labelList Foam::ccm::reader::patchStartList(label initial) const @@ -311,7 +310,7 @@ Foam::labelList Foam::ccm::reader::readVertices nullptr, nullptr, nullptr, - vrts.begin(), + vrts.data(), kCCMIOStart, kCCMIOEnd ); @@ -388,7 +387,7 @@ void Foam::ccm::reader::readCells &(globalState_->error), cellsNode, &mapId, - cellTableId_.begin(), + cellTableId_.data(), kCCMIOStart, kCCMIOEnd ); @@ -597,7 +596,7 @@ void Foam::ccm::reader::readCells kCCMIOInternalFaces, nullptr, nullptr, - ccmFaces.begin(), + ccmFaces.data(), kCCMIOStart, kCCMIOEnd ); @@ -607,7 +606,7 @@ void Foam::ccm::reader::readCells &(globalState_->error), nodeId, kCCMIOInternalFaces, - faceCells.begin(), + faceCells.data(), kCCMIOStart, kCCMIOEnd ); @@ -686,7 +685,7 @@ void Foam::ccm::reader::readCells kCCMIOBoundaryFaces, nullptr, nullptr, - ccmFaces.begin(), + ccmFaces.data(), kCCMIOStart, kCCMIOEnd ); @@ -695,7 +694,7 @@ void Foam::ccm::reader::readCells &(globalState_->error), nodeId, kCCMIOBoundaryFaces, - faceCells.begin(), + faceCells.data(), kCCMIOStart, kCCMIOEnd ); @@ -837,7 +836,7 @@ void Foam::ccm::reader::readInterfaces &(globalState_->error), interfaceNode, "ProstarBaffles", - mapData.begin(), + mapData.data(), kCCMIOStart, kCCMIOEnd ); @@ -880,7 +879,7 @@ void Foam::ccm::reader::readInterfaces &(globalState_->error), interfaceNode, "FaceIds", - mapData.begin(), + mapData.data(), kCCMIOStart, kCCMIOEnd ); @@ -1058,7 +1057,7 @@ void Foam::ccm::reader::readMonitoring // CCMIOGetNode(nullptr, childNode, "Cells", &subNode); // CCMIORead1i // ( - // nullptr, subNode, faceCells.begin(), + // nullptr, subNode, faceCells.data(), // kCCMIOStart, kCCMIOEnd // ); // diff --git a/src/conversion/ccm/reader/ccmReaderSolution.C b/src/conversion/ccm/reader/ccmReaderSolution.C index 349e539fdf..7a1dcad594 100644 --- a/src/conversion/ccm/reader/ccmReaderSolution.C +++ b/src/conversion/ccm/reader/ccmReaderSolution.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -542,7 +542,6 @@ Foam::ccm::reader::readField && dataLocation == requestedLocation ) { - #ifdef SOLID_STRESS_HACK bool okayCombination = true; @@ -611,7 +610,7 @@ Foam::ccm::reader::readField dataNode, nullptr, nullptr, - rawData.begin(), + rawData.data(), kCCMIOStart, kCCMIOEnd ); @@ -627,7 +626,6 @@ Foam::ccm::reader::readField const label cellId = mapData[i]; scalarData[cellId] = rawData[i]; } - } } } diff --git a/src/conversion/ccm/writer/ccmWriter.C b/src/conversion/ccm/writer/ccmWriter.C index 19c7323c16..33f12e1f56 100644 --- a/src/conversion/ccm/writer/ccmWriter.C +++ b/src/conversion/ccm/writer/ccmWriter.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -74,7 +74,7 @@ void Foam::ccm::writer::addLinearMap mapId, size, (start + size), - data.begin(), + data.cdata(), kCCMIOStart, kCCMIOEnd ); diff --git a/src/conversion/ccm/writer/ccmWriterMesh.C b/src/conversion/ccm/writer/ccmWriterMesh.C index 7eb086b922..79f9df0139 100644 --- a/src/conversion/ccm/writer/ccmWriterMesh.C +++ b/src/conversion/ccm/writer/ccmWriterMesh.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -175,7 +175,7 @@ void Foam::ccm::writer::writeFaces nodeType, mapId, streamSize, - ccmStream.begin(), + ccmStream.cdata(), kCCMIOStart, kCCMIOEnd ); @@ -235,7 +235,7 @@ void Foam::ccm::writer::writeFaces nodeId, nodeType, mapId, - ccmStream.begin(), + ccmStream.cdata(), kCCMIOStart, kCCMIOEnd ); @@ -262,7 +262,7 @@ void Foam::ccm::writer::writeFaces nodeId, "ProstarFaceId", size, - ccmStream.begin(), + ccmStream.cdata(), kCCMIOStart, kCCMIOEnd ); @@ -290,7 +290,7 @@ void Foam::ccm::writer::writeFaces "ProstarFaceId", size, 2, - ccmStream.begin(), + ccmStream.cdata(), kCCMIOStart, kCCMIOEnd ); @@ -337,7 +337,7 @@ void Foam::ccm::writer::writeVertices verticesNode, 3, scaling, vertexMap, - vrts.begin(), + vrts.cdata(), kCCMIOStart, kCCMIOEnd ); @@ -612,7 +612,7 @@ void Foam::ccm::writer::writeCells &(globalState_->error), cellsNode, maps_->cells, - mapData.begin(), + mapData.data(), kCCMIOStart, kCCMIOEnd ); assertNoError("writing 'Cells' node"); @@ -640,7 +640,7 @@ void Foam::ccm::writer::writeCells cellsNode, "CellTopologyType", mesh_.nCells(), - mapData.begin(), + mapData.cdata(), kCCMIOStart, kCCMIOEnd ); @@ -701,7 +701,7 @@ void Foam::ccm::writer::writeInterfaces "FaceIds", interfaces.size(), 2, - mapData.begin(), kCCMIOStart, kCCMIOEnd + mapData.cdata(), kCCMIOStart, kCCMIOEnd ) != kCCMIONoErr ) diff --git a/src/conversion/ccm/writer/ccmWriterSolution.C b/src/conversion/ccm/writer/ccmWriterSolution.C index 0d52d04d43..accfa07a6b 100644 --- a/src/conversion/ccm/writer/ccmWriterSolution.C +++ b/src/conversion/ccm/writer/ccmWriterSolution.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2018 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -737,7 +737,7 @@ void Foam::ccm::writer::writeSolution kCCMIOFace, const_cast ( - field.primitiveField().begin() + field.primitiveField().cdata() ), kCCMIOStart, kCCMIOEnd @@ -762,7 +762,10 @@ void Foam::ccm::writer::writeSolution nodeId, maps_->boundary[patchI], kCCMIOFace, - field.boundaryField()[patchI].begin(), + const_cast + ( + field.boundaryField()[patchI].cdata() + ), kCCMIOStart, kCCMIOEnd ); diff --git a/src/overset/lduPrimitiveProcessorInterface/calculatedProcessorFvPatchField.C b/src/overset/lduPrimitiveProcessorInterface/calculatedProcessorFvPatchField.C index 2c1f511b6c..5d0b4f30c7 100644 --- a/src/overset/lduPrimitiveProcessorInterface/calculatedProcessorFvPatchField.C +++ b/src/overset/lduPrimitiveProcessorInterface/calculatedProcessorFvPatchField.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -170,7 +170,7 @@ void Foam::calculatedProcessorFvPatchField::initEvaluate ( Pstream::commsTypes::nonBlocking, procInterface_.neighbProcNo(), - reinterpret_cast(this->begin()), + reinterpret_cast(this->data()), this->byteSize(), procInterface_.tag(), procInterface_.comm() @@ -181,7 +181,7 @@ void Foam::calculatedProcessorFvPatchField::initEvaluate ( Pstream::commsTypes::nonBlocking, procInterface_.neighbProcNo(), - reinterpret_cast(sendBuf_.begin()), + reinterpret_cast(sendBuf_.cdata()), this->byteSize(), procInterface_.tag(), procInterface_.comm() @@ -246,7 +246,7 @@ void Foam::calculatedProcessorFvPatchField::initInterfaceMatrixUpdate ( Pstream::commsTypes::nonBlocking, procInterface_.neighbProcNo(), - reinterpret_cast(scalarReceiveBuf_.begin()), + reinterpret_cast(scalarReceiveBuf_.data()), scalarReceiveBuf_.byteSize(), procInterface_.tag(), procInterface_.comm() @@ -257,7 +257,7 @@ void Foam::calculatedProcessorFvPatchField::initInterfaceMatrixUpdate ( Pstream::commsTypes::nonBlocking, procInterface_.neighbProcNo(), - reinterpret_cast(scalarSendBuf_.begin()), + reinterpret_cast(scalarSendBuf_.cdata()), scalarSendBuf_.byteSize(), procInterface_.tag(), procInterface_.comm()