<commit_before>!   $Id$
!   Contour plot demo.
!
!   Copyright (C) 2004  <NAME>
!
!   This file is part of PLplot.
!
!   PLplot is free software; you can redistribute it and/or modify
!   it under the terms of the GNU Library General Public License as
!   published by the Free Software Foundation; either version 2 of the
!   License, or (at your option) any later version.
!
!   PLplot 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 Library General Public License for more details.
!
!   You should have received a copy of the GNU Library General Public
!   License along with PLplot; if not, write to the Free Software
!   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

!   Does several contour plots using different coordinate mappings.

program x09f95
    use plplot, PI => PL_PI, TWOPI => PL_TWOPI
    use plf95demolib
    implicit none
    integer i, j

!   xdim and ydim are the absolute static dimensions.
!   nptsx, and nptsy are the (potentially dynamic) defined area of the 2D
!   arrays that is actually used.
    integer, parameter :: xdim=99, ydim=100, nptsx=35, nptsy=46

    real(kind=plflt)   :: z(xdim, ydim), w(xdim, ydim), &
                          xg1(xdim), yg1(ydim), &
                          xg2(xdim, ydim), yg2(xdim, ydim)
    real(kind=plflt)   :: xc(nptsx), yc(nptsy)
    real(kind=plflt)   :: xx, yy, argx, argy, distort
    real(kind=plflt)   :: tr(6)

    real(kind=plflt)   :: clevel(11) = &
        (/ -1._plflt, -0.8_plflt, -0.6_plflt, -0.4_plflt, -0.2_plflt, &
            0._plflt,  0.2_plflt,  0.4_plflt,  0.6_plflt,  0.8_plflt, 1._plflt /)

!   Process command-line arguments
    call plparseopts(PL_PARSE_FULL)

    tr = (/ 2._plflt/dble(nptsx-1), 0.0_plflt, -1.0_plflt, &
            0.0_plflt, 2._plflt/dble(nptsy-1), -1.0_plflt /)

!   Calculate the data matrices.
    xc = (arange(0,nptsx) - (nptsx/2)) / dble(nptsx/2)
    yc = (arange(0,nptsy) - (nptsy/2)) / dble(nptsy/2) - 1.0_plflt

    do i=1,nptsx
        do j=1,nptsy
            z(i,j) = xc(i)**2 - yc(j)**2
            w(i,j) = 2._plflt*xc(i)*yc(j)
        enddo
    enddo

!   Build the 1-d coord arrays.
    distort = 0.4_plflt

    xg1 = coord_function( arange(0,nptsx) / dble(nptsx-1),  distort )
    yg1 = coord_function( arange(0,nptsy) / dble(nptsy-1), -distort )

!   Build the 2-d coord arrays.
    do i=1,nptsx
        xx = -1._plflt + dble(i-1)*2._plflt/dble(nptsx-1)
        argx = 0.5_plflt*PI*xx
        do j=1,nptsy
            yy = -1._plflt + dble(j-1)*2._plflt/dble(nptsy-1)
            argy = 0.5_plflt*PI*yy
            xg2(i,j) = xx + distort*cos(argx)*cos(argy)
            yg2(i,j) = yy - distort*cos(argx)*cos(argy)
        enddo
    enddo

    call plinit
<commit_msg>Correct mistake in assignmentts to xg1 and yg1 (different array dimensions for left- and right-hand sides - see SF bug tracker)<commit_after>!   $Id$
!   Contour plot demo.
!
!   Copyright (C) 2004  <NAME>
!
!   This file is part of PLplot.
!
!   PLplot is free software; you can redistribute it and/or modify
!   it under the terms of the GNU Library General Public License as
!   published by the Free Software Foundation; either version 2 of the
!   License, or (at your option) any later version.
!
!   PLplot 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 Library General Public License for more details.
!
!   You should have received a copy of the GNU Library General Public
!   License along with PLplot; if not, write to the Free Software
!   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

!   Does several contour plots using different coordinate mappings.

program x09f95
    use plplot, PI => PL_PI, TWOPI => PL_TWOPI
    use plf95demolib
    implicit none
    integer i, j

!   xdim and ydim are the absolute static dimensions.
!   nptsx, and nptsy are the (potentially dynamic) defined area of the 2D
!   arrays that is actually used.
    integer, parameter :: xdim=99, ydim=100, nptsx=35, nptsy=46

    real(kind=plflt)   :: z(xdim, ydim), w(xdim, ydim), &
                          xg1(xdim), yg1(ydim), &
                          xg2(xdim, ydim), yg2(xdim, ydim)
    real(kind=plflt)   :: xc(nptsx), yc(nptsy)
    real(kind=plflt)   :: xx, yy, argx, argy, distort
    real(kind=plflt)   :: tr(6)

    real(kind=plflt)   :: clevel(11) = &
        (/ -1._plflt, -0.8_plflt, -0.6_plflt, -0.4_plflt, -0.2_plflt, &
            0._plflt,  0.2_plflt,  0.4_plflt,  0.6_plflt,  0.8_plflt, 1._plflt /)

!   Process command-line arguments
    call plparseopts(PL_PARSE_FULL)

    tr = (/ 2._plflt/dble(nptsx-1), 0.0_plflt, -1.0_plflt, &
            0.0_plflt, 2._plflt/dble(nptsy-1), -1.0_plflt /)

!   Calculate the data matrices.
    xc = (arange(0,nptsx) - (nptsx/2)) / dble(nptsx/2)
    yc = (arange(0,nptsy) - (nptsy/2)) / dble(nptsy/2) - 1.0_plflt

    do i=1,nptsx
        do j=1,nptsy
            z(i,j) = xc(i)**2 - yc(j)**2
            w(i,j) = 2._plflt*xc(i)*yc(j)
        enddo
    enddo

!   Build the 1-d coord arrays.
    distort = 0.4_plflt

    xg1(1:nptsx) = coord_function( arange(0,nptsx) / dble(nptsx-1),  distort )
    yg1(1:nptsy) = coord_function( arange(0,nptsy) / dble(nptsy-1), -distort )

!   Build the 2-d coord arrays.
    do i=1,nptsx
        xx = -1._plflt + dble(i-1)*2._plflt/dble(nptsx-1)
        argx = 0.5_plflt*PI*xx
        do j=1,nptsy
            yy = -1._plflt + dble(j-1)*2._plflt/dble(nptsy-1)
            argy = 0.5_plflt*PI*yy
            xg2(i,j) = xx + distort*cos(argx)*cos(argy)
            yg2(i,j) = yy - distort*cos(argx)*cos(argy)
        enddo
    enddo

    call plinit

{'fraction_non_alphanumeric': 0.12215426435609922, 'fraction_numerical': 0.03771661569826707, 'mean_word_length': 2.5293764988009593, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6097036', 'n_tokens_mistral': 2456, 'n_tokens_neox': 2341, 'n_words': 617}