public static void TestStiffnessSubmatricesOfCrackBodyElement()
        {
            double equalityTolerance = 1E-13;
            Matrix expectedKss       = 1E6 * Matrix.CreateFromArray(new double[, ]
            {
                { +1.154, +0.481, -0.769, +0.096, -0.577, -0.481, +0.192, -0.096 },
                { +0.481, +1.154, -0.096, +0.192, -0.481, -0.577, +0.096, -0.769 },
                { -0.769, -0.096, +1.154, -0.481, +0.192, +0.096, -0.577, +0.481 },
                { +0.096, +0.192, -0.481, +1.154, -0.096, -0.769, +0.481, -0.577 },
                { -0.577, -0.481, +0.192, -0.096, +1.154, +0.481, -0.769, +0.096 },
                { -0.481, -0.577, +0.096, -0.769, +0.481, +1.154, -0.096, +0.192 },
                { +0.192, +0.096, -0.577, +0.481, -0.769, -0.096, +1.154, -0.481 },
                { -0.096, -0.769, +0.481, -0.577, +0.096, +0.192, -0.481, +1.154 }
            });

            Matrix expectedKse = 1E6 * Matrix.CreateFromArray(new double[, ]
            {
                { +0.962, +0.240, +0.769, +0.144, +0.577, +0.433, +0.385, -0.048 },
                { +0.240, +0.481, +0.337, -0.192, +0.529, +0.577, +0.048, -0.096 },
                { -0.769, +0.144, -0.962, +0.240, -0.385, -0.048, -0.577, +0.433 },
                { +0.337, +0.192, +0.240, -0.481, +0.048, +0.096, +0.529, -0.577 },
                { -0.577, -0.433, -0.385, +0.048, -0.962, -0.240, -0.769, -0.144 },
                { -0.529, -0.577, -0.048, +0.096, -0.240, -0.481, -0.337, +0.192 },
                { +0.385, +0.048, +0.577, -0.433, +0.769, -0.144, +0.962, -0.240 },
                { -0.048, -0.096, -0.529, +0.577, -0.337, -0.192, -0.240, +0.481 }
            });

            Matrix expectedKes = 1E6 * Matrix.CreateFromArray(new double[, ]
            {
                { +0.962, +0.240, -0.769, +0.337, -0.577, -0.529, +0.385, -0.048 },
                { +0.240, +0.481, +0.144, +0.192, -0.433, -0.577, +0.048, -0.096 },
                { +0.769, +0.337, -0.962, +0.240, -0.385, -0.048, +0.577, -0.529 },
                { +0.144, -0.192, +0.240, -0.481, +0.048, +0.096, -0.433, +0.577 },
                { +0.577, +0.529, -0.385, +0.048, -0.962, -0.240, +0.769, -0.337 },
                { +0.433, +0.577, -0.048, +0.096, -0.240, -0.481, -0.144, -0.192 },
                { +0.385, +0.048, -0.577, +0.529, -0.769, -0.337, +0.962, -0.240 },
                { -0.048, -0.096, +0.433, -0.577, -0.144, +0.192, -0.240, +0.481 }
            });

            Matrix expectedKee = 1E6 * Matrix.CreateFromArray(new double[, ]
            {
                { +1.923, +0.481, +0.000, +0.000, +0.000, +0.000, +0.769, -0.096 },
                { +0.481, +0.962, +0.000, +0.000, +0.000, +0.000, +0.096, -0.192 },
                { +0.000, +0.000, +1.923, -0.481, +0.769, +0.096, +0.000, +0.000 },
                { +0.000, +0.000, -0.481, +0.962, -0.096, -0.192, +0.000, +0.000 },
                { +0.000, +0.000, +0.769, -0.096, +1.923, +0.481, +0.000, +0.000 },
                { +0.000, +0.000, +0.096, -0.192, +0.481, +0.962, +0.000, +0.000 },
                { +0.769, +0.096, +0.000, +0.000, +0.000, +0.000, +1.923, -0.481 },
                { -0.096, -0.192, +0.000, +0.000, +0.000, +0.000, -0.481, +0.962 }
            });

            XContinuumElement2D element = CreateCrackBodyElement();
            Matrix Kss = element.BuildStandardStiffnessMatrix();

            (Matrix Kee1, Matrix Kes) = element.BuildEnrichedStiffnessMatricesLower();
            (Matrix Kee2, Matrix Kse) = element.BuildEnrichedStiffnessMatricesUpper();

            Assert.True(expectedKss.Equals(Kss.DoToAllEntries(round), equalityTolerance));
            Assert.True(expectedKee.Equals(Kee1.DoToAllEntries(round), equalityTolerance));
            Assert.True(expectedKee.Equals(Kee2.DoToAllEntries(round), equalityTolerance));
            Assert.True(expectedKes.Equals(Kes.DoToAllEntries(round), equalityTolerance));
            Assert.True(expectedKse.Equals(Kse.DoToAllEntries(round), equalityTolerance));
        }
        public static void TestStiffnessSubmatricesOfMaterialInterfaceElement()
        {
            double equalityTolerance = 1E-13;
            Matrix expectedKss       = 1E6 * Matrix.CreateFromArray(new double[, ]
            {
                { +0.913, +0.421, -0.577, +0.012, -0.433, -0.349, +0.096, -0.084 },
                { +0.421, +1.034, -0.132, +0.144, -0.373, -0.433, +0.084, -0.745 },
                { -0.577, -0.132, +0.817, -0.300, +0.192, +0.060, -0.433, +0.373 },
                { +0.012, +0.144, -0.300, +0.697, -0.060, -0.409, +0.349, -0.433 },
                { -0.433, -0.373, +0.192, -0.060, +0.817, +0.300, -0.577, +0.132 },
                { -0.349, -0.433, +0.060, -0.409, +0.300, +0.697, -0.012, +0.144 },
                { +0.096, +0.084, -0.433, +0.349, -0.577, -0.012, +0.913, -0.421 },
                { -0.084, -0.745, +0.373, -0.433, +0.132, +0.144, -0.421, +1.034 }
            });

            Matrix expectedKse = 1E6 * Matrix.CreateFromArray(new double[, ]
            {
                { +1.242, +0.080, +1.643, +0.160, +1.723, +2.083, +2.123, +2.484 },
                { +1.122, -2.865, +1.042, -1.462, +2.324, +2.424, +2.724, +3.826 },
                { -2.845, +0.881, -2.925, +0.801, -0.441, -1.122, -0.521, -1.522 },
                { +0.321, -2.744, +0.401, -3.025, -0.881, +2.063, -1.282, +1.783 },
                { -0.521, +1.522, -0.441, +1.122, -2.925, -0.801, -2.845, -0.881 },
                { +1.282, +1.783, +0.881, +2.063, -0.401, -3.025, -0.321, -2.744 },
                { +2.123, -2.484, +1.723, -2.083, +1.643, -0.160, +1.242, -0.080 },
                { -2.724, +3.826, -2.324, +2.424, -1.042, -1.462, -1.122, -2.865 }
            });

            Matrix expectedKes = 1E6 * Matrix.CreateFromArray(new double[, ]
            {
                { +1.242, +1.122, -2.845, +0.321, -0.521, +1.282, +2.123, -2.724 },
                { +0.080, -2.865, +0.881, -2.744, +1.522, +1.783, -2.484, +3.826 },
                { +1.643, +1.042, -2.925, +0.401, -0.441, +0.881, +1.723, -2.324 },
                { +0.160, -1.462, +0.801, -3.025, +1.122, +2.063, -2.083, +2.424 },
                { +1.723, +2.324, -0.441, -0.881, -2.925, -0.401, +1.643, -1.042 },
                { +2.083, +2.424, -1.122, +2.063, -0.801, -3.025, -0.160, -1.462 },
                { +2.123, +2.724, -0.521, -1.282, -2.845, -0.321, +1.242, -1.122 },
                { +2.484, +3.826, -1.522, +1.783, -0.881, -2.744, -0.080, -2.865 }
            });

            Matrix expectedKee = 1E6 * Matrix.CreateFromArray(new double[, ]
            {
                { 95.753, -6.010, 49.279, -3.606, 18.029, -10.817, 38.862, 1.202 },
                { -6.010, 46.675, -8.413, 28.245, -13.221, -9.014, -1.202, -8.213 },
                { 49.279, -8.413, 94.151, -6.010, 40.465, 1.202, 18.029, 13.221 },
                { -3.606, 28.245, -6.010, 41.066, -1.202, -2.604, 10.817, -9.014 },
                { 18.029, -13.221, 40.465, -1.202, 94.151, 6.010, 49.279, 8.413 },
                { -10.817, -9.014, 1.2020, -2.604, 6.010, 41.066, 3.606, 28.245 },
                { 38.862, -1.202, 18.029, 10.817, 49.279, 3.606, 95.753, 6.010 },
                { 1.2020, -8.213, 13.221, -9.014, 8.413, 28.245, 6.010, 46.675 }
            });

            XContinuumElement2D element = CreateMaterialInterfaceElement();
            Matrix Kss = element.BuildStandardStiffnessMatrix();

            (Matrix Kee1, Matrix Kes) = element.BuildEnrichedStiffnessMatricesLower();
            (Matrix Kee2, Matrix Kse) = element.BuildEnrichedStiffnessMatricesUpper();


            Assert.True(expectedKss.Equals(Kss.DoToAllEntries(round), equalityTolerance));
            Assert.True(expectedKee.Equals(Kee1.DoToAllEntries(round), equalityTolerance));
            Assert.True(expectedKee.Equals(Kee2.DoToAllEntries(round), equalityTolerance));
            Assert.True(expectedKes.Equals(Kes.DoToAllEntries(round), equalityTolerance));
            Assert.True(expectedKse.Equals(Kse.DoToAllEntries(round), equalityTolerance));
        }