Skip to content

Getting Started C++ quick-start snippet does not compile (undeclared iter, dt, dis) #384

Description

@SAY-5

The C++ Quick Start example in doc/sphinx/source/intros/gettingstarted.md is presented as a complete int main() program labeled transport1D.cpp, but it cannot compile.

The time-integration loop uses three variables that the snippet never declares:

for (int i = 0; i <= iter; i++) {        // iter undeclared
  C += dt * (D * (dis * (G * C)) - ...); // dt and dis undeclared
}

It also never sets initial conditions, so even after fixing the declarations C and V stay zero and the output is meaningless.

The real example it points to, examples/cpp/transport1D.cpp, declares iter, dt, dis, vel, R, C0, sets C(0) = C0 and V.fill(vel), and applies the retardation/dispersion scaling. A reader who copies the documented snippet gets compile errors on the very first program in the guide.

Suggested fix: align the snippet with the actual transport1D.cpp so it is self-contained and compiles.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions