예제 #1
0
        /// <summary>
        /// Gets the local to global (and vice versa) transformation manager for this element.
        /// </summary>
        /// <returns>the trasformation manager related to this element</returns>
        public TransformManagerL2G GetTransformationManager()
        {
            if (this.lastNodalLocations == null)
            {
                lastNodalLocations = new Point[this.nodes.Length];
            }

            var flag = true;

            for (var i = 0; i < this.nodes.Length; i++)
            {
                if (lastNodalLocations[i] != nodes[i].Location)
                {
                    flag = false;
                    break;
                }
            }

            if (flag)
            {
                return(TransformManagerL2G.MakeFromLambdaMatrix(lastLambdaMatrix));
            }
            else
            {
                for (var i = 0; i < this.nodes.Length; i++)
                {
                    lastNodalLocations[i] = nodes[i].Location;
                }

                return(TransformManagerL2G.MakeFromLambdaMatrix(lastLambdaMatrix = GetLambdaMatrix()));
            }
        }
예제 #2
0
        /// <summary>
        /// Gets the local to global (and vice versa) transformation manager for this element.
        /// </summary>
        /// <returns>the trasformation manager related to this element</returns>
        public TransformManagerL2G GetTransformationManager()
        {
            /*
             * if (this.lastNodalLocations == null)
             *  lastNodalLocations = new Point[this.nodes.Length];
             *
             * var flag = true;
             *
             * for (var i = 0; i < this.nodes.Length; i++)
             * {
             *  if (lastNodalLocations[i] != nodes[i].Location)
             *  {
             *      flag = false;
             *      break;
             *  }
             * }
             *
             * if (flag)
             *  return TransformManagerL2G.MakeFromLambdaMatrix(lastLambdaMatrix);
             *
             *
             * else*/
            {
                //for (var i = 0; i < this.nodes.Length; i++)
                //    lastNodalLocations[i] = nodes[i].Location;

                var lambda = GetLambdaMatrix();

                return(TransformManagerL2G.MakeFromLambdaMatrix(lambda, MatrixPool));
            }
        }
        /// <summary>
        /// convert abaqus iso coords to bfe coords
        /// </summary>
        /// <param name="elm">target triangle element</param>
        /// <param name="elementTransformation">target triangle element</param>
        /// <param name="v">coordinations in <see cref="elm"/>'s local coordination system (abaqus)</param>
        /// <returns></returns>
        public static double[] AbaqusCoord2BfeCoord(TriangleElement elm, Vector v)
        {
            ///abaqus local coordination def: comment from https://engineering.stackexchange.com/questions/48285/abaqus-stri3-element-local-coordination-system?noredirect=1#comment87622_48285
            ///bfe local coordination def: comment from

            {
                //abaqus
                var v12 = elm.Nodes[1].Location - elm.Nodes[0].Location; //from node 2 to node 1
                var v13 = elm.Nodes[2].Location - elm.Nodes[0].Location; //from node 3 to node 1

                var n = Vector.Cross(v12, v13).GetUnit();                //unit of positive normal

                var cosOneTenth = Math.Cos(0.1 * Math.PI / 180);         //cos(0.1 deg)

                var takeI        = false;                                //take projection of I vector as local x dir
                var cos_normal_i = Vector.Dot(n, Vector.I);              //cos angle between I and positive normal unit
                var angle_n_i    = Math.Acos(cos_normal_i) * 180.0 / Math.PI;

                //due to Math.Acos documentation, 0° ≤ angle_n_i ≤ 180°
                if (angle_n_i < 179.9 && angle_n_i > 0.1)
                {
                    takeI = true;
                }
                else
                {
                    takeI = false;
                }

                var _1Axis = takeI ? Vector.I : Vector.J;//needs to be projected on the plane with normal of `n`

                //vector to plane project https://www.maplesoft.com/support/help/maple/view.aspx?path=MathApps%2FProjectionOfVectorOntoPlane

                var alpha = Vector.Dot(n, _1Axis) / n.Length;

                var proj1 = _1Axis - alpha * n;            //it is local x axis

                var local1 = proj1;                        //local x axis in global 3d
                var local3 = n;                            //local y axis in global 3d
                var local2 = Vector.Cross(local3, local1); //local z axis in global 3d

                var lamX = local1.GetUnit();               //Lambda_X
                var lamY = local2.GetUnit();               //Lambda_Y
                var lamZ = local3.GetUnit();               //Lambda_Z

                var lambda = Matrix.OfJaggedArray(new[]    //eq. 5.13
                {
                    new[] { lamX.X, lamY.X, lamZ.X },
                    new[] { lamX.Y, lamY.Y, lamZ.Y },
                    new[] { lamX.Z, lamY.Z, lamZ.Z }
                });

                var tr = TransformManagerL2G.MakeFromLambdaMatrix(lambda.AsMatrix());

                //lambda for transform between abaqus local coordination system <> global system

                //first need to convert v from element coord system to
                //TODO: these are right only if both abaqus and bfe local system origins are same

                Vector local;

                {//transform from abaus local to bfe local
                    var abaqusLocal = v;
                    var global      = tr.TransformLocalToGlobal(abaqusLocal);
                    var bfeLocal    = elm.GetTransformationManager().TransformGlobalToLocal(global);

                    local = bfeLocal;
                }


                return(new double[] { local.X, local.Y, local.Z });
            }
        }