The ParaMonte Documentation Website
Current view: top level - kernel - SpecBase_InterfaceType_mod.f90 (source / functions) Hit Total Coverage
Test: ParaMonte 1.5.1 :: Coarray Parallel Kernel - Code Coverage Report Lines: 17 17 100.0 %
Date: 2021-01-08 12:59:07 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       2             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       3             : !!!!
       4             : !!!!   MIT License
       5             : !!!!
       6             : !!!!   ParaMonte: plain powerful parallel Monte Carlo library.
       7             : !!!!
       8             : !!!!   Copyright (C) 2012-present, The Computational Data Science Lab
       9             : !!!!
      10             : !!!!   This file is part of the ParaMonte library.
      11             : !!!!
      12             : !!!!   Permission is hereby granted, free of charge, to any person obtaining a 
      13             : !!!!   copy of this software and associated documentation files (the "Software"), 
      14             : !!!!   to deal in the Software without restriction, including without limitation 
      15             : !!!!   the rights to use, copy, modify, merge, publish, distribute, sublicense, 
      16             : !!!!   and/or sell copies of the Software, and to permit persons to whom the 
      17             : !!!!   Software is furnished to do so, subject to the following conditions:
      18             : !!!!
      19             : !!!!   The above copyright notice and this permission notice shall be 
      20             : !!!!   included in all copies or substantial portions of the Software.
      21             : !!!!
      22             : !!!!   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
      23             : !!!!   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
      24             : !!!!   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
      25             : !!!!   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
      26             : !!!!   DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
      27             : !!!!   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 
      28             : !!!!   OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
      29             : !!!!
      30             : !!!!   ACKNOWLEDGMENT
      31             : !!!!
      32             : !!!!   ParaMonte is an honor-ware and its currency is acknowledgment and citations.
      33             : !!!!   As per the ParaMonte library license agreement terms, if you use any parts of 
      34             : !!!!   this library for any purposes, kindly acknowledge the use of ParaMonte in your 
      35             : !!!!   work (education/research/industry/development/...) by citing the ParaMonte 
      36             : !!!!   library as described on this page:
      37             : !!!!
      38             : !!!!       https://github.com/cdslaborg/paramonte/blob/main/ACKNOWLEDGMENT.md
      39             : !!!!
      40             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      41             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      42             : 
      43             : !> \brief
      44             : !> This module contains the classes and procedures for setting up the `interfaceType` attribute of ParaMonte samplers.
      45             : !> For more information, see the description of this attribute in the body of the module.
      46             : !> \author Amir Shahmoradi
      47             : 
      48             : module SpecBase_InterfaceType_mod
      49             : 
      50             :     use Constants_mod, only: IK
      51             :     implicit none
      52             : 
      53             :     character(*), parameter         :: MODULE_NAME = "@SpecBase_InterfaceType_mod"
      54             :     integer(IK), parameter          :: MAX_INTERFACETYPE_LEN = 511_IK
      55             : 
      56             :     character(:)    , allocatable   :: interfaceType ! namelist input
      57             : 
      58             :     type                            :: InterfaceType_type
      59             :         logical                     :: isC = .false.
      60             :         logical                     :: isCPP = .false.
      61             :         logical                     :: isFortran = .false.
      62             :         logical                     :: isMATLAB = .false.
      63             :         logical                     :: isPython = .false.
      64             :         logical                     :: isR = .false.
      65             :         character(:), allocatable   :: val
      66             :         character(:), allocatable   :: def
      67             :         character(:), allocatable   :: null
      68             :         character(:), allocatable   :: desc
      69             :     contains
      70             :         procedure, pass             :: set => setInterfaceType, nullifyNameListVar
      71             :     end type InterfaceType_type
      72             : 
      73             :     interface InterfaceType_type
      74             :         module procedure            :: constructInterfaceType
      75             :     end interface InterfaceType_type
      76             : 
      77             :     private :: constructInterfaceType, setInterfaceType, nullifyNameListVar
      78             : 
      79             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      80             : 
      81             : contains
      82             : 
      83             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      84             : 
      85        1047 :     function constructInterfaceType() result(InterfaceTypeObj)
      86             : #if INTEL_COMPILER_ENABLED && defined DLL_ENABLED && (OS_IS_WINDOWS || defined OS_IS_DARWIN)
      87             :         !DEC$ ATTRIBUTES DLLEXPORT :: constructInterfaceType
      88             : #endif
      89             :         use Constants_mod, only: NULL_SK
      90             :         use Decoration_mod, only: TAB
      91             :         use String_mod, only: num2str
      92             :         implicit none
      93             :         type(InterfaceType_type) :: InterfaceTypeObj
      94             : #if defined C_ENABLED
      95             :         InterfaceTypeObj%def = "The C Programming Language."
      96             :         InterfaceTypeObj%isC = .true.
      97             : #elif defined CPP_ENABLED
      98             :         InterfaceTypeObj%def = "The C++ Programming Language."
      99             :         InterfaceTypeObj%isCPP = .true.
     100             : #elif defined FORTRAN_ENABLED
     101        1047 :         InterfaceTypeObj%def = "The Fortran Programming Language."
     102        1047 :         InterfaceTypeObj%isFortran = .true. ! index(interfaceLowerCase,"fortran") /= 0
     103             : #elif defined JULIA_ENABLED
     104             :         InterfaceTypeObj%def = "The Julia Programming Language."
     105             :         InterfaceTypeObj%isJulia = .true.
     106             : #elif defined MATLAB_ENABLED
     107             :         InterfaceTypeObj%def = "The MATLAB Programming Language."
     108             :         InterfaceTypeObj%isMATLAB = .true.
     109             : #elif defined MATTHEMATICA_ENABLED
     110             :         InterfaceTypeObj%def = "The Wolfram Mathermatica Programming Language."
     111             :         InterfaceTypeObj%isMathermatica = .true.
     112             : #elif defined PYTHON_ENABLED
     113             :         InterfaceTypeObj%def = "The Python Programming Language."
     114             :         InterfaceTypeObj%isPython = .true.
     115             : #elif defined R_ENABLED
     116             :         InterfaceTypeObj%def = "The R Programming Language."
     117             :         InterfaceTypeObj%isR = .true.
     118             : #else
     119             : #error "Undefined ParaMonte interface type in SpecBase_InterfaceType_mod.f90"
     120             : #endif
     121        1047 :         if ( allocated(InterfaceTypeObj%null) ) deallocate(InterfaceTypeObj%null)
     122        1047 :         allocate( character(len=MAX_INTERFACETYPE_LEN) :: InterfaceTypeObj%null )
     123        1047 :         InterfaceTypeObj%null = repeat(NULL_SK, MAX_INTERFACETYPE_LEN)
     124             :         InterfaceTypeObj%desc = &
     125        1047 :         "This is a ParaMonte internal variable used for providing information about other languages' interface with ParaMonte."
     126        1047 :     end function constructInterfaceType
     127             : 
     128             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     129             : 
     130        1047 :     subroutine nullifyNameListVar(InterfaceTypeObj)
     131             : #if INTEL_COMPILER_ENABLED && defined DLL_ENABLED && (OS_IS_WINDOWS || defined OS_IS_DARWIN)
     132             :         !DEC$ ATTRIBUTES DLLEXPORT :: nullifyNameListVar
     133             : #endif
     134             :         implicit none
     135             :         class(InterfaceType_type), intent(in) :: InterfaceTypeObj
     136        1047 :         interfaceType = InterfaceTypeObj%null
     137        1047 :     end subroutine nullifyNameListVar
     138             : 
     139             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     140             : 
     141        1047 :     subroutine setInterfaceType(InterfaceTypeObj,interfaceType)
     142             : #if INTEL_COMPILER_ENABLED && defined DLL_ENABLED && (OS_IS_WINDOWS || defined OS_IS_DARWIN)
     143             :         !DEC$ ATTRIBUTES DLLEXPORT :: setInterfaceType
     144             : #endif
     145        1047 :         use String_mod, only: getLowerCase
     146             :         implicit none
     147             :         class(InterfaceType_type), intent(inout)    :: InterfaceTypeObj
     148             :         character(*), intent(in)                    :: interfaceType
     149        1047 :         InterfaceTypeObj%val = trim(adjustl(interfaceType))
     150        1047 :         if (InterfaceTypeObj%val==trim(adjustl(InterfaceTypeObj%null))) then
     151        1047 :             InterfaceTypeObj%val=InterfaceTypeObj%def
     152             :         end if
     153        2094 :     end subroutine setInterfaceType
     154             : 
     155             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     156             : 
     157             : end module SpecBase_InterfaceType_mod ! LCOV_EXCL_LINE

ParaMonte: Plain Powerful Parallel Monte Carlo Library 
The Computational Data Science Lab
© Copyright 2012 - 2021