Skip to content

Commit

Permalink
Flatten layout of demo directories.
Browse files Browse the repository at this point in the history
  • Loading branch information
garth-wells committed Jan 21, 2019
1 parent 893d2d3 commit 94ef41d
Show file tree
Hide file tree
Showing 19 changed files with 14 additions and 18 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ build_demo.*
test_*_tempdir
/python/demo/**/*.py
/python/demo/**/*.xml
/python/demo/undocumented/mesh-quality/mesh-quality.pdf
/cpp/demo/**/*.ufl
/cpp/demo/**/*.cpp
/cpp/demo/**/*.c
Expand Down
12 changes: 6 additions & 6 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ endif()
# and tests

set(COPY_DEMO_TEST_DEMO_DATA FALSE)
if (PYTHONINTERP_FOUND AND NOT EXISTS ${DOLFIN_SOURCE_DIR}/demo/documented/poisson/Poisson.h)
if (PYTHONINTERP_FOUND AND NOT EXISTS ${DOLFIN_SOURCE_DIR}/demo/poisson/Poisson.h)
message(STATUS "")
message(STATUS "Generating form files in demo and test and directories. May take some time...")
message(STATUS "----------------------------------------------------------------------------------------")
Expand All @@ -337,8 +337,8 @@ if (PYTHONINTERP_FOUND AND NOT EXISTS ${DOLFIN_SOURCE_DIR}/demo/documented/poiss

if (FORM_GENERATION_RESULT)
# Cleanup so download is triggered next time we run cmake
if (EXISTS ${DOLFIN_SOURCE_DIR}/demo/documented/poisson/Poisson.h)
file(REMOVE ${DOLFIN_SOURCE_DIR}/demo/documented/poisson/Poisson.h)
if (EXISTS ${DOLFIN_SOURCE_DIR}/demo/poisson/Poisson.h)
file(REMOVE ${DOLFIN_SOURCE_DIR}/demo/poisson/Poisson.h)
endif()
message(FATAL_ERROR "Generation of form files failed: \n${FORM_GENERATION_OUTPUT}")
endif()
Expand All @@ -351,7 +351,7 @@ endif()
# FIXME: Generate files in Build directory instead?
# NOTE: We need to call this script after generate-formfiles

if (PYTHONINTERP_FOUND AND NOT EXISTS ${DOLFIN_SOURCE_DIR}/demo/documented/poisson/CMakeLists.txt)
if (PYTHONINTERP_FOUND AND NOT EXISTS ${DOLFIN_SOURCE_DIR}/demo/poisson/CMakeLists.txt)
message(STATUS "")
message(STATUS "Generating CMakeLists.txt files in demo and test directories")
message(STATUS "-------------------------------------------------------------------")
Expand All @@ -365,8 +365,8 @@ if (PYTHONINTERP_FOUND AND NOT EXISTS ${DOLFIN_SOURCE_DIR}/demo/documented/poiss
if (CMAKE_GENERATION_RESULT)

# Cleanup so FFC rebuild is triggered next time we run cmake
if (EXISTS ${DOLFIN_SOURCE_DIR}/demo/documented/poisson/CMakeLists.txt)
file(REMOVE ${DOLFIN_SOURCE_DIR}/demo/documented/poisson/CMakeLists.txt)
if (EXISTS ${DOLFIN_SOURCE_DIR}/demo/poisson/CMakeLists.txt)
file(REMOVE ${DOLFIN_SOURCE_DIR}/demo/poisson/CMakeLists.txt)
endif()
message(FATAL_ERROR "Generation of CMakeLists.txt files failed: \n${CMAKE_GENERATION_OUTPUT}")
endif()
Expand Down
1 change: 0 additions & 1 deletion cpp/cmake/scripts/generate-cmakefiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
demo=set(["main.cpp", "main.cpp.rst"]), bench=set(["main.cpp"]))

# Projects that use custom CMakeLists.txt (shouldn't overwrite)
#exclude_projects = [os.path.join('demo', 'undocumented', 'plot-qt')]
exclude_projects = []


Expand Down
4 changes: 2 additions & 2 deletions cpp/demo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ find_package(DOLFIN REQUIRED)
# include(${DOLFIN_USE_FILE})

# Demos that run in real and complex modes
add_subdirectory(documented/poisson)
add_subdirectory(poisson)

# Demos that run only in real mode
if (NOT PETSC_SCALAR_COMPLEX)
add_subdirectory(documented/hyperelasticity)
add_subdirectory(hyperelasticity)
endif()

# Demos that run only in complex mode
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
10 changes: 4 additions & 6 deletions python/demo/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@
import pytest

# Get directory of this file
dir_path = pathlib.Path(__file__).resolve().parent
path = pathlib.Path(__file__).resolve().parent

# Build list of demo programs
demos = []
for subdir in ['documented', 'undocumented']:
p = pathlib.Path(dir_path, subdir)
demo_files = list(p.glob('**/*.py'))
for f in demo_files:
demos.append((f.parent, f.name))
demo_files = list(path.glob('**/*.py'))
for f in demo_files:
demos.append((f.parent, f.name))


@pytest.mark.serial
Expand Down
2 changes: 1 addition & 1 deletion python/doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import sys
import shutil
shutil.rmtree("demos", True)
shutil.copytree("../../demo/documented", "demos")
shutil.copytree("../../demo", "demos")

#import rstprocess
#rstprocess.process()
Expand Down
2 changes: 1 addition & 1 deletion python/doc/source/rstprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def process():
raise RuntimeError("Cannot find pylit.py")

# Directories to scan
subdirs = ["../../demo/documented"]
subdirs = ["../../demo"]

# Iterate over subdirectories containing demos
for subdir in subdirs:
Expand Down

0 comments on commit 94ef41d

Please sign in to comment.