Вы находитесь на странице: 1из 2

www.appliedmathematics.

info

Demonstration of 2D Vector Geometry Operations using Fortran


This document1 is a user-guide for the the set of open source Fortran codes for carrying out two-dimensional vector operations. The file
of vector operations can be downloaded from the link GEOM2D.FOR and the set of test problems can be downloaded from the link
GEOM2D_T.FOR. The functions of vector geometry that are demonstrated by the spreadsheet are introduced in the document Vector
Geometry, using the similar examples. An Excel spreadsheet GEOM.xlsm illustrates the test of the same operations (including in VBA) on
the same test data.

Module
SUBROUTINE
VEC2(PA,PB,VEC)

Interface components
REAL*8 PA(2), PB(2),
VEC(2)

Service
Finds the 2-vector vec linking point PA to point
PB and stores the resultin VEC.

FUNCTION
DOT2(VECA,VECB)
FUNCTION SIZE2(VECA,)

REAL*8 VECA(2),
VECB(2), DOT2
REAL*8 VECA(2),
SIZE2
REAL*8 VECA(2),
SSIZE2
REAL*8 PA(2), PB(2),
DIST2
REAL*8 PA(2), PB(2),
VEC(2)

Returns the dot product of the two 2-vectors


VECA and VECB
Returns the modulus of the 2-vector VEC

FUNCTION SSIZE2(VECA,)
FUNCTION DIST2(PA,PB)
SUBROUTINE NORM2(PA,
PB, VEC)

Returns the square of the modulus of the 2vector VEC


Returns the distance between two points PA
and PB
Finds the unit normal to the line between points
PA and PB, pointing to the 'left' and stores the
resultin VEC.

Test(s)
1
1) PA= (2,4), PB= (3,9) VEC=( )
5
2
2) PA= (2,4), PB= (4,1) VEC=( )
3
1
2
VECA=( ), VECB=( )DOT2=-13
5
3
1
VEC=VECA=( )SIZE2=26
5
1
VEC=VECA=( )SIZE2=26
5
1) PA= (2,4), PB= (3,9) DIST=26
1) PA= (2,4), PB= (3,9) VEC=(

5/26
)
1/26

These codes are typically used in the boundary element method software www.boundary-element-method.com and a guide to Fortran 77
con be found here.
1

http://www.appliedmathematics.info/software/GEOM2D_FOR.htm

www.appliedmathematics.info

Вам также может понравиться