• VTF
  • FSI
  • AMROC
  • SFC
  • Motion
  • STLIB
  • Main Page
  • Related Pages
  • Classes
  • Files
  • File List
  • File Members

amroc/clawpack/ClpF77GFMFileOutput.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 // Copyright (C) 2009 Ralf Deiterding
00004 // Oak Ridge National Laboratory
00005 
00006 #ifndef AMROC_CLP_F77_GFM_FILEOUTPUT_H
00007 #define AMROC_CLP_F77_GFM_FILEOUTPUT_H
00008 
00017 #include "F77Interfaces/F77GFMFileOutput.h"
00018 #include "ClpIntegratorBase.h"
00019 
00020 template <class VectorType, class FixupType, class FlagType, class AuxVectorType, int dim>
00021 class ClpF77GFMFileOutput : public F77GFMFileOutput<VectorType,FixupType,FlagType,dim> {
00022   typedef typename VectorType::InternalDataType DataType;
00023   typedef F77GFMFileOutput<VectorType,FixupType,FlagType,dim> base;
00024   typedef typename base::vec_grid_fct_type vec_grid_fct_type;  
00025   typedef typename base::grid_fct_type grid_fct_type;
00026   typedef typename base::generic_func_type generic_func_type;
00027   typedef typename base::gfm_solver_type gfm_solver_type;
00028 public:
00029   typedef ClpIntegratorBase<VectorType,AuxVectorType,dim> integrator_type;
00030   
00031   typedef void (*out_aux_1_func_type) ( FI(1,VectorType), FI(1,DataType), const DataType* aux, BI, 
00032                                         const INTEGER& meqn, const INTEGER& maux,  
00033                                         const INTEGER& cnt, const DOUBLE& t );
00034   typedef void (*out_aux_2_func_type) ( FI(2,VectorType), FI(2,DataType), const DataType* aux, BI, 
00035                                         const INTEGER& meqn, const INTEGER& maux, 
00036                                         const INTEGER& cnt, const DOUBLE& t );
00037   typedef void (*out_aux_3_func_type) ( FI(3,VectorType), FI(3,DataType), const DataType* aux, BI, 
00038                                         const INTEGER& meqn, const INTEGER& maux,
00039                                         const INTEGER& cnt, const DOUBLE& t );
00040 
00041   ClpF77GFMFileOutput(gfm_solver_type& solver, integrator_type& integ, generic_func_type out) : base(solver,out), _Integrator(integ) {}
00042   virtual ~ClpF77GFMFileOutput() {}
00043   
00044   virtual void Transform(vec_grid_fct_type& u, grid_fct_type& work, const int Time, const int& Level, 
00045                          const int cnt, const double& t) {
00046     if (!base::f_out) return;    
00047     forall(u,Time,Level,c)
00048       BBox bb = u(Time,Level,c).bbox();
00049       AllocError::SetTexts("ClpFileOutput","Transform(): aux");
00050       DataType* aux = new DataType[bb.size()*Integrator_().NAux()];   
00051       double dt = 0.0;
00052       Integrator_().SetAux(aux,u(Time,Level,c),t,dt);
00053       if (dim == 1) 
00054         ((out_aux_1_func_type) base::f_out)(FA(1,u(Time,Level,c)),FA(1,work(Time,Level,c)),aux,
00055                                             BOUNDING_BOX(bb),base::NEquations(),Integrator_().NAux(),cnt,t);
00056       else if (dim == 2) 
00057         ((out_aux_2_func_type) base::f_out)(FA(2,u(Time,Level,c)),FA(2,work(Time,Level,c)),aux,
00058                                             BOUNDING_BOX(bb),base::NEquations(),Integrator_().NAux(),cnt,t);
00059       else if (dim == 3) 
00060         ((out_aux_3_func_type) base::f_out)(FA(3,u(Time,Level,c)),FA(3,work(Time,Level,c)),aux,
00061                                             BOUNDING_BOX(bb),base::NEquations(),Integrator_().NAux(),cnt,t);
00062       delete [] aux;
00063     end_forall 
00064   }
00065 
00066   inline integrator_type& Integrator_() { return _Integrator; }
00067   inline const integrator_type& Integrator_() const { return _Integrator; }
00068  private:
00069   integrator_type& _Integrator;
00070 };
00071 
00072 
00073 #endif