Merge branch 'master' of bitbucket.org:glavaux/cosmotool
This commit is contained in:
commit
286d094dbb
@ -22,11 +22,13 @@ option(INTERNAL_HDF5 "Build internal version of HDF5" OFF)
|
||||
option(INTERNAL_NETCDF "Build internal version of NETCDF" OFF)
|
||||
option(INTERNAL_BOOST "Build internal version of BOOST" OFF)
|
||||
|
||||
IF(BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
|
||||
IF(NOT BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
|
||||
SET(CosmoTool_local CosmoTool_static)
|
||||
ELSE(BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
|
||||
ELSE(NOT BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
|
||||
SET(CosmoTool_local CosmoTool)
|
||||
ENDIF(BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
|
||||
ENDIF(NOT BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
|
||||
|
||||
MESSAGE(STATUS "Using the target ${CosmoTool_local} to build python module")
|
||||
|
||||
include(${CMAKE_SOURCE_DIR}/external/external_build.cmake)
|
||||
|
||||
|
@ -154,6 +154,8 @@ def get_grid_values(xx,data, ranges):
|
||||
def get_mean_density(fdir, smin, step):
|
||||
""" estimate ensemble mean
|
||||
"""
|
||||
import progressbar as pb
|
||||
|
||||
print('-'*60)
|
||||
print('Get 3D ensemble mean density field')
|
||||
print('-'*60)
|
||||
@ -174,23 +176,23 @@ def get_mean_density(fdir, smin, step):
|
||||
fname1 = fdir + 'final_density_'+str(idat)+'.dat'
|
||||
#and (idat<smin+1000)
|
||||
while((os.path.exists(fname0))):
|
||||
auxdata0,auxranges0=read_borg_vol(fname0)
|
||||
auxdata1,auxranges1=read_borg_vol(fname1)
|
||||
auxx0=auxdata0
|
||||
auxx1=auxdata1
|
||||
MEAN0+=auxx0
|
||||
VAR0+=auxx0**2
|
||||
MEAN1+=auxx1
|
||||
VAR1+=auxx1**2
|
||||
auxdata0,auxranges0=read_borg_vol(fname0)
|
||||
auxdata1,auxranges1=read_borg_vol(fname1)
|
||||
auxx0=auxdata0
|
||||
auxx1=auxdata1
|
||||
MEAN0+=auxx0
|
||||
VAR0+=auxx0**2
|
||||
MEAN1+=auxx1
|
||||
VAR1+=auxx1**2
|
||||
|
||||
norm+=1
|
||||
idat+=step
|
||||
fname0 = fdir + 'initial_density_'+str(idat)+'.dat'
|
||||
fname1 = fdir + 'final_density_'+str(idat)+'.dat'
|
||||
del auxranges0
|
||||
del auxdata0
|
||||
del auxranges1
|
||||
del auxdata1
|
||||
norm+=1
|
||||
idat+=step
|
||||
fname0 = fdir + 'initial_density_'+str(idat)+'.dat'
|
||||
fname1 = fdir + 'final_density_'+str(idat)+'.dat'
|
||||
del auxranges0
|
||||
del auxdata0
|
||||
del auxranges1
|
||||
del auxdata1
|
||||
|
||||
MEAN0/=norm
|
||||
VAR0/=norm
|
||||
@ -208,6 +210,8 @@ def get_mean_density(fdir, smin, step):
|
||||
def get_mean_density_fdir(fdir,init,steps):
|
||||
""" estimate ensemble mean
|
||||
"""
|
||||
import progressbar as pb
|
||||
|
||||
print('-'*60)
|
||||
print('Get 3D ensemble mean density field')
|
||||
print('-'*60)
|
||||
@ -227,7 +231,7 @@ def get_mean_density_fdir(fdir,init,steps):
|
||||
norm0=0.
|
||||
norm1=0.
|
||||
|
||||
for fn in fname0:
|
||||
for fn in pb.ProgressBar(len(fname0))(fname0):
|
||||
auxborg=read_borg_vol(fn)
|
||||
auxdata0 = auxborg.density
|
||||
MEAN0+=auxdata0
|
||||
@ -236,7 +240,7 @@ def get_mean_density_fdir(fdir,init,steps):
|
||||
del auxdata0
|
||||
del auxborg
|
||||
|
||||
for fn in fname1:
|
||||
for fn in pb.ProgressBar(len(fname1))(fname1):
|
||||
auxborg1=read_borg_vol(fn)
|
||||
auxdata1 = auxborg1.density
|
||||
MEAN1+=auxdata1
|
||||
|
@ -1,4 +1,3 @@
|
||||
add_definitions(-fPIC)
|
||||
|
||||
SET(CosmoTool_SRCS
|
||||
fortran.cpp
|
||||
@ -75,9 +74,11 @@ if (BUILD_SHARED_LIBS)
|
||||
target_link_libraries(CosmoTool ${CosmoTool_LIBS})
|
||||
if (BUILD_STATIC_LIBS)
|
||||
add_library(CosmoTool_static STATIC ${CosmoTool_SRCS})
|
||||
set_target_properties(CosmoTool_static PROPERTIES COMPILE_FLAGS "${CMAKE_C_COMPILE_OPTIONS_PIC}")
|
||||
endif(BUILD_STATIC_LIBS)
|
||||
else (BUILD_SHARED_LIBS)
|
||||
add_library(CosmoTool STATIC ${CosmoTool_SRCS})
|
||||
set_target_properties(CosmoTool PROPERTIES COMPILE_FLAGS "${CMAKE_C_COMPILE_OPTIONS_PIC}")
|
||||
endif (BUILD_SHARED_LIBS)
|
||||
|
||||
install(TARGETS CosmoTool
|
||||
|
Loading…
Reference in New Issue
Block a user