Skip to content

Commit

Permalink
Merge pull request #84 from andrsd/doco
Browse files Browse the repository at this point in the history
Improving doco generation
  • Loading branch information
andrsd authored Aug 10, 2024
2 parents 65807e5 + c6ccceb commit 2875e09
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 130 deletions.
165 changes: 40 additions & 125 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,40 @@
find_package(Doxygen QUIET)

if(DOXYGEN_FOUND)
# List of all images with error evaluated against coolprop
set(ERR_IMAGES "")

macro(add_fluid NAME YAML_FILE)
set(${NAME}_ERR_IMGS
${NAME}_err_c_p.png
${NAME}_err_c_v.png
${NAME}_err_h.png
${NAME}_err_k.png
${NAME}_err_mu.png
${NAME}_err_rho.png
${NAME}_err_s.png
${NAME}_err_u.png
${NAME}_err_w.png
)
message(STATUS ${NAME}_ERR_IMGS)
message(STATUS ${${NAME}_ERR_IMGS})

add_custom_command(
OUTPUT
${${NAME}_ERR_IMGS}
COMMAND
${CMAKE_COMMAND} -E env "PYTHONPATH=${PROJECT_BINARY_DIR}/python/src:$ENV{PYTHONPATH}"
python3 plot_err.py ${YAML_FILE}
WORKING_DIRECTORY
${PROJECT_SOURCE_DIR}/docs/pyplots
DEPENDS
${PROJECT_SOURCE_DIR}/docs/pyplots/plot_err.py
${PROJECT_SOURCE_DIR}/docs/pyplots/${YAML_FILE}
)

list(APPEND ERR_IMAGES ${${NAME}_ERR_IMGS})
endmacro()

find_program(SPHINX_BUILD sphinx-build)
mark_as_advanced(FORCE SPHINX_BUILD)

Expand All @@ -12,61 +46,11 @@ if(DOXYGEN_FOUND)
add_custom_target(doc DEPENDS ${PROJECT_BINARY_DIR}/docs/html/index.html)

file(GLOB_RECURSE RST_FILES ${PROJECT_SOURCE_DIR}/docs/*.rst)
set(N2_ERR_IMGS
n2_err_c_p.png
n2_err_c_v.png
n2_err_h.png
n2_err_k.png
n2_err_mu.png
n2_err_rho.png
n2_err_s.png
n2_err_u.png
n2_err_w.png
)
set(AIR_ERR_IMGS
air_err_c_p.png
air_err_c_v.png
air_err_h.png
air_err_k.png
air_err_mu.png
air_err_rho.png
air_err_s.png
air_err_u.png
air_err_w.png
)
set(HE_ERR_IMGS
he_err_c_p.png
he_err_c_v.png
he_err_h.png
he_err_k.png
he_err_mu.png
he_err_rho.png
he_err_s.png
he_err_u.png
he_err_w.png
)
set(CO2_ERR_IMGS
co2_err_c_p.png
co2_err_c_v.png
co2_err_h.png
co2_err_k.png
co2_err_mu.png
co2_err_rho.png
co2_err_s.png
co2_err_u.png
co2_err_w.png
)
set(O2_ERR_IMGS
o2_err_c_p.png
o2_err_c_v.png
o2_err_h.png
o2_err_k.png
o2_err_mu.png
o2_err_rho.png
o2_err_s.png
o2_err_u.png
o2_err_w.png
)
add_fluid(air air.yml)
add_fluid(he he.yml)
add_fluid(n2 n2.yml)
add_fluid(co2 co2.yml)
add_fluid(o2 o2.yml)

add_custom_command(
OUTPUT
Expand All @@ -77,11 +61,7 @@ if(DOXYGEN_FOUND)
${PROJECT_BINARY_DIR}/docs/conf.py
${PROJECT_BINARY_DIR}/docs/xml/index.xml
${RST_FILES}
${N2_ERR_IMGS}
${AIR_ERR_IMGS}
${HE_ERR_IMGS}
${CO2_ERR_IMGS}
${O2_ERR_IMGS}
${ERR_IMAGES}
)

add_custom_command(
Expand All @@ -94,71 +74,6 @@ if(DOXYGEN_FOUND)
${PROJECT_SOURCE_DIR}/include/fprops/*.h
)

add_custom_command(
OUTPUT
${N2_ERR_IMGS}
COMMAND
${CMAKE_COMMAND} -E env "PYTHONPATH=${PROJECT_BINARY_DIR}/python/src:$ENV{PYTHONPATH}"
python3 plot_err.py n2.yml
WORKING_DIRECTORY
${PROJECT_SOURCE_DIR}/docs/pyplots
DEPENDS
${PROJECT_SOURCE_DIR}/docs/pyplots/plot_err.py
${PROJECT_SOURCE_DIR}/docs/pyplots/n2.yml
)

add_custom_command(
OUTPUT
${AIR_ERR_IMGS}
COMMAND
${CMAKE_COMMAND} -E env "PYTHONPATH=${PROJECT_BINARY_DIR}/python/src:$ENV{PYTHONPATH}"
python3 plot_err.py air.yml
WORKING_DIRECTORY
${PROJECT_SOURCE_DIR}/docs/pyplots
DEPENDS
${PROJECT_SOURCE_DIR}/docs/pyplots/plot_err.py
${PROJECT_SOURCE_DIR}/docs/pyplots/air.yml
)

add_custom_command(
OUTPUT
${HE_ERR_IMGS}
COMMAND
${CMAKE_COMMAND} -E env "PYTHONPATH=${PROJECT_BINARY_DIR}/python/src:$ENV{PYTHONPATH}"
python3 plot_err.py he.yml
WORKING_DIRECTORY
${PROJECT_SOURCE_DIR}/docs/pyplots
DEPENDS
${PROJECT_SOURCE_DIR}/docs/pyplots/plot_err.py
${PROJECT_SOURCE_DIR}/docs/pyplots/he.yml
)

add_custom_command(
OUTPUT
${CO2_ERR_IMGS}
COMMAND
${CMAKE_COMMAND} -E env "PYTHONPATH=${PROJECT_BINARY_DIR}/python/src:$ENV{PYTHONPATH}"
python3 plot_err.py co2.yml
WORKING_DIRECTORY
${PROJECT_SOURCE_DIR}/docs/pyplots
DEPENDS
${PROJECT_SOURCE_DIR}/docs/pyplots/plot_err.py
${PROJECT_SOURCE_DIR}/docs/pyplots/co2.yml
)

add_custom_command(
OUTPUT
${O2_ERR_IMGS}
COMMAND
${CMAKE_COMMAND} -E env "PYTHONPATH=${PROJECT_BINARY_DIR}/python/src:$ENV{PYTHONPATH}"
python3 plot_err.py o2.yml
WORKING_DIRECTORY
${PROJECT_SOURCE_DIR}/docs/pyplots
DEPENDS
${PROJECT_SOURCE_DIR}/docs/pyplots/plot_err.py
${PROJECT_SOURCE_DIR}/docs/pyplots/o2.yml
)

add_custom_command(
TARGET doc
POST_BUILD
Expand Down
5 changes: 0 additions & 5 deletions docs/classes/fluid-properties.rst

This file was deleted.

0 comments on commit 2875e09

Please sign in to comment.