mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 13:15:39 -04:00
New class method, Mesh.fromRectLattice()
This commit is contained in:
parent
e3f0bff0f0
commit
a47f3abbde
1 changed files with 34 additions and 0 deletions
|
|
@ -182,6 +182,40 @@ class Mesh(IDManagerMixin):
|
|||
|
||||
return mesh
|
||||
|
||||
@classmethod
|
||||
def fromRectLattice(cls, lattice, division=1, mesh_id=None, name=''):
|
||||
"""Create mesh from an existing rectangular lattice
|
||||
|
||||
Parameters
|
||||
----------
|
||||
lattice : openmc.RectLattice
|
||||
Rectangular lattice used as a template for this mesh
|
||||
division : int, optional
|
||||
Number of mesh cells per lattice cell.
|
||||
If not specified, there will be 1 mesh cell per lattice cell.
|
||||
mesh_id : int, optional
|
||||
Unique identifier for the mesh
|
||||
name : str, optional
|
||||
Name of the mesh
|
||||
|
||||
Returns
|
||||
-------
|
||||
openmc.Mesh
|
||||
Mesh instance
|
||||
|
||||
"""
|
||||
cv.check_type('rectangular lattice', lattice, openmc.RectLattice)
|
||||
|
||||
shape = np.array(lattice.shape)
|
||||
width = lattice.pitch*shape
|
||||
|
||||
mesh = cls(mesh_id, name)
|
||||
mesh.lower_left = lattice.lower_left
|
||||
mesh.upper_right = lattice.lower_left + width
|
||||
mesh.dimension = shape*division
|
||||
|
||||
return mesh
|
||||
|
||||
def to_xml_element(self):
|
||||
"""Return XML representation of the mesh
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue