Пример #1
0
        private MeshBoundary ParseBoundary(ParseTreeNode node)
        {
            var b = new MeshBoundary();

            b.Name = node.ChildNodes[0].Token.Text;
            foreach (ParseTreeNode rootEntryNode in node.ChildNodes[2].FindDictEntries(null))
            {
                var identifier = rootEntryNode.GetEntryIdentifier();
                switch (identifier)
                {
                case "type":
                    b.Type = rootEntryNode.GetBasicValEnum <PatchType>();
                    break;

                case "neighbourPatch":
                    b.NeighbourPatch = rootEntryNode.GetBasicValString();
                    break;

                case "faces":
                    b.Faces = new List <List <int> >();
                    var arrayBody = rootEntryNode.GetDictArrayBody();
                    Func <ParseTreeNode, List <int> > fconv = nn =>
                    {
                        var r = new List <int>();
                        r.AddRange(nn.ChildNodes[1].GetArrayOfInt32());
                        return(r);
                    };
                    b.Faces.AddRange(arrayBody.GetArray(fconv));
                    break;
                }
            }
            return(b);
        }
Пример #2
0
 private MeshBoundary ParseBoundary(ParseTreeNode node)
 {
     var b = new MeshBoundary();
     b.Name = node.ChildNodes[0].Token.Text;
     foreach (ParseTreeNode rootEntryNode in node.ChildNodes[2].FindDictEntries(null))
     {
         var identifier = rootEntryNode.GetEntryIdentifier();
         switch (identifier)
         {
             case "type":
                 b.Type = rootEntryNode.GetBasicValEnum<PatchType>();
                 break;
             case "neighbourPatch":
                 b.NeighbourPatch = rootEntryNode.GetBasicValString();
                 break;
             case "faces":
                 b.Faces = new List<List<int>>();
                 var arrayBody = rootEntryNode.GetDictArrayBody();
                 Func<ParseTreeNode, List<int>> fconv = nn =>
                 {
                     var r = new List<int>();
                     r.AddRange(nn.ChildNodes[1].GetArrayOfInt32());
                     return r;
                 };
                 b.Faces.AddRange(arrayBody.GetArray(fconv));
                 break;
         }
     }
     return b;
 }