ruby-gr 0.66.0.0 → 0.71.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f62d57c43711e0e23533d38287699d89479a21071c362ff162f2106dfcc550e
4
- data.tar.gz: 9be23f52f87aa7b61680142bc648049cbfa2c4b683bf082d47679daf430ff9dc
3
+ metadata.gz: 7bcc99a586935b6552accdfb5c93e8e2c11ab9fbe84e7381470d632ba27d75d3
4
+ data.tar.gz: d788f7c35a41e6522b8a4856abe168a9376acb0f2237d8b6e1490eef340d8ae7
5
5
  SHA512:
6
- metadata.gz: fd728fb1457f78827d8ce1ecf77ef7cd87df51f1ecbc4a1165d371a67e04cac130294dbe9e8b6d947a69a6c1385818f7aa041df3d4de9a883aec7e11f62742f6
7
- data.tar.gz: f6e6af01b74bfe6f6b373477d1a7cb917b52c8cb941d530fd1a90986927e241a4c75048cf49f2c1c4fbabebf59ea763d01de418768d67ebbafd9a19dabaf7b1c
6
+ metadata.gz: fc80ccc8e0a8b1070166d0234d680b3eb227aaacc95005b03fd61449ab3e2d27329abaf9476eaad5fb11a5fda7835b2dc2062a9438982fdf1bb435952b29bc68
7
+ data.tar.gz: 62e1a5366a7cdad3bbd456f53efc439dd41a661a1601d6b0d63c9e03455d87494888f7dd1e25e11c5c2e550c2808ca01a52c706c08a8c8dda2054cbc04ffdcc2
data/README.md CHANGED
@@ -25,8 +25,6 @@
25
25
 
26
26
  ## Installation
27
27
 
28
- GR.rb supports Ruby 2.5+.
29
-
30
28
  First, [install GR](#gr-installation). Then install [`gr-plot`](https://github.com/red-data-tools/gr-plot) gem.
31
29
 
32
30
  ```sh
data/lib/gr/ffi.rb CHANGED
@@ -19,7 +19,42 @@ module GR
19
19
 
20
20
  # https://github.com/sciapp/gr/blob/master/lib/gr/gr.h
21
21
  # keep same order
22
+
23
+ Vertex = struct [
24
+ 'double x',
25
+ 'double y',
26
+ ]
27
+
28
+ # Three-dimensional coordinate
29
+ Point3d = struct [
30
+ 'double x',
31
+ 'double y',
32
+ 'double z',
33
+ ]
34
+
35
+ # Data point for `gr_volume_nogrid`
36
+ DataPoint3d = struct [
37
+ { pt: Point3d }, # Coordinates of data point
38
+ 'double data', # Intensity of data point
39
+ ]
40
+
41
+ # Provides optional extra data for `gr_volume_interp_gauss`
42
+ Guess = struct [
43
+ 'double sqrt_det', # Square root of determinant of covariance matrix
44
+ {gauss_sig_1: Point3d},
45
+ {gauss_sig_2: Point3d},
46
+ {gauss_sig_3: Point3d}, # \f$\Sigma^{-\frac{1}{2}}\f$ encoded as three column vectors
47
+ ]
48
+
49
+ # Provides optional extra data for `gr_volume_interp_tri_linear`
50
+ TriLinear = struct [
51
+ 'double grid_x_re', # Reciproke of interpolation kernel extent in x-directionGrid resolution in x direction
52
+ 'double grid_y_re', # Reciproke of interpolation kernel extent in y-directionGrid resolution in y direction
53
+ 'double grid_z_re', # Reciproke of interpolation kernel extent in z-directionGrid resolution in z direction
54
+ ]
55
+
22
56
  try_extern 'void gr_initgr(void)'
57
+ try_extern 'int gr_debug(void)'
23
58
  try_extern 'void gr_opengks(void)'
24
59
  try_extern 'void gr_closegks(void)'
25
60
  try_extern 'void gr_inqdspsize(double *, double *, int *, int *)'
@@ -67,6 +102,7 @@ module GR
67
102
  try_extern 'void gr_settextcolorind(int)'
68
103
  try_extern 'void gr_inqtextcolorind(int *)'
69
104
  try_extern 'void gr_setcharheight(double)'
105
+ try_extern 'void gr_setwscharheight(double chh, double height)'
70
106
  try_extern 'void gr_inqcharheight(double *)'
71
107
  try_extern 'void gr_setcharup(double, double)'
72
108
  try_extern 'void gr_settextpath(int)'
@@ -223,5 +259,10 @@ module GR
223
259
  try_extern 'void gr_cpubasedvolume(int, int, int, double *, int, double *, double *, double *, double *)'
224
260
  try_extern 'void gr_inqvpsize(int *, int *, double *)'
225
261
  try_extern 'void gr_polygonmesh3d(int, const double *, const double *, const double *, int, const int *, const int *)'
262
+ try_extern 'void gr_volume_nogrid(unsigned long, const data_point3d_t *, const void *, int, kernel_f, double *, double *, double, radius_f)'
263
+ try_extern 'void gr_volume_interp_tri_linear_init(double, double, double)'
264
+ try_extern 'void gr_volume_interp_gauss_init(double, double *)'
265
+ try_extern 'double gr_volume_interp_tri_linear(const data_point3d_t *, const void *, const point3d_t *, const point3d_t *)'
266
+ try_extern 'double gr_volume_interp_gauss(const data_point3d_t *, const void *, const point3d_t *, const point3d_t *)'
226
267
  end
227
268
  end
data/lib/gr.rb CHANGED
@@ -278,7 +278,7 @@ module GR
278
278
  # GR_TEXT_ENABLE_INLINE_MATH)
279
279
  #
280
280
  # The values for `x` and `y` specify the text position. If the GR_TEXT_USE_WC
281
- # option is set, they are interpreted as world cordinates, otherwise as
281
+ # option is set, they are interpreted as world coordinates, otherwise as
282
282
  # normalized device coordinates. The string may contain new line characters
283
283
  # and inline math expressions ($...$). The latter are only taken into account,
284
284
  # if the GR_TEXT_ENABLE_INLINE_MATH option is set.
@@ -407,7 +407,7 @@ module GR
407
407
  # @param nrow [Integer] total number of rows in the color index array and the radii array
408
408
  # @param color [Integer] color index array
409
409
  #
410
- # The mapping of the polar coordinates and the drawing is performed simialr
410
+ # The mapping of the polar coordinates and the drawing is performed similar
411
411
  # to `gr_polarcellarray` with the difference that the individual cell sizes
412
412
  # are specified allowing nonuniform sized cells.
413
413
  #
@@ -556,7 +556,7 @@ module GR
556
556
  # * -27 : MARKERTYPE_STAR_6 - 6-pointed star (hexagram)
557
557
  # * -28 : MARKERTYPE_STAR_7 - 7-pointed star (heptagram)
558
558
  # * -29 : MARKERTYPE_STAR_8 - 8-pointed star (octagram)
559
- # * -30 : MARKERTYPE_VLINE - verical line
559
+ # * -30 : MARKERTYPE_VLINE - vertical line
560
560
  # * -31 : MARKERTYPE_HLINE - horizontal line
561
561
  # * -32 : MARKERTYPE_OMARK - o-mark
562
562
  #
@@ -1544,10 +1544,10 @@ module GR
1544
1544
 
1545
1545
  def beginprint(file_path)
1546
1546
  super(file_path)
1547
- if block_given?
1548
- yield
1549
- endprint
1550
- end
1547
+ return unless block_given?
1548
+
1549
+ yield
1550
+ endprint
1551
1551
  end
1552
1552
 
1553
1553
  # Open and activate a print device with the given layout attributes.
@@ -1586,7 +1586,7 @@ module GR
1586
1586
  # * Folio : 0.210 x 0.330
1587
1587
  # * Ledger : 0.432 x 0.279
1588
1588
  # * Tabloid : 0.279 x 0.432
1589
- # @param orientation [String] Page orientation (Landscape, Portait)
1589
+ # @param orientation [String] Page orientation (Landscape, Portrait)
1590
1590
  #
1591
1591
  # @!method beginprintext
1592
1592
 
data/lib/gr3/ffi.rb CHANGED
@@ -17,7 +17,7 @@ module GR3
17
17
 
18
18
  extend GRCommons::TryExtern
19
19
 
20
- typealias("GR3_MC_DTYPE", "unsigned short")
20
+ typealias('GR3_MC_DTYPE', 'unsigned short')
21
21
 
22
22
  # https://github.com/sciapp/gr/blob/master/lib/gr3/gr3.h
23
23
  # keep same order
@@ -100,6 +100,8 @@ module GR3
100
100
  ' const float *colors, const float *scales)'
101
101
  try_extern 'void gr3_drawsurface(int mesh)'
102
102
  try_extern 'void gr3_surface(int nx, int ny, float *px, float *py, float *pz, int option)'
103
+ try_extern 'void gr3_isosurface(int nx, int ny, int nz, const float *data, float isovalue, const float *color,' \
104
+ ' const int *strides)'
103
105
  try_extern 'int gr3_drawtubemesh(int n, float *points, float *colors, float *radii,' \
104
106
  ' int num_steps, int num_segments)'
105
107
  try_extern 'int gr3_createtubemesh(int *mesh, int n,' \
data/lib/gr3.rb CHANGED
@@ -302,7 +302,7 @@ module GR3
302
302
  # @!method drawmesh
303
303
 
304
304
  # This function marks a mesh for deletion and removes the user’s reference
305
- # from the mesh’s referenc counter, so a user must not use the mesh after
305
+ # from the mesh’s reference counter, so a user must not use the mesh after
306
306
  # calling this function.
307
307
  #
308
308
  # @param mesh [Integer] The mesh that should be marked for deletion
@@ -587,10 +587,10 @@ module GR3
587
587
 
588
588
  super(n, positions, colors, radii, bond_radius, bond_color, bond_delta)
589
589
 
590
- if spins
591
- spins = Numo::SFloat.cast(spins).reshape(n, 3)
592
- drawspins(positions, spins, colors)
593
- end
590
+ return unless spins
591
+
592
+ spins = Numo::SFloat.cast(spins).reshape(n, 3)
593
+ drawspins(positions, spins, colors)
594
594
  end
595
595
 
596
596
  # Creates meshes for slices through the given data, using the current GR
@@ -5,7 +5,6 @@
5
5
  # It should not be loaded when gr_commons/gr_commons is loaded.
6
6
 
7
7
  require 'logger'
8
- require 'pp'
9
8
 
10
9
  module GRCommons
11
10
  # Convenience class methods
@@ -8,15 +8,15 @@ module GRCommons
8
8
  # Improved extern method.
9
9
  # 1. Ignore functions that cannot be attached.
10
10
  # 2. Available function (names) are stored in @ffi_methods.
11
- # For compatiblity with older versions of GR.
11
+ # For compatibility with older versions of GR.
12
12
  def try_extern(signature, *opts)
13
13
  @ffi_methods ||= []
14
14
  begin
15
15
  func = extern(signature, *opts)
16
16
  @ffi_methods << func.name
17
17
  func
18
- rescue StandardError => e
19
- warn "#{e.class.name}: #{e.message}"
18
+ rescue Fiddle::DLError => e
19
+ warn "#{e.class.name}: #{e.message}" if $VERBOSE
20
20
  end
21
21
  end
22
22
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GRCommons
4
- VERSION = '0.66.0.0'
4
+ VERSION = '0.71.7.0'
5
5
  end
data/lib/grm/ffi.rb CHANGED
@@ -20,40 +20,40 @@ module GRM
20
20
  # Currently, the declarations of GRM functions are distributed in several
21
21
  # header files.
22
22
 
23
- # https://github.com/sciapp/gr/blob/master/lib/grm/args.h
23
+ # https://github.com/sciapp/gr/blob/master/lib/grm/include/grm/args.h
24
24
  try_extern 'grm_args_t *grm_args_new(void)'
25
25
  try_extern 'void grm_args_delete(grm_args_t *args)'
26
26
  try_extern 'int grm_args_push(grm_args_t *args, const char *key, const char *value_format, ...)'
27
27
  try_extern 'int grm_args_push_buf(grm_args_t *args, const char *key, const char *value_format, const void *buffer, int apply_padding)'
28
28
  try_extern 'int grm_args_contains(const grm_args_t *args, const char *keyword)'
29
+ try_extern 'int grm_args_first_value(const grm_args_t *args, const char *keyword, const char *first_value_format, void *first_value, unsigned int *array_length)'
30
+ try_extern 'int grm_args_values(const grm_args_t *args, const char *keyword, const char *expected_format, ...)'
29
31
  try_extern 'void grm_args_clear(grm_args_t *args)'
30
32
  try_extern 'void grm_args_remove(grm_args_t *args, const char *key)'
31
33
  typealias 'grm_args_ptr_t', 'void*'
32
34
  try_extern 'grm_args_ptr_t grm_length(double value, const char *unit)'
33
35
 
34
- # https://github.com/sciapp/gr/blob/master/lib/grm/dump.h
36
+ # https://github.com/sciapp/gr/blob/master/lib/grm/include/grm/dump.h
35
37
  try_extern 'void grm_dump(const grm_args_t *args, FILE *f)'
36
38
  try_extern 'void grm_dump_json(const grm_args_t *args, FILE *f)'
37
39
  try_extern 'char *grm_dump_json_str(void)'
38
40
 
39
- # https://github.com/sciapp/gr/blob/master/lib/grm/event.h
41
+ # https://github.com/sciapp/gr/blob/master/lib/grm/include/grm/event.h
40
42
  typealias 'grm_event_type_t', 'int' # enum
41
43
  typealias 'grm_event_callback_t', 'void*'
42
44
  try_extern 'int grm_register(grm_event_type_t type, grm_event_callback_t callback)'
43
45
  try_extern 'int grm_unregister(grm_event_type_t type)'
44
46
 
45
- # https://github.com/sciapp/gr/blob/master/lib/grm/interaction.h
46
- # FIXME: https://github.com/ruby/fiddle/issues/68
47
- typealias 'const_int', 'int' # FIXME
47
+ # https://github.com/sciapp/gr/blob/master/lib/grm/include/grm/interaction.h
48
48
  try_extern 'int grm_input(const grm_args_t *input_args)'
49
- try_extern 'int grm_get_box(const_int x1, const_int y1, const_int x2, const_int y2, const_int keep_aspect_ratio, int *x, int *y, int *w, int *h)' # FIXME
49
+ try_extern 'int grm_get_box(const int x1, const int y1, const int x2, const int y2, const int keep_aspect_ratio, int *x, int *y, int *w, int *h)'
50
50
  try_extern 'int grm_is3d(const int x, const int y)'
51
- try_extern 'grm_tooltip_info_t *grm_get_tooltip(const_int, const_int)' # FIXME
51
+ try_extern 'grm_tooltip_info_t *grm_get_tooltip(const int, const int)'
52
52
 
53
- # https://github.com/sciapp/gr/blob/master/lib/grm/net.h
54
- try_extern 'void *grm_open(int is_receiver, const char *name, unsigned int id,
55
- const char *(*custom_recv)(const char *, unsigned int),
56
- int (*custom_send)(const char *, unsigned int, const char *))'
53
+ # https://github.com/sciapp/gr/blob/master/lib/grm/include/grm/net.h
54
+ try_extern 'void *grm_open(int is_receiver, const char *name, unsigned int id, ' \
55
+ 'const char *(*custom_recv)(const char *, unsigned int), ' \
56
+ 'int (*custom_send)(const char *, unsigned int, const char *))'
57
57
  try_extern 'grm_args_t *grm_recv(const void *p, grm_args_t *args)'
58
58
  try_extern 'int grm_send(const void *p, const char *data_desc, ...)'
59
59
  try_extern 'int grm_send_buf(const void *p, const char *data_desc, const void *buffer, int apply_padding)'
@@ -61,7 +61,7 @@ module GRM
61
61
  try_extern 'int grm_send_args(const void *p, const grm_args_t *args)'
62
62
  try_extern 'void grm_close(const void *p)'
63
63
 
64
- # https://github.com/sciapp/gr/blob/master/lib/grm/plot.h
64
+ # https://github.com/sciapp/gr/blob/master/lib/grm/include/grm/plot.h
65
65
  try_extern 'void grm_finalize(void)'
66
66
  try_extern 'int grm_clear(void)'
67
67
  try_extern 'unsigned int grm_max_plotid(void)'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-gr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.66.0.0
4
+ version: 0.71.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kojix2
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-09 00:00:00.000000000 Z
11
+ date: 2023-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fiddle
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 1.1.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 1.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: numo-narray
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -94,14 +94,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
- version: '2.6'
97
+ version: '2.7'
98
98
  required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - ">="
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  requirements: []
104
- rubygems_version: 3.3.7
104
+ rubygems_version: 3.4.1
105
105
  signing_key:
106
106
  specification_version: 4
107
107
  summary: GR for Ruby