# assign inputs
_numOfCpus_ = IN[0]
decomposeParDict = None

try:
    from butterfly.decomposeParDict import DecomposeParDict
except ImportError as e:
    msg = '\nFailed to import butterfly. Did you install butterfly on your machine?' + \
            '\nYou can download butterfly from package manager.' + \
            '\nOpen an issue on github if you think this is a bug:' + \
            ' https://github.com/ladybug-analysis-tools/butterfly/issues'
        
    raise ImportError('{}\n{}'.format(msg, e))


try:
    numberOfSubdomains = int(_numOfCpus_)
except:
    numberOfSubdomains = 2

decomposeParDict = DecomposeParDict.scotch(numberOfSubdomains)

# assign outputs to OUT
OUT = (decomposeParDict,)
Example #2
0
Simple decomposeParDict. Dictionary for parallel runs.

-

    Args:
        _XYZDiv_: Number of subdomains in x, y, z as a list (default: (2, 1, 1)).
        _delta_: Cell skew factor (default: 0.001).
    Returns:
        decomposeParDict: decomposeParDict.
"""

ghenv.Component.Name = "Butterfly_decomposeParDict simple"
ghenv.Component.NickName = "decomposeParDict_simple"
ghenv.Component.Message = 'VER 0.0.04\nMAR_14_2017'
ghenv.Component.Category = "Butterfly"
ghenv.Component.SubCategory = "08::Etc"
ghenv.Component.AdditionalHelpFromDocStrings = "2"

try:
    from butterfly.decomposeParDict import DecomposeParDict
except ImportError as e:
    msg = '\nFailed to import butterfly:'
    raise ImportError('{}\n{}'.format(msg, e))

try:
    x, y, z = _XYZDiv_
except:
    x, y, z = 2, 1, 1

decomposeParDict = DecomposeParDict.simple((x, y, z), _delta_)
Example #3
0
    ghenv.Component.Params.Input[index].Description = description
    ghenv.Component.Params.OnParametersChanged()


if not _mode_:
    modifyComponentInput(index=1,
                         name='_numOfCpus_',
                         nickName='_numOfCpus_',
                         description='Number of CPUs (default: 2).')
    modifyComponentInput(index=2, name='.', nickName='.', description='.')
    try:
        numberOfSubdomains = _numOfCpus_[0]
    except:
        numberOfSubdomains = 2

    decomposeParDict = DecomposeParDict.scotch(numberOfSubdomains)
else:
    modifyComponentInput(
        index=1,
        name='_XYZDiv_',
        nickName='_XYZDiv_',
        description=
        'Number of subdomains in x, y, z as a list. default: (2, 1, 1)')
    modifyComponentInput(index=2,
                         name='_delta_',
                         nickName='_delta_',
                         description='Cell skew factor (default: 0.001).')

    try:
        x, y, z = _XYZDiv_
    except:
    raise ImportError('{}\n{}'.format(msg, e))

def modifyComponentInput(index, name, nickName, description):
    """Modify input parameter of the component."""
    ghenv.Component.Params.Input[index].Name = name
    ghenv.Component.Params.Input[index].NickName = nickName
    ghenv.Component.Params.Input[index].Description = description
    ghenv.Component.Params.OnParametersChanged()

if not _mode_:
    modifyComponentInput(index=1, name='_numOfCpus_', nickName='_numOfCpus_',
                         description='Number of CPUs (default: 2).')
    modifyComponentInput(index=2, name='.', nickName='.', description='.')
    try:
        numberOfSubdomains = _numOfCpus_[0]
    except:
        numberOfSubdomains = 2
 
    decomposeParDict = DecomposeParDict.scotch(numberOfSubdomains)
else:
    modifyComponentInput(index=1, name='_XYZDiv_', nickName='_XYZDiv_',
        description='Number of subdomains in x, y, z as a list. default: (2, 1, 1)')
    modifyComponentInput(index=2, name='_delta_', nickName='_delta_',
                     description='Cell skew factor (default: 0.001).')
    
    try:
        x, y, z = _XYZDiv_
    except:
        x, y, z = 2, 1, 1
    
    decomposeParDict = DecomposeParDict.simple((x, y, z), _delta_)