Last change
on this file since 2189 was
1955,
checked in by ymipsl, 4 years ago
|
Xios coupling
Bug fix in grid mask connectors.
YM
|
-
Property svn:executable set to
*
|
File size:
1.3 KB
|
Rev | Line | |
---|
[1943] | 1 | #ifndef __GRID_MASK_CONNECTOR_HPP__ |
---|
| 2 | #define __GRID_MASK_CONNECTOR_HPP__ |
---|
| 3 | |
---|
| 4 | #include "xios_spl.hpp" |
---|
| 5 | #include "array_new.hpp" |
---|
| 6 | #include "local_view.hpp" |
---|
| 7 | #include "distributed_view.hpp" |
---|
| 8 | |
---|
| 9 | namespace xios |
---|
| 10 | { |
---|
| 11 | |
---|
| 12 | class CGridMaskConnector |
---|
| 13 | { |
---|
| 14 | |
---|
| 15 | public: |
---|
| 16 | |
---|
| 17 | CGridMaskConnector(vector<CLocalView*>& views) : views_(views) {} |
---|
| 18 | void computeConnector(CArray<bool,1>& mask) ; |
---|
| 19 | |
---|
| 20 | CArray<bool,1>& getElementMask(int pos) { return elementsMask_[pos] ;} |
---|
| 21 | vector<CArray<bool,1>>& getElementsMask(void) ; |
---|
| 22 | |
---|
| 23 | private: |
---|
| 24 | vector<CLocalView*> views_ ; |
---|
| 25 | vector<CArray<bool,1>> elementsMask_ ; |
---|
| 26 | |
---|
| 27 | vector<int> size_ ; |
---|
| 28 | vector<int> index_ ; |
---|
| 29 | int nViews_ ; |
---|
| 30 | |
---|
| 31 | private: |
---|
| 32 | |
---|
| 33 | void recursiveInternal(int level, bool*& mask) |
---|
| 34 | { |
---|
| 35 | if (level==0) |
---|
| 36 | { |
---|
| 37 | for(int i=0; i < size_[level] ; i++) |
---|
| 38 | { |
---|
| 39 | for(int j=0 ; j<nViews_ ; j++) elementsMask_[j](index_[j]) |= *mask ; |
---|
| 40 | index_[level]++ ; |
---|
| 41 | mask++ ; |
---|
| 42 | } |
---|
| 43 | index_[level] = 0 ; |
---|
| 44 | } |
---|
| 45 | else |
---|
| 46 | { |
---|
[1955] | 47 | for(int i=0; i<size_[level] ; i++) |
---|
| 48 | { |
---|
| 49 | recursiveInternal(level-1, mask) ; |
---|
| 50 | index_[level]++ ; |
---|
| 51 | } |
---|
[1943] | 52 | index_[level] = 0 ; |
---|
| 53 | } |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | } ; |
---|
| 57 | |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.