示例#1
0
        private FetiDPSolver(IModel model, ICornerNodeSelection cornerNodeSelection,
                             IFetiDPSubdomainMatrixManagerFactory matrixManagerFactory, IDofOrderer dofOrderer,
                             IFetiPreconditionerFactory preconditionerFactory, bool problemIsHomogeneous,
                             IFetiDPInterfaceProblemSolver interfaceProblemSolver)
        {
            // Model
            if (model.Subdomains.Count == 1)
            {
                throw new InvalidSolverException(
                          $"{name} cannot be used if there is only 1 subdomain");
            }
            this.model = model;
            this.cornerNodeSelection = cornerNodeSelection;

            // 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, IFetiDPSubdomainMatrixManager>();
            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 FetiDPDofSeparator();
            this.preconditionerFactory = preconditionerFactory;

            // Interface problem
            this.coarseProblemSolver    = matrixManagerFactory.CreateCoarseProblemSolver(model.Subdomains);
            this.interfaceProblemSolver = interfaceProblemSolver;

            // Homogeneous/heterogeneous problems
            this.problemIsHomogeneous = problemIsHomogeneous;
            if (problemIsHomogeneous)
            {
                this.stiffnessDistribution = new HomogeneousStiffnessDistribution(model, dofSeparator);
            }
            else
            {
                this.stiffnessDistribution = new HeterogeneousStiffnessDistribution(model, dofSeparator);
            }
        }
示例#2
0
 public Builder(ICornerNodeSelection cornerNodeSelection,
                IFetiDPSubdomainMatrixManagerFactory matrixManagerFactory)
 {
     this.cornerNodeSelection  = cornerNodeSelection;
     this.matrixManagerFactory = matrixManagerFactory;
 }