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