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

To help you get started, we’ve selected a few ert 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 Ensembles / ert / devel / python / python / ert / ecl / faults / layer.py View on Github external
def cellsEqual(self , value):
        """
        Will return a list [(i1,j1),(i2,j2) , ...(in,jn)] of all cells with value @value.
        """
        i_list = IntVector()
        j_list = IntVector()
        Layer.cNamespace().cells_equal( self , 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 / devel / python / python / ert / ecl / 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 OPM / ResInsight / ThirdParty / Ert / devel / python / python / ert / ecl / ecl_grid.py View on Github external
def exportACTNUM(self):
        actnum = IntVector( initial_size = self.getGlobalSize() )
        self._init_actnum( actnum.getDataPtr() )
        return actnum
github OPM / ResInsight / ThirdParty / Ert / devel / python / python / ert / ecl / 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 / python / ert / ecl / 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 Ensembles / ert / devel / python / python / ert / ecl / 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 = EclSum.cNamespace().get_report_end( self , report_step )
            index_list.append( time_index )
        return index_list
github OPM / ResInsight / ThirdParty / Ert / python / python / ert / enkf / enkf_obs.py View on Github external
def getObservationAndMeasureData(self, fs, local_obsdata, active_list, meas_data, obs_data):
        assert isinstance(fs, EnkfFs)
        assert isinstance(local_obsdata, LocalObsdata)
        assert isinstance(active_list, IntVector)
        assert isinstance(meas_data, MeasData)
        assert isinstance(obs_data, ObsData)

        self._get_obs_and_measure_data(fs, local_obsdata, active_list, meas_data, obs_data)
github OPM / ResInsight / ThirdParty / Ert / python / python / ert / enkf / observations / gen_observation.py View on Github external
raise ValueError("Exactly one the scalar_value and obs_file arguments must be present")

        if obs_file is not None:
            if not os.path.isfile( obs_file ):
                raise IOError("The file with observation data:%s does not exist" % obs_file )
            else:
                self._load( obs_file )
        else:
            obs_value , obs_std = scalar_value
            self._scalar_set( obs_value , obs_std )

        if not data_index is None:
            if os.path.isfile( data_index ):
                self._load_data_index( data_index )
            else:
                index_list = IntVector.active_list( data_index )
                self._add_data_index( index_list )
github Ensembles / ert / python / python / ert / ecl / ecl_grid.py View on Github external
def createRectangular(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