public void AddSubdomain(XSubdomain2D_old subdomain) { //TODO: all entities should have a builder that uses sets, etc to make sure other entities are unique, etc and the //main collection that will be used by solvers, which must use sorted and efficient collections. if (subdomains.Contains(subdomain)) { throw new ArgumentException( $"A subdomain with id = {subdomain.ID} already exists."); //TODO: Write a DuplicateEntryException for entities. } subdomains.Add(subdomain); }
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); }