Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O OpenFOAM-plus
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 339
    • Issues 339
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Development
  • OpenFOAM-plus
  • Issues
  • #481
Closed
Open
Issue created May 24, 2017 by Markus Towara@mtowara

BlockMesh: Implicit initialization of member overwrites previous initialization

in src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.H the members are declared in the following order:

    point p1_, p2_, p3_;
    cylindricalCS cs_;
    scalar angle_;
    scalar radius_;

in the constructor calcAngle() is called which sets angle_ and radius_. If scalar is anything but a primitive type the default constructor of angle_ and radius_ will be called after calcAngle returns, thus overwriting its results.

Foam::blockEdges::arcEdge::arcEdge
(
    const pointField& points,
    const label start,
    const label end,
    const point& pMid
)
:
    blockEdge(points, start, end),
    p1_(points_[start_]),
    p2_(pMid),
    p3_(points_[end_]),
    cs_(calcAngle())
{}

The easy fix is to switch the declaration of the members in the.H file. The more sane fix probably is to not alter any member variables before initialization is done.

Edited Jun 21, 2017 by Andrew Heather
Assignee
Assign to
Time tracking