View Issue Details

IDProjectCategoryView StatusLast Update
0003727OpenFOAMBugpublic2021-09-14 09:29
Reportertniemi Assigned Tohenry  
PrioritylowSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Versiondev 
Summary0003727: meshtools/coordinateSystem: Missing copy constructor preventing reuse of coordinateSystems
DescriptionI tried to use the constant/coordinateSystem-file to specify a single, simple coordinate system which was used in multiple porous regions. However, I noticed that this only worked for the first porous region and when the second one is created one gets

--> FOAM FATAL ERROR:
object of type N4Foam18coordinateRotationE is not allocated

I traced the issue to coordinateSystem-class, which has R_ as autoPtr but does not have a custom copy constructor. Thus when calling the clone-function, the default copy constructor is used which transfers the ownership of R_ and clears the original pointer. The next clone will produce a coordinateSystem with null R_.

Adding
coordinateSystem(const coordinateSystem &obj)
:
        name_(obj.name_),
        origin_(obj.origin_),
        R_(obj.R_->clone())
        {}

seemed to solve the issue.
Steps To ReproduceWith tutorials/incompressible/pisoFoam/laminar/porousBlockage try to define another porosity source which uses "coordinateSystem porousBlockage;"

leads to
--> FOAM FATAL ERROR:
object of type N4Foam18coordinateRotationE is not allocated
TagsNo tags attached.

Activities

henry

2021-09-14 09:02

manager   ~0012186

Thanks for the report, I am working on this now. coordinateSystem will need an operator= as well as the copy constructor

henry

2021-09-14 09:29

manager   ~0012187

Resolved by commit 3e157225676659a40589446f927e2eeed39c4e16

Issue History

Date Modified Username Field Change
2021-09-14 08:17 tniemi New Issue
2021-09-14 09:02 henry Note Added: 0012186
2021-09-14 09:29 henry Assigned To => henry
2021-09-14 09:29 henry Status new => resolved
2021-09-14 09:29 henry Resolution open => fixed
2021-09-14 09:29 henry Note Added: 0012187