Add C ABI wrapper
This commit is contained in:
@@ -0,0 +1,296 @@
|
||||
#include "femlite_c_api.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "femlite_fortran_mangle.h"
|
||||
|
||||
#define F_INIT FC_GLOBAL(femlite_f_init, FEMLITE_F_INIT)
|
||||
#define F_FINALIZE FC_GLOBAL(femlite_f_finalize, FEMLITE_F_FINALIZE)
|
||||
#define F_GET_VERSION FC_GLOBAL(femlite_f_get_version, FEMLITE_F_GET_VERSION)
|
||||
#define F_LAST_ERROR_C FC_GLOBAL(femlite_f_last_error_c, FEMLITE_F_LAST_ERROR_C)
|
||||
#define F_READ_INP_C FC_GLOBAL(femlite_f_read_inp_c, FEMLITE_F_READ_INP_C)
|
||||
#define F_BUILD_MODEL FC_GLOBAL(femlite_f_build_model, FEMLITE_F_BUILD_MODEL)
|
||||
#define F_COMPUTE_MASS FC_GLOBAL(femlite_f_compute_mass, FEMLITE_F_COMPUTE_MASS)
|
||||
#define F_ESTIMATE_DT FC_GLOBAL(femlite_f_estimate_dt, FEMLITE_F_ESTIMATE_DT)
|
||||
#define F_ADVANCE_EXPLICIT FC_GLOBAL(femlite_f_advance_explicit, FEMLITE_F_ADVANCE_EXPLICIT)
|
||||
#define F_GET_TIME FC_GLOBAL(femlite_f_get_time, FEMLITE_F_GET_TIME)
|
||||
#define F_GET_SIZE FC_GLOBAL(femlite_f_get_size, FEMLITE_F_GET_SIZE)
|
||||
#define F_CLEAR_SPH FC_GLOBAL(femlite_f_clear_sph, FEMLITE_F_CLEAR_SPH)
|
||||
#define F_APPLY_SPH_NODES FC_GLOBAL(femlite_f_apply_sph_nodes, FEMLITE_F_APPLY_SPH_NODES)
|
||||
#define F_GET_FACET_COUNT FC_GLOBAL(femlite_f_get_facet_count, FEMLITE_F_GET_FACET_COUNT)
|
||||
#define F_GET_FACETS FC_GLOBAL(femlite_f_get_facets, FEMLITE_F_GET_FACETS)
|
||||
#define F_APPLY_PRESSURE FC_GLOBAL(femlite_f_apply_facet_pressure, FEMLITE_F_APPLY_FACET_PRESSURE)
|
||||
#define F_APPLY_TRACTIONS FC_GLOBAL(femlite_f_apply_facet_tractions, FEMLITE_F_APPLY_FACET_TRACTIONS)
|
||||
#define F_GET_NODE_MOTION FC_GLOBAL(femlite_f_get_node_motion, FEMLITE_F_GET_NODE_MOTION)
|
||||
#define F_WRITE_RESTART_C FC_GLOBAL(femlite_f_write_restart_c, FEMLITE_F_WRITE_RESTART_C)
|
||||
#define F_READ_RESTART_C FC_GLOBAL(femlite_f_read_restart_c, FEMLITE_F_READ_RESTART_C)
|
||||
|
||||
extern void F_INIT(int *ierr);
|
||||
extern void F_FINALIZE(int *ierr);
|
||||
extern void F_GET_VERSION(int *major, int *minor, int *patch, int *ierr);
|
||||
extern void F_LAST_ERROR_C(int *code, char *message, int *capacity, int *ierr);
|
||||
extern void F_READ_INP_C(const char *filename, int *length, int *ierr);
|
||||
extern void F_BUILD_MODEL(int *ierr);
|
||||
extern void F_COMPUTE_MASS(int *ierr);
|
||||
extern void F_ESTIMATE_DT(double *dtcrit, int *ierr);
|
||||
extern void F_ADVANCE_EXPLICIT(double *dt, int *ierr);
|
||||
extern void F_GET_TIME(double *time, int *step, int *ierr);
|
||||
extern void F_GET_SIZE(int *num_nodes, int *num_elems, int *num_dof, int *ierr);
|
||||
extern void F_CLEAR_SPH(int *ierr);
|
||||
extern void F_APPLY_SPH_NODES(int *num_force_nodes,
|
||||
const int *node_ids,
|
||||
const double *forces,
|
||||
int *ierr);
|
||||
extern void F_GET_FACET_COUNT(int *num_facets, int *max_face_nodes, int *ierr);
|
||||
extern void F_GET_FACETS(int *num_facets,
|
||||
int *max_face_nodes,
|
||||
int *facet_id,
|
||||
int *elem_id,
|
||||
int *face_id,
|
||||
int *facet_nnode,
|
||||
int *facet_conn,
|
||||
double *x,
|
||||
double *vnod,
|
||||
double *normal,
|
||||
double *area,
|
||||
int *ierr);
|
||||
extern void F_APPLY_PRESSURE(int *num_facets,
|
||||
const int *facet_id,
|
||||
const double *pressure,
|
||||
int *ierr);
|
||||
extern void F_APPLY_TRACTIONS(int *num_facets,
|
||||
const int *facet_id,
|
||||
const double *pressure,
|
||||
const double *shear,
|
||||
int *ierr);
|
||||
extern void F_GET_NODE_MOTION(int *node_id,
|
||||
double *displacement,
|
||||
double *velocity,
|
||||
double *acceleration,
|
||||
int *ierr);
|
||||
extern void F_WRITE_RESTART_C(const char *filename, int *length, int *ierr);
|
||||
extern void F_READ_RESTART_C(const char *filename, int *length, int *ierr);
|
||||
|
||||
static int call_with_path(const char *path,
|
||||
void (*routine)(const char *, int *, int *))
|
||||
{
|
||||
int ierr = 0;
|
||||
int length = 0;
|
||||
|
||||
if (path == NULL) {
|
||||
return -1;
|
||||
}
|
||||
length = (int)strlen(path);
|
||||
if (length <= 0) {
|
||||
return -1;
|
||||
}
|
||||
routine(path, &length, &ierr);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
static void trim_fortran_message(char *message, int message_capacity)
|
||||
{
|
||||
int end = 0;
|
||||
|
||||
if (message == NULL || message_capacity <= 0) {
|
||||
return;
|
||||
}
|
||||
end = message_capacity - 1;
|
||||
while (end > 0 && message[end - 1] == ' ') {
|
||||
--end;
|
||||
}
|
||||
message[end] = '\0';
|
||||
}
|
||||
|
||||
int femlite_initialize(void)
|
||||
{
|
||||
int ierr = 0;
|
||||
F_INIT(&ierr);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int femlite_finalize(void)
|
||||
{
|
||||
int ierr = 0;
|
||||
F_FINALIZE(&ierr);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int femlite_get_version(int *major, int *minor, int *patch)
|
||||
{
|
||||
int ierr = 0;
|
||||
if (major == NULL || minor == NULL || patch == NULL) {
|
||||
return -1;
|
||||
}
|
||||
F_GET_VERSION(major, minor, patch, &ierr);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int femlite_get_last_error(int *code, char *message, int message_capacity)
|
||||
{
|
||||
int ierr = 0;
|
||||
if (code == NULL || message == NULL || message_capacity <= 0) {
|
||||
return -1;
|
||||
}
|
||||
F_LAST_ERROR_C(code, message, &message_capacity, &ierr);
|
||||
trim_fortran_message(message, message_capacity);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int femlite_read_inp(const char *filename)
|
||||
{
|
||||
return call_with_path(filename, F_READ_INP_C);
|
||||
}
|
||||
|
||||
int femlite_build_model(void)
|
||||
{
|
||||
int ierr = 0;
|
||||
F_BUILD_MODEL(&ierr);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int femlite_compute_lumped_mass(void)
|
||||
{
|
||||
int ierr = 0;
|
||||
F_COMPUTE_MASS(&ierr);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int femlite_estimate_stable_dt(double *dtcrit)
|
||||
{
|
||||
int ierr = 0;
|
||||
if (dtcrit == NULL) {
|
||||
return -1;
|
||||
}
|
||||
F_ESTIMATE_DT(dtcrit, &ierr);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int femlite_advance_explicit(double dt)
|
||||
{
|
||||
int ierr = 0;
|
||||
F_ADVANCE_EXPLICIT(&dt, &ierr);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int femlite_get_current_time(double *time, int *step)
|
||||
{
|
||||
int ierr = 0;
|
||||
if (time == NULL || step == NULL) {
|
||||
return -1;
|
||||
}
|
||||
F_GET_TIME(time, step, &ierr);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int femlite_get_model_size(int *num_nodes, int *num_elems, int *num_dof)
|
||||
{
|
||||
int ierr = 0;
|
||||
if (num_nodes == NULL || num_elems == NULL || num_dof == NULL) {
|
||||
return -1;
|
||||
}
|
||||
F_GET_SIZE(num_nodes, num_elems, num_dof, &ierr);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int femlite_clear_sph_forces(void)
|
||||
{
|
||||
int ierr = 0;
|
||||
F_CLEAR_SPH(&ierr);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int femlite_apply_sph_nodal_forces(int num_force_nodes,
|
||||
const int *node_ids,
|
||||
const double *forces)
|
||||
{
|
||||
int ierr = 0;
|
||||
if (num_force_nodes < 0 || node_ids == NULL || forces == NULL) {
|
||||
return -1;
|
||||
}
|
||||
F_APPLY_SPH_NODES(&num_force_nodes, node_ids, forces, &ierr);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int femlite_get_boundary_facet_count(int *num_facets, int *max_face_nodes)
|
||||
{
|
||||
int ierr = 0;
|
||||
if (num_facets == NULL || max_face_nodes == NULL) {
|
||||
return -1;
|
||||
}
|
||||
F_GET_FACET_COUNT(num_facets, max_face_nodes, &ierr);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int femlite_get_boundary_facets(int num_facets,
|
||||
int max_face_nodes,
|
||||
int *facet_id,
|
||||
int *elem_id,
|
||||
int *face_id,
|
||||
int *facet_nnode,
|
||||
int *facet_conn,
|
||||
double *x,
|
||||
double *vnod,
|
||||
double *normal,
|
||||
double *area)
|
||||
{
|
||||
int ierr = 0;
|
||||
if (facet_id == NULL || elem_id == NULL || face_id == NULL ||
|
||||
facet_nnode == NULL || facet_conn == NULL || x == NULL ||
|
||||
vnod == NULL || normal == NULL || area == NULL) {
|
||||
return -1;
|
||||
}
|
||||
F_GET_FACETS(&num_facets, &max_face_nodes, facet_id, elem_id, face_id,
|
||||
facet_nnode, facet_conn, x, vnod, normal, area, &ierr);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int femlite_apply_sph_facet_pressure(int num_facets,
|
||||
const int *facet_id,
|
||||
const double *pressure)
|
||||
{
|
||||
int ierr = 0;
|
||||
if (num_facets < 0 || facet_id == NULL || pressure == NULL) {
|
||||
return -1;
|
||||
}
|
||||
F_APPLY_PRESSURE(&num_facets, facet_id, pressure, &ierr);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int femlite_apply_sph_facet_tractions(int num_facets,
|
||||
const int *facet_id,
|
||||
const double *pressure,
|
||||
const double *shear)
|
||||
{
|
||||
int ierr = 0;
|
||||
if (num_facets < 0 || facet_id == NULL || pressure == NULL ||
|
||||
shear == NULL) {
|
||||
return -1;
|
||||
}
|
||||
F_APPLY_TRACTIONS(&num_facets, facet_id, pressure, shear, &ierr);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int femlite_get_node_kinematics(int node_id,
|
||||
double *displacement,
|
||||
double *velocity,
|
||||
double *acceleration)
|
||||
{
|
||||
int ierr = 0;
|
||||
if (displacement == NULL || velocity == NULL || acceleration == NULL) {
|
||||
return -1;
|
||||
}
|
||||
F_GET_NODE_MOTION(&node_id, displacement, velocity, acceleration, &ierr);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int femlite_write_restart(const char *filename)
|
||||
{
|
||||
return call_with_path(filename, F_WRITE_RESTART_C);
|
||||
}
|
||||
|
||||
int femlite_read_restart(const char *filename)
|
||||
{
|
||||
return call_with_path(filename, F_READ_RESTART_C);
|
||||
}
|
||||
@@ -0,0 +1,282 @@
|
||||
module fem_fortran_bridge_utils
|
||||
use fem_precision
|
||||
use fem_error
|
||||
implicit none
|
||||
|
||||
contains
|
||||
|
||||
subroutine bridge_chars_to_string(chars, length, value, ierr)
|
||||
integer, intent(in) :: length
|
||||
character(len=1), intent(in) :: chars(length)
|
||||
character(len=*), intent(out) :: value
|
||||
integer, intent(out) :: ierr
|
||||
integer :: i
|
||||
|
||||
value = ' '
|
||||
if (length .le. 0) then
|
||||
call error_set(FEM_ERR_INPUT, 'C string is empty', ierr)
|
||||
return
|
||||
end if
|
||||
if (length .gt. len(value)) then
|
||||
call error_set(FEM_ERR_INPUT, 'C string is too long', ierr)
|
||||
return
|
||||
end if
|
||||
|
||||
do i = 1, length
|
||||
value(i:i) = chars(i)
|
||||
end do
|
||||
ierr = FEM_SUCCESS
|
||||
end subroutine bridge_chars_to_string
|
||||
|
||||
subroutine bridge_string_to_chars(value, chars, capacity)
|
||||
character(len=*), intent(in) :: value
|
||||
integer, intent(in) :: capacity
|
||||
character(len=1), intent(out) :: chars(capacity)
|
||||
integer :: i
|
||||
integer :: ncopy
|
||||
|
||||
if (capacity .le. 0) return
|
||||
chars = ' '
|
||||
ncopy = min(len_trim(value), capacity)
|
||||
do i = 1, ncopy
|
||||
chars(i) = value(i:i)
|
||||
end do
|
||||
end subroutine bridge_string_to_chars
|
||||
|
||||
end module fem_fortran_bridge_utils
|
||||
|
||||
subroutine femlite_f_init(ierr)
|
||||
use fem_api
|
||||
implicit none
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call fem_initialize(ierr)
|
||||
end subroutine femlite_f_init
|
||||
|
||||
subroutine femlite_f_finalize(ierr)
|
||||
use fem_api
|
||||
implicit none
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call fem_finalize(ierr)
|
||||
end subroutine femlite_f_finalize
|
||||
|
||||
subroutine femlite_f_get_version(major, minor, patch, ierr)
|
||||
use fem_api
|
||||
implicit none
|
||||
integer, intent(out) :: major
|
||||
integer, intent(out) :: minor
|
||||
integer, intent(out) :: patch
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call fem_get_version(major, minor, patch, ierr)
|
||||
end subroutine femlite_f_get_version
|
||||
|
||||
subroutine femlite_f_last_error_c(code, message, capacity, ierr)
|
||||
use fem_error
|
||||
use fem_fortran_bridge_utils
|
||||
implicit none
|
||||
integer, intent(out) :: code
|
||||
integer, intent(in) :: capacity
|
||||
character(len=1), intent(out) :: message(capacity)
|
||||
integer, intent(out) :: ierr
|
||||
character(len=256) :: local_message
|
||||
|
||||
call fem_get_last_error(code, local_message, ierr)
|
||||
call bridge_string_to_chars(local_message, message, capacity)
|
||||
end subroutine femlite_f_last_error_c
|
||||
|
||||
subroutine femlite_f_read_inp_c(filename, length, ierr)
|
||||
use fem_api
|
||||
use fem_fortran_bridge_utils
|
||||
implicit none
|
||||
integer, intent(in) :: length
|
||||
character(len=1), intent(in) :: filename(length)
|
||||
integer, intent(out) :: ierr
|
||||
character(len=512) :: local_filename
|
||||
|
||||
call bridge_chars_to_string(filename, length, local_filename, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) return
|
||||
call fem_read_inp(trim(local_filename), ierr)
|
||||
end subroutine femlite_f_read_inp_c
|
||||
|
||||
subroutine femlite_f_build_model(ierr)
|
||||
use fem_api
|
||||
implicit none
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call fem_build_model(ierr)
|
||||
end subroutine femlite_f_build_model
|
||||
|
||||
subroutine femlite_f_compute_mass(ierr)
|
||||
use fem_api
|
||||
implicit none
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call fem_compute_lumped_mass(ierr)
|
||||
end subroutine femlite_f_compute_mass
|
||||
|
||||
subroutine femlite_f_estimate_dt(dtcrit, ierr)
|
||||
use fem_api
|
||||
use fem_precision
|
||||
implicit none
|
||||
real(rk), intent(out) :: dtcrit
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call fem_estimate_stable_dt(dtcrit, ierr)
|
||||
end subroutine femlite_f_estimate_dt
|
||||
|
||||
subroutine femlite_f_advance_explicit(dt, ierr)
|
||||
use fem_api
|
||||
use fem_precision
|
||||
implicit none
|
||||
real(rk), intent(in) :: dt
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call fem_advance_explicit(dt, ierr)
|
||||
end subroutine femlite_f_advance_explicit
|
||||
|
||||
subroutine femlite_f_get_time(time, step, ierr)
|
||||
use fem_api
|
||||
use fem_precision
|
||||
implicit none
|
||||
real(rk), intent(out) :: time
|
||||
integer, intent(out) :: step
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call fem_get_current_time(time, step, ierr)
|
||||
end subroutine femlite_f_get_time
|
||||
|
||||
subroutine femlite_f_get_size(num_nodes, num_elems, num_dof, ierr)
|
||||
use fem_api
|
||||
implicit none
|
||||
integer, intent(out) :: num_nodes
|
||||
integer, intent(out) :: num_elems
|
||||
integer, intent(out) :: num_dof
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call fem_get_model_size(num_nodes, num_elems, num_dof, ierr)
|
||||
end subroutine femlite_f_get_size
|
||||
|
||||
subroutine femlite_f_clear_sph(ierr)
|
||||
use fem_api
|
||||
implicit none
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call fem_clear_sph_forces(ierr)
|
||||
end subroutine femlite_f_clear_sph
|
||||
|
||||
subroutine femlite_f_apply_sph_nodes(num_force_nodes, node_ids, forces, ierr)
|
||||
use fem_api
|
||||
use fem_precision
|
||||
implicit none
|
||||
integer, intent(in) :: num_force_nodes
|
||||
integer, intent(in) :: node_ids(num_force_nodes)
|
||||
real(rk), intent(in) :: forces(NDIM,num_force_nodes)
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call fem_apply_sph_nodal_forces(num_force_nodes, node_ids, forces, ierr)
|
||||
end subroutine femlite_f_apply_sph_nodes
|
||||
|
||||
subroutine femlite_f_get_facet_count(num_facets, max_fnodes, ierr)
|
||||
use fem_api
|
||||
implicit none
|
||||
integer, intent(out) :: num_facets
|
||||
integer, intent(out) :: max_fnodes
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call fem_get_boundary_facet_count(num_facets, max_fnodes, ierr)
|
||||
end subroutine femlite_f_get_facet_count
|
||||
|
||||
subroutine femlite_f_get_facets(nfacet, max_fnodes, facet_id, elem_id, &
|
||||
face_id, facet_nnode, facet_conn, x, vnod, &
|
||||
normal, area, ierr)
|
||||
use fem_api
|
||||
use fem_precision
|
||||
implicit none
|
||||
integer, intent(in) :: nfacet
|
||||
integer, intent(in) :: max_fnodes
|
||||
integer, intent(out) :: facet_id(nfacet)
|
||||
integer, intent(out) :: elem_id(nfacet)
|
||||
integer, intent(out) :: face_id(nfacet)
|
||||
integer, intent(out) :: facet_nnode(nfacet)
|
||||
integer, intent(out) :: facet_conn(max_fnodes,nfacet)
|
||||
real(rk), intent(out) :: x(NDIM,max_fnodes,nfacet)
|
||||
real(rk), intent(out) :: vnod(NDIM,max_fnodes,nfacet)
|
||||
real(rk), intent(out) :: normal(NDIM,nfacet)
|
||||
real(rk), intent(out) :: area(nfacet)
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call fem_get_boundary_facets(nfacet, max_fnodes, facet_id, elem_id, &
|
||||
face_id, facet_nnode, facet_conn, x, vnod, &
|
||||
normal, area, ierr)
|
||||
end subroutine femlite_f_get_facets
|
||||
|
||||
subroutine femlite_f_apply_facet_pressure(nfacet, facet_id, pressure, ierr)
|
||||
use fem_api
|
||||
use fem_precision
|
||||
implicit none
|
||||
integer, intent(in) :: nfacet
|
||||
integer, intent(in) :: facet_id(nfacet)
|
||||
real(rk), intent(in) :: pressure(nfacet)
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call fem_apply_sph_facet_pressure(nfacet, facet_id, pressure, ierr)
|
||||
end subroutine femlite_f_apply_facet_pressure
|
||||
|
||||
subroutine femlite_f_apply_facet_tractions(nfacet, facet_id, pressure, &
|
||||
shear, ierr)
|
||||
use fem_api
|
||||
use fem_precision
|
||||
implicit none
|
||||
integer, intent(in) :: nfacet
|
||||
integer, intent(in) :: facet_id(nfacet)
|
||||
real(rk), intent(in) :: pressure(nfacet)
|
||||
real(rk), intent(in) :: shear(NDIM,nfacet)
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call fem_apply_sph_facet_tractions(nfacet, facet_id, pressure, shear, ierr)
|
||||
end subroutine femlite_f_apply_facet_tractions
|
||||
|
||||
subroutine femlite_f_get_node_motion(node_id, displacement, velocity, &
|
||||
acceleration, ierr)
|
||||
use fem_api
|
||||
use fem_precision
|
||||
implicit none
|
||||
integer, intent(in) :: node_id
|
||||
real(rk), intent(out) :: displacement(NDIM)
|
||||
real(rk), intent(out) :: velocity(NDIM)
|
||||
real(rk), intent(out) :: acceleration(NDIM)
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
call fem_get_node_kinematics(node_id, displacement, velocity, &
|
||||
acceleration, ierr)
|
||||
end subroutine femlite_f_get_node_motion
|
||||
|
||||
subroutine femlite_f_write_restart_c(filename, length, ierr)
|
||||
use fem_api
|
||||
use fem_fortran_bridge_utils
|
||||
implicit none
|
||||
integer, intent(in) :: length
|
||||
character(len=1), intent(in) :: filename(length)
|
||||
integer, intent(out) :: ierr
|
||||
character(len=512) :: local_filename
|
||||
|
||||
call bridge_chars_to_string(filename, length, local_filename, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) return
|
||||
call fem_write_restart(trim(local_filename), ierr)
|
||||
end subroutine femlite_f_write_restart_c
|
||||
|
||||
subroutine femlite_f_read_restart_c(filename, length, ierr)
|
||||
use fem_api
|
||||
use fem_fortran_bridge_utils
|
||||
implicit none
|
||||
integer, intent(in) :: length
|
||||
character(len=1), intent(in) :: filename(length)
|
||||
integer, intent(out) :: ierr
|
||||
character(len=512) :: local_filename
|
||||
|
||||
call bridge_chars_to_string(filename, length, local_filename, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) return
|
||||
call fem_read_restart(trim(local_filename), ierr)
|
||||
end subroutine femlite_f_read_restart_c
|
||||
Reference in New Issue
Block a user