Builds the global stiffness matrix by summing all the individual finite element stiffness matrices
Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LinearSolver" /> class.
        /// </summary>
        /// <param name="modelToSolve">The model on which to run the analysis</param>
        /// <param name="stiffnessMatrixBuilder">The class which generates the stiffness matrices for solving.</param>
        public LinearSolver(FiniteElementModel modelToSolve, GlobalModelStiffnessMatrixBuilder stiffnessMatrixBuilder)
        {
            Guard.AgainstNullArgument(modelToSolve, "modelToSolve");
            Guard.AgainstNullArgument(stiffnessMatrixBuilder, "stiffnessMatrixBuilder");

            this.model = modelToSolve;
            this.matrixBuilder = stiffnessMatrixBuilder;
        }
        public void Setup()
        {
            mocks = new MockRepository();

            node1 = mocks.StrictMock<IFiniteElementNode>();
            node2 = mocks.StrictMock<IFiniteElementNode>();
            node3 = mocks.StrictMock<IFiniteElementNode>();

            spring1 = mocks.StrictMock<IFiniteElement>();
            spring2 = mocks.StrictMock<IFiniteElement>();

            spring1Calculator = mocks.StrictMock<IElementStiffnessCalculator>();
            spring2Calculator = mocks.StrictMock<IElementStiffnessCalculator>();

            constraintProvider = mocks.StrictMock<IModelConstraintProvider>();

            topologyQueryable = mocks.StrictMock<ITopologyQueryable>();

            elementStiffnessMatrixBuilderFactory = mocks.StrictMock<IElementStiffnessMatrixBuilderFactory>();

            Expect.Call(elementStiffnessMatrixBuilderFactory.Create(spring1))
                .Return(spring1Calculator);
            Expect.Call(elementStiffnessMatrixBuilderFactory.Create(spring2))
                .Return(spring2Calculator);

            SUT = new GlobalModelStiffnessMatrixBuilder(topologyQueryable, constraintProvider, elementStiffnessMatrixBuilderFactory);
        }