00001
00002
00003
00004
00005 #ifndef AMROC_CLP_F77_BREP_OUTPUT_H
00006 #define AMROC_CLP_F77_BREP_OUTPUT_H
00007
00015 #include "F77Interfaces/F77BrepOutput.h"
00016 #include "ClpIntegratorBase.h"
00017
00026 template <class VectorType, class AuxVectorType, int dim>
00027 class ClpF77BrepOutput : public F77BrepOutput<VectorType,dim> {
00028 typedef typename VectorType::InternalDataType DataType;
00029 typedef F77BrepOutput<VectorType,dim> base;
00030 public:
00031 typedef typename base::vec_grid_fct_type vec_grid_fct_type;
00032 typedef typename base::grid_fct_type grid_fct_type;
00033 typedef typename base::interpolation_type interpolation_type;
00034 typedef typename base::point_type point_type;
00035 typedef typename out_base::generic_func_type generic_func_type;
00036 typedef GridData<VectorType,dim> vec_grid_data_type;
00037 typedef GridData<DataType,dim> grid_data_type;
00038
00039 F77BrepOutput(interpolation_type* interpol, generic_func_type out) : out_base(out), base(interpol) {}
00040
00041 virtual ~F77BrepOutput() {}
00042
00043 virtual void WriteOut(vec_grid_fct_type& u,
00044 const int num_vertices, const DataType* vertices,
00045 const int num_connections, const int* connections) {
00046
00047 VectorType* data = new VectorType[num_vertices];
00048 int Time = CurrentTime(base::GH(),0);
00049 double t = GetPhysicalTime(u,Time,0);
00050 base::Interpolation().PointsValues(u,t,num_vertices,(const point_type*)vertices,data);
00051 int NValues = num_vertices*base::NEquations();
00052 base::Interpolation().ArrayCombine(VizServer,NValues,(DataType *)data);
00053
00054 if (MY_PROC==VizServer) {
00055 DataType* output_data = new DataType[base::Ncnt()*num_vertices];
00056 BBox bb(dim,1);
00057 bb.lower() = 0; bb.upper() = 0;
00058 bb.upper()(0) = num_vertices-1;
00059 vec_grid_data_type val(bb,data);
00060 for (int cnt=1;cnt<=base::Ncnt(); cnt++) {
00061 if (base::OutputName(cnt-1).c_str()[0] == '-') continue;
00062 grid_data_type output(bb,output_data+(cnt-1)*num_vertices);
00063 if (dim == 1)
00064 ((typename out_base::out_1_func_type) (out_base::f_out))(FA(1,val),FA(1,output),BOUNDING_BOX(bb),
00065 base::NEquations(),cnt,t);
00066 else if (dim == 2)
00067 ((typename out_base::out_2_func_type) (out_base::f_out))(FA(2,val),FA(2,output),BOUNDING_BOX(bb),
00068 base::NEquations(),cnt,t);
00069 else if (dim == 3)
00070 ((typename out_base::out_3_func_type) (out_base::f_out))(FA(3,val),FA(3,output),BOUNDING_BOX(bb),
00071 base::NEquations(),cnt,t);
00072 for (register int i=0; i<num_vertices; i++)
00073 if (data[i](0)==base::Interpolation().ErrorValue())
00074 output_data[(cnt-1)*num_vertices+i]=base::Interpolation().ErrorValue();
00075
00076 DataType* dummy;
00077 output.deallocate(dummy);
00078 }
00079 VectorType* dummy;
00080 val.deallocate(dummy);
00081
00082 base::WriteMesh(num_vertices,vertices,num_connections,connections,Time,t,output_data);
00083
00084 delete [] output_data;
00085 }
00086 delete [] data;
00087 }
00088 };
00089
00090 #endif