Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • openfoam openfoam
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 480
    • Issues 480
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 10
    • Merge requests 10
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Model experiments
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Development
  • openfoamopenfoam
  • Issues
  • #481

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 Admin
Assignee
Assign to
Time tracking