亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? imagemain.java

?? 很多人都在為計算流體程序的初始數據輸入感到頭疼
?? JAVA
字號:
package  testconditon.imageload;


// imageMain.java
// This main() method illustrates how to perform image operations:
//    - read an image from an input file.  The user is asked to type a
//      file name.  The file can be in gif, jpeg or bmp format.
//    - write an image to a bmp output file.  The user is asked to type the
//      file name.
//    - modify the image
//             apply a green filter to the top half,
//             apply a fading green filter across the whole image, 
//             add vertical black bars to the image,
//             convert to a grayscale image
//      The user selects which operations to apply.
//
// Within the Java code, a colour image is represented using a 
// three-dimensional array.
//    The first index selects one row of the image.
//    The second index selects on column of the image.
//    The third index selects a colour (RED, GREEN, or BLUE).
// For example, "testImage[3][5][RED]" is an integer value in the range
// 0 to 255.  A 0 indicates that there is no red colour at row 3, column 5
// in testImage.  A 255 indicates that there is maximal red colour at
// this location.
// If RED, GREEN, and BLUE are all 0, the image appears black.  If they
// are all 255, the image appears white.
//
import java.util.*;
import java.io.*;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;


public class imageMain {

    // Give names to the constants used for the red, green and blue 
    // values in an image.
    // The use of final variables is discussed on page 10-11 of the
    // Main textbook used in CISC124.
    // Red, green and blue are 8 bit quantities, each with a value 
    // between 0 and 255.  In a file, each pixel occupies a 32 bit word.
    // Since red, green and blue need a total of 24 bits, this leaves
    // 8 extra bits.  These extra bits are called "offset".  You never need
    // to change the value of the offset bits.
    final static int RED    = 0;
    final static int GREEN  = 1;
    final static int BLUE   = 2;
    final static int OFFSET = 3;  // ignore offset; use only red, green, blue
///define the variable
    public  int XX;
    public  int YY;
        
   /*
    * flag 聲明
    * CONST_INTERFACE = 8 CONST_FLUID = 9, CONST_EMPTY = 0, CONST_WALL = 1, CONST_NONE = 2,
    */
     public static final int CONST_INTERFACE = 8;
     public static final int CONST_FLUID = 9;
     public static final int CONST_EMPTY = 0;
     public static final int CONST_WALL = 1;
     public static final int CONST_NONE = 2;
 
     
   /*
    * 其他常量聲明
    */
    public static final int SquareLow = 31;
    public static final int SquareUp = 69;//正方形在40X40的區??
    public static final double r0=1;//密度
    public static final double MassFluid=1;//質量
    public static final double MassInterface=0.5; //界面質量
    public static final double MassAero=0;//空氣質量
     /*
      *變量聲明
      */ 
      public int[][] flag; 
      public int[][][] normal_dirction;
      public double[][] u;
      public double[][] v;
      public double[][] rho;
      public double[][] mass;
      public double[][] UU;

    // The console is used to receive input from the user.  In this program,
    // the user is asked to type file names.
    static public BufferedReader console = new BufferedReader(
                                    new InputStreamReader(System.in));

// 



// ****************************** main **********************************
// The main method reads an input image file, and allows the user to 
// select from a set of modifications that can be applied to the image.
//

