Exemplo n.º 1
0
        //Save WIND data to file
        public virtual void Save(string WINDPLUSFileName)
        {
            try
            {
                if (WINDFileContents.Count > 0)
                {
                    { //Write .WIND file:
                        TextWriter w = new StreamWriter(WINDPLUSFileName);
                        //number of wind zones and parameters:
                        w.WriteLine(WINDFileContents.Count);
                        w.WriteLine(GetVariable("WINDPLUS_STRESSCOEFF_CD"));
                        w.WriteLine(GetVariable("WINDPLUS_AIRDENSITY"));

                        for (int i = 0; i < WINDFileContents.Count; ++i)
                        {
                            //wind file name, rows
                            w.WriteLine(WINDFileContents[i].SecondaryFileName);
                            w.WriteLine(WINDFileContents[i].nExtraLines);
                            for (int j = 0; j < WINDFileContents[i].nExtraLines; ++j)
                            {
                                w.WriteLine(WINDFileContents[i].ExtraData[j]);
                            }
                        }
                        w.Close();
                    }

                    // Write secondary wind data files.
                    int nColumns = 3;
                    Universal.SaveSecondaryTables("WIND", nColumns);

                    //foreach (Universal.SecondaryGroup aGroup in Universal.SecondaryGroups.Values)
                    //{
                    //    if (aGroup.Component == "WIND")
                    //    {
                    //        TextWriter secondaryFile = new StreamWriter(aGroup.FileName);

                    //        secondaryFile.WriteLine(aGroup.NPoints);
                    //        for (int i = 0; i < aGroup.NPoints; i++)
                    //        {
                    //            secondaryFile.WriteLine(aGroup.Table[i].Col0 + "   " +
                    //                                aGroup.Table[i].Col1 + "   " +
                    //                                aGroup.Table[i].Col2);
                    //        }
                    //        secondaryFile.Close();
                    //    }
                    //}
                }
                else
                {
                    MessageBox.Show(Universal.Idioma("The wins table is empty. It was not saved.", "La tabla de viento está vacía. No fue almacenada."),
                                    "RiverFlow2D", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch
            {
                MessageBox.Show(Universal.Idioma("ERROR 1903170641: error while saving .WIND file.", "ERROR 1903170641: error almacenando archivo .WIND."),
                                "RiverFlow2D", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        //Save .LRAIN data to file
        public virtual void Save(string LINFFileName)
        {
            try
            {
                if (LRAINFileContents.Count > 0)
                {
                    {        //Write .LRAIN file:
                        TextWriter w = new StreamWriter(LINFFileName);
                        //number of rain/evaporation zones and parameters:
                        w.WriteLine(LRAINFileContents.Count);


                        for (int i = 0; i < LRAINFileContents.Count; ++i)
                        {
                            w.WriteLine(LRAINFileContents[i].SecondaryFileName);
                            w.WriteLine(LRAINFileContents[i].nExtraLines);
                            for (int j = 0; j < LRAINFileContents[i].nExtraLines; ++j)
                            {
                                w.WriteLine(LRAINFileContents[i].ExtraData[j]);
                            }
                        }
                        w.Close();
                    }

                    // Write secondary rain/evaporation data files.
                    int nColumns = 3;
                    Universal.SaveSecondaryTables("LRAIN", nColumns);

                    //foreach (Universal.SecondaryGroup aGroup in Universal.SecondaryGroups.Values)
                    //{
                    //    if (aGroup.Component == "LRAIN")
                    //    {
                    //	    TextWriter secondaryFile = new StreamWriter(aGroup.FileName);

                    //	    secondaryFile.WriteLine(aGroup.NPoints);
                    //	    for (int i = 0; i < aGroup.NPoints; i++)
                    //	    {
                    //	    secondaryFile.WriteLine(aGroup.Table[i].Col0 + "   " +
                    //						    aGroup.Table[i].Col1 + "   " +
                    //						    aGroup.Table[i].Col2);
                    //	    }
                    //	    secondaryFile.Close();
                    //    }
                    //}
                }
                else
                {
                    MessageBox.Show(Universal.Idioma("The rain/evaporation table is empty. It was not saved.",
                                                     "La tabla de lluvia/evaporación está vacía. No fue almacenada"),
                                    "RiverFlow2D", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch
            {
                MessageBox.Show(Universal.Idioma("ERROR 2103170805: error while saving .LRAIN file.", "ERROR 2103170805: error almacenando .LRAIN."),
                                "RiverFlow2D", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 3
0
        //Save GATES data to file.
        public virtual void Save(string DAMBREACHFileName)
        {
            try
            {
                if (DAMBREACHFileContents.Count > 0)
                {
                    {//Write .DAMBREACH file:
                        TextWriter w = new StreamWriter(DAMBREACHFileName);
                        //number of breaches::
                        w.WriteLine(DAMBREACHFileContents.Count);



                        for (int i = 0; i < DAMBREACHFileContents.Count; ++i)
                        {
                            //dam breach name, coordinates, parameters, filename, rows
                            w.WriteLine(DAMBREACHFileContents[i].DamBreachName);
                            w.WriteLine(DAMBREACHFileContents[i].Coordinates);
                            w.WriteLine(DAMBREACHFileContents[i].Parameters);
                            w.WriteLine(DAMBREACHFileContents[i].SecondaryFileName);
                            w.WriteLine(DAMBREACHFileContents[i].nExtraLines);
                            for (int j = 0; j < DAMBREACHFileContents[i].nExtraLines; ++j)
                            {
                                w.WriteLine(DAMBREACHFileContents[i].ExtraData[j]);
                            }
                        }
                        w.Close();
                    }

                    //Write secondary temporal evolution data files.
                    int nColumns = 3;
                    Universal.SaveSecondaryTables("DAMBREACH", nColumns);
                }
                else
                {
                    MessageBox.Show(Universal.Idioma("The dam breach table is empty. It was not saved.", "La tabla de brechas esá vacía. No fue almacanada."),
                                    "RiverFlow2D", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch
            {
                MessageBox.Show(Universal.Idioma("ERROR 1206171122: error while saving .DAMBREACH file.", "ERROR 1206171122: error almacenando archivo .DAMBREACH file."),

                                "RiverFlow2D", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 4
0
        //Save data to file
        public virtual void Save(string SOURCESfilename)
        {
            try
            {
                if (SOURCESFileContents.Count > 0)
                {
                    {//Write .SOURCES file:
                        TextWriter w = new StreamWriter(SOURCESfilename);
                        //number of sources:
                        w.WriteLine(SOURCESFileContents.Count);


                        for (int i = 0; i < SOURCESFileContents.Count; ++i)
                        {
                            //Sources name, file name, XY:
                            w.WriteLine(SOURCESFileContents[i].SourceName);
                            w.WriteLine(SOURCESFileContents[i].SourceType);
                            w.WriteLine(SOURCESFileContents[i].SecondaryFileName);
                            w.WriteLine(SOURCESFileContents[i].XY);
                        }
                        w.Close();
                    }

                    // Write secondary sources data files.
                    int nColumns = 3;
                    Universal.SaveSecondaryTables("SOURCES", nColumns);
                }
                else
                {
                    MessageBox.Show(Universal.Idioma("The sources table is empty. It was not saved.", "La tabla de fuentes y sumideros está vacía. No fue almacenada."),
                                    "RiverFlow2D", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch
            {
                MessageBox.Show(Universal.Idioma("ERROR 0308171717: error while saving .SOURCES file.", "ERROR 0308171717: error almacenando archivo .SOURCES."),
                                "RiverFlow2D", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 5
0
        //Save BRIDGES data to file.
        public virtual void Save(string filename)
        {
            try
            {
                if (BRIDGESFileContents.Count > 0)
                {
                    { //Write .BRIDGES file:
                        TextWriter w = new StreamWriter(filename);
                        //number of bridges:
                        w.WriteLine(BRIDGESFileContents.Count);



                        for (int i = 0; i < BRIDGESFileContents.Count; ++i)
                        {
                            //Bridge name, parameters, profiles file name, rows
                            w.WriteLine(BRIDGESFileContents[i].BridgeName);
                            w.WriteLine(BRIDGESFileContents[i].Parameters);
                            w.WriteLine(BRIDGESFileContents[i].SecondaryFileName);
                            w.WriteLine(BRIDGESFileContents[i].nExtraLines);
                            for (int j = 0; j < BRIDGESFileContents[i].nExtraLines; ++j)
                            {
                                w.WriteLine(BRIDGESFileContents[i].ExtraData[j]);
                            }
                        }
                        w.Close();
                    }

                    // Write secondary geometry data files.
                    int nColumns = 5;
                    Universal.SaveSecondaryTables("BRIDGES", nColumns);

                    //foreach (Universal.SecondaryGroup aGroup in Universal.SecondaryGroups.Values)
                    //{
                    //  if (aGroup.Component == "BRIDGES")
                    //  {
                    //    TextWriter secondaryFile = new StreamWriter(aGroup.FileName);

                    //    secondaryFile.WriteLine(aGroup.NPoints);
                    //    for (int i = 0; i < aGroup.NPoints; i++)
                    //    {
                    //      secondaryFile.WriteLine(aGroup.Table[i].Col0 + "   " +
                    //                         aGroup.Table[i].Col1 + "   " +
                    //                         aGroup.Table[i].Col2 + "   " +
                    //                         aGroup.Table[i].Col3 + "   " +
                    //                         aGroup.Table[i].F4);
                    //    }
                    //    secondaryFile.Close();
                    //  }
                    //}
                }
                else
                {
                    MessageBox.Show(Universal.Idioma("The bridge table is empty. It was not saved.", "La tabla del puente esta vacía. No fue almacenada."),
                                    "RiverFlow2D", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch
            {
                MessageBox.Show(Universal.Idioma("ERROR 0405171625: error while saving .BRIDGES file.", "ERROR 0405171625: error almacenando .BRIDGES."),
                                "RiverFlow2D", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 6
0
        //Save GATES data to file.
        public virtual void Save(string GATESFileName)
        {
            try
            {
                if (GATESFileContents.Count > 0)
                {
                    {//Write .GATES file:
                        TextWriter w = new StreamWriter(GATESFileName);
                        //number of gates::
                        w.WriteLine(GATESFileContents.Count);



                        for (int i = 0; i < GATESFileContents.Count; ++i)
                        {
                            //Gate name, parameters, filename, rows
                            w.WriteLine(GATESFileContents[i].GateName);
                            w.WriteLine(GATESFileContents[i].Parameters);
                            w.WriteLine(GATESFileContents[i].SecondaryFileName);
                            w.WriteLine(GATESFileContents[i].nExtraLines);
                            for (int j = 0; j < GATESFileContents[i].nExtraLines; ++j)
                            {
                                w.WriteLine(GATESFileContents[i].ExtraData[j]);
                            }
                        }
                        w.Close();
                    }

                    //Write secondary openings data files.
                    int nColumns = 2;
                    Universal.SaveSecondaryTables("GATES", nColumns);

                    //foreach (Universal.SecondaryGroup aGroup in Universal.SecondaryGroups.Values)
                    //{
                    //  if (aGroup.Component == "GATES")
                    //  {
                    //    TextWriter secondaryFile = new StreamWriter(aGroup.FileName);

                    //    secondaryFile.WriteLine(aGroup.NPoints);

                    //    for (int i = 0; i < aGroup.NPoints; i++)
                    //    {
                    //      secondaryFile.WriteLine(aGroup.Table[i].Col0 + "   " +
                    //                        aGroup.Table[i].Col1);
                    //    }
                    //    secondaryFile.Close();
                    //  }
                    //}
                }
                else
                {
                    MessageBox.Show(Universal.Idioma("The gates table is empty. It was not saved.", "La tabla de compuertas está vacía. No fue almacenada"),
                                    "RiverFlow2D", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch
            {
                MessageBox.Show(Universal.Idioma("ERROR 2504170705: error while saving .GATES file.", "ERROR 2504170705: error almacenando .GATES file."),
                                "RiverFlow2D", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }