Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

finite element method problem 1

Status
Not open for further replies.

yehia1984

Programmer
May 20, 2005
1
GB
i am a begginner in fortran and am trying to write a program that calulates the distance between two points, in order to identify duplicate co ordinates.

there are a list of co ordinate points and for each of these co ordinate points is a corresponding label, i.e. co-ordinat point 1 is node 1, co ordiante point 2 is node 2 etc (e.g. (0,0) is node 1, (0,3) is node 2, (0,6) is node 3 etc...)

Once the distance has been calculated the prgram then runs an IF statement with the criteria that if the distance is less that 10E-6 that it would flag this result, in an IFLAG vector of the nodal points.

does any on know how to do this? i would really appreciate it.

thanks

ps am willing to descirbe the problem in more detail if you need it.

 
To calculate the distance between two points, you have to use the formula: dist=SQRT((x(j)-x(i))**2+(y(j)-y(i))**2). Let me propose you a process that is much faster and would guarantee you don't have duplicate coordinates:

Do I=1,NumbOfCoord
IM1=I+1
Do J=IM1,NumbOfCoord
If(ABS(x(i)-x(j)).GT.0.10D-5)Cycle
If(ABS(y(i)-y(j)).GT.0.10D-5)Cycle
Write(*,1000)I,J
1000 Format("Points",I4," and",I4," have the",
*" same coordinates")
End Do
End Do

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top