    public void imageimport() {


        // This program is supposed to be run without any arguments.
        // If the user supplies arguments, issue an explanatory message.
     //   if (args.length!=0) {
    //       System.out.println("Usage: java imageProgram");
     //      System.exit(1);  // exit.  The exit code 1 indicates failure
   //     }


        // Ask the user for a file name and read the contents of this 
        // file into "testImage".
        // After method "loadImage" completes, the size of the image 
        // is available as follows:
        //    - the number of rows is testImage.length
        //    - the number of columns is testImage[0].length
        int[][][] testImage = imageIO.loadImage();
        final int MAXROWS = testImage.length;
        final int MAXCOLS = testImage[0].length;
        System.out.println("max rows is "+MAXROWS);
        System.out.println("max cols is "+MAXCOLS);
        XX=MAXROWS;
        YY=MAXCOLS;
      flag = new int[XX+1][YY+1]; 
      normal_dirction = new int [XX+1][YY+1][2];
      u = new double[XX+1][YY+1];
      v = new double[XX+1][YY+1];
      rho = new double[XX+1][YY+1];
      mass = new double[XX+1][YY+1];
      UU = new double [XX+1][YY+1];

        // Repeatedly offer the user a list of operations to choose from
        // Sample operations are provided, to illustrate how an image
        // can be updated.
        //
        while (true) {   
            System.out.println("");
            System.out.println("What operation do you want to perform? ");
            System.out.println("   1 read initial condition from picture");
            System.out.println("   2 out put data file");
            System.out.println("   3 quit");
            String reply = null;
            try{
            reply = console.readLine();
            }
            catch(IOException e) {
                System.out.println(e);
                System.exit(1);
            }

         if (reply.startsWith("1")) {
                for (int row=0; row<MAXROWS; row++) {
                    
                    for (int col=0; col<MAXCOLS; col++) {
                                     u[row][col]=0;
                                     v[row][col]=0;
                                     rho[row][col]=r0;
                                     UU[row][col]=col;
                                      System.out.println(row+" "+col+"\n");
                       
                                //增加流體??
                if( testImage[row][col][GREEN] == 255){
                        flag[row][col]=CONST_FLUID;
                        mass[row][col]=MassFluid;     
                       System.out.println(row+" "+col+"is green and it is fluid"+"\n");
                }

        //增加interface
		else if (testImage[row][col][RED] == 255){
                 
                                flag[row][col]=CONST_INTERFACE;
                                mass[row][col]=MassInterface;
                                  System.out.println(row+" "+col+"is red and it is interface"+"\n");
                           
                        }

        
        //增加wall
                else if(testImage[row][col][BLUE] == 255){
                    flag[row][col]= CONST_WALL;
                   if(row==0){
                       normal_dirction[row][col][0]=1; 
                       normal_dirction[row][col][1]=0; 
                   }
                   else if(row==XX){
                       normal_dirction[row][col][0]=-1; 
                       normal_dirction[row][col][1]=0; 
                   }                  
                    else if(col==0){
                       normal_dirction[row][col][0]=0; 
                       normal_dirction[row][col][1]=1; 
                   }
                   else if(col==YY){
                       normal_dirction[row][col][0]=0; 
                       normal_dirction[row][col][1]=-1; 
                   }
                    
                       
                      System.out.println(row+" "+col+"is blue and it is wall"+"\n");
                }
        
        //添加空的區域
        else {
                    flag[row][col]=CONST_EMPTY  ;
                     mass[row][col]=MassAero;                                      
                     System.out.println(row+" "+col+"\n");
           }
                    }  // for col
                }  // for row2
                System.out.println("pic has been read");
            } // if reply is 1
          if (reply.startsWith("2")) {
              int x,y;  
             int tXX=XX+1;
             int tYY=YY+1;
             PrintWriter outFile=null;
		try {
			outFile = new PrintWriter(new FileWriter("initfile"));
                        outFile.println("version zw");
                        outFile.println(tXX+" "+tYY); 
			for(x=0; x<=XX; x++) {
				for (y=0; y<=YY; y++) {
                                 //分情況輸??
                                    //interface
                                      if(flag[x][y]==CONST_INTERFACE){
                                          outFile.print(flag[x][y]+" "+u[x][y] +" "+v[x][y] +" "+rho[x][y] +" "+mass[x][y]+" "+UU[x][y]);
                                      }
                                    //fluid
                                      else if(flag[x][y]==CONST_FLUID){
                                          outFile.print(flag[x][y]+" "+u[x][y] +" "+v[x][y] +" "+mass[x][y]+" "+UU[x][y]);
                                      }
                                   //empty
                                      else if(flag[x][y]==CONST_EMPTY){
                                          outFile.print(flag[x][y]+" "+UU[x][y]);  
                                      }	
                                  //wall
                                      else if(flag[x][y]==CONST_WALL){
                                          outFile.print(flag[x][y]+" "+ normal_dirction[x][y][0] +" "+ normal_dirction[x][y][1]+" "+UU[x][y]);
                                      }    
                                    //NONE
                                  else if (flag[x][y]==CONST_NONE){
                                          outFile.print(flag[x][y]+" "+UU[x][y]);  
                                      }	  
                                  else{
                                  }
				outFile.println();
				
			} 	
		}
          }catch (IOException e) {
			e.printStackTrace();
		} finally {
			
                    outFile.close();
			
		}
          }
           
            else if (reply.startsWith("3")) {
               try{
                    console.close();
               }
               catch(IOException e) {
                    System.out.println(e);
                 System.exit(1);
                }
                System.exit(1);
            }  // if reply is 6

            // The user's reply was not recognized as a command.
            //else System.out.println("Unrecognized command.  Please try again.");
        } // end of "while true"
    } // end of main()


} // end of class imageMain











