Exemplo n.º 1
0
        /// <summary>
        /// Add nodes classified on the model entity of dimension `dim' and tag `tag'.
        /// `nodeTags' contains the node tags (their unique, strictly positive
        /// identification numbers). `coord' is a vector of length 3 times the length
        /// of `nodeTags' that contains the x, y, z coordinates of the nodes,
        /// concatenated: [n1x, n1y, n1z, n2x, ...]. The optional `parametricCoord'
        /// vector contains the parametric coordinates of the nodes, if any. The
        /// length of `parametricCoord' can be 0 or `dim' times the length of
        /// `nodeTags'. If the `nodeTags' vector is empty, new tags are automatically
        /// assigned to the nodes.
        /// </summary>
        public void AddNodes(int dim, long[] nodeTags, double[] coord, double[] parametricCoord, int tag = -1)
        {
            var numNodes = coord.Length / 3;

            if (numNodes != nodeTags.Length)
            {
                throw new GMshException("Wrong number of coordinates");
            }

            GMshNativeMethods.gmshModelMeshAddNodes(dim, tag, nodeTags.Select(n => Convert.ToUInt32(n)).ToArray(), nodeTags.Length.ToUint(), coord, coord.Length.ToUint(), parametricCoord, parametricCoord.Length.ToUint(), ref ierr);
            if (ierr != 0)
            {
                throw new GMshException(ierr);
            }
        }