Exemple #1
0
        /// <summary>
        /// Evaluates all polynomials in reference space
        /// in this basis (see <see cref="Polynomials"/>);
        /// </summary>
        /// <param name="Ns"></param>
        /// <returns>
        /// <list type="bullet">
        ///   <item>1st index: node index</item>
        ///   <item>2nd index: polynomial index</item>
        /// </list>
        /// </returns>
        public virtual MultidimensionalArray Evaluate(NodeSet Ns)
        {
            int iKref = Ns.GetVolumeRefElementIndex(this.GridDat);
            int N     = this.Polynomials[iKref].Count;
            MultidimensionalArray Values = this.GridDat.ChefBasis.BasisValues.GetValues(Ns, this.Degree);

            if (Values.GetLength(1) == N)
            {
                return(Values);
            }
            else
            {
                return(Values.ExtractSubArrayShallow(new int[] { 0, 0 }, new int[] { Ns.NoOfNodes - 1, N - 1 }));
            }
        }
Exemple #2
0
        /// <summary>
        /// A vectorized evaluation for the 2nd derivative, i.e. the Hessian, in physical coordinates: \f$ \partial^2_{\vec{x}} \phi_{j n} \f$.
        /// </summary>
        /// <param name="Nodes"></param>
        /// <param name="j0">Index of first cell in the vector</param>
        /// <param name="Len">Length of the vector</param>
        /// <returns>
        ///  - 1st index: cell
        ///  - 2nd index: node index <em>m</em>
        ///  - 3rd index: polynomial index <em>n</em>
        ///  - 4th index: spatial direction of 1st derivation, <em>k</em>
        ///  - 5th index: spatial direction of 2nd derivation, <em>l</em>
        /// So, the entry [m,n,k,l] =
        /// \f$
        /// \frac{\partial}{\partial x_k} \frac{\partial}{\partial x_l} \phi_n (\vec{x}_m)
        ///  \f$, where \f$ \vec{x}_m \f$ is the
        /// <em>m</em>-th vector in the nodeset #<paramref name="Nodes"/>.
        /// </returns>
        public MultidimensionalArray CellEval2ndDeriv(NodeSet Nodes, int j0, int Len)
        {
            int iKref = Nodes.GetVolumeRefElementIndex(this.GridDat);
            int N     = this.Polynomials[iKref].Count;
            int D     = this.GridDat.SpatialDimension;
            MultidimensionalArray Values = this.GridDat.ChefBasis.CellBasisHessianValues.GetValue_Cell(Nodes, j0, Len, this.Degree);

            if (Values.GetLength(2) == N)
            {
                return(Values);
            }
            else
            {
                return(Values.ExtractSubArrayShallow(new int[] { 0, 0, 0, 0, 0 }, new int[] { Len - 1, Nodes.NoOfNodes - 1, N - 1, D - 1, D - 1 }));
            }
        }