public ContinuityEquations Build(EquationOrder order)
            {
                var nodes = new List <XNode>();
                var dofs  = new List <EnrichedDof>();
                var positiveSubdomains = new List <XSubdomain2D_old>();
                var negativeSubdomains = new List <XSubdomain2D_old>();

                if (order == EquationOrder.DofMajor)
                {
                    foreach (var nodeData in data)
                    {
                        XNode node = nodeData.Key;
                        foreach (var dofData in nodeData.Value)
                        {
                            EnrichedDof dof = dofData.Key;
                            if (dofData.Value.Count > 1) // There must be >= 2 subdomains, in order to enforce continuity
                            {
                                XSubdomain2D_old[] subdomains = dofData.Value.ToArray();
                                for (int i = 0; i < subdomains.Length - 1; ++i)
                                {
                                    nodes.Add(node);
                                    dofs.Add(dof);
                                    positiveSubdomains.Add(subdomains[i]);
                                    negativeSubdomains.Add(subdomains[i + 1]);
                                }
                            }
                        }
                    }
                    return(new ContinuityEquations(nodes.Count, nodes, dofs, positiveSubdomains, negativeSubdomains));
                }
                else
                {
                    throw new NotImplementedException();
                }
            }
            public void Register(XNode node, EnrichedDof dof, XSubdomain2D_old subdomain)
            {
                bool nodeExists = data.TryGetValue(node, out Dictionary <EnrichedDof, SortedSet <XSubdomain2D_old> > nodeData);

                if (!nodeExists)
                {
                    nodeData = new Dictionary <EnrichedDof, SortedSet <XSubdomain2D_old> >();
                    data.Add(node, nodeData);
                }

                bool dofExists = nodeData.TryGetValue(dof, out SortedSet <XSubdomain2D_old> subdomains);

                if (!dofExists)
                {
                    subdomains = new SortedSet <XSubdomain2D_old>();
                    nodeData.Add(dof, subdomains);
                }

                subdomains.Add(subdomain);
            }
Exemple #3
0
 public int GetEnrichedDofOf(XNode node, EnrichedDof dofType)
 {
     return(enrichedDofs[node, dofType]);
 }
 public int GetEnrichedDofOf(XNode node, EnrichedDof dofType)
 {
     throw new InvalidOperationException("This method does not make sense for this dofOrderer. Refactor them.");
 }
Exemple #5
0
 public int GetSubdomainEnrichedDofOf(XNode node, EnrichedDof dofType)
 {
     return(subdomainEnrichedDofs[node, dofType]);
 }
Exemple #6
0
 //
 public int GetGlobalEnrichedDofOf(XNode node, EnrichedDof dofType)
 {
     return(FirstGlobalDofIndex + subdomainEnrichedDofs[node, dofType]);
 }