Skip to content

Add "vol" to "Domain.set_type" #192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion spatialpy/Model.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def timespan(self, time_span, timestep_size=None):



def set_type(self, geometry_ivar, type_id, mass=None, nu=None, rho=None, c=None, fixed=False):
def set_type(self, geometry_ivar, type_id, vol=None, mass=None, nu=None, rho=None, c=None, fixed=False):
""" Add a type definition to the model. By default, all regions are set to
type 0. Returns the number of domain points that were tagged with this type_id

Expand All @@ -246,6 +246,8 @@ def set_type(self, geometry_ivar, type_id, mass=None, nu=None, rho=None, c=None,
:type geometry_ivar: spatialpy.Geometry.Geometry
:param type_id: (usually an int) the identifier for this type
:type type_id: int
:param vol: The volume of each particle in the type
:type vol: float
:param mass: The mass of each particle in the type
:type mass: float
:param rho: The density of each particle in the type
Expand All @@ -271,6 +273,8 @@ def set_type(self, geometry_ivar, type_id, mass=None, nu=None, rho=None, c=None,
for v_ndx in range(self.domain.get_num_voxels()):
if geometry_ivar.inside( self.domain.coordinates()[v_ndx,:], on_boundary[v_ndx]):
self.domain.type[v_ndx] = type_id
if vol is not None:
self.domain.vol[v_ndx] = vol
if mass is not None:
self.domain.mass[v_ndx] = mass
if rho is not None:
Expand Down