/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2015-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see .
\*---------------------------------------------------------------------------*/
#include "mapDistribute.H"
#include "globalIndexAndTransform.H"
#include "transformField.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(mapDistribute, 0);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::mapDistribute::printLayout(Ostream& os) const
{
mapDistributeBase::printLayout(os);
forAll(transformElements_, i)
{
if (!transformElements_[i].empty())
{
os << "transform " << i << ':' << nl
<< " start : " << transformStart_[i] << nl
<< " size : " << transformElements_[i].size() << endl;
}
}
}
Foam::UPtrList Foam::mapDistribute::extractBase
(
const UPtrList& maps
)
{
UPtrList baseMaps(maps.size());
forAll(maps, i)
{
// Implicit cast to
baseMaps.set(i, maps.get(i));
}
return baseMaps;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::mapDistribute::mapDistribute() noexcept
:
mapDistributeBase(UPstream::worldComm)
{}
Foam::mapDistribute::mapDistribute(const label comm) noexcept
:
mapDistributeBase(comm)
{}
Foam::mapDistribute::mapDistribute(mapDistributeBase&& map)
:
mapDistributeBase(std::move(map))
{}
Foam::mapDistribute::mapDistribute(const mapDistribute& map)
:
mapDistributeBase(map),
transformElements_(map.transformElements_),
transformStart_(map.transformStart_)
{}
Foam::mapDistribute::mapDistribute(mapDistribute&& map)
:
mapDistribute()
{
transfer(map);
}
Foam::mapDistribute::mapDistribute
(
const label constructSize,
labelListList&& subMap,
labelListList&& constructMap,
labelListList&& transformElements,
labelList&& transformStart,
const bool subHasFlip,
const bool constructHasFlip,
const label comm
)
:
mapDistributeBase
(
constructSize,
std::move(subMap),
std::move(constructMap),
subHasFlip,
constructHasFlip,
comm
),
transformElements_(std::move(transformElements)),
transformStart_(std::move(transformStart))
{}
Foam::mapDistribute::mapDistribute
(
const globalIndex& globalNumbering,
labelList& elements,
const globalIndexAndTransform& globalTransforms,
const labelPairList& transformedElements,
labelList& transformedIndices,
List