cardiac-geometriesx 0.0.1__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 cardiac-geometriesx might be problematic. Click here for more details.

@@ -0,0 +1,875 @@
1
+ import math
2
+ from importlib.metadata import metadata
3
+ from pathlib import Path
4
+
5
+ import rich_click as click
6
+
7
+ from . import mesh
8
+
9
+
10
+ meta = metadata("cardiac-geometriesx")
11
+ __version__ = meta["Version"]
12
+ __author__ = meta["Author"]
13
+ __license__ = meta["License"]
14
+
15
+
16
+ @click.group()
17
+ @click.version_option(__version__, prog_name="cardiac_geometriesx")
18
+ def app():
19
+ """
20
+ Cardiac Geometries - A library for creating meshes of
21
+ cardiac geometries
22
+ """
23
+ pass
24
+
25
+
26
+ @click.command(help="Create LV ellipsoidal geometry")
27
+ @click.argument(
28
+ "outdir",
29
+ required=True,
30
+ type=click.Path(
31
+ file_okay=False,
32
+ dir_okay=True,
33
+ writable=True,
34
+ readable=True,
35
+ resolve_path=True,
36
+ ),
37
+ )
38
+ @click.option(
39
+ "--r-short-endo",
40
+ default=7.0,
41
+ type=float,
42
+ help="Shortest radius on the endocardium layer",
43
+ show_default=True,
44
+ )
45
+ @click.option(
46
+ "--r-short-epi",
47
+ default=10.0,
48
+ type=float,
49
+ help="Shortest radius on the epicardium layer",
50
+ show_default=True,
51
+ )
52
+ @click.option(
53
+ "--r-long-endo",
54
+ default=17.0,
55
+ type=float,
56
+ help="Longest radius on the endocardium layer",
57
+ show_default=True,
58
+ )
59
+ @click.option(
60
+ "--r-long-epi",
61
+ default=20.0,
62
+ type=float,
63
+ help="Longest radius on the epicardium layer",
64
+ show_default=True,
65
+ )
66
+ @click.option(
67
+ "--psize-ref",
68
+ default=3.0,
69
+ type=float,
70
+ help="The reference point size (smaller values yield as finer mesh",
71
+ show_default=True,
72
+ )
73
+ @click.option(
74
+ "--mu-apex-endo",
75
+ default=-math.pi,
76
+ type=float,
77
+ help="Angle for the endocardial apex",
78
+ show_default=True,
79
+ )
80
+ @click.option(
81
+ "--mu-base-endo",
82
+ default=-math.acos(5 / 17),
83
+ type=float,
84
+ help="Angle for the endocardial base",
85
+ show_default=True,
86
+ )
87
+ @click.option(
88
+ "--mu-apex-epi",
89
+ default=-math.pi,
90
+ type=float,
91
+ help="Angle for the epicardial apex",
92
+ show_default=True,
93
+ )
94
+ @click.option(
95
+ "--mu-base-epi",
96
+ default=-math.acos(5 / 20),
97
+ type=float,
98
+ help="Angle for the epicardial base",
99
+ show_default=True,
100
+ )
101
+ @click.option(
102
+ "--create-fibers",
103
+ default=False,
104
+ is_flag=True,
105
+ type=bool,
106
+ help="If True create analytic fibers",
107
+ show_default=True,
108
+ )
109
+ @click.option(
110
+ "--fiber-angle-endo",
111
+ default=-60,
112
+ type=float,
113
+ help="Angle for the endocardium",
114
+ show_default=True,
115
+ )
116
+ @click.option(
117
+ "--fiber-angle-epi",
118
+ default=+60,
119
+ type=float,
120
+ help="Angle for the epicardium",
121
+ show_default=True,
122
+ )
123
+ @click.option(
124
+ "--fiber-space",
125
+ default="P_1",
126
+ type=str,
127
+ help="Function space for fibers of the form family_degree",
128
+ show_default=True,
129
+ )
130
+ @click.option(
131
+ "--aha/--no-aha",
132
+ default=True,
133
+ is_flag=True,
134
+ type=bool,
135
+ help="If True create 17-segment AHA regions",
136
+ show_default=True,
137
+ )
138
+ def lv_ellipsoid(
139
+ outdir: Path,
140
+ r_short_endo: float = 7.0,
141
+ r_short_epi: float = 10.0,
142
+ r_long_endo: float = 17.0,
143
+ r_long_epi: float = 20.0,
144
+ psize_ref: float = 3,
145
+ mu_apex_endo: float = -math.pi,
146
+ mu_base_endo: float = -math.acos(5 / 17),
147
+ mu_apex_epi: float = -math.pi,
148
+ mu_base_epi: float = -math.acos(5 / 20),
149
+ create_fibers: bool = False,
150
+ fiber_angle_endo: float = -60,
151
+ fiber_angle_epi: float = +60,
152
+ fiber_space: str = "P_1",
153
+ aha: bool = True,
154
+ ):
155
+ outdir = Path(outdir)
156
+ outdir.mkdir(exist_ok=True)
157
+
158
+ geo = mesh.lv_ellipsoid(
159
+ outdir=outdir,
160
+ r_short_endo=r_short_endo,
161
+ r_short_epi=r_short_epi,
162
+ r_long_endo=r_long_endo,
163
+ r_long_epi=r_long_epi,
164
+ mu_base_endo=mu_base_endo,
165
+ mu_base_epi=mu_base_epi,
166
+ mu_apex_endo=mu_apex_endo,
167
+ mu_apex_epi=mu_apex_epi,
168
+ psize_ref=psize_ref,
169
+ create_fibers=create_fibers,
170
+ fiber_angle_endo=fiber_angle_endo,
171
+ fiber_angle_epi=fiber_angle_epi,
172
+ fiber_space=fiber_space,
173
+ aha=aha,
174
+ )
175
+ geo.save(outdir / "lv_ellipsoid.bp")
176
+
177
+
178
+ @click.command(help="Create BiV ellipsoidal geometry")
179
+ @click.argument(
180
+ "outdir",
181
+ required=True,
182
+ type=click.Path(
183
+ file_okay=False,
184
+ dir_okay=True,
185
+ writable=True,
186
+ readable=True,
187
+ resolve_path=True,
188
+ ),
189
+ )
190
+ @click.option(
191
+ "--char-length",
192
+ default=0.5,
193
+ type=float,
194
+ help="Characteristic length of mesh",
195
+ show_default=True,
196
+ )
197
+ @click.option(
198
+ "--center-lv-x",
199
+ default=0.0,
200
+ type=float,
201
+ help="X-coordinate for the center of the lv",
202
+ show_default=True,
203
+ )
204
+ @click.option(
205
+ "--center-lv-y",
206
+ default=0.0,
207
+ type=float,
208
+ help="Y-coordinate for the center of the lv",
209
+ show_default=True,
210
+ )
211
+ @click.option(
212
+ "--center-lv-z",
213
+ default=0.0,
214
+ type=float,
215
+ help="Z-coordinate for the center of the lv",
216
+ show_default=True,
217
+ )
218
+ @click.option(
219
+ "--a-endo-lv",
220
+ default=2.5,
221
+ type=float,
222
+ help="Dilation of lv endo ellipsoid in the x-direction",
223
+ show_default=True,
224
+ )
225
+ @click.option(
226
+ "--b-endo-lv",
227
+ default=1.0,
228
+ type=float,
229
+ help="Dilation of lv endo ellipsoid in the y-direction",
230
+ show_default=True,
231
+ )
232
+ @click.option(
233
+ "--c-endo-lv",
234
+ default=1.0,
235
+ type=float,
236
+ help="Dilation of lv endo ellipsoid in the y-direction",
237
+ show_default=True,
238
+ )
239
+ @click.option(
240
+ "--a-epi-lv",
241
+ default=3.0,
242
+ type=float,
243
+ help="Dilation of lv epi ellipsoid in the x-direction",
244
+ show_default=True,
245
+ )
246
+ @click.option(
247
+ "--b-epi-lv",
248
+ default=1.5,
249
+ type=float,
250
+ help="Dilation of lv epi ellipsoid in the y-direction",
251
+ show_default=True,
252
+ )
253
+ @click.option(
254
+ "--c-epi-lv",
255
+ default=1.5,
256
+ type=float,
257
+ help="Dilation of lv epi ellipsoid in the y-direction",
258
+ show_default=True,
259
+ )
260
+ @click.option(
261
+ "--center-rv-x",
262
+ default=0.0,
263
+ type=float,
264
+ help="X-coordinate for the center of the rv",
265
+ show_default=True,
266
+ )
267
+ @click.option(
268
+ "--center-rv-y",
269
+ default=0.5,
270
+ type=float,
271
+ help="Y-coordinate for the center of the rv",
272
+ show_default=True,
273
+ )
274
+ @click.option(
275
+ "--center-rv-z",
276
+ default=0.0,
277
+ type=float,
278
+ help="Z-coordinate for the center of the rv",
279
+ show_default=True,
280
+ )
281
+ @click.option(
282
+ "--a-endo-rv",
283
+ default=3.0,
284
+ type=float,
285
+ help="Dilation of rv endo ellipsoid in the x-direction",
286
+ show_default=True,
287
+ )
288
+ @click.option(
289
+ "--b-endo-rv",
290
+ default=1.5,
291
+ type=float,
292
+ help="Dilation of rv endo ellipsoid in the y-direction",
293
+ show_default=True,
294
+ )
295
+ @click.option(
296
+ "--c-endo-rv",
297
+ default=1.5,
298
+ type=float,
299
+ help="Dilation of rv endo ellipsoid in the y-direction",
300
+ show_default=True,
301
+ )
302
+ @click.option(
303
+ "--a-epi-rv",
304
+ default=4.0,
305
+ type=float,
306
+ help="Dilation of rv epi ellipsoid in the x-direction",
307
+ show_default=True,
308
+ )
309
+ @click.option(
310
+ "--b-epi-rv",
311
+ default=2.5,
312
+ type=float,
313
+ help="Dilation of rv epi ellipsoid in the y-direction",
314
+ show_default=True,
315
+ )
316
+ @click.option(
317
+ "--c-epi-rv",
318
+ default=2.0,
319
+ type=float,
320
+ help="Dilation of rv epi ellipsoid in the z-direction",
321
+ show_default=True,
322
+ )
323
+ @click.option(
324
+ "--create-fibers",
325
+ default=False,
326
+ is_flag=True,
327
+ type=bool,
328
+ help="If True create analytic fibers",
329
+ show_default=True,
330
+ )
331
+ @click.option(
332
+ "--fiber-angle-endo",
333
+ default=-60,
334
+ type=float,
335
+ help="Angle for the endocardium",
336
+ show_default=True,
337
+ )
338
+ @click.option(
339
+ "--fiber-angle-epi",
340
+ default=+60,
341
+ type=float,
342
+ help="Angle for the epicardium",
343
+ show_default=True,
344
+ )
345
+ @click.option(
346
+ "--fiber-space",
347
+ default="P_1",
348
+ type=str,
349
+ help="Function space for fibers of the form family_degree",
350
+ show_default=True,
351
+ )
352
+ def biv_ellipsoid(
353
+ outdir: Path,
354
+ char_length: float = 0.5,
355
+ center_lv_x: float = 0.0,
356
+ center_lv_y: float = 0.0,
357
+ center_lv_z: float = 0.0,
358
+ a_endo_lv: float = 2.5,
359
+ b_endo_lv: float = 1.0,
360
+ c_endo_lv: float = 1.0,
361
+ a_epi_lv: float = 3.0,
362
+ b_epi_lv: float = 1.5,
363
+ c_epi_lv: float = 1.5,
364
+ center_rv_x: float = 0.0,
365
+ center_rv_y: float = 0.5,
366
+ center_rv_z: float = 0.0,
367
+ a_endo_rv: float = 3.0,
368
+ b_endo_rv: float = 1.5,
369
+ c_endo_rv: float = 1.5,
370
+ a_epi_rv: float = 4.0,
371
+ b_epi_rv: float = 2.5,
372
+ c_epi_rv: float = 2.0,
373
+ create_fibers: bool = False,
374
+ fiber_angle_endo: float = -60,
375
+ fiber_angle_epi: float = +60,
376
+ fiber_space: str = "P_1",
377
+ ):
378
+ outdir = Path(outdir)
379
+ outdir.mkdir(exist_ok=True)
380
+
381
+ geo = mesh.biv_ellipsoid(
382
+ outdir=outdir,
383
+ char_length=char_length,
384
+ center_lv_y=center_lv_y,
385
+ center_lv_z=center_lv_z,
386
+ a_endo_lv=a_endo_lv,
387
+ b_endo_lv=b_endo_lv,
388
+ c_endo_lv=c_endo_lv,
389
+ a_epi_lv=a_epi_lv,
390
+ b_epi_lv=b_epi_lv,
391
+ c_epi_lv=c_epi_lv,
392
+ center_rv_y=center_rv_y,
393
+ center_rv_z=center_rv_z,
394
+ a_endo_rv=a_endo_rv,
395
+ b_endo_rv=b_endo_rv,
396
+ c_endo_rv=c_endo_rv,
397
+ a_epi_rv=a_epi_rv,
398
+ b_epi_rv=b_epi_rv,
399
+ c_epi_rv=c_epi_rv,
400
+ create_fibers=create_fibers,
401
+ fiber_angle_endo=fiber_angle_endo,
402
+ fiber_angle_epi=fiber_angle_epi,
403
+ fiber_space=fiber_space,
404
+ )
405
+ geo.save(outdir / "biv_ellipsoid.bp")
406
+
407
+
408
+ @click.command(help="Create BiV ellipsoidal geometry embedded in a torso")
409
+ @click.argument(
410
+ "outdir",
411
+ required=True,
412
+ type=click.Path(
413
+ file_okay=False,
414
+ dir_okay=True,
415
+ writable=True,
416
+ readable=True,
417
+ resolve_path=True,
418
+ ),
419
+ )
420
+ @click.option(
421
+ "--char-length",
422
+ default=0.5,
423
+ type=float,
424
+ help="Characteristic length of mesh",
425
+ show_default=True,
426
+ )
427
+ @click.option(
428
+ "--heart-as-surface/--heart-as-volume",
429
+ default=False,
430
+ help="Whether the heart should be a surface of a volume inside the torso",
431
+ show_default=True,
432
+ )
433
+ @click.option(
434
+ "--torso-length",
435
+ default=20,
436
+ type=float,
437
+ help="Length of torso in the x-direction",
438
+ show_default=True,
439
+ )
440
+ @click.option(
441
+ "--torso-width",
442
+ default=20,
443
+ type=float,
444
+ help="Length of torso in the y-direction",
445
+ show_default=True,
446
+ )
447
+ @click.option(
448
+ "--torso-height",
449
+ default=20,
450
+ type=float,
451
+ help="Length of torso in the z-direction",
452
+ show_default=True,
453
+ )
454
+ @click.option(
455
+ "--rotation-angle",
456
+ default=math.pi / 6,
457
+ type=float,
458
+ help=(
459
+ "Angle to rotate the torso in order to object realistic" " position of the heart in a torso"
460
+ ),
461
+ show_default=True,
462
+ )
463
+ @click.option(
464
+ "--center-lv-x",
465
+ default=0.0,
466
+ type=float,
467
+ help="X-coordinate for the center of the lv",
468
+ show_default=True,
469
+ )
470
+ @click.option(
471
+ "--center-lv-y",
472
+ default=0.0,
473
+ type=float,
474
+ help="Y-coordinate for the center of the lv",
475
+ show_default=True,
476
+ )
477
+ @click.option(
478
+ "--center-lv-z",
479
+ default=0.0,
480
+ type=float,
481
+ help="Z-coordinate for the center of the lv",
482
+ show_default=True,
483
+ )
484
+ @click.option(
485
+ "--a-endo-lv",
486
+ default=2.5,
487
+ type=float,
488
+ help="Dilation of lv endo ellipsoid in the x-direction",
489
+ show_default=True,
490
+ )
491
+ @click.option(
492
+ "--b-endo-lv",
493
+ default=1.0,
494
+ type=float,
495
+ help="Dilation of lv endo ellipsoid in the y-direction",
496
+ show_default=True,
497
+ )
498
+ @click.option(
499
+ "--c-endo-lv",
500
+ default=1.0,
501
+ type=float,
502
+ help="Dilation of lv endo ellipsoid in the y-direction",
503
+ show_default=True,
504
+ )
505
+ @click.option(
506
+ "--a-epi-lv",
507
+ default=3.0,
508
+ type=float,
509
+ help="Dilation of lv epi ellipsoid in the x-direction",
510
+ show_default=True,
511
+ )
512
+ @click.option(
513
+ "--b-epi-lv",
514
+ default=1.5,
515
+ type=float,
516
+ help="Dilation of lv epi ellipsoid in the y-direction",
517
+ show_default=True,
518
+ )
519
+ @click.option(
520
+ "--c-epi-lv",
521
+ default=1.5,
522
+ type=float,
523
+ help="Dilation of lv epi ellipsoid in the y-direction",
524
+ show_default=True,
525
+ )
526
+ @click.option(
527
+ "--center-rv-x",
528
+ default=0.0,
529
+ type=float,
530
+ help="X-coordinate for the center of the rv",
531
+ show_default=True,
532
+ )
533
+ @click.option(
534
+ "--center-rv-y",
535
+ default=0.5,
536
+ type=float,
537
+ help="Y-coordinate for the center of the rv",
538
+ show_default=True,
539
+ )
540
+ @click.option(
541
+ "--center-rv-z",
542
+ default=0.0,
543
+ type=float,
544
+ help="Z-coordinate for the center of the rv",
545
+ show_default=True,
546
+ )
547
+ @click.option(
548
+ "--a-endo-rv",
549
+ default=3.0,
550
+ type=float,
551
+ help="Dilation of rv endo ellipsoid in the x-direction",
552
+ show_default=True,
553
+ )
554
+ @click.option(
555
+ "--b-endo-rv",
556
+ default=1.5,
557
+ type=float,
558
+ help="Dilation of rv endo ellipsoid in the y-direction",
559
+ show_default=True,
560
+ )
561
+ @click.option(
562
+ "--c-endo-rv",
563
+ default=1.5,
564
+ type=float,
565
+ help="Dilation of rv endo ellipsoid in the y-direction",
566
+ show_default=True,
567
+ )
568
+ @click.option(
569
+ "--a-epi-rv",
570
+ default=4.0,
571
+ type=float,
572
+ help="Dilation of rv epi ellipsoid in the x-direction",
573
+ show_default=True,
574
+ )
575
+ @click.option(
576
+ "--b-epi-rv",
577
+ default=2.5,
578
+ type=float,
579
+ help="Dilation of rv epi ellipsoid in the y-direction",
580
+ show_default=True,
581
+ )
582
+ @click.option(
583
+ "--c-epi-rv",
584
+ default=2.0,
585
+ type=float,
586
+ help="Dilation of rv epi ellipsoid in the z-direction",
587
+ show_default=True,
588
+ )
589
+ @click.option(
590
+ "--create-fibers",
591
+ default=False,
592
+ is_flag=True,
593
+ type=bool,
594
+ help="If True create analytic fibers",
595
+ show_default=True,
596
+ )
597
+ @click.option(
598
+ "--fiber-angle-endo",
599
+ default=-60,
600
+ type=float,
601
+ help="Angle for the endocardium",
602
+ show_default=True,
603
+ )
604
+ @click.option(
605
+ "--fiber-angle-epi",
606
+ default=+60,
607
+ type=float,
608
+ help="Angle for the epicardium",
609
+ show_default=True,
610
+ )
611
+ @click.option(
612
+ "--fiber-space",
613
+ default="P_1",
614
+ type=str,
615
+ help="Function space for fibers of the form family_degree",
616
+ show_default=True,
617
+ )
618
+ def biv_ellipsoid_torso(
619
+ outdir: Path,
620
+ char_length: float = 0.5,
621
+ heart_as_surface: bool = True,
622
+ torso_length: float = 20.0,
623
+ torso_width: float = 20.0,
624
+ torso_height: float = 20.0,
625
+ rotation_angle: float = math.pi / 6,
626
+ center_lv_x: float = 0.0,
627
+ center_lv_y: float = 0.0,
628
+ center_lv_z: float = 0.0,
629
+ a_endo_lv: float = 2.5,
630
+ b_endo_lv: float = 1.0,
631
+ c_endo_lv: float = 1.0,
632
+ a_epi_lv: float = 3.0,
633
+ b_epi_lv: float = 1.5,
634
+ c_epi_lv: float = 1.5,
635
+ center_rv_x: float = 0.0,
636
+ center_rv_y: float = 0.5,
637
+ center_rv_z: float = 0.0,
638
+ a_endo_rv: float = 3.0,
639
+ b_endo_rv: float = 1.5,
640
+ c_endo_rv: float = 1.5,
641
+ a_epi_rv: float = 4.0,
642
+ b_epi_rv: float = 2.5,
643
+ c_epi_rv: float = 2.0,
644
+ create_fibers: bool = False,
645
+ fiber_angle_endo: float = -60,
646
+ fiber_angle_epi: float = +60,
647
+ fiber_space: str = "P_1",
648
+ ):
649
+ outdir = Path(outdir)
650
+ outdir.mkdir(exist_ok=True)
651
+
652
+ geo = mesh.biv_ellipsoid_torso(
653
+ outdir=outdir,
654
+ char_length=char_length,
655
+ heart_as_surface=heart_as_surface,
656
+ torso_length=torso_length,
657
+ torso_height=torso_height,
658
+ torso_width=torso_width,
659
+ rotation_angle=rotation_angle,
660
+ center_lv_x=center_lv_x,
661
+ center_lv_y=center_lv_y,
662
+ center_lv_z=center_lv_z,
663
+ a_endo_lv=a_endo_lv,
664
+ b_endo_lv=b_endo_lv,
665
+ c_endo_lv=c_endo_lv,
666
+ a_epi_lv=a_epi_lv,
667
+ b_epi_lv=b_epi_lv,
668
+ c_epi_lv=c_epi_lv,
669
+ center_rv_x=center_rv_x,
670
+ center_rv_y=center_rv_y,
671
+ center_rv_z=center_rv_z,
672
+ a_endo_rv=a_endo_rv,
673
+ b_endo_rv=b_endo_rv,
674
+ c_endo_rv=c_endo_rv,
675
+ a_epi_rv=a_epi_rv,
676
+ b_epi_rv=b_epi_rv,
677
+ c_epi_rv=c_epi_rv,
678
+ create_fibers=create_fibers,
679
+ fiber_angle_endo=fiber_angle_endo,
680
+ fiber_angle_epi=fiber_angle_epi,
681
+ fiber_space=fiber_space,
682
+ )
683
+
684
+ geo.save(outdir / "biv_ellipsoid_torso.bp")
685
+
686
+
687
+ @click.command(help="Create slab geometry")
688
+ @click.argument(
689
+ "outdir",
690
+ required=True,
691
+ type=click.Path(
692
+ file_okay=False,
693
+ dir_okay=True,
694
+ writable=True,
695
+ readable=True,
696
+ resolve_path=True,
697
+ ),
698
+ )
699
+ @click.option(
700
+ "--lx",
701
+ default=20.0,
702
+ type=float,
703
+ help="Length of slab in the x-direction",
704
+ show_default=True,
705
+ )
706
+ @click.option(
707
+ "--ly",
708
+ default=7.0,
709
+ type=float,
710
+ help="Length of slab in the y-direction",
711
+ show_default=True,
712
+ )
713
+ @click.option(
714
+ "--lz",
715
+ default=1.0,
716
+ type=float,
717
+ help="Length of slab in the z-direction",
718
+ show_default=True,
719
+ )
720
+ @click.option(
721
+ "--dx",
722
+ default=1.0,
723
+ type=float,
724
+ help="Element size",
725
+ show_default=True,
726
+ )
727
+ @click.option(
728
+ "--create-fibers",
729
+ default=False,
730
+ is_flag=True,
731
+ type=bool,
732
+ help="If True create analytic fibers",
733
+ show_default=True,
734
+ )
735
+ @click.option(
736
+ "--fiber-angle-endo",
737
+ default=-60,
738
+ type=float,
739
+ help="Angle for the endocardium",
740
+ show_default=True,
741
+ )
742
+ @click.option(
743
+ "--fiber-angle-epi",
744
+ default=+60,
745
+ type=float,
746
+ help="Angle for the epicardium",
747
+ show_default=True,
748
+ )
749
+ @click.option(
750
+ "--fiber-space",
751
+ default="P_1",
752
+ type=str,
753
+ help="Function space for fibers of the form family_degree",
754
+ show_default=True,
755
+ )
756
+ def slab(
757
+ outdir: Path,
758
+ lx: float = 20.0,
759
+ ly: float = 7.0,
760
+ lz: float = 3.0,
761
+ dx: float = 1.0,
762
+ create_fibers: bool = True,
763
+ fiber_angle_endo: float = -60,
764
+ fiber_angle_epi: float = +60,
765
+ fiber_space: str = "P_1",
766
+ ):
767
+ outdir = Path(outdir)
768
+ outdir.mkdir(exist_ok=True)
769
+
770
+ geo = mesh.slab(
771
+ outdir=outdir,
772
+ lx=lx,
773
+ ly=ly,
774
+ lz=lz,
775
+ dx=dx,
776
+ create_fibers=create_fibers,
777
+ fiber_angle_endo=fiber_angle_endo,
778
+ fiber_angle_epi=fiber_angle_epi,
779
+ fiber_space=fiber_space,
780
+ )
781
+ geo.save(outdir / "slab.bp")
782
+
783
+
784
+ @click.command(help="Create slab in bath geometry")
785
+ @click.argument(
786
+ "outdir",
787
+ required=True,
788
+ type=click.Path(
789
+ file_okay=False,
790
+ dir_okay=True,
791
+ writable=True,
792
+ readable=True,
793
+ resolve_path=True,
794
+ ),
795
+ )
796
+ @click.option(
797
+ "--lx",
798
+ default=1.0,
799
+ type=float,
800
+ help="Length of slab in the x-direction",
801
+ show_default=True,
802
+ )
803
+ @click.option(
804
+ "--ly",
805
+ default=0.01,
806
+ type=float,
807
+ help="Length of slab in the y-direction",
808
+ show_default=True,
809
+ )
810
+ @click.option(
811
+ "--lz",
812
+ default=0.5,
813
+ type=float,
814
+ help="Length of slab in the z-direction",
815
+ show_default=True,
816
+ )
817
+ @click.option(
818
+ "--bx",
819
+ default=0.0,
820
+ type=float,
821
+ help="Thickness of bath in the x-direction",
822
+ show_default=True,
823
+ )
824
+ @click.option(
825
+ "--by",
826
+ default=0.0,
827
+ type=float,
828
+ help="Thickness of bath in the y-direction",
829
+ show_default=True,
830
+ )
831
+ @click.option(
832
+ "--bz",
833
+ default=0.1,
834
+ type=float,
835
+ help="Thickness of bath in the z-direction",
836
+ show_default=True,
837
+ )
838
+ @click.option(
839
+ "--dx",
840
+ default=0.01,
841
+ type=float,
842
+ help="Element size",
843
+ show_default=True,
844
+ )
845
+ def slab_in_bath(
846
+ outdir: Path,
847
+ lx: float = 1.0,
848
+ ly: float = 0.01,
849
+ lz: float = 0.5,
850
+ bx: float = 0.0,
851
+ by: float = 0.0,
852
+ bz: float = 0.1,
853
+ dx: float = 0.01,
854
+ ):
855
+ outdir = Path(outdir)
856
+ outdir.mkdir(exist_ok=True)
857
+
858
+ geo = mesh.slab_in_bath(
859
+ outdir=outdir,
860
+ lx=lx,
861
+ ly=ly,
862
+ lz=lz,
863
+ bx=bx,
864
+ by=by,
865
+ bz=bz,
866
+ dx=dx,
867
+ )
868
+ geo.save(outdir / "slab_in_bath.bp")
869
+
870
+
871
+ app.add_command(lv_ellipsoid)
872
+ app.add_command(biv_ellipsoid)
873
+ app.add_command(biv_ellipsoid_torso)
874
+ app.add_command(slab)
875
+ app.add_command(slab_in_bath)