~ubuntu-branches/ubuntu/trusty/rheolef/trusty

« back to all changes in this revision

Viewing changes to skit/plib2/polymorphic_scatter_message.h

  • Committer: Package Import Robot
  • Author(s): Pierre Saramito
  • Date: 2012-04-06 09:12:21 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20120406091221-m58me99p1nxqui49
Tags: 6.0-1
* New upstream release 6.0 (major changes):
  - massively distributed and parallel support
  - full FEM characteristic method (Lagrange-Gakerkin method) support
  - enhanced users documentation 
  - source code supports g++-4.7 (closes: #667356)
* debian/control: dependencies for MPI distributed solvers added
* debian/rules: build commands simplified
* debian/librheolef-dev.install: man1/* to man9/* added
* debian/changelog: package description rewritted (closes: #661689)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef BOOST_PP_IS_ITERATING
2
 
#ifndef _RHEOLEF_POLYMORHIC_SCATTER_MESSAGE_H
3
 
#define _RHEOLEF_POLYMORHIC_SCATTER_MESSAGE_H
4
 
///
5
 
/// This file is part of Rheolef.
6
 
///
7
 
/// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
8
 
///
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.
13
 
///
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.
18
 
///
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
22
 
/// 
23
 
/// =========================================================================
24
 
//
25
 
// create distributed to sequential scatter context for polymorphic_array
26
 
//
27
 
#include "rheolef/polymorphic_data_vector.h"
28
 
 
29
 
namespace rheolef {
30
 
 
31
 
/// @brief scatter buffer for polymorphic_array
32
 
template<class T, class V, int NV>
33
 
struct polymorphic_scatter_buffer {};
34
 
 
35
 
/// @brief scatter mesage area handler for polymorphic_array
36
 
template<class T, class V, int NV>
37
 
struct polymorphic_scatter_message {};
38
 
 
39
 
// ----------------------------------------------------------
40
 
// run here the recursive inclusion of this file:
41
 
// ----------------------------------------------------------
42
 
// _RHEOLEF_POLYMORPHIC_MAX_SIZE was defined by "polymorphic_data_vector.h"
43
 
#define BOOST_PP_ITERATION_LIMITS (0, _RHEOLEF_POLYMORPHIC_MAX_SIZE)
44
 
#define BOOST_PP_FILENAME_1    "rheolef/polymorphic_scatter_message.h" // this file
45
 
#include BOOST_PP_ITERATE()
46
 
 
47
 
} // namespace rheolef
48
 
#endif // _RHEOLEF_POLYMORPHIC_SCATTER_MESSAGE_H
49
 
#else // BOOST_PP_IS_ITERATING
50
 
// ----------------------------------------------------------
51
 
// here, this file is recursively included with growing "N" :
52
 
// ----------------------------------------------------------
53
 
#define N    BOOST_PP_ITERATION()
54
 
 
55
 
template<class T, class V>
56
 
class polymorphic_scatter_message<T,V,N> {
57
 
public:
58
 
  typedef typename polymorphic_data_vector<T,V,N>::size_type size_type;
59
 
  static const size_type                          _n_variant = N;
60
 
 
61
 
// data:
62
 
 
63
 
  std::vector<boost::array<size_type,_n_variant> > start_variant; // n_proc+1
64
 
 
65
 
  // not used in polymorphic case: for compatibility with msg_scatter_init generic code:
66
 
  std::vector<size_type>                        starts;   // n_proc+1
67
 
 
68
 
  std::vector<size_type>                        procs;    // n_proc
69
 
 
70
 
  boost::array<std::list<std::pair<size_type,mpi::request> >,
71
 
               _n_variant>                      requests; // n_proc
72
 
  std::vector<size_type>                        indices;  // n_data
73
 
  
74
 
  polymorphic_data_vector<T,V,N>                values;   // n_data
75
 
  std::vector<mpi::status>                      sstatus;  // n_status
76
 
    
77
 
  std::vector<size_type>        local_slots;              // n_local
78
 
  std::vector<size_type>        local_slots_nonmatching;
79
 
  bool                          local_nonmatching_computed;// n_local_nonmatching
80
 
  size_type                     local_n_nonmatching;
81
 
  bool                          local_is_copy;
82
 
  size_type                     local_copy_start;
83
 
  size_type                     local_copy_length;
84
 
 
85
 
// allocator:
86
 
 
87
 
  polymorphic_scatter_message() 
88
 
  : start_variant(),
89
 
    starts(),
90
 
    procs(), 
91
 
    requests(), 
92
 
    indices(), 
93
 
    values(), 
94
 
    sstatus(),
95
 
    local_slots(),
96
 
    local_slots_nonmatching(),
97
 
    local_nonmatching_computed(false),
98
 
    local_n_nonmatching(0),
99
 
    local_is_copy(false),
100
 
    local_copy_start(0),
101
 
    local_copy_length(0)
102
 
  {}
103
 
  void resize (size_type n_data, size_type nproc) {
104
 
        start_variant.resize (nproc+1);
105
 
        starts.resize  (nproc+1);
106
 
        procs.resize   (nproc);
107
 
        indices.resize (n_data);
108
 
  }
109
 
// accessors:
110
 
 
111
 
  size_type n_proc() const { return procs.size(); }
112
 
  size_type n_data() const { return indices.size(); }
113
 
  size_type n_status() const { return sstatus.size(); }
114
 
  size_type n_local() const { return local_slots.size(); }
115
 
  size_type n_local_nonmatching() const { return local_slots_nonmatching.size(); }
116
 
};
117
 
#endif // _RHEOLEF_POLYMORHIC_SCATTER_MESSAGE_H