Пример #1
0
        microstructure.MicrostructurePlugIn.destroy(self)

    def matChanged(self, materialname):
        # The given material has changed.  Look through the materials
        # in our Microstructure to see if we care.
        matl = materialmanager.getMaterial(materialname)
        #Interface branch
        ##TODO: Should we look at the material associated with the
        ##edgements instead?
        if config.dimension() == 2 and runtimeflags.surface_mode:
            interfacemsplugin = self.microstructure.getPlugIn("Interfaces")
            interfacemats = interfacemsplugin.getInterfaceMaterials()


#         elif config.dimension() == 3:
        else:
            interfacemats = []

        if matl in material.getMaterials(self.microstructure) or \
               materialname in interfacemats:
            # We *do* care. Really.  Tell all the SubProblems
            # belonging to the microstructure that the material has
            # changed.
            msname = self.microstructure.name()
            subppaths = subproblemcontext.subproblems.keys(base=msname)
            for subppath in subppaths:
                subpctxt = subproblemcontext.subproblems[[msname] + subppath]
                subpctxt.changed("Material properties changed.")

microstructure.registerMicrostructurePlugIn(MaterialMSPlugIn, "Material")
Пример #2
0
    #(2) Bulk materials get deleted
    #(3) Bulk materials get assigned to pixels
    #(4) Renaming an interface material might also trigger a rebuild(?)
    #(5) Pixel groups get destroyed or changed.
    def rebuildMeshes(self):
        meshclass = ooflib.engine.mesh.meshes
        msname = self.microstructure.name()
        for meshkey in meshclass.keys(base=msname):
            mesh = meshclass[[msname] + meshkey]
            mesh.begin_writing()
            try:
                mesh.interfacesChanged() # marks mesh as OutOfSync
            finally:
                mesh.end_writing()

microstructure.registerMicrostructurePlugIn(InterfaceMSPlugIn, "Interfaces")

#######################################################
#Interface definitions.  All interfaces are subclasses of InterfaceDef. 

class InterfaceDef(registeredclass.RegisteredClass):
    registry = []
    tip = "Tools to define interfaces."
    discussion = """<para>
    <classname>InterfaceDef</classname> objects are used by the
    <xref linkend='MenuItem-OOF.Microstructure.Interface.New'/> command
    to define interfaces in a &micro;.
    </para>"""
    def addToMS(self,interfacemsplugin,interfacename):
        interfacemsplugin.addInterface(interfacename,self)
    def check(self):
Пример #3
0
    #(2) Bulk materials get deleted
    #(3) Bulk materials get assigned to pixels
    #(4) Renaming an interface material might also trigger a rebuild(?)
    #(5) Pixel groups get destroyed or changed.
    def rebuildMeshes(self):
        meshclass = ooflib.engine.mesh.meshes
        msname = self.microstructure.name()
        for meshkey in meshclass.keys(base=msname):
            mesh = meshclass[[msname] + meshkey]
            mesh.begin_writing()
            try:
                mesh.interfacesChanged()  # marks mesh as OutOfSync
            finally:
                mesh.end_writing()

microstructure.registerMicrostructurePlugIn(InterfaceMSPlugIn, "Interfaces")

#######################################################
#Interface definitions.  All interfaces are subclasses of InterfaceDef.


class InterfaceDef(registeredclass.RegisteredClass):
    registry = []
    tip = "Tools to define interfaces."
    discussion = """<para>
    <classname>InterfaceDef</classname> objects are used by the
    <xref linkend='MenuItem-OOF.Microstructure.Interface.New'/> command
    to define interfaces in a &micro;.
    </para>"""

    def addToMS(self, interfacemsplugin, interfacename):
Пример #4
0
    def destroy(self):
        switchboard.removeCallback(self.sbcallback)
        microstructure.MicrostructurePlugIn.destroy(self)
    def matChanged(self, materialname):
        # The given material has changed.  Look through the materials
        # in our Microstructure to see if we care.
        matl = materialmanager.getMaterial(materialname)
        #Interface branch
        ##TODO: Should we look at the material associated with the
        ##edgements instead?
        if config.dimension() == 2 and runtimeflags.surface_mode:
            interfacemsplugin=self.microstructure.getPlugIn("Interfaces")
            interfacemats=interfacemsplugin.getInterfaceMaterials()
#         elif config.dimension() == 3:
        else:
            interfacemats = []

        if matl in material.getMaterials(self.microstructure) or \
               materialname in interfacemats:
            # We *do* care. Really.  Tell all the SubProblems
            # belonging to the microstructure that the material has
            # changed.
            msname = self.microstructure.name()
            subppaths = subproblemcontext.subproblems.keys(base=msname)
            for subppath in subppaths:
                subpctxt = subproblemcontext.subproblems[[msname]+subppath]
                subpctxt.changed("Material properties changed.")
                

microstructure.registerMicrostructurePlugIn(MaterialMSPlugIn, "Material")