for solventName in solventNamesToMergeInto: soluteNames = [] for c in b: if c.p.mergeWith == solventName: soluteNames.append(c.name) converter = blockConverters.MultipleComponentMerger( b, soluteNames, solventName) b = converter.convert() return b for paramDef in parameters.forType(blocks.Block).inCategory( parameters.Category.assignInBlueprints): setattr( BlockBlueprint, paramDef.name, yamlize.Attribute(name=paramDef.name, default=None), ) def _setBlueprintNumberOfAxialMeshes(meshPoints, factor): """ Set the blueprint number of axial mesh based on the axial mesh refinement factor. """ if factor <= 0: raise ValueError("A positive axial mesh refinement factor " f"must be provided. A value of {factor} is invalid.")
for modName, modList in materialInputs.items(): paramName = "material modifications for {}".format(modName) paramsToCheck[paramName] = modList for paramName, blockVals in paramsToCheck.items(): if len(self.blocks) != len(blockVals): raise ValueError( "Assembly {} had {} blocks, but {} {}. These numbers should be equal. " "Check input for errors.".format( a, len(self.blocks), len(blockVals), paramName ) ) for paramDef in parameters.forType(assemblies.Assembly).inCategory( parameters.Category.assignInBlueprints ): setattr( AssemblyBlueprint, paramDef.name, yamlize.Attribute(name=paramDef.name, default=None), ) class AssemblyKeyedList(yamlize.KeyedList): """ Effectively and OrderedDict of assembly items, keyed on the assembly name. This uses yamlize KeyedList for YAML serialization. """