How to use the ecl.util.util.IntVector function in ecl

To help you get started, we’ve selected a few ecl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github equinor / libecl / python / ecl / grid / ecl_region.py View on Github external
def kw_index_list(self , ecl_kw , force_active):
        c_ptr = self._get_kw_index_list( ecl_kw , force_active)
        index_list = IntVector.createCReference( c_ptr, self )
        return index_list
github OPM / ResInsight / ThirdParty / Ert / python / ecl / summary / ecl_sum.py View on Github external
def report_index_list(self):
        """
        Internal function for working with report_steps.
        """
        first_report = self.first_report
        last_report  = self.last_report
        index_list = IntVector()
        for report_step in range(first_report, last_report + 1):
            time_index = self._get_report_end(report_step)
            index_list.append(time_index)
        return index_list
github equinor / libecl / python / ecl / grid / ecl_grid_generator.py View on Github external
def create_rectangular(cls, dims, dV, actnum=None):
        """
        Will create a new rectangular grid. @dims = (nx,ny,nz)  @dVg = (dx,dy,dz)

        With the default value @actnum == None all cells will be active,
        """
        if actnum is None:
            ecl_grid = cls._alloc_rectangular(
                                     dims[0], dims[1], dims[2],
                                     dV[0], dV[1], dV[2],
                                     None
                                     )
        else:
            if not isinstance(actnum, IntVector):
                tmp = IntVector(initial_size=len(actnum))
                for (index, value) in enumerate(actnum):
                    tmp[index] = value
                actnum = tmp

            if not len(actnum) == dims[0]*dims[1]*dims[2]:
                raise ValueError(
                        "ACTNUM size mismatch: len(ACTNUM):%d  Expected:%d"
                        % (len(actnum), dims[0]*dims[1]*dims[2])
                        )

            ecl_grid = cls._alloc_rectangular(
                                 dims[0], dims[1], dims[2],
                                 dV[0], dV[1], dV[2],
                                 actnum.getDataPtr()
                                 )
github equinor / libecl / python / ecl / grid / faults / layer.py View on Github external
def cells_equal(self, value):
        """
        Will return a list [(i1,j1),(i2,j2), ...(in,jn)] of all cells with value @value.
        """
        i_list = IntVector()
        j_list = IntVector()
        self._cells_equal(value, i_list, j_list)
        ij_list= []
        for (i,j) in zip(i_list, j_list):
            ij_list.append((i,j))
        return ij_list
github OPM / ResInsight / ThirdParty / Ert / python / ecl / grid / ecl_grid.py View on Github external
def exportACTNUM(self):
        actnum = IntVector(initial_size=self.getGlobalSize())
        self._init_actnum(actnum.getDataPtr())
        return actnum
github equinor / libecl / python / ecl / grid / faults / layer.py View on Github external
def cells_equal(self, value):
        """
        Will return a list [(i1,j1),(i2,j2), ...(in,jn)] of all cells with value @value.
        """
        i_list = IntVector()
        j_list = IntVector()
        self._cells_equal(value, i_list, j_list)
        ij_list= []
        for (i,j) in zip(i_list, j_list):
            ij_list.append((i,j))
        return ij_list
github equinor / libecl / python / ecl / grid / faults / fault_block.py View on Github external
def get_neighbours(self, polylines=None, connected_only=True):
        """
        Will return a list of FaultBlock instances which are in direct
        contact with this block.
        """
        neighbour_id_list = IntVector()
        if polylines is None:
            polylines = CPolylineCollection()

        self._get_neighbours(connected_only, polylines, neighbour_id_list)

        parent_layer = self.getParentLayer()
        neighbour_list = []
        for id in neighbour_id_list:
            neighbour_list.append(parent_layer.getBlock(id))
        return neighbour_list
github equinor / libecl / python / ecl / grid / ecl_grid.py View on Github external
def exportACTNUM(self):
        actnum = IntVector(initial_size=self.getGlobalSize())
        self._init_actnum(actnum.getDataPtr())
        return actnum
github equinor / libecl / python / ecl / grid / ecl_grid.py View on Github external
def create_rectangular(cls, dims, dV, actnum=None):
        """
        Will create a new rectangular grid. @dims = (nx,ny,nz)  @dVg = (dx,dy,dz)

        With the default value @actnum == None all cells will be active,
        """

        warnings.warn("EclGrid.createRectangular is deprecated. " +
                "Please used the similar method in EclGridGenerator!",
                DeprecationWarning)

        if actnum is None:
            ecl_grid = cls._alloc_rectangular(dims[0], dims[1], dims[2], dV[0], dV[1], dV[2], None)
        else:
            if not isinstance(actnum, IntVector):
                tmp = IntVector(initial_size=len(actnum))
                for (index, value) in enumerate(actnum):
                    tmp[index] = value
                actnum = tmp

            if not len(actnum) == dims[0] * dims[1] * dims[2]:
                raise ValueError("ACTNUM size mismatch: len(ACTNUM):%d  Expected:%d" % (len(actnum), dims[0] * dims[1] * dims[2]))
            ecl_grid = cls._alloc_rectangular(dims[0], dims[1], dims[2], dV[0], dV[1], dV[2], actnum.getDataPtr())

        # If we have not succeeded in creatin the grid we *assume* the
        # error is due to a failed malloc.
        if ecl_grid is None:
            raise MemoryError("Failed to allocated regualar grid")

        return ecl_grid