lcpp-org / RustBCA

A free, open-source Binary Collision Approximation (BCA) code for ion-material interactions including sputtering, implantation, and reflection
https://github.com/lcpp-org/RustBCA/wiki
GNU General Public License v3.0
41 stars 14 forks source link

[feature] Triangle lists should follow GetDP-like structure #75

Closed drobnyjt closed 1 year ago

drobnyjt commented 3 years ago

Is your feature request related to a problem? Please describe. Current implementation of triangle lists is unreadable and difficult to manage in code and by hand.

Proposed solution Switch to:

  1. a list of points in the form of x-y pairs: (x, y)
  2. triangles become a list of point indexes (0, 1, 2)
  3. triangle list becomes a list of three-tuples, each of which defines a triangle with three point indexes
drobnyjt commented 3 years ago

Working on this now. Draft version of input file looks like this:

[mesh_2d_input]
energy_barrier_thickness = 2.2E-4
length_unit = "MICRON"
densities = [ [ 3.0e+10, 6.0e+10, 0.0, 0.0,], [ 3.0e+10, 6.0e+10, 0.0, 0.0,],]
mesh_points = [[0.0, -0.5], [0.0, 0.5], [0.5, 0.5], [0.5, -0.5]]
triangles = [[0, 1, 2], [0, 2, 3]]
material_boundary_points = [0, 1, 2, 3]
simulation_boundary_points = [ [ 0.6, -0.6,], [ -0.1, -0.6,], [ -0.1, 0.6,], [ 0.6, 0.6,], [ 0.6, -0.6,],]
electronic_stopping_correction_factors = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

Questions: This is less verbose than before, actually, because necessarily a list of triangles will have many points repeated. Is it more or less legible?

Should simulation boundary points be treated the same as regular mesh points? Should they be in the mesh points list?