Exemplo n.º 1
0
        /// <summary>
        /// Read the next six tokens and parse them as a
        /// Six-vector's X, Y, Z, XX, YY and ZZ coordinates.
        /// The position of the reader will
        /// then move along to the next token after these, such that repeated calls
        /// to Next___() will return each token in sequence.
        /// </summary>
        /// <returns></returns>
        public SixVector Next6AsSixVector()
        {
            var result = SixVector.FromTokensList(_Tokens, _Index);

            Index += 6;
            return(result);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initialise a new node support with the fixed dimensions specified
 /// and the given stiffnesses in the other directions
 /// </summary>
 /// <param name="fixity"></param>
 public NodeSupport(Bool6D fixity, SixVector stiffness) : this(fixity)
 {
     _Stiffness = stiffness;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initialise a new vertex releases component with the specified
 /// releases and stiffnesses.  Note that the stiffness values will
 /// typically be ignored in directions which are not also released.
 /// </summary>
 /// <param name="releases"></param>
 /// <param name="stiffness"></param>
 public VertexReleases(Bool6D releases, SixVector stiffness) : this(releases)
 {
     _Stiffness = stiffness;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Update the properties of a Nucleus node from a GWA string
        /// in NODE.2 version syntax
        /// </summary>
        /// <param name="node"></param>
        /// <param name="gwa"></param>
        public void ReadNode(string gwa, Model.Model model, GSAConversionContext context)
        {
            // NODE.2 | num | name | colour | x | y | z |
            // is_grid { | grid_plane | datum | grid_line_a | grid_line_b } | axis |
            // is_rest { | rx | ry | rz | rxx | ryy | rzz } |
            // is_stiff { | Kx | Ky | Kz | Kxx | Kyy | Kzz } |
            // is_mesh { | edge_length | radius | tie_to_mesh | column_rigidity | column_prop | column_node | column_angle | column_factor | column_slab_factor }

            var tr = new TokenReader(gwa);

            tr.Next();                            // NODE
            string gsaID = tr.Next();             // num

            string name = tr.Next();              // name

            tr.Next();                            // colour
            Vector position = tr.Next3AsVector(); // x | y | z

            var node = context.IDMap.GetModelObject <Node>(model, gsaID);

            if (node == null)
            {
                node = model.Create.Node(position);
            }
            else
            {
                node.Position = position;
            }

            node.Name = name;

            if (tr.NextIs("GRID"))
            {
                tr.Skip(4); // is_grid { | grid_plane | datum | grid_line_a | grid_line_b }
            }
            tr.Next();      // axis !!!TODO!!!
            Bool6D fixity = new Bool6D();

            if (tr.NextIs("REST")) // is_rest
            {
                fixity = tr.Next6AsBool6D("1");
            }
            SixVector stiffness = null;

            if (tr.NextIs("STIFF")) // is_stiff
            {
                stiffness = tr.Next6AsSixVector();
            }
            if (!fixity.AllFalse || (stiffness != null && !stiffness.IsZero()))
            {
                var nodeSupport = new NodeSupport(fixity);
                if (stiffness != null)
                {
                    nodeSupport.Stiffness = stiffness;
                }
                //TODO: Axis
                node.SetData(nodeSupport);
            }
            else
            {
                node.Data.RemoveData <NodeSupport>(); //Clear restraints on existing nodes
            }
            context.IDMap.Add(node, gsaID);
        }