Exemplo n.º 1
0
# @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+>
"""
Solution Parameter.

    Args:
        _filename: OpenFOAM filename that the values are belong to (e.g.
            blockMeshDict, fvSchemes).
        _values: new values as a valid OpenFOAM (c++) dictionary.
        replace_: Set to True if you want the original dictionary to be replaced
            by new values. Default is False which means the original dictionary
            will be only updated by new values.
    Returns:
        solutionParam: A solution parameter.
"""
ghenv.Component.Name = "Butterfly_Solution Parameter"
ghenv.Component.NickName = "solutionParam"
ghenv.Component.Message = 'VER 0.0.04\nMAR_14_2017'
ghenv.Component.Category = "Butterfly"
ghenv.Component.SubCategory = "06::Solution"
ghenv.Component.AdditionalHelpFromDocStrings = "2"

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

if _filename and _values:
    solutionParam = SolutionParameter.fromCppDictionary(
        _filename, _values, replace_, tRange_)
Exemplo n.º 2
0
        residualControl_: residualControl.
        probes_: probes.
        additionalParams_: List of solution parameters. Use solutionParameter
            component to create solutionParams.
    Returns:
        solutionParams: A list of solution parameters.
"""
ghenv.Component.Name = "Butterfly_Solution Parameters"
ghenv.Component.NickName = "solutionParams"
ghenv.Component.Message = 'VER 0.0.04\nMAR_14_2017'
ghenv.Component.Category = "Butterfly"
ghenv.Component.SubCategory = "06::Solution"
ghenv.Component.AdditionalHelpFromDocStrings = "1"

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

if controlDict_:
    controlDict_ = SolutionParameter.fromCppDictionary('controlDict',
                                                       str(controlDict_))

if probes_:
    probes_ = SolutionParameter.fromCppDictionary('probes', str(probes_))

params = [controlDict_, probes_] + additionalParams_

solutionParams = (p for p in params if p)
            blockMeshDict, fvSchemes).
        _values: new values as a valid OpenFOAM (c++) dictionary.
        replace_: Set to True if you want the original dictionary to be replaced
            by new values. Default is False which means the original dictionary
            will be only updated by new values.
    Returns:
        solutionParam: A solution parameter.
"""
ghenv.Component.Name = "Butterfly_Solution Parameter"
ghenv.Component.NickName = "solutionParam"
ghenv.Component.Message = "VER 0.0.03\nOCT_30_2016"
ghenv.Component.Category = "Butterfly"
ghenv.Component.SubCategory = "06::Solution"
ghenv.Component.AdditionalHelpFromDocStrings = "2"

try:
    from butterfly.solution import SolutionParameter
except ImportError as e:
    msg = (
        "\nFailed to import butterfly. Did you install butterfly on your machine?"
        + "\nYou can download the installer file from github: "
        + "https://github.com/mostaphaRoudsari/Butterfly/tree/master/plugin/grasshopper/samplefiles"
        + "\nOpen an issue on github if you think this is a bug:"
        + " https://github.com/mostaphaRoudsari/Butterfly/issues"
    )

    raise ImportError("{}\n{}".format(msg, e))

if _filename and _values:
    solutionParam = SolutionParameter.fromCppDictionary(_filename, _values, replace_, tRange_)
        solutionParams: A list of solution parameters.
"""
ghenv.Component.Name = "Butterfly_Solution Parameters"
ghenv.Component.NickName = "solutionParams"
ghenv.Component.Message = 'VER 0.0.03\nOCT_30_2016'
ghenv.Component.Category = "Butterfly"
ghenv.Component.SubCategory = "06::Solution"
ghenv.Component.AdditionalHelpFromDocStrings = "1"

try:
     from butterfly.solution import SolutionParameter
except ImportError as e:
    msg = '\nFailed to import butterfly. Did you install butterfly on your machine?' + \
            '\nYou can download the installer file from github: ' + \
            'https://github.com/mostaphaRoudsari/Butterfly/tree/master/plugin/grasshopper/samplefiles' + \
            '\nOpen an issue on github if you think this is a bug:' + \
            ' https://github.com/mostaphaRoudsari/Butterfly/issues'
        
    raise ImportError('{}\n{}'.format(msg, e))

if controlDict_:
    controlDict_ = SolutionParameter.fromCppDictionary('controlDict', controlDict_)

if probes_:
    probes_ = SolutionParameter.fromCppDictionary('probes', probes_)


params = [controlDict_, probes_] + additionalParams_

solutionParams = (p for p in params if p)