Skip to content

Commit

Permalink
Update compilation command and embedded C++ tutorial example
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl committed Apr 5, 2022
1 parent d802eb3 commit fea3b1e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pages/tutorials/cxx-guide/factories.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

Learn how to generate the major objects to represent phase information in C++

The following program demonstrates the general method for creating the following
object types:
The following program demonstrates the general method for accessing the following
object types from a ``Solution`` object:

- ``ThermoPhase`` - represents the thermodynamic properties of mixtures containing
one or more species)
Expand Down
4 changes: 3 additions & 1 deletion pages/tutorials/cxx-guide/simple-example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ might look like this:

.. code:: bash
g++ combustor.cpp -o combustor -pthread -O3 -std=c++0x -I/opt/cantera-2.5.1/include -L/opt/cantera-2.5.1/lib -lcantera -lsundials_cvodes -lsundials_ida -lsundials_nvecserial
g++ combustor.cpp -o combustor -pthread -O3 -std=c++11 \
-I/opt/cantera-2.5.1/include -L/opt/cantera-2.5.1/lib \
-lcantera -lsundials_cvodes -lsundials_ida -lsundials_nvecserial -lfmt -lyaml-cpp
The locations of the Cantera header files (specified by the ``-I`` option) and the
libraries (specified by the ``-L`` option) will vary depending on where you
Expand Down
9 changes: 6 additions & 3 deletions pages/tutorials/cxx-guide/thermo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@ prints its temperature is shown below:

.. code:: c++

#include "cantera/thermo.h"
#include "cantera/base/Solution.h"
#include "cantera/thermo/ThermoPhase.h"
#include <iostream>

int main(int argc, char** argv)
{
std::unique_ptr<Cantera::ThermoPhase> gas(
Cantera::newPhase("h2o2.yaml", "ohmech"));
// Create a new Solution object
auto sol = Cantera::newSolution("h2o2.yaml", "ohmech", "None");
std::shared_ptr<Cantera::ThermoPhase> gas = sol->thermo();

std::cout << gas->temperature() << std::endl;
return 0;
}
Expand Down

0 comments on commit fea3b1e

Please sign in to comment.