Manual Reference Pages  - is_contiguous (3fortran)

NAME

IS_CONTIGUOUS(3) - [ARRAY:INQUIRY] Test if object is contiguous

SYNOPSIS

result = is_contiguous(array)

         logical function is_contiguous(array)

type(TYPE(kind=**)),intent(in) :: array

CHARACTERISTICS

o a kind designated as ** may be any supported kind for the type
o ARRAY may be of any type. It shall be an array or assumed-rank. If it is a pointer it shall be associated.
o the result is a default logical scalar

DESCRIPTION

IS_CONTIGUOUS(3) returns .true. if and only if an object is contiguous.

An object is contiguous if it is
o (1) an object with the CONTIGUOUS attribute,
o (2) a nonpointer whole array that is not assumed-shape,
o (3) an assumed-shape array that is argument associated with an array that is contiguous,
o (4) an array allocated by an ALLOCATE statement,
o (5) a pointer associated with a contiguous target, or
o (6) a nonzero-sized array section provided that
o (A) its base object is contiguous,
o (B) it does not have a vector subscript,
o (C) the elements of the section, in array element order, are a subset of the base object elements that are consecutive in array element order,
o (D) if the array is of type character and a substring-range appears, the substring-range specifies all of the characters of the parent-string,
o (E) only its final part-ref has nonzero rank, and
o (F) it is not the real or imaginary part of an array of type complex.
An object is not contiguous if it is an array subobject, and
o the object has two or more elements,
o the elements of the object in array element order are not consecutive in the elements of the base object,
o the object is not of type character with length zero, and
o the object is not of a derived type that has no ultimate components other than zero-sized arrays and
o characters with length zero.
It is processor-dependent whether any other object is contiguous.

OPTIONS

o ARRAY : An array of any type to be tested for being contiguous. If it is a pointer it shall be associated.

RESULT

The result has the value .true. if ARRAY is contiguous, and .false. otherwise.

EXAMPLES

Sample program:

    program demo_is_contiguous
    implicit none
    intrinsic is_contiguous
    real, DIMENSION (1000, 1000), TARGET :: A
    real, DIMENSION (:, :), POINTER       :: IN, OUT
       IN => A              ! Associate IN with target A
       OUT => A(1:1000:2,:) ! Associate OUT with subset of target A
       !
       write(*,*)’IN is ’,IS_CONTIGUOUS(IN)
       write(*,*)’OUT is ’,IS_CONTIGUOUS(OUT)
       !
    end program demo_is_contiguous

Results:

        IN is  T
        OUT is  F

STANDARD

Fortran 2008

SEE ALSO

****(3)

fortran-lang intrinsic descriptions


Nemo Release 3.1 is_contiguous (3fortran) April 28, 2024
Generated by manServer 1.08 from 74378554-f391-4f41-aacb-7cfb1bdebc60 using man macros.