]> SALOME platform Git repositories - tools/solverlab.git/blob - CoreFlows/examples/Python/CMakeLists.txt
Salome HOME
c554e5b933b12064b73e7adf7b3143b3f0f462c1
[tools/solverlab.git] / CoreFlows / examples / Python / CMakeLists.txt
1 # Graphic interface---------------------------------------------------------------------------------------------#
2                                                                                                                 #
3 if  ( (EXISTS $ENV{CONFIGURATION_ROOT_DIR}) AND (EXISTS $ENV{KERNEL_ROOT_DIR}) AND (EXISTS $ENV{GUI_ROOT_DIR}) )
4
5         # Common CMake macros
6         # ===================
7         SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
8         IF(EXISTS ${CONFIGURATION_ROOT_DIR})
9           LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
10           INCLUDE(SalomeMacros NO_POLICY_SCOPE)
11         ELSE()
12           MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
13         ENDIF()
14                                                                                                                 #
15         # Find Salome KERNEL 
16         # ==================
17         SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
18         IF( EXISTS ${KERNEL_ROOT_DIR} )
19           FIND_PACKAGE(SalomeKERNEL REQUIRED)
20         ELSE( EXISTS ${KERNEL_ROOT_DIR} )
21           MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR!")
22         ENDIF( EXISTS ${KERNEL_ROOT_DIR} )
23             
24         MESSAGE(STATUS "SalomeKERNEL_VERSION is ${SalomeKERNEL_VERSION}")
25
26         SET(_all_SCRIPTS
27             SinglePhase/SOLVERLAB_2DSphericalExplosion_HEXAGON.py
28             )
29         
30         SALOME_INSTALL_SCRIPTS("${_all_SCRIPTS}" ${SALOME_INSTALL_SCRIPT_PYTHON}/tests)
31         
32         SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH ${PROJECT_BINARY_DIR}/src) 
33         SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
34         
35         ADD_TEST(PythonTests ${PYTHON_EXECUTABLE} ${SALOME_INSTALL_SCRIPT_PYTHON}/tests/SOLVERLAB_2DSphericalExplosion_HEXAGON.py ${CMAKE_INSTALL_PREFIX}/share/meshes/2DHexagonWithTriangles/meshHexagonWithTriangles200.med)
36         SET_TESTS_PROPERTIES(PythonTests PROPERTIES ENVIRONMENT "${tests_env}")
37                                                                                                                 #
38 endif( (EXISTS $ENV{CONFIGURATION_ROOT_DIR}) AND (EXISTS $ENV{KERNEL_ROOT_DIR}) AND (EXISTS $ENV{GUI_ROOT_DIR}) )                                                                                                        #
39 #---------------------------------------------------------------------------------------------------------------#
40
41
42 #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} )
43 #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} )
44
45 ############# python example tests
46
47 function(CreatePythonTest pythonFile)
48     add_test(${pythonFile} ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${pythonFile})
49 #    SET_PROPERTY(TEST ${pythonFile}        PROPERTY ENVIRONMENT LD_LIBRARY_PATH=${TESTS_LIBRARY_PATH} )
50 #    SET_PROPERTY(TEST ${pythonFile} APPEND PROPERTY ENVIRONMENT      PYTHONPATH=${TESTS_PYTHON_PATH}  )
51 endfunction(CreatePythonTest)
52
53 # copy all *.py tests files before build
54 file(GLOB pythonTestFiles "*.py" )
55 file(COPY ${pythonTestFiles} DESTINATION ${CMAKE_CURRENT_BINARY_DIR} 
56     FILE_PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE
57 )
58
59 CreatePythonTest(DiffusionEquation/DiffusionEquation_1DHeatedRod.py)
60 CreatePythonTest(DiffusionEquation/DiffusionEquation_1DHeatedRod_FE.py)
61 add_test(DiffusionEquation/DiffusionEquation_2DSpherical_FE ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/DiffusionEquation/DiffusionEquation_2DSpherical.py 1)
62 add_test(DiffusionEquation/DiffusionEquation_2DSpherical_FV ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/DiffusionEquation/DiffusionEquation_2DSpherical.py 0)
63
64 CreatePythonTest(DriftModel/DriftModel_1DBoilingAssembly.py)
65 CreatePythonTest(DriftModel/DriftModel_1DBoilingChannel.py)
66 CreatePythonTest(DriftModel/DriftModel_1DChannelGravity.py)
67 CreatePythonTest(DriftModel/DriftModel_1DDepressurisation.py)
68 CreatePythonTest(DriftModel/DriftModel_1DPorosityJump.py)
69 CreatePythonTest(DriftModel/DriftModel_1DPressureLoss.py)
70 CreatePythonTest(DriftModel/DriftModel_1DRiemannProblem.py)
71 CreatePythonTest(DriftModel/DriftModel_1DVidangeReservoir.py)
72 CreatePythonTest(DriftModel/DriftModel_2BranchesBoilingChannels.py)
73 CreatePythonTest(DriftModel/DriftModel_2DInclinedChannelGravity.py)
74 CreatePythonTest(DriftModel/DriftModel_2DInclinedChannelGravityTriangles.py)
75 CreatePythonTest(DriftModel/DriftModel_2DInclinedChannelGravityBarriers.py)
76 CreatePythonTest(DriftModel/DriftModel_2DBoilingChannelBarrier.py)
77 CreatePythonTest(DriftModel/DriftModel_2DInclinedBoilingChannelBarrier.py)
78 CreatePythonTest(DriftModel/DriftModel_2DInclinedBoilingChannel.py)
79 CreatePythonTest(DriftModel/DriftModel_2DPorosityJump.py)
80 CreatePythonTest(DriftModel/DriftModel_2DPressureLoss.py)
81 CreatePythonTest(DriftModel/DriftModel_2DVidangeReservoir.py)
82 CreatePythonTest(DriftModel/DriftModel_2DVidangeReservoirUnstructured.py)
83 CreatePythonTest(DriftModel/DriftModel_3DBoilingChannelBarrier.py)
84
85 CreatePythonTest(FiveEqsTwoFluid/FiveEqsTwoFluid_1DBoilingAssembly.py)
86 CreatePythonTest(FiveEqsTwoFluid/FiveEqsTwoFluid_1DBoilingChannel.py)
87 CreatePythonTest(FiveEqsTwoFluid/FiveEqsTwoFluid_1DVidangeReservoir.py)
88 CreatePythonTest(FiveEqsTwoFluid/FiveEqsTwoFluid_2DInclinedBoilingChannel.py)
89 CreatePythonTest(FiveEqsTwoFluid/FiveEqsTwoFluid_2DInclinedSedimentation.py)
90 CreatePythonTest(FiveEqsTwoFluid/FiveEqsTwoFluid_2DVidangeReservoir.py)
91
92 CreatePythonTest(IsothermalTwoFluid/IsothermalTwoFluid_1DSedimentation.py)
93 CreatePythonTest(IsothermalTwoFluid/IsothermalTwoFluid_1DVidangeReservoir.py)
94 CreatePythonTest(IsothermalTwoFluid/IsothermalTwoFluid_2DVidangeReservoir.py)
95
96 CreatePythonTest(SinglePhase/SinglePhase_1DDepressurisation.py)
97 CreatePythonTest(SinglePhase/SinglePhase_1DHeatedAssembly.py)
98 CreatePythonTest(SinglePhase/SinglePhase_1DHeatedChannel.py)
99 CreatePythonTest(SinglePhase/SinglePhase_1DHeatedChannel_Implicit.py)
100 CreatePythonTest(SinglePhase/SinglePhase_1DRiemannProblem.py)
101 CreatePythonTest(SinglePhase/SinglePhase_1DRiemannProblem_Implicit.py)
102 CreatePythonTest(SinglePhase/SinglePhase_1DRiemannProblem_Implicit_LineSearch.py)
103 CreatePythonTest(SinglePhase/SinglePhase_1DWaterHammer.py)
104 CreatePythonTest(SinglePhase/SinglePhase_2BranchesHeatedChannels.py)
105 CreatePythonTest(SinglePhase/SinglePhase_2DVidangeReservoir.py)
106 CreatePythonTest(SinglePhase/SinglePhase_2DLidDrivenCavity.py)
107 CreatePythonTest(SinglePhase/SinglePhase_2DLidDrivenCavity_unstructured.py)
108 CreatePythonTest(SinglePhase/SinglePhase_2DPoiseuilleFlow.py)
109 CreatePythonTest(SinglePhase/SinglePhase_2DPoiseuilleFlow_restart.py)
110 CreatePythonTest(SinglePhase/SinglePhase_2DPoiseuilleFlow_outputFields.py)
111 CreatePythonTest(SinglePhase/SinglePhase_2DAirfoil.py)
112 CreatePythonTest(SinglePhase/SinglePhase_2DSphericalExplosion_unstructured.py)
113 CreatePythonTest(SinglePhase/SinglePhase_2DSphericalExplosion_HEXAGON.py)
114 CreatePythonTest(SinglePhase/SinglePhase_3DSphericalExplosion_TETRAHEDRON.py)
115 CreatePythonTest(SinglePhase/SinglePhase_2DHeatedChannelInclined.py)
116 CreatePythonTest(SinglePhase/SinglePhase_2DThermalDiffusion.py)
117 CreatePythonTest(SinglePhase/SinglePhase_2DWallHeatedChannel_ChangeSect.py)
118 CreatePythonTest(SinglePhase/SinglePhase_3DSphericalExplosion_unstructured.py)
119 CreatePythonTest(SinglePhase/SinglePhase_3DHeatDrivenCavity.py)
120 CreatePythonTest(SinglePhase/SinglePhase_3DVortexTube_NoCone_NoViscosity.py)
121 CreatePythonTest(SinglePhase/SinglePhase_3DVortexTube_WithCone_NoViscosity.py)
122
123 CreatePythonTest(TransportEquation/TransportEquation_1DHeatedChannel.py)
124
125 CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_2DEF.py)
126 CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_2DEF_Neumann.py)
127 CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_2DFV_StructuredTriangles.py)
128 CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_2DFV_EquilateralTriangles.py)
129 CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_2DFV_StructuredSquares.py)
130 CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_2DFV_StructuredSquares_Neumann.py)
131 CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_3DEF.py)
132 CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_3DFV_StructuredCubes.py)
133 CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_3DFV_StructuredTetrahedra.py)
134 CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_3DEF_RoomCooling.py)
135 CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_3DVF_RoomCooling_StructuredCubes.py)
136 CreatePythonTest(StationaryDiffusionEquation/StationaryDiffusionEquation_3DVF_RoomCooling_UnstructuredTetras.py)
137
138 if( SOLVERLAB_WITH_MPI )
139   add_test(NAME MPI4PY_2Procs                                        COMMAND "${MPIEXEC}" "-n" "2" "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/MPI4PY/testMPI4PY.py")     
140   add_test(NAME StationaryDiffusion_TwoIndependentSimulations_2Procs COMMAND "${MPIEXEC}" "-n" "2" "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/MPI4PY/testTwoSimulations.py")     
141   add_test(NAME SendRecvMEDCouplingFieldSameMesh_2Procs              COMMAND "${MPIEXEC}" "-n" "2" "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/MPI4PY/testSendRecvFieldSameMesh.py")     
142   add_test(NAME SendRecvMEDCouplingFieldDifferentMeshes_2Procs       COMMAND "${MPIEXEC}" "-n" "2" "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/MPI4PY/testSendRecvFieldDifferentMeshes.py")     
143   add_test(NAME SendRecvMEDCouplingFieldSubComm_4Procs               COMMAND "${MPIEXEC}" "-n" "4" "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/MPI4PY/testSendRecvFieldSubComm.py")     
144 endif( SOLVERLAB_WITH_MPI )
145
146 ############# python convergence tests
147
148 function(CreatePythonConvergenceTest model convergenceTest pythonSolver MESHES_AND_PICTURES_PATH)
149     FILE(GLOB MY_MESHES_AND_PICTURES  MESHES_AND_PICTURES_PATH )
150     file(COPY convergence_${model}_${convergenceTest}.py ../${pythonSolver} ${MY_MESHES_AND_PICTURES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR} FILE_PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE )
151
152     add_test(convergence_${model}_${convergenceTest} ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/convergence_${model}_${convergenceTest}.py)
153     #SET_PROPERTY(TEST convergence_${model}_${convergenceTest}        PROPERTY ENVIRONMENT LD_LIBRARY_PATH=${TESTS_LIBRARY_PATH} )
154     #SET_PROPERTY(TEST convergence_${model}_${convergenceTest} APPEND PROPERTY ENVIRONMENT      PYTHONPATH=${TESTS_PYTHON_PATH} )
155
156 endfunction(CreatePythonConvergenceTest)
157
158 add_subdirectory (Convergence/StationaryDiffusion)
159 add_subdirectory (Convergence/SinglePhase)
160