|
1 | 1 | """ |
2 | | -exodus.py v 1.21.3 (seacas-py3) is a python wrapper of some of the exodus library |
| 2 | +exodus.py v 1.21.4 (seacas-py3) is a python wrapper of some of the exodus library |
3 | 3 | (Python 3 Version) |
4 | 4 |
|
5 | 5 | Exodus is a common database for multiple application codes (mesh |
|
78 | 78 |
|
79 | 79 | EXODUS_PY_COPYRIGHT_AND_LICENSE = __doc__ |
80 | 80 |
|
81 | | -EXODUS_PY_VERSION = "1.21.3 (seacas-py3)" |
| 81 | +EXODUS_PY_VERSION = "1.21.4 (seacas-py3)" |
82 | 82 |
|
83 | 83 | EXODUS_PY_COPYRIGHT = """ |
84 | | -You are using exodus.py v 1.21.3 (seacas-py3), a python wrapper of some of the exodus library. |
| 84 | +You are using exodus.py v 1.21.4 (seacas-py3), a python wrapper of some of the exodus library. |
85 | 85 |
|
86 | 86 | Copyright (c) 2013-2023 National Technology & |
87 | 87 | Engineering Solutions of Sandia, LLC (NTESS). Under the terms of |
@@ -2354,7 +2354,7 @@ def get_variable_values_time(self, objType, entityId, var_name, start_step, end_ |
2354 | 2354 | objType : ex_entity_type |
2355 | 2355 | type of object being queried |
2356 | 2356 | entityid : ex_entity_id |
2357 | | - id of the entity (block, set) *ID* (not *INDEX*) |
| 2357 | + index/id of the entity (element, node) |
2358 | 2358 | var_name : string |
2359 | 2359 | name of variable |
2360 | 2360 | start_step : int |
@@ -2415,6 +2415,45 @@ def get_variable_values(self, objType, entityId, name, step): |
2415 | 2415 | values = ctype_to_numpy(self, values) |
2416 | 2416 | return values |
2417 | 2417 |
|
| 2418 | + def get_variable_values_multi_time(self, objType, entityId, name, begin_step, end_step): |
| 2419 | + """ |
| 2420 | + get list of `objType` variable values for a specified object id |
| 2421 | + block, variable name, and 1-based range of time steps |
| 2422 | +
|
| 2423 | + >>> evar_vals = exo.get_variable_values_multi_time('EX_ELEM_BLOCK', elem_blk_id, |
| 2424 | + ... evar_name, 1, 10) |
| 2425 | +
|
| 2426 | + Parameters |
| 2427 | + ---------- |
| 2428 | + objType : ex_entity_type |
| 2429 | + type of object being queried |
| 2430 | + entityid : ex_entity_id |
| 2431 | + id of the entity (block, set) *ID* (not *INDEX*) |
| 2432 | + name : string |
| 2433 | + name of variable |
| 2434 | + begin_step : int |
| 2435 | + 1-based index of time step at beginning of range |
| 2436 | + end_step : int |
| 2437 | + 1-based index of time step at end of range |
| 2438 | +
|
| 2439 | + Returns |
| 2440 | + ------- |
| 2441 | +
|
| 2442 | + if array_type == 'ctype': |
| 2443 | + <list<ctypes.c_double>> evar_vals |
| 2444 | +
|
| 2445 | + if array_type == 'numpy': |
| 2446 | + <np_array<double>> evar_vals |
| 2447 | + """ |
| 2448 | + names = self.get_variable_names(objType) |
| 2449 | + var_id = names.index(name) + 1 |
| 2450 | + numVals = self.get_entity_count(objType, entityId) |
| 2451 | + |
| 2452 | + values = self.__ex_get_var(begin_step, end_step, objType, var_id, entityId, numVals) |
| 2453 | + if self.use_numpy: |
| 2454 | + values = ctype_to_numpy(self, values) |
| 2455 | + return values |
| 2456 | + |
2418 | 2457 | def put_variable_values(self, objType, entityId, name, step, values): |
2419 | 2458 | """ |
2420 | 2459 | store a list of element variable values for a specified element |
@@ -5938,6 +5977,27 @@ def __ex_get_var(self, timeStep, varType, varId, blkId, numValues): |
5938 | 5977 | var_vals) |
5939 | 5978 | return var_vals |
5940 | 5979 |
|
| 5980 | + def __ex_get_var_multi_time(self, start_step, end_step, varType, varId, blkId, numValues): |
| 5981 | + s_step = ctypes.c_int(start_step) |
| 5982 | + e_step = ctypes.c_int(end_step) |
| 5983 | + var_type = ctypes.c_int(get_entity_type(varType)) |
| 5984 | + var_id = ctypes.c_int(varId) |
| 5985 | + block_id = ctypes.c_longlong(blkId) |
| 5986 | + num_values = ctypes.c_longlong(numValues) |
| 5987 | + num_steps = end_step - start_step + 1 |
| 5988 | + var_vals = (ctypes.c_double * num_values.value * num_steps)() |
| 5989 | + EXODUS_LIB.ex_get_var_multi_time( |
| 5990 | + self.fileId, |
| 5991 | + step, |
| 5992 | + var_type, |
| 5993 | + var_id, |
| 5994 | + block_id, |
| 5995 | + num_values, |
| 5996 | + s_step, |
| 5997 | + e_step, |
| 5998 | + var_vals) |
| 5999 | + return var_vals |
| 6000 | + |
5941 | 6001 | def __ex_get_var_time(self, varType, varId, entityID, start_step, end_step): |
5942 | 6002 | s_step = ctypes.c_int(start_step) |
5943 | 6003 | e_step = ctypes.c_int(end_step) |
|
0 commit comments