Skip to content

Commit

Permalink
Making a placeholder class for Cone
Browse files Browse the repository at this point in the history
  • Loading branch information
pshriwise committed Oct 24, 2024
1 parent f782bed commit dd41ae0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
8 changes: 8 additions & 0 deletions src/openmc_cad_adapter/surfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,14 @@ def to_cubit_surface_inner(self, ent_type, node, extents, inner_world=None, hex=
def from_openmc_surface_inner(cls, sphere):
return cls(r=sphere.r, x0=sphere.x0, y0=sphere.y0, z0=sphere.z0, boundary_type=sphere.boundary_type, albedo=sphere.albedo, name=sphere.name, surface_id=sphere.id)

class CADCone(CADSurface):

def to_cubit_surface(self, ent_type, node, extents, inner_world=None, hex=False):
raise NotImplementedError('General Cones are not yet supported')

@classmethod
def from_openmc_surface(cls, surface):
raise NotImplementedError('General Cones are not yet supported')

class CADXCone(CADSurface, openmc.XCone):

Expand Down
3 changes: 0 additions & 3 deletions src/openmc_cad_adapter/to_cubit_journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ def reverse():
ids, cad_cmds = cad_surface.to_cubit_surface(ent_type, node, w, inner_world, hex)
cmds += cad_cmds
return ids
elif surface._type == "cone":
raise NotImplementedError("cone not implemented")
pass
elif surface._type == "quadric":
(gq_type, A_, B_, C_, K_, translation, rotation_matrix) = characterize_general_quadratic(surface)

Expand Down
9 changes: 8 additions & 1 deletion test/test_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,11 @@ def test_torus_diff_radii(request, run_in_tmpdir):
with pytest.raises(ValueError):
z_torus = openmc.ZTorus(x0=50.0, y0=50.0, z0=50.0, a=5.0, b=2.0, c=3.0)
g = openmc.Geometry([openmc.Cell(region=-z_torus)])
to_cubit_journal(g, world=(500, 500, 500), filename='z_torus.jou')
to_cubit_journal(g, world=(500, 500, 500), filename='a_torus.jou')


def test_general_cone(request, run_in_tmpdir):
with pytest.raises(NotImplementedError):
cone = openmc.Cone(x0=0.0, y0=0.0, z0=0.0, r2=6.0, dx=1, dy=1, dz=1)
g = openmc.Geometry([openmc.Cell(region=-cone)])
to_cubit_journal(g, world=(500, 500, 500), filename='cone.jou')

0 comments on commit dd41ae0

Please sign in to comment.