00001
00002
00003
00004 #ifndef _EVENSTREAMLINEPLACE_H
00005 #define _EVENSTREAMLINEPLACE_H
00006 #include "dataStructure.h"
00007 #include "Util.h"
00008
00009 #include <algorithm>
00010 #include "TrajectoryList.h"
00011 #include "QuadMesh.h"
00012 class TfCore;
00013 class EvenStreamlinePlace
00014 {
00015 public:
00016 TrajectoryList *evenstreamlines;
00017 SamplePtList **samplepts;
00018 int num_tracingpoints ;
00019 DynList_Int *trianglelist;
00020 double streamlinelength;
00021 double dsep;
00022 double percentage_dsep;
00023 double discsize;
00024 double sample_interval;
00025 int every_nsample;
00026 double loopdsep;
00027 double dist2sing;
00028 double seeddist;
00029 double minstartdist;
00030 TfCore *m_tfCore;
00031 QuadMesh* quadmesh;
00032
00033 int which_triangle;
00034 double samp[2];
00035 icVector2 outside_push;
00036 bool isAdd_push;
00037 float push_rank;
00038
00040 icVector2 tenline_dir_global;
00041 double hstep;
00042 double predict_stepsize;
00043 double euler_stepsize;
00044 int globalface;
00045 int g_face, g_type;
00046 double majorDensity;
00047 double mintenline_length;
00049 EvenStreamlinePlace(int initsize);
00050
00051 ~EvenStreamlinePlace();
00052
00053 void init();
00054 void setTfCore(TfCore *tfCore);
00055 bool grow_a_majRoad(double seed_p[2], int triangle, double dtest,
00056 double discsize, double Sample_interval,
00057 double loopdsep, double dist2sing,
00058 double streamlinelength,int type,icVector2 &direction);
00059 bool grow_a_separatrix(double start[2],double seed_p[2], int triangle, double dtest,
00060 double discsize, double Sample_interval,
00061 double loopdsep, double dist2sing,
00062 double streamlinelength,
00063 int type, icVector2 direction,int index,int sep_index);
00064 void compute_tensor_at_quad(int face, double x, double y, icMatrix2x2 &ten);
00065 bool is_in_cell(int id, double x, double y);
00066 int get_cellID_givencoords(double x, double y);
00067 int trace_majRoad_in_quad(int &face_id, double globalp[2], int type,
00068 double dtest, double loopsep, double dist2sing,
00069 double sample_interval, double discsize, int &flag);
00070 int trace_separatrix_in_quad(int &face_id, double globalp[2], int type,
00071 double dtest, double loopsep, double dist2sing,
00072 double sample_interval, double discsize, int &flag,int index, int sep_index);
00073 void get_tenvec_quad(double cur_p[2], double vec[2]);
00074 void compute_phi_in_quad(int face, double x, double y, double &phi);
00075 void RK23_2d(double pre_p[2], double next_p[2], double &hstep_loc, double &hnext,
00076 double eps, double &eps_did);
00077 bool get_nextpt_RK23_ten_quad(double first[2], double second[2], int &face_id, int type);
00078 int get_nextpt_RK23_ten_quad(double first[2], double second[2], int &face_id, int type,int index,int sep_index);
00079 bool close_to_cur_samplePt(double p[2], int triangle, SamplePt **samples, int num_samples,
00080 double separate_dist, double discsize, double sample_interval);
00081 void cal_euclidean_dist_2(int triangle, double p[3], double dsep, double discsize,
00082 DynList_Int *trianglelist);
00083 void reset_dist(DynList_Int *trianglelist);
00084 void get_next_cell_2(int &face_id, double pre[2], double cur[2],
00085 int &PassVertornot, int type);
00086 bool cross_vertex_ten_quad(int &face_id, double cur_p[2], double pre_p[2], int &passornot, int type);
00087 void get_cell_through_ver(int vertid, int &cell, int type);
00088 SamplePt **cal_samplepts_when_tracing(int traj, double interval, int &cur_line, int &movetonext, double &cur_length,
00089 SamplePt **samples, int &num_samples);
00090 bool cal_a_sample_of_streamline(int traj, int &cur_lineindex, int &movetonext,
00091 double curpt[2], double interval, double &cur_length);
00092 bool is_in_reg_cell(int id, double x, double y);
00093 void reverse_streamline(int streamlineid);
00094 void set_default_parameters();
00095 void init_major_line_info();
00096 void reset();
00097 };
00098 #endif
00099