00001
00002
00003
00004
00005
00006 #ifndef AMROC_SCHEME_BREP_OUTPUT_H
00007 #define AMROC_SCHEME_BREP_OUTPUT_H
00008
00016 #include "Interfaces/SchemeFileOutput.h"
00017 #include "BrepOutput.h"
00018
00025 template <class SchemeType, int dim>
00026 class SchemeBrepOutput : public SchemeOutBase<SchemeType,dim>,
00027 public BrepOutput<typename SchemeType::VectorType,dim> {
00028 typedef typename SchemeType::VectorType VectorType;
00029 typedef typename VectorType::InternalDataType DataType;
00030 typedef BrepOutput<VectorType,dim> base;
00031 typedef SchemeOutBase<SchemeType,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 GridData<VectorType,dim> vec_grid_data_type;
00038 typedef GridData<DataType,dim> grid_data_type;
00039
00040 SchemeBrepOutput(interpolation_type* interpol, SchemeType &lbm) : out_base(lbm), base(interpol) {}
00041
00042 virtual ~SchemeBrepOutput() {}
00043
00044 virtual void WriteOut(vec_grid_fct_type& u,
00045 const int num_vertices, const DataType* vertices,
00046 const int num_connections, const int* connections) {
00047
00048 VectorType* data = new VectorType[num_vertices];
00049 int Time = CurrentTime(base::GH(),0);
00050 double t = GetPhysicalTime(u,Time,0);
00051 base::Interpolation().PointsValues(u,t,num_vertices,(const point_type*)vertices,data);
00052 int NValues = num_vertices*base::NEquations();
00053 base::Interpolation().ArrayCombine(VizServer,NValues,(DataType *)data);
00054
00055 if (MY_PROC==VizServer) {
00056 DataType* output_data = new DataType[base::Ncnt()*num_vertices];
00057 BBox bb(dim,1);
00058 bb.lower() = 0; bb.upper() = 0;
00059 bb.upper()(0) = num_vertices-1;
00060 vec_grid_data_type val(bb,data);
00061 for (int cnt=1;cnt<=base::Ncnt(); cnt++) {
00062 if (base::OutputName(cnt-1).c_str()[0] == '-') continue;
00063 grid_data_type output(bb,output_data+(cnt-1)*num_vertices);
00064 out_base::Scheme().Output(val,output,cnt,0);
00065 for (register int i=0; i<num_vertices; i++)
00066 if (data[i](0)==base::Interpolation().ErrorValue())
00067 output_data[(cnt-1)*num_vertices+i]=base::Interpolation().ErrorValue();
00068
00069 DataType* dummy;
00070 output.deallocate(dummy);
00071 }
00072 VectorType* dummy;
00073 val.deallocate(dummy);
00074
00075 base::WriteMesh(num_vertices,vertices,num_connections,connections,Time,t,output_data);
00076
00077 delete [] output_data;
00078 }
00079 delete [] data;
00080 }
00081 };
00082
00083 #endif