Exemplo n.º 1
0
        public static Coord Read(BinaryReader reader)
        {
            byte version = reader.ReadByte();

            switch (version)
            {
            case Version0:
            {
                MapAxes ma     = MapAxes.Read(reader);
                int     icount = reader.ReadInt32();
                int     jcount = reader.ReadInt32();
                Pillar[,] ps = new Pillar[icount, jcount];
                for (int i = 0; i < icount; ++i)
                {
                    for (int j = 0; j < jcount; ++j)
                    {
                        ps[i, j] = Pillar.Read(reader);
                    }
                }
                return(new Coord(ma, ps));
            }

            default:
                return(new Coord());
            }
        }
Exemplo n.º 2
0
        bool ReadFromGRDECL(SpecGrid specGrid, MapAxes mapAxes, string file)
        {
            double[] values = GRDECLReader.Array(file, grdecl_kw_coord);
            if (values.Count() == 0)
            {
                return(false);
            }
            if (values.Count() != 2 * 3 * (specGrid.NX + 1) * (specGrid.NY + 1))
            {
                return(false);
            }
            //Init(specGrid.NX, specGrid.NX, 50f, 50f);
            Pillars = new Pillar[specGrid.NX + 1, specGrid.NY + 1];
            int n = 0;

            for (int j = 0; j < specGrid.NY + 1; ++j)
            {
                for (int i = 0; i < specGrid.NX + 1; ++i)
                {
                    double xt = values[n++];
                    double yt = values[n++];
                    double zt = values[n++];
                    double xb = values[n++];
                    double yb = values[n++];
                    double zb = values[n++];
                    Pillars[i, j] = new Pillar(xt, yt, zt, xb, yb, zb);
                }
            }
            MapAxes = mapAxes;
            return(true);
        }
Exemplo n.º 3
0
        public bool Read(SpecGrid specGrid, MapAxes mapAxes, string file, FileType type)
        {
            switch (type)
            {
            case FileType.CMG_ASCII:
                return(ReadFromCMG(specGrid, file));

            case FileType.GRDECL_ASCII:
                return(ReadFromGRDECL(specGrid, mapAxes, file));

            default:
                return(false);
            }
        }
Exemplo n.º 4
0
        public bool Read(string file, FileType type)
        {
            SpecGrid = new SpecGrid(file, type);
            MapAxes ma = new MapAxes(file, type);

            Coord  = new Coord(SpecGrid, ma, file, type);
            Zcorn  = new Zcorn(SpecGrid, file, type);
            Actnum = new Actnum(SpecGrid, file, type);
            if (Specified())
            {
                return(true);
            }
            Clear();
            return(false);
        }
Exemplo n.º 5
0
        void Init(int nx, int ny, double xSize, double ySize)
        {
            MapAxes = new MapAxes();
            const double z = 0f;

            Pillars = new Pillar[nx + 1, ny + 1];
            double y = 0.0f;

            for (int j = 0; j < ny + 1; ++j)
            {
                double x = 0.0f;
                for (int i = 0; i < nx + 1; ++i)
                {
                    Pillars[i, j] = new Pillar(x, y, z, x, y, z);
                    x            += xSize;
                }
                y += ySize;
            }
        }
Exemplo n.º 6
0
        double[,] Matrix(MapAxes mapAxes)
        {
            if (mapAxes.X1 == mapAxes.X2 && mapAxes.X2 == mapAxes.X3 &&
                mapAxes.Y1 == mapAxes.Y2 && mapAxes.Y2 == mapAxes.Y3)
            {
                return new double[, ] {
                           { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 }
                }
            }
            ;
            // http://htmlbook.ru/blog/matritsa-preobrazovanii

            /*
             * x' = ax+cy+tx
             * y' = bx+dy+ty
             */
            //float tx = -X2;
            //float ty = -Y2;
            //float a = X1 == X2 ? 1f : X1 - X2 / Math.Abs(X1 - X2);
            //float d = Y3 == Y2 ? 1f : Y3 - Y2 / Math.Abs(Y3 - Y2);
            double tx = 0;
            double ty = 0;
            double a  = -1;
            double d  = 1;
            double b  = 0f; // переделать
            double c  = 0f; // переделать

            /*
             * 0,0  0,1  0,2            a   b   0
             * 1,0  1,1  1,2            c   d   0
             * 2,0  2,1  2,2            tx  ty  1
             */
            return(new double[, ] {
                { a, b, 0 }, { c, d, 0 }, { tx, ty, 1 }
            });
        }
Exemplo n.º 7
0
 public Coord(SpecGrid specGrid, MapAxes mapAxes, string file, FileType type)
 {
     Init();
     Read(specGrid, mapAxes, file, type);
 }
Exemplo n.º 8
0
 public Coord(MapAxes mapAxes, Pillar[,] pillars)
 {
     Init(mapAxes, pillars);
 }
Exemplo n.º 9
0
 void Init(MapAxes mapAxes, Pillar[,] pillars)
 {
     Pillars = pillars;
     MapAxes = mapAxes;
 }
Exemplo n.º 10
0
 void Init()
 {
     Pillars = new Pillar[0, 0];
     MapAxes = new MapAxes();
 }