TOP iteration best practices?
1664 2 1- peterbengtson
- Member
- 20 posts
- Joined: April 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.
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 - June 22, 2021 11:30:11
- peterbengtson
- Member
- 20 posts
- Joined: April 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.
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 - June 23, 2021 03:30:53
- peterbengtson
- Member
- 20 posts
- Joined: April 2021
- Offline
-
- Quick Links