1
#ifndef BOOST_PP_IS_ITERATING
2
#ifndef _RHEOLEF_POLYMORPHIC_ARRAY_H
3
#define _RHEOLEF_POLYMORPHIC_ARRAY_H
5
/// This file is part of Rheolef.
7
/// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
9
/// Rheolef is free software; you can redistribute it and/or modify
10
/// it under the terms of the GNU General Public License as published by
11
/// the Free Software Foundation; either version 2 of the License, or
12
/// (at your option) any later version.
14
/// Rheolef is distributed in the hope that it will be useful,
15
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
16
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
/// GNU General Public License for more details.
19
/// You should have received a copy of the GNU General Public License
20
/// along with Rheolef; if not, write to the Free Software
21
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
/// =========================================================================
25
#include "rheolef/polymorphic_traits.h"
26
#include "rheolef/polymorphic_data_vector.h"
27
#include "rheolef/polymorphic_data_map.h"
28
#include "rheolef/polymorphic_map.h"
30
#ifdef _RHEOLEF_HAVE_MPI
31
#include "rheolef/polymorphic_scatter_message.h"
32
#include "rheolef/mpi_scatter_init.h"
33
#endif // _RHEOLEF_HAVE_MPI
38
namespace mpl = boost::mpl;
40
template <class T, class V, int NV>
41
struct polymorphic_array_seq_rep {};
43
/// @brief array element output helper
45
struct _polymorphic_array_put_element_type {
46
std::ostream& operator() (std::ostream& os, const T& x) { return os << x; }
49
#ifdef _RHEOLEF_HAVE_MPI
51
template <class T, class V, int NV>
52
struct polymorphic_array_mpi_rep {};
54
template <class Stash, class Message, int NV>
55
struct mpi_polymorphic_assembly_begin_t {};
57
template <class Container, class Message, int NV>
58
struct mpi_polymorphic_assembly_end_t {};
60
template <class Container, class Message, class Buffer, class Tag, int NV>
61
struct mpi_polymorphic_scatter_begin_t {};
63
template <class Container, class Message, class Tag, int NV>
64
struct mpi_polymorphic_scatter_begin_global_t {};
66
template <class Container, class Message, class Buffer, int NV>
67
struct mpi_polymorphic_scatter_end_t {};
69
#endif // _RHEOLEF_HAVE_MPI
71
// ----------------------------------------------------------
72
// run here the recursive inclusion of this file:
73
// ----------------------------------------------------------
74
// _RHEOLEF_POLYMORPHIC_MAX_SIZE was defined by "polymorphic_data_vector.h"
75
#define BOOST_PP_ITERATION_LIMITS (0, _RHEOLEF_POLYMORPHIC_MAX_SIZE)
76
#define BOOST_PP_FILENAME_1 "rheolef/polymorphic_array.h" // this file
77
#include BOOST_PP_ITERATE()
79
} // namespace rheolef
80
#endif // _RHEOLEF_POLYMORPHIC_ARRAY_H
81
#else // BOOST_PP_IS_ITERATING
82
// ----------------------------------------------------------
83
// here, this file is recursively included with growing "N" :
84
// ----------------------------------------------------------
85
#define N BOOST_PP_ITERATION()
87
/*Class:polymorphic_array
88
NAME: polymorphic_array - an array of derived classes (@PACKAGE@-@VERSION@)
91
template <class T, class V> class polymorphic_array_seq_rep;
94
Geometric entities of finite elements are implemented by using
95
a polymorphic hierarchy of classes: the base class @code{geo_element}
96
is a pure virtual methods. Then, derived classes, such as
97
@code{geo_element_t} for a triangle, are introduced with a storage
98
zone for the indexes of its vertices in the mesh (See "geo"(3)).
100
Each element has a fixed size storage zone: a buffer of a
101
particular element type can be efficiently exchanged with MPI.
103
Here is an atempt to generalize the distributed array<T>,
104
with reference counting, to the polymorphic case. The base
105
class is denoted as T and the derived ones are included as
106
a vector of type V, e.g. V=mpl::vctor<T0,T1,T2>.
109
Here, class Ti are suposed to have a method :
110
size_type variant() const;
111
that returns the class index i=0..n_variant-1.
112
A more general approch should us run-time type identification.
114
Finally, the container should honor an optional Allocator template class parameter.
115
SEE ALSO: "geo"(3) "geo_element"(3)
117
LJK-IMAG, 38041 Grenoble cedex 9, France
118
| Pierre.Saramito@imag.fr
119
DATE: 15 december 2010
123
// -------------------------------------------------------------
124
// representation classes
125
// -------------------------------------------------------------
126
template <class T, class V>
127
class polymorphic_array_seq_rep<T,V,N> {
132
static const size_t _n_variant = mpl::size<V>::value; // should be = N
133
typedef typename std::vector<int>::size_type size_type;
134
typedef T element_type;
135
typedef polymorphic_data_map<T,V,N> data_type; // extensible area
136
typedef polymorphic_data_vector<T,V,N> buffer_type; // contiguous area ; for mpi
138
#define _RHEOLEF_typedef(z,k,unused) \
139
typedef typename mpl::at_c<V,k>::type T##k; \
140
typedef typename data_type::map##k##_type map##k##_type;
141
BOOST_PP_REPEAT(N, _RHEOLEF_typedef, ~)
142
#undef _RHEOLEF_typedef
144
struct const_reference {
145
const_reference (const polymorphic_pair_type<T,V,N>& x) : _x(x) {}
146
operator const T& () const { return _x.get_reference(); }
149
const polymorphic_pair_type<T,V,N>& _x;
151
struct const_iterator {
152
typedef typename std::vector<polymorphic_pair_type<T,V,N> >::const_iterator raw_iterator;
153
typedef std::bidirectional_iterator_tag iterator_category;
154
typedef typename raw_iterator::value_type value_type;
155
typedef typename raw_iterator::difference_type difference_type;
156
typedef typename raw_iterator::pointer pointer;
157
typedef typename polymorphic_array_seq_rep<T,V,N>::const_reference reference;
159
const_iterator (raw_iterator ri) : _ri(ri) {}
160
const_reference operator* () const { return const_reference(*_ri); }
161
const_iterator& operator++ () { ++_ri; return *this; }
162
const_iterator& operator-- () { --_ri; return *this; }
163
const_iterator operator++ (int) {
164
const_iterator tmp = *this;
168
const_iterator operator-- (int) {
169
const_iterator tmp = *this;
173
bool operator== (const_iterator j) const { return _ri == j._ri; }
174
bool operator!= (const_iterator j) const { return _ri != j._ri; }
179
reference (polymorphic_array_seq_rep<T,V,N>& x, size_type index)
180
: _x(x), _index(index) {}
181
operator const T& () const { return _x.rhs (_index); }
182
operator T& () { return _x.rhs_non_const (_index); }
184
size_type variant() const { return _x.variant(_index); }
186
#define _RHEOLEF_assign(z,k,unused) \
187
reference& operator= (const T##k& value) { \
188
_x.assign (_index, value); \
191
BOOST_PP_REPEAT(N, _RHEOLEF_assign, ~)
192
#undef _RHEOLEF_assign
195
reference& operator= (const_reference ref);
199
polymorphic_array_seq_rep<T,V,N>& _x;
203
typedef std::bidirectional_iterator_tag iterator_category;
204
typedef T value_type;
205
typedef std::ptrdiff_t difference_type;
207
typedef typename polymorphic_array_seq_rep<T,V,N>::reference reference;
209
iterator (polymorphic_array_seq_rep<T,V,N>& x, size_type index)
210
: _x(x), _index(index) {}
211
operator const_iterator() const { return const_iterator (_x._ptr.begin() + _index); }
212
reference operator* () const { return reference(_x,_index); }
213
iterator& operator++ () { ++_index; return *this; }
214
iterator& operator-- () { --_index; return *this; }
215
iterator operator++ (int) {
216
iterator tmp = *this;
220
iterator operator-- (int) {
221
iterator tmp = *this;
225
bool operator== (iterator j) const { return _index == j._index; }
226
bool operator!= (iterator j) const { return _index != j._index; }
229
polymorphic_array_seq_rep<T,V,N>& _x;
235
polymorphic_array_seq_rep (size_type loc_size = 0);
236
polymorphic_array_seq_rep (const distributor& ownership);
237
polymorphic_array_seq_rep (const array_seq_rep<T>& x);
238
void resize (const distributor& ownership);
239
void resize (size_type loc_size);
243
size_type size() const { return _ptr.size(); }
244
size_type dis_size() const { return size(); }
245
reference operator[] (size_type index) { return reference (*this, index); }
246
const_reference operator[] (size_type index) const { return const_reference (_ptr[index]); }
247
size_type variant (size_type index) const { return _ptr[index].variant(); }
248
const_iterator begin () const { return const_iterator (_ptr.begin()); }
249
const_iterator end () const { return const_iterator (_ptr.end()); }
250
iterator begin () { return iterator (*this, 0); }
251
iterator end () { return iterator (*this, _ptr.size()); }
252
const distributor& ownership() const { return _ownership; }
253
const communicator& comm() const { return ownership().comm(); }
255
#define _RHEOLEF_set(z,k,unused) \
256
void set_dis_entry (size_type index, const T##k& value) { assign (index, value); }
257
BOOST_PP_REPEAT(N, _RHEOLEF_set, ~)
262
idiststream& get_values (idiststream& ips);
263
odiststream& put_values (odiststream& ops) const;
264
template <class PutFunction> odiststream& put_values (odiststream& opsa, PutFunction put_element) const;
265
void dump (std::string name) const;
269
const T& rhs (size_type index) const { return _ptr [index].get_reference(); }
270
T& rhs_non_const (size_type index) { return _ptr [index].get_reference(); }
271
void erase (size_type index);
274
#define _RHEOLEF_load(z,k,unused) \
275
void load (const std::vector<std::pair<size_type,T##k> >& buffer); \
276
void assign (size_type index, const T##k& value);
277
BOOST_PP_REPEAT(N, _RHEOLEF_load, ~)
283
friend class polymorphic_map_rep<T,V,N>;
284
distributor _ownership;
285
std::vector<polymorphic_pair_type<T,V,N> > _ptr;
288
#ifdef _RHEOLEF_HAVE_MPI
289
template <class T, class V>
290
class polymorphic_array_mpi_rep<T,V,N> : public polymorphic_array_seq_rep<T,V,N> {
295
static const size_t _n_variant = mpl::size<V>::value; // should be = N
296
typedef polymorphic_array_seq_rep<T,V,N> seq;
297
typedef typename seq::size_type size_type;
298
typedef T element_type;
299
typedef typename seq::data_type data_type;
300
typedef typename seq::buffer_type buffer_type;
301
typedef typename seq::reference reference;
302
typedef typename seq::const_reference const_reference;
303
typedef typename seq::iterator iterator;
304
typedef typename seq::const_iterator const_iterator;
306
#define _RHEOLEF_typedef(z,k,unused) \
307
typedef typename mpl::at_c<V,k>::type T##k; \
308
typedef typename data_type::map##k##_type map##k##_type;
309
BOOST_PP_REPEAT(N, _RHEOLEF_typedef, ~)
310
#undef _RHEOLEF_typedef
315
polymorphic_array_mpi_rep (size_type dis_size = 0, size_type loc_size = distributor::decide);
316
void resize (size_type dis_size = 0, size_type loc_size = distributor::decide);
319
polymorphic_array_mpi_rep (const distributor& ownership);
320
void resize (const distributor& ownership);
321
polymorphic_array_mpi_rep (const polymorphic_array_mpi_rep<T,V,N>& x);
323
// accessors & modifiers:
325
size_type size() const { return polymorphic_array_seq_rep<T,V,N>::size(); }
326
size_type dis_size() const { return ownership().dis_size(); }
328
const distributor& ownership() const { return polymorphic_array_seq_rep<T,V,N>::ownership(); }
329
const communicator& comm() const { return ownership().comm(); }
331
const_reference operator[] (size_type index) const {
332
return polymorphic_array_seq_rep<T,V,N>::operator[] (index);
334
reference operator[] (size_type index) {
335
return polymorphic_array_seq_rep<T,V,N>::operator[] (index);
337
const_iterator begin () const { return seq::begin(); }
338
const_iterator end () const { return seq::end(); }
339
iterator begin () { return seq::begin(); }
340
iterator end () { return seq::end(); }
342
#define _RHEOLEF_set(z,k,unused) \
343
void set_dis_entry (size_type dis_index, const T##k& value);
344
BOOST_PP_REPEAT(N, _RHEOLEF_set, ~)
347
void dis_entry_assembly_begin ();
348
void dis_entry_assembly_end ();
350
void repartition ( // old_numbering for *this
351
const array_mpi_rep<size_type>& partition, // old_ownership
352
polymorphic_array_mpi_rep<T,V,N>& new_array, // new_ownership (created)
353
array_mpi_rep<size_type>& old_numbering, // new_ownership
354
array_mpi_rep<size_type>& new_numbering) const; // old_ownership
357
void get_dis_entry (const Set& ext_idx_set, polymorphic_map_rep<T,V,N>& ext_idx_map) const;
361
idiststream& get_values (idiststream& ips);
362
odiststream& put_values (odiststream& ops) const;
363
template <class Permutation>
364
odiststream& permuted_put_values (odiststream& ops, const Permutation& perm) const;
365
template <class Permutation, class PutFunction>
366
odiststream& permuted_put_values (odiststream& ops, const Permutation& perm,
367
PutFunction put_element) const;
368
void dump (std::string name) const;
371
typedef polymorphic_data_map<T,V,_n_variant> stash_type;
372
struct message_type {
373
boost::array<std::list<std::pair<size_t,mpi::request> >,_n_variant> waits;
374
polymorphic_data_vector<T,V,_n_variant> data;
379
message_type _receive;
380
boost::array<size_type,_n_variant> _receive_max_size;
382
#endif // _RHEOLEF_HAVE_MPI
384
#ifndef _RHEOLEF_POLYMORPHIC_ARRAY
385
#define _RHEOLEF_POLYMORPHIC_ARRAY
386
// -------------------------------------------------------------
387
// wrapper class: sequential polymorphic_array
388
// -------------------------------------------------------------
389
template <class T, class M = rheo_default_memory_model, class V = typename polymorphic_traits<T>::derived_type>
390
struct polymorphic_array {};
392
//<polymorphic_array:
393
template <class T, class V>
394
class polymorphic_array<T,sequential,V> : public smart_pointer<polymorphic_array_seq_rep<T,V,mpl::size<V>::value> > {
399
static const size_t _n_variant = mpl::size<V>::value;
401
typedef sequential memory_type;
402
typedef polymorphic_array_seq_rep<T,V,_n_variant> rep;
403
typedef smart_pointer<rep> base;
404
typedef typename rep::size_type size_type;
405
typedef typename rep::reference reference;
406
typedef typename rep::const_reference const_reference;
407
typedef typename rep::iterator iterator;
408
typedef typename rep::const_iterator const_iterator;
412
polymorphic_array (size_type n = 0);
413
void resize (size_type n);
414
polymorphic_array (const distributor& ownership);
415
void resize (const distributor& ownership);
417
// accessors & modifiers:
419
size_type size () const;
420
size_type dis_size() const;
421
reference operator[] (size_type i);
422
const_reference operator[] (size_type i) const;
423
const_iterator begin () const;
424
const_iterator end () const;
428
const distributor& ownership() const;
429
const communicator& comm() const;
433
idiststream& get_values (idiststream& ips);
434
odiststream& put_values (odiststream& ops) const;
435
template <class PutFunction> odiststream& put_values (odiststream& ops, PutFunction put_element) const;
436
void dump (std::string name) const;
438
template <class T, class V>
439
odiststream& operator<< (odiststream& ops, const polymorphic_array<T,sequential,V>& x);
441
template <class T, class V>
442
idiststream& operator>> (idiststream& ips, polymorphic_array<T,sequential,V>& x);
443
//>polymorphic_array:
445
template <class T, class V>
447
polymorphic_array<T,sequential,V>::polymorphic_array (const distributor& ownership)
448
: base (new_macro(rep(ownership)))
451
template <class T, class V>
453
polymorphic_array<T,sequential,V>::polymorphic_array (size_type n)
454
: base (new_macro(rep(n)))
457
template <class T, class V>
460
polymorphic_array<T,sequential,V>::resize (size_type n)
462
return base::data().resize(n);
464
template <class T, class V>
467
polymorphic_array<T,sequential,V>::resize (const distributor& ownership)
469
return base::data().resize(ownership);
471
template <class T, class V>
473
typename polymorphic_array<T,sequential,V>::size_type
474
polymorphic_array<T,sequential,V>::size () const
476
return base::data().size();
478
template <class T, class V>
480
typename polymorphic_array<T,sequential,V>::size_type
481
polymorphic_array<T,sequential,V>::dis_size () const
483
return base::data().dis_size();
485
template <class T, class V>
487
typename polymorphic_array<T,sequential,V>::reference
488
polymorphic_array<T,sequential,V>::operator[] (size_type i)
490
return base::data().operator[] (i);
492
template <class T, class V>
494
typename polymorphic_array<T,sequential,V>::const_reference
495
polymorphic_array<T,sequential,V>::operator[] (size_type i) const
497
return base::data().operator[] (i);
499
template <class T, class V>
501
typename polymorphic_array<T,sequential,V>::iterator
502
polymorphic_array<T,sequential,V>::begin ()
504
return base::data().begin();
506
template <class T, class V>
508
typename polymorphic_array<T,sequential,V>::iterator
509
polymorphic_array<T,sequential,V>::end ()
511
return base::data().end();
513
template <class T, class V>
515
typename polymorphic_array<T,sequential,V>::const_iterator
516
polymorphic_array<T,sequential,V>::begin () const
518
return base::data().begin();
520
template <class T, class V>
522
typename polymorphic_array<T,sequential,V>::const_iterator
523
polymorphic_array<T,sequential,V>::end () const
525
return base::data().end();
527
template <class T, class V>
530
polymorphic_array<T,sequential,V>::ownership () const
532
return base::data().ownership();
534
template <class T, class V>
537
polymorphic_array<T,sequential,V>::comm() const
539
return base::data().comm();
541
template <class T, class V>
544
polymorphic_array<T,sequential,V>::get_values(idiststream& ips)
546
return base::data().get_values(ips);
548
template <class T, class V>
549
template <class PutFunction>
552
polymorphic_array<T,sequential,V>::put_values(odiststream& ops, PutFunction put_element) const
554
return base::data().put_values (ops, put_element);
556
template <class T, class V>
559
polymorphic_array<T,sequential,V>::put_values(odiststream& ops) const
561
return base::data().put_values(ops);
563
template <class T, class V>
566
polymorphic_array<T,sequential,V>::dump(std::string name) const
568
return base::data().dump (name);
570
template <class T, class V>
573
operator<< (odiststream& ops, const polymorphic_array<T,sequential,V>& x) {
574
return x.put_values (ops);
576
template <class T, class V>
579
operator>> (idiststream& ips, polymorphic_array<T,sequential,V>& x) {
580
return x.get_values(ips);
582
// -------------------------------------------------------------
583
// wrapper class: distributed polymorphic_array
584
// -------------------------------------------------------------
585
#ifdef _RHEOLEF_HAVE_MPI
587
//<polymorphic_array:
588
template <class T, class V>
589
class polymorphic_array<T,distributed,V> : public smart_pointer<polymorphic_array_mpi_rep<T,V,mpl::size<V>::value> > {
594
static const size_t _n_variant = mpl::size<V>::value;
596
typedef distributed memory_type;
597
typedef polymorphic_array_mpi_rep<T,V,_n_variant> rep;
598
typedef smart_pointer<rep> base;
599
typedef typename rep::size_type size_type;
600
typedef typename rep::reference reference;
601
typedef typename rep::const_reference const_reference;
602
typedef typename rep::iterator iterator;
603
typedef typename rep::const_iterator const_iterator;
608
polymorphic_array (size_type n = 0);
609
void resize (size_type n);
611
polymorphic_array (const distributor& ownership = distributor());
612
void resize (const distributor& ownership);
614
// accessors & modifiers:
616
size_type size () const;
617
size_type dis_size () const;
618
reference operator[] (size_type i);
619
const_reference operator[] (size_type i) const;
620
const_iterator begin () const;
621
const_iterator end () const;
625
const distributor& ownership() const;
626
const communicator& comm() const;
628
void dis_entry_assembly_begin ();
629
void dis_entry_assembly_end ();
631
void repartition ( // old_numbering for *this
632
const array<size_type,distributed>& partition, // old_ownership
633
polymorphic_array<T,distributed,V>& new_array, // new_ownership (created)
634
array<size_type,distributed>& old_numbering, // new_ownership
635
array<size_type,distributed>& new_numbering) const; // old_ownership
638
void get_dis_entry (const Set& ext_idx_set, polymorphic_map<T,V>& ext_idx_map) const;
642
idiststream& get_values (idiststream& ips);
643
odiststream& put_values (odiststream& ops) const;
644
template <class Permutation>
645
odiststream& permuted_put_values (odiststream& ops, const Permutation& perm) const;
646
template <class Permutation, class PutFunction>
647
odiststream& permuted_put_values (odiststream& ops, const Permutation& perm,
648
PutFunction put_element) const;
649
void dump (std::string name) const;
651
template <class T, class V>
652
odiststream& operator<< (odiststream& ops, const polymorphic_array<T,distributed,V>& x);
654
template <class T, class V>
655
idiststream& operator>> (idiststream& ips, polymorphic_array<T,distributed,V>& x);
656
//>polymorphic_array:
659
template <class T, class V>
661
polymorphic_array<T,distributed,V>::polymorphic_array (size_type n)
662
: base (new_macro(rep(n)))
665
template <class T, class V>
668
polymorphic_array<T,distributed,V>::resize (size_type n)
670
return base::data().resize(n);
673
template <class T, class V>
675
polymorphic_array<T,distributed,V>::polymorphic_array (const distributor& ownership)
676
: base (new_macro(rep(ownership)))
679
template <class T, class V>
682
polymorphic_array<T,distributed,V>::resize (const distributor& ownership)
684
return base::data().resize(ownership);
686
template <class T, class V>
688
typename polymorphic_array<T,distributed,V>::size_type
689
polymorphic_array<T,distributed,V>::size () const
691
return base::data().size();
693
template <class T, class V>
695
typename polymorphic_array<T,distributed,V>::size_type
696
polymorphic_array<T,distributed,V>::dis_size () const
698
return base::data().dis_size();
700
template <class T, class V>
702
typename polymorphic_array<T,distributed,V>::reference
703
polymorphic_array<T,distributed,V>::operator[] (size_type i)
705
return base::data().operator[] (i);
707
template <class T, class V>
709
typename polymorphic_array<T,distributed,V>::const_reference
710
polymorphic_array<T,distributed,V>::operator[] (size_type i) const
712
return base::data().operator[] (i);
714
template <class T, class V>
716
typename polymorphic_array<T,distributed,V>::iterator
717
polymorphic_array<T,distributed,V>::begin ()
719
return base::data().begin();
721
template <class T, class V>
723
typename polymorphic_array<T,distributed,V>::iterator
724
polymorphic_array<T,distributed,V>::end ()
726
return base::data().end();
728
template <class T, class V>
730
typename polymorphic_array<T,distributed,V>::const_iterator
731
polymorphic_array<T,distributed,V>::begin () const
733
return base::data().begin();
735
template <class T, class V>
737
typename polymorphic_array<T,distributed,V>::const_iterator
738
polymorphic_array<T,distributed,V>::end () const
740
return base::data().end();
742
template <class T, class V>
745
polymorphic_array<T,distributed,V>::ownership () const
747
return base::data().ownership();
749
template <class T, class V>
752
polymorphic_array<T,distributed,V>::comm() const
754
return base::data().comm();
756
template <class T, class V>
759
polymorphic_array<T,distributed,V>::get_values(idiststream& ips)
761
return base::data().get_values(ips);
763
template <class T, class V>
766
polymorphic_array<T,distributed,V>::put_values(odiststream& ops) const
768
return base::data().put_values(ops);
770
template <class T, class V>
773
polymorphic_array<T,distributed,V>::dis_entry_assembly_begin ()
775
return base::data().dis_entry_assembly_begin();
777
template <class T, class V>
780
polymorphic_array<T,distributed,V>::dis_entry_assembly_end ()
782
return base::data().dis_entry_assembly_end();
784
template <class T, class V>
785
template <class Permutation>
788
polymorphic_array<T,distributed,V>::permuted_put_values (
790
const Permutation& perm) const
792
return base::data().permuted_put_values (ops, perm);
794
template <class T, class V>
795
template <class Permutation, class PutFunction>
798
polymorphic_array<T,distributed,V>::permuted_put_values (
800
const Permutation& perm,
801
PutFunction put_element) const
803
return base::data().permuted_put_values (ops, perm, put_element);
805
template <class T, class V>
808
polymorphic_array<T,distributed,V>::dump(std::string name) const
810
return base::data().dump (name);
812
template <class T, class V>
815
operator<< (odiststream& ops, const polymorphic_array<T,distributed,V>& x) {
816
return x.put_values (ops);
818
template <class T, class V>
821
operator>> (idiststream& ips, polymorphic_array<T,distributed,V>& x) {
822
return x.get_values (ips);
824
template <class T, class V>
827
polymorphic_array<T,distributed,V>::repartition (
828
const array<size_type,distributed>& partition,
829
polymorphic_array<T,distributed,V>& new_array,
830
array<size_type,distributed>& old_numbering,
831
array<size_type,distributed>& new_numbering) const
833
base::data().repartition (
836
old_numbering.data(),
837
new_numbering.data());
839
template <class T, class V>
843
polymorphic_array<T,distributed,V>::get_dis_entry (
844
const Set& ext_idx_set,
845
polymorphic_map<T,V>& ext_idx_map) const
847
base::data().get_dis_entry (ext_idx_set, ext_idx_map.data());
849
#endif // _RHEOLEF_HAVE_MPI
852
#endif // _RHEOLEF_POLYMORPHIC_ARRAY
853
// -------------------------------------------------------------
854
// not inlined : longer code
855
// -------------------------------------------------------------
856
#include "rheolef/polymorphic_array_seq.icc"
857
#include "rheolef/polymorphic_array_mpi.icc"
859
#endif // BOOST_PP_IS_ITERATING