Ejemplo n.º 1
0
 def setMarkerGroup(self, markerGroup: Field):
     self._markerGroup = None
     self._markerGroupName = None
     self._markerNodeGroup = None
     self._markerLocationField = None
     self._markerCoordinatesField = None
     self._markerNameField = None
     self._markerDataGroup = None
     self._markerDataCoordinatesField = None
     self._markerDataNameField = None
     self._markerDataLocationField = None
     self._markerDataLocationCoordinatesField = None
     self._markerDataDeltaField = None
     self._markerDataLocationGroupField = None
     self._markerDataLocationGroup = None
     if not markerGroup:
         return
     fieldGroup = markerGroup.castGroup()
     assert fieldGroup.isValid()
     self._markerGroup = fieldGroup
     self._markerGroupName = markerGroup.getName()
     nodes = self._fieldmodule.findNodesetByFieldDomainType(
         Field.DOMAIN_TYPE_NODES)
     self._markerNodeGroup = self._markerGroup.getFieldNodeGroup(
         nodes).getNodesetGroup()
     if self._markerNodeGroup.isValid():
         node = self._markerNodeGroup.createNodeiterator().next()
         if node.isValid():
             fieldcache = self._fieldmodule.createFieldcache()
             fieldcache.setNode(node)
             fielditer = self._fieldmodule.createFielditerator()
             field = fielditer.next()
             while field.isValid():
                 if field.isDefinedAtLocation(fieldcache):
                     if (not self._markerLocationField
                         ) and field.castStoredMeshLocation().isValid():
                         self._markerLocationField = field
                     elif (not self._markerNameField) and (
                             field.getValueType()
                             == Field.VALUE_TYPE_STRING):
                         self._markerNameField = field
                 field = fielditer.next()
             self._updateMarkerCoordinatesField()
     else:
         self._markerNodeGroup = None
     datapoints = self._fieldmodule.findNodesetByFieldDomainType(
         Field.DOMAIN_TYPE_DATAPOINTS)
     self._markerDataGroup = self._markerGroup.getFieldNodeGroup(
         datapoints).getNodesetGroup()
     if self._markerDataGroup.isValid():
         datapoint = self._markerDataGroup.createNodeiterator().next()
         if datapoint.isValid():
             fieldcache = self._fieldmodule.createFieldcache()
             fieldcache.setNode(datapoint)
             fielditer = self._fieldmodule.createFielditerator()
             field = fielditer.next()
             while field.isValid():
                 if field.isDefinedAtLocation(fieldcache):
                     if (not self._markerDataCoordinatesField) and field.isTypeCoordinate() and \
                             (field.getNumberOfComponents() == 3) and (field.castFiniteElement().isValid()):
                         self._markerDataCoordinatesField = field
                     elif (not self._markerDataNameField) and (
                             field.getValueType()
                             == Field.VALUE_TYPE_STRING):
                         self._markerDataNameField = field
                 field = fielditer.next()
     else:
         self._markerDataGroup = None
     self._calculateMarkerDataLocations()
Ejemplo n.º 2
0
def field_is_managed_group(field_in: Field):
    """
    Conditional function returning True if the field is a managed Group.
    """
    return field_in.castGroup().isValid() and field_in.isManaged()