View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002598 | OpenFOAM | Bug | public | 2017-07-01 12:31 | 2017-10-18 16:12 |
Reporter | jacob | Assigned To | henry | ||
Priority | low | Severity | minor | Reproducibility | always |
Status | closed | Resolution | no change required | ||
Platform | GNU/Linux | OS | OpenSuSE | OS Version | Tumbleweed |
Summary | 0002598: lduMatrix does not have a virtual destructor | ||||
Description | The class lduMatrix is used as a base class for fvMatrix. As such, it should have a virtual destructor. | ||||
Additional Information | Also, without a virtual destructor (and in absence of any other virtual function) lduMatrix is not considered polymorphic by compilers (or at least by GCC 6.2.0) and hence it cannot be dynamic_cast-ed to fvMatrix. Such a feature is otherwise useful e.g. when accessing the objectRegistry from within a lduMatrix solver. | ||||
Tags | No tags attached. | ||||
|
lduMatrix is not polymorphic, does not have any virtual functions and hence does not currently need a virtual destructor. Could you provide a use case for which this would be required? Where is OpenFOAM is this required and causing a problem? |
|
I provided a use case in "Additional Information": When fvMatrix is derived from lduMatrix, it should be possible to dynamic_cast lduMatrix to fvMatrix. Right now this is not possible, because lduMatrix is not polymorphic. Addition of a virtual destructor would make the class polymorphic. If this is not desired, I withdraw my suggestion. |
|
lduMatrix was not designed to be dynamically up-cast and currently there is no need for this in OpenFOAM nor does it appear to be appropriate. Under what conditions do you need to up-cast lduMatrix? Wouldn't it be better to provide direct access to the fvMatrix rather than up-casting the lduMatrix? |
|
I think this issue can be closed, it originates from my misunderstanding of OpenFOAM architecture. No action needed. |
Date Modified | Username | Field | Change |
---|---|---|---|
2017-07-01 12:31 | jacob | New Issue | |
2017-07-02 16:10 | henry | Note Added: 0008319 | |
2017-07-10 14:22 | jacob | Note Added: 0008376 | |
2017-07-10 14:37 | henry | Note Added: 0008377 | |
2017-10-18 15:36 | jacob | Note Added: 0008888 | |
2017-10-18 16:12 | henry | Assigned To | => henry |
2017-10-18 16:12 | henry | Status | new => closed |
2017-10-18 16:12 | henry | Resolution | open => no change required |