/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- 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 "CompactListList.H" // * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * // template template Foam::CompactListList::CompactListList(const UList& ll) : UCompactListList(), offsets_(), m_() { UCompactListList::setSizeAndValuesToListList(offsets_, m_, ll); UCompactListList::shallowCopy(UCompactListList(offsets_, m_)); } template template Foam::CompactListList::CompactListList(const UIndirectList& ll) : UCompactListList(), offsets_(), m_() { UCompactListList::setSizeAndValuesToListList(offsets_, m_, ll); UCompactListList::shallowCopy(UCompactListList(offsets_, m_)); } template Foam::CompactListList::CompactListList ( const labelUList& rowSizes, const T& t ) : UCompactListList(), offsets_(rowSizes.size() + 1), m_() { label sumSize = 0; offsets_[0] = 0; forAll(rowSizes, i) { sumSize += rowSizes[i]; offsets_[i+1] = sumSize; } m_.setSize(sumSize, t); UCompactListList::shallowCopy(UCompactListList(offsets_, m_)); } // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template void Foam::CompactListList::setSize(const label mRows) { if (mRows == 0) { clear(); } if (mRows < this->size()) { offsets_.setSize(mRows + 1); m_.setSize(offsets_[mRows]); UCompactListList::shallowCopy(UCompactListList(offsets_, m_)); } else if (mRows > this->size()) { FatalErrorInFunction << "Cannot be used to extend the list from " << offsets_.size() << " to " << mRows << nl << " Please use one of the other setSize member functions" << abort(FatalError); } } template void Foam::CompactListList::setSize ( const label mRows, const label nData ) { offsets_.setSize(mRows + 1); m_.setSize(nData); UCompactListList::shallowCopy(UCompactListList(offsets_, m_)); } template void Foam::CompactListList::setSize ( const label mRows, const label nData, const T& t ) { offsets_.setSize(mRows + 1); m_.setSize(nData, t); UCompactListList::shallowCopy(UCompactListList(offsets_, m_)); } template void Foam::CompactListList::setSize(const labelUList& rowSizes) { offsets_.setSize(rowSizes.size() + 1); label sumSize = 0; offsets_[0] = 0; forAll(rowSizes, i) { sumSize += rowSizes[i]; offsets_[i+1] = sumSize; } m_.setSize(sumSize); UCompactListList::shallowCopy(UCompactListList(offsets_, m_)); } template template void Foam::CompactListList::setSize(const UList& ll) { UCompactListList::setSizeToListList(offsets_, m_, ll); UCompactListList::shallowCopy(UCompactListList(offsets_, m_)); } template template void Foam::CompactListList::setSize(const UIndirectList& ll) { UCompactListList::setSizeToListList(offsets_, m_, ll); UCompactListList::shallowCopy(UCompactListList(offsets_, m_)); } template void Foam::CompactListList::clear() { offsets_ = List