]> SALOME platform Git repositories - tools/solverlab.git/blob - CoreFlows/examples/Python/CMakeLists.txt
Salome HOME
Exemple d'étude pour l'assemblée générale STMF
[tools/solverlab.git] / CoreFlows / examples / Python / CMakeLists.txt
1 # Graphic interface---------------------------------------------------------------------------------------------#
2                                                                                                                 #
3 if (COREFLOWS_WITH_GUI)                                                                                                                          
4                                                                                                                 #
5         # Find KERNEL 
6         # ==============
7         SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
8         IF( EXISTS ${KERNEL_ROOT_DIR} )
9           LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
10           LIST(APPEND CMAKE_PREFIX_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
11           INCLUDE(SalomeMacros)
12           FIND_PACKAGE(SalomeKERNEL REQUIRED)
13         ELSE( EXISTS ${KERNEL_ROOT_DIR} )
14           MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR!")
15         ENDIF( EXISTS ${KERNEL_ROOT_DIR} )
16         
17         # Find SALOME GUI 
18         # ==============
19         SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
20         IF(EXISTS ${GUI_ROOT_DIR})
21           LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
22           LIST(APPEND CMAKE_PREFIX_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
23           FIND_PACKAGE(SalomeGUI)
24         ELSE(EXISTS ${GUI_ROOT_DIR})
25           MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR!")
26         ENDIF(EXISTS ${GUI_ROOT_DIR})
27         
28         # Platform setup
29         # ==============
30         INCLUDE(SalomeSetupPlatform)   # From KERNEL
31             
32         # Prerequisites
33         # =============
34         
35         # Mandatory products
36         IF(  $ENV{PARAVIEW_VERSION} STRLESS "5")
37                  FIND_PACKAGE(SalomePython REQUIRED)
38         ELSE()
39                  FIND_PACKAGE(SalomePythonInterp REQUIRED)
40                  FIND_PACKAGE(SalomePythonLibs REQUIRED)
41         ENDIF()
42         
43         SET(_all_SCRIPTS
44             main_tests.py
45             )
46         
47         SALOME_INSTALL_SCRIPTS("${_all_SCRIPTS}" ${SALOME_INSTALL_SCRIPT_PYTHON}/tests)
48         
49         SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH ${PROJECT_BINARY_DIR}/src) 
50         SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
51         
52         ADD_TEST(PythonTests ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/main_tests.py)
53         SET_TESTS_PROPERTIES(PythonTests PROPERTIES ENVIRONMENT "${tests_env}")
54                                                                                                                 #
55 endif (COREFLOWS_WITH_GUI)                                                                                                        #
56 #---------------------------------------------------------------------------------------------------------------#
57
58
59 #SET(TESTS_LIBRARY_PATH ${CMAKE_BINARY_DIR}/Models/src:${CDMATH_DIR}/lib:${MEDCOUPLING_LIBRARIES}:${MEDFILE_C_LIBRARIES}:${PETSC_DIR}/${PETSC_ARCH}/lib:${PV_LIB_DIR} )
60 #SET(TESTS_PYTHON_PATH  ${CMAKE_BINARY_DIR}/Models/src:${CMAKE_BINARY_DIR}/swig:${CDMATH_DIR}/lib:${CDMATH_DIR}/lib/cdmath:${CDMATH_DIR}/bin/cdmath:${CDMATH_DIR}/bin/cdmath/postprocessing:${MEDCOUPLING_LIBRARIES}:${MEDFILE_C_LIBRARIES}:${PETSC_DIR}/${PETSC_ARCH}/lib:${PV_PYTHON_DIR} )
61
62 ############# python example tests
63
64 function(CreatePythonTest pythonFile)
65     add_test(${pythonFile} ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${pythonFile})
66 #    SET_PROPERTY(TEST ${pythonFile}        PROPERTY ENVIRONMENT LD_LIBRARY_PATH=${TESTS_LIBRARY_PATH} )
67 #    SET_PROPERTY(TEST ${pythonFile} APPEND PROPERTY ENVIRONMENT      PYTHONPATH=${TESTS_PYTHON_PATH}  )
68 endfunction(CreatePythonTest)
69
70 # copy all *.py tests files before build
71 file(GLOB pythonTestFiles "*.py" )
72 file(COPY ${pythonTestFiles} DESTINATION ${CMAKE_CURRENT_BINARY_DIR} 
73     FILE_PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE
74 )
75
76 # copy all mesh files before build
77 file(COPY ../resources DESTINATION ${CMAKE_CURRENT_BINARY_DIR} 
78     FILE_PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE
79 )
80
81 CreatePythonTest(DiffusionEquation/DiffusionEquation_1DHeatedRod.py)
82 CreatePythonTest(DiffusionEquation/DiffusionEquation_1DHeatedRod_FE.py)
83
84 CreatePythonTest(DriftModel/DriftModel_1DBoilingAssembly.py)
85 CreatePythonTest(DriftModel/DriftModel_1DBoilingChannel.py)
86 CreatePythonTest(DriftModel/DriftModel_1DChannelGravity.py)
87 CreatePythonTest(DriftModel/DriftModel_1DDepressurisation.py)
88 CreatePythonTest(DriftModel/DriftModel_1DPorosityJump.py)
89 CreatePythonTest(DriftModel/DriftModel_1DPressureLoss.py)
90 CreatePythonTest(DriftModel/DriftModel_1DRiemannProblem.py)
91 CreatePythonTest(DriftModel/DriftModel_1DVidangeReservoir.py)
92 CreatePythonTest(DriftModel/DriftModel_2BranchesBoilingChannels.py)
93 CreatePythonTest(DriftModel/DriftModel_2DInclinedChannelGravity.py)
94 CreatePythonTest(DriftModel/DriftModel_2DInclinedChannelGravityTriangles.py)
95 CreatePythonTest(DriftModel/DriftModel_2DInclinedChannelGravityBarriers.py)
96 CreatePythonTest(DriftModel/DriftModel_2DBoilingChannelBarrier.py)
97 CreatePythonTest(DriftModel/DriftModel_2DInclinedBoilingChannelBarrier.py)
98 CreatePythonTest(DriftModel/DriftModel_2DInclinedBoilingChannel.py)
99 CreatePythonTest(DriftModel/DriftModel_2DPorosityJump.py)
100 CreatePythonTest(DriftModel/DriftModel_2DPressureLoss.py)
101 CreatePythonTest(DriftModel/DriftModel_2DVidangeReservoir.py)
102 CreatePythonTest(DriftModel/DriftModel_2DVidangeReservoirUnstructured.py)
103 CreatePythonTest(DriftModel/DriftModel_3DBoilingChannelBarrier.py)
104
105 CreatePythonTest(FiveEqsTwoFluid/FiveEqsTwoFluid_1DBoilingAssembly.py)
106 CreatePythonTest(FiveEqsTwoFluid/FiveEqsTwoFluid_1DBoilingChannel.py)
107 CreatePythonTest(FiveEqsTwoFluid/FiveEqsTwoFluid_1DVidangeReservoir.py)
108 CreatePythonTest(FiveEqsTwoFluid/FiveEqsTwoFluid_2DInclinedBoilingChannel.py)
109 CreatePythonTest(FiveEqsTwoFluid/FiveEqsTwoFluid_2DInclinedSedimentation.py)
110 CreatePythonTest(FiveEqsTwoFluid/FiveEqsTwoFluid_2DVidangeReservoir.py)
111
112 CreatePythonTest(IsothermalTwoFluid/IsothermalTwoFluid_1DSedimentation.py)
113 CreatePythonTest(IsothermalTwoFluid/IsothermalTwoFluid_1DVidangeReservoir.py)
114 CreatePythonTest(IsothermalTwoFluid/IsothermalTwoFluid_2DVidangeReservoir.py)
115
116 CreatePythonTest(SinglePhase/SinglePhase_1DDepressurisation.py)
117 CreatePythonTest(SinglePhase/SinglePhase_1DHeatedAssembly.py)
118 CreatePythonTest(SinglePhase/SinglePhase_1DHeatedChannel.py)
119 CreatePythonTest(SinglePhase/SinglePhase_1DRiemannProblem.py)
120 CreatePythonTest(SinglePhase/SinglePhase_1DWaterHammer.py)
121 CreatePythonTest(SinglePhase/SinglePhase_2BranchesHeatedChannels.py)
122 CreatePythonTest(SinglePhase/SinglePhase_2DVidangeReservoir.py)
123 CreatePythonTest(SinglePhase/SinglePhase_2DLidDrivenCavity.py)
124 CreatePythonTest(SinglePhase/SinglePhase_2DLidDrivenCavity_unstructured.py)
125 CreatePythonTest(SinglePhase/SinglePhase_2DPoiseuilleFlow.py)
126 CreatePythonTest(SinglePhase/SinglePhase_2DPoiseuilleFlow_restart.py)
127 CreatePythonTest(SinglePhase/SinglePhase_2DPoiseuilleFlow_outputFields.py)
128 CreatePythonTest(SinglePhase/SinglePhase_2DSphericalExplosion_unstructured.py)
129 CreatePythonTest(SinglePhase/SinglePhase_2DSphericalExplosion_HEXAGON.py)
130 CreatePythonTest(SinglePhase/SinglePhase_2DHeatedChannelInclined.py)
131 CreatePythonTest(SinglePhase/SinglePhase_2DThermalDiffusion.py)
132 CreatePythonTest(SinglePhase/SinglePhase_2DWallHeatedChannel_ChangeSect.py)
133 CreatePythonTest(SinglePhase/SinglePhase_3DSphericalExplosion_unstructured.py)
134 CreatePythonTest(SinglePhase/SinglePhase_3DHeatDrivenCavity.py)
135 CreatePythonTest(SinglePhase/SinglePhase_3DVortexTube_NoCone_NoViscosity.py)
136 CreatePythonTest(SinglePhase/SinglePhase_3DVortexTube_WithCone_NoViscosity.py)
137
138 CreatePythonTest(TransportEquation/TransportEquation_1DHeatedChannel.py)
139
140 CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_2DEF.py)
141 CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_2DEF_Neumann.py)
142 CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_2DFV_StructuredTriangles.py)
143 CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_2DFV_EquilateralTriangles.py)
144 CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_2DFV_StructuredSquares.py)
145 CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_2DFV_StructuredSquares_Neumann.py)
146 CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_3DEF.py)
147 CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_3DFV_StructuredCubes.py)
148 CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_3DFV_StructuredTetrahedra.py)
149 CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_3DEF_RoomCooling.py)
150 CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_3DVF_RoomCooling_StructuredCubes.py)
151 CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_3DVF_RoomCooling_UnstructuredTetras.py)
152
153 ############# python convergence tests
154
155 function(CreatePythonConvergenceTest model convergenceTest pythonSolver MESHES_AND_PICTURES_PATH)
156     FILE(GLOB MY_MESHES_AND_PICTURES  MESHES_AND_PICTURES_PATH )
157     file(COPY convergence_${model}_${convergenceTest}.py ../${pythonSolver} ${MY_MESHES_AND_PICTURES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR} FILE_PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE )
158
159     add_test(convergence_${model}_${convergenceTest} ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/convergence_${model}_${convergenceTest}.py)
160     SET_PROPERTY(TEST convergence_${model}_${convergenceTest}        PROPERTY ENVIRONMENT LD_LIBRARY_PATH=${TESTS_LIBRARY_PATH} )
161     SET_PROPERTY(TEST convergence_${model}_${convergenceTest} APPEND PROPERTY ENVIRONMENT      PYTHONPATH=${TESTS_PYTHON_PATH} )
162
163 endfunction(CreatePythonConvergenceTest)
164
165 add_subdirectory (Convergence/StationaryDiffusion)
166