1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Various utility functions that perform mesh-related operations.
33 University of Massachusetts Amherst
36 \*---------------------------------------------------------------------------*/
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 // Parallel non-blocking send for fixed lists
50 template <class Type, unsigned Size>
54 const FixedList<Type, Size>& data
61 reinterpret_cast<const char*>(&data[0]),
67 // Parallel non-blocking receive for fixed lists
68 template <class Type, unsigned Size>
72 FixedList<Type, Size>& data
79 reinterpret_cast<char*>(data.begin()),
85 // Parallel non-blocking send for lists
90 const UList<Type>& data
97 reinterpret_cast<const char*>(&data[0]),
98 data.size()*sizeof(Type)
103 // Parallel non-blocking receive for lists
104 template <class Type>
113 Pstream::nonBlocking,
115 reinterpret_cast<char*>(&data[0]),
116 data.size()*sizeof(Type)
121 // Utility method to size-up the list to include an item
122 template <class Type>
123 inline void sizeUpList
129 list.setSize(list.size() + 1, item);
133 // Utility method to size-down the list to remove an item
134 template <class Type>
135 inline void sizeDownList
143 if ((index = findIndex(list, item)) > -1)
145 meshOps::removeIndex(index, list);
151 "inline void meshOps::sizeDownList"
152 "(const Type& item, List<Type>& list)"
154 << nl << "Item: " << item
155 << " was not found in list. " << nl
156 << " List: " << nl << list
157 << abort(FatalError);
162 // Remove an item at a particular index in the list
163 template <class Type>
164 inline void removeIndex
171 List<Type> newList(list.size() - 1);
173 // Copy individual items
183 newList[n++] = list[itemI];
187 list.transfer(newList);
191 } // End namespace meshOps
194 } // End namespace Foam
196 // ************************************************************************* //