Prepare SPHLite 0.2.0 development baseline
This commit is contained in:
+159
-4
@@ -5,12 +5,14 @@ module sph_api
|
||||
sph_error_set, sph_error_get
|
||||
use sph_log, only: sph_log_close
|
||||
use sph_control, only: sph_control_reset, sph_control_get_time
|
||||
use sph_database, only: sph_db_free, sph_db_get_particle_count
|
||||
use sph_input_reader, only: sph_input_read, sph_input_build_model
|
||||
use sph_database, only: sph_db_free, sph_db_get_particle_count, &
|
||||
sph_db_get_particle_state_capacity, sph_db_get_particle_state
|
||||
use sph_input_reader, only: sph_input_read, sph_input_build_model, &
|
||||
sph_input_get_warning_count
|
||||
use sph_solver_explicit, only: sph_solver_estimate_stable_dt, &
|
||||
sph_solver_advance_explicit, sph_solver_run_explicit
|
||||
use sph_output_csv, only: sph_output_write_csv, sph_output_set_directory, &
|
||||
sph_output_set_interval
|
||||
use sph_output_csv, only: sph_output_write_csv, sph_output_write_step, &
|
||||
sph_output_set_directory, sph_output_set_interval
|
||||
use sph_restart, only: sph_restart_write, sph_restart_read
|
||||
use sph_coupling_interface, only: sph_coupling_reset
|
||||
use sph_particle, only: sph_particle_initialize, sph_particle_reset
|
||||
@@ -156,6 +158,50 @@ contains
|
||||
call sph_db_get_particle_count(count, ierr)
|
||||
end subroutine sph_get_particle_count
|
||||
|
||||
subroutine sph_get_particle_state_capacity(count, ndim, ierr)
|
||||
integer, intent(out) :: count
|
||||
integer, intent(out) :: ndim
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call sph_api_require_initialized(ierr)
|
||||
if (ierr /= SPH_SUCCESS) then
|
||||
count = 0
|
||||
ndim = 0
|
||||
return
|
||||
end if
|
||||
call sph_db_get_particle_state_capacity(count, ndim, ierr)
|
||||
end subroutine sph_get_particle_state_capacity
|
||||
|
||||
subroutine sph_get_particle_state(max_particles, particle_id_ext, phase, &
|
||||
status, material_id, section_id, x, v, a, rho, pressure, &
|
||||
internal_energy, temperature, h, count, ierr)
|
||||
integer, intent(in) :: max_particles
|
||||
integer, intent(out) :: particle_id_ext(max_particles)
|
||||
integer, intent(out) :: phase(max_particles)
|
||||
integer, intent(out) :: status(max_particles)
|
||||
integer, intent(out) :: material_id(max_particles)
|
||||
integer, intent(out) :: section_id(max_particles)
|
||||
real(rk), intent(out) :: x(3,max_particles)
|
||||
real(rk), intent(out) :: v(3,max_particles)
|
||||
real(rk), intent(out) :: a(3,max_particles)
|
||||
real(rk), intent(out) :: rho(max_particles)
|
||||
real(rk), intent(out) :: pressure(max_particles)
|
||||
real(rk), intent(out) :: internal_energy(max_particles)
|
||||
real(rk), intent(out) :: temperature(max_particles)
|
||||
real(rk), intent(out) :: h(max_particles)
|
||||
integer, intent(out) :: count
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call sph_api_require_initialized(ierr)
|
||||
if (ierr /= SPH_SUCCESS) then
|
||||
count = 0
|
||||
return
|
||||
end if
|
||||
call sph_db_get_particle_state(max_particles, particle_id_ext, phase, &
|
||||
status, material_id, section_id, x, v, a, rho, pressure, &
|
||||
internal_energy, temperature, h, count, ierr)
|
||||
end subroutine sph_get_particle_state
|
||||
|
||||
subroutine sph_write_csv(filename, ierr)
|
||||
character(len=*), intent(in) :: filename
|
||||
integer, intent(out) :: ierr
|
||||
@@ -165,6 +211,16 @@ contains
|
||||
call sph_output_write_csv(filename, ierr)
|
||||
end subroutine sph_write_csv
|
||||
|
||||
subroutine sph_write_output(step, time, ierr)
|
||||
integer, intent(in) :: step
|
||||
real(rk), intent(in) :: time
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call sph_api_require_initialized(ierr)
|
||||
if (ierr /= SPH_SUCCESS) return
|
||||
call sph_output_write_step(step, time, ierr)
|
||||
end subroutine sph_write_output
|
||||
|
||||
subroutine sph_set_output_directory(directory, ierr)
|
||||
character(len=*), intent(in) :: directory
|
||||
integer, intent(out) :: ierr
|
||||
@@ -201,6 +257,19 @@ contains
|
||||
call sph_restart_read(filename, ierr)
|
||||
end subroutine sph_read_restart
|
||||
|
||||
subroutine sph_get_input_warning_count(count, ierr)
|
||||
integer, intent(out) :: count
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call sph_api_require_initialized(ierr)
|
||||
if (ierr /= SPH_SUCCESS) then
|
||||
count = 0
|
||||
return
|
||||
end if
|
||||
call sph_input_get_warning_count(count)
|
||||
ierr = SPH_SUCCESS
|
||||
end subroutine sph_get_input_warning_count
|
||||
|
||||
subroutine sph_api_require_initialized(ierr)
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
@@ -340,6 +409,92 @@ subroutine sphft_get_particle_count(count, ierr)
|
||||
call sph_get_particle_count(count, ierr)
|
||||
end subroutine sphft_get_particle_count
|
||||
|
||||
subroutine sphft_get_particle_state_capacity(count, ndim, ierr)
|
||||
use sph_api, only: sph_get_particle_state_capacity
|
||||
implicit none
|
||||
integer, intent(out) :: count
|
||||
integer, intent(out) :: ndim
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call sph_get_particle_state_capacity(count, ndim, ierr)
|
||||
end subroutine sphft_get_particle_state_capacity
|
||||
|
||||
subroutine sphft_get_particle_state(max_particles, particle_id_ext, phase, &
|
||||
status, material_id, section_id, x, v, a, rho, pressure, &
|
||||
internal_energy, temperature, h, count, ierr)
|
||||
use sph_api, only: sph_get_particle_state
|
||||
use sph_precision, only: rk
|
||||
implicit none
|
||||
integer, intent(in) :: max_particles
|
||||
integer, intent(out) :: particle_id_ext(max_particles)
|
||||
integer, intent(out) :: phase(max_particles)
|
||||
integer, intent(out) :: status(max_particles)
|
||||
integer, intent(out) :: material_id(max_particles)
|
||||
integer, intent(out) :: section_id(max_particles)
|
||||
real(rk), intent(out) :: x(3,max_particles)
|
||||
real(rk), intent(out) :: v(3,max_particles)
|
||||
real(rk), intent(out) :: a(3,max_particles)
|
||||
real(rk), intent(out) :: rho(max_particles)
|
||||
real(rk), intent(out) :: pressure(max_particles)
|
||||
real(rk), intent(out) :: internal_energy(max_particles)
|
||||
real(rk), intent(out) :: temperature(max_particles)
|
||||
real(rk), intent(out) :: h(max_particles)
|
||||
integer, intent(out) :: count
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call sph_get_particle_state(max_particles, particle_id_ext, phase, &
|
||||
status, material_id, section_id, x, v, a, rho, pressure, &
|
||||
internal_energy, temperature, h, count, ierr)
|
||||
end subroutine sphft_get_particle_state
|
||||
|
||||
subroutine sphft_set_output_directory_chars(chars, count, ierr)
|
||||
use sph_api, only: sph_set_output_directory
|
||||
implicit none
|
||||
integer, intent(in) :: chars(*)
|
||||
integer, intent(in) :: count
|
||||
integer, intent(out) :: ierr
|
||||
character(len=1024) :: directory
|
||||
integer :: i
|
||||
integer :: n
|
||||
|
||||
directory = ' '
|
||||
n = count
|
||||
if (n > len(directory)) n = len(directory)
|
||||
do i = 1, n
|
||||
directory(i:i) = char(chars(i))
|
||||
end do
|
||||
call sph_set_output_directory(directory(1:n), ierr)
|
||||
end subroutine sphft_set_output_directory_chars
|
||||
|
||||
subroutine sphft_set_output_interval(interval, ierr)
|
||||
use sph_api, only: sph_set_output_interval
|
||||
implicit none
|
||||
integer, intent(in) :: interval
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call sph_set_output_interval(interval, ierr)
|
||||
end subroutine sphft_set_output_interval
|
||||
|
||||
subroutine sphft_write_output(step, time, ierr)
|
||||
use sph_api, only: sph_write_output
|
||||
use sph_precision, only: rk
|
||||
implicit none
|
||||
integer, intent(in) :: step
|
||||
real(rk), intent(in) :: time
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call sph_write_output(step, time, ierr)
|
||||
end subroutine sphft_write_output
|
||||
|
||||
subroutine sphft_get_input_warning_count(count, ierr)
|
||||
use sph_api, only: sph_get_input_warning_count
|
||||
implicit none
|
||||
integer, intent(out) :: count
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call sph_get_input_warning_count(count, ierr)
|
||||
end subroutine sphft_get_input_warning_count
|
||||
|
||||
subroutine sphft_write_csv_chars(chars, count, ierr)
|
||||
use sph_api, only: sph_write_csv
|
||||
implicit none
|
||||
|
||||
Reference in New Issue
Block a user