1!$Id:$
2      logical function lclip( ix, nen, x, ndm )
3
4!      * * F E A P * * A Finite Element Analysis Program
5
6!....  Copyright (c) 1984-2017: Regents of the University of California
7!                               All rights reserved
8
9!-----[--.----+----.----+----.-----------------------------------------]
10!      Purpose: Clip plot at specified planes
11
12!      Inputs:
13!         ix(*)     - List of nodes on element
14!         nen       - Number of nodes on element
15!         x(ndm,*)  - Nodal coordinates of element
16!         ndm       - Spatial dimension of mesh
17
18!      Outputs:
19!         lclip     - Flag, true if element is within clip region
20!-----[--.----+----.----+----.-----------------------------------------]
21
22      implicit  none
23
24      include  'plclip.h'
25
26      integer   i, n, nen,ndm
27
28      integer   ix(nen)
29      real*8    x(ndm,*),x0(3)
30
31      save
32
33      do i = 1, ndm
34        x0(i) = 0.0d0
35        do n = 1,nen
36          if(ix(n).gt.0) x0(i) = x0(i) + x(i,ix(n))
37        end do
38        x0(i) = x0(i)/nen
39      end do
40      if(ndm.eq.1) then
41        lclip = (x0(1).ge.cmin(1)) .and. (x0(1).le.cmax(1))
42      elseif(ndm.eq.2) then
43        lclip = (x0(1).ge.cmin(1)) .and. (x0(1).le.cmax(1))
44     &                             .and.
45     &          (x0(2).ge.cmin(2)) .and. (x0(2).le.cmax(2))
46      elseif(ndm.eq.3) then
47        lclip = (x0(1).ge.cmin(1)) .and. (x0(1).le.cmax(1))
48     &                             .and.
49     &          (x0(2).ge.cmin(2)) .and. (x0(2).le.cmax(2))
50     &                             .and.
51     &          (x0(3).ge.cmin(3)) .and. (x0(3).le.cmax(3))
52      else
53        lclip = .false.
54      endif
55
56      end
57