Commit 6c3d0e13 authored by Roy Fabrice's avatar Roy Fabrice
Browse files

write is fisnished but untested

init is removed
parent 24916169
......@@ -62,48 +62,12 @@ module halo_m
real(kind=4), allocatable, dimension(:,:) :: non_thermal_pressures_cell
real(kind=4), allocatable, dimension(:,:) :: passive_scalars_cell
contains
procedure :: Init_hdf5 => Init_halo_from_hdf5
procedure :: Read_hdf5 => Read_hdf5_halo
procedure :: Write_hdf5 => Write_hdf5_halo
procedure :: Write_info => Write_halo_info
end type halo_t
contains
!----------------------------------------------------------------------------------------------------------------------------------
subroutine Init_halo_from_hdf5(this, hdf5_id)
use fortran_hdf5_constants_m
use fortran_hdf5_read_attribute_m
use fortran_hdf5_read_data_m
use hdf5, only : HID_T
class(halo_t), intent(inout) :: this
integer(HID_T), intent(in) :: hdf5_id
character(len=H5_STR_LEN) :: aname
integer(kind=4) :: halos_nb
integer(kind=IDKIND), dimension(2) :: halo_id
#ifdef DEBUG
write(ERROR_UNIT,'(a,i0)') 'Init_halo_from_hdf5 begins on process', mpi_process%rank
#endif
! JE NE SAIS PLUS CE QUE JE VOULAIS FAIRE DANS CETTE ROUTINE...
! aname = 'nhalo_file'
! call hdf5_read_attr(hdf5_id, aname, halos_nb)
! ! read halo_id_min and halo_id_max from halo file
! aname = 'identity_halo_minmax'
! call hdf5_read_data(hdf5_id, aname, 2, halo_id)
! ! open group for halo_id_min
#ifdef DEBUG
write(ERROR_UNIT,'(a,i0)') 'Init_halo_from_hdf5 ends on process', mpi_process%rank
#endif
end subroutine Init_halo_from_hdf5
!----------------------------------------------------------------------------------------------------------------------------------
subroutine Read_hdf5_halo(this, hdf5_data_id, properties)
......@@ -332,157 +296,100 @@ contains
write(ERROR_UNIT,'(a,i0)') 'Write_hdf5_halo begins on process', mpi_process%rank
#endif
halo_group_name= 'halo_'
halo_group_name_fmt = '(a5,i27.27)'
write(halo_group_name(1:H5_STR_LEN),halo_group_name_fmt) trim(halo_group_name), this%identity
halo_group_name= 'halo_'
halo_group_name_fmt = '(a5,i27.27)'
write(halo_group_name(1:H5_STR_LEN),halo_group_name_fmt) trim(halo_group_name), this%identity
call hdf5_create_group(hdf5_data_id, halo_group_name, hdf5_halo_id)
call hdf5_create_group(hdf5_data_id, halo_group_name, hdf5_halo_id)
attribute_name = 'npart_halo'
call hdf5_write_attr(hdf5_halo_id, attribute_name, this%particles_number)
attribute_name = 'ncell_halo'
call hdf5_write_attr(hdf5_halo_id, attribute_name, this%cells_number)
attribute_name = 'npart_halo'
call hdf5_write_attr(hdf5_halo_id, attribute_name, this%particles_number)
attribute_name = 'ncell_halo'
call hdf5_write_attr(hdf5_halo_id, attribute_name, this%cells_number)
if(properties%has_position_part) then
data_name = 'position_part'
call hdf5_write_data(hdf5_halo_id,data_name,3,this%particles_number,this%position_part)
end if
if(properties%has_velocity_part) then
data_name = 'velocity_part'
call hdf5_write_data(hdf5_halo_id,data_name,3,this%particles_number,this%velocity_part)
end if
if(properties%has_position_part) then
data_name = 'position_part'
call hdf5_write_data(hdf5_halo_id,data_name,3,this%particles_number,this%position_part)
if(properties%has_identity_part) then
data_name = 'identity_part'
call hdf5_write_data(hdf5_halo_id,data_name,this%particles_number,this%identity_part)
end if
if(properties%has_gravitational_field_part) then
data_name = 'gravitational_field_part'
call hdf5_write_data(hdf5_halo_id,data_name,3,this%particles_number,this%gravitational_field_part)
end if
if(properties%has_potential_part) then
data_name = 'potential_part'
call hdf5_write_data(hdf5_halo_id,data_name,this%particles_number,this%potential_part)
end if
if(properties%has_mass_part) then
data_name = 'mass_part'
call hdf5_write_data(hdf5_halo_id,data_name,this%particles_number,this%mass_part)
end if
if(properties%has_velocity_part) then
data_name = 'velocity_part'
call hdf5_write_data(hdf5_halo_id,data_name,3,this%particles_number,this%velocity_part)
if(properties%has_ramses_identity_part) then
data_name = 'ramses_identity_part'
call hdf5_write_data(hdf5_halo_id,data_name,this%particles_number,this%ramses_identity_part)
end if
! if(properties%has_identity_part) then
! allocate(this%identity_part(this%particles_number), stat=alloc_stat, errmsg=error_message)
! if(alloc_stat /= 0) then
! call Allocate_error('this%identity_part','Read_hdf5_halo', error_message, alloc_stat, mpi_process%rank)
! end if
! data_name = 'identity_part'
! call hdf5_read_data(hdf5_halo_id,data_name,this%particles_number,this%identity_part)
! end if
! if(properties%has_gravitational_field_part) then
! allocate(this%gravitational_field_part(3,this%particles_number), stat=alloc_stat, errmsg=error_message)
! if(alloc_stat /= 0) then
! call Allocate_error('this%gravitational_field_part','Read_hdf5_halo', error_message, alloc_stat, mpi_process%rank)
! end if
! data_name = 'gravitational_field_part'
! call hdf5_read_data(hdf5_halo_id,data_name,3,this%particles_number,this%gravitational_field_part)
! end if
! if(properties%has_potential_part) then
! allocate(this%potential_part(this%particles_number), stat=alloc_stat, errmsg=error_message)
! if(alloc_stat /= 0) then
! call Allocate_error('this%potential_part','Read_hdf5_halo', error_message, alloc_stat, mpi_process%rank)
! end if
! data_name = 'potential_part'
! call hdf5_read_data(hdf5_halo_id,data_name,this%particles_number,this%potential_part)
! end if
! if(properties%has_mass_part) then
! allocate(this%mass_part(this%particles_number), stat=alloc_stat, errmsg=error_message)
! if(alloc_stat /= 0) then
! call Allocate_error('this%mass_part','Read_hdf5_halo', error_message, alloc_stat, mpi_process%rank)
! end if
! data_name = 'mass_part'
! call hdf5_read_data(hdf5_halo_id,data_name,this%particles_number,this%mass_part)
! end if
! if(properties%has_ramses_identity_part) then
! allocate(this%ramses_identity_part(this%particles_number), stat=alloc_stat, errmsg=error_message)
! if(alloc_stat /= 0) then
! call Allocate_error('this%ramses_identity_part','Read_hdf5_halo', error_message, alloc_stat, mpi_process%rank)
! end if
! data_name = 'ramses_identity_part'
! call hdf5_read_data(hdf5_halo_id,data_name,this%particles_number,this%ramses_identity_part)
! end if
! if(properties%has_birth_date_part) then
! allocate(this%birth_date_part(this%particles_number), stat=alloc_stat, errmsg=error_message)
! if(alloc_stat /= 0) then
! call Allocate_error('this%birth_date_part','Read_hdf5_halo', error_message, alloc_stat, mpi_process%rank)
! end if
! data_name = 'birth_date_part'
! call hdf5_read_data(hdf5_halo_id,data_name,this%particles_number,this%birth_date_part)
! end if
! if(properties%has_metallicity_part) then
! allocate(this%metallicity_part(this%particles_number), stat=alloc_stat, errmsg=error_message)
! if(alloc_stat /= 0) then
! call Allocate_error('this%metallicity_part','Read_hdf5_halo', error_message, alloc_stat, mpi_process%rank)
! end if
! data_name = 'metallicity_part'
! call hdf5_read_data(hdf5_halo_id,data_name,this%particles_number,this%metallicity_part)
! end if
! if(properties%has_position_cell) then
! allocate(this%position_cell(3,this%cells_number), stat=alloc_stat, errmsg=error_message)
! if(alloc_stat /= 0) then
! call Allocate_error('this%position_cell','Read_hdf5_halo', error_message, alloc_stat, mpi_process%rank)
! end if
! data_name = 'position_cell'
! call hdf5_read_data(hdf5_halo_id,data_name,3,this%cells_number,this%position_cell)
! end if
! if(properties%has_velocity_cell) then
! allocate(this%velocity_cell(3,this%cells_number), stat=alloc_stat, errmsg=error_message)
! if(alloc_stat /= 0) then
! call Allocate_error('this%velocity_cell','Read_hdf5_halo', error_message, alloc_stat, mpi_process%rank)
! end if
! data_name = 'velocity_cell'
! call hdf5_read_data(hdf5_halo_id,data_name,3,this%cells_number,this%velocity_cell)
! end if
! if(properties%has_identity_cell) then
! allocate(this%identity_cell(this%cells_number), stat=alloc_stat, errmsg=error_message)
! if(alloc_stat /= 0) then
! call Allocate_error('this%identity_cell','Read_hdf5_halo', error_message, alloc_stat, mpi_process%rank)
! end if
! data_name = 'identity_cell'
! call hdf5_read_data(hdf5_halo_id,data_name,this%cells_number,this%identity_cell)
! end if
! if(properties%has_density_cell) then
! allocate(this%density_cell(this%cells_number), stat=alloc_stat, errmsg=error_message)
! if(alloc_stat /= 0) then
! call Allocate_error('this%density_cell','Read_hdf5_halo', error_message, alloc_stat, mpi_process%rank)
! end if
! data_name = 'density_cell'
! call hdf5_read_data(hdf5_halo_id,data_name,this%cells_number,this%density_cell)
! end if
! if(properties%has_thermal_pressure_cell) then
! allocate(this%thermal_pressure_cell(this%cells_number), stat=alloc_stat, errmsg=error_message)
! if(alloc_stat /= 0) then
! call Allocate_error('this%thermal_pressure_cell','Read_hdf5_halo', error_message, alloc_stat, mpi_process%rank)
! end if
! data_name = 'thermal_pressure_cell'
! call hdf5_read_data(hdf5_halo_id,data_name,this%cells_number,this%thermal_pressure_cell)
! end if
! if(properties%has_non_thermal_pressures_cell) then
! attribute_name = 'n_non_thermal_pressures'
! call hdf5_read_attr(hdf5_halo_id,attribute_name,this%n_non_thermal_pressures)
! allocate(this%non_thermal_pressures_cell(this%n_non_thermal_pressures,this%cells_number), &
! stat=alloc_stat, errmsg=error_message)
! if(alloc_stat /= 0) then
! call Allocate_error('this%non_thermal_pressures_cell','Read_hdf5_halo', error_message, alloc_stat, mpi_process%rank)
! end if
! data_name = 'non_thermal_pressures_cell'
! call hdf5_read_data(hdf5_halo_id,data_name,this%n_non_thermal_pressures,this%cells_number,this%non_thermal_pressures_cell)
! end if
! if(properties%has_passive_scalars_cell) then
! attribute_name = 'n_passive_scalars'
! call hdf5_read_attr(hdf5_halo_id,attribute_name,this%n_passive_scalars)
! allocate(this%passive_scalars_cell(this%n_passive_scalars,this%cells_number), stat=alloc_stat, errmsg=error_message)
! if(alloc_stat /= 0) then
! call Allocate_error('this%passive_scalars_cell','Read_hdf5_halo', error_message, alloc_stat, mpi_process%rank)
! end if
! data_name = 'passive_scalars_cell'
! call hdf5_read_data(hdf5_halo_id,data_name,this%n_passive_scalars,this%cells_number,this%passive_scalars_cell)
! end if
if(properties%has_birth_date_part) then
data_name = 'birth_date_part'
call hdf5_write_data(hdf5_halo_id,data_name,this%particles_number,this%birth_date_part)
end if
if(properties%has_metallicity_part) then
data_name = 'metallicity_part'
call hdf5_write_data(hdf5_halo_id,data_name,this%particles_number,this%metallicity_part)
end if
if(properties%has_position_cell) then
data_name = 'position_cell'
call hdf5_write_data(hdf5_halo_id,data_name,3,this%cells_number,this%position_cell)
end if
if(properties%has_velocity_cell) then
data_name = 'velocity_cell'
call hdf5_write_data(hdf5_halo_id,data_name,3,this%cells_number,this%velocity_cell)
end if
if(properties%has_identity_cell) then
data_name = 'identity_cell'
call hdf5_write_data(hdf5_halo_id,data_name,this%cells_number,this%identity_cell)
end if
if(properties%has_density_cell) then
data_name = 'density_cell'
call hdf5_write_data(hdf5_halo_id,data_name,this%cells_number,this%density_cell)
end if
if(properties%has_thermal_pressure_cell) then
data_name = 'thermal_pressure_cell'
call hdf5_write_data(hdf5_halo_id,data_name,this%cells_number,this%thermal_pressure_cell)
end if
if(properties%has_non_thermal_pressures_cell) then
attribute_name = 'n_non_thermal_pressures'
call hdf5_write_attr(hdf5_halo_id,attribute_name,this%n_non_thermal_pressures)
data_name = 'non_thermal_pressures_cell'
call hdf5_write_data(hdf5_halo_id,data_name,this%n_non_thermal_pressures,this%cells_number,this%non_thermal_pressures_cell)
end if
if(properties%has_passive_scalars_cell) then
attribute_name = 'n_passive_scalars'
call hdf5_write_attr(hdf5_halo_id,attribute_name,this%n_passive_scalars)
data_name = 'passive_scalars_cell'
call hdf5_write_data(hdf5_halo_id,data_name,this%n_passive_scalars,this%cells_number,this%passive_scalars_cell)
end if
call hdf5_close_group(hdf5_halo_id)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment