// test_tri_split.java plot splits import java.io.*; import java.awt.*; import java.awt.event.*; public class test_tri_split extends Frame { // mouse and display variables int xm, ym, bm; // mouse position int height = 700; int width = 700; double xmin; double xmax; double ymin; double ymax; double xw, yh, xoff, yoff; final int sz = 10000; final int sz3 = 20000; int debug=3; // debug print level int ntri; // number of triangles int minvert; // minimum vertex number, reduced to zero int t1[] = new int[sz]; // vertex numbers on triangles int t2[] = new int[sz]; // vertex numbers on triangles int t3[] = new int[sz]; // vertex numbers on triangles int ncoord; // number of coordinates, also equals nvert double xc[] = new double[sz]; // coordinates in vertex order double yc[] = new double[sz]; // coordinates in vertex order int b1[] = new int[sz]; // dirichlet boundary edge vertices int b2[] = new int[sz]; // dirichlet boundary edge vertices int nvert; // number of unique vertices int uniqueb[] = new int[sz3]; // bound vertices int nbound; // number of boundary vertices int uniquef[] = new int[sz3]; // free vertices, 0 to nfree-1 int nfree; // degrees of freedom ntri-nbound int nuniquev, nuniqueb, nuniquef; // vertices counts int rtn[] = new int[6]; double rtnx[] = new double[5]; public test_tri_split(String root) { System.out.println("test_tri_split.java running, root="+root); setTitle("test_tri_split"); setSize(width,height); setBackground(Color.white); setForeground(Color.black); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); setVisible(true); this.addMouseListener (new mousePressHandler()); do_program(root); } // test_tri_split constructor void do_program(String root) { new tri_input(root, t1, t2, t3, // ntri of these b1, b2, // nbound of these xc, yc, // ncoord of these uniqueb, rtn, rtnx); if(rtn[0]==0) System.exit(0); ntri = rtn[0]; nbound = rtn[1]; ncoord = rtn[2]; nvert = rtn[3]; nfree = rtn[4]; nuniqueb = rtn[5]; xmin = rtnx[0]; xmax = rtnx[1]; ymin = rtnx[2]; ymax = rtnx[3]; System.out.println("ntri="+ntri+", nbound="+nbound+", ncoord="+ncoord); System.out.println("nvert="+nvert+", nfree="+nfree+", nuniqueb="+nuniqueb); System.out.println("xmin="+xmin+",xmax="+xmax+ ", ymin="+ymin+", ymax="+ymax); xw = (xmax-xmin)*1.2; yh = (ymax-ymin)*1.2; xoff = 0.083333*xw; yoff = 0.083333*yh; // plot repaint(); check_boundary(); dup_test(); } // end do_program class mousePressHandler extends MouseAdapter { public void mousePressed (MouseEvent e) { xm = e.getX(); ym = e.getY(); bm = e.getButton(); if(in_rect(width-40, height-30, 30, 20)) { // split again new tri_split(ntri, t1, t2, t3, nbound, b1, b2, ncoord, xc, yc, uniqueb, rtn); if(rtn[0]==0) System.exit(0); ntri = rtn[0]; nbound = rtn[1]; ncoord = rtn[2]; nvert = rtn[3]; nfree = rtn[4]; nuniqueb = rtn[5]; System.out.println("ntri="+ntri+", nbound="+nbound+", ncoord="+ncoord); System.out.println("nvert="+nvert+", nfree="+nfree+", nuniqueb="+nuniqueb); System.out.println("xmin="+xmin+",xmax="+xmax+ ", ymin="+ymin+", ymax="+ymax); // for(int i=0; i