Пример #1
0
            self.begin_writing()
            try:
                microStructures.remove(self.name())
                ms.destroy()
            finally:
                self.end_writing()
        finally:
            self.cancel_reservation()


## microsctructures is an instance of the WhoClass, which hosts
## a set of MicrostructureContext objects. The MicrostructureContext
## class was subclassed from the Who class, and it contains
## a Microstructure object.
microStructures = whoville.WhoClass('Microstructure',
                                    150,
                                    instanceClass=MicrostructureContext,
                                    proxyClasses=['<topmost>', '<top bitmap>'])


# Handy utility function, returns the microstructure object, not the
# context, and so is not equivalent to microStructures[name].
def getMicrostructure(name):
    try:
        return microStructures[name].getObject()
    except KeyError:
        return None


def getMSContextFromMS(microstructure):
    return microStructures[microstructure.name()]
Пример #2
0
        return data.linsys.static_residual_ind_part('K')

    def compute_jacobian(self, data, nlsolver):
        # debug.fmsg()
        return data.linsys.J_submatrix('K', 'K')

    def compute_linear_coef_mtx(self, data, nlsolver):
        # debug.fmsg()
        return data.linsys.K_submatrix('K', 'K')


#####################################################

subproblems = whoville.WhoClass(
    'SubProblem',
    instanceClass=SubProblemContext,
    ordering=400,
    secret=True,
    parentClass=mesh.meshes)

#####################################################

# SubProblemParameters are used instead of WhoParameters in cases in
# which only the subproblem name, and not its full path, needs to be
# specified.  The associated gui widget lists only the subproblems
# belonging to the mesh that's in the same scope.

# TODO: It would be good to use a variant of the WhoParameter for
# this.  The difficulty with that is that its checker() method would
# have to find the correct Mesh to know which SubProblem names were
# valid.  But for creating compound subproblems, the Mesh is given not
# in the SubProblem constructor arguments, but one level up:
Пример #3
0
# the WhoClass.

from ooflib.common.IO import whoville


class TopBitmap(whoville.WhoProxyClass):
    def resolve(self, proxy, gfxwindow):
        return gfxwindow.topwho('Microstructure', 'Image')

    def getTimeStamp(self, proxy, gfxwindow):
        return gfxwindow.getLayerChangeTimeStamp()


TopBitmap('<top bitmap>')

whoville.WhoClass('Top Bitmap', ordering=20000, proxyClasses=['<top bitmap>'])


def predefinedPixelInfoLayer():
    ##     if config.dimension() == 2:
    return pixelInfoDisplay(color=defaultPixelInfoColor,
                            line_width=defaultLineWidth)


##     if config.dimension() == 3:
##         return pixelInfoDisplay(color=defaultPixelInfoColor,
##                                 opacity=defaultOpacity)

ghostgfxwindow.PredefinedLayer('Top Bitmap', '<top bitmap>',
                               predefinedPixelInfoLayer)