tip='How the initial value is to be interpreted.') ], help="Load a FloatBC initializer. Used internally in data files.", discussion="""<para> Load an initializer for a floating boundary condition from a saved &mesh;. </para>""")) meshmenu.addItem( OOFMenuItem('Initialize_Field', callback=ooflib.engine.IO.meshmenu.initField, params=[ whoville.WhoParameter('mesh', ooflib.engine.mesh.meshes, tip=parameter.emptyTipString), meshparameters.FieldParameter('field', tip=parameter.emptyTipString, outofplane=True), fieldinit.FieldInitParameter('initializer', tip=parameter.emptyTipString) ], help="Initialize a Field. Used internally in Mesh data files.", discussion="""<para> Initialize a &field; on a saved &mesh;. If <link linkend='MenuItem-OOF.LoadData.Mesh.Load_Field'>field data</link> is saved as well, it will overwrite the &fields; from the initializer. </para>""")) def _crossSection(menuitem, mesh, name, cs): meshcontext = ooflib.engine.mesh.meshes[mesh]
return [self.field.name()] names = [] it = self.field.iterator(planarity.ALL_INDICES) while not it.end(): names.append("%s[%s]" % (self.field.name(), it.shortstring())) it.next() return names registeredclass.Registration( "Average Field", MeshBdyAnalyzer, AverageField, ordering=1, params=[ meshparameters.FieldParameter('field', tip=parameter.emptyTipString) ], tip="Average a Field over a boundary.", discussion="<para>Average the given &field; along a boundary.</para>") # def bdyAnalysis(meshcontext, time, boundary, analyzer, destination): # # Do the computation *before* writing the header, because we need # # the OutputVal type of the result to tell us what the columns # # are. # femesh = meshcontext.getObject() # edgeset = femesh.getBoundary(boundary).edgeset # result = analyzer(femesh, edgeset) # # Write header info # destination.comment(analyzer.shortrepr()) # destination.comment("Boundary:", boundary)
while not it.end(): names.append("%s[%s]" % (field.name(), it.shortstring())) it.next() return names FieldOutput = output.Output( name="field", callback=_field, otype=outputval.OutputValPtr, srepr=lambda x: x.resolveAlias('field').value.name(), instancefn=_field_instancefn, column_names=_field_column_names, params=[ meshparameters.FieldParameter("field", outofplane=1, tip=parameter.emptyTipString) ], tip="Compute Field values.", discussion= '<para>Compute the value of the given &field; on a &mesh;.</para>') ## TODO: Add Field and Flux outputs that take their values from some ## *other* Mesh, in order to compute how well solutions are ## converging. Or, possibly, add a DifferenceWithOtherMesh output, ## that computes the same quantities for the minuend and subtrahend, ## but on different Meshes. ############
bdycondition.FloatBCInitMethod, tip='How the initial value is to be interpreted.')], help="Load a FloatBC initializer. Used internally in data files.", discussion="""<para> Load an initializer for a floating boundary condition from a saved &mesh;. </para>""" )) meshmenu.addItem(OOFMenuItem( 'Initialize_Field', callback=ooflib.engine.IO.meshmenu.initField, params=[ whoville.WhoParameter( 'mesh', ooflib.engine.mesh.meshes, tip=parameter.emptyTipString), meshparameters.FieldParameter( 'field', tip=parameter.emptyTipString, outofplane=(config.dimension()==2)), fieldinit.FieldInitParameter( 'initializer', tip=parameter.emptyTipString) ], help="Initialize a Field. Used internally in Mesh data files.", discussion="""<para> Initialize a &field; on a saved &mesh;. If <link linkend='MenuItem-OOF.LoadData.Mesh.Load_Field'>field data</link> is saved as well, it will overwrite the &fields; from the initializer. </para>""")) def _crossSection(menuitem, mesh, name, cs):