Commit 69b3826f authored by David Thompson's avatar David Thompson
Browse files

WIP: Some arcs.

parent e4929ee1
......@@ -53,7 +53,7 @@ nodeClasses = {
# Generally, point ids are non-exclusive and non-contiguous while
# cell ids are primary for high-dimensional datasets and
# referential for subsets or lower-dimensional boundaries of those datasets.
'smtk::markup::IdAllotment': {
'smtk::markup::AssignedIds': {
'description': 'An API for querying the IDs allotted to a component in an IdSpace.',
'type-aliases': {
'IdType': 'smtk::markup::IdSpace::IdType',
......@@ -72,7 +72,7 @@ nodeClasses = {
],
'methods': {
'range' : {
'signature': 'std::array<IdAllotment::IdType, 2> range() const',
'signature': 'std::array<AssignedIds::IdType, 2> range() const',
'description': 'Returns the range of IDs in the allotment.',
'attributes': [ 'pure virtual' ]
},
......@@ -88,55 +88,24 @@ nodeClasses = {
}
},
'members': {
'idSpace': { 'type': 'std::weak_ptr<smtk::markup::IdSpace>' },
'nature': { 'type': 'IdAllotment::Nature' }
'space': { 'type': 'std::weak_ptr<smtk::markup::IdSpace>' },
'nature': { 'type': 'AssignedIds::Nature' }
}
},
# Grouping components
'smtk::markup::Collection': {
'smtk::markup::Group': {
'description': 'A set of components owned by this collection (i.e., held by shared pointer).',
'members': {
'keys': { 'type': 'std::weak_ptr<smtk::markup::IdAllotment>' },
'members': { 'type': 'std::unordered_map<smtk::markup::IdSpace::IdType, std::weak_ptr<smtk::markup::Component>>' },
'keys': { 'type': 'std::weak_ptr<smtk::markup::AssignedIds>' },
'ownsMembers': { 'type': 'bool', 'description': 'When removing a member arc, should the component be deleted?' },
},
'arcs': {
'members': { 'type': 'Members', 'template': 'Arcs', 'dest-type': 'smtk::markup::Component' },
},
'methods': {
'setMembers': {
'signature': 'bool setMembers(const std::set<std::weak_ptr<smtk::markup::Component>, std::owner_less<std::weak_ptr<smtk::markup::Component>>>& members)',
'description': 'Set the objects held by this collection.',
'body': """
std::unordered_map<smtk::markup::IdSpace::IdType, std::weak_ptr<smtk::markup::Component>> next;
std::unordered_set<smtk::markup::IdSpace::IdType> removed;
auto newEntries = members;
for (const auto& entry : m_members)
{
if (auto member = entry.second.lock())
{
if (members.find(member) != members.end())
{
next[entry.first] = member;
newEntries.erase(member);
}
else
{
removed.insert(entry.first);
}
}
}
std::size_t ii = 0;
for (const auto& member : newEntries)
{
for (; next.find(ii) != next.end(); ++ii)
{ /* do nothing */ }
next[ii] = member.lock();
++ii;
}
m_members = next;
return removed.empty() && newEntries.empty();
"""
},
},
'header-includes': [
'smtk/markup/IdAllotment.h'
'smtk/markup/AssignedIds.h'
],
},
# Organizational components
......@@ -196,21 +165,21 @@ nodeClasses = {
'smtk::markup::Image': {
'description': 'An n-dimensional grid of cells.',
'members': {
'axes': { 'type': 'std::vector<std::weak_ptr<smtk::markup::IdAllotment>>', 'access': 'force-write' },
'points': { 'type': 'std::weak_ptr<smtk::markup::IdAllotment>' },
'cells': { 'type': 'std::weak_ptr<smtk::markup::IdAllotment>' },
'axes': { 'type': 'std::vector<std::weak_ptr<smtk::markup::AssignedIds>>', 'access': 'force-write' },
'points': { 'type': 'std::weak_ptr<smtk::markup::AssignedIds>' },
'cells': { 'type': 'std::weak_ptr<smtk::markup::AssignedIds>' },
'data': { 'type': 'vtkSmartPointer<vtkImageData>' }
},
'header-includes': [ 'smtk/markup/IdAllotment.h', 'vtkSmartPointer.h' ],
'header-includes': [ 'smtk/markup/AssignedIds.h', 'vtkSmartPointer.h' ],
'header-forward-classes': [ 'vtkImageData' ],
},
'smtk::markup::Grid': {
'description': 'A base class for collections of unstructured cells.',
'members': {
'points': { 'type': 'std::weak_ptr<smtk::markup::IdAllotment>' },
'cells': { 'type': 'std::weak_ptr<smtk::markup::IdAllotment>' }
'points': { 'type': 'std::weak_ptr<smtk::markup::AssignedIds>' },
'cells': { 'type': 'std::weak_ptr<smtk::markup::AssignedIds>' }
},
'header-includes': [ 'smtk/markup/IdAllotment.h' ],
'header-includes': [ 'smtk/markup/AssignedIds.h' ],
'smtk::markup::VolumeGrid': {
'description': 'A collection of unstructured, possibly-nonconforming cells of any dimension.',
'members': {
......@@ -236,13 +205,13 @@ nodeClasses = {
# Spatial components
'smtk::markup::Subset': {
'description': 'A subset of an IdSpace. Subsets may represent cell or node subsets. See SideSet for subsets that involve the boundary operator.',
'header-includes': [ 'smtk/markup/IdAllotment.h' ],
'header-includes': [ 'smtk/markup/AssignedIds.h' ],
'type-aliases' : {
'Visitor': 'std::function<smtk::common::Visit(smtk::markup::IdSpace&, smtk::markup::IdSpace::IdType)>'
},
'members': {
'idSpace': {
'type': 'std::weak_ptr<smtk::markup::IdAllotment>',
'ids': {
'type': 'std::weak_ptr<smtk::markup::AssignedIds>',
'description': 'The IdSpace which is being subsetted.'
}
},
......@@ -279,7 +248,7 @@ nodeClasses = {
},
'smtk::markup::SideSet': {
'description': 'An adaptation of subsets for representing subsets of boundaries of spatial data.',
'header-forward-classes': [ 'smtk::markup::IdAllotment' ],
'header-forward-classes': [ 'smtk::markup::AssignedIds' ],
'header-includes': [
'smtk/common/Visit.h',
'smtk/markup/BoundaryOperator.h',
......@@ -299,7 +268,7 @@ nodeClasses = {
{
return result;
}
auto space = allotment->idSpace().lock();
auto space = allotment->space().lock();
for (const auto& side : m_sides)
{
result = visitor(*space, side.first, side.second);
......@@ -314,7 +283,7 @@ nodeClasses = {
}
},
'members': {
'domain': { 'type': 'std::weak_ptr<smtk::markup::IdAllotment>' },
'domain': { 'type': 'std::weak_ptr<smtk::markup::AssignedIds>' },
'boundaryOperator': { 'type': 'std::weak_ptr<smtk::markup::BoundaryOperator>' },
'sides': {
'type': 'std::multimap<smtk::markup::IdSpace::IdType, smtk::markup::IdSpace::IdType>',
......@@ -325,12 +294,12 @@ nodeClasses = {
# Non-spatial components
'smtk::markup::Field': {
'header-includes': [ { 'name': 'string', 'system': True }, ],
'header-forward-classes': [ 'smtk::markup::IdAllotment', 'smtk::markup::Index' ],
'header-forward-classes': [ 'smtk::markup::AssignedIds', 'smtk::markup::Index' ],
'members': {
'name': { 'type': 'std::string' },
'type': { 'type': 'std::string' }, # scalar, vector, tensor, bigfoot
'order': { 'type': 'std::vector<int>' }, # dimension of each tuple
'idSpace': { 'type': 'std::weak_ptr<smtk::markup::IdAllotment>' },
'ids': { 'type': 'std::weak_ptr<smtk::markup::AssignedIds>' },
'index': { 'type': 'std::weak_ptr<smtk::markup::Index>' },
},
'methods': {
......@@ -362,15 +331,20 @@ nodeClasses = {
}
}
arcClasses = {
'smtk::markup::Children<NodeType, bool Hold>': { }, # collections link to members this way. Hold indicates the child may not be deleted while the parent references it.
'smtk::markup::Parents<NodeType>': { }, # members of collections link to each parent collection this way.
'type-aliases': {
'GroupMembers': 'smtk::markup::Children<smtk::markup::Component, true>',
'Groups': 'smtk::markup::Parent<smtk::markup::Group>',
'ReferencesMember': 'smtk::markup::Child<smtk::markup::Component, false>',
'Reference': 'smtk::markup::Parent<smtk::markup::References>',
'smtk::markup::Members' : {
'template': 'Arcs',
'source-type': 'smtk::markup::Group',
'dest-type': 'smtk::markup::Component',
'inverse': 'Groups'
},
'smtk::markup::Groups': {
'template': 'Arcs',
'source-type': 'smtk::markup::Component',
'dest-type': 'smtk::markup::Group',
'inverse': 'Members'
},
# 'type-aliases': {
# },
'smtk::markup::DerivedData': { } # Arc from a 'promoted reference' copy of data to its original data.
}
......@@ -762,7 +736,7 @@ def generate(classList, classType = 'nodes', moduleData = {}, inherit = None):
if inherit is None:
inherit = [] if classType == 'arcs' else ['smtk::graph::Component']
keywords = set(['access', 'attributes', 'body', 'description', 'enums', 'header-includes', 'header-forward-classes', 'members', 'methods', 'protected-methods', 'signature', 'type-aliases'])
keywords = set(['access', 'arcs', 'attributes', 'body', 'description', 'dest-type', 'enums', 'header-includes', 'header-forward-classes', 'inverse', 'members', 'methods', 'protected-methods', 'signature', 'source-type', 'template', 'type-aliases'])
for name in classList.keys():
if name in keywords:
continue
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment