Esempio n. 1
0
        /**
         * Writes a fault skin to a file with specified name.
         * @param fileName the fault skin file name.
         * @param skin the fault skin.
         */
        public static void writeToFile(String fileName, FaultSkin skin)
        {
            throw new NotImplementedException();
#if false
            try {
                ArrayOutputStream aos = new ArrayOutputStream(fileName);
                aos.writeInt(skin.size());
                aos.writeInt(skin._seed.i1);
                aos.writeInt(skin._seed.i2);
                aos.writeInt(skin._seed.i3);
                for (FaultCell cell:skin)
                {
                    aos.writeFloat(cell.x1);
                    aos.writeFloat(cell.x2);
                    aos.writeFloat(cell.x3);
                    aos.writeFloat(cell.fl);
                    aos.writeFloat(cell.fp);
                    aos.writeFloat(cell.ft);
                    aos.writeFloat(cell.s1);
                    aos.writeFloat(cell.s2);
                    aos.writeFloat(cell.s3);
                }
                for (FaultCell cell:skin)
                {
                    FaultCell[] nabors = new FaultCell[] { cell.ca, cell.cb, cell.cl, cell.cr };
                    for (FaultCell nabor:nabors)
                    {
                        if (nabor != null)
                        {
                            aos.writeInt(nabor.i1);
                            aos.writeInt(nabor.i2);
                            aos.writeInt(nabor.i3);
                        }
                        else
                        {
                            aos.writeInt(INULL);
                            aos.writeInt(INULL);
                            aos.writeInt(INULL);
                        }
                    }
                }
                aos.close();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
#endif
        }
Esempio n. 2
0
        public static void writeToFileSlow(String fileName, FaultSkin skin)
        {
            throw new NotImplementedException();
#if false
            try
            {
                FileOutputStream   fos = new FileOutputStream(fileName);
                ObjectOutputStream oos = new ObjectOutputStream(fos);
                oos.writeObject(skin);
                oos.close();
            }
            catch (Exception e)
            {
                throw new RuntimeException(e);
            }
#endif
        }
Esempio n. 3
0
        public static FaultSkin readFromFileSlow(String fileName)
        {
            throw new NotImplementedException();
#if false
            try
            {
                FileInputStream   fis  = new FileInputStream(fileName);
                ObjectInputStream ois  = new ObjectInputStream(fis);
                FaultSkin         skin = (FaultSkin)ois.readObject();
                ois.close();
                return(skin);
            }
            catch (Exception e)
            {
                throw new RuntimeException(e);
            }
#endif
        }
Esempio n. 4
0
        /**
         * Returns a fault skin read from a file with specified name.
         * @param fileName the fault skin file name.
         * @return the fault skin.
         */
        public static FaultSkin readFromFile(String fileName)
        {
            throw new NotImplementedException();
#if false
            FaultSkin skin = new FaultSkin();
            try {
                ArrayInputStream ais      = new ArrayInputStream(fileName);
                int ncell                 = ais.readInt();
                int i1seed                = ais.readInt();
                int i2seed                = ais.readInt();
                int i3seed                = ais.readInt();
                List <FaultCell> cellList = new List <FaultCell>(ncell);
                for (int icell = 0; icell < ncell; ++icell)
                {
                    float     x1   = ais.readFloat();
                    float     x2   = ais.readFloat();
                    float     x3   = ais.readFloat();
                    float     fl   = ais.readFloat();
                    float     fp   = ais.readFloat();
                    float     ft   = ais.readFloat();
                    FaultCell cell = new FaultCell(x1, x2, x3, fl, fp, ft);
                    cell.skin = skin;
                    cellList.add(cell);
                    cell.s1 = ais.readFloat();
                    cell.s2 = ais.readFloat();
                    cell.s3 = ais.readFloat();
                }
                FaultCell[]   cells = cellList.toArray(new FaultCell[0]);
                FaultCellGrid fcg   = new FaultCellGrid(cells);
                for (FaultCell cell:cellList)
                {
                    int i1a = ais.readInt();
                    int i2a = ais.readInt();
                    int i3a = ais.readInt();
                    int i1b = ais.readInt();
                    int i2b = ais.readInt();
                    int i3b = ais.readInt();
                    int i1l = ais.readInt();
                    int i2l = ais.readInt();
                    int i3l = ais.readInt();
                    int i1r = ais.readInt();
                    int i2r = ais.readInt();
                    int i3r = ais.readInt();
                    if (i1a != INULL)
                    {
                        cell.ca = fcg.get(i1a, i2a, i3a);
                    }
                    if (i1b != INULL)
                    {
                        cell.cb = fcg.get(i1b, i2b, i3b);
                    }
                    if (i1l != INULL)
                    {
                        cell.cl = fcg.get(i1l, i2l, i3l);
                    }
                    if (i1r != INULL)
                    {
                        cell.cr = fcg.get(i1r, i2r, i3r);
                    }
                }
                ais.close();
                skin._seed     = fcg.get(i1seed, i2seed, i3seed);
                skin._cellList = cellList;
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            return(skin);
#endif
        }