Пример #1
0
 public Builder(IFeti1SubdomainMatrixManagerFactory matrixManagerFactory,
                Dictionary <int, double> factorPivotTolerances)
 {
     //TODO: This is a very volatile parameter and the user should not have to specify it.
     this.factorPivotTolerances = factorPivotTolerances;
     this.matrixManagerFactory  = matrixManagerFactory;
 }
Пример #2
0
        private Feti1Solver(IStructuralModel model, IFeti1SubdomainMatrixManagerFactory matrixManagerFactory,
                            IDofOrderer dofOrderer, Dictionary <int, double> factorPivotTolerances,
                            IFetiPreconditionerFactory preconditionerFactory, IFeti1InterfaceProblemSolver interfaceProblemSolver,
                            bool problemIsHomogeneous, bool projectionMatrixQIsIdentity)
        {
            // Model
            if (model.Subdomains.Count == 1)
            {
                throw new InvalidSolverException(
                          $"{name} cannot be used if there is only 1 subdomain");
            }
            this.model = model;

            // Subdomains
            subdomains = new Dictionary <int, ISubdomain>();
            foreach (ISubdomain subdomain in model.Subdomains)
            {
                subdomains[subdomain.ID] = subdomain;
            }

            // Matrix managers and linear systems
            matrixManagers        = new Dictionary <int, IFeti1SubdomainMatrixManager>();
            matrixManagersGeneral = new Dictionary <int, IFetiSubdomainMatrixManager>();
            this.linearSystems    = new Dictionary <int, ISingleSubdomainLinearSystem>();
            var externalLinearSystems = new Dictionary <int, ILinearSystem>();

            foreach (ISubdomain subdomain in model.Subdomains)
            {
                int s             = subdomain.ID;
                var matrixManager = matrixManagerFactory.CreateMatricesManager(subdomain);
                matrixManagers[s]        = matrixManager;
                matrixManagersGeneral[s] = matrixManager;
                this.linearSystems[s]    = matrixManager.LinearSystem;
                externalLinearSystems[s] = matrixManager.LinearSystem;

                //TODO: This will call HandleMatrixWillBeSet() once for each subdomain. For now I will clear the data when
                //      BuildMatrices() is called. Redesign this.
                //matrixManager.LinearSystem.MatrixObservers.Add(this);
            }
            LinearSystems = externalLinearSystems;

            this.dofOrderer            = dofOrderer;
            this.dofSeparator          = new Feti1DofSeparator();
            this.factorPivotTolerances = factorPivotTolerances;
            this.preconditionerFactory = preconditionerFactory;

            // Interface problem
            this.interfaceProblemSolver = interfaceProblemSolver;

            // Homogeneous/heterogeneous problems
            this.problemIsHomogeneous        = problemIsHomogeneous;
            this.projectionMatrixQIsIdentity = projectionMatrixQIsIdentity;
            if (problemIsHomogeneous)
            {
                this.stiffnessDistribution = new HomogeneousStiffnessDistribution(model, dofSeparator);
            }
            else
            {
                this.stiffnessDistribution = new HeterogeneousStiffnessDistribution(model, dofSeparator);
            }
        }