View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000059||OpenFOAM||[All Projects] Bug||public||2010-10-21 15:48||2010-11-01 18:07|
|Priority||normal||Severity||feature||Reproducibility||have not tried|
|Fixed in Version|
|Summary||0000059: Size control in DynamicField|
|Description||Is there a possibility of having a templated size-control option (i.e., using a SizeInc/SizeMult/SizeDiv) for DynamicField, similar to the DynamicList approach? It would be better than blindly increasing the size of the field by 2, like it is right now.|
I don't see this being an issue from a programming stand-point, but it would be a nice feature to have.
A less urgent feature-request would be to implement features that have been left out of DynamicField (like the remove() member, clearStorage(), etc..)
|Tags||No tags attached.|
|DynamicField is lagging a bit with respect to DynamicList. Feel free to add the missing bits (also the size control) and send them to me.|
DynFieldModifications.tgz (4,384 bytes)
I've uploaded the modifications with (most of) the missing bits. It mostly mimics the DynamicList functionality, but I was unsure about adding other Field functions like xfer(), transfer(), map(), rmap(), etc... I guess the inheritance hierarchy takes care of those for the moment, but pointer bugs may arise if we're not careful, so I leave that analysis to you.
I also noticed that the constructor for DynamicList specifies an over-ride for the underlying size:
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::DynamicList
const label nElem
// we could also enforce SizeInc granularity when (!SizeMult || !SizeDiv)
List<T>::size(0); <--- Shouldn't this not be there??
I agree that memory is un-initialized, but it gives the false impression that the List is sized to 'nElem', while it's artificially set to zero. Is this behaviour intentional?
I've updated DynamicField (commit 96dcbab7e165db56d78f36d14349b7db9777e1ea).
- I've removed the tmp handling - do you need it?
- the List::size(0) is intentional. That constructor just allocates memory which you then can fill with 'append'.
|I guess this level of functionality should suffice for now, thanks.|
|2010-10-21 16:16||henry||Assigned To||=> user4|
|2010-10-21 16:16||henry||Status||new => assigned|
||Note Added: 0000088|
||File Added: DynFieldModifications.tgz|
||Note Added: 0000089|
||Note Added: 0000102|
||Note Added: 0000110|
||Note Added: 0000111|
||Status||assigned => resolved|
||Resolution||open => fixed|