h2lib 13.1.304__py3-none-win_amd64.whl → 13.1.501__py3-none-win_amd64.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.
- h2lib/HAWC2Lib.dll +0 -0
- h2lib/_h2lib.py +185 -0
- h2lib/_version.py +3 -3
- h2lib/dll_wrapper.py +7 -7
- h2lib/h2lib_signatures.py +42 -0
- {h2lib-13.1.304.dist-info → h2lib-13.1.501.dist-info}/METADATA +2 -2
- h2lib-13.1.501.dist-info/RECORD +10 -0
- {h2lib-13.1.304.dist-info → h2lib-13.1.501.dist-info}/WHEEL +1 -1
- h2lib-13.1.304.dist-info/RECORD +0 -10
- {h2lib-13.1.304.dist-info → h2lib-13.1.501.dist-info}/top_level.txt +0 -0
h2lib/HAWC2Lib.dll
CHANGED
Binary file
|
h2lib/_h2lib.py
CHANGED
@@ -300,6 +300,191 @@ class H2LibThread(H2LibSignatures, DLLWrapper):
|
|
300
300
|
vx, vy, vz = self.get_rotor_avg_wsp(1, rotor)
|
301
301
|
return [vy, vx, -vz]
|
302
302
|
|
303
|
+
def init_static_solver(self):
|
304
|
+
"""
|
305
|
+
Initialize the static solver.
|
306
|
+
|
307
|
+
Raises
|
308
|
+
------
|
309
|
+
RuntimeError
|
310
|
+
If the static solver has already been initialized.
|
311
|
+
|
312
|
+
Returns
|
313
|
+
-------
|
314
|
+
None.
|
315
|
+
|
316
|
+
"""
|
317
|
+
error_code = H2LibSignatures.init_static_solver(self, restype=np.int64)[1]
|
318
|
+
if error_code > 0:
|
319
|
+
if error_code == 102:
|
320
|
+
raise RuntimeError("STATIC_SOLVER_ALREADY_INITIALIZED")
|
321
|
+
raise RuntimeError(error_code) # pragma: no cover
|
322
|
+
|
323
|
+
def get_number_of_bodies_and_constraints(self):
|
324
|
+
"""
|
325
|
+
Get number of bodies and constraints.
|
326
|
+
|
327
|
+
Raises
|
328
|
+
------
|
329
|
+
RuntimeError
|
330
|
+
If the structure is confidential.
|
331
|
+
|
332
|
+
Returns
|
333
|
+
-------
|
334
|
+
nbdy : int
|
335
|
+
Number of bodies.
|
336
|
+
ncst : int
|
337
|
+
Number of constraints.
|
338
|
+
|
339
|
+
"""
|
340
|
+
nbdy = -1
|
341
|
+
ncst = -1
|
342
|
+
error_code = -1
|
343
|
+
(
|
344
|
+
nbdy,
|
345
|
+
ncst,
|
346
|
+
error_code,
|
347
|
+
) = H2LibSignatures.get_number_of_bodies_and_constraints(
|
348
|
+
self, nbdy, ncst, error_code
|
349
|
+
)[
|
350
|
+
0
|
351
|
+
]
|
352
|
+
if error_code > 0:
|
353
|
+
if error_code == 4:
|
354
|
+
raise RuntimeError("STRUCTURE_IS_CONFIDENTIAL")
|
355
|
+
raise RuntimeError(error_code) # pragma: no cover
|
356
|
+
return nbdy, ncst
|
357
|
+
|
358
|
+
def get_number_of_elements(self):
|
359
|
+
"""
|
360
|
+
Get the number of elements for each body.
|
361
|
+
|
362
|
+
Raises
|
363
|
+
------
|
364
|
+
RuntimeError
|
365
|
+
If the structure is confidential.
|
366
|
+
|
367
|
+
Returns
|
368
|
+
-------
|
369
|
+
nelem : (nbdy) ndarray, int
|
370
|
+
Number of elements for each body.
|
371
|
+
|
372
|
+
"""
|
373
|
+
nbdy, _ = self.get_number_of_bodies_and_constraints()
|
374
|
+
|
375
|
+
nelem = np.zeros((nbdy, ), dtype=np.int64, order="F")
|
376
|
+
error_code = -1
|
377
|
+
_, nelem, error_code = H2LibSignatures.get_number_of_elements(
|
378
|
+
self, nbdy, nelem, error_code
|
379
|
+
)[0]
|
380
|
+
|
381
|
+
if error_code > 0:
|
382
|
+
if error_code == 4: # pragma: no cover
|
383
|
+
# This cannot happen because if the structure is confidential we will
|
384
|
+
# get this error from get_number_of_bodies_and_constraints().
|
385
|
+
raise RuntimeError("STRUCTURE_IS_CONFIDENTIAL") # pragma: no cover
|
386
|
+
elif error_code == 7: # pragma: no cover
|
387
|
+
# This cannot happen because we call get_number_of_bodies_and_constraints().
|
388
|
+
raise ValueError("WRONG_NUMBER_OF_BODIES") # pragma: no cover
|
389
|
+
raise RuntimeError(error_code) # pragma: no cover
|
390
|
+
return nelem
|
391
|
+
|
392
|
+
def get_timoshenko_location(self, ibdy, ielem):
|
393
|
+
"""
|
394
|
+
Get the location and orientation of an element.
|
395
|
+
|
396
|
+
Parameters
|
397
|
+
----------
|
398
|
+
ibdy : int
|
399
|
+
Body index, starting from 0.
|
400
|
+
ielem : int
|
401
|
+
Element index, starting from 0.
|
402
|
+
|
403
|
+
Raises
|
404
|
+
------
|
405
|
+
RuntimeError
|
406
|
+
If the structure is confidential.
|
407
|
+
IndexError
|
408
|
+
If the body or the element do not exist.
|
409
|
+
|
410
|
+
Returns
|
411
|
+
-------
|
412
|
+
l : float
|
413
|
+
Element length.
|
414
|
+
r1 : (3) ndarray
|
415
|
+
Location of node 1.
|
416
|
+
r12 : (3) ndarray
|
417
|
+
Vector from node 1 to node 2.
|
418
|
+
tes : (3, 3) ndarray
|
419
|
+
Transformation matrix describing orientation.
|
420
|
+
|
421
|
+
"""
|
422
|
+
|
423
|
+
l = 0.0
|
424
|
+
r1 = np.zeros((3), order="F")
|
425
|
+
r12 = np.zeros((3), order="F")
|
426
|
+
tes = np.zeros((3, 3), order="F")
|
427
|
+
error_code = -1
|
428
|
+
(
|
429
|
+
_,
|
430
|
+
_,
|
431
|
+
l,
|
432
|
+
r1,
|
433
|
+
r12,
|
434
|
+
tes,
|
435
|
+
error_code,
|
436
|
+
) = H2LibSignatures.get_timoshenko_location(
|
437
|
+
self, ibdy + 1, ielem + 1, l, r1, r12, tes, error_code
|
438
|
+
)[
|
439
|
+
0
|
440
|
+
]
|
441
|
+
if error_code > 0:
|
442
|
+
if error_code == 4:
|
443
|
+
raise RuntimeError("STRUCTURE_IS_CONFIDENTIAL")
|
444
|
+
elif error_code == 5:
|
445
|
+
raise IndexError("BODY_DOES_NOT_EXIST")
|
446
|
+
elif error_code == 6:
|
447
|
+
raise IndexError("ELEMENT_DOES_NOT_EXIST")
|
448
|
+
raise RuntimeError(error_code) # pragma: no cover
|
449
|
+
|
450
|
+
return l, r1, r12, tes
|
451
|
+
|
452
|
+
def get_body_rotation_tensor(self, ibdy):
|
453
|
+
"""
|
454
|
+
Get the rotation tensor of the requested body, that transforms from local to global base.
|
455
|
+
|
456
|
+
Parameters
|
457
|
+
----------
|
458
|
+
ibdy : int
|
459
|
+
Body index, starting from 0.
|
460
|
+
|
461
|
+
Raises
|
462
|
+
------
|
463
|
+
RuntimeError
|
464
|
+
If the structure is confidential.
|
465
|
+
IndexError
|
466
|
+
If the body does not exist.
|
467
|
+
|
468
|
+
Returns
|
469
|
+
-------
|
470
|
+
amat : (3, 3) ndarray
|
471
|
+
Rotation tensor.
|
472
|
+
|
473
|
+
"""
|
474
|
+
amat = np.zeros((3, 3), order="F")
|
475
|
+
error_code = -1
|
476
|
+
_, amat, error_code = H2LibSignatures.get_body_rotation_tensor(
|
477
|
+
self, ibdy + 1, amat, error_code
|
478
|
+
)[0]
|
479
|
+
if error_code > 0:
|
480
|
+
if error_code == 4:
|
481
|
+
raise RuntimeError("STRUCTURE_IS_CONFIDENTIAL")
|
482
|
+
elif error_code == 5:
|
483
|
+
raise IndexError("BODY_DOES_NOT_EXIST")
|
484
|
+
raise RuntimeError(error_code) # pragma: no cover
|
485
|
+
|
486
|
+
return amat
|
487
|
+
|
303
488
|
|
304
489
|
@contextmanager
|
305
490
|
def set_LD_LIBRARY_PATH():
|
h2lib/_version.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
# This file is autogenerated and should not be modified manually
|
2
|
-
__version__ = '13.1.
|
3
|
-
h2lib_version = '13.1.
|
4
|
-
hawc2_version = '13.1.
|
2
|
+
__version__ = '13.1.501'
|
3
|
+
h2lib_version = '13.1.501'
|
4
|
+
hawc2_version = '13.1.5+2-g1058cd2'
|
h2lib/dll_wrapper.py
CHANGED
@@ -8,6 +8,7 @@ import ctypes
|
|
8
8
|
from _ctypes import POINTER
|
9
9
|
from ctypes import c_int, c_double, c_char, c_char_p, c_long, c_longlong
|
10
10
|
from contextlib import contextmanager
|
11
|
+
import tempfile
|
11
12
|
try:
|
12
13
|
from ctypes import windll
|
13
14
|
except ImportError:
|
@@ -26,23 +27,20 @@ in_use = []
|
|
26
27
|
|
27
28
|
class SuppressStream(object):
|
28
29
|
|
29
|
-
def __init__(self, stream=sys.stderr):
|
30
|
+
def __init__(self, suppressed_output_file, stream=sys.stderr):
|
30
31
|
self.orig_stream_fileno = stream.fileno()
|
31
32
|
self.stream = stream
|
33
|
+
self.suppressed_output_file = suppressed_output_file
|
32
34
|
|
33
35
|
def __enter__(self):
|
34
36
|
# save stream file descriptor
|
35
37
|
self.orig_stream_dup = os.dup(self.orig_stream_fileno)
|
36
|
-
self.devnull = open(os.devnull, 'w')
|
37
38
|
self.stream.flush()
|
38
|
-
os.dup2(self.
|
39
|
+
os.dup2(self.suppressed_output_file.fileno(), self.orig_stream_fileno)
|
39
40
|
|
40
41
|
def __exit__(self, type, value, traceback):
|
41
|
-
os.close(self.orig_stream_fileno)
|
42
42
|
os.dup2(self.orig_stream_dup, self.orig_stream_fileno)
|
43
43
|
os.close(self.orig_stream_dup)
|
44
|
-
self.devnull.flush()
|
45
|
-
self.devnull.close()
|
46
44
|
|
47
45
|
|
48
46
|
def suppress_output(f):
|
@@ -124,7 +122,7 @@ def wrap(self, f, *args, **kwargs):
|
|
124
122
|
f.restype = restype
|
125
123
|
with chdir(self.cwd):
|
126
124
|
if self.suppress_output:
|
127
|
-
with SuppressStream(sys.stdout), SuppressStream(sys.stderr):
|
125
|
+
with SuppressStream(self.suppressed_output_file, sys.stdout), SuppressStream(self.suppressed_output_file, sys.stderr):
|
128
126
|
res = f(*c_args)
|
129
127
|
else:
|
130
128
|
res = f(*c_args)
|
@@ -152,6 +150,7 @@ class DLLWrapper(object):
|
|
152
150
|
self.cdecl = cdecl
|
153
151
|
self.fortran = fortran
|
154
152
|
self.suppress_output = False
|
153
|
+
self.suppressed_output_file = tempfile.TemporaryFile('w')
|
155
154
|
self.open()
|
156
155
|
in_use.append(os.path.abspath(self.filename))
|
157
156
|
atexit.register(self.close)
|
@@ -211,6 +210,7 @@ class DLLWrapper(object):
|
|
211
210
|
else:
|
212
211
|
_ctypes.dlclose(self.lib._handle)
|
213
212
|
del self.lib
|
213
|
+
self.suppressed_output_file.close()
|
214
214
|
atexit.unregister(self.close)
|
215
215
|
in_use.remove(os.path.abspath(self.filename))
|
216
216
|
|
h2lib/h2lib_signatures.py
CHANGED
@@ -98,6 +98,14 @@ END SUBROUTINE'''
|
|
98
98
|
end subroutine'''
|
99
99
|
return self.get_lib_function('get_bem_grid_dim')(rotor, nazi, nrad)
|
100
100
|
|
101
|
+
def get_body_rotation_tensor(self, ibdy, amat, error_code):
|
102
|
+
'''subroutine get_body_rotation_tensor(ibdy, amat, error_code) &
|
103
|
+
integer(kind=8), intent(in) :: ibdy
|
104
|
+
real(kind=c_double), dimension(3, 3), intent(out) :: amat
|
105
|
+
integer(kind=8), intent(out) :: error_code
|
106
|
+
end subroutine'''
|
107
|
+
return self.get_lib_function('get_body_rotation_tensor')(ibdy, amat, error_code)
|
108
|
+
|
101
109
|
def get_diameter(self, rotor, restype):
|
102
110
|
'''function get_diameter(rotor) bind(C, name="get_diameter")
|
103
111
|
!DEC$ ATTRIBUTES DLLEXPORT :: get_diameter
|
@@ -152,6 +160,22 @@ END SUBROUTINE'''
|
|
152
160
|
end function'''
|
153
161
|
return self.get_lib_function('get_nrotors')(restype=restype)
|
154
162
|
|
163
|
+
def get_number_of_bodies_and_constraints(self, nbdy, ncst, error_code):
|
164
|
+
'''subroutine get_number_of_bodies_and_constraints(nbdy, ncst, error_code) &
|
165
|
+
integer(kind=8), intent(out) :: nbdy
|
166
|
+
integer(kind=8), intent(out) :: ncst
|
167
|
+
integer(kind=8), intent(out) :: error_code
|
168
|
+
end subroutine'''
|
169
|
+
return self.get_lib_function('get_number_of_bodies_and_constraints')(nbdy, ncst, error_code)
|
170
|
+
|
171
|
+
def get_number_of_elements(self, nbdy, nelem, error_code):
|
172
|
+
'''subroutine get_number_of_elements(nbdy, nelem, error_code) &
|
173
|
+
integer(kind=8), intent(in) :: nbdy
|
174
|
+
integer(kind=8), dimension(nbdy), intent(out) :: nelem
|
175
|
+
integer(kind=8), intent(out) :: error_code
|
176
|
+
end subroutine'''
|
177
|
+
return self.get_lib_function('get_number_of_elements')(nbdy, nelem, error_code)
|
178
|
+
|
155
179
|
def get_rotor_avg_wsp(self, coo, rotor, wsp):
|
156
180
|
'''subroutine get_rotor_avg_wsp(coo, rotor, wsp) bind(C, name="get_rotor_avg_wsp")
|
157
181
|
integer*8, intent(in) :: rotor
|
@@ -199,6 +223,18 @@ END SUBROUTINE'''
|
|
199
223
|
subroutine'''
|
200
224
|
return self.get_lib_function('get_time')(time)
|
201
225
|
|
226
|
+
def get_timoshenko_location(self, ibdy, ielem, l, r1, r12, tes, error_code):
|
227
|
+
'''subroutine get_timoshenko_location(ibdy, ielem, l, r1, r12, tes, error_code) &
|
228
|
+
integer(kind=8), intent(in) :: ibdy
|
229
|
+
integer(kind=8), intent(in) :: ielem
|
230
|
+
real(kind=c_double), intent(out) :: l
|
231
|
+
real(kind=c_double), dimension(3), intent(out) :: r1
|
232
|
+
real(kind=c_double), dimension(3), intent(out) :: r12
|
233
|
+
real(kind=c_double), dimension(3,3), intent(out) :: tes
|
234
|
+
integer(kind=8), intent(out) :: error_code
|
235
|
+
end subroutine'''
|
236
|
+
return self.get_lib_function('get_timoshenko_location')(ibdy, ielem, l, r1, r12, tes, error_code)
|
237
|
+
|
202
238
|
def get_version(self, s):
|
203
239
|
'''subroutine get_version(s) BIND(C, NAME='get_version')
|
204
240
|
character(kind=c_char, len=1), intent(inout) :: s(255)
|
@@ -211,6 +247,12 @@ subroutine'''
|
|
211
247
|
end subroutine'''
|
212
248
|
return self.get_lib_function('init')()
|
213
249
|
|
250
|
+
def init_static_solver(self, restype):
|
251
|
+
'''function init_static_solver() result(error_code) &
|
252
|
+
!DEC$ ATTRIBUTES DLLEXPORT :: init_static_solver
|
253
|
+
end function'''
|
254
|
+
return self.get_lib_function('init_static_solver')(restype=restype)
|
255
|
+
|
214
256
|
def init_windfield(self, Nxyz, dxyz, box_offset_yz, transport_speed):
|
215
257
|
'''subroutine init_windfield(Nxyz, dxyz, box_offset_yz, transport_speed) bind(C, name="init_windfield")
|
216
258
|
integer*8, dimension(3), intent(in) :: Nxyz
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: h2lib
|
3
|
-
Version: 13.1.
|
4
|
-
Summary: Python interface to HAWC2 (13.1.
|
3
|
+
Version: 13.1.501
|
4
|
+
Summary: Python interface to HAWC2 (13.1.5+2-g1058cd2)
|
5
5
|
Download-URL:
|
6
6
|
Author: Mads M. Pedersen, S.G.Horcas and N.G.Ramos
|
7
7
|
Author-email: mmpe@dtu.dk
|
@@ -0,0 +1,10 @@
|
|
1
|
+
h2lib/HAWC2Lib.dll,sha256=-zboBoSlFNChFhH5b4bHnNY7lTLXyR43wyhen_0CmeE,30593024
|
2
|
+
h2lib/__init__.py,sha256=f3fO4I6IEFRM9LaV2O3w9Pioj3GPI8qRl7P5Tg5ONtE,528
|
3
|
+
h2lib/_h2lib.py,sha256=Qn_aULMG01aneh6rhdMa9H3BQFB7-OS8qa-6BIHeXK8,20411
|
4
|
+
h2lib/_version.py,sha256=LeCABlFq698V40Ol9KoFvS6ggkg8XSZinGRCToWiW9I,157
|
5
|
+
h2lib/dll_wrapper.py,sha256=RC5_gJ1cwHXVfUaSvmsatyQrvks-aZJFAiXrG4B-FEI,12061
|
6
|
+
h2lib/h2lib_signatures.py,sha256=j0TL8Zv6kX18F28X5cdzTlwQd1ZKiyg_zVBRqdOCPhY,16858
|
7
|
+
h2lib-13.1.501.dist-info/METADATA,sha256=6JMH55CMa6sR25SD2-0ACNyknVXAuGCv_jYJiCzpKVk,738
|
8
|
+
h2lib-13.1.501.dist-info/WHEEL,sha256=Z9NC-OvRBktQLUujjZiuac9jF_06CqbjTb-FqrCClNs,101
|
9
|
+
h2lib-13.1.501.dist-info/top_level.txt,sha256=y_a-tUqphEZQ_0nsWSMaSb21P8Lsd8hUxUdE9g2Dcbk,6
|
10
|
+
h2lib-13.1.501.dist-info/RECORD,,
|
h2lib-13.1.304.dist-info/RECORD
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
h2lib/HAWC2Lib.dll,sha256=KSsiNknsQ_PEfMkmpNKVUv7FAAiKo-nC_tVWEF9EOnc,29877248
|
2
|
-
h2lib/__init__.py,sha256=f3fO4I6IEFRM9LaV2O3w9Pioj3GPI8qRl7P5Tg5ONtE,528
|
3
|
-
h2lib/_h2lib.py,sha256=RBwI5FPkepo05pFSg50Go6i_ye9hthgmgSCm8k6DEyg,14990
|
4
|
-
h2lib/_version.py,sha256=iizTBXTu347A-uMlr6INY1FMuezX-9BSyagu6qZtgmk,146
|
5
|
-
h2lib/dll_wrapper.py,sha256=xQicDPnhK0Zgr3ifHX1peLJ6uwYZvXxLQAt9LIu45RY,11922
|
6
|
-
h2lib/h2lib_signatures.py,sha256=KO7HJzoy6GUXnkRt_VBbwa5_RVKZlLV1cKonHTMm2TQ,14732
|
7
|
-
h2lib-13.1.304.dist-info/METADATA,sha256=kNXLUUDqqpzPAM8g4isV3Th7UBwW7Fj17snXmZhz2C0,727
|
8
|
-
h2lib-13.1.304.dist-info/WHEEL,sha256=KNRoynpGu-d6mheJI-zfvcGl1iN-y8BewbiCDXsF3cY,101
|
9
|
-
h2lib-13.1.304.dist-info/top_level.txt,sha256=y_a-tUqphEZQ_0nsWSMaSb21P8Lsd8hUxUdE9g2Dcbk,6
|
10
|
-
h2lib-13.1.304.dist-info/RECORD,,
|
File without changes
|