Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Roy Fabrice
pFoF
Commits
75d906e3
Commit
75d906e3
authored
Nov 13, 2019
by
Roy Fabrice
Browse files
haloanalyzer is a mess
everythink should be checked and eventually written from scratch
parent
621979cd
Changes
8
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
75d906e3
...
...
@@ -23,3 +23,4 @@ clean:
cd
tools/conepartcreator/src
;
make clean
cd
tools/conegravcreator/src
;
make clean
cd
tools/conemapper/src
;
make clean
rm
-f
mod/
*
obj/
*
common/src/modreadhalo.f90
View file @
75d906e3
...
...
@@ -42,7 +42,8 @@ contains
position_halo
,
velocity_halo
,
rmax_halo
,
identity_halo
,
npart_halo
)
use
iso_fortran_env
,
only
:
ERROR_UNIT
,
OUTPUT_UNIT
use
modconstant
,
only
:
IDKIND
,
type_common_metadata
,
type_parameter_pfof
,
type_info_ramses
,
type_info_cone_part
use
modconstant
,
only
:
IDKIND
,
type_common_metadata
,
type_parameter_pfof
use
type_info_ramses_mod
,
only
:
type_info_ramses
,
type_info_cone_part
use
fortran_hdf5_constants_m
,
only
:
H5_FILENAME_LEN
,
H5_STR_LEN
use
fortran_hdf5_manage_files_m
,
only
:
hdf5_close_file
,
hdf5_open_file
use
fortran_hdf5_manage_groups_m
,
only
:
hdf5_close_group
,
hdf5_open_group
...
...
@@ -167,13 +168,14 @@ contains
use
fortran_hdf5_read_data_m
use
iso_fortran_env
,
only
:
ERROR_UNIT
,
OUTPUT_UNIT
use
modconstant
,
only
:
ERR_MSG_LEN
,
IDKIND
,
&
type_common_metadata
,
type_parameter_pfof
,
type_info_ramses
,
type_info_cone_part
type_common_metadata
,
type_parameter_pfof
use
type_info_ramses_mod
,
only
:
type_info_ramses
,
type_info_cone_part
use
modmpicommons
,
only
:
type_info_process
use
modreadmeta
,
only
:
Read_meta_common
,
&
Read_meta_halofinder_parameter
,
&
Read_meta_info_cone
,
&
Read_meta_info_ramses
use
hdf5
,
only
:
HID_T
type
(
type_info_process
),
intent
(
in
)
::
info_proc
character
(
len
=
H5_FILENAME_LEN
),
intent
(
in
)
::
filename
...
...
tools/haloanalyzer/src/Makefile
View file @
75d906e3
include
../../../Make.inc
EXE
=
haloanalyzer
COMMONDIR
=
../../../common/src/
OBJDIR
=
../../../obj/
MODDIR
=
../../../mod/
VPATH
=
$(COMMONDIR)
:.
SRC
=
modhdf5.f90
\
modconstant.f90
\
EXE
=
haloanalyzer.exe
SRC
=
modconstant.f90
\
type_info_ramses_mod.f90
\
error_handling_mod.f90
\
type_particles_mod.f90
\
haloanalyzer_var_mod.f90
\
haloanalyzer_init_mod.f90
\
modvarcommons.f90
\
modmpicommons.f90
\
modvariable.f90
\
modreadmeta.f90
\
modreadhalo.f90
\
modfunctions.f90
\
...
...
@@ -39,20 +38,20 @@ $(OBJDIR)%.o:%.f90
@
echo
"--------------------------------"
@
echo
building
$*
.o with parameters
\
FC
=
$(FC)
,
FCFLAGS
=
$(FCFLAGS)
$(FC)
-c
$(FCFLAGS)
$<
-o
$@
$(FC)
-c
$(FCFLAGS)
$<
-o
$@
#
%.mod:%.f90
#
@echo "--------------------------------"
#
@echo building $*.mod with parameters \
#
FC=$(FC), FCFLAGS=$(FCFLAGS)
#
$(FC) -c $(FCFLAGS) $<
$(MODDIR)
%.mod
:
%.f90
@
echo
"--------------------------------"
@
echo
building
$*
.mod with parameters
\
FC
=
$(FC)
,
FCFLAGS
=
$(FCFLAGS)
$(FC)
-c
$(FCFLAGS)
$<
all
:
release
all
:
directories release
release
:
$(EXE)
debug
:
FCFLAGS = $(DEBUGFLAGS)
debug
:
$(EXE)
$(EXE)
:
gitversion $(OBJS)
@
echo
"--------------------------------"
@
echo
building
$(EXE)
...
...
@@ -63,12 +62,12 @@ cleanall :
@
echo
cleaning compiled objects, modules and executable
rm
-f
$(OBJDIR)
*
.o
$(MODDIR)
*
.mod
*
~
$(EXE)
$(COMMONDIR)
/gitversion.h
clean
:
clean
:
@
echo
"--------------------------------"
@
echo
cleaning executable
rm
-f
$(EXE)
@
echo
cleaning compiled objects, modules and executable
rm
-f
$(EXE)
# create file for git version
gitversion
:
$(OBJ_GIT)
ifneq
($(USE_GIT), )
@
cd
$(COMMONDIR)
;
\
...
...
@@ -86,5 +85,4 @@ ${OBJDIR}:
${MODDIR}
:
${MKDIR_P}
$@
.PHONY
:
gitversion clean cleanall directories all
tools/haloanalyzer/src/haloanalyzer.f90
View file @
75d906e3
!=======================================================================
! Author: Fabrice Roy (LUTH/CNRS/Observatoire de Paris)
! Fabrice.Roy@obspm.fr
!=======================================================================
!------------------------------------------------------------------------------------------------------------------------------------
! Copyright 2015 Fabrice Roy
!
! Contact: fabrice.roy@obspm.fr
!
! This file is part of pFoF.
!
! pFoF is free software: you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
! the Free Software Foundation, either version 3 of the License, or
! (at your option) any later version.
!
! pFoF is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with pFoF. If not, see <http://www.gnu.org/licenses/>.
!> @file
!! Generic program reading a set of hdf5 halo files produced by pFoF
! and analyzing them
!! @brief
!!
!! @author Fabrice Roy
!=======================================================================
! Generic program reading a set of hdf5 halo files produced by pFoF
!> Generic program reading a set of hdf5 halo files produced by pFoF
! and analyzing them
! You can analyze either a subset of haloes by providing thier ID (analyzelist)
! or each halo in a subset of files by providing the name of the files (analyzefile)
!
=======================================================================
P
rogram
haloanalyzer
!
------------------------------------------------------------------------------------------------------------------------------------
p
rogram
haloanalyzer
use
haloanalyzer_var_mod
use
modanalyzeengines
use
modfunctions
use
modhdf5
use
fortran_hdf5_manage_interface_m
use
hdf5
,
only
:
HID_T
implicit
none
type
(
list_of_var
)
::
var
! list of the datasets needed for your analyzis
...
...
@@ -30,7 +52,7 @@ Program haloanalyzer
#ifdef WITHMPI
C
all
M
pi_Init
(
mpierr
)
c
all
m
pi_Init
(
mpierr
)
#endif
call
hdf5_init
()
...
...
@@ -40,7 +62,7 @@ Program haloanalyzer
var
%
vel
=
.false.
! default is .true.
var
%
id
=
.false.
! default is .true.
call
h
aloanalyzer_init
(
var
,
dm_particles
)
call
H
aloanalyzer_init
(
var
,
dm_particles
)
! The first argument is the name of the file containing the list of the ID of the haloes that you want to analyze
! The second argument is the name of your analyzis subroutine (defined in modfunctions.f90)
...
...
tools/haloanalyzer/src/haloanalyzer_var_m.f90
0 → 100644
View file @
75d906e3
Module
modvariable
#ifdef WITHMPI
Use
mpi
#endif
! If you do not know the type of integer used for the ID, use h5dump on the first halo file.
! h5dump -d haloID test_halo_00000.h5
! This will print the dataset haloID containing the ID of each halo in the file.
! You should see something like
! HDF5 "test_halo_00000.h5" {
! DATASET "haloID" {
! DATATYPE H5T_STD_I64LE
! The datatype should contain the number of bits used, i.e. 32 for kind=4 or 64 for kind=8.
#ifdef LONGINT
Integer
,
parameter
::
PRI
=
8
#ifdef WITHMPI
Integer
,
parameter
::
MPI_PRI
=
Mpi_Integer8
#endif
#else
Integer
,
parameter
::
PRI
=
4
#ifdef WITHMPI
Integer
,
parameter
::
MPI_PRI
=
Mpi_Integer
#endif
#endif !! Variables read from the HDF5 file
Integer
(
kind
=
PRI
),
dimension
(:),
allocatable
::
id
! id of the particles in the halo just read
Real
(
kind
=
4
),
dimension
(:,:),
allocatable
::
pos
! position of the particles in the halo just read
Real
(
kind
=
4
),
dimension
(:,:),
allocatable
::
vel
! velocities of the particles in the halo just read
Real
(
kind
=
4
),
dimension
(:),
allocatable
::
mp
Integer
(
kind
=
PRI
)
::
currenthaloID
! haloID of the halo analyzed in your function
Integer
(
kind
=
4
)
::
currenthalo
! index of the halo which varies from 1 to N where N is the total number of haloes you are analyzing
Integer
(
kind
=
4
)
::
nbhaloanalyzed
! total number of haloes that you want to analyze
#ifdef WITHMPI
Integer
::
procID
Integer
::
procNB
Integer
::
mpierr
#endif
End
Module
modvariable
tools/haloanalyzer/src/haloanalyzer_var_mod.f90
View file @
75d906e3
...
...
@@ -14,6 +14,19 @@ module haloanalyzer_var_mod
! DATATYPE H5T_STD_I64LE
! The datatype should contain the number of bits used, i.e. 32 for kind=4 or 64 for kind=8.
implicit
none
private
public
::
type_particles
,
&
type_var_list
,
&
type_info_proc
,
&
currenthalo
,
&
currenthaloID
,
&
nbhaloanalyzed
type
::
type_particles
integer
(
kind
=
4
)
::
nb_part
integer
(
kind
=
IDKIND
),
dimension
(:),
allocatable
::
pfof_id
...
...
@@ -46,4 +59,9 @@ module haloanalyzer_var_mod
integer
::
pnb
end
type
type_info_proc
integer
(
kind
=
IDKIND
)
::
currenthaloID
! haloID of the halo analyzed in your function
integer
(
kind
=
4
)
::
currenthalo
! index of the halo which varies from 1 to N where N is the total number of haloes you are analyzing
integer
(
kind
=
4
)
::
nbhaloanalyzed
! total number of haloes that you want to analyze
end
module
haloanalyzer_var_mod
tools/haloanalyzer/src/modanalyzeengines.f90
View file @
75d906e3
...
...
@@ -4,9 +4,7 @@
!=======================================================================
module
modanalyzeengines
use
modvariable
use
modfunctions
use
modhdf5
use
modconstant
,
only
:
IDKIND
,
MPI_IDKIND
implicit
none
...
...
tools/haloanalyzer/src/modfunctions.f90
View file @
75d906e3
...
...
@@ -4,8 +4,9 @@
!=======================================================================
Module
modfunctions
U
se
modvariable
u
se
haloanalyzer_var_mod
implicit
none
!! WARNING: you can declare here the output variables you may want to deal with in the
!! main program, for instance if you want to write them in an output file.
!! If the variable is an allocatable array, you have to allocate it the first
...
...
@@ -26,14 +27,14 @@ Contains
Real
(
kind
=
8
),
dimension
(
3
)
::
x
If
(
.not.
Allocated
(
cmpos
))
Then
Allocate
(
cmpos
(
3
,
nbhaloanalyzed
))
Allocate
(
cmpos
(
3
,
nbhaloanalyzed
))
End
If
np
=
size
(
pos
,
2
)
x
=
0.d0
Do
ip
=
1
,
np
x
=
x
+
pos
(:,
ip
)
x
=
x
+
pos
(:,
ip
)
End
Do
cmpos
(:,
currenthalo
)
=
x
/
real
(
np
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment