Ejemplo n.º 1
0
    def LoadRequestedData(self, datadescription):
        """Call this method in RequestDataDescription co-processing pass to mark
           the datadescription with information about what fields and grids are
           required for this pipeline for the given timestep, if any.

           Default implementation uses the update-frequencies set using
           SetUpdateFrequencies() to determine if the current timestep needs to
           be processed and then requests all fields. Subclasses can override
           this method to provide additional customizations. If there is a Live
           connection that can also override the initial frequencies."""

        # if this is a time step to do live then only the channels that were requested when
        # generating the script will be made available even though the adaptor may be able
        # to provide other channels. similarly, if only specific arrays were requested when
        # generating the script then only those arrays will be provided to the Live connection.
        # note that we want the pipeline built before we do the actual first live connection.
        if self.__EnableLiveVisualization and self.NeedToOutput(datadescription, self.__LiveVisualizationFrequency) \
           and self.__LiveVisualizationLink:
            if self.__LiveVisualizationLink.Initialize(
                    servermanager.ActiveConnection.Session.
                    GetSessionProxyManager()):
                if self.__RequestedArrays:
                    for key in self.__RequestedArrays:
                        for v in self.__RequestedArrays[key]:
                            datadescription.GetInputDescriptionByName(
                                key).AddField(v[0], v[1])
                elif self.__InitialFrequencies:
                    # __ProducersMap will not be filled up until after the first call to
                    # DoCoProcessing so we rely on __InitialFrequencies initially but then
                    # __ProducersMap after that as __InitialFrequencies will be cleared out.
                    for key in self.__InitialFrequencies:
                        datadescription.GetInputDescriptionByName(
                            key).AllFieldsOn()
                        datadescription.GetInputDescriptionByName(
                            key).GenerateMeshOn()
                else:
                    for key in self.__ProducersMap:
                        datadescription.GetInputDescriptionByName(
                            key).AllFieldsOn()
                        datadescription.GetInputDescriptionByName(
                            key).GenerateMeshOn()
                return

        # if we haven't processed the pipeline yet in DoCoProcessing() we
        # must use the initial frequencies to figure out if there's
        # work to do this time/timestep. If we don't have Live enabled
        # we know that the output frequencies aren't changed and can
        # just use the initial frequencies.
        if self.__ForceOutputAtFirstCall or self.__InitialFrequencies or not self.__EnableLiveVisualization:
            if self.__RequestedArrays:
                for key in self.__RequestedArrays:
                    for v in self.__RequestedArrays[key]:
                        datadescription.GetInputDescriptionByName(
                            key).AddField(v[0], v[1])
            elif self.__InitialFrequencies:
                for key in self.__InitialFrequencies:
                    freqs = self.__InitialFrequencies.get(key, [])
                    if self.__EnableLiveVisualization or self.IsInModulo(
                            datadescription, freqs):
                        datadescription.GetInputDescriptionByName(
                            key).AllFieldsOn()
                        datadescription.GetInputDescriptionByName(
                            key).GenerateMeshOn()
        else:
            # the catalyst pipeline may have been changed by a Live connection
            # so we need to regenerate the frequencies
            from paraview import cpstate
            frequencies = {}
            for writer in self.__WritersList:
                frequency = writer.parameters.GetProperty(
                    "WriteFrequency").GetElement(0)
                if self.NeedToOutput(
                        datadescription,
                        frequency) or datadescription.GetForceOutput() == True:
                    writerinputs = cpstate.locate_simulation_inputs(writer)
                    for writerinput in writerinputs:
                        if self.__RequestedArrays:
                            for key in self.__RequestedArrays:
                                for v in self.__RequestedArrays[key]:
                                    datadescription.GetInputDescriptionByName(
                                        writerinput).AddField(v[0], v[1])
                        else:
                            datadescription.GetInputDescriptionByName(
                                writerinput).AllFieldsOn()
                            datadescription.GetInputDescriptionByName(
                                writerinput).GenerateMeshOn()

            for view in self.__ViewsList:
                if (view.cpFrequency and self.NeedToOutput(datadescription, view.cpFrequency)) or \
                   datadescription.GetForceOutput() == True:
                    viewinputs = cpstate.locate_simulation_inputs_for_view(
                        view)
                    for viewinput in viewinputs:
                        if self.__RequestedArrays:
                            for key in self.__RequestedArrays:
                                for v in self.__RequestedArrays[key]:
                                    datadescription.GetInputDescriptionByName(
                                        viewinput).AddField(v[0], v[1])
                        else:
                            datadescription.GetInputDescriptionByName(
                                viewinput).AllFieldsOn()
                            datadescription.GetInputDescriptionByName(
                                viewinput).GenerateMeshOn()
Ejemplo n.º 2
0
    def LoadRequestedData(self, datadescription):
        """Call this method in RequestDataDescription co-processing pass to mark
           the datadescription with information about what fields and grids are
           required for this pipeline for the given timestep, if any.

           Default implementation uses the update-frequencies set using
           SetUpdateFrequencies() to determine if the current timestep needs to
           be processed and then requests all fields. Subclasses can override
           this method to provide additional customizations."""

        timestep = datadescription.GetTimeStep()

        # if this is a time step to do live then all of the inputs
        # must be made available. note that we want the pipeline built
        # before we do the actual first live connection.
        if self.__EnableLiveVisualization and self.NeedToOutput(timestep, self.__LiveVisualizationFrequency) \
           and self.__LiveVisualizationLink:
            if self.__LiveVisualizationLink.Initialize(
                    servermanager.ActiveConnection.Session.
                    GetSessionProxyManager()):
                num_inputs = datadescription.GetNumberOfInputDescriptions()
                for cc in range(num_inputs):
                    input_name = datadescription.GetInputDescriptionName(cc)
                    datadescription.GetInputDescription(cc).AllFieldsOn()
                    datadescription.GetInputDescription(cc).GenerateMeshOn()
                return

        # if we haven't processed the pipeline yet in DoCoProcessing() we
        # must use the initial frequencies to figure out if there's
        # work to do this time/timestep. If Live is enabled we mark
        # all inputs as needed (this is only done if the Live connection
        # hasn't been set up yet). If we don't have live enabled
        # we know that the output frequencies aren't changed and can
        # just use the initial frequencies.
        if self.__ForceOutputAtFirstCall or self.__InitialFrequencies or not self.__EnableLiveVisualization:
            num_inputs = datadescription.GetNumberOfInputDescriptions()
            for cc in range(num_inputs):
                input_name = datadescription.GetInputDescriptionName(cc)

                freqs = self.__InitialFrequencies.get(input_name, [])
                if self.__EnableLiveVisualization or (self and self.IsInModulo(
                        timestep, freqs)):
                    datadescription.GetInputDescription(cc).AllFieldsOn()
                    datadescription.GetInputDescription(cc).GenerateMeshOn()
        else:
            # the catalyst pipeline may have been changed by a live connection
            # so we need to regenerate the frequencies
            from paraview import cpstate
            frequencies = {}
            for writer in self.__WritersList:
                frequency = writer.parameters.GetProperty(
                    "WriteFrequency").GetElement(0)
                if self.NeedToOutput(
                        timestep,
                        frequency) or datadescription.GetForceOutput() == True:
                    writerinputs = cpstate.locate_simulation_inputs(writer)
                    for writerinput in writerinputs:
                        datadescription.GetInputDescriptionByName(
                            writerinput).AllFieldsOn()
                        datadescription.GetInputDescriptionByName(
                            writerinput).GenerateMeshOn()

            for view in self.__ViewsList:
                if (view.cpFrequency and self.NeedToOutput(timestep, view.cpFrequency)) or \
                   datadescription.GetForceOutput() == True:
                    viewinputs = cpstate.locate_simulation_inputs_for_view(
                        view)
                    for viewinput in viewinputs:
                        datadescription.GetInputDescriptionByName(
                            viewinput).AllFieldsOn()
                        datadescription.GetInputDescriptionByName(
                            viewinput).GenerateMeshOn()
Ejemplo n.º 3
0
    def LoadRequestedData(self, datadescription):
        """Call this method in RequestDataDescription co-processing pass to mark
           the datadescription with information about what fields and grids are
           required for this pipeline for the given timestep, if any.

           Default implementation uses the update-frequencies set using
           SetUpdateFrequencies() to determine if the current timestep needs to
           be processed and then requests all fields. Subclasses can override
           this method to provide additional customizations."""

        timestep = datadescription.GetTimeStep()

        # if this is a time step to do live then all of the inputs
        # must be made available. note that we want the pipeline built
        # before we do the actual first live connection.
        if self.__EnableLiveVisualization and self.NeedToOutput(timestep, self.__LiveVisualizationFrequency) \
           and self.__LiveVisualizationLink:
            if self.__LiveVisualizationLink.Initialize(servermanager.ActiveConnection.Session.GetSessionProxyManager()):
                num_inputs = datadescription.GetNumberOfInputDescriptions()
                for cc in range(num_inputs):
                    input_name = datadescription.GetInputDescriptionName(cc)
                    datadescription.GetInputDescription(cc).AllFieldsOn()
                    datadescription.GetInputDescription(cc).GenerateMeshOn()
                return

        # if we haven't processed the pipeline yet in DoCoProcessing() we
        # must use the initial frequencies to figure out if there's
        # work to do this time/timestep. If Live is enabled we mark
        # all inputs as needed (this is only done if the Live connection
        # hasn't been set up yet). If we don't have live enabled
        # we know that the output frequencies aren't changed and can
        # just use the initial frequencies.
        if self.__ForceOutputAtFirstCall or self.__InitialFrequencies or not self.__EnableLiveVisualization:
            num_inputs = datadescription.GetNumberOfInputDescriptions()
            for cc in range(num_inputs):
                input_name = datadescription.GetInputDescriptionName(cc)

                freqs = self.__InitialFrequencies.get(input_name, [])
                if self.__EnableLiveVisualization or ( self and self.IsInModulo(timestep, freqs) ):
                        datadescription.GetInputDescription(cc).AllFieldsOn()
                        datadescription.GetInputDescription(cc).GenerateMeshOn()
        else:
            # the catalyst pipeline may have been changed by a live connection
            # so we need to regenerate the frequencies
            from paraview import cpstate
            frequencies = {}
            for writer in self.__WritersList:
                frequency = writer.parameters.GetProperty(
                    "WriteFrequency").GetElement(0)
                if self.NeedToOutput(timestep, frequency) or datadescription.GetForceOutput() == True:
                    writerinputs = cpstate.locate_simulation_inputs(writer)
                    for writerinput in writerinputs:
                        datadescription.GetInputDescriptionByName(writerinput).AllFieldsOn()
                        datadescription.GetInputDescriptionByName(writerinput).GenerateMeshOn()

            for view in self.__ViewsList:
                if (view.cpFrequency and self.NeedToOutput(timestep, view.cpFrequency)) or \
                   datadescription.GetForceOutput() == True:
                    viewinputs = cpstate.locate_simulation_inputs_for_view(view)
                    for viewinput in viewinputs:
                        datadescription.GetInputDescriptionByName(viewinput).AllFieldsOn()
                        datadescription.GetInputDescriptionByName(viewinput).GenerateMeshOn()
Ejemplo n.º 4
0
    def LoadRequestedData(self, datadescription):
        """Call this method in RequestDataDescription co-processing pass to mark
           the datadescription with information about what fields and grids are
           required for this pipeline for the given timestep, if any.

           Default implementation uses the update-frequencies set using
           SetUpdateFrequencies() to determine if the current timestep needs to
           be processed and then requests all fields. Subclasses can override
           this method to provide additional customizations. If there is a Live
           connection that can also override the initial frequencies."""

        # if this is a time step to do live then only the channels that were requested when
        # generating the script will be made available even though the adaptor may be able
        # to provide other channels. similarly, if only specific arrays were requested when
        # generating the script then only those arrays will be provided to the Live connection.
        # note that we want the pipeline built before we do the actual first live connection.
        if self.__EnableLiveVisualization and self.NeedToOutput(datadescription, self.__LiveVisualizationFrequency) \
           and self.__LiveVisualizationLink:
            if self.__LiveVisualizationLink.Initialize(servermanager.ActiveConnection.Session.GetSessionProxyManager()):
                if self.__RequestedArrays:
                    for key in self.__RequestedArrays:
                        for v in self.__RequestedArrays[key]:
                            datadescription.GetInputDescriptionByName(key).AddField(v[0], v[1])
                elif self.__InitialFrequencies:
                    # __ProducersMap will not be filled up until after the first call to
                    # DoCoProcessing so we rely on __InitialFrequencies initially but then
                    # __ProducersMap after that as __InitialFrequencies will be cleared out.
                    for key in self.__InitialFrequencies:
                        datadescription.GetInputDescriptionByName(key).AllFieldsOn()
                        datadescription.GetInputDescriptionByName(key).GenerateMeshOn()
                else:
                    for key in self.__ProducersMap:
                        datadescription.GetInputDescriptionByName(key).AllFieldsOn()
                        datadescription.GetInputDescriptionByName(key).GenerateMeshOn()
                return

        # if we haven't processed the pipeline yet in DoCoProcessing() we
        # must use the initial frequencies to figure out if there's
        # work to do this time/timestep. If we don't have Live enabled
        # we know that the output frequencies aren't changed and can
        # just use the initial frequencies.
        if self.__ForceOutputAtFirstCall or self.__InitialFrequencies or not self.__EnableLiveVisualization:
            if self.__RequestedArrays:
                for key in self.__RequestedArrays:
                    for v in self.__RequestedArrays[key]:
                        datadescription.GetInputDescriptionByName(key).AddField(v[0], v[1])
            elif self.__InitialFrequencies:
                for key in self.__InitialFrequencies:
                    freqs = self.__InitialFrequencies.get(key, [])
                    if self.__EnableLiveVisualization or self.IsInModulo(datadescription, freqs):
                        datadescription.GetInputDescriptionByName(key).AllFieldsOn()
                        datadescription.GetInputDescriptionByName(key).GenerateMeshOn()
        else:
            # the catalyst pipeline may have been changed by a Live connection
            # so we need to regenerate the frequencies
            from paraview import cpstate
            frequencies = {}
            for writer in self.__WritersList:
                frequency = writer.parameters.GetProperty("WriteFrequency").GetElement(0)
                if self.NeedToOutput(datadescription, frequency) or datadescription.GetForceOutput() == True:
                    writerinputs = cpstate.locate_simulation_inputs(writer)
                    for writerinput in writerinputs:
                        if self.__RequestedArrays:
                            for key in self.__RequestedArrays:
                                for v in self.__RequestedArrays[key]:
                                    datadescription.GetInputDescriptionByName(writerinput).AddField(v[0], v[1])
                        else:
                            datadescription.GetInputDescriptionByName(writerinput).AllFieldsOn()
                            datadescription.GetInputDescriptionByName(writerinput).GenerateMeshOn()

            for view in self.__ViewsList:
                if (view.cpFrequency and self.NeedToOutput(datadescription, view.cpFrequency)) or \
                   datadescription.GetForceOutput() == True:
                    viewinputs = cpstate.locate_simulation_inputs_for_view(view)
                    for viewinput in viewinputs:
                        if self.__RequestedArrays:
                            for key in self.__RequestedArrays:
                                for v in self.__RequestedArrays[key]:
                                    datadescription.GetInputDescriptionByName(viewinput).AddField(v[0], v[1])
                        else:
                            datadescription.GetInputDescriptionByName(viewinput).AllFieldsOn()
                            datadescription.GetInputDescriptionByName(viewinput).GenerateMeshOn()