AMROC Main     Blockstructured Adaptive Mesh Refinement in object-oriented C++


Main Page   Class Hierarchy   Compound List   File List  

Fixup1.h

Go to the documentation of this file.
00001 #ifndef AMROC_FIXUP1_H
00002 #define AMROC_FIXUP1_H
00003 
00011 #include "FixupBase.h"
00012 
00013 #ifndef FixupName
00014 #define Fixup(dim)      name2(Fixup,dim)
00015 #define FixupName
00016 #endif
00017 
00018 #ifndef FixupOpsName
00019 #define FixupOps(dim)      name2(FixupOps,dim)
00020 #define FixupOpsName
00021 #endif
00022 
00029 template <class VectorType, class FixupType>
00030 class FixupOps(1) {
00031 public:
00032   FixupOps(1)() {}
00033 
00034   void copy_to(GridData(1)<FixupType> &target, const BBox &to,
00035                const GridData(1)<VectorType> &source, const BBox &fromwhere, const int s) {   
00036     BBox tobb(to * target.bbox()); 
00037     BBox frombb(fromwhere * source.bbox()); AlignBBox(frombb, s);
00038     equals_to(target(tobb.lower(0)),source(frombb.lower(0)));
00039   }
00040   void copy_to(GridData(1)<FixupType> &target,  
00041                const GridData(1)<VectorType> &source, const BBox &fromwhere, const int s) {   
00042     BBox tobb(target.bbox()); 
00043     BBox frombb(fromwhere * source.bbox()); AlignBBox(frombb, s);
00044     equals_to(target(tobb.lower(0)),source(frombb.lower(0)));
00045   }
00046   
00047   void copy_from(GridData(1)<VectorType> &target, const BBox &towhere, 
00048                  const GridData(1)<FixupType> &source, const BBox &from, const int s) {    
00049     BBox tobb(towhere * target.bbox()); AlignBBox(tobb, s);
00050     BBox frombb(from * source.bbox()); 
00051     equals_from(target(tobb.lower(0)),source(frombb.lower(0)));
00052   }
00053   void copy_from(GridData(1)<VectorType> &target, const BBox &towhere, 
00054                  const GridData(1)<FixupType> &source, const int s) {    
00055     BBox tobb(towhere * target.bbox()); AlignBBox(tobb, s);
00056     BBox frombb(source.bbox()); 
00057     equals_from(target(tobb.lower(0)),source(frombb.lower(0)));
00058   }
00059   
00060   void add_to(GridData(1)<FixupType> &target, const BBox &to, 
00061               const GridData(1)<VectorType> &source, const BBox &fromwhere, const int s) {    
00062     BBox tobb(to * target.bbox()); 
00063     BBox frombb(fromwhere * source.bbox()); AlignBBox(frombb, s);
00064     plus_to(target(tobb.lower(0)),source(frombb.lower(0)));
00065   }
00066   void add_to(GridData(1)<FixupType> &target,
00067               const GridData(1)<VectorType> &source, const BBox &fromwhere, const int s) {    
00068     BBox tobb(target.bbox()); 
00069     BBox frombb(fromwhere * source.bbox()); AlignBBox(frombb, s);
00070     plus_to(target(tobb.lower(0)),source(frombb.lower(0)));
00071   }
00072   
00073   void add_from(GridData(1)<VectorType> &target, const BBox &towhere, 
00074                 const GridData(1)<FixupType> &source, const BBox &from, const int s) {    
00075     BBox tobb(towhere * target.bbox()); AlignBBox(tobb, s);
00076     BBox frombb(from * source.bbox()); 
00077     plus_from(target(tobb.lower(0)),source(frombb.lower(0)));
00078   }
00079   void add_from(GridData(1)<VectorType> &target, const BBox &towhere, 
00080                 const GridData(1)<FixupType> &source, const int s) {    
00081     BBox tobb(towhere * target.bbox()); AlignBBox(tobb, s);
00082     BBox frombb(source.bbox()); 
00083     plus_from(target(tobb.lower(0)),source(frombb.lower(0)));
00084   }
00085   
00086   void add_to(GridData(1)<FixupType> &target, const BBox &to, 
00087               const GridData(1)<VectorType> &source, const BBox &from) {   
00088     BBox tobb(to * target.bbox()); 
00089     BBox frombb(from * source.bbox()); 
00090     plus_to(target(tobb.lower(0)),source(frombb.lower(0)));
00091   }
00092   void add_to(GridData(1)<FixupType> &target, 
00093               const GridData(1)<VectorType> &source, const BBox &where) {   
00094     BBox tobb(target.bbox()); 
00095     BBox frombb(where * source.bbox());
00096     plus_to(target(tobb.lower(0)),source(frombb.lower(0)));
00097   }
00098 };
00099 
00106 template <class VectorType, class FixupType>
00107 class Fixup(1) : public FixupBase(1)<VectorType,FixupType> {
00108   typedef Integrator(1)<VectorType> integrator_type;
00109   typedef GridData(1)<VectorType>  vec_grid_data_type;
00110   typedef GridData(DIM_1)<VectorType> ld_vec_grid_data_type;
00111   typedef GridData(DIM_1)<FixupType>  ld_fixup_grid_data_type;
00112 
00113 public:
00114   Fixup(1)(integrator_type& integ) : FixupBase(1)<VectorType,FixupType>(integ) {}  
00115 
00116 protected:
00117   void debug_print(vec_grid_data_type &gd, const BBox &where) {
00118 #ifdef DEBUG_PRINT
00119     for (register int i=where.lower(0); i<=where.upper(0); i+=where.stepsize(0)) 
00120       ( comm_service::log() << "[" << i << "]=" 
00121         << gd(i)(0) << " " ).flush();
00122 #endif
00123   }    
00124 
00125   void debug_print_ldv(ld_vec_grid_data_type &gd, const BBox &where) {
00126 #ifdef DEBUG_PRINT
00127     ( comm_service::log() << "[" << gd.bbox().lower(0) << "]=" 
00128       << gd(gd.bbox().lower(0))(0) << " " ).flush();
00129     ( comm_service::log() << "\n" ).flush();
00130 #endif
00131   }    
00132   void debug_print_ldv(ld_vec_grid_data_type &gd) {
00133     debug_print_ldv(gd, gd.bbox());
00134   }
00135 
00136   void debug_print_ld(ld_fixup_grid_data_type &gd, const BBox &where) {
00137 #ifdef DEBUG_PRINT
00138     ( comm_service::log() << "[" << gd.bbox().lower(0) << "]=" 
00139       << gd(gd.bbox().lower(0))(0) << " " ).flush();
00140     ( comm_service::log() << "\n" ).flush();
00141 #endif
00142   }    
00143   void debug_print_ld(ld_fixup_grid_data_type &gd) {
00144     debug_print_ld(gd, gd.bbox());
00145   }
00146 };
00147 
00148 
00149 #endif


Quickstart     Users Guide     Programmers Reference     Installation      Examples     Download



AMROC Main      Home      Contact
last update: 06/01/04