Esempio n. 1
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);
        }
Esempio n. 2
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());
            }
        }
Esempio n. 3
0
        public Pillar GlobalPillar(int i, int j)
        {
            const double zTop = 0f, zBottom = 10000f;
            Point3D      top    = Pillars[i, j].Point3D(zTop);
            Point3D      bottom = Pillars[i, j].Point3D(zBottom);
            Pillar       result = new Pillar(GlobalPoint3D(top), GlobalPoint3D(bottom));

            return(result);
        }
Esempio n. 4
0
 bool ReadFromCMG(SpecGrid specGrid, string file)
 {
     try
     {
         using (StreamReader sr = new StreamReader(file))
         {
             Pillars = new Pillar[specGrid.NX + 1, specGrid.NY + 1];
             string line;
             while ((line = sr.ReadLine()) != null)
             {
                 if (CMGReader.ClearLine(line) == cmg_kw_coord)
                 {
                     break;
                 }
             }
             List <string> values       = new List <string>();
             int           valuesNeeded = 6 * (specGrid.NX + 1);
             int           n            = 0;
             for (int j = 0; j < specGrid.NY + 1; ++j)
             {
                 while (values.Count < valuesNeeded && (line = sr.ReadLine()) != null)// add
                 {
                     line = CMGReader.ClearLine(line);
                     if (line != string.Empty)
                     {
                         foreach (string word in line.Split())
                         {
                             values.Add(word);
                         }
                     }
                 }
                 for (int i = 0; i < specGrid.NX + 1; ++i)
                 {
                     double xt = double.Parse(values[n++]);
                     double yt = double.Parse(values[n++]);
                     double zt = double.Parse(values[n++]);
                     double xb = double.Parse(values[n++]);
                     double yb = double.Parse(values[n++]);
                     double zb = double.Parse(values[n++]);
                     Pillars[i, j] = new Pillar(xt, yt, zt, xb, yb, zb);
                 }
                 values.RemoveRange(0, valuesNeeded); // remove
                 n = 0;
             }
             return(true);
         }
     }
     catch (Exception)
     {
         Init();
         return(false);
     }
 }
Esempio n. 5
0
 public Point2D XY(double tvd)
 {
     for (int i = 1; i < Points.Count(); ++i)
     {
         if (Points[i].TVD >= tvd)
         {
             InclPoint t      = Points[i - 1];
             InclPoint b      = Points[i];
             Pillar    pillar = new Pillar(t.X, t.Y, t.TVD, b.X, b.Y, b.TVD);
             return(pillar.Point2D(tvd));
         }
     }
     return(new Point2D());
 }
Esempio n. 6
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;
            }
        }
Esempio n. 7
0
 void Init()
 {
     Pillars = new Pillar[0, 0];
     MapAxes = new MapAxes();
 }