recheader.java

来自「mpi并行计算的c++代码 可用vc或gcc编译通过 可以用来搭建并行计算试验环」· Java 代码 · 共 105 行

JAVA
105
字号
/* *  (C) 2001 by Argonne National Laboratory *      See COPYRIGHT in top-level directory. *//* *  @author  Anthony Chan */package logformat.clog2;import java.io.*;// Class corresponds to CLOG_Rec_Headerpublic class RecHeader{    private static final int BYTESIZE = 8 + 4 * 4;    public         double time;    private        int    icomm;    // unique communicator ID    private        int    rank;     // rank of communicator labelled by icomm    public         int    thread;    public         int    rectype;    public         int    lineID;   // lineID used in drawable    public RecHeader()    {        time       = Const.INVALID_double;        icomm      = Const.INVALID_int;        rank       = Const.INVALID_int;        thread     = Const.INVALID_int;        rectype    = Const.INVALID_int;        lineID     = Const.INVALID_int;    }    public RecHeader( DataInputStream istm )    {        this.readFromDataStream( istm );    }    public int readFromDataStream( DataInputStream istm )    {        try {            time       = istm.readDouble();            icomm      = istm.readInt();            rank       = istm.readInt();            thread     = istm.readInt();            rectype    = istm.readInt();        } catch ( IOException ioerr ) {            ioerr.printStackTrace();            return 0;        }        lineID  = LineID.compute( icomm, rank );        return BYTESIZE;    }    public int skipBytesFromDataStream( DataInputStream in )    {        try {            in.skipBytes( BYTESIZE );        } catch ( IOException ioerr ) {            ioerr.printStackTrace();            return 0;        }        return BYTESIZE;    }/*    //Copy Constructor    public RecHeader copy()    {        RecHeader cp  = new RecHeader();        cp.time       = this.time;         cp.icomm      = this.icomm;        cp.rank       = this.rank;        cp.thread     = this.thread;        cp.rectype    = this.rectype;        lineID  = LineID.compute( icomm, rank );        return cp;    }*/    public int getRecType()    {        return this.rectype;    }    public String toString()    {        return ( "RecHeader"               + "[ time=" + time               + ", icomm=" + icomm               + ", rank=" + rank               + ", thread=" + thread                + ", rectype=" + rectype               // + ", BYTESIZE=" + BYTESIZE               + " ]" );    } }

⌨️ 快捷键说明

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