Closed jgostick closed 10 years ago
@maghighi: I think this should be handled by the mode approach. If the user sets mode to 'remove' then the locations that have been sent should be set to false. The tricky part: the reason I need this is simply to increase the size of the list by adding falses, so the setter must somehow accept indices that are longer than the existing list! We could consider adding an 'update' mode, which simply makes the given list the same size as 'all' but doesn't require any locations?
We can add this mode easily. The reason we didn't do this before, was because of using mode='overwrite'. The default mode is merge, so the user can only add True to the locations. But we thought if the user wants to change some of the True locations to False, then he should create the desired Boolean mask (by using get_info and then some changes to it). After this step, the user can send the new locations with mode='overwrite' to the setter. Surely, applying mode='remove' will make things easier for the user. I also think that if user doesn't send any locations with the mode='remove', we should remove that label from the info dictionary too.(?) About that tricky part: set info always creates (or uses) Np (or Nt) long arrays (if we don't send any locations, it creates a False array Np,Nt long). So are you saying that you want an array larger than Np(Nt)? It's doable but could you please give an example for the situation which we want the size of set_info output to be greater than the size of the network?
From: jgostick [notifications@github.com] Sent: Wednesday, February 26, 2014 9:38 PM To: PMEAL/OpenPNM Cc: Mahmoudreza Aghighi Subject: Re: [OpenPNM] send data to set_pore_info (#94)
@maghighihttps://github.com/maghighi: I think this should be handled by the mode approach. If the user sets mode to 'remove' then the locations that have been sent should be set to false. The tricky part: the reason I need this is simply to increase the size of the list by adding falses, so the setter must somehow accept indices that are longer than the existing list! We could consider adding an 'update' mode, which simply makes the given list the same size as 'all' but doesn't require any locations?
— Reply to this email directly or view it on GitHubhttps://github.com/PMEAL/OpenPNM/issues/94#issuecomment-36204211.
I'm playing with the clone pores idea, and after cloning we need to increase the length of 'all' and the other labels. 'all' is easy to do by hand since the values are all True, but the others more tricky and it would just be easier if we could add False's to the end of each. The Np trick will still work if we increase the size of 'all' first, the Np will be right.
Also I like the idea of removing the dictionary with mode 'remove' and locations is empty.
The mentioned features have been added to set_info.
I have just realized that we have no way of removing a label, we can only add them. Set_pore/throat_info need to either accept a data arg with true/falses, or add a mode for "remove" labels since the default is currently always "add" implicitly.