11 #ifndef FIELD_LAYOUT_H
12 #define FIELD_LAYOUT_H
51 template <
unsigned Dim>
60 template<
unsigned Dim>
141 unsigned vnodes1,
unsigned vnodes2,
142 bool recurse=
false,
int vnodes=-1);
145 unsigned vnodes1,
unsigned vnodes2,
unsigned vnodes3,
146 bool recurse=
false,
int vnodes=-1);
151 unsigned vnodes1,
unsigned vnodes2,
unsigned vnodes3,
153 bool recurse=
false,
int vnodes=-1);
158 unsigned vnodes1,
unsigned vnodes2,
unsigned vnodes3,
159 unsigned vnodes4,
unsigned vnodes5,
160 bool recurse=
false,
int vnodes=-1);
165 unsigned vnodes1,
unsigned vnodes2,
unsigned vnodes3,
166 unsigned vnodes4,
unsigned vnodes5,
unsigned vnodes6,
167 bool recurse=
false,
int vnodes=-1);
192 unsigned* vnodesPerDirection,
193 bool recurse=
false,
int vnodes=-1 ) {
194 initialize(domain,p,vnodesPerDirection,recurse,vnodes);
219 const int *nbegin,
const int *nend);
265 bool recurse=
false,
int vnodes=-1);
268 unsigned vnodes1,
unsigned vnodes2,
269 bool recurse=
false,
int vnodes=-1);
272 unsigned vnodes1,
unsigned vnodes2,
unsigned vnodes3,
273 bool recurse=
false,
int vnodes=-1);
278 unsigned vnodes1,
unsigned vnodes2,
unsigned vnodes3,
280 bool recurse=
false,
int vnodes=-1);
285 unsigned vnodes1,
unsigned vnodes2,
unsigned vnodes3,
286 unsigned vnodes4,
unsigned vnodes5,
287 bool recurse=
false,
int vnodes=-1);
292 unsigned vnodes1,
unsigned vnodes2,
unsigned vnodes3,
293 unsigned vnodes4,
unsigned vnodes5,
unsigned vnodes6,
294 bool recurse=
false,
int vnodes=-1);
296 unsigned* vnodesPerDirection,
297 bool recurse=
false,
int vnodes=-1);
307 const int *nbegin,
const int *nend);
335 template <
unsigned Dim2>
344 bool read(
const char *filename);
348 bool write(
const char *filename);
388 for (
unsigned int d=0; d <
Dim; ++d)
436 void write(std::ostream&)
const;
477 template<
unsigned Dim>
481 initialize(i1, p1, vnodes);
484 template<
unsigned Dim>
489 initialize(i1, i2, p1, p2, vnodes);
492 template<
unsigned Dim>
499 initialize(i1, i2, i3, p1, p2, p3, vnodes);
502 template<
unsigned Dim>
510 initialize(i1, i2, i3, i4, p1, p2, p3, p4, vnodes);
513 template<
unsigned Dim>
522 initialize(i1, i2, i3, i4, i5, p1, p2, p3, p4, p5, vnodes);
525 template<
unsigned Dim>
534 initialize(i1, i2, i3, i4, i5, i6, p1, p2, p3, p4, p5, p6, vnodes);
544 template<
unsigned Dim>
549 bool recurse,
int vnodes)
552 if (vnodes == -1) vnodes = vnodes1;
554 if ((
unsigned int) vnodes != vnodes1) {
555 ERRORMSG(
"FieldLayout constructor: "
556 <<
"(vnodes1 != vnodes)"
557 <<
" ; vnodes1 = " << vnodes1
558 <<
" ; vnodes = " << vnodes <<
endl);
560 initialize(i1, p1, vnodes1, recurse,vnodes);
563 template<
unsigned Dim>
567 unsigned vnodes1,
unsigned vnodes2,
568 bool recurse,
int vnodes)
571 if (vnodes == -1) vnodes = vnodes1*vnodes2;
573 if ((
unsigned int) vnodes != vnodes1*vnodes2) {
574 ERRORMSG(
"FieldLayout constructor: "
575 <<
"(vnodes != vnodes1*vnodes2)"
576 <<
" ; vnodes1 = " << vnodes1 <<
" ; vnodes2 = " << vnodes2
577 <<
" ; vnodes = " << vnodes <<
endl);
579 initialize(i1, i2, p1, p2, vnodes1, vnodes2, recurse, vnodes);
582 template<
unsigned Dim>
587 unsigned vnodes1,
unsigned vnodes2,
589 bool recurse,
int vnodes)
592 if (vnodes == -1) vnodes = vnodes1*vnodes2*vnodes3;
594 if ((
unsigned int) vnodes != vnodes1*vnodes2*vnodes3) {
595 ERRORMSG(
"FieldLayout constructor: "
596 <<
"(vnodes != vnodes1*vnodes2*vnodes3)"
597 <<
" ; vnodes1 = " << vnodes1 <<
" ; vnodes2 = " << vnodes2
598 <<
" ; vnodes3 = " << vnodes3
599 <<
" ; vnodes = " << vnodes <<
endl);
601 initialize(i1, i2, i3, p1, p2, p3, vnodes1, vnodes2, vnodes3, recurse, vnodes);
604 template<
unsigned Dim>
610 unsigned vnodes1,
unsigned vnodes2,
611 unsigned vnodes3,
unsigned vnodes4,
612 bool recurse,
int vnodes)
615 if (vnodes == -1) vnodes = vnodes1*vnodes2*vnodes3*vnodes4;
617 if ((
unsigned int) vnodes != vnodes1*vnodes2*vnodes3*vnodes4) {
618 ERRORMSG(
"FieldLayout constructor: "
619 <<
"(vnodes != vnodes1*vnodes2*vnodes3*vnodes4)"
620 <<
" ; vnodes1 = " << vnodes1 <<
" ; vnodes2 = " << vnodes2
621 <<
" ; vnodes3 = " << vnodes3 <<
" ; vnodes4 = " << vnodes4
622 <<
" ; vnodes = " << vnodes <<
endl);
624 initialize(i1, i2, i3, i4, p1, p2, p3, p4,
625 vnodes1, vnodes2, vnodes3, recurse, vnodes);
628 template<
unsigned Dim>
635 unsigned vnodes1,
unsigned vnodes2,
636 unsigned vnodes3,
unsigned vnodes4,
638 bool recurse,
int vnodes)
641 if (vnodes == -1) vnodes = vnodes1*vnodes2*vnodes3*vnodes4*vnodes5;
643 if ((
unsigned int) vnodes != vnodes1*vnodes2*vnodes3*vnodes4*vnodes5) {
644 ERRORMSG(
"FieldLayout constructor: "
645 <<
"(vnodes != vnodes1*vnodes2*vnodes3*vnodes4*vnodes5)"
646 <<
" ; vnodes1 = " << vnodes1 <<
" ; vnodes2 = " << vnodes2
647 <<
" ; vnodes3 = " << vnodes3 <<
" ; vnodes4 = " << vnodes4
648 <<
" ; vnodes5 = " << vnodes5
649 <<
" ; vnodes = " << vnodes <<
endl);
651 initialize(i1, i2, i3, i4, i5, p1, p2, p3, p4, p5,
652 vnodes1, vnodes2, vnodes3, vnodes4, vnodes5, recurse, vnodes);
655 template<
unsigned Dim>
662 unsigned vnodes1,
unsigned vnodes2,
663 unsigned vnodes3,
unsigned vnodes4,
664 unsigned vnodes5,
unsigned vnodes6,
665 bool recurse,
int vnodes)
668 if (vnodes == -1) vnodes = vnodes1*vnodes2*vnodes3*vnodes4*vnodes5*vnodes6;
670 if ((
unsigned int) vnodes != vnodes1*vnodes2*vnodes3*vnodes4*vnodes5*vnodes6) {
671 ERRORMSG(
"FieldLayout constructor: "
672 <<
"(vnodes != vnodes1*vnodes2*vnodes3*vnodes4*vnodes5*vnodes6)"
673 <<
" ; vnodes1 = " << vnodes1 <<
" ; vnodes2 = " << vnodes2
674 <<
" ; vnodes3 = " << vnodes3 <<
" ; vnodes4 = " << vnodes4
675 <<
" ; vnodes5 = " << vnodes5 <<
" ; vnodes6 = " << vnodes6
676 <<
" ; vnodes = " << vnodes <<
endl);
678 initialize(i1, i2, i3, i4, i5, i6, p1, p2, p3, p4, p5, p6,
679 vnodes1, vnodes2, vnodes3, vnodes4, vnodes5, vnodes6, recurse, vnodes);
682 template<
unsigned Dim>
690 initialize(Domain, dombegin, domend, nbegin, nend);
700 template<
unsigned Dim>
704 return Local_ac.size();
707 template<
unsigned Dim>
711 return Local_ac.begin();
714 template<
unsigned Dim>
718 return Local_ac.end();
721 template<
unsigned Dim>
725 return Local_ac.begin();
728 template<
unsigned Dim>
732 return Local_ac.end();
735 template<
unsigned Dim>
739 return Remotes_ac.size();
742 template<
unsigned Dim>
746 return Remotes_ac.begin();
749 template<
unsigned Dim>
753 return Remotes_ac.end();
756 template<
unsigned Dim>
760 return Remotes_ac[gc]->size();
763 template<
unsigned Dim>
767 return Remotes_ac[gc]->begin();
770 template<
unsigned Dim>
774 return Remotes_ac[gc]->end();
777 template<
unsigned Dim>
783 return Remotes_ac[gc]->touch_range(domain);
789 template<
unsigned Dim>
PartBunchBase< T, Dim >::ConstIterator end(PartBunchBase< T, Dim > const &bunch)
PartBunchBase< T, Dim >::ConstIterator begin(PartBunchBase< T, Dim > const &bunch)
std::ostream & operator<<(std::ostream &, const FieldLayout< Dim > &)
Inform & endl(Inform &inf)
void Repartition(const NDIndex< Dim > &domain)
bool write(const char *filename)
touch_range_dv touch_range_rdv(const NDIndex< Dim > &domain, const GuardCellSizes< Dim > &gc=gc0()) const
const NDIndex< Dim > & getDomain() const
iterator_dv begin_rdv(const GuardCellSizes< Dim > &gc=gc0())
UserList::ID_t get_Id() const
void new_gc_layout(const GuardCellSizes< Dim > &)
int numVnodes(void) const
FieldLayout(const NDIndex< Dim > &domain, e_dim_tag *p=0, int vnodes=-1)
static GuardCellSizes< Dim > gc0()
void Repartition(const NDIndex< Dim > *, const NDIndex< Dim > *)
bool read(const char *filename)
NDIndex< Dim > getLocalNDIndex()
bool fitsGuardCells(const GuardCellSizes< Dim > &gc) const
iterator_gdv begin_rgdv()
ac_gc_domain_vnodes Remotes_ac
void checkout(FieldLayoutUser &f)
unsigned getVnodesPerDirection(unsigned dir)
ac_domain_vnodes::iterator iterator_dv
iterator_dv end_rdv(const GuardCellSizes< Dim > &gc=gc0())
ac_gc_domain_vnodes::iterator iterator_gdv
ac_id_vnodes::const_iterator const_iterator_iv
e_dim_tag RequestedLayout[Dim]
ac_gc_domain_vnodes::size_type size_rgdv() const
ac_domain_vnodes::touch_iterator touch_iterator_dv
FieldLayout(const NDIndex< Dim > &domain, e_dim_tag *p, unsigned *vnodesPerDirection, bool recurse=false, int vnodes=-1)
unsigned * vnodesPerDirection_m
DomainMap< NDIndex< Dim >, RefCountedP< Vnode< Dim > >, Touches< Dim >, Contains< Dim >, Split< Dim > > ac_domain_vnodes
unsigned int MinWidth[Dim]
std::pair< touch_iterator_dv, touch_iterator_dv > touch_range_dv
void initialize(const Index &i1, e_dim_tag p1=PARALLEL, int vnodes=-1)
size_type_if size_if() const
void setup(const NDIndex< Dim > &, e_dim_tag *, int)
ac_id_vnodes::size_type size_iv() const
iterator_user iterator_if
void checkin(FieldLayoutUser &f, const GuardCellSizes< Dim > &gc=gc0())
vmap< GuardCellSizes< Dim >, my_auto_ptr< ac_domain_vnodes > > ac_gc_domain_vnodes
vmap< Unique::type, my_auto_ptr< Vnode< Dim > > > ac_id_vnodes
ac_id_vnodes::iterator iterator_iv
e_dim_tag getRequestedDistribution(unsigned int d) const
ac_domain_vnodes::size_type size_rdv(const GuardCellSizes< Dim > &gc=gc0()) const
size_type_user size_type_if
e_dim_tag getDistribution(unsigned int d) const
bool operator==(const FieldLayout< Dim2 > &x) const
unsigned left(unsigned d) const
unsigned right(unsigned d) const
iterator_user begin_user()
ID_t getUserListID() const
UserList_t::iterator iterator_user
size_type_user getNumUsers() const
UserList_t::size_type size_type_user
rep_type::iterator iterator
rep_type::size_type size_type
rep_type::const_iterator const_iterator