Skip to content

Commit 28eec3d

Browse files
author
Martin D. Weinberg
committed
Merge branch 'AddUnits' of github.com:EXP-code/EXP into AddUnits
2 parents a69dcba + 27c1763 commit 28eec3d

5 files changed

Lines changed: 75 additions & 18 deletions

File tree

CMakeLists.txt

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,41 @@ endif()
4747
# Build options
4848
option(ENABLE_NBODY "Enable EXP n-body" ON)
4949
option(ENABLE_PYEXP "Enable the Python bindings" ON)
50+
option(ENABLE_PYEXP_ONLY "Python bindings and support libraries only" OFF)
51+
option(ENABLE_UTILS "Enable build of the EXP standalone utilities" OFF)
5052
option(ENABLE_PNG "Enable PNG graphics support" FALSE)
5153
option(ENABLE_CUDA "Enable CUDA" FALSE)
5254
option(ENABLE_SLURM "Enable SLURM checkpointing support" FALSE)
5355
option(ENABLE_XDR "Enable RPC/XDR support for Tipsy standard" FALSE)
5456
option(ENABLE_VTK "Configure VTK if available" FALSE)
5557
option(ENABLE_CUDA_SINGLE "Use real*4 instead of real*8 for CUDA" FALSE)
56-
option(ENABLE_USER "Enable basic user modules" ON)
58+
option(ENABLE_USER "Enable compilation of user modules" ON)
5759
option(ENABLE_SLCHECK "Enable *careful* Sturm-Liouville solutions" TRUE)
5860
option(ENABLE_TESTS "Enable build tests for EXP, pyEXP and helpers" ON)
61+
option(ENABLE_MINIMAL "Compile EXP support libraries only" OFF)
5962
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
6063
option(BUILD_DOCS "Build documentation" OFF)
6164

65+
# Metaflag for minimal build
66+
67+
if(ENABLE_MINIMAL)
68+
set(ENABLE_NBODY OFF)
69+
set(ENABLE_PYEXP OFF)
70+
set(ENABLE_USER OFF)
71+
set(ENABLE_UTILS OFF)
72+
set(ENABLE_TESTS OFF)
73+
endif()
74+
75+
# Metaflag for pyEXP only
76+
77+
if(ENABLE_PYEXP_ONLY)
78+
set(ENABLE_NBODY OFF)
79+
set(ENABLE_PYEXP ON)
80+
set(ENABLE_USER OFF)
81+
set(ENABLE_UTILS OFF)
82+
set(ENABLE_TESTS OFF)
83+
endif()
84+
6285
# Set mpirun launcher for CTest
6386

6487
set(EXP_MPI_LAUNCH "mpirun" CACHE STRING "Command to run an MPI application (for unit tests only)")
@@ -253,12 +276,15 @@ add_subdirectory(expui)
253276
if (ENABLE_NBODY)
254277
add_subdirectory(src)
255278
endif()
256-
add_subdirectory(utils)
279+
if (ENABLE_UTILS)
280+
add_subdirectory(utils)
281+
endif()
257282
if (ENABLE_PYEXP)
258283
add_subdirectory(pyEXP)
259284
endif()
260-
261-
add_subdirectory(extern/user-modules)
285+
if (ENABLE_USER)
286+
add_subdirectory(extern/user-modules)
287+
endif()
262288

263289
# Build the tests; set ENABLE_TEST=OFF to disable
264290
if(ENABLE_TESTS)

expui/BiorthBasis.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,6 +1546,11 @@ namespace BasisClasses
15461546

15471547
if (dmodel.compare("MN")==0) // Miyamoto-Nagai
15481548
model = std::make_shared<MNdisk>(1.0, H);
1549+
else if (DTYPE == DiskType::python) {
1550+
model = std::make_shared<AxiSymPyModel>(pyname, acyl);
1551+
std::cout << "Using AxiSymPyModel for deprojection from Python function <"
1552+
<< pyname << ">" << std::endl;
1553+
}
15491554
else // Default to exponential
15501555
model = std::make_shared<Exponential>(1.0, H);
15511556

expui/CMakeLists.txt

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,20 @@ install(TARGETS expui DESTINATION lib)
4848

4949
# Configure and build the test routines
5050
#
51-
add_executable(nativetoh5 coefstoh5.cc)
52-
add_executable(h5compare h5compare.cc)
53-
add_executable(viewcoefs viewcoefs.cc)
54-
add_executable(h5power h5power.cc)
55-
add_executable(makecoefs makecoefs.cc)
56-
add_executable(testread testread.cc)
57-
add_executable(testunits testunits.cc)
51+
if(ENABLE_UTILS)
52+
add_executable(nativetoh5 coefstoh5.cc)
53+
add_executable(h5compare h5compare.cc)
54+
add_executable(viewcoefs viewcoefs.cc)
55+
add_executable(h5power h5power.cc)
56+
add_executable(makecoefs makecoefs.cc)
57+
add_executable(testread testread.cc)
58+
add_executable(testunits testunits.cc)
5859

59-
foreach(program ${bin_PROGRAMS})
60-
target_link_libraries(${program} expui exputil ${common_LINKLIB})
61-
target_include_directories(${program} PUBLIC ${common_INCLUDE})
62-
target_compile_options(${program} PUBLIC ${OpenMP_CXX_FLAGS})
63-
install(TARGETS ${program} DESTINATION bin)
64-
endforeach()
60+
foreach(program ${bin_PROGRAMS})
61+
target_link_libraries(${program} expui exputil ${common_LINKLIB})
62+
target_include_directories(${program} PUBLIC ${common_INCLUDE})
63+
target_compile_options(${program} PUBLIC ${OpenMP_CXX_FLAGS})
64+
install(TARGETS ${program} DESTINATION bin)
65+
endforeach()
66+
67+
endif()

expui/UnitValidator.H

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <map>
44

55
/** Class to validate unit types and names The allowed types and units
6-
can be extended as needed by adding new names and aliasess to
6+
can be extended as needed by adding new names and aliases to
77
UnitValidator::createAllowedUnitTypes() and
88
UnitValidator::createAllowedUnitNames() in UnitValidator.cc
99
*/

include/DiskModels.H

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,4 +277,27 @@ public:
277277

278278
};
279279

280+
//! Enforce an axisymmetric model by using the x-axis only from a
281+
//! user-defined Python model
282+
class AxiSymPyModel : public EmpCylSL::AxiDisk
283+
{
284+
private:
285+
286+
std::shared_ptr<DiskDensityFunc> pyDens;
287+
double scale;
288+
289+
public:
290+
291+
AxiSymPyModel(const std::string& pyname, double a) : scale(a)
292+
{
293+
pyDens = std::make_shared<DiskDensityFunc>(pyname);
294+
}
295+
296+
double operator()(double R, double z, double phi=0.)
297+
{
298+
return (*pyDens)(R*scale, z*scale, 0.0);
299+
}
300+
301+
};
302+
280303
#endif

0 commit comments

Comments
 (0)