|
1 | 1 | #include "apfAggregateNumbering.h" |
| 2 | +#include "apfAggregateNumberingClass.h" |
2 | 3 | #include "apfField.h" |
3 | 4 | #include "apfNumberingClass.h" |
4 | 5 | #include "apfTagData.h" |
|
8 | 9 | #include <set> |
9 | 10 | namespace apf |
10 | 11 | { |
11 | | - template <class T> |
12 | | - class AggregateNumberingOf : public NumberingOf<T> |
13 | | - { |
14 | | - public: |
15 | | - AggregateNumberingOf() |
16 | | - : NumberingOf<T>() |
17 | | - , nd_ids(NULL) |
18 | | - , shr(NULL) |
19 | | - , blks_per_nd(0) |
20 | | - , dofs_per_blk(0) |
21 | | - , slf(-1) |
22 | | - , strds() |
23 | | - , frsts() |
24 | | - , lcl_strd(0) |
25 | | - { } |
26 | | - void init(const char * n, |
27 | | - Mesh * m, |
28 | | - Sharing * sh, |
29 | | - FieldShape * s, |
30 | | - int blks, |
31 | | - int bs); |
32 | | - void init(Field * f, Sharing * sh, int blks, int bs); |
33 | | - void globalize(); |
34 | | - virtual void getAll(MeshEntity * e, T * dat); |
35 | | - virtual T get(MeshEntity * e, int nd, int cmp); |
36 | | - virtual void set(MeshEntity*,int,int,T) {} |
37 | | - Sharing * getSharing() const { return shr; } |
38 | | - void setSharing(Sharing * s) { shr = s; } |
39 | | - int countBlocks() const { return blks_per_nd; } |
40 | | - int blockSize() const { return dofs_per_blk; } |
41 | | - T getLocalStride() const { return lcl_strd; } |
42 | | - T getScopeStride() const { return strds[slf]; } |
43 | | - T getLocalFirstDof() const { return frsts[slf]; } |
44 | | - T getStride(int peer) const { return strds[peer]; }; |
45 | | - T getFirstDof(int peer) const { return frsts[peer]; } |
46 | | - private: |
47 | | - FieldDataOf<T> * nd_ids; |
48 | | - Sharing * shr; |
49 | | - int blks_per_nd; |
50 | | - int dofs_per_blk; |
51 | | - int slf; |
52 | | - DynamicArray<T> strds; |
53 | | - DynamicArray<T> frsts; |
54 | | - int lcl_strd; |
55 | | - }; |
| 12 | + // explicit instantiations |
| 13 | + template class AggregateNumberingOf<int>; |
| 14 | + template class AggregateNumberingOf<long>; |
56 | 15 | // this assumes that the ranks returned by a sharing |
57 | 16 | // do not change when the pcu comm changes |
58 | 17 | // if the sharing can handle the pcu comm changing |
@@ -288,16 +247,11 @@ namespace apf |
288 | 247 | getAll(e,&data[0]); |
289 | 248 | return data[nd*cmps + cmp]; |
290 | 249 | } |
291 | | - // explicit instantiations |
292 | | - template class AggregateNumberingOf<int>; |
293 | | - template class AggregateNumberingOf<long>; |
294 | | - typedef AggregateNumberingOf<int> AggNumbering; |
295 | | - typedef AggregateNumberingOf<long> GlobalAggNumbering; |
296 | | - Numbering * createAggNumbering(Field * f, |
297 | | - int blocks, |
298 | | - int dofs_per_block, |
299 | | - MPI_Comm cm, |
300 | | - Sharing * share) |
| 250 | + AggNumbering * createAggNumbering(Field * f, |
| 251 | + int blocks, |
| 252 | + int dofs_per_block, |
| 253 | + MPI_Comm cm, |
| 254 | + Sharing * share) |
301 | 255 | { |
302 | 256 | bool dlt = false; |
303 | 257 | if(!share) |
@@ -330,13 +284,13 @@ namespace apf |
330 | 284 | f->getMesh()->addNumbering(n); |
331 | 285 | return n; |
332 | 286 | } |
333 | | - Numbering * createAggNumbering(Mesh * m, |
334 | | - const char * name, |
335 | | - FieldShape * shape, |
336 | | - int blocks, |
337 | | - int dofs_per_block, |
338 | | - MPI_Comm cm, |
339 | | - Sharing * share) |
| 287 | + AggNumbering * createAggNumbering(Mesh * m, |
| 288 | + const char * name, |
| 289 | + FieldShape * shape, |
| 290 | + int blocks, |
| 291 | + int dofs_per_block, |
| 292 | + MPI_Comm cm, |
| 293 | + Sharing * share) |
340 | 294 | { |
341 | 295 | bool dlt = false; |
342 | 296 | if(!share) |
@@ -364,4 +318,17 @@ namespace apf |
364 | 318 | m->addNumbering(n); |
365 | 319 | return n; |
366 | 320 | } |
| 321 | + /* Public API */ |
| 322 | + Numbering * getNumbering(AggNumbering * n) |
| 323 | + { |
| 324 | + return static_cast<Numbering*>(n); |
| 325 | + } |
| 326 | + int countBlocks(AggNumbering * n) |
| 327 | + { |
| 328 | + return n->blockSize(); |
| 329 | + } |
| 330 | + int countDOFsPerBlock(AggNumbering * n) |
| 331 | + { |
| 332 | + return n->blockSize(); |
| 333 | + } |
367 | 334 | } |
0 commit comments