ansys-pyensight-core 0.9.2__py3-none-any.whl → 0.9.3__py3-none-any.whl

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.

Potentially problematic release.


This version of ansys-pyensight-core might be problematic. Click here for more details.

@@ -77,6 +77,8 @@ ElementType = _build_enum("ElementType", libuserd_pb2.ElementType.items())
77
77
  VariableLocation = _build_enum("VariableLocation", libuserd_pb2.VariableLocation.items())
78
78
  VariableType = _build_enum("VariableType", libuserd_pb2.VariableType.items())
79
79
  PartHints = _build_enum("PartHints", libuserd_pb2.PartHints.items(), flag=True)
80
+ UpdateHints = _build_enum("UpdateHints", libuserd_pb2.UpdateHints.items(), flag=True)
81
+ RankValues = _build_enum("RankValues", libuserd_pb2.RankValues.items())
80
82
 
81
83
 
82
84
  class LibUserdError(Exception):
@@ -142,8 +144,8 @@ class Query(object):
142
144
  self._userd = userd
143
145
  self.id = pb.id
144
146
  self.name = pb.name
145
- self.x_title = pb.xTitle
146
- self.y_title = pb.yTitle
147
+ self.x_title = pb.x_title
148
+ self.y_title = pb.y_title
147
149
  self.metadata = {}
148
150
  for key in pb.metadata.keys():
149
151
  self.metadata[key] = pb.metadata[key]
@@ -165,6 +167,7 @@ class Query(object):
165
167
  """
166
168
  self._userd.connect_check()
167
169
  pb = libuserd_pb2.Query_dataRequest()
170
+ pb.query_id = self.id
168
171
  try:
169
172
  reply = self._userd.stub.Query_data(pb, metadata=self._userd.metadata())
170
173
  except grpc.RpcError as e:
@@ -191,19 +194,19 @@ class Variable(object):
191
194
  The id of this variable.
192
195
  name : str
193
196
  The name of this variable.
194
- unitLabel : str
197
+ unit_label : str
195
198
  The unit label of this variable, "Pa" for example.
196
- unitDims : str
199
+ unit_dims : str
197
200
  The dimensions of this variable, "L/S" for distance per second.
198
201
  location : "VariableLocation"
199
202
  The location of this variable.
200
203
  type : "VariableType"
201
204
  The type of this variable.
202
- timeVarying : bool
205
+ time_varying : bool
203
206
  True if the variable is time-varying.
204
- isComplex : bool
207
+ complex : bool
205
208
  True if the variable is complex.
206
- numOfComponents : int
209
+ number_of_components : int
207
210
  The number of components of this variable. A scalar is 1 and
208
211
  a vector is 3.
209
212
  metadata : Dict[str, str]
@@ -214,14 +217,14 @@ class Variable(object):
214
217
  self._userd = userd
215
218
  self.id = pb.id
216
219
  self.name = pb.name
217
- self.unitLabel = pb.unitLabel
218
- self.unitDims = pb.unitDims
219
- self.location = VariableLocation(pb.varLocation) # type: ignore
220
+ self.unit_label = pb.unit_label
221
+ self.unit_dims = pb.unit_dims
222
+ self.location = VariableLocation(pb.location) # type: ignore
220
223
  self.type = VariableType(pb.type) # type: ignore
221
- self.timeVarying = pb.timeVarying
222
- self.isComplex = pb.isComplex
223
- self.interleaveFlag = pb.interleaveFlag
224
- self.numOfComponents = pb.numOfComponents
224
+ self.time_varying = pb.time_varying
225
+ self.complex = pb.complex
226
+ self.interleave_flag = pb.interleave_flag
227
+ self.number_of_components = pb.number_of_components
225
228
  self.metadata = {}
226
229
  for key in pb.metadata.keys():
227
230
  self.metadata[key] = pb.metadata[key]
@@ -257,8 +260,6 @@ class Part(object):
257
260
  The id of the Reader this part is associated with.
258
261
  hints : int
259
262
  See: `PartHints`.
260
- reader_api_version : float
261
- The API version number of the USERD reader this part was read with.
262
263
  metadata : Dict[str, str]
263
264
  The metadata for this query.
264
265
  """
