Beispiel #1
0
    def __call__(self, skelcontext, name):
        skelobj = skelcontext.getObject()
        seg_list = segments_from_el_aggregate(skelcontext, self.group)
        (startnode, seg_list) = _segset2seglist(seg_list, self.direction,
                                                skelobj)
        skelcontext.createEdgeBoundary(name, seg_list, startnode)


registeredclass.TwoDOnlyRegistration(
    "Edge boundary from elements",
    BoundaryConstructor,
    EdgeFromElements,
    ordering=_edgeBdyConstructor + _elemBdySource,
    params=[
        skeletongroupparams.ElementAggregateParameter(
            'group', tip="Construct the boundary from these elements"),
        director.DirectorParameter('direction', tip="Direction of Boundary.")
    ],
    tip="Construct an edge boundary around a set of elements.",
    discussion=xmlmenudump.loadFile(
        'DISCUSSIONS/engine/reg/edge_from_elements.xml'))

# ## ### #### ##### ###### ####### ######## ####### ###### ##### #### ### ## #


def segments_from_face_aggregate(skelcontext, group):
    faces = skelcontext.faces_from_face_aggregate(group)
    ## TODO OPT: If cskeletonsegment.sequenceSegments() could accept a set
    ## as well as a list, we wouldn't have to convert the set returned
    ## by exteriorSegmentsOfFaceSet to a list here.
    return list(skelcontext.exteriorSegmentsOfFaceSet(faces))
Beispiel #2
0
    def contains(self, pt):
        skelel = self.skeleton.enclosingElement(pt)
        if self.elements == placeholder.selection:
            return skelel.isSelected()
        return self.elements in skelel.groups
            
                
    def get_elements(self):
        return self._elements_from_aggregate()

registeredclass.Registration(
    'Element Group',
    Domain,
    ElementGroup,
    30,
    params=[skeletongroupparams.ElementAggregateParameter('elements',
                                                          tip='Elements to sample.')],
    sample_types=[analysissample.GRID, analysissample.ELEMENT],
    tip='Use an element group as the post-processing domain.',
    discussion=xmlmenudump.loadFile('DISCUSSIONS/engine/reg/element_group_domain.xml')
    )

#=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=#

class SinglePoint(Domain):
    def __init__(self, point):
        self.point = point
    def get_points(self):
        return [self.point]

registeredclass.Registration(
    'Single Point',
Beispiel #3
0
        def __call__(self, skelcontext, name):
            skelobj = skelcontext.getObject()

            seg_list = segments_from_el_aggregate(skelcontext, self.group)

            (startnode, seg_list) = _segset2seglist(seg_list, self.direction, skelobj)

            skelcontext.createEdgeBoundary(name, seg_list, startnode)


    registeredclass.Registration(
        "Edge boundary from elements",
        BoundaryConstructor,
        EdgeFromElements,
        ordering=101,
        params = [skeletongroupparams.ElementAggregateParameter('group',
                               tip="Construct the boundary from these elements"),
                  director.DirectorParameter('direction',
                                             director.Director('Clockwise'),
                                             tip="Direction of Boundary.")],
        tip="Construct an edge boundary around a set of elements.",
        discussion=xmlmenudump.loadFile('DISCUSSIONS/engine/reg/edge_from_elements.xml'))


# ## ### #### ##### ###### ####### ######## ####### ###### ##### #### ### ## #


# Stateful object for keeping track of where you are in the
# path-construction process.  Maintains a list of segments-or-None,
# and a dictionary, indexed by nodes, of pointers into this list.
# "None" in the list means that the segment in question has already
# been used in the current path.