Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fypp everything? #781

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/file-filter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

fortran_src: &fortran_src
- '**/*.f90'
- '**/*.fpp'
- '**/*.fypp'

python_src: &python_src
- '**/*.py'
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ yarn.lock
.venv/
/build/
.vscode/
src/*/include/case.fpp
src/*/include/case.fypp
src/*/autogen/

*.swo
Expand Down
72 changes: 36 additions & 36 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -253,48 +253,48 @@ endif()
#
# * Locate all source files for <target> of the type
#
# src/[<target>,common]/[.,include]/*.[f90,fpp].
# src/[<target>,common]/[.,include]/*.[f90,fypp].
#
# * For each .fpp file found with filepath <dirpath>/<filename>.fpp, using a
# * For each .fypp file found with filepath <dirpath>/<filename>.fypp, using a
# custom command, instruct CMake how to generate a file with path
#
# src/<target>/fypp/<filename>.f90
#
# by running Fypp on <dirpath>/<filename>.fpp. It is important to understand
# by running Fypp on <dirpath>/<filename>.fypp. It is important to understand
# that this does not actually run the pre-processor. Rather, it instructs
# CMake what to do when it finds a src/<target>/fypp/<filename>.f90 path
# in the source list for a target. Thus, an association is made from an .f90
# file to its corresponding .fpp file (if applicable) even though the
# generation is of the form .fpp -> .f90.
# file to its corresponding .fypp file (if applicable) even though the
# generation is of the form .fypp -> .f90.
#
# This design has one limitation: If an .fpp file depends on another, for
# This design has one limitation: If an .fypp file depends on another, for
# example if it '#:include's it and uses a macro defined in it, then the
# dependency will not be tracked. A modification to the .fpp file it depends
# on will not trigger a re-run of Fypp on the .fpp file that depends on it.
# dependency will not be tracked. A modification to the .fypp file it depends
# on will not trigger a re-run of Fypp on the .fypp file that depends on it.
# As a compromise, both in speed and complexity, all .f90 files generated
# from .fpp files are re-generated not only when their corresponding .fpp
# from .fypp files are re-generated not only when their corresponding .fypp
# file is modified, but also when any file with filepath of the form
#
# src/[<target>,common]/include/*.fpp
# src/[<target>,common]/include/*.fypp
#
# is modified. This is a reasonable compromise as modifications to .fpp files
# is modified. This is a reasonable compromise as modifications to .fypp files
# in the include directories will be rare - by design. Other approaches would
# have required a more complex CMakeLists.txt file (perhaps parsing the .fpp
# have required a more complex CMakeLists.txt file (perhaps parsing the .fypp
# files to determine their dependencies) or the endurment of longer
# compilation times (by way of re-running Fypp on all .fpp files every time
# compilation times (by way of re-running Fypp on all .fypp files every time
# one of them is modified).
#
# .fpp files in src/common are treated as if they were in src/<target> (not
# .fypp files in src/common are treated as if they were in src/<target> (not
# pre-processed to src/common/fypp/) so as not to clash with other targets'
# .fpp files (this has caused problems in the past).
# .fypp files (this has caused problems in the past).
#
# * Export, in the variable <target>_SRCs, a list of all source files (.f90)
# that would compile to produce <target>. If <target> includes .fpp files,
# that would compile to produce <target>. If <target> includes .fypp files,
# then the list will include the paths to the corresponding .f90 files that
# Fypp would generate from the .fpp files.
# Fypp would generate from the .fypp files.
#
# This design allows us to be flexible in our use of Fypp as we don't have to
# worry about running the pre-processor on .fpp files when we create executables
# worry about running the pre-processor on .fypp files when we create executables
# and generate documentation. Instead, we can simply include the list of .f90
# files that will eventually be used to compile <target>.

Expand All @@ -316,31 +316,31 @@ macro(HANDLE_SOURCES target useCommon)
endif()

# Gather:
# * src/[<target>,(common)]/*.fpp]
# * (if any) <build>/modules/<target>/*.fpp
file(GLOB ${target}_FPPs CONFIGURE_DEPENDS "${${target}_DIR}/*.fpp"
"${CMAKE_BINARY_DIR}/modules/${target}/*.fpp")
# * src/[<target>,(common)]/*.fypp]
# * (if any) <build>/modules/<target>/*.fypp
file(GLOB ${target}_FYPPs CONFIGURE_DEPENDS "${${target}_DIR}/*.fypp"
"${CMAKE_BINARY_DIR}/modules/${target}/*.fypp")
if (${useCommon})
file(GLOB common_FPPs CONFIGURE_DEPENDS "${common_DIR}/*.fpp")
list(APPEND ${target}_FPPs ${common_FPPs})
file(GLOB common_FYPPs CONFIGURE_DEPENDS "${common_DIR}/*.fypp")
list(APPEND ${target}_FYPPs ${common_FYPPs})
endif()

# Gather:
# * src/[<target>,common]/include/*.fpp
# * (if any) <build>/include/<target>/*.fpp
file(GLOB ${target}_incs CONFIGURE_DEPENDS "${${target}_DIR}/include/*.fpp"
"${CMAKE_BINARY_DIR}/include/${target}/*.fpp")
# * src/[<target>,common]/include/*.fypp
# * (if any) <build>/include/<target>/*.fypp
file(GLOB ${target}_incs CONFIGURE_DEPENDS "${${target}_DIR}/include/*.fypp"
"${CMAKE_BINARY_DIR}/include/${target}/*.fypp")

if (${useCommon})
file(GLOB common_incs CONFIGURE_DEPENDS "${common_DIR}/include/*.fpp")
file(GLOB common_incs CONFIGURE_DEPENDS "${common_DIR}/include/*.fypp")
list(APPEND ${target}_incs ${common_incs})
endif()

# /path/to/*.fpp (used by <target>) -> <build>/fypp/<target>/*.f90
# /path/to/*.fypp (used by <target>) -> <build>/fypp/<target>/*.f90
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/fypp/${target}")
foreach(fpp ${${target}_FPPs})
cmake_path(GET fpp FILENAME fpp_filename)
set(f90 "${CMAKE_BINARY_DIR}/fypp/${target}/${fpp_filename}.f90")
foreach(fypp ${${target}_FYPPs})
cmake_path(GET fypp FILENAME fypp_filename)
set(f90 "${CMAKE_BINARY_DIR}/fypp/${target}/${fypp_filename}.f90")

add_custom_command(
OUTPUT ${f90}
Expand All @@ -356,9 +356,9 @@ macro(HANDLE_SOURCES target useCommon)
-D chemistry=False
--line-numbering
--no-folding
"${fpp}" "${f90}"
DEPENDS "${fpp};${${target}_incs}"
COMMENT "Preprocessing (Fypp) ${fpp_filename}"
"${fypp}" "${f90}"
DEPENDS "${fypp};${${target}_incs}"
COMMENT "Preprocessing (Fypp) ${fypp_filename}"
VERBATIM
)

Expand Down
4 changes: 2 additions & 2 deletions docs/documentation/case.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ end if

Some patch configurations are not adequately handled with the above analytic variable definitions.
In this case, a hard coded patch can be used.
Hard coded patches can be added by adding additional hard coded patch identifiers to `src/pre_process/include/1[2,3]dHardcodedIC.fpp`.
For example, to add a 2D Hardcoded patch with an id of 200, one would add the following to `src/pre_process/include/2dHardcodedIC.fpp`
Hard coded patches can be added by adding additional hard coded patch identifiers to `src/pre_process/include/1[2,3]dHardcodedIC.fypp`.
For example, to add a 2D Hardcoded patch with an id of 200, one would add the following to `src/pre_process/include/2dHardcodedIC.fypp`

```f90
case(200)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
! This file exists so that Fypp can be run without generating case.fpp files for
! This file exists so that Fypp can be run without generating case.fypp files for
! each target. This is useful when generating documentation, for example. This
! should also let MFC be built with CMake directly, without invoking mfc.sh.

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
!!@file m_checker_common.f90
!!@brief Contains module m_checker_common

#:include 'macros.fpp'
#:include 'macros.fypp'

!> @brief The purpose of the module is to check for compatible input files for.
!! inputs common to pre-processing, post-processing and simulation
Expand Down
4 changes: 2 additions & 2 deletions src/common/m_chemistry.fpp → src/common/m_chemistry.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
!! @brief Contains module m_chemistry
!! @author Henry Le Berre <hberre3@gatech.edu>

#:include 'macros.fpp'
#:include 'case.fpp'
#:include 'macros.fypp'
#:include 'case.fypp'

module m_chemistry

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
!! @file m_derived_types.f90
!! @brief Contains module m_derived_types

#:include "macros.fpp"
#:include "macros.fypp"

!> @brief This file contains the definitions of all of the custom-defined
!! types used in the pre-process code.
Expand Down
2 changes: 1 addition & 1 deletion src/common/m_helper.fpp → src/common/m_helper.fypp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#:include 'macros.fpp'
#:include 'macros.fypp'
!>
!! @file m_helper.f90
!! @brief Contains module m_helper
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#:include 'macros.fpp'
#:include 'macros.fypp'

!> @brief The module serves as a proxy to the parameters and subroutines
!! available in the MPI implementation's MPI module. Specifically,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
!> energies (6-eqn to 4-eqn) equilibrium through an infinitely fast (algebraic)
!> procedure.

#:include 'macros.fpp'
#:include 'macros.fypp'

module m_phase_change

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
!! @file m_variables_conversion.f90
!! @brief Contains module m_variables_conversion

#:include 'macros.fpp'
#:include 'case.fpp'
#:include 'macros.fypp'
#:include 'case.fypp'

!> @brief This module consists of subroutines used in the conversion of the
!! conservative variables into the primitive ones and vice versa. In
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
!!@file m_checker.f90
!!@brief Contains module m_checker

#:include 'macros.fpp'
#:include 'macros.fypp'

!> @brief The purpose of the module is to check for compatible input files
module m_checker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
!! @file m_global_parameters.f90
!! @brief Contains module m_global_parameters

#:include 'case.fpp'
#:include 'case.fypp'

!> @brief This module contains all of the parameters characterizing the
!! computational domain, simulation algorithm, stiffened equation of
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
!! @file m_assign_variables.f90
!! @brief Contains module m_assign_variables

#:include 'case.fpp'
#:include 'case.fypp'

module m_assign_variables

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
!> @brief This module contains subroutines that read, and check consistency
!! of, the user provided inputs and data.

#:include 'macros.fpp'
#:include 'macros.fypp'

module m_check_ib_patches

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#:include 'macros.fpp'
#:include 'macros.fypp'

!> @brief This module contains subroutines that read, and check consistency
!! of, the user provided inputs and data.

#:include 'macros.fpp'
#:include 'macros.fypp'

module m_check_patches

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
!!@file m_checker.f90
!!@brief Contains module m_checker

#:include 'macros.fpp'
#:include 'macros.fypp'

!> @brief The purpose of the module is to check for compatible input files
module m_checker
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
!>
!! @file m_compute_levelset.fpp
!! @file m_compute_levelset.fypp
!! @brief Contains module m_compute_levelset

#:include 'macros.fpp'
#:include 'macros.fypp'

!> @brief This module is used to handle all operations related to immersed
!! boundary methods (IBMs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
!! @file m_global_parameters.f90
!! @brief Contains module m_global_parameters

#:include 'case.fpp'
#:include 'case.fypp'

!> @brief This module contains all of the parameters characterizing the
!! computational domain, simulation algorithm, initial condition
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
!>
!! @file m_model.fpp
!! @file m_model.fypp
!! @author Henry Le Berre <hberre3@gatech.edu>
!! @brief Contains module m_model

#:include 'macros.fpp'
#:include 'macros.fypp'

module m_model

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
!>
!! @file m_patches.fpp
!! @file m_patches.fypp
!! @brief Contains module m_patches

#:include 'case.fpp'
#:include '1dHardcodedIC.fpp'
#:include '2dHardcodedIC.fpp'
#:include '3dHardcodedIC.fpp'
#:include 'macros.fpp'
#:include 'case.fypp'
#:include '1dHardcodedIC.fypp'
#:include '2dHardcodedIC.fypp'
#:include '3dHardcodedIC.fypp'
#:include 'macros.fypp'

module m_patches

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
!>
!! @file m_perturbation.fpp
!! @file m_perturbation.fypp
!! @brief Contains module m_perturbation

!> @brief This module contains subroutines that compute perturbations to the
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
!>
!! @file m_acoustic_src.fpp
!! @file m_acoustic_src.fypp
!! @brief Contains module m_acoustic_src

#:include 'macros.fpp'
#:include 'macros.fypp'

!> @brief The module contains the subroutines used to create a acoustic source pressure source term
module m_acoustic_src
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#:include 'macros.fpp'
#:include 'macros.fypp'

module m_body_forces

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
!>
!! @file m_boundary_conditions.fpp
!! @file m_boundary_conditions.fypp
!! @brief Contains module m_boundary_conditions

!> @brief The purpose of the module is to apply noncharacteristic and processor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
!! @file m_bubbles.f90
!! @brief Contains module m_bubbles

#:include 'macros.fpp'
#:include 'macros.fypp'

!> @brief This module contains the procedures shared by the ensemble-averaged and volume-averaged bubble models.
module m_bubbles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
!! @file m_bubbles_EE.f90
!! @brief Contains module m_bubbles_EE

#:include 'macros.fpp'
#:include 'macros.fypp'

!> @brief This module is used to compute the ensemble-averaged bubble dynamic variables
module m_bubbles_EE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
!>
!! @file m_bubbles_EL.fpp
!! @file m_bubbles_EL.fypp
!! @brief Contains module m_bubbles_EL

#:include 'macros.fpp'
#:include 'macros.fypp'

!> @brief This module is used to to compute the volume-averaged bubble model
module m_bubbles_EL
Expand Down
Loading
Loading