implement support for lammps_map_atom() to plugin loader, Fortran module, swig
This commit is contained in:
@ -305,6 +305,8 @@ of the contents of the :f:mod:`LIBLAMMPS` Fortran interface to LAMMPS.
|
|||||||
:ftype extract_setting: function
|
:ftype extract_setting: function
|
||||||
:f extract_global: :f:func:`extract_global`
|
:f extract_global: :f:func:`extract_global`
|
||||||
:ftype extract_global: function
|
:ftype extract_global: function
|
||||||
|
:f map_atom: :f:func:`map_atom`
|
||||||
|
:ftype map_atom: function
|
||||||
:f extract_atom: :f:func:`extract_atom`
|
:f extract_atom: :f:func:`extract_atom`
|
||||||
:ftype extract_atom: function
|
:ftype extract_atom: function
|
||||||
:f extract_compute: :f:func:`extract_compute`
|
:f extract_compute: :f:func:`extract_compute`
|
||||||
|
|||||||
@ -101,6 +101,7 @@ liblammpsplugin_t *liblammpsplugin_load(const char *lib)
|
|||||||
ADDSYM(extract_setting);
|
ADDSYM(extract_setting);
|
||||||
ADDSYM(extract_global_datatype);
|
ADDSYM(extract_global_datatype);
|
||||||
ADDSYM(extract_global);
|
ADDSYM(extract_global);
|
||||||
|
ADDSYM(map_atom);
|
||||||
|
|
||||||
ADDSYM(extract_atom_datatype);
|
ADDSYM(extract_atom_datatype);
|
||||||
ADDSYM(extract_atom);
|
ADDSYM(extract_atom);
|
||||||
|
|||||||
@ -146,6 +146,7 @@ struct _liblammpsplugin {
|
|||||||
int (*extract_setting)(void *, const char *);
|
int (*extract_setting)(void *, const char *);
|
||||||
int *(*extract_global_datatype)(void *, const char *);
|
int *(*extract_global_datatype)(void *, const char *);
|
||||||
void *(*extract_global)(void *, const char *);
|
void *(*extract_global)(void *, const char *);
|
||||||
|
void *(*map_atom)(void *, const void *);
|
||||||
|
|
||||||
int *(*extract_atom_datatype)(void *, const char *);
|
int *(*extract_atom_datatype)(void *, const char *);
|
||||||
void *(*extract_atom)(void *, const char *);
|
void *(*extract_atom)(void *, const char *);
|
||||||
|
|||||||
@ -113,6 +113,9 @@ MODULE LIBLAMMPS
|
|||||||
PROCEDURE :: get_mpi_comm => lmp_get_mpi_comm
|
PROCEDURE :: get_mpi_comm => lmp_get_mpi_comm
|
||||||
PROCEDURE :: extract_setting => lmp_extract_setting
|
PROCEDURE :: extract_setting => lmp_extract_setting
|
||||||
PROCEDURE :: extract_global => lmp_extract_global
|
PROCEDURE :: extract_global => lmp_extract_global
|
||||||
|
PROCEDURE, PRIVATE :: lmp_map_atom_int
|
||||||
|
PROCEDURE, PRIVATE :: lmp_map_atom_big
|
||||||
|
GENERIC :: map_atom => lmp_map_atom_int, lmp_map_atom_big
|
||||||
PROCEDURE :: extract_atom => lmp_extract_atom
|
PROCEDURE :: extract_atom => lmp_extract_atom
|
||||||
PROCEDURE :: extract_compute => lmp_extract_compute
|
PROCEDURE :: extract_compute => lmp_extract_compute
|
||||||
PROCEDURE :: extract_fix => lmp_extract_fix
|
PROCEDURE :: extract_fix => lmp_extract_fix
|
||||||
@ -508,6 +511,13 @@ MODULE LIBLAMMPS
|
|||||||
TYPE(c_ptr) :: lammps_extract_global
|
TYPE(c_ptr) :: lammps_extract_global
|
||||||
END FUNCTION lammps_extract_global
|
END FUNCTION lammps_extract_global
|
||||||
|
|
||||||
|
FUNCTION lammps_map_atom(handle, tag) BIND(C)
|
||||||
|
IMPORT :: c_ptr, c_int
|
||||||
|
IMPLICIT NONE
|
||||||
|
TYPE(c_ptr), INTENT(IN), VALUE :: handle, tag
|
||||||
|
INTEGER(c_int) :: lammps_map_atom
|
||||||
|
END FUNCTION lammps_map_atom
|
||||||
|
|
||||||
FUNCTION lammps_extract_atom_datatype(handle, name) BIND(C)
|
FUNCTION lammps_extract_atom_datatype(handle, name) BIND(C)
|
||||||
IMPORT :: c_ptr, c_int
|
IMPORT :: c_ptr, c_int
|
||||||
IMPLICIT NONE
|
IMPLICIT NONE
|
||||||
@ -1323,6 +1333,38 @@ CONTAINS
|
|||||||
END SELECT
|
END SELECT
|
||||||
END FUNCTION
|
END FUNCTION
|
||||||
|
|
||||||
|
! equivalent function to lammps_map_atom (for 32-bit integer tags)
|
||||||
|
INTEGER FUNCTION lmp_map_atom_int(self, id)
|
||||||
|
CLASS(lammps), INTENT(IN) :: self
|
||||||
|
INTEGER(c_int), INTENT(IN), TARGET :: id
|
||||||
|
INTEGER(c_int64_t), TARGET :: id64
|
||||||
|
TYPE(c_ptr) :: Cptr
|
||||||
|
|
||||||
|
IF (SIZE_TAGINT == 8) THEN
|
||||||
|
id64 = id
|
||||||
|
Cptr = C_LOC(id64)
|
||||||
|
ELSE
|
||||||
|
Cptr = C_LOC(id)
|
||||||
|
END IF
|
||||||
|
lmp_map_atom_int = lammps_map_atom(self%handle, Cptr) + 1
|
||||||
|
END FUNCTION lmp_map_atom_int
|
||||||
|
|
||||||
|
! equivalent function to lammps_map_atom (for 64-bit integer tags)
|
||||||
|
INTEGER FUNCTION lmp_map_atom_big(self, id)
|
||||||
|
CLASS(lammps), INTENT(IN) :: self
|
||||||
|
INTEGER(c_int64_t), INTENT(IN), TARGET :: id
|
||||||
|
INTEGER(c_int), TARGET :: id32
|
||||||
|
TYPE(c_ptr) :: Cptr
|
||||||
|
|
||||||
|
IF (SIZE_TAGINT == 8) THEN
|
||||||
|
Cptr = C_LOC(id)
|
||||||
|
ELSE
|
||||||
|
id32 = id
|
||||||
|
Cptr = C_LOC(id32)
|
||||||
|
END IF
|
||||||
|
lmp_map_atom_big = lammps_map_atom(self%handle, Cptr) + 1
|
||||||
|
END FUNCTION lmp_map_atom_big
|
||||||
|
|
||||||
! equivalent function to lammps_extract_atom
|
! equivalent function to lammps_extract_atom
|
||||||
! the assignment is actually overloaded so as to bind the pointers to
|
! the assignment is actually overloaded so as to bind the pointers to
|
||||||
! lammps data based on the information available from LAMMPS
|
! lammps data based on the information available from LAMMPS
|
||||||
|
|||||||
@ -125,6 +125,7 @@ extern int lammps_get_mpi_comm(void *handle);
|
|||||||
extern int lammps_extract_setting(void *handle, const char *keyword);
|
extern int lammps_extract_setting(void *handle, const char *keyword);
|
||||||
extern int lammps_extract_global_datatype(void *handle, const char *name);
|
extern int lammps_extract_global_datatype(void *handle, const char *name);
|
||||||
extern void *lammps_extract_global(void *handle, const char *name);
|
extern void *lammps_extract_global(void *handle, const char *name);
|
||||||
|
extern int lammps_map_atom(void *handle, const void *id);
|
||||||
|
|
||||||
extern int lammps_extract_atom_datatype(void *handle, const char *name);
|
extern int lammps_extract_atom_datatype(void *handle, const char *name);
|
||||||
extern void *lammps_extract_atom(void *handle, const char *name);
|
extern void *lammps_extract_atom(void *handle, const char *name);
|
||||||
@ -310,6 +311,7 @@ extern int lammps_get_mpi_comm(void *handle);
|
|||||||
extern int lammps_extract_setting(void *handle, const char *keyword);
|
extern int lammps_extract_setting(void *handle, const char *keyword);
|
||||||
extern int lammps_extract_global_datatype(void *handle, const char *name);
|
extern int lammps_extract_global_datatype(void *handle, const char *name);
|
||||||
extern void *lammps_extract_global(void *handle, const char *name);
|
extern void *lammps_extract_global(void *handle, const char *name);
|
||||||
|
extern int lammps_map_atom(void *handle, const void *id);
|
||||||
|
|
||||||
extern int lammps_extract_atom_datatype(void *handle, const char *name);
|
extern int lammps_extract_atom_datatype(void *handle, const char *name);
|
||||||
extern void *lammps_extract_atom(void *handle, const char *name);
|
extern void *lammps_extract_atom(void *handle, const char *name);
|
||||||
|
|||||||
Reference in New Issue
Block a user