Re: iso curve extraction
- From: veda <kedar.hardikar@xxxxxxxxx>
- Date: Mon, 23 Jul 2007 08:19:08 -0000
On Jul 23, 4:50 am, fj <francois.j...@xxxxxxx> wrote:
Francois,
First, I am sorry for giving credit to another person on the board
mistakenly. Your help is making me feel optimistic about what I am
trying to do.
Thanks for the description. For orientation, I am looking at local
unit normal pointing from f<0 (inside) to f>0 (outside) for each
segment of the iso curve. This part is somewhat tricky. If my
orientation calculation fails, all of my subsequent calculation will
suffer.
The degenerate case where two curves pass thru one element makes life
difficult. I believe however, that this problem should be overcome by
trying a finer mesh. Is't this corret? (thats why you are computing
Yes it's correct : a fine meshing usually avoids that situation
value at the center right?). The three points in the element cas - One
at the corner and two others is basically same as 4-points and two
segments right?
Right
One possibility is that after I generate a list of segments using your
subroutine, I somehow "clean the list" to have unique set of points
that are connected correctly. I have not idea, however, how to do it.
for example, there could be "disconnected" curves - In my case the
number of disconnected regions is not likely to be more than 2-3.
If anyone has any suggestions about handling orientations and
disconneced curves, please let me know.
You can do the job easily in several successive steps
- building up all segments in calling TITQ4N on all the meshes. The
result could be :
. a number of segments NSEG
. a number of nodes NN equal to 2*NSEG (two nodes by segment)
. the coordinates of the nodes (array XY(2,NN))
- two other integer arrays are necessary to manage segments :
. ISEG(2,NSEG) : the two node indexes defining each segment
. IUSE(NSEG) indicating whether of not each segment has been used to
build up a curve
IUSE must be initialized to 0
- eliminating double nodes
- building up curves
To realize the two last steps, you could use routines similar to the
following ones :
SUBROUTINE eliminate_double(nn,xy,nseg,iseg)
! after building up all isocurve segments, one normally gets :
! - a number of nodes nn equals to 2*nseg
! - the coordinates of the nodes
! To compute the connection between segments, one starts by the
elimination
! of double nodes
INTEGER,INTENT(in) :: nn ! number of nodes (= 2*nseg)
REAL ,INTENT(in) :: xy(2,nn) ! coordinates
INTEGER,INTENT(in) :: nseg ! number of segments built up
by calling TITQ4N
INTEGER,INTENT(out) :: iseg(2,nseg) ! the indexes of the nodes
composing each segment
INTEGER :: i,j,k
REAL :: epsilon=1.e-5
DO i=1,nseg
iseg(1,i)=2*i-1
iseg(2,i)=2*i
ENDDO
DO i=nn,1,-1
DO j=1,i-1
IF((xy(1,i)-xy(1,j))**2+(xy(2,i)-xy(2,j))**2 < epsilon) THEN ! i
and j are identical nodes
DO k=1,nseg ! replacing the node i by the node j
IF(iseg(1,k) == i) iseg(1,k)=j
IF(iseg(2,k) == i) iseg(2,k)=j
ENDDO
EXIT
ENDIF
ENDDO
ENDDO
END SUBROUTINE
SUBROUTINE extract_curve(nseg,iseg,iuse,nc,ic)
INTEGER,INTENT(in) :: nseg ! number of segments
INTEGER,INTENT(in) :: iseg(2,nseg) ! node indexes defining each
segment
INTEGER,INTENT(inout) :: iuse(nseg) ! use index (must be
initialized to 0 by the caller routine)
INTEGER,INTENT(out) :: nc ! number of nodes composing
the iso curve
INTEGER,INTENT(out) :: ic(*) ! node indexes (maximum
size : nseg+1)
INTEGER :: k,j
nc=0
DO k=1,nseg
IF(iuse(k) == 1) CYCLE
nc=2
ic(1)=iseg(1,k)
ic(2)=iseg(2,k)
iuse(k)=1 ! the segment k is declared "used"
DO j=k+1,nseg
IF(iuse(j) == 1) CYCLE
IF(iseg(1,j) == ic(1)) THEN
! the segment j is connected to the beginning of the curve by
its first node
nc=nc+1
ic(2:nc)=ic(1:nc-1) ! shift to allow the insertion
of a value
ic(1)=iseg(2,j)
iuse(j)=1
ELSE IF(iseg(2,j) == ic(1)) THEN
! the segment j is connected to the beginning of the curve by
its second node
nc=nc+1
ic(2:nc)=ic(1:nc-1) ! shift to allow the insertion
of a value
ic(1)=iseg(1,j)
iuse(j)=1
ELSE IF(iseg(1,j) == ic(nc)) THEN
! the segment j is connected to the end of the curve by its
first node
nc=nc+1
ic(nc)=iseg(2,j)
iuse(j)=1
ELSE IF(iseg(2,j) == ic(nc)) THEN
! the segment j is connected to the end of the curve by its
second node
nc=nc+1
ic(nc)=iseg(1,j)
iuse(j)=1
ENDIF
ENDDO
EXIT
ENDDO
END SUBROUTINE
Take care : this is a non tested example of programming !
The routine extract_curve must be called in a loop. One exits the loop
only if NC=0 which means that all segments have been used.
Each call to curve_extract builds up an iso curve. This iso curve is
closed if the first and last node indexes are equal.
Nodes are listed successively but the algorithm does not determine the
orientation (rotation in the direct or reverse sens depending on the
definition of the first selected segment).
Francois,
As I start working thru the code, I seem to have some inconsistent
results with the subroutine you have. I am still in the process of de-
bugging, however, by changing the way "zero-point" gets assigned in
array, A, I can get some consistent results.
One last question, and I will take this indipendently to debug-
the "node numbering" you have used is
4----3
| |
1----2
Right? I somehow need to change how entries in A are assigned
(something to do with sign of "coef" etc. Just wanted to let you
know.
Anyway, if you have something to say on this let me know. Otherwise it
has been great help...won't ask for any de-bugging further.
Thanks.
Veda.
.
- Follow-Ups:
- Re: iso curve extraction
- From: fj
- Re: iso curve extraction
- References:
- iso curve extraction
- From: veda
- Re: iso curve extraction
- From: glen herrmannsfeldt
- Re: iso curve extraction
- From: fj
- Re: iso curve extraction
- From: veda
- Re: iso curve extraction
- From: fj
- Re: iso curve extraction
- From: veda
- Re: iso curve extraction
- From: fj
- iso curve extraction
- Prev by Date: Re: Need some HELP!! In a pre-version fortran codes
- Next by Date: Re: iso curve extraction
- Previous by thread: Re: iso curve extraction
- Next by thread: Re: iso curve extraction
- Index(es):
Loading