00001 #ifndef NMWR_GB_GRAL_DISTRIBUTED_COMPOSITE_GRID_OUTPUT_H 00002 #define NMWR_GB_GRAL_DISTRIBUTED_COMPOSITE_GRID_OUTPUT_H 00003 00004 // $LICENSE 00005 00006 00007 #include <string> 00008 #include "Utility/as-string.h" 00009 00016 template<class CoarseG, class OG> 00017 class composite_grid_output { 00018 typedef composite_grid_output<CoarseG, OG> self; 00019 00020 public: 00021 typedef CoarseG coarse_grid_type; 00022 typedef OG ovrlp_grid_type; 00023 typedef typename OG::fine_grid_type fine_grid_type; 00024 typedef typename OG::overlap_type overlap_type; 00025 00026 typedef grid_types<coarse_grid_type> cgt; 00027 typedef typename cgt::Cell CoarseCell; 00028 typedef typename cgt::CellIterator CoarseCellIterator; 00029 00030 private: 00031 std::string basenm; 00032 00033 coarse_grid_type the_coarse; 00034 grid_function<CoarseCell,ovrlp_grid_type> local_grids; 00035 00036 // FORBIDDEN (for the moment) 00037 composite_grid_output(self const& rhs); 00038 self& operator=(self const& rhs); 00039 00040 std::string coarse_file_nm(std::string const& base) 00041 { return (basenm + ".coarse");} 00042 std::string ovlp_grid_base(std::string const& base, 00043 CoarseCell const& C) 00044 { return (basenm + "." + as_string(number(*C))); } 00045 00046 int number(CoarseCell const& C) const { return C.handle();} 00047 public: 00048 00049 composite_grid_output(std::string const& base) 00050 : basenm(base), the_coarse(coarse_file_nm(basenm)) {} 00051 00052 void coarse_grid_complete(); // update data dependent on coarse grid 00053 00054 void calc_dependent_information() { /* none */ } 00055 00056 //-------------------- component access ---------------------------- 00057 00058 coarse_grid_type & TheCoarseGrid() { return the_coarse;} 00059 coarse_grid_type const& TheCoarseGrid() const { return the_coarse;} 00060 00061 ovrlp_grid_type & OvrlpGrid(const CoarseCell& c) { return local_grids[c];} 00062 ovrlp_grid_type const& OvrlpGrid(const CoarseCell& c) const { return local_grids(c);} 00063 00064 fine_grid_type & Grid(const CoarseCell& c) { return local_grids[c].TheGrid();} 00065 fine_grid_type const& Grid(const CoarseCell& c) const { return local_grids[c].TheGrid();} 00066 00067 overlap_type const& Overlap(const CoarseCell& c) const { return OvrlpGrid(c).TheOverlap();} 00068 overlap_type & Overlap(const CoarseCell& c) { return OvrlpGrid(c).TheOverlap();} 00069 00070 }; 00071 00072 00073 #ifdef NMWR_INCLUDE_TEMPLATE_DEFS 00074 #include "Gral/Distributed/internal/composite-grid-output.C" 00075 #endif 00076 00077 00078 00079 #endif 00080
1.2.11-20011104 written by Dimitri van Heesch,
© 1997-2000