TOP iteration best practices?

   1343   2   1
User Avatar
Member
20 posts
Joined: 4月 2021
Offline
I have a TOP network like the following:



Analyze_Terrain produces a scaled down version of a terrain with point attributes describing various aspects of it, such as slope average for neighbours, fertility, sunlight, distance to fresh and sea water, etc. The following nodes each create another point attribute reflecting the relative suitability for a certain kind of settlement. They take the analysed terrain and add a point attribute for each point in the terrain geometry. The accumulated point data is is used to select ideal locations for settlements, but also for other things such as anisotropic pathfinding.

Each node has the following interface:



Since this part of the network essentially consists of a rolled-out loop, I thought I'd use the CSV Input node to generate work items for each type of settlement, like so:



Whilst this creates the correct number of work items, the iteration itself doesn't include the terrain, so Precalculate_Village_Suitability has nothing to operate on. It of course gets its HDA Parameters correctly from the work items:



I can see several ways of adding the terrain data geometry, but this must be such a common operation - "create work items from a CSV file, then use them to iterate over geometry, modifying it, then feed the updated geometry into the next iteration for the next work item". The end result would be the result of the last iteration. (I'm aware that in this particular case the iterations could run in parallel, but there are other situations where sequential operation is required.)

Are there any best practices in this area? How would I go about creating this type of iteration in PDG? I've scoured the net for the past few days and come up with very little. Thankful for any tips or pointers.
Edited by peterbengtson - 2021年6月22日 11:30:11

Attachments:
Screenshot 2021-06-21 at 21.35.26.png (126.7 KB)
a.png (133.8 KB)
b.png (125.5 KB)
c.png (65.8 KB)

User Avatar
Member
20 posts
Joined: 4月 2021
Offline
This seems to work:



The problem is now that something is needed in place of the Null node to return only the last result of the iteration - the Place_All_Villages node gets six work items rather than one. A Wait For All node doesn't cut it, as the "inputpath" attribute still is a vector of six elements. Wait For All also seems counterintuitive and wrong after a sequential loop.

Nothing in the way of attribute manipulation seems to get rid of the previous data: applying "Last Value" to "inputpath" in the Block End Feedback gets rid of the array temporarily, but it reappears again in the Place_All_Villages node.

Again, any pointers are much appreciated. I can find no examples of TOP iteration over files anywhere on the web.
Edited by peterbengtson - 2021年6月23日 03:30:53

Attachments:
Screenshot 2021-06-23 at 09.14.39.png (121.5 KB)

User Avatar
Member
20 posts
Joined: 4月 2021
Offline
This works, that is, using a split node to select the last work item:



... using a Split Expression like so:



But is that really the most idiomatic way of selecting the results of the last iteration?

Attachments:
Screenshot 2021-06-24 at 02.47.45.png (90.4 KB)
Screenshot 2021-06-24 at 02.47.57.png (71.9 KB)

  • Quick Links