@@ -270,7 +271,6 @@ class Part(object):
270
271
  self.name = pb.name
271
272
  self.reader_id = pb.reader_id
272
273
  self.hints = pb.hints
273
- self.reader_api_version = pb.reader_api_version
274
274
  self.metadata = {}
275
275
  for key in pb.metadata.keys():
276
276
  self.metadata[key] = pb.metadata[key]
@@ -281,10 +281,16 @@ class Part(object):
281
281
  def __repr__(self):
282
282
  return f"<{self.__class__.__name__} object, id: {self.id}, name: '{self.name}'>"
283
283
 
284
- def nodes(self) -> "numpy.array":
284
+ def nodes(self, rank: Optional[int] = None) -> "numpy.array":
285
285
  """
286
286
  Return the vertex array for the part.
287
287
 
288
+ Parameters
289
+ ----------
290
+ rank : int, optional
291
+ For a dataset using multiple ranks, the rank to return data from. The
292
+ default is RankValues.SINGLE_RANK.
293
+
288
294
  Returns
289
295
  -------
290
296
  numpy.array
@@ -300,8 +306,10 @@ class Part(object):
300
306
 
301
307
  """
302
308
  self._userd.connect_check()
309
+ rank = self._userd.rank_check(rank)
303
310
  pb = libuserd_pb2.Part_nodesRequest()
304
311
  pb.part_id = self.id
312
+ pb.rank = rank
305
313
  try:
306
314
  stream = self._userd.stub.Part_nodes(pb, metadata=self._userd.metadata())
307
315
  except grpc.RpcError as e:
@@ -315,10 +323,16 @@ class Part(object):
315
323
  nodes[offset : offset + len(values)] = values
316
324
  return nodes
317
325
 
318
- def num_elements(self) -> dict:
326
+ def num_elements(self, rank: Optional[int] = None) -> dict:
319
327
  """
320
328
  Get the number of elements of a given type in the current part.
321
329
 
330
+ Parameters
331
+ ----------
332
+ rank : int, optional
333
+ For a dataset using multiple ranks, the rank to return data from. The
334
+ default is RankValues.SINGLE_RANK.
335
+
322
336
  Returns
323
337
  -------
324
338
  dict
@@ -335,19 +349,21 @@ class Part(object):
335
349
 
336
350
  """
337
351
  self._userd.connect_check()
352
+ rank = self._userd.rank_check(rank)
338
353
  pb = libuserd_pb2.Part_num_elementsRequest()
339
354
  pb.part_id = self.id
355
+ pb.rank = rank
340
356
  try:
341
357
  reply = self._userd.stub.Part_num_elements(pb, metadata=self._userd.metadata())
342
358
  except grpc.RpcError as e:
343
359
  raise self._userd.libuserd_exception(e)
344
360
  elements = {}
345
- for key in reply.elementCount.keys():
346
- if reply.elementCount[key] > 0:
347
- elements[key] = reply.elementCount[key]
361
+ for key in reply.element_count.keys():
362
+ if reply.element_count[key] > 0:
363
+ elements[key] = reply.element_count[key]
348
364
  return elements
349
365
 
350
- def element_conn(self, elem_type: int) -> "numpy.array":
366
+ def element_conn(self, elem_type: int, rank: Optional[int] = None) -> "numpy.array":
351
367
  """
352
368
  For "zoo" element types, return the part element connectivity for the specified
353
369
  element type.
@@ -356,6 +372,9 @@ class Part(object):
356
372
  ----------
357
373
  elem_type : int
358
374
  The element type. All but NFACED and NSIDED element types are allowed.
375
+ rank : int, optional
376
+ For a dataset using multiple ranks, the rank to return data from. The
377
+ default is RankValues.SINGLE_RANK.
359
378
 
360
379
  Returns
361
380
  -------
@@ -375,9 +394,12 @@ class Part(object):
375
394
  """
376
395
  if elem_type >= ElementType.NSIDED: # type: ignore
377
396
  raise RuntimeError(f"Element type {elem_type} is not valid for this call")
397
+ self._userd.connect_check()
398
+ rank = self._userd.rank_check(rank)
378
399
  pb = libuserd_pb2.Part_element_connRequest()
379
400
  pb.part_id = self.id
380
- pb.elemType = elem_type
401
+ pb.type = elem_type
402
+ pb.rank = rank
381
403
  try:
382
404
  stream = self._userd.stub.Part_element_conn(pb, metadata=self._userd.metadata())
383
405
  conn = numpy.empty(0, dtype=numpy.uint32)
@@ -396,7 +418,9 @@ class Part(object):
396
418
  raise error
397
419
  return conn
398
420
 
399
- def element_conn_nsided(self, elem_type: int) -> List["numpy.array"]:
421
+ def element_conn_nsided(
422
+ self, elem_type: int, rank: Optional[int] = None
423
+ ) -> List["numpy.array"]:
400
424
  """
401
425
  For an N-Sided element type (regular or ghost), return the connectivity information
402
426
  for the elements of that type in this part at this timestep.
@@ -414,6 +438,9 @@ class Part(object):
414
438
  ----------
415
439
  elem_type: int
416
440
  NSIDED or NSIDED_GHOST.
441
+ rank : int, optional
442
+ For a dataset using multiple ranks, the rank to return data from. The
443
+ default is RankValues.SINGLE_RANK.
417
444
 
418
445
  Returns
419
446
  -------
@@ -421,9 +448,11 @@ class Part(object):
421
448
  Two numpy arrays: num_nodes_per_element, nodes
422
449
  """
423
450
  self._userd.connect_check()
451
+ rank = self._userd.rank_check(rank)
424
452
  pb = libuserd_pb2.Part_element_conn_nsidedRequest()
425
453
  pb.part_id = self.id
426
- pb.elemType = elem_type
454
+ pb.type = elem_type
455
+ pb.rank = rank
427
456
  try:
428
457
  stream = self._userd.stub.Part_element_conn_nsided(pb, metadata=self._userd.metadata())
429
458
  nodes = numpy.empty(0, dtype=numpy.uint32)
@@ -433,19 +462,21 @@ class Part(object):
433
462
  nodes = numpy.empty(chunk.nodes_total_size, dtype=numpy.uint32)
434
463
  if len(indices) < chunk.indices_total_size:
435
464
  indices = numpy.empty(chunk.indices_total_size, dtype=numpy.uint32)
436
- if len(chunk.nodesPerPolygon):
465
+ if len(chunk.nodes_per_polygon):
437
466
  offset = chunk.nodes_offset
438
- values = numpy.array(chunk.nodesPerPolygon)
467
+ values = numpy.array(chunk.nodes_per_polygon)
439
468
  nodes[offset : offset + len(values)] = values
440
- if len(chunk.nodeIndices):
469
+ if len(chunk.node_indices):
441
470
  offset = chunk.indices_offset
442
- values = numpy.array(chunk.nodeIndices)
471
+ values = numpy.array(chunk.node_indices)
443
472
  indices[offset : offset + len(values)] = values
444
473
  except grpc.RpcError as e:
445
474
  raise self._userd.libuserd_exception(e)
446
475
  return [nodes, indices]
447
476
 
448
- def element_conn_nfaced(self, elem_type: int) -> List["numpy.array"]:
477
+ def element_conn_nfaced(
478
+ self, elem_type: int, rank: Optional[int] = None
479
+ ) -> List["numpy.array"]:
449
480
  """
450
481
  For an N-Faced element type (regular or ghost), return the connectivity information
451
482
  for the elements of that type in this part at this timestep.
@@ -465,6 +496,9 @@ class Part(object):
465
496
  ----------
466
497
  elem_type: int
467
498
  NFACED or NFACED_GHOST.
499
+ rank : int, optional
500
+ For a dataset using multiple ranks, the rank to return data from. The
501
+ default is RankValues.SINGLE_RANK.
468
502
 
469
503
  Returns
470
504
  -------
@@ -472,9 +506,11 @@ class Part(object):
472
506
  Three numpy arrays: num_faces_per_element, num_nodes_per_face, face_nodes
473
507
  """
474
508
  self._userd.connect_check()
509
+ rank = self._userd.rank_check(rank)
475
510
  pb = libuserd_pb2.Part_element_conn_nfacedRequest()
476
511
  pb.part_id = self.id
477
- pb.elemType = elem_type
512
+ pb.type = elem_type
513
+ pb.rank = rank
478
514
  try:
479
515
  stream = self._userd.stub.Part_element_conn_nfaced(pb, metadata=self._userd.metadata())
480
516
  face = numpy.empty(0, dtype=numpy.uint32)
@@ -487,24 +523,29 @@ class Part(object):
487
523
  npf = numpy.empty(chunk.npf_total_size, dtype=numpy.uint32)
488
524
  if len(nodes) < chunk.nodes_total_size:
489
525
  nodes = numpy.empty(chunk.nodes_total_size, dtype=numpy.uint32)
490
- if len(chunk.facesPerElement):
526
+ if len(chunk.faces_per_element):
491
527
  offset = chunk.face_offset
492
- values = numpy.array(chunk.facesPerElement)
528
+ values = numpy.array(chunk.faces_per_element)
493
529
  face[offset : offset + len(values)] = values
494
- if len(chunk.nodesPerFace):
530
+ if len(chunk.nodes_per_face):
495
531
  offset = chunk.npf_offset
496
- values = numpy.array(chunk.nodesPerFace)
532
+ values = numpy.array(chunk.nodes_per_face)
497
533
  npf[offset : offset + len(values)] = values
498
- if len(chunk.nodeIndices):
534
+ if len(chunk.node_indices):
499
535
  offset = chunk.nodes_offset
500
- values = numpy.array(chunk.nodeIndices)
536
+ values = numpy.array(chunk.node_indices)
501
537
  nodes[offset : offset + len(values)] = values
502
538
  except grpc.RpcError as e:
503
539
  raise self._userd.libuserd_exception(e)
504
540
  return [face, npf, nodes]
505
541
 
506
542
  def variable_values(
507
- self, variable: "Variable", elem_type: int = 0, imaginary: bool = False, component: int = 0
543
+ self,
544
+ variable: "Variable",
545
+ elem_type: int = 0,
546
+ imaginary: bool = False,
547
+ component: int = 0,
548
+ rank: Optional[int] = None,
508
549
  ) -> "numpy.array":
509
550
  """
510
551
  Return a numpy array containing the value(s) of a variable. If the variable is a
@@ -526,6 +567,9 @@ class Part(object):
526
567
  component : int
527
568
  Select the channel for a multivalued variable type. For example, if the variable
528
569
  is a vector, setting component to 1 will select the 'Y' component.
570
+ rank : int, optional
571
+ For a dataset using multiple ranks, the rank to return data from. The
572
+ default is RankValues.SINGLE_RANK.
529
573
 
530
574
  Returns
531
575
  -------
@@ -533,12 +577,14 @@ class Part(object):
533
577
  A numpy array or a single scalar float.
534
578
  """
535
579
  self._userd.connect_check()
580
+ rank = self._userd.rank_check(rank)
536
581
  pb = libuserd_pb2.Part_variable_valuesRequest()
537
582
  pb.part_id = self.id
538
583
  pb.var_id = variable.id
539
- pb.elemType = elem_type
540
- pb.varComponent = component
584
+ pb.type = elem_type
585
+ pb.component = component
541
586
  pb.complex = imaginary
587
+ pb.rank = rank
542
588
  try:
543
589
  stream = self._userd.stub.Part_variable_values(pb, metadata=self._userd.metadata())
544
590
  v = numpy.empty(0, dtype=numpy.float32)
@@ -546,7 +592,7 @@ class Part(object):
546
592
  if len(v) < chunk.total_size:
547
593
  v = numpy.empty(chunk.total_size, dtype=numpy.float32)
548
594
  offset = chunk.offset
549
- values = numpy.array(chunk.varValues)
595
+ values = numpy.array(chunk.values)
550
596
  v[offset : offset + len(values)] = values
551
597
  except grpc.RpcError as e:
552
598
  raise self._userd.libuserd_exception(e)
@@ -603,6 +649,10 @@ class Reader(object):
603
649
  The units system provided by the dataset.
604
650
  metadata : Dict[str, str]
605
651
  The metadata for this query.
652
+ reader_api_version : float
653
+ The reader USERD API version number
654
+ number_of_ranks : int
655
+ The number of ranks being used by the dataset reader
606
656
 
607
657
  Notes
608
658
  -----
@@ -612,7 +662,9 @@ class Reader(object):
612
662
 
613
663
  def __init__(self, userd: "LibUserd", pb: libuserd_pb2.Reader) -> None:
614
664
  self._userd = userd
615
- self.unit_system = pb.unitSystem
665
+ self.unit_system = pb.unit_system
666
+ self.reader_api_version = pb.reader_api_version
667
+ self.number_of_ranks = pb.number_of_ranks
616
668
  self.metadata = {}
617
669
  for key in pb.metadata.keys():
618
670
  self.metadata[key] = pb.metadata[key]
@@ -707,7 +759,7 @@ class Reader(object):
707
759
  except grpc.RpcError as e:
708
760
  raise self._userd.libuserd_exception(e)
709
761
  out = []
710
- for part in parts.partList:
762
+ for part in parts.part_list:
711
763
  out.append(Part(self._userd, part))
712
764
  return out
713
765
 
@@ -727,7 +779,7 @@ class Reader(object):
727
779
  except grpc.RpcError as e:
728
780
  raise self._userd.libuserd_exception(e)
729
781
  out = []
730
- for variable in variables.variableList:
782
+ for variable in variables.variable_list:
731
783
  out.append(Variable(self._userd, variable))
732
784
  return out
733
785
 
@@ -747,7 +799,7 @@ class Reader(object):
747
799
  except grpc.RpcError as e:
748
800
  raise self._userd.libuserd_exception(e)
749
801
  out = []
750
- for query in queries.queryList:
802
+ for query in queries.query_list:
751
803
  out.append(Query(self._userd, query))
752
804
  return out
753
805
 
@@ -770,7 +822,7 @@ class Reader(object):
770
822
  )
771
823
  except grpc.RpcError as e:
772
824
  raise self._userd.libuserd_exception(e)
773
- return reply.numberOfTimeSets
825
+ return reply.number_of_timesets
774
826
 
775
827
  def timevalues(self, timeset: int = 0) -> List[float]:
776
828
  """
@@ -795,12 +847,12 @@ class Reader(object):
795
847
  return numpy.array([], dtype="float32")
796
848
  self._userd.connect_check()
797
849
  pb = libuserd_pb2.Reader_timevaluesRequest()
798
- pb.timeSetNumber = timeset
850
+ pb.timeset_number = timeset
799
851
  try:
800
852
  timevalues = self._userd.stub.Reader_timevalues(pb, metadata=self._userd.metadata())
801
853
  except grpc.RpcError as e:
802
854
  raise self._userd.libuserd_exception(e)
803
- return numpy.array(timevalues.timeValues)
855
+ return numpy.array(timevalues.time_values)
804
856
 
805
857
  def set_timevalue(self, timevalue: float, timeset: int = 0) -> None:
806
858
  """
@@ -841,8 +893,8 @@ class Reader(object):
841
893
  return
842
894
  self._userd.connect_check()
843
895
  pb = libuserd_pb2.Reader_set_timevalueRequest()
844
- pb.timesetNumber = timeset
845
- pb.timeValue = timevalue
896
+ pb.timeset_number = timeset
897
+ pb.time_value = timevalue
846
898
  try:
847
899
  _ = self._userd.stub.Reader_set_timevalue(pb, metadata=self._userd.metadata())
848
900
  except grpc.RpcError as e:
@@ -868,8 +920,8 @@ class Reader(object):
868
920
  return