?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人av在线影院| 蜜臀av一区二区| 国产色婷婷亚洲99精品小说| 欧美一级黄色片| 欧美一级片在线观看| 7777精品伊人久久久大香线蕉最新版| 欧美性色黄大片| 欧美三级视频在线| 欧美午夜精品久久久久久孕妇| 岛国精品一区二区| 成人av网站在线观看| 国产成人亚洲精品狼色在线| 国产精品亚洲第一| 北条麻妃一区二区三区| 色综合夜色一区| 欧美日韩国产天堂| 精品美女被调教视频大全网站| 精品久久久久久亚洲综合网| 久久免费美女视频| 国产精品色哟哟网站| 玉米视频成人免费看| 水野朝阳av一区二区三区| 黄色日韩三级电影| 91美女在线视频| 欧美日韩国产综合草草| 欧美成人aa大片| 国产精品视频一二| 午夜av电影一区| 国产在线精品一区二区三区不卡 | 成人久久久精品乱码一区二区三区 | 久久免费精品国产久精品久久久久| 欧美电视剧在线看免费| 中文字幕在线一区免费| 亚洲伊人伊色伊影伊综合网| 日本va欧美va瓶| 成人97人人超碰人人99| 欧美性大战xxxxx久久久| 欧美mv日韩mv国产| 亚洲品质自拍视频| 九九热在线视频观看这里只有精品| 国产精品一区二区不卡| 精品视频一区 二区 三区| 久久蜜臀精品av| 一区二区三区四区中文字幕| 久久精品99国产精品| 91小视频免费观看| 精品国产百合女同互慰| 亚洲精品美国一| 国产精品一二一区| 精品1区2区3区| 国产精品三级av在线播放| 丝袜国产日韩另类美女| 91视频国产观看| 欧美激情一区二区在线| 日本不卡视频在线| 欧美性三三影院| 亚洲视频 欧洲视频| 精品一区二区三区欧美| 欧美老女人在线| 亚洲色图20p| 成人一级片在线观看| 欧美v国产在线一区二区三区| 亚洲伦理在线精品| 懂色中文一区二区在线播放| 欧美不卡一区二区三区| 日韩高清不卡在线| 欧美影院一区二区三区| 亚洲美女偷拍久久| 99精品偷自拍| 国产精品―色哟哟| 波多野结衣精品在线| 欧美高清在线一区二区| 国产一区亚洲一区| 2023国产一二三区日本精品2022| 亚洲成av人片一区二区梦乃 | 综合分类小说区另类春色亚洲小说欧美 | 成人av电影在线网| 亚洲国产岛国毛片在线| 大桥未久av一区二区三区中文| 久久久久久免费| 国产乱子伦视频一区二区三区| 欧美白人最猛性xxxxx69交| 日本人妖一区二区| 精品国产亚洲在线| 国产成人av一区二区三区在线观看| 久久久久国产一区二区三区四区| 狠狠色丁香久久婷婷综| 国产人伦精品一区二区| 岛国一区二区在线观看| 亚洲日本电影在线| 欧美三日本三级三级在线播放| 午夜不卡在线视频| 日韩精品中文字幕一区二区三区| 精品一区二区在线观看| 久久久久久免费| www.亚洲在线| 性做久久久久久久久| 日韩三级视频在线观看| 国产精品一二一区| 一区二区三区欧美亚洲| 91精品国产乱| 成人性生交大片免费看中文网站| 国产精品色婷婷久久58| 91久久精品日日躁夜夜躁欧美| 日本一不卡视频| 国产精品久久久久影视| 欧美日韩视频一区二区| 国产乱一区二区| 洋洋av久久久久久久一区| 日韩精品一区二区三区蜜臀| 国产不卡高清在线观看视频| 一区二区三区在线免费播放| 欧美一级片在线看| 91麻豆国产香蕉久久精品| 精品在线播放免费| 一区二区三区在线播放| 久久亚洲综合av| 欧美性三三影院| 成人精品gif动图一区| 天天操天天干天天综合网| 中文字幕av一区二区三区高| 欧美视频一区二区三区在线观看 | 成人av在线观| 美国毛片一区二区三区| 亚洲视频免费在线| 久久久www免费人成精品| 欧美日韩的一区二区| 9i看片成人免费高清| 久久99精品一区二区三区三区| 亚洲综合一区二区三区| 国产欧美日本一区视频| 欧美电影免费观看完整版| 色婷婷精品大在线视频| 国产乱一区二区| 精品在线免费观看| 丝袜亚洲精品中文字幕一区| 亚洲欧美乱综合| 中文字幕在线免费不卡| 久久精品欧美一区二区三区不卡 | 国模冰冰炮一区二区| 偷拍亚洲欧洲综合| 亚洲国产乱码最新视频| 最好看的中文字幕久久| 欧美极品aⅴ影院| 久久精品夜色噜噜亚洲a∨| 欧美精品一区二区高清在线观看| 欧美日韩国产在线播放网站| 欧美日韩一区久久| 欧美视频在线不卡| 欧美性一二三区| 欧美日韩高清一区二区| 欧美精品久久一区| 91精品国产综合久久福利软件 | 欧美一级二级三级蜜桃| 91精品一区二区三区在线观看| 欧美视频自拍偷拍| 欧美精品在线观看一区二区| 欧美日本国产一区| 欧美一区二区在线播放| 欧美一区二区三区在线观看| 3d动漫精品啪啪一区二区竹菊| 在线成人午夜影院| 欧美大度的电影原声| 精品国产乱码久久久久久闺蜜| 日韩一区二区高清| 久久综合九色综合97_久久久| 精品成人一区二区| 国产清纯白嫩初高生在线观看91| 国产精品毛片无遮挡高清| 18欧美亚洲精品| 亚洲午夜电影在线| 美女高潮久久久| 国产v日产∨综合v精品视频| av不卡免费电影| 欧美日韩中文国产| 久久综合九色综合97婷婷| 亚洲国产激情av| 亚洲福利电影网| 狠狠色丁香久久婷婷综合丁香| 高清视频一区二区| 欧美日韩中文字幕精品| 精品国产一区二区三区不卡| 国产精品视频一二三区| 午夜视频一区在线观看| 狠狠色综合播放一区二区| 91污在线观看| 91精品国产综合久久久久久| 国产性色一区二区| 亚洲激情av在线| 精品一区二区三区免费| 99精品视频在线观看免费| 91麻豆精品91久久久久久清纯| 国产午夜亚洲精品羞羞网站| 一区二区三区蜜桃网| 韩国成人在线视频| 欧美私人免费视频| 日本一区免费视频| 天天综合色天天综合色h| 成人黄色777网| 日韩一区二区三免费高清|