Skip to content

Operations with CartesianPoints not supported and causing errors #552

@hervasa2

Description

@hervasa2

Multiplication of scalar and a CartesianPoint and sum of CartesianPoint's is used in move_charges_inside_semiconductor!. This is causing errors during charge drift simulation. Given that this functionality was removed in #489 it needs to be explicitly added back in. This can be fixed by a simple

Base.:(*)(pt::AbstractCartesianPoint{<:Real}, u::Real) = CartesianPoint(get_x(pt) * u, get_y(pt) * u, get_z(pt) * u)
Base.:(*)(u::Real, pt::AbstractCartesianPoint{<:Real}) = pt * u

Base.:(+)(pt1::AbstractCartesianPoint{<:Real}, pt2::AbstractCartesianPoint{<:Real}) = CartesianPoint(get_x(pt1) + get_x(pt2), get_y(pt1) + get_y(pt2), get_z(pt1) + get_z(pt2))
Base.:(-)(pt1::AbstractCartesianPoint{<:Real}, pt2::AbstractCartesianPoint{<:Real}) = CartesianPoint(get_x(pt1) - get_x(pt2), get_y(pt1) - get_y(pt2), get_z(pt1) - get_z(pt2))

However, I see this comment

# product (not defined for affine points), but a cartesian product, so supporting this should be fine:

So I did not open a PR at this stage. Instead we need a systematic review of all previously supported methods involving Points as #543 states. I am creating this issue separate to release 0.11 (#543) because of its urgency.

Metadata

Metadata

Labels

breakingChanges syntax to older versionsbugSomething isn't workingtestsAdd tests to increase code coverage

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions