DimensionsWrapper2D_I2P.f90 Source File

This File Depends On

sourcefile~~dimensionswrapper2d_i2p.f90~~EfferentGraph sourcefile~dimensionswrapper2d_i2p.f90 DimensionsWrapper2D_I2P.f90 sourcefile~dimensionswrapper2d.f90 DimensionsWrapper2D.f90 sourcefile~dimensionswrapper2d.f90->sourcefile~dimensionswrapper2d_i2p.f90 sourcefile~errormessages.f90 ErrorMessages.f90 sourcefile~errormessages.f90->sourcefile~dimensionswrapper2d_i2p.f90 sourcefile~dimensionswrapper.f90 DimensionsWrapper.f90 sourcefile~dimensionswrapper.f90->sourcefile~dimensionswrapper2d.f90
Help

Files Dependent On This One

sourcefile~~dimensionswrapper2d_i2p.f90~~AfferentGraph sourcefile~dimensionswrapper2d_i2p.f90 DimensionsWrapper2D_I2P.f90 sourcefile~i2pwrapperfactory.f90 I2PWrapperFactory.f90 sourcefile~dimensionswrapper2d_i2p.f90->sourcefile~i2pwrapperfactory.f90 sourcefile~wrapperfactorylistsingleton.f90 WrapperFactoryListSingleton.f90 sourcefile~i2pwrapperfactory.f90->sourcefile~wrapperfactorylistsingleton.f90 sourcefile~wrapperfactorylist_l_test.f90 WrapperFactoryList_L_Test.f90 sourcefile~wrapperfactorylistsingleton.f90->sourcefile~wrapperfactorylist_l_test.f90 sourcefile~wrapperfactorylist_r8p_test.f90 WrapperFactoryList_R8P_Test.f90 sourcefile~wrapperfactorylistsingleton.f90->sourcefile~wrapperfactorylist_r8p_test.f90 sourcefile~wrapperfactorylist_i4p_test.f90 WrapperFactoryList_I4P_Test.f90 sourcefile~wrapperfactorylistsingleton.f90->sourcefile~wrapperfactorylist_i4p_test.f90 sourcefile~wrapperfactorylist_dlca_test.f90 WrapperFactoryList_DLCA_Test.f90 sourcefile~wrapperfactorylistsingleton.f90->sourcefile~wrapperfactorylist_dlca_test.f90 sourcefile~wrapperfactorylist_i2p_test.f90 WrapperFactoryList_I2P_Test.f90 sourcefile~wrapperfactorylistsingleton.f90->sourcefile~wrapperfactorylist_i2p_test.f90 sourcefile~fpl.f90 FPL.f90 sourcefile~wrapperfactorylistsingleton.f90->sourcefile~fpl.f90 sourcefile~wrapperfactorylist_i1p_test.f90 WrapperFactoryList_I1P_Test.f90 sourcefile~wrapperfactorylistsingleton.f90->sourcefile~wrapperfactorylist_i1p_test.f90 sourcefile~wrapperfactorylist_i8p_test.f90 WrapperFactoryList_I8P_Test.f90 sourcefile~wrapperfactorylistsingleton.f90->sourcefile~wrapperfactorylist_i8p_test.f90 sourcefile~wrapperfactorylist_r4p_test.f90 WrapperFactoryList_R4P_Test.f90 sourcefile~wrapperfactorylistsingleton.f90->sourcefile~wrapperfactorylist_r4p_test.f90 sourcefile~parameterlist.f90 ParameterList.f90 sourcefile~wrapperfactorylistsingleton.f90->sourcefile~parameterlist.f90 sourcefile~parameterlistiterator_test.f90 ParameterListIterator_Test.f90 sourcefile~fpl.f90->sourcefile~parameterlistiterator_test.f90 sourcefile~extendwrappers.f90 ExtendWrappers.f90 sourcefile~fpl.f90->sourcefile~extendwrappers.f90 sourcefile~parameterlist_wrapper7d_test.f90 ParameterList_Wrapper7D_Test.f90 sourcefile~fpl.f90->sourcefile~parameterlist_wrapper7d_test.f90 sourcefile~parameterlist_test.f90 ParameterList_Test.f90 sourcefile~fpl.f90->sourcefile~parameterlist_test.f90 sourcefile~parameterlist_wrapper4d_test.f90 ParameterList_Wrapper4D_Test.f90 sourcefile~fpl.f90->sourcefile~parameterlist_wrapper4d_test.f90 sourcefile~parameterlist_wrapper6d_test.f90 ParameterList_Wrapper6D_Test.f90 sourcefile~fpl.f90->sourcefile~parameterlist_wrapper6d_test.f90 sourcefile~parameterlist_wrapper2d_test.f90 ParameterList_Wrapper2D_Test.f90 sourcefile~fpl.f90->sourcefile~parameterlist_wrapper2d_test.f90 sourcefile~fortranparameterlist_example.f90 FortranParameterList_Example.f90 sourcefile~fpl.f90->sourcefile~fortranparameterlist_example.f90 sourcefile~parameterlist_wrapper0d_test.f90 ParameterList_Wrapper0D_Test.f90 sourcefile~fpl.f90->sourcefile~parameterlist_wrapper0d_test.f90 sourcefile~parameterlist_wrapper1d_test.f90 ParameterList_Wrapper1D_Test.f90 sourcefile~fpl.f90->sourcefile~parameterlist_wrapper1d_test.f90 sourcefile~parameterlist_wrapper5d_test.f90 ParameterList_Wrapper5D_Test.f90 sourcefile~fpl.f90->sourcefile~parameterlist_wrapper5d_test.f90 sourcefile~parameterlist_wrapper3d_test.f90 ParameterList_Wrapper3D_Test.f90 sourcefile~fpl.f90->sourcefile~parameterlist_wrapper3d_test.f90 sourcefile~parameterlist.f90->sourcefile~fpl.f90
Help


Source Code

!-----------------------------------------------------------------
! FPL (Fortran Parameter List)
! Copyright (c) 2015 Santiago Badia, Alberto F. Martín, 
! Javier Principe and Víctor Sande.
! All rights reserved.
!
! This library is free software; you can redistribute it and/or
! modify it under the terms of the GNU Lesser General Public
! License as published by the Free Software Foundation; either
! version 3.0 of the License, or (at your option) any later version.
!
! This library is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
! Lesser General Public License for more details.
!
! You should have received a copy of the GNU Lesser General Public
! License along with this library.
!-----------------------------------------------------------------

module DimensionsWrapper2D_I2P

USE DimensionsWrapper2D
USE PENF, only: I2P, I4P, str, byte_size
USE ErrorMessages

implicit none
private

    type, extends(DimensionsWrapper2D_t) :: DimensionsWrapper2D_I2P_t
        integer(I2P), allocatable :: Value(:,:)
    contains
    private
        procedure, public :: Set            => DimensionsWrapper2D_I2P_Set
        procedure, public :: Get            => DimensionsWrapper2D_I2P_Get
        procedure, public :: GetShape       => DimensionsWrapper2D_I2P_GetShape
        procedure, public :: GetPointer     => DimensionsWrapper2D_I2P_GetPointer
        procedure, public :: GetPolymorphic => DimensionsWrapper2D_I2P_GetPolymorphic
        procedure, public :: DataSizeInBytes=> DimensionsWrapper2D_I2P_DataSizeInBytes
        procedure, public :: isOfDataType   => DimensionsWrapper2D_I2P_isOfDataType
        procedure, public :: toString       => DimensionsWrapper2D_I2P_toString
        procedure, public :: Free           => DimensionsWrapper2D_I2P_Free
        procedure, public :: Print          => DimensionsWrapper2D_I2P_Print
        final             ::                   DimensionsWrapper2D_I2P_Final
    end type           

public :: DimensionsWrapper2D_I2P_t

contains


    subroutine DimensionsWrapper2D_I2P_Final(this) 
    !-----------------------------------------------------------------
    !< Final procedure of DimensionsWrapper2D
    !-----------------------------------------------------------------
        type(DimensionsWrapper2D_I2P_t), intent(INOUT) :: this
    !-----------------------------------------------------------------
        call this%Free()
    end subroutine


    subroutine DimensionsWrapper2D_I2P_Set(this, Value) 
    !-----------------------------------------------------------------
    !< Set I2P Wrapper Value
    !-----------------------------------------------------------------
        class(DimensionsWrapper2D_I2P_t), intent(INOUT) :: this
        class(*),                         intent(IN)    :: Value(:,:)
        integer                                         :: err
    !-----------------------------------------------------------------
        select type (Value)
            type is (integer(I2P))
                allocate(this%Value(size(Value,dim=1),  &
                                    size(Value,dim=2)), &
                                    stat=err)
                this%Value = Value
                if(err/=0) &
                    call msg%Error( txt='Setting Value: Allocation error ('//&
                                    str(no_sign=.true.,n=err)//')', &
                                    file=__FILE__, line=__LINE__ )
            class Default
                call msg%Warn( txt='Setting value: Expected data type (I2P)', &
                               file=__FILE__, line=__LINE__ )
        end select
    end subroutine


    subroutine DimensionsWrapper2D_I2P_Get(this, Value) 
    !-----------------------------------------------------------------
    !< Get I2P Wrapper Value
    !-----------------------------------------------------------------
        class(DimensionsWrapper2D_I2P_t), intent(IN)  :: this
        class(*),                         intent(OUT) :: Value(:,:)
        integer(I4P), allocatable                     :: ValueShape(:)
    !-----------------------------------------------------------------
        select type (Value)
            type is (integer(I2P))
                call this%GetShape(ValueShape)
                if(all(ValueShape == shape(Value))) then
                    Value = this%Value
                else
                    call msg%Warn(txt='Getting value: Wrong shape ('//&
                                  str(no_sign=.true.,n=ValueShape)//'/='//&
                                  str(no_sign=.true.,n=shape(Value))//')',&
                                  file=__FILE__, line=__LINE__ )
                endif
            class Default
                call msg%Warn(txt='Getting value: Expected data type (I2P)',&
                              file=__FILE__, line=__LINE__ )
        end select
    end subroutine


    subroutine DimensionsWrapper2D_I2P_GetShape(this, ValueShape)
    !-----------------------------------------------------------------
    !< Get Wrapper Value Shape
    !-----------------------------------------------------------------
        class(DimensionsWrapper2D_I2P_t), intent(IN)    :: this
        integer(I4P), allocatable,        intent(INOUT) :: ValueShape(:)
    !-----------------------------------------------------------------
        if(allocated(ValueShape)) deallocate(ValueShape)
		allocate(ValueShape(this%GetDimensions()))
        ValueShape = shape(this%Value, kind=I4P)
    end subroutine


    function DimensionsWrapper2D_I2P_GetPointer(this) result(Value) 
    !-----------------------------------------------------------------
    !< Get Unlimited Polymorphic pointer to Wrapper Value
    !-----------------------------------------------------------------
        class(DimensionsWrapper2D_I2P_t), target, intent(IN) :: this
        class(*), pointer                                    :: Value(:,:)
    !-----------------------------------------------------------------
        Value => this%value
    end function


    subroutine DimensionsWrapper2D_I2P_GetPolymorphic(this, Value) 
    !-----------------------------------------------------------------
    !< Get Unlimited Polymorphic Wrapper Value
    !-----------------------------------------------------------------
        class(DimensionsWrapper2D_I2P_t), intent(IN)  :: this
        class(*), allocatable,            intent(OUT) :: Value(:,:)
    !-----------------------------------------------------------------
        allocate(Value(size(this%Value,dim=1),  &
                       size(this%Value,dim=2)), &
                       source=this%Value)
    end subroutine


    function DimensionsWrapper2D_I2P_DataSizeInBytes(this) result(DataSizeInBytes)
    !-----------------------------------------------------------------
    !< Return the size in bytes of stored data
    !-----------------------------------------------------------------
        class(DimensionsWrapper2D_I2P_t), intent(IN) :: this             !< Dimensions wrapper 2D
        integer(I4P)                                 :: DataSizeinBytes  !< Size in bytes of the stored data
    !-----------------------------------------------------------------
        DataSizeInBytes = byte_size(this%value(1,1))*size(this%value)
    end function DimensionsWrapper2D_I2P_DataSizeInBytes


    function DimensionsWrapper2D_I2P_isOfDataType(this, Mold) result(isOfDataType)
    !-----------------------------------------------------------------
    !< Check if Mold and Value are of the same datatype 
    !-----------------------------------------------------------------
        class(DimensionsWrapper2D_I2P_t), intent(IN) :: this          !< Dimensions wrapper 2D
        class(*),                         intent(IN) :: Mold          !< Mold for data type comparison
        logical                                      :: isOfDataType  !< Boolean flag to check if Value is of the same data type as Mold
    !-----------------------------------------------------------------
        isOfDataType = .false.
        select type (Mold)
            type is (integer(I2P))
                isOfDataType = .true.
        end select
    end function DimensionsWrapper2D_I2P_isOfDataType


    subroutine DimensionsWrapper2D_I2P_Free(this) 
    !-----------------------------------------------------------------
    !< Free a DimensionsWrapper2D
    !-----------------------------------------------------------------
        class(DimensionsWrapper2D_I2P_t), intent(INOUT) :: this
        integer                                         :: err
    !-----------------------------------------------------------------
        if(allocated(this%Value)) then
            deallocate(this%Value, stat=err)
            if(err/=0) call msg%Error(txt='Freeing Value: Deallocation error ('// &
                                      str(no_sign=.true.,n=err)//')',             &
                                      file=__FILE__, line=__LINE__ )
        endif
    end subroutine


    function DimensionsWrapper2D_I2P_toString(this, Separator) result(String) 
    !-----------------------------------------------------------------
    !< Return the wrapper value as a string
    !-----------------------------------------------------------------
        class(DimensionsWrapper2D_I2P_t), intent(IN)  :: this
        character(len=1), optional,       intent(IN)  :: Separator
        character(len=:), allocatable                 :: String
        character(len=1)                              :: Sep
        integer(I4P)                                  :: idx
    !-----------------------------------------------------------------
        String = ''
        Sep = ','
        if(allocated(this%Value)) then
            if(present(Separator)) Sep = Separator
            do idx=1, size(this%Value,2)
                String = String // trim(str(n=this%Value(:,idx))) // Sep
            enddo
            String = trim(adjustl(String(:len(String)-1)))
        endif
    end function


    subroutine DimensionsWrapper2D_I2P_Print(this, unit, prefix, iostat, iomsg)
    !-----------------------------------------------------------------
    !< Print Wrapper
    !-----------------------------------------------------------------
        class(DimensionsWrapper2D_I2P_t), intent(IN)  :: this         !< DimensionsWrapper
        integer(I4P),                     intent(IN)  :: unit         !< Logic unit.
        character(*), optional,           intent(IN)  :: prefix       !< Prefixing string.
        integer(I4P), optional,           intent(OUT) :: iostat       !< IO error.
        character(*), optional,           intent(OUT) :: iomsg        !< IO error message.
        character(len=:), allocatable                 :: prefd        !< Prefixing string.
        integer(I4P)                                  :: iostatd      !< IO error.
        character(500)                                :: iomsgd       !< Temporary variable for IO error message.
    !-----------------------------------------------------------------
        prefd = '' ; if (present(prefix)) prefd = prefix
        write(unit=unit,fmt='(A,$)',iostat=iostatd,iomsg=iomsgd) prefd//' Data Type = I2P'//&
                        ', Dimensions = '//trim(str(no_sign=.true., n=this%GetDimensions()))//&
                        ', Bytes = '//trim(str(no_sign=.true., n=this%DataSizeInBytes()))//&
                        ', Value = '
        write(unit=unit,fmt=*,iostat=iostatd,iomsg=iomsgd) this%toString()

        if (present(iostat)) iostat = iostatd
        if (present(iomsg))  iomsg  = iomsgd
    end subroutine DimensionsWrapper2D_I2P_Print

