G
gas
Hi
So, I have the following problem:
I have to store several types of Cells, (call them A, B, ...), where the
number of Cell types is going to increase as we continue development.
Among other things, I have to compute inductances between all
combinations of these cells. How the inductance is computed depends
entirely on the type of cell.
It seems like there must be an elegant solution to this, probably a
design pattern. The naive solutions I think of have big disadvantages:
If I store a pointer of base classes, calculating the inductances gets
messy and complicated (especially as the number of Cell types
increases). If I store the different cell types seperately, the routines
where I calculate over the different combinations of cells gets ugly, and
scales badly.
So can someone give me a good idea, point me at a good pattern, whatever?
Thanks,
Glen
So, I have the following problem:
I have to store several types of Cells, (call them A, B, ...), where the
number of Cell types is going to increase as we continue development.
Among other things, I have to compute inductances between all
combinations of these cells. How the inductance is computed depends
entirely on the type of cell.
It seems like there must be an elegant solution to this, probably a
design pattern. The naive solutions I think of have big disadvantages:
If I store a pointer of base classes, calculating the inductances gets
messy and complicated (especially as the number of Cell types
increases). If I store the different cell types seperately, the routines
where I calculate over the different combinations of cells gets ugly, and
scales badly.
So can someone give me a good idea, point me at a good pattern, whatever?
Thanks,
Glen