コード例 #1
0
        /// <summary>
        /// Analyses the stiffness matrix for warnings.
        /// </summary>
        /// <param name="mtx">The MTX.</param>
        /// <param name="map">The map.</param>
        /// <param name="currentCase">The current load case which error is with it.</param>
        /// <remarks>
        /// Only searches for zero elements on matrix diagonal
        /// </remarks>
        private void AnalyseStiffnessMatrixForWarnings(ZoneDevidedMatrix mtx, DofMappingManager map,
                                                       LoadCase currentCase)
        {
            var cs = mtx.ReleasedReleasedPart;

            var n = cs.ColumnCount;

            var t = new bool[n]; //true if i'th diagonal member nonzero, false if diagonal member zero!

            for (var i = 0; i < n; i++)
            {
                var st = cs.ColumnPointers[i];
                var en = cs.ColumnPointers[i + 1];

                var col = i;

                for (var j = st; j < en; j++)
                {
                    var row = cs.RowIndices[j];
                    //var val = cs.Values[j];

                    if (row == col)
                    {
                        t[row] = true;
                    }
                }
            }

            for (var i = 0; i < n; i++)
            {
                if (t[i])
                {
                    continue;
                }

                var globalDofNum = map.RMap1[map.RMap2[i]];

                var nodeNum = globalDofNum / 6;
                var dof     = (DoF)(globalDofNum % 6);

                var rec = TraceRecords.GetRecord(30000, parent.Nodes[nodeNum].Label);

                rec.TargetIdentifier = string.Format(
                    "{0} DoF on node #{1} for load case with [name = '{2}'] and [nature = {3}]", dof, nodeNum,
                    currentCase.CaseName, currentCase.LoadType);

                parent.Trace.Write(rec);
            }
        }
コード例 #2
0
ファイル: CalcUtil.cs プロジェクト: saegeoff/BFE.Net
        /// <summary>
        /// Gets the reduced zone divided matrix.
        /// </summary>
        /// <param name="reducedMatrix">The reduced matrix.</param>
        /// <param name="map">The map.</param>
        /// <returns></returns>
        public static ZoneDevidedMatrix GetReducedZoneDividedMatrix(CCS reducedMatrix, DofMappingManager map)
        {
            var m = map.M;
            var n = map.N;
            var r = reducedMatrix;

            if (r.ColumnCount != r.RowCount || r.RowCount != 6 * m)
            {
                throw new InvalidOperationException();
            }

            var ff = new Coord(map.RMap2.Length, map.RMap2.Length);
            var fs = new Coord(map.RMap2.Length, map.RMap3.Length);
            var sf = new Coord(map.RMap3.Length, map.RMap2.Length);
            var ss = new Coord(map.RMap3.Length, map.RMap3.Length);

            for (var i = 0; i < 6 * m; i++)
            {
                var st = r.ColumnPointers[i];
                var en = r.ColumnPointers[i + 1];

                var col = i;

                for (var j = st; j < en; j++)
                {
                    var row = r.RowIndices[j];
                    var val = r.Values[j];

                    if (map.Fixity[map.RMap1[row]] == DofConstraint.Released &&
                        map.Fixity[map.RMap1[col]] == DofConstraint.Released)
                    {
                        ff.At(map.Map2[row], map.Map2[col], val);
                    }

                    if (map.Fixity[map.RMap1[row]] == DofConstraint.Released &&
                        map.Fixity[map.RMap1[col]] != DofConstraint.Released)
                    {
                        fs.At(map.Map2[row], map.Map3[col], val);
                    }

                    if (map.Fixity[map.RMap1[row]] != DofConstraint.Released &&
                        map.Fixity[map.RMap1[col]] == DofConstraint.Released)
                    {
                        sf.At(map.Map3[row], map.Map2[col], val);
                    }

                    if (map.Fixity[map.RMap1[row]] != DofConstraint.Released &&
                        map.Fixity[map.RMap1[col]] != DofConstraint.Released)
                    {
                        ss.At(map.Map3[row], map.Map3[col], val);
                    }
                }
            }

            var buf = new ZoneDevidedMatrix();

            buf.ReleasedReleasedPart = ff.ToCCs();
            buf.ReleasedFixedPart    = fs.ToCCs();
            buf.FixedReleasedPart    = sf.ToCCs();
            buf.FixedFixedPart       = ss.ToCCs();

            return(buf);
        }