869
921
  self._userd.connect_check()
870
922
  pb = libuserd_pb2.Reader_set_timestepRequest()
871
- pb.timeSetNumber = timeset
872
- pb.timeStep = timestep
923
+ pb.timeset_number = timeset
924
+ pb.time_step = timestep
873
925
  try:
874
926
  _ = self._userd.stub.Reader_set_timestep(pb, metadata=self._userd.metadata())
875
927
  except grpc.RpcError as e:
@@ -892,9 +944,38 @@ class Reader(object):
892
944
  )
893
945
  except grpc.RpcError as e:
894
946
  raise self._userd.libuserd_exception(e)
895
- return reply.isGeomChanging
947
+ return reply.is_geometry_changing
896
948
 
897
- def variable_value(self, variable: "Variable") -> float:
949
+ def dynamic_update_check(self, changes_allowed: int) -> int:
950
+ """
951
+ When this method is called, it allows the reader to change aspects of
952
+ dataset. If the reader changes the time steps, mesh data or the
953
+ dataset structure (variable, part or query lists) this function
954
+ will return the nature of the change. The returned bits will always be
955
+ a subset of the input allowed bits.
956
+
957
+ Parameters
958
+ ----------
959
+ changes_allowed : int
960
+ Bitfield formed by oring UpdateHints values for the things that are allowed to change.
961
+
962
+ Returns
963
+ -------
964
+ int
965
+ A bitfield formed by oring UpdateHints values for the things that changed.
966
+ """
967
+ self._userd.connect_check()
968
+ pb = libuserd_pb2.Reader_dynamic_update_checkRequest()
969
+ pb.changes_allowed = changes_allowed
970
+ try:
971
+ reply = self._userd.stub.Reader_dynamic_update_check(
972
+ pb, metadata=self._userd.metadata()
973
+ )
974
+ except grpc.RpcError as e:
975
+ raise self._userd.libuserd_exception(e)
976
+ return reply.changed
977
+
978
+ def variable_value(self, variable: "Variable", rank: Optional[int] = None) -> float:
898
979
  """
899
980
  For any "case" variable (e.g. time), the value of the variable.
900
981
 
@@ -902,15 +983,19 @@ class Reader(object):
902
983
  ----------
903
984
  variable
904
985
  The variable to query. Note, this variable location must be on a CASE.
905
-
986
+ rank : int, optional
987
+ For a dataset using multiple ranks, the rank to return data from. The
988
+ default is RankValues.SINGLE_RANK.
906
989
  Returns
907
990
  -------
908
991
  float
909
992
  The value of the variable.
910
993
  """
911
994
  self._userd.connect_check()
995
+ rank = self._userd.rank_check(rank)
912
996
  pb = libuserd_pb2.Reader_variable_valueRequest()
913
997
  pb.variable_id = variable.id
998
+ pb.rank = rank
914
999
  try:
915
1000
  reply = self._userd.stub.Reader_variable_value(pb, metadata=self._userd.metadata())
916
1001
  except grpc.RpcError as e:
@@ -944,9 +1029,9 @@ class ReaderInfo(object):
944
1029
  The reader name.
945
1030
  description : str
946
1031
  A brief description of the reader and in some cases its operation.
947
- fileLabel1 : str
1032
+ file_label1 : str
948
1033
  A string appropriate for a "file select" button for the primary filename.
949
- fileLabel2 : str
1034
+ file_label2 : str
950
1035
  A string appropriate for a "file select" button for the secondary filename.
951
1036
  opt_booleans : List[dict]
952
1037
  The boolean user options.
@@ -961,8 +1046,8 @@ class ReaderInfo(object):
961
1046
  self.id = pb.id
962
1047
  self.name = pb.name
963
1048
  self.description = pb.description
964
- self.fileLabel1 = pb.fileLabel1
965
- self.fileLabel2 = pb.fileLabel2
1049
+ self.file_label1 = pb.file_label1
1050
+ self.file_label2 = pb.file_label2
966
1051
  self.opt_booleans = []
967
1052
  for b in pb.options.booleans:
968
1053
  self.opt_booleans.append(dict(name=b.name, value=b.value, default=b.default_value))
@@ -1044,7 +1129,7 @@ class LibUserd(object):
1044
1129
 
1045
1130
  Parameters
1046
1131
  ----------
1047
- ansys_installation
1132
+ ansys_installation : str
1048
1133
  Optional location to search for an Ansys software installation.
1049
1134
 
1050
1135
  Examples
@@ -1073,6 +1158,7 @@ class LibUserd(object):
1073
1158
  pim_instance: Optional[Any] = None,
1074
1159
  timeout: float = 120.0,
1075
1160
  pull_image_if_not_available: bool = False,
1161
+ number_of_ranks: int = 1,
1076
1162
  ):
1077
1163
  self._server_pathname: Optional[str] = None
1078
1164
  self._host = "127.0.0.1"
@@ -1099,6 +1185,7 @@ class LibUserd(object):
1099
1185
  self._enshell_grpc_channel: Optional[grpc.Channel] = channel
1100
1186
  self._pim_file_service: Optional[Any] = None
1101
1187
  self._service_host_port: Dict[str, Tuple[str, int]] = {}
1188
+ self._number_of_ranks = number_of_ranks
1102
1189
  local_launch = True
1103
1190
  if any([use_docker, use_dev, self._pim_instance]):
1104
1191
  local_launch = False
@@ -1169,6 +1256,8 @@ class LibUserd(object):
1169
1256
  self.VariableLocation = VariableLocation
1170
1257
  self.VariableType = VariableType
1171
1258
  self.PartHints = PartHints
1259
+ self.UpdateHints = UpdateHints
1260
+ self.RankValues = RankValues
1172
1261
 
1173
1262
  def _pull_docker_image(self) -> None:
1174
1263
  """Pull the docker image if not available"""
@@ -1209,8 +1298,8 @@ class LibUserd(object):
1209
1298
  )
1210
1299
  self._cei_home = self._enshell.cei_home()
1211
1300
  self._ansys_version = self._enshell.ansys_version()
1212
- print("CEI_HOME=", self._cei_home)
1213
- print("Ansys Version=", self._ansys_version)
1301
+ # print("CEI_HOME=", self._cei_home)
1302
+ # print("Ansys Version=", self._ansys_version)
1214
1303
  grpc_port = self._service_host_port["grpc_private"][1]
1215
1304
  ensight_args = f"-grpc_server {grpc_port}"
1216
1305
  container_env_str = f"ENSIGHT_SECURITY_TOKEN={self._security_token}\n"
@@ -1491,6 +1580,28 @@ class LibUserd(object):
1491
1580
  if not self._is_connected():
1492
1581
  raise RuntimeError("gRPC connection not established")
1493
1582
 
1583
+ def rank_check(self, rank: Optional[int]) -> int:
1584
+ """
1585
+ Validate the specified rank number. If the rank is None, return 0.
1586
+
1587
+ Parameters
1588
+ ----------
1589
+ rank: Optional[int]
1590
+ The rank number to validate.
1591
+
1592
+ Returns
1593
+ -------
1594
+ int
1595
+ The validated rank number.
1596
+ """
1597
+ if rank is None:
1598
+ return 0
1599
+ if int(rank) < 0 or int(rank) >= self._number_of_ranks:
1600
+ raise RuntimeError(
1601
+ f"Invalid rank number specified: {rank}. Valid range:[0, {self._number_of_ranks-1}]"
1602
+ )
1603
+ return int(rank)
1604
+
1494
1605
  """
1495
1606
  gRPC method bindings
1496
1607
  """
@@ -1584,7 +1695,7 @@ class LibUserd(object):
1584
1695
 
1585
1696
  Parameters
1586
1697
  ----------
1587
- element_type
1698
+ element_type : int
1588
1699
  The element type: ElementType enum value
1589
1700
 
1590
1701
  Returns
@@ -1609,7 +1720,7 @@ class LibUserd(object):
1609
1720
 
1610
1721
  Parameters
1611
1722
  ----------
1612
- element_type
1723
+ element_type : int
1613
1724
  The element type: ElementType enum value
1614
1725
 
1615
1726
  Returns
@@ -1632,7 +1743,7 @@ class LibUserd(object):
1632
1743
 
1633
1744
  Parameters
1634
1745
  ----------
1635
- element_type
1746
+ element_type : int
1636
1747
  The element type: ElementType enum value
1637
1748
 
1638
1749
  Returns
@@ -1655,7 +1766,7 @@ class LibUserd(object):
1655
1766
 
1656
1767
  Parameters
1657
1768
  ----------
1658
- element_type
1769
+ element_type : int
1659
1770
  The element type: ElementType enum value
1660
1771
 
1661
1772
  Returns
@@ -1678,7 +1789,7 @@ class LibUserd(object):
1678
1789
 
1679
1790
  Parameters
1680
1791
  ----------
1681
- element_type
1792
+ element_type : int
1682
1793
  The element type: ElementType enum value
1683
1794
 
1684
1795
  Returns
@@ -1716,13 +1827,26 @@ class LibUserd(object):
1716
1827
  raise self.libuserd_exception(e)
1717
1828
  return ret.result
1718
1829
 
1719
- def initialize(self) -> None:
1830
+ def initialize(self, number_of_ranks: int = 0) -> None:
1720
1831
  """
1721
1832
  This call initializes the libuserd system. It causes the library to scan for available
1722
1833
  readers and set up any required reduction engine bits. It can only be called once.
1834
+
1835
+ Parameters
1836
+ ----------
1837
+ number_of_ranks : int, optional
1838
+ The degree of I/O parallelism to read data with. Zero is serial I/O. Note: this
1839
+ option is not currently implemented and 0 should be used.
1723
1840
  """
1724
1841
  self.connect_check()
1725
1842
  pb = libuserd_pb2.Libuserd_initializeRequest()
1843
+ if number_of_ranks:
1844
+ self._number_of_ranks = number_of_ranks
1845
+ try:
1846
+ pb.parallel_node_count = number_of_ranks
1847
+ except Exception:
1848
+ # This exception is allowed to support older .proto versions
1849
+ pass
1726
1850
  try:
1727
1851
  _ = self.stub.Libuserd_initialize(pb, metadata=self.metadata())
1728
1852
  except grpc.RpcError as e:
@@ -1744,7 +1868,7 @@ class LibUserd(object):
1744
1868
  except grpc.RpcError as e:
1745
1869
  raise self.libuserd_exception(e)
1746
1870
  out = []
1747
- for reader in readers.readerInfo:
1871
+ for reader in readers.reader_info:
1748
1872
  out.append(ReaderInfo(self, reader))
1749
1873
  return out
1750
1874
 
@@ -1755,10 +1879,10 @@ class LibUserd(object):
1755
1879
 
1756
1880
  Parameters
1757
1881
  ----------
1758
- name1
1882
+ name1 : str
1759
1883
  Primary input filename
1760
1884
 
1761
- name2
1885
+ name2 : str
1762
1886
  Optional, secondary input filename
1763
1887
 
1764
1888
  Returns
@@ -1776,7 +1900,7 @@ class LibUserd(object):
1776
1900
  except grpc.RpcError as e:
1777
1901
  raise self.libuserd_exception(e)
1778
1902
  out = []
1779
- for reader in readers.readerInfo:
1903
+ for reader in readers.reader_info:
1780
1904
  out.append(ReaderInfo(self, reader))
1781
1905
  return out
1782
1906
 
@@ -1865,11 +1989,11 @@ class LibUserd(object):
1865
1989
  Parameters:
1866
1990
  ----------
1867
1991
 
1868
- uri: str
1992
+ uri : str
1869
1993
  The uri to get files from
1870
- pathname: str
1994
+ pathname : str
1871
1995
  The location were to save the files. It could be either a file or a folder.
1872
- folder: bool
1996
+ folder : bool
1873
1997
  True if the uri will server files from a directory. In this case,
1874
1998
  pathname will be used as the directory were to save the files.
1875
1999
  """