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


Main Page   Class Hierarchy   Compound List   File List  

ClpSetAux.h

Go to the documentation of this file.
00001 #ifndef AMROC_CLP_SETAUX_H
00002 #define AMROC_CLP_SETAUX_H
00003 
00012 #ifndef ClpSetAuxName
00013 #define ClpSetAux(dim)      name2(ClpSetAux,dim)
00014 #define ClpSetAuxName
00015 #endif
00016 
00017 #ifndef ClpIntegratorBaseName
00018 #define ClpIntegratorBase(dim)      name2(ClpIntegratorBase,dim)
00019 #define ClpIntegratorBaseName
00020 #endif
00021 
00022 template <class VectorType, class AuxVectorType>
00023 class ClpIntegratorBase(DIM);
00024 
00033 template <class VectorType, class AuxVectorType>
00034 class ClpSetAux(DIM) {
00035   typedef typename VectorType::InternalDataType DataType;
00036   typedef ClpIntegratorBase(DIM)<VectorType, AuxVectorType> integrator_type;
00037   typedef GridData(DIM)<VectorType> vec_grid_data_type;
00038 
00039 public:
00040   ClpSetAux(DIM)(integrator_type& integ) : _integrator(integ) {
00041     setaux_func = f_setaux;
00042   }
00043 
00044   void Set(DataType* aux, vec_grid_data_type& StateVec, double t, 
00045            double dt, DCoords& dx) {
00046     if (NAux()>0 && setaux_func!=(setaux_func_type)0) {
00047       int mx[DIM], ibx[DIM];
00048       DimExtBBox(StateVec.bbox(), mx, ibx);
00049       DCoords lbcorner = GH().worldCoords(StateVec.lower(),StateVec.stepsize());
00050       (*setaux_func)(AA(DIM,mx),NEquations(),NGhosts(),AA(DIM,ibx),AA(DIM,mx),
00051                      StateVec.data(),aux,NAux(),AA(DIM,lbcorner()),AA(DIM,dx()),
00052                      t,dt);   
00053     }
00054   }
00055 
00056   void DimExtBBox(const BBox& bb, int mx[], int ibx[]) {
00057     for (int d=0; d<DIM; d++) 
00058       if (bb.extents(d)-2*NGhosts()<1) 
00059         { mx[d] = bb.extents(d); ibx[d] = 0; }
00060       else
00061         { mx[d] = bb.extents(d)-2*NGhosts(); ibx[d] = 1; }
00062   }
00063 
00064   inline const integrator_type& Integrator() const { return _integrator; }
00065   inline const int& NEquations() const { return Integrator().NEquations(); }
00066   inline const int& NGhosts() const { return Integrator().NGhosts(); }
00067   inline const int& NAux() const { return Integrator().NAux(); }
00068   inline const GridHierarchy& GH() const { return Integrator().GH(); }
00069 
00070 protected:
00071   integrator_type& _integrator;
00072   setaux_func_type setaux_func;
00073 };
00074 
00075 
00076 #endif


Quickstart     Users Guide     Programmers Reference     Installation      Examples     Download



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