Skip to content

mesti_subpixel_smoothing function #7

@yggbg

Description

@yggbg

Hello, there is an issue inside the mesti_subpixel_smoothing() function at line 148:

if xBC == "periodic" || xBC == "Bloch"
    object_list_temp = deepcopy(object_list)        
    num_new_periodic_object = 0
    for obj_ind = 1:length(object_list)
        object = object_list[obj_ind]
        if bounds(object)[1][1] <= bounds(domain)[1][1] && bounds(object)[2][1] >= bounds(domain)[1][1] && bounds(object)[2][1] < bounds(domain)[2][1]
            insert!(object_list_temp, obj_ind+num_new_periodic_object+1, translate(object, [bounds(domain)[2][1]-bounds(domain)[1][1],0,0]))
            insert!(object_epsilon_list, obj_ind+num_new_periodic_object+1, object_epsilon_list[obj_ind+num_new_periodic_object])
            num_new_periodic_object = num_new_periodic_object + 1
        elseif bounds(object)[1][1] <= bounds(domain)[2][1] && bounds(object)[2][1] >= bounds(domain)[2][1] && bounds(object)[1][1] > bounds(domain)[1][1]
# line below is where the issue occurs
             insert!(object_list_temp,  translate(object, obj_ind+num_new_periodic_object+1, [-(bounds(domain)[2][1]-bounds(domain)[1][1]),0,0]))
            insert!(object_epsilon_list, obj_ind+num_new_periodic_object+1, object_epsilon_list[obj_ind+num_new_periodic_object])                
            num_new_periodic_object = num_new_periodic_object + 1               
        end
    end
    object_list = deepcopy(object_list_temp)
    object_list_temp = nothing
end

After taking a look at this page I realized that there are 3 inputs to the translate() function instead of the expected 2 inputs.

Here's the block of code for the yBC part:

if yBC == "periodic" || yBC == "Bloch"
    object_list_temp = deepcopy(object_list)        
    num_new_periodic_object = 0        
    for obj_ind = 1:length(object_list)
        object = object_list[obj_ind]
        if bounds(object)[1][2] <= bounds(domain)[1][2] && bounds(object)[2][2] >= bounds(domain)[1][2] && bounds(object)[2][2] < bounds(domain)[2][2]
            insert!(object_list_temp, obj_ind+num_new_periodic_object+1, translate(object, [0, bounds(domain)[2][2]-bounds(domain)[1][2], 0]))
            insert!(object_epsilon_list, obj_ind+num_new_periodic_object+1, object_epsilon_list[obj_ind+num_new_periodic_object])                                
            num_new_periodic_object = num_new_periodic_object + 1
        elseif bounds(object)[1][2] <= bounds(domain)[2][2] && bounds(object)[2][2] >= bounds(domain)[2][2] && bounds(object)[1][2] > bounds(domain)[1][2]
# line below is the yBC equivalent of the line above that caused the issue
             insert!(object_list_temp, obj_ind+num_new_periodic_object+1, translate(object, [0, -(bounds(domain)[2][2]-bounds(domain)[1][2]), 0]))
            insert!(object_epsilon_list, obj_ind+num_new_periodic_object+1, object_epsilon_list[obj_ind+num_new_periodic_object])                                
            num_new_periodic_object = num_new_periodic_object + 1               
        end
    end
    object_list = deepcopy(object_list_temp)
    object_list_temp = nothing        
end

Replacing the faulty line with the following fixed the issue on my end:

insert!(object_list_temp, obj_ind+num_new_periodic_object+1, translate(object, [-(bounds(domain)[2][1]-bounds(domain)[1][1]),0,0]))

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions