How to use the ert.geo.GeoPrototype 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 OPM / ResInsight / ThirdParty / Ert / devel / python / python / ert / geo / cpolyline_collection.py View on Github external
import ctypes

from ert.cwrap import BaseCClass, CWrapper
from ert.geo import GeoPrototype, CPolyline


class CPolylineCollection(BaseCClass):
    TYPE_NAME = "geo_polygon_collection"

    _alloc_new          = GeoPrototype("void*            geo_polygon_collection_alloc(  )" , bind = False)
    _free               = GeoPrototype("void             geo_polygon_collection_free( geo_polygon_collection )" )
    _size               = GeoPrototype("int              geo_polygon_collection_size( geo_polygon_collection)" )
    _create_polyline    = GeoPrototype("geo_polygon_ref  geo_polygon_collection_create_polygon(geo_polygon_collection , char*)" )
    _has_polyline       = GeoPrototype("bool             geo_polygon_collection_has_polygon(geo_polygon_collection , char*)" )
    _iget               = GeoPrototype("geo_polygon_ref  geo_polygon_collection_iget_polygon(geo_polygon_collection , int)" )
    _get                = GeoPrototype("geo_polygon_ref  geo_polygon_collection_get_polygon(geo_polygon_collection , char*)" )
    _add_polyline       = GeoPrototype("void             geo_polygon_collection_add_polygon(geo_polygon_collection , geo_polygon , bool)")


    
    def __init__(self):
        c_ptr = self._alloc_new(  )
        super(CPolylineCollection , self).__init__( c_ptr )
        self.parent_ref = None
        

    def __contains__(self , name):
        return self._has_polyline(name)
    

    def __len__(self):
        return self._size( )
github Ensembles / ert / devel / python / python / ert / geo / cpolyline.py View on Github external
from .geometry_tools import GeometryTools


class CPolyline(BaseCClass):
    TYPE_NAME = "geo_polygon"
    
    _alloc_new          = GeoPrototype("void*           geo_polygon_alloc( char* )" , bind = False)
    _fread_alloc_irap   = GeoPrototype("geo_polygon_obj geo_polygon_fload_alloc_irap( char* )" , bind = False)
    _add_point          = GeoPrototype("void     geo_polygon_add_point( geo_polygon , double , double )")
    _add_point_front    = GeoPrototype("void     geo_polygon_add_point_front( geo_polygon , double , double )")
    _free               = GeoPrototype("void     geo_polygon_free( geo_polygon )")
    _size               = GeoPrototype("int      geo_polygon_get_size( geo_polygon )")
    _iget_xy            = GeoPrototype("void     geo_polygon_iget_xy( geo_polygon , int , double* , double* )")
    _segment_intersects = GeoPrototype("bool     geo_polygon_segment_intersects( geo_polygon , double , double, double , double)")
    _get_name           = GeoPrototype("char*    geo_polygon_get_name( geo_polygon  )")
    _set_name           = GeoPrototype("void     geo_polygon_set_name( geo_polygon , char*  )")
    _segment_length     = GeoPrototype("double   geo_polygon_get_length( geo_polygon)")
    _equal              = GeoPrototype("bool     geo_polygon_equal( geo_polygon , geo_polygon )")


    def __init__(self, name = None , init_points = []):
        c_ptr = self._alloc_new( name )
        super(CPolyline , self).__init__( c_ptr )
        for (xc, yc) in init_points:
            self.addPoint(xc, yc)


    @classmethod
    def createFromXYZFile(cls , filename , name = None):
        if not os.path.isfile(filename):
            raise IOError("No such file:%s" % filename)
github OPM / ResInsight / ThirdParty / Ert / python / python / ert / geo / cpolyline_collection.py View on Github external
"""
import ctypes

from cwrap import BaseCClass
from ert.geo import GeoPrototype, CPolyline


class CPolylineCollection(BaseCClass):
    TYPE_NAME = "geo_polygon_collection"

    _alloc_new          = GeoPrototype("void*            geo_polygon_collection_alloc(  )" , bind = False)
    _free               = GeoPrototype("void             geo_polygon_collection_free( geo_polygon_collection )" )
    _size               = GeoPrototype("int              geo_polygon_collection_size( geo_polygon_collection)" )
    _create_polyline    = GeoPrototype("geo_polygon_ref  geo_polygon_collection_create_polygon(geo_polygon_collection , char*)" )
    _has_polyline       = GeoPrototype("bool             geo_polygon_collection_has_polygon(geo_polygon_collection , char*)" )
    _iget               = GeoPrototype("geo_polygon_ref  geo_polygon_collection_iget_polygon(geo_polygon_collection , int)" )
    _get                = GeoPrototype("geo_polygon_ref  geo_polygon_collection_get_polygon(geo_polygon_collection , char*)" )
    _add_polyline       = GeoPrototype("void             geo_polygon_collection_add_polygon(geo_polygon_collection , geo_polygon , bool)")



    def __init__(self):
        c_ptr = self._alloc_new(  )
        super(CPolylineCollection , self).__init__( c_ptr )
        self.parent_ref = None


    def __contains__(self , name):
        return self._has_polyline(name)


    def __len__(self):
github OPM / ResInsight / ThirdParty / Ert / python / python / ert / geo / surface.py View on Github external
class Surface(BaseCClass):
    TYPE_NAME = "surface"

    _alloc        = GeoPrototype("void*  geo_surface_fload_alloc_irap( char* , bool )" , bind = False)
    _free         = GeoPrototype("void   geo_surface_free( surface )")
    _new          = GeoPrototype("void*  geo_surface_alloc_new( int, int, double, double, double, double, double )", bind = False)
    _get_nx       = GeoPrototype("int    geo_surface_get_nx( surface )")
    _get_ny       = GeoPrototype("int    geo_surface_get_ny( surface )")
    _iget_zvalue  = GeoPrototype("double geo_surface_iget_zvalue( surface , int)")
    _iset_zvalue  = GeoPrototype("void   geo_surface_iset_zvalue( surface , int , double)")
    _write        = GeoPrototype("void   geo_surface_fprintf_irap( surface , char* )")
    _equal        = GeoPrototype("bool   geo_surface_equal( surface , surface )")
    _header_equal = GeoPrototype("bool   geo_surface_equal_header( surface , surface )")
    _copy         = GeoPrototype("surface_obj geo_surface_alloc_copy( surface , bool )")
    _assign       = GeoPrototype("void   geo_surface_assign_value( surface , double )")
    _scale        = GeoPrototype("void   geo_surface_scale( surface , double )")
    _shift        = GeoPrototype("void   geo_surface_shift( surface , double )")
    _iadd         = GeoPrototype("void   geo_surface_iadd( surface , surface )")
    _imul         = GeoPrototype("void   geo_surface_imul( surface , surface )")
    _isub         = GeoPrototype("void   geo_surface_isub( surface , surface )")
    _isqrt        = GeoPrototype("void   geo_surface_isqrt( surface )")
    _iget_xy      = GeoPrototype("void   geo_surface_iget_xy(surface, int, double*, double*)")
    _get_pointset = GeoPrototype("geo_pointset_ref geo_surface_get_pointset(surface)")


    def __init__(self, filename=None, nx=None, ny=None, xinc=None, yinc=None,
                                      xstart=None, ystart=None, angle=None):
        """
        This will load a irap surface from file. The surface should
        consist of a header and a set z values.
        """
        if filename is not None:
github Ensembles / ert / devel / python / python / ert / geo / surface.py View on Github external
class Surface(BaseCClass):
    TYPE_NAME = "surface"

    _alloc        = GeoPrototype("void*  geo_surface_fload_alloc_irap( char* , bool )" , bind = False)
    _free         = GeoPrototype("void   geo_surface_free( surface )")
    _get_nx       = GeoPrototype("int    geo_surface_get_nx( surface )")
    _get_ny       = GeoPrototype("int    geo_surface_get_ny( surface )")
    _iget_zvalue  = GeoPrototype("double geo_surface_iget_zvalue( surface , int)")
    _iset_zvalue  = GeoPrototype("void   geo_surface_iset_zvalue( surface , int , double)")
    _write        = GeoPrototype("void   geo_surface_fprintf_irap( surface , char* )")
    _equal        = GeoPrototype("bool   geo_surface_equal( surface , surface )")
    _header_equal = GeoPrototype("bool   geo_surface_equal_header( surface , surface )")
    _copy         = GeoPrototype("surface_obj geo_surface_alloc_copy( surface , bool )")
    _assign       = GeoPrototype("void   geo_surface_assign_value( surface , double )")
    _scale        = GeoPrototype("void   geo_surface_scale( surface , double )")
    _shift        = GeoPrototype("void   geo_surface_shift( surface , double )")
    _iadd         = GeoPrototype("void   geo_surface_iadd( surface , surface )")
    _imul         = GeoPrototype("void   geo_surface_imul( surface , surface )")
    _isub         = GeoPrototype("void   geo_surface_isub( surface , surface )")
    _isqrt        = GeoPrototype("void   geo_surface_isqrt( surface )")

    
    def __init__(self, filename):
        """
        This will load a irap surface from file. The surface should
        consist of a header and a set z values.
        """
        if os.path.isfile( filename ):
            c_ptr = self._alloc(filename , True)
            super(Surface , self).__init__(c_ptr)
        else:
github OPM / ResInsight / ThirdParty / Ert / devel / python / python / ert / geo / cpolyline_collection.py View on Github external
Create a polygon
"""
import ctypes

from ert.cwrap import BaseCClass, CWrapper
from ert.geo import GeoPrototype, CPolyline


class CPolylineCollection(BaseCClass):
    TYPE_NAME = "geo_polygon_collection"

    _alloc_new          = GeoPrototype("void*            geo_polygon_collection_alloc(  )" , bind = False)
    _free               = GeoPrototype("void             geo_polygon_collection_free( geo_polygon_collection )" )
    _size               = GeoPrototype("int              geo_polygon_collection_size( geo_polygon_collection)" )
    _create_polyline    = GeoPrototype("geo_polygon_ref  geo_polygon_collection_create_polygon(geo_polygon_collection , char*)" )
    _has_polyline       = GeoPrototype("bool             geo_polygon_collection_has_polygon(geo_polygon_collection , char*)" )
    _iget               = GeoPrototype("geo_polygon_ref  geo_polygon_collection_iget_polygon(geo_polygon_collection , int)" )
    _get                = GeoPrototype("geo_polygon_ref  geo_polygon_collection_get_polygon(geo_polygon_collection , char*)" )
    _add_polyline       = GeoPrototype("void             geo_polygon_collection_add_polygon(geo_polygon_collection , geo_polygon , bool)")


    
    def __init__(self):
        c_ptr = self._alloc_new(  )
        super(CPolylineCollection , self).__init__( c_ptr )
        self.parent_ref = None
        

    def __contains__(self , name):
        return self._has_polyline(name)
    
github OPM / ResInsight / ThirdParty / Ert / python / python / ert / geo / surface.py View on Github external
Create a polygon
"""
import os.path
import ctypes
from numpy import zeros

from cwrap import BaseCClass
from ert.geo import GeoPrototype
from ert.geo import GeoPointset

class Surface(BaseCClass):
    TYPE_NAME = "surface"

    _alloc        = GeoPrototype("void*  geo_surface_fload_alloc_irap( char* , bool )" , bind = False)
    _free         = GeoPrototype("void   geo_surface_free( surface )")
    _new          = GeoPrototype("void*  geo_surface_alloc_new( int, int, double, double, double, double, double )", bind = False)
    _get_nx       = GeoPrototype("int    geo_surface_get_nx( surface )")
    _get_ny       = GeoPrototype("int    geo_surface_get_ny( surface )")
    _iget_zvalue  = GeoPrototype("double geo_surface_iget_zvalue( surface , int)")
    _iset_zvalue  = GeoPrototype("void   geo_surface_iset_zvalue( surface , int , double)")
    _write        = GeoPrototype("void   geo_surface_fprintf_irap( surface , char* )")
    _equal        = GeoPrototype("bool   geo_surface_equal( surface , surface )")
    _header_equal = GeoPrototype("bool   geo_surface_equal_header( surface , surface )")
    _copy         = GeoPrototype("surface_obj geo_surface_alloc_copy( surface , bool )")
    _assign       = GeoPrototype("void   geo_surface_assign_value( surface , double )")
    _scale        = GeoPrototype("void   geo_surface_scale( surface , double )")
    _shift        = GeoPrototype("void   geo_surface_shift( surface , double )")
    _iadd         = GeoPrototype("void   geo_surface_iadd( surface , surface )")
    _imul         = GeoPrototype("void   geo_surface_imul( surface , surface )")
    _isub         = GeoPrototype("void   geo_surface_isub( surface , surface )")
    _isqrt        = GeoPrototype("void   geo_surface_isqrt( surface )")
    _iget_xy      = GeoPrototype("void   geo_surface_iget_xy(surface, int, double*, double*)")
github OPM / ResInsight / ThirdParty / Ert / python / python / ert / geo / surface.py View on Github external
_alloc        = GeoPrototype("void*  geo_surface_fload_alloc_irap( char* , bool )" , bind = False)
    _free         = GeoPrototype("void   geo_surface_free( surface )")
    _new          = GeoPrototype("void*  geo_surface_alloc_new( int, int, double, double, double, double, double )", bind = False)
    _get_nx       = GeoPrototype("int    geo_surface_get_nx( surface )")
    _get_ny       = GeoPrototype("int    geo_surface_get_ny( surface )")
    _iget_zvalue  = GeoPrototype("double geo_surface_iget_zvalue( surface , int)")
    _iset_zvalue  = GeoPrototype("void   geo_surface_iset_zvalue( surface , int , double)")
    _write        = GeoPrototype("void   geo_surface_fprintf_irap( surface , char* )")
    _equal        = GeoPrototype("bool   geo_surface_equal( surface , surface )")
    _header_equal = GeoPrototype("bool   geo_surface_equal_header( surface , surface )")
    _copy         = GeoPrototype("surface_obj geo_surface_alloc_copy( surface , bool )")
    _assign       = GeoPrototype("void   geo_surface_assign_value( surface , double )")
    _scale        = GeoPrototype("void   geo_surface_scale( surface , double )")
    _shift        = GeoPrototype("void   geo_surface_shift( surface , double )")
    _iadd         = GeoPrototype("void   geo_surface_iadd( surface , surface )")
    _imul         = GeoPrototype("void   geo_surface_imul( surface , surface )")
    _isub         = GeoPrototype("void   geo_surface_isub( surface , surface )")
    _isqrt        = GeoPrototype("void   geo_surface_isqrt( surface )")
    _iget_xy      = GeoPrototype("void   geo_surface_iget_xy(surface, int, double*, double*)")
    _get_pointset = GeoPrototype("geo_pointset_ref geo_surface_get_pointset(surface)")


    def __init__(self, filename=None, nx=None, ny=None, xinc=None, yinc=None,
                                      xstart=None, ystart=None, angle=None):
        """
        This will load a irap surface from file. The surface should
        consist of a header and a set z values.
        """
        if filename is not None:
            filename = str(filename)
            if os.path.isfile( filename ):
                c_ptr = self._alloc(filename , True)
github Ensembles / ert / devel / python / python / ert / geo / surface.py View on Github external
Create a polygon
"""
import os.path

from ert.cwrap import BaseCClass
from ert.geo import GeoPrototype


class Surface(BaseCClass):
    TYPE_NAME = "surface"

    _alloc        = GeoPrototype("void*  geo_surface_fload_alloc_irap( char* , bool )" , bind = False)
    _free         = GeoPrototype("void   geo_surface_free( surface )")
    _get_nx       = GeoPrototype("int    geo_surface_get_nx( surface )")
    _get_ny       = GeoPrototype("int    geo_surface_get_ny( surface )")
    _iget_zvalue  = GeoPrototype("double geo_surface_iget_zvalue( surface , int)")
    _iset_zvalue  = GeoPrototype("void   geo_surface_iset_zvalue( surface , int , double)")
    _write        = GeoPrototype("void   geo_surface_fprintf_irap( surface , char* )")
    _equal        = GeoPrototype("bool   geo_surface_equal( surface , surface )")
    _header_equal = GeoPrototype("bool   geo_surface_equal_header( surface , surface )")
    _copy         = GeoPrototype("surface_obj geo_surface_alloc_copy( surface , bool )")
    _assign       = GeoPrototype("void   geo_surface_assign_value( surface , double )")
    _scale        = GeoPrototype("void   geo_surface_scale( surface , double )")
    _shift        = GeoPrototype("void   geo_surface_shift( surface , double )")
    _iadd         = GeoPrototype("void   geo_surface_iadd( surface , surface )")
    _imul         = GeoPrototype("void   geo_surface_imul( surface , surface )")
    _isub         = GeoPrototype("void   geo_surface_isub( surface , surface )")
    _isqrt        = GeoPrototype("void   geo_surface_isqrt( surface )")

    
    def __init__(self, filename):
        """
github Ensembles / ert / devel / python / python / ert / geo / cpolyline.py View on Github external
#  for more details. 
"""
Create a polygon
"""
import ctypes
import os.path

from ert.cwrap import BaseCClass, CWrapper
from ert.geo import GeoPrototype
from .geometry_tools import GeometryTools


class CPolyline(BaseCClass):
    TYPE_NAME = "geo_polygon"
    
    _alloc_new          = GeoPrototype("void*           geo_polygon_alloc( char* )" , bind = False)
    _fread_alloc_irap   = GeoPrototype("geo_polygon_obj geo_polygon_fload_alloc_irap( char* )" , bind = False)
    _add_point          = GeoPrototype("void     geo_polygon_add_point( geo_polygon , double , double )")
    _add_point_front    = GeoPrototype("void     geo_polygon_add_point_front( geo_polygon , double , double )")
    _free               = GeoPrototype("void     geo_polygon_free( geo_polygon )")
    _size               = GeoPrototype("int      geo_polygon_get_size( geo_polygon )")
    _iget_xy            = GeoPrototype("void     geo_polygon_iget_xy( geo_polygon , int , double* , double* )")
    _segment_intersects = GeoPrototype("bool     geo_polygon_segment_intersects( geo_polygon , double , double, double , double)")
    _get_name           = GeoPrototype("char*    geo_polygon_get_name( geo_polygon  )")
    _set_name           = GeoPrototype("void     geo_polygon_set_name( geo_polygon , char*  )")
    _segment_length     = GeoPrototype("double   geo_polygon_get_length( geo_polygon)")
    _equal              = GeoPrototype("bool     geo_polygon_equal( geo_polygon , geo_polygon )")


    def __init__(self, name = None , init_points = []):
        c_ptr = self._alloc_new( name )
        super(CPolyline , self).__init__( c_ptr )