Loading...
Searching...
No Matches
PABLO_userDataLB.tpp
1/*---------------------------------------------------------------------------*\
2 *
3 * bitpit
4 *
5 * Copyright (C) 2015-2021 OPTIMAD engineering Srl
6 *
7 * -------------------------------------------------------------------------
8 * License
9 * This file is part of bitpit.
10 *
11 * bitpit is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU Lesser General Public License v3 (LGPL)
13 * as published by the Free Software Foundation.
14 *
15 * bitpit is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 * License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with bitpit. If not, see <http://www.gnu.org/licenses/>.
22 *
23\*---------------------------------------------------------------------------*/
24
25/*
26 * UserDataLB.tpp
27 *
28 * Created on: 27/mar/2014
29 * Author: Marco Cisternino
30 */
31
32/* \cond
33 */
34template<class D>
35inline size_t UserDataLB<D>::fixedSize() const {
36 return 0;
37}
38
39template<class D>
40inline size_t UserDataLB<D>::size(const uint32_t e) const {
42 return sizeof(double);
43}
44
45template<class D>
46inline void UserDataLB<D>::move(const uint32_t from, const uint32_t to) {
47 data[to] = data[from];
48}
49
50template<class D>
51template<class Buffer>
52inline void UserDataLB<D>::gather(Buffer& buff, const uint32_t e) {
53 buff << data[e];
54}
55
56template<class D>
57template<class Buffer>
58inline void UserDataLB<D>::scatter(Buffer& buff, const uint32_t e) {
59 buff >> data[e];
60}
61
62template<class D>
63inline void UserDataLB<D>::assign(uint32_t stride, uint32_t length) {
64 Data dataCopy = data;
65 typename Data::iterator first = dataCopy.begin() + stride;
66 typename Data::iterator last = first + length;
67 data.assign(first,last);
68#if defined(__INTEL_COMPILER)
69#else
70 data.shrink_to_fit();
71#endif
72 first = dataCopy.end();
73 last = dataCopy.end();
74};
75
76template<class D>
77inline void UserDataLB<D>::resize(uint32_t newSize) {
78 data.resize(newSize);
79}
80
81template<class D>
82inline void UserDataLB<D>::resizeGhost(uint32_t newSize) {
83 ghostdata.resize(newSize);
84}
85
86template<class D>
87inline void UserDataLB<D>::shrink() {
88#if defined(__INTEL_COMPILER)
89#else
90 data.shrink_to_fit();
91#endif
92}
93
94template<class D>
95inline UserDataLB<D>::UserDataLB(Data& data_, Data& ghostdata_) : data(data_), ghostdata(ghostdata_){}
96
97template<class D>
98inline UserDataLB<D>::~UserDataLB() {}
99/* \endcond
100 */
#define BITPIT_UNUSED(variable)
Definition compiler.hpp:63
--- layout: doxygen_footer ---