From 188a271477cb93dde1eb7aa63acefe772d311d96 Mon Sep 17 00:00:00 2001 From: Cyrus Harrison Date: Fri, 26 Mar 2021 15:24:37 -0700 Subject: [PATCH] add sphinx source for cpp_fort_and_py example (#736) --- src/docs/sphinx/tutorial_cpp_fort_and_py.rst | 37 ++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/docs/sphinx/tutorial_cpp_fort_and_py.rst diff --git a/src/docs/sphinx/tutorial_cpp_fort_and_py.rst b/src/docs/sphinx/tutorial_cpp_fort_and_py.rst new file mode 100644 index 000000000..1db45153c --- /dev/null +++ b/src/docs/sphinx/tutorial_cpp_fort_and_py.rst @@ -0,0 +1,37 @@ +.. # Copyright (c) Lawrence Livermore National Security, LLC and other Conduit +.. # Project developers. See top-level LICENSE AND COPYRIGHT files for dates and +.. # other details. No copyright assignment is required to contribute to Conduit. + +======================================================= +Passing Conduit Nodes between C++, Fortran, and Python +======================================================= + +The ``cpp_fort_and_py`` example demonstrates how to pass Conduit Nodes between +C++, Fortran, and Python. It is a standalone example that you can build with +CMake against your Conduit install. + +You can find this example under ``src/examples/cpp_fort_and_py`` in +Conduit's source tree, or under ``examples/conduit/cpp_fort_and_py`` in +a Conduit install. + +It includes source for an embedded python interpreter and also shows how +to create a Fortran module that binds Conduit Nodes via Conduit's C-API. + +It creates two executables: + + ============================ =========================================== + **conduit_cpp_and_py_ex** Demo of C++ to Python and vice versa + **conduit_fort_and_py_ex** Demo of Fortran to Python and vice versa + ============================ =========================================== + +This demos wrapping Conduit Nodes, effectively creating referenced +data across languages. You can also use `set_external` to directly access +and change zero-copied data. + +Please see the main CMakeList.txt file for details on building and running: + +``cpp_fort_and_py/CMakeLists.txt`` excerpt: + +.. literalinclude:: ../../examples/cpp_fort_and_py/CMakeLists.txt + :lines: 6-34 + :dedent: 2