예제 #1
0
파일: PolyMesh.cs 프로젝트: Netkidxp/TPLC
 public bool ChangePatchName(string oldName, string newName)
 {
     /*
      * FoamDictionaryListFile f = new FoamDictionaryListFile(FoamConst.GetBoundaryFileNameFromVxt(vxtFileName));
      * f.Read();
      * if (!f.Dictionary.IsNull)
      * {
      *   FoamDictionary d = f.Dictionary.Item(oldName);
      *   f.Dictionary.RemoveChild(oldName);
      *   f.Dictionary.SetChild(newName, d);
      * }
      * f.Write();
      */
     try
     {
         StreamReader sr   = new StreamReader(FoamConst.GetBoundaryFileNameFromVxt(vxtFileName));
         string       code = sr.ReadToEnd();
         sr.Close();
         code = code.Replace(oldName, newName);
         File.Delete(FoamConst.GetBoundaryFileNameFromVxt(vxtFileName));
         StreamWriter sw = new StreamWriter(FoamConst.GetBoundaryFileNameFromVxt(vxtFileName), false);
         sw.Write(code);
         sw.Close();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
예제 #2
0
파일: PolyMesh.cs 프로젝트: Netkidxp/TPLC
        public List <string> GetAllPatchNames()
        {
            List <string>          names = new List <string>();
            FoamDictionaryListFile f     = new FoamDictionaryListFile(FoamConst.GetBoundaryFileNameFromVxt(vxtFileName));

            f.Read();
            if (!f.Dictionary.IsNull)
            {
                foreach (KeyValuePair <string, FoamDictionary> k in f.Dictionary)
                {
                    names.Add(k.Key);
                }
            }
            return(names);
        }
예제 #3
0
파일: PolyMesh.cs 프로젝트: Netkidxp/TPLC
        public void SetBoundaryType(string name, BoundaryType bt)
        {
            FoamDictionaryListFile f = new FoamDictionaryListFile(FoamConst.GetBoundaryFileNameFromVxt(vxtFileName));

            f.Read();
            if (!f.Dictionary.IsNull)
            {
                foreach (KeyValuePair <string, FoamDictionary> k in f.Dictionary)
                {
                    if (k.Key == name)
                    {
                        FoamDictionary cv = k.Value;
                        cv.SetChild("type", bt.ToString());
                        cv.RemoveChild("inGroups");
                    }
                }
            }
            f.Write();
        }
예제 #4
0
파일: PolyMesh.cs 프로젝트: Netkidxp/TPLC
        public List <string> GetPatchNamesByType(string typeName)
        {
            List <string>          names = new List <string>();
            FoamDictionaryListFile f     = new FoamDictionaryListFile(FoamConst.GetBoundaryFileNameFromVxt(vxtFileName));

            f.Read();
            if (!f.Dictionary.IsNull)
            {
                foreach (KeyValuePair <string, FoamDictionary> k in f.Dictionary)
                {
                    FoamDictionary cv = k.Value;
                    if (cv.Child("type").Data == typeName)
                    {
                        names.Add(k.Key);
                    }
                }
            }
            return(names);
        }