Skip to content

Commit 3473dd2

Browse files
authored
Merge pull request #32 from zasexton/main
simplifying imports and improving face extraction
2 parents d1b9c50 + ec967f6 commit 3473dd2

29 files changed

+2120
-267
lines changed

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,17 @@ svZeroDSolver*
2727

2828
# Sample artifacts
2929
cube.dmn
30+
31+
# Local GUI docs and scripts (ignored)
32+
CAD_GUI_DOCUMENTATION.md
33+
CAD_GUI_SUMMARY.md
34+
FIX_LLVM_MISMATCH.sh
35+
GUI_FEATURES.md
36+
GUI_IMPROVEMENTS.md
37+
GUI_QUICK_START.md
38+
GUI_UPGRADE_SUMMARY.md
39+
OPENGL_FIX_SUMMARY.md
40+
OPENGL_TROUBLESHOOTING.md
41+
STYLE_COMPARISON.md
42+
UBUNTU_20.04_SETUP.md
43+
launch_gui_system_mesa.sh

docs/api/domain.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ <h1><code>svv.domain.Domain</code></h1>
6868
<h2>Quick Example</h2>
6969
<pre data-copy><code class="language-python">import numpy as np
7070
import pyvista as pv
71-
from svv.domain import Domain
71+
from svv.domain.domain import Domain
7272

7373
# Create domain from PyVista mesh
7474
mesh = pv.read('vessel_geometry.stl')
@@ -460,7 +460,7 @@ <h2>Examples</h2>
460460
<div class="api-example">
461461
<h3>Creating a Domain from STL File</h3>
462462
<pre data-copy><code class="language-python">import pyvista as pv
463-
from svv.domain import Domain
463+
from svv.domain.domain import Domain
464464

465465
# Load STL file
466466
mesh = pv.read('vessel.stl')
@@ -559,8 +559,8 @@ <h2>Notes</h2>
559559
<h2>See Also</h2>
560560
<ul>
561561
<li><a href="patch.html"><code>svv.domain.Patch</code></a> - Individual patch for RBF interpolation</li>
562-
<li><a href="../tree/tree.html"><code>svv.tree.Tree</code></a> - Vascular tree generation using domains</li>
563-
<li><a href="../forest/forest.html"><code>svv.forest.Forest</code></a> - Collection of trees within a domain</li>
562+
<li><a href="tree.html"><code>svv.tree.Tree</code></a> - Vascular tree generation using domains</li>
563+
<li><a href="forest.html"><code>svv.forest.Forest</code></a> - Collection of trees within a domain</li>
564564
</ul>
565565
</section>
566566
</main>

docs/api/forest.html

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ <h1><code>svv.forest.Forest</code></h1>
6666
<!-- Quick Example -->
6767
<div class="api-quick-example">
6868
<h2>Quick Example</h2>
69-
<pre data-copy><code class="language-python">from svv.forest import Forest
70-
from svv.domain import Domain
69+
<pre data-copy><code class="language-python">from svv.forest.forest import Forest
70+
from svv.domain.domain import Domain
7171
import numpy as np
7272
import pyvista as pv
7373

@@ -394,9 +394,10 @@ <h2>Examples</h2>
394394

395395
<div class="api-example">
396396
<h3>Arterial-Venous Network</h3>
397-
<pre data-copy><code class="language-python">from svv.forest import Forest
398-
from svv.domain import Domain
397+
<pre data-copy><code class="language-python">from svv.forest.forest import Forest
398+
from svv.domain.domain import Domain
399399
import numpy as np
400+
import pyvista as pv
400401

401402
# Create organ domain
402403
organ = pv.read('liver.stl')
@@ -438,7 +439,9 @@ <h3>Arterial-Venous Network</h3>
438439

