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