! This file was automatically generated by SWIG (http://www.swig.org).
! Version 4.0.0
!
! Do not make changes to this file unless you know what you are doing--modify
! the SWIG interface file instead.

! ---------------------------------------------------------------
! Programmer(s): Auto-generated by swig.
! ---------------------------------------------------------------
! SUNDIALS Copyright Start
! Copyright (c) 2002-2022, Lawrence Livermore National Security
! and Southern Methodist University.
! All rights reserved.
!
! See the top-level LICENSE and NOTICE files for details.
!
! SPDX-License-Identifier: BSD-3-Clause
! SUNDIALS Copyright End
! ---------------------------------------------------------------


#include "sundials/sundials_config.h"

module fsundials_context_mod
 use, intrinsic :: ISO_C_BINDING
 implicit none
 private

 ! DECLARATION CONSTRUCTS
 public :: FSUNContext_GetProfiler
 public :: FSUNContext_SetProfiler

public :: FSUNContext_Free
public :: FSUNContext_Create


! WRAPPER DECLARATIONS
interface
function swigc_FSUNContext_GetProfiler(farg1, farg2) &
bind(C, name="_wrap_FSUNContext_GetProfiler") &
result(fresult)
use, intrinsic :: ISO_C_BINDING
type(C_PTR), value :: farg1
type(C_PTR), value :: farg2
integer(C_INT) :: fresult
end function

function swigc_FSUNContext_SetProfiler(farg1, farg2) &
bind(C, name="_wrap_FSUNContext_SetProfiler") &
result(fresult)
use, intrinsic :: ISO_C_BINDING
type(C_PTR), value :: farg1
type(C_PTR), value :: farg2
integer(C_INT) :: fresult
end function


function swigc_FSUNContext_Free(farg1) &
bind(C, name="_wrap_FSUNContext_Free") &
result(fresult)
use, intrinsic :: ISO_C_BINDING
type(C_PTR), value :: farg1
integer(C_INT) :: fresult
end function

function swigc_FSUNContext_Create(farg1, farg2) &
bind(C, name="_wrap_FSUNContext_Create") &
result(fresult)
use, intrinsic :: ISO_C_BINDING
type(C_PTR), value :: farg1
type(C_PTR), value :: farg2
integer(C_INT) :: fresult
end function


end interface


contains
 ! MODULE SUBPROGRAMS
function FSUNContext_GetProfiler(sunctx, profiler) &
result(swig_result)
use, intrinsic :: ISO_C_BINDING
integer(C_INT) :: swig_result
type(C_PTR) :: sunctx
type(C_PTR), target, intent(inout) :: profiler
integer(C_INT) :: fresult 
type(C_PTR) :: farg1 
type(C_PTR) :: farg2 

farg1 = sunctx
farg2 = c_loc(profiler)
fresult = swigc_FSUNContext_GetProfiler(farg1, farg2)
swig_result = fresult
end function

function FSUNContext_SetProfiler(sunctx, profiler) &
result(swig_result)
use, intrinsic :: ISO_C_BINDING
integer(C_INT) :: swig_result
type(C_PTR) :: sunctx
type(C_PTR) :: profiler
integer(C_INT) :: fresult 
type(C_PTR) :: farg1 
type(C_PTR) :: farg2 

farg1 = sunctx
farg2 = profiler
fresult = swigc_FSUNContext_SetProfiler(farg1, farg2)
swig_result = fresult
end function


function FSUNContext_Free(ctx) &
result(swig_result)
use, intrinsic :: ISO_C_BINDING
integer(C_INT) :: swig_result
type(C_PTR), target, intent(inout) :: ctx
integer(C_INT) :: fresult
type(C_PTR) :: farg1

farg1 = c_loc(ctx)
fresult = swigc_FSUNContext_Free(farg1)
swig_result = fresult
end function

function FSUNContext_Create(comm, ctx) &
result(swig_result)
use, intrinsic :: ISO_C_BINDING
#ifdef SUNDIALS_BUILD_WITH_PROFILING
use fsundials_profiler_mod, only : FSUNProfiler_Create
#endif
integer(C_INT) :: swig_result
type(C_PTR) :: comm
type(C_PTR), target, intent(inout) :: ctx
integer(C_INT) :: fresult
type(C_PTR) :: farg1
type(C_PTR) :: farg2
#ifdef SUNDIALS_BUILD_WITH_PROFILING
type(C_PTR) :: profiler
#endif

farg1 = comm
farg2 = c_loc(ctx)
fresult = swigc_FSUNContext_Create(c_null_ptr, farg2)
#ifdef SUNDIALS_BUILD_WITH_PROFILING
fresult = FSUNProfiler_Create(farg1, "FSUNContext Default", profiler)
fresult = swigc_FSUNContext_SetProfiler(ctx, profiler)
#endif
swig_result = fresult
end function


end module
