Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the suffix _type for the C structures in GLS #362

Merged
merged 1 commit into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions GALAHAD.jl/gen/rewriter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ function rewrite!(path::String, name::String, optimized::Bool)
text = replace(text, "real_sp_" => "Float32")
text = replace(text, "\n " => "\n ")

# Special case for gls
text = replace(text, "gls_control" => "gls_control_type")
text = replace(text, "gls_ainfo" => "gls_ainfo_type")
text = replace(text, "gls_sinfo" => "gls_sinfo_type")
text = replace(text, "gls_finfo" => "gls_finfo_type")

for type in types
for package in packages
if "$(package)_$(type)_type" ∉ nonparametric_structures
Expand Down
6 changes: 3 additions & 3 deletions GALAHAD.jl/src/wrappers/uls.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ struct uls_inform_type{T}
iterative_refinements::Cint
alternative::Bool
solver::NTuple{21,Cchar}
gls_ainfo_type::gls_ainfo_type{T}
gls_finfo_type::gls_finfo_type{T}
gls_sinfo_type::gls_sinfo_type
gls_ainfo::gls_ainfo_type{T}
gls_finfo::gls_finfo_type{T}
gls_sinfo::gls_sinfo_type
ma48_ainfo::ma48_ainfo{T}
ma48_finfo::ma48_finfo{T}
ma48_sinfo::ma48_sinfo
Expand Down
40 changes: 20 additions & 20 deletions include/galahad_gls.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ extern "C" {
/**
* control derived type as a C struct
*/
struct gls_control {
struct gls_control_type {

/// \brief
/// use C or Fortran sparse matrix indexing
Expand Down Expand Up @@ -225,7 +225,7 @@ struct gls_control {
/**
* ainfo derived type as a C struct
*/
struct gls_ainfo {
struct gls_ainfo_type {

/// \brief
/// Flags success or failure case
Expand Down Expand Up @@ -291,7 +291,7 @@ struct gls_ainfo {
/**
* finfo derived type as a C struct
*/
struct gls_finfo {
struct gls_finfo_type {

/// \brief
/// Flags success or failure case
Expand Down Expand Up @@ -329,7 +329,7 @@ struct gls_finfo {
/**
* sinfo derived type as a C struct
*/
struct gls_sinfo {
struct gls_sinfo_type {

/// \brief
/// Flags success or failure case
Expand All @@ -348,20 +348,20 @@ struct gls_sinfo {
// *-*-*-*-*-*-*-*-*-*- G L S _ I N I T I A L I Z E -*-*-*-*-*-*-*-*-*

void gls_initialize( void **data,
struct gls_control *control );
struct gls_control_type *control );

/*!<
Set default control values and initialize private data

@param[in,out] data holds private internal data

@param[out] control is a struct containing control information
(see gls_control)
(see gls_control_type)
*/

// *-*-*-*-*-*-*-*-*- G L S _ R E A D _ S P E C F I L E -*-*-*-*-*-*-*

void gls_read_specfile( struct gls_control *control,
void gls_read_specfile( struct gls_control_type *control,
const char specfile[] );

/*!<
Expand All @@ -373,23 +373,23 @@ void gls_read_specfile( struct gls_control *control,
$GALAHAD/doc/gls.pdf for a list of keywords that may be set.

@param[in,out] control is a struct containing control information
(see gls_control)
(see gls_control_type)

@param[in] specfile is a character string containing the name of
the specification file
*/

// *-*-*-*-*-*-*-*-*-*-*-*- G L S _ I M P O R T -*-*-*-*-*-*-*-*-*-*

void gls_import( struct gls_control *control,
void gls_import( struct gls_control_type *control,
void **data,
ipc_ *status );

/*!<
Import problem data into internal storage prior to solution.

@param[in] control is a struct whose members provide control
paramters for the remaining prcedures (see gls_control)
paramters for the remaining prcedures (see gls_control_type)

@param[in,out] data holds private internal data

Expand All @@ -413,15 +413,15 @@ void gls_import( struct gls_control *control,

// *-*-*-*-*-*-*- G L S _ R E S E T _ C O N T R O L -*-*-*-*-*-*-*

void gls_reset_control( struct gls_control *control,
void gls_reset_control( struct gls_control_type *control,
void **data,
ipc_ *status );

/*!<
Reset control parameters after import if required.

@param[in] control is a struct whose members provide control
paramters for the remaining prcedures (see gls_control)
paramters for the remaining prcedures (see gls_control_type)

@param[in,out] data holds private internal data

Expand All @@ -433,9 +433,9 @@ void gls_reset_control( struct gls_control *control,
// *-*-*-*-*-*-*-*-*-*- G L S _ I N F O R M A T I O N -*-*-*-*-*-*-*-*

void gls_information( void **data,
struct gls_ainfo *ainfo,
struct gls_finfo *finfo,
struct gls_sinfo *sinfo,
struct gls_ainfo_type *ainfo,
struct gls_finfo_type *finfo,
struct gls_sinfo_type *sinfo,
ipc_ *status );

/*!<
Expand All @@ -444,13 +444,13 @@ void gls_information( void **data,
@param[in,out] data holds private internal data

@param[out] ainfo is a struct containing analysis output information
(see gls_ainfo)
(see gls_ainfo_type)

@param[out] finfo is a struct containing factorization output information
(see gls_finfo)
(see gls_finfo_type)

@param[out] sinfo is a struct containing solver output information
(see gls_sinfo)
(see gls_sinfo_type)

@param[out] status is a scalar variable of type ipc_, that gives
the exit status from the package.
Expand All @@ -461,7 +461,7 @@ void gls_information( void **data,
// *-*-*-*-*-*-*-*-*-*- G L S _ T E R M I N A T E -*-*-*-*-*-*-*-*-*-*

void gls_finalize( void **data,
struct gls_control *control,
struct gls_control_type *control,
ipc_ *status );

/*!<
Expand All @@ -470,7 +470,7 @@ void gls_finalize( void **data,
@param[in,out] data holds private internal data

@param[out] control is a struct containing control information
(see gls_control)
(see gls_control_type)

@param[out] status is a scalar variable of type ipc_, that gives
the exit status from the package.
Expand Down
6 changes: 3 additions & 3 deletions include/galahad_uls.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,11 +395,11 @@ struct uls_inform_type {

/// \brief
/// the output arrays from GLS
struct gls_ainfo gls_ainfo;
struct gls_ainfo_type gls_ainfo;
/// see gls_ainfo
struct gls_finfo gls_finfo;
struct gls_finfo_type gls_finfo;
/// see gls_ainfo
struct gls_sinfo gls_sinfo;
struct gls_sinfo_type gls_sinfo;

/// \brief
/// the output arrays from MA48
Expand Down
44 changes: 22 additions & 22 deletions src/gls/C/gls_ciface.F90
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ MODULE GALAHAD_GLS_precision_ciface
! D e r i v e d t y p e d e f i n i t i o n s
!-------------------------------------------------

TYPE, BIND( C ) :: gls_control
TYPE, BIND( C ) :: gls_control_type
LOGICAL ( KIND = C_BOOL ) :: f_indexing
INTEGER ( KIND = ipc_ ) :: lp
INTEGER ( KIND = ipc_ ) :: wp
Expand All @@ -58,9 +58,9 @@ MODULE GALAHAD_GLS_precision_ciface
REAL ( KIND = rpc_ ) :: cgce
LOGICAL ( KIND = C_BOOL ) :: diagonal_pivoting
LOGICAL ( KIND = C_BOOL ) :: struct_abort
END TYPE gls_control
END TYPE gls_control_type

TYPE, BIND( C ) :: GLS_ainfo
TYPE, BIND( C ) :: GLS_ainfo_type
INTEGER ( KIND = ipc_ ) :: flag
INTEGER ( KIND = ipc_ ) :: more
INTEGER ( KIND = ipc_ ) :: len_analyse
Expand All @@ -76,9 +76,9 @@ MODULE GALAHAD_GLS_precision_ciface
INTEGER ( KIND = ipc_ ) :: sblock
INTEGER ( KIND = ipc_ ) :: tblock
REAL ( KIND = rpc_ ) :: ops
END TYPE GLS_ainfo
END TYPE GLS_ainfo_type

TYPE, BIND( C ) :: GLS_finfo
TYPE, BIND( C ) :: GLS_finfo_type
INTEGER ( KIND = ipc_ ) :: flag
INTEGER ( KIND = ipc_ ) :: more
INTEGER ( KIND = ipc_ ) :: size_factor
Expand All @@ -87,13 +87,13 @@ MODULE GALAHAD_GLS_precision_ciface
INTEGER ( KIND = ipc_ ) :: rank
INTEGER ( KIND = ipc_ ) :: stat
REAL ( KIND = rpc_ ) :: ops
END TYPE GLS_finfo
END TYPE GLS_finfo_type

TYPE, BIND( C ) :: GLS_sinfo
TYPE, BIND( C ) :: GLS_sinfo_type
INTEGER ( KIND = ipc_ ) :: flag
INTEGER ( KIND = ipc_ ) :: more
INTEGER ( KIND = ipc_ ) :: stat
END TYPE GLS_sinfo
END TYPE GLS_sinfo_type

!----------------------
! P r o c e d u r e s
Expand All @@ -104,7 +104,7 @@ MODULE GALAHAD_GLS_precision_ciface
! copy C control parameters to fortran

SUBROUTINE copy_control_in( ccontrol, fcontrol, f_indexing )
TYPE ( gls_control ), INTENT( IN ) :: ccontrol
TYPE ( gls_control_type ), INTENT( IN ) :: ccontrol
TYPE ( f_gls_control ), INTENT( OUT ) :: fcontrol
LOGICAL, OPTIONAL, INTENT( OUT ) :: f_indexing

Expand Down Expand Up @@ -146,7 +146,7 @@ END SUBROUTINE copy_control_in

SUBROUTINE copy_control_out( fcontrol, ccontrol, f_indexing )
TYPE ( f_gls_control ), INTENT( IN ) :: fcontrol
TYPE ( gls_control ), INTENT( OUT ) :: ccontrol
TYPE ( gls_control_type ), INTENT( OUT ) :: ccontrol
LOGICAL, OPTIONAL, INTENT( IN ) :: f_indexing

! C or Fortran sparse matrix indexing
Expand Down Expand Up @@ -186,7 +186,7 @@ END SUBROUTINE copy_control_out
! copy C ainfo parameters to fortran

SUBROUTINE copy_ainfo_in( cainfo, fainfo )
TYPE ( gls_ainfo ), INTENT( IN ) :: cainfo
TYPE ( gls_ainfo_type ), INTENT( IN ) :: cainfo
TYPE ( f_gls_ainfo ), INTENT( OUT ) :: fainfo

! Integers
Expand Down Expand Up @@ -216,7 +216,7 @@ END SUBROUTINE copy_ainfo_in

SUBROUTINE copy_ainfo_out( fainfo, cainfo )
TYPE ( f_gls_ainfo ), INTENT( IN ) :: fainfo
TYPE ( gls_ainfo ), INTENT( OUT ) :: cainfo
TYPE ( gls_ainfo_type ), INTENT( OUT ) :: cainfo

! Integers
cainfo%flag = fainfo%flag
Expand Down Expand Up @@ -244,7 +244,7 @@ END SUBROUTINE copy_ainfo_out
! copy C finfo parameters to fortran

SUBROUTINE copy_finfo_in( cfinfo, ffinfo )
TYPE ( gls_finfo ), INTENT( IN ) :: cfinfo
TYPE ( gls_finfo_type ), INTENT( IN ) :: cfinfo
TYPE ( f_gls_finfo ), INTENT( OUT ) :: ffinfo

! Integers
Expand All @@ -267,7 +267,7 @@ END SUBROUTINE copy_finfo_in

SUBROUTINE copy_finfo_out( ffinfo, cfinfo )
TYPE ( f_gls_finfo ), INTENT( IN ) :: ffinfo
TYPE ( gls_finfo ), INTENT( OUT ) :: cfinfo
TYPE ( gls_finfo_type ), INTENT( OUT ) :: cfinfo

! Integers
cfinfo%flag = ffinfo%flag
Expand All @@ -288,7 +288,7 @@ END SUBROUTINE copy_finfo_out
! copy C sinfo parameters to fortran

SUBROUTINE copy_sinfo_in( csinfo, fsinfo )
TYPE ( gls_sinfo ), INTENT( IN ) :: csinfo
TYPE ( gls_sinfo_type ), INTENT( IN ) :: csinfo
TYPE ( f_gls_sinfo ), INTENT( OUT ) :: fsinfo

! Integers
Expand All @@ -304,7 +304,7 @@ END SUBROUTINE copy_sinfo_in

SUBROUTINE copy_sinfo_out( fsinfo, csinfo )
TYPE ( f_gls_sinfo ), INTENT( IN ) :: fsinfo
TYPE ( gls_sinfo ), INTENT( OUT ) :: csinfo
TYPE ( gls_sinfo_type ), INTENT( OUT ) :: csinfo

! Integers
csinfo%flag = fsinfo%flag
Expand All @@ -328,7 +328,7 @@ SUBROUTINE gls_initialize( cdata, ccontrol ) BIND( C )
! dummy arguments

TYPE ( C_PTR ), INTENT( OUT ) :: cdata ! data is a black-box
TYPE ( gls_control ), INTENT( OUT ) :: ccontrol
TYPE ( gls_control_type ), INTENT( OUT ) :: ccontrol

! local variables

Expand Down Expand Up @@ -367,7 +367,7 @@ SUBROUTINE gls_reset_control( ccontrol, cdata, status ) BIND( C )
! dummy arguments

INTEGER ( KIND = ipc_ ), INTENT( OUT ) :: status
TYPE ( gls_control ), INTENT( INOUT ) :: ccontrol
TYPE ( gls_control_type ), INTENT( INOUT ) :: ccontrol
TYPE ( C_PTR ), INTENT( INOUT ) :: cdata

! local variables
Expand Down Expand Up @@ -406,9 +406,9 @@ SUBROUTINE gls_information( cdata, cainfo, cfinfo, csinfo, status ) BIND( C )
! dummy arguments

TYPE ( C_PTR ), INTENT( INOUT ) :: cdata
TYPE ( gls_ainfo ), INTENT( INOUT ) :: cainfo
TYPE ( gls_finfo ), INTENT( INOUT ) :: cfinfo
TYPE ( gls_sinfo ), INTENT( INOUT ) :: csinfo
TYPE ( gls_ainfo_type ), INTENT( INOUT ) :: cainfo
TYPE ( gls_finfo_type ), INTENT( INOUT ) :: cfinfo
TYPE ( gls_sinfo_type ), INTENT( INOUT ) :: csinfo
INTEGER ( KIND = ipc_ ), INTENT( OUT ) :: status

! local variables
Expand Down Expand Up @@ -446,7 +446,7 @@ SUBROUTINE gls_finalize( cdata, ccontrol, status ) BIND( C )
! dummy arguments

TYPE ( C_PTR ), INTENT( INOUT ) :: cdata
TYPE ( gls_control ), INTENT( IN ) :: ccontrol
TYPE ( gls_control_type ), INTENT( IN ) :: ccontrol
INTEGER ( KIND = ipc_ ), INTENT( OUT ) :: status

! local variables
Expand Down
Loading
Loading