runfeap.java

来自「平面三角形有限元程序」· Java 代码 · 共 85 行

JAVA
85
字号
/* * runFeap.java * * Created on 8. Dezember 2002, 20:52 *//** * * @author  uhde */import java.io.*;public class runFeap {        BufferedWriter output;        /** Creates a new instance of runFeap */    public runFeap(String cmdline, String feapFile) {        try {            //Open Feap Programm            Process p = Runtime.getRuntime().exec(cmdline);            // Write something to process            output = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));            command("n");            // feap input file in homedir !!!!!!!!!!!!!!!!!!!!            command(feapFile);            command("");            command("");            command("");            command("y");            command("tang,,1");            command("disp,all");            command("stre,all");            command("show");            command("plot");            command("mesh");//                // Read something from process//                String linein = new String();//                //linein2;//                BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));//                // Maybe parse line per line for a prompt?//                while((linein = input.readLine()) != null) {//                   // if (linein2.equals(linein))//                        System.out.println(linein);//                }//                //linein2 = linein;//                input.close();        } catch (IOException err) {                err.printStackTrace();        }    }    /* send command to feap process */    private void command(String cmd) {	try {            String line= cmd + "\n";            output.write(line,0, line.length());            output.flush();	} catch (IOException err) {            err.printStackTrace();        }    }    /* Exec an feap command */    public void execCommand(String cmd) {        command(cmd);    }        protected void finalize() {        System.out.println("Bye");        command("end");        command("quit");        command("n");        try {            output.close();        } catch (IOException e) {            e.printStackTrace();            // nothing        }    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?