439440
<div class="api-example">
440441
<h3>Multi-Tree Network with Connections</h3>
441-
<pre data-copy><code class="language-python"># Create forest with multiple trees per network
442+
<pre data-copy><code class="language-python">from svv.forest.forest import Forest
443+
import numpy as np
444+
# Create forest with multiple trees per network
442445
forest = Forest(
443446
n_networks=1,
444447
n_trees_per_network=[4], # 4 trees in single network
@@ -468,13 +471,17 @@ <h3>Multi-Tree Network with Connections</h3>
468471
if forest.connections:
469472
print(f"Tree connections solved: {len(forest.connections.tree_connections)}")
470473

471-
# Export connected network
472-
forest.export_solid(outdir='connected_network')</code></pre>
474+
# Export connected network: save each tree as STL
475+
for i in range(forest.n_networks):
476+
for j in range(forest.n_trees_per_network[i]):
477+
model = forest.networks[i][j].export_solid(watertight=True)
478+
model.save(f'connected_network_{i}_{j}.stl')</code></pre>
473479
</div>
474480

475481
<div class="api-example">
476482
<h3>Competitive Growth Pattern</h3>
477483
<pre data-copy><code class="language-python"># Enable competition between networks
484+
from svv.forest.forest import Forest
478485
import numpy as np
479486
forest = Forest(
480487
domain=domain,

docs/api/index_api.html

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ <h2>Quick Start</h2>
8585
8686
<h3>Basic Import</h3>
8787
<pre data-copy><code class="language-python">import svv
88-
from svv.domain import Domain
89-
from svv.forest import Forest
90-
from svv.tree import Tree
91-
from svv.simulation import Simulation
88+
from svv.domain.domain import Domain
89+
from svv.forest.forest import Forest
90+
from svv.tree.tree import Tree
91+
from svv.simulation.simulation import Simulation
9292
9393
# Create a domain
9494
domain = Domain()
@@ -190,7 +190,7 @@ <h4>Main Classes</h4>
190190
</div>
191191
<div class="api-example">
192192
<h4>Example Usage</h4>
193-
<pre data-copy><code class="language-python">from svv.domain import Domain
193+
<pre data-copy><code class="language-python">from svv.domain.domain import Domain
194194

195195
# Create a domain from a mesh
196196
import pyvista as pv
@@ -268,8 +268,8 @@ <h4>Main Classes</h4>
268268
<div class="api-example">
269269
<h4>Example Usage</h4>
270270
<pre data-copy><code class="language-python">import pyvista as pv
271-
from svv.domain import Domain
272-
from svv.forest import Forest
271+
from svv.domain.domain import Domain
272+
from svv.forest.forest import Forest
273273

274274
# Prepare a domain and build its implicit representation
275275
domain = Domain(pv.Cube())
@@ -399,7 +399,7 @@ <h4>Main Classes</h4>
399399

400400
<div class="api-example">
401401
<h4>Example Usage</h4>
402-
<pre data-copy><code class="language-python">from svv.simulation import Simulation
402+
<pre data-copy><code class="language-python">from svv.simulation.simulation import Simulation
403403
from svv.simulation.fluid.rom.zero_d.zerod_tree import export_0d_simulation
404404

405405
# Wrap a generated tree in a Simulation container
@@ -490,8 +490,8 @@ <h2>Common Examples</h2>
490490
<div class="api-example-card">
491491
<h3>Generate a Vascular Tree</h3>
492492
<pre data-copy><code class="language-python">import pyvista as pv
493-
from svv.domain import Domain
494-
from svv.tree import Tree
493+
from svv.domain.domain import Domain
494+
from svv.tree.tree import Tree
495495

496496
domain = Domain(pv.Cube())
497497
domain.create()
@@ -504,7 +504,8 @@ <h3>Generate a Vascular Tree</h3>
504504
tree.n_add(100)
505505

506506
# Export watertight geometry for printing or meshing
507-
tree.export_solid(outdir='vascular_tree')</code></pre>
507+
solid_model = tree.export_solid(watertight=True)
508+
solid_model.save('vascular_tree.stl')</code></pre>
508509
</div>
509510

510511
<div class="api-example-card">

docs/api/simulation.html

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ <h1><code>svv.simulation.Simulation</code></h1>
6868
<!-- Quick Example -->
6969
<div class="api-quick-example">
7070
<h2>Quick Example</h2>
71-
<pre data-copy><code class="language-python">from svv.simulation import Simulation
72-
from svv.tree import Tree
71+
<pre data-copy><code class="language-python">from svv.simulation.simulation import Simulation
72+
# Assumes `tree` is an existing svv.tree.Tree built as in the Quickstart
7373

7474
# Create simulation from tree
7575
sim = Simulation(tree, name="coronary_sim", directory="./simulations")
@@ -425,9 +425,9 @@ <h2>Examples</h2>
425425

426426
<div class="api-example">
427427
<h3>Complete 3D CFD Simulation Setup</h3>
428-
<pre data-copy><code class="language-python">from svv.simulation import Simulation
429-
from svv.tree import Tree
430-
from svv.domain import Domain
428+
<pre data-copy><code class="language-python">from svv.simulation.simulation import Simulation
429+
from svv.tree.tree import Tree
430+
from svv.domain.domain import Domain
431431
import pyvista as pv
432432

433433
# Generate vascular tree
@@ -492,7 +492,8 @@ <h3>Multi-Scale Simulation (3D + 1D)</h3>
492492

493493
# Write both simulations
494494
sim.write_3d_fluid_simulation()
495-
sim.write_1d_fluid_simulation()
495+
# Note: writing 1-D files is not yet automated.
496+
# Use the returned centerlines/mesh/params to invoke the SimVascular 1-D tools.
496497

497498
# Access centerlines for coupling
498499
centerlines = sim.fluid_1d_simulations[0][0]

docs/api/tree.html

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ <h1><code>svv.tree.Tree</code></h1>
6666
<!-- Quick Example -->
6767
<div class="api-quick-example">
6868
<h2>Quick Example</h2>
69-
<pre data-copy><code class="language-python">from svv.tree import Tree
70-
from svv.domain import Domain
69+
<pre data-copy><code class="language-python">from svv.tree.tree import Tree
70+
from svv.domain.domain import Domain
7171
import pyvista as pv
7272

7373
# Create domain from mesh
@@ -397,8 +397,8 @@ <h2>Examples</h2>
397397

398398
<div class="api-example">
399399
<h3>Basic Tree Generation</h3>
400-
<pre data-copy><code class="language-python">from svv.tree import Tree
401-
from svv.domain import Domain
400+
<pre data-copy><code class="language-python">from svv.tree.tree import Tree
401+
from svv.domain.domain import Domain
402402
import numpy as np
403403
import pyvista as pv
404404

@@ -457,7 +457,8 @@ <h3>Constrained Growth with Physical Clearance</h3>
457457

458458
<div class="api-example">
459459
<h3>Export for Simulation</h3>
460-
<pre data-copy><code class="language-python"># Generate tree
460+
<pre data-copy><code class="language-python">import numpy as np
461+
# Generate tree
461462
tree = Tree()
462463
tree.set_domain(domain)
463464
tree.set_root([0, 0, 0])
@@ -509,7 +510,8 @@ <h2>Performance Considerations</h2>
509510

510511
<h3>Timing Analysis</h3>
511512
<p>Access detailed timing information through the <code>times</code> attribute:</p>
512-
<pre data-copy><code class="language-python"># After growing tree
513+
<pre data-copy><code class="language-python"># After growing tree
514+
import numpy as np
513515
import pandas as pd
514516

515517
# Convert timing data to DataFrame

svv/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.0.33"
1+
__version__ = "0.0.34"
22

33
# If the optional companion package with compiled accelerators is installed
44
# (svv-accelerated), prefer those modules transparently by aliasing them into

svv/simulation/boundary_conditions.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ def __str__(self):
1616
return str(vars(self))
1717

1818
def __repr__(self):
19-
return str(vars(self))
19+
try:
20+
return self.toxml().toprettyxml(indent=" ")
21+
except Exception:
22+
return str(vars(self))
2023

2124
def __eq__(self, other):
2225
check = ["bc_type", "value", "time_varying", "time_varying_file", "impose_flux", "profile"]
@@ -37,7 +40,10 @@ def __str__(self):
3740
return self.toxml().toprettyxml()
3841

3942
def __repr__(self):
40-
return self.toxml().toprettyxml()
43+
try:
44+
return self.toxml().toprettyxml(indent=" ")
45+
except Exception:
46+
return str(vars(self))
4147

4248
def set_type(self, bc_type):
4349
if bc_type not in ["Dirichlet", "Neumann", "Dir", "Neu"]:

svv/simulation/equation.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ def __str__(self):
5151
return self.toxml().toprettyxml()
5252

5353
def __repr__(self):
54-
return self.toxml().toprettyxml()
54+
try:
55+
return self.toxml().toprettyxml(indent=" ")
56+
except Exception:
57+
return str(vars(self))
5558

5659
def set_type(self, equation_type):
5760
if equation_type not in ["fluid", "scalarTransport"]:

svv/simulation/fluid/fluid_equation.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,12 @@ def add_wall(self, face, value=0.0, bc_type='Dirichlet', time_varying_file=None)
6464

6565
def check_bcs(self):
6666
"""
67-
Check that all boundary conditions are set.
67+
Check that all boundary conditions are set for caps.
6868
"""
6969
for face in self.faces:
7070
found = False
71+
if not 'cap' in face:
72+
continue
7173
for bc in self.boundary_conditions:
7274
if bc.name == face:
7375
found = True

0 commit comments

Comments
 (0)