end module DimensionsWrapper2D_I2P

Circle.f90 CircleWrapper.f90 CircleWrapperFactory.f90 compact_real.f90 DimensionsWrapper.f90 DimensionsWrapper0D.f90 DimensionsWrapper0D_DLCA.f90 DimensionsWrapper0D_I1P.f90 DimensionsWrapper0D_I2P.f90 DimensionsWrapper0D_I4P.f90 DimensionsWrapper0D_I8P.f90 DimensionsWrapper0D_L.f90 DimensionsWrapper0D_R4P.f90 DimensionsWrapper0D_R8P.f90 DimensionsWrapper1D.f90 DimensionsWrapper1D_DLCA.f90 DimensionsWrapper1D_I1P.f90 DimensionsWrapper1D_I2P.f90 DimensionsWrapper1D_I4P.f90 DimensionsWrapper1D_I8P.f90 DimensionsWrapper1D_L.f90 DimensionsWrapper1D_R4P.f90 DimensionsWrapper1D_R8P.f90 DimensionsWrapper2D.f90 DimensionsWrapper2D_DLCA.f90 DimensionsWrapper2D_I1P.f90 DimensionsWrapper2D_I2P.f90 DimensionsWrapper2D_I4P.f90 DimensionsWrapper2D_I8P.f90 DimensionsWrapper2D_L.f90 DimensionsWrapper2D_R4P.f90 DimensionsWrapper2D_R8P.f90 DimensionsWrapper3D.f90 DimensionsWrapper3D_DLCA.f90 DimensionsWrapper3D_I1P.f90 DimensionsWrapper3D_I2P.f90 DimensionsWrapper3D_I4P.f90 DimensionsWrapper3D_I8P.f90 DimensionsWrapper3D_L.f90 DimensionsWrapper3D_R4P.f90 DimensionsWrapper3D_R8P.f90 DimensionsWrapper4D.f90 DimensionsWrapper4D_DLCA.f90 DimensionsWrapper4D_I1P.f90 DimensionsWrapper4D_I2P.f90 DimensionsWrapper4D_I4P.f90 DimensionsWrapper4D_I8P.f90 DimensionsWrapper4D_L.f90 DimensionsWrapper4D_R4P.f90 DimensionsWrapper4D_R8P.f90 DimensionsWrapper5D.f90 DimensionsWrapper5D_DLCA.f90 DimensionsWrapper5D_I1P.f90 DimensionsWrapper5D_I2P.f90 DimensionsWrapper5D_I4P.f90 DimensionsWrapper5D_I8P.f90 DimensionsWrapper5D_L.f90 DimensionsWrapper5D_R4P.f90 DimensionsWrapper5D_R8P.f90 DimensionsWrapper6D.f90 DimensionsWrapper6D_DLCA.f90 DimensionsWrapper6D_I1P.f90 DimensionsWrapper6D_I2P.f90 DimensionsWrapper6D_I4P.f90 DimensionsWrapper6D_I8P.f90 DimensionsWrapper6D_L.f90 DimensionsWrapper6D_R4P.f90 DimensionsWrapper6D_R8P.f90 DimensionsWrapper7D.f90 DimensionsWrapper7D_DLCA.f90 DimensionsWrapper7D_I1P.f90 DimensionsWrapper7D_I2P.f90 DimensionsWrapper7D_I4P.f90 DimensionsWrapper7D_I8P.f90 DimensionsWrapper7D_L.f90 DimensionsWrapper7D_R4P.f90 DimensionsWrapper7D_R8P.f90 DLACWrapperFactory.f90 ErrorMessages.f90 ExtendWrappers.f90 FortranParameterList_Example.f90 FPL.f90 FPL_utils.f90 I1PWrapperFactory.f90 I2PWrapperFactory.f90 I4PWrapperFactory.f90 I8PWrapperFactory.f90 LWrapperFactory.f90 ParameterEntry.f90 ParameterEntryDictionary.f90 ParameterList.f90 ParameterList_Test.f90 ParameterList_Wrapper0D_Test.f90 ParameterList_Wrapper1D_Test.f90 ParameterList_Wrapper2D_Test.f90 ParameterList_Wrapper3D_Test.f90 ParameterList_Wrapper4D_Test.f90 ParameterList_Wrapper5D_Test.f90 ParameterList_Wrapper6D_Test.f90 ParameterList_Wrapper7D_Test.f90 ParameterListIterator_Test.f90 ParameterRootEntry.f90 R4PWrapperFactory.f90 R8PWrapperFactory.f90 WrapperFactory.f90 WrapperFactoryList.f90 WrapperFactoryList_DLCA_Test.f90 WrapperFactoryList_I1P_Test.f90 WrapperFactoryList_I2P_Test.f90 WrapperFactoryList_I4P_Test.f90 WrapperFactoryList_I8P_Test.f90 WrapperFactoryList_L_Test.f90 WrapperFactoryList_R4P_Test.f90 WrapperFactoryList_R8P_Test.f90 WrapperFactoryListSingleton.f90