Links with a large number of ports tend to have a large, sparsely-populated internal admittance matrix of size nPorts * nPorts that wastes a significant amount of memory as nPorts increases. This is not a problem for most links, which have 2 ports, but as an example, the GunnsThermalSource link in GunnShowThermalTest.xml has 12 ports and admittance matrix of 144 doubles, which is entirely unused. We envision applications having specialized links with hundreds or even thousands of ports and needing to use a compressed admittance matrix to avoid wasting too much memory.
[x] By default, existing links will be unaffected and require no updates.
[x] Allow links the option of using and allocating its own custom internal admittance matrix.
[x] The link will allocate a new array of int defining the custom node map from its internal admittance matrix to the solver's matrix.
[x] The link will implement a virtual int getCompressedNodeMap(unsigned int*) that returns the compressed node map array and its size, and the default implementation will return null/0. Using std::vector would be a simpler implementation, but we want to retain visibility into an array through Trick for maintainability.
[x] The solver will call the link's getCompressedNodeMap() and map the link's admittance to the solver matrix via the returned node map accordingly.
[x] The link must retain knowledge of the size of the network, during init and run, so it can compute the row & column offsets of its node map into the solver's matrix. We can probably get this from any network node's config object.
[x] Modify the link setPort function to recompute the compressed node map into the solver's matrix, so that ports can be moved during run.
[x] Implement and demonstrate this in GunnsThermalSource, which since it only has flow source effects and never sets its admittance matrix, will have a custom admittance matrix of size zero.
Links with a large number of ports tend to have a large, sparsely-populated internal admittance matrix of size nPorts * nPorts that wastes a significant amount of memory as nPorts increases. This is not a problem for most links, which have 2 ports, but as an example, the GunnsThermalSource link in GunnShowThermalTest.xml has 12 ports and admittance matrix of 144 doubles, which is entirely unused. We envision applications having specialized links with hundreds or even thousands of ports and needing to use a compressed admittance matrix to avoid wasting too much memory.