Пример #1
0
    def loadVector(self, plot_block_data, fs, report_step, realization_number):
        """
        @type plot_block_data: PlotBlockData
        @type fs: EnkfFs
        @type report_step: int
        @type realization_number: int
        @rtype PlotBlockVector
        """
        config_node = self.__obs_vector.getConfigNode()

        is_private_container = (
            config_node.getImplementationType() == ErtImplType.CONTAINER)
        data_node = EnkfNode(config_node, private=is_private_container)

        node_id = NodeId(report_step, realization_number)

        if data_node.tryLoad(fs, node_id):
            block_obs = self.getBlockObservation(report_step)

            data = DoubleVector()
            for index in range(len(block_obs)):
                value = block_obs.getData(data_node.valuePointer(), index,
                                          node_id)
                data.append(value)
            data.permute(self.__permutation_vector)

            plot_block_vector = PlotBlockVector(realization_number, data)
            plot_block_data.addPlotBlockVector(plot_block_vector)
Пример #2
0
    def test_permutation_vector(self):
        vector = DoubleVector()

        for i in range(5, 0, -1):
            vector.append(i)

        permutation_vector = vector.permutationSort()

        for index, value in enumerate(range(5, 0, -1)):
            self.assertEqual(vector[index], value)

        vector.permute(permutation_vector)

        for index, value in enumerate(range(1, 6)):
            self.assertEqual(vector[index], value)
Пример #3
0
    def test_permutation_vector(self):
        vector = DoubleVector()

        for i in range(5, 0, -1):
            vector.append(i)

        permutation_vector = vector.permutationSort()

        for index, value in enumerate(range(5, 0, -1)):
            self.assertEqual(vector[index], value)

        vector.permute(permutation_vector)

        for index, value in enumerate(range(1, 6)):
            self.assertEqual(vector[index], value)