~ubuntu-branches/ubuntu/trusty/deal.ii/trusty

« back to all changes in this revision

Viewing changes to lac/source/trilinos_block_vector.cc

  • Committer: Bazaar Package Importer
  • Author(s): Adam C. Powell, IV, Adam C. Powell, IV, Denis Barbier
  • Date: 2010-07-29 13:47:01 UTC
  • mfrom: (3.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20100729134701-akb8jb3stwge8tcm
Tags: 6.3.1-1
[ Adam C. Powell, IV ]
* Changed to source format 3.0 (quilt).
* Changed maintainer to debian-science with Adam Powell as uploader.
* Added source lintian overrides about Adam Powell's name.
* Added Vcs info on git repository.
* Bumped Standards-Version.
* Changed stamp-patch to patch target and fixed its application criterion.
* Moved make_dependencies and expand_instantiations to a versioned directory
  to avoid shlib package conflicts.

[ Denis Barbier ]
* New upstream release (closes: #562332).
  + Added libtbb support.
  + Forward-ported all patches.
* Updates for new PETSc version, including workaround for different versions
  of petsc and slepc.
* Add debian/watch.
* Update to debhelper 7.
* Added pdebuild patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//---------------------------------------------------------------------------
2
 
//    $Id: trilinos_block_vector.cc 18069 2009-01-05 07:38:24Z kronbichler $
 
2
//    $Id: trilinos_block_vector.cc 20362 2010-01-13 15:57:21Z kronbichler $
3
3
//    Version: $Name$
4
4
//
5
 
//    Copyright (C) 2008 by the deal.II authors
 
5
//    Copyright (C) 2008, 2009 by the deal.II authors
6
6
//
7
7
//    This file is subject to QPL and may not be  distributed
8
8
//    without copyright and license information. Please refer
11
11
//
12
12
//---------------------------------------------------------------------------
13
13
 
 
14
 
14
15
#include <lac/trilinos_block_vector.h>
15
 
#include <lac/trilinos_block_sparse_matrix.h>
16
 
 
17
16
 
18
17
#ifdef DEAL_II_USE_TRILINOS
19
18
 
 
19
#  include <lac/trilinos_block_sparse_matrix.h>
 
20
 
 
21
 
20
22
DEAL_II_NAMESPACE_OPEN
21
23
 
22
24
namespace TrilinosWrappers
42
44
        this->components[i] = v.block(i);
43
45
 
44
46
      collect_sizes();
45
 
        
46
 
      return *this;
47
 
    }
48
 
 
49
 
 
50
 
 
51
 
    template <typename Number>
52
 
    BlockVector &
53
 
    BlockVector::operator = (const ::dealii::BlockVector<Number> &v)
54
 
    {
55
 
      Assert (n_blocks() == v.n_blocks(),
56
 
              ExcDimensionMismatch(n_blocks(),v.n_blocks()));
57
 
 
58
 
      for (unsigned int i=0; i<this->n_blocks(); ++i)
59
 
        this->components[i] = v.block(i);
60
47
 
61
48
      return *this;
62
49
    }
107
94
 
108
95
 
109
96
    void
 
97
    BlockVector::reinit (const std::vector<IndexSet> &parallel_partitioning,
 
98
                         const MPI_Comm              &communicator,
 
99
                         const bool                   fast)
 
100
    {
 
101
      const unsigned int no_blocks = parallel_partitioning.size();
 
102
      std::vector<unsigned int> block_sizes (no_blocks);
 
103
 
 
104
      for (unsigned int i=0; i<no_blocks; ++i)
 
105
        {
 
106
          block_sizes[i] = parallel_partitioning[i].size();
 
107
        }
 
108
 
 
109
      this->block_indices.reinit (block_sizes);
 
110
      if (components.size() != n_blocks())
 
111
        components.resize(n_blocks());
 
112
 
 
113
      for (unsigned int i=0; i<n_blocks(); ++i)
 
114
        components[i].reinit(parallel_partitioning[i], communicator, fast);
 
115
 
 
116
      collect_sizes();
 
117
    }
 
118
 
 
119
 
 
120
 
 
121
    void
110
122
    BlockVector::reinit (const BlockVector& v,
111
123
                         const bool fast)
112
124
    {
113
125
      block_indices = v.get_block_indices();
114
126
      if (components.size() != n_blocks())
115
127
        components.resize(n_blocks());
116
 
  
 
128
 
117
129
      for (unsigned int i=0;i<n_blocks();++i)
118
130
        components[i].reinit(v.block(i), fast, false);
119
 
      
 
131
 
120
132
      collect_sizes();
121
133
    }
122
134
 
129
141
      this->block_indices.reinit (block_sizes);
130
142
      if (this->components.size() != this->n_blocks())
131
143
        this->components.resize(this->n_blocks());
132
 
  
 
144
 
133
145
      for (unsigned int i=0;i<this->n_blocks();++i)
134
146
        components[i].clear();
135
147
 
139
151
 
140
152
 
141
153
    void
142
 
    BlockVector::import_nonlocal_data_for_fe 
 
154
    BlockVector::import_nonlocal_data_for_fe
143
155
      (const TrilinosWrappers::BlockSparseMatrix &m,
144
156
       const BlockVector                         &v)
145
157
    {
169
181
        components[i].compress();
170
182
    }
171
183
 
 
184
 
 
185
 
 
186
    void BlockVector::print (std::ostream       &out,
 
187
                             const unsigned int  precision,
 
188
                             const bool          scientific,
 
189
                             const bool          across) const
 
190
    {
 
191
      for (unsigned int i=0;i<this->n_blocks();++i)
 
192
        {
 
193
          if (across)
 
194
            out << 'C' << i << ':';
 
195
          else
 
196
            out << "Component " << i << std::endl;
 
197
          this->components[i].print(out, precision, scientific, across);
 
198
        }
 
199
    }
 
200
 
172
201
  } /* end of namespace MPI */
173
202
 
174
203
 
209
238
 
210
239
 
211
240
  void
 
241
  BlockVector::reinit (const std::vector<IndexSet> &partitioning,
 
242
                       const MPI_Comm              &communicator,
 
243
                       const bool                   fast)
 
244
  {
 
245
    unsigned int no_blocks = partitioning.size();
 
246
    std::vector<unsigned int> block_sizes (no_blocks);
 
247
 
 
248
    for (unsigned int i=0; i<no_blocks; ++i)
 
249
      block_sizes[i] = partitioning[i].size();
 
250
 
 
251
 
 
252
    this->block_indices.reinit (block_sizes);
 
253
    if (components.size() != n_blocks())
 
254
      components.resize(n_blocks());
 
255
 
 
256
    for (unsigned int i=0; i<n_blocks(); ++i)
 
257
      components[i].reinit(partitioning[i], communicator, fast);
 
258
 
 
259
    collect_sizes();
 
260
  }
 
261
 
 
262
 
 
263
 
 
264
  void
212
265
  BlockVector::reinit (const std::vector<unsigned int> &block_sizes,
213
266
                       const bool                       fast)
214
267
  {
219
272
    for (unsigned int i=0; i<n_blocks(); ++i)
220
273
      components[i].reinit(block_sizes[i], fast);
221
274
 
222
 
    collect_sizes();      
 
275
    collect_sizes();
223
276
  }
224
 
    
 
277
 
225
278
 
226
279
 
227
280
  void
230
283
    block_indices = v.get_block_indices();
231
284
    if (components.size() != n_blocks())
232
285
      components.resize(n_blocks());
233
 
  
 
286
 
234
287
    for (unsigned int i=0;i<n_blocks();++i)
235
288
      components[i] = v.block(i);
236
289
  }
244
297
    block_indices.reinit (block_sizes);
245
298
    if (components.size() != n_blocks())
246
299
      components.resize(n_blocks());
247
 
  
 
300
 
248
301
    for (unsigned int i=0;i<n_blocks();++i)
249
302
      block(i).clear();
250
303
 
260
313
    block_indices = v.get_block_indices();
261
314
    if (components.size() != n_blocks())
262
315
      components.resize(n_blocks());
263
 
  
 
316
 
264
317
    for (unsigned int i=0;i<n_blocks();++i)
265
318
      components[i].reinit(v.block(i), fast);
266
 
      
 
319
 
267
320
    collect_sizes();
268
321
  }
269
322
 
297
350
 
298
351
    return *this;
299
352
  }
300
 
 
 
353
 
 
354
 
 
355
 
 
356
  void BlockVector::print (std::ostream       &out,
 
357
                           const unsigned int  precision,
 
358
                           const bool          scientific,
 
359
                           const bool          across) const
 
360
  {
 
361
    for (unsigned int i=0;i<this->n_blocks();++i)
 
362
      {
 
363
        if (across)
 
364
          out << 'C' << i << ':';
 
365
        else
 
366
          out << "Component " << i << std::endl;
 
367
        this->components[i].print(out, precision, scientific, across);
 
368
      }
 
369
  }
 
370
 
301
371
}
302
372
 
303
373