diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2007-01-12 20:41:00 +0000 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2007-01-12 20:41:00 +0000 |
commit | 46b7adb8ce67d530d807293109b1759662a1ffa4 (patch) | |
tree | 07b52349e4255152c6f3c4f36d343edae3d2363c /Carpet/CarpetLib/src/gh.hh | |
parent | f65b896e853a5f2f0b43cb9e44cf373a71de0000 (diff) |
CarpetLib: Add new datatype region_t
The new datatype region_t combines an extent (a bbox), an outer
boundary descriptor, a refinement descriptor, and a processor number:
struct region_t {
ibbox extent; // extent
b2vect outer_boundaries; // outer boundaries
b2vect refinement_boundaries; // refinement boundaries
int map; // map to which this
// region belongs
int processor; // processor number
};
These quantities are often used together, and combining them into a
single datatype simplifies the code significantly.
Adapt gh, dh, etc. to use this new datatype.
This is a major API change.
darcs-hash:20070112204130-dae7b-92cad546187b0fe499e8cfc38b2e26614a4f608c.gz
Diffstat (limited to 'Carpet/CarpetLib/src/gh.hh')
-rw-r--r-- | Carpet/CarpetLib/src/gh.hh | 83 |
1 files changed, 36 insertions, 47 deletions
diff --git a/Carpet/CarpetLib/src/gh.hh b/Carpet/CarpetLib/src/gh.hh index a3e943785..cc9d148f2 100644 --- a/Carpet/CarpetLib/src/gh.hh +++ b/Carpet/CarpetLib/src/gh.hh @@ -10,6 +10,7 @@ #include "bboxset.hh" #include "defs.hh" #include "dist.hh" +#include "region.hh" #include "vect.hh" using namespace std; @@ -33,15 +34,9 @@ class gh { public: // Types - typedef vector<ibbox> cexts; // ... for each component - typedef vector<cexts> rexts; // ... for each refinement level - typedef vector<rexts> mexts; // ... for each multigrid level - - typedef vector<bbvect> cbnds; // ... for each component - typedef vector<cbnds> rbnds; // ... for each refinement level - - typedef vector<int> cprocs; // ... for each component - typedef vector<cprocs> rprocs; // ... for each refinement level + typedef vector<region_t> cregs; // ... for each component + typedef vector<cregs> rregs; // ... for each refinement level + typedef vector<rregs> mregs; // ... for each multigrid level public: // should be readonly @@ -54,18 +49,14 @@ public: // should be readonly const ibbox baseextent; - private: vector<vector<ibbox> > _bases; // [ml][rl] - // TODO: invent structure for this - mexts _extents; // extents of all grids - rbnds _outer_boundaries; // boundary descriptions of all grids - rprocs _processors; // processor numbers of all grids - - mexts _oldextents; // a copy, used during regridding - rbnds _oldouter_boundaries; - rprocs _oldprocessors; - + + // Extents and properties of all grids + mregs _regions; + // A copy, used during regridding + mregs _oldregions; + list<th*> ths; // list of all time hierarchies list<dh*> dhs; // list of all data hierarchies @@ -80,65 +71,64 @@ public: virtual ~gh (); // Modifiers - void regrid (const mexts& exts, - const rbnds& outer_bounds, - const rprocs& procs); + void regrid (mregs const & regs); bool recompose (const int rl, const bool do_prolongate); private: bool level_did_change (const int rl) const; + // Accessors + public: - const mexts & extents() const + mregs const & regions () const { - return _extents; + return _regions; } - const rbnds & outer_boundaries() const + const vector<vector<ibbox> > & bases() const + { + return _bases; + } + + ibbox extent (const int m, const int rl, const int c) const { - return _outer_boundaries; + return _regions.at(m).at(rl).at(c).extent; + } + + b2vect outer_boundaries (const int rl, const int c) const + { + return _regions.at(0).at(rl).at(c).outer_boundaries; } - const rprocs & processors() const + b2vect refinement_boundaries (const int rl, const int c) const { - return _processors; + return _regions.at(0).at(rl).at(c).refinement_boundaries; } - const vector<vector<ibbox> > & bases() const + int processor (const int rl, const int c) const { - return _bases; + return _regions.at(0).at(rl).at(c).processor; } - - // Accessors + int mglevels () const { - return (int)_extents.size(); + return (int)_regions.size(); } int reflevels () const { if (mglevels() == 0) return 0; - return (int)_extents.at(0).size(); + return (int)_regions.at(0).size(); } int components (const int rl) const { - return (int)_extents.at(0).at(rl).size(); - } - - bbvect outer_boundary (const int rl, const int c) const - { - return _outer_boundaries.at(rl).at(c); - } - - int proc (const int rl, const int c) const - { - return _processors.at(rl).at(c); + return (int)_regions.at(0).at(rl).size(); } bool is_local (const int rl, const int c) const { - return proc(rl,c) == dist::rank(); + return processor(rl,c) == dist::rank(); } int local_components (const int rl) const; @@ -155,7 +145,6 @@ public: virtual ostream& output (ostream& os) const; private: - void check_processor_number_consistency (); void check_multigrid_consistency (); void check_component_consistency (); void check_base_grid_extent (); |