EquidistanceInPoint_Line
This function returns the equidistance points strictly inside an edge.
- All points are inside the interval
- Points are in increasing order
Interface
- ܀ Interface
- Interface 2
- ️܀ See example
- ↢
INTERFACE
MODULE PURE FUNCTION EquidistanceInPoint_Line(order, xij) RESULT(ans)
INTEGER(I4B), INTENT(IN) :: order
!! order
REAL(DFP), INTENT(IN) :: xij(2)
!! coordinates of point 1 and point 2
REAL(DFP), ALLOCATABLE :: ans(:)
END FUNCTION EquidistanceInPoint_Line
END INTERFACE
xij
xij(1)
is 1D coordinate of point 1.xij(2)
is 1D coordinate of point 2.
INTERFACE
MODULE PURE FUNCTION EquidistanceInPoint_Line(order, xij) RESULT(ans)
INTEGER(I4B), INTENT(IN) :: order
!! order
REAL(DFP), OPTIONAL, INTENT(IN) :: xij(:, :)
!! coordinates of point 1 and point 2 in $x_{iJ}$ format
!! number of rows = nsd
!! number of cols = 2
REAL(DFP), ALLOCATABLE :: ans(:, :)
!! returned coordinates in $x_{iJ}$ format
END FUNCTION EquidistanceInPoint_Line
END INTERFACE
xij
xij(:, 1)
are coordinates of point 1.xij(:, 2)
are coordinates of point 2.
ans
- If
xij
is present, then number of rows inans
is same as the number of rows inxij
, otherwise it is 1. - The rows in
ans
denote the spatial components. - The points are arranged in increasing order.
program main
use easifembase
implicit none
integer( i4b ) :: i1, i2, order
real( dfp ), allocatable :: x1( : ), x2( : ), x(:,:), ans(:,:)
integer(i4b), allocatable :: degree(:,:)
call reallocate(x, 1, 2)
x(1,:)=[-1,1]
x1 = EquidistanceInPoint_Line( order=1, xij=x(1,:) )
call display( x1, "x1 = ", orient="row" )
x1 = EquidistanceInPoint_Line( order=2, xij=x(1,:) )
call display( x1, "x1 = ", orient="row" )
x1 = EquidistanceInPoint_Line( order=3, xij=x(1,:) )
call display( x1, "x1 = ", orient="row" )
x1 = EquidistanceInPoint_Line( order=4, xij=x(1,:) )
call display( x1, "x1 = ", orient="row" )
See results
results
x1 =
-----
x1 =
-------
0.00000
x1 =
--------------------
-0.333333 0.333333
x1 =
-------------------------------
-0.500000 0.000000 0.500000
call reallocate(x, 3, 2)
x(:,1)=[0.2,0.2,0.0]
x(:,2)=[0.2,0.6,0.0]
ans = EquidistanceInPoint_Line( order=1, xij=x )
call display( ans, "ans = ")
ans = EquidistanceInPoint_Line( order=2, xij=x )
call display( ans, "ans = ")
See results
results
ans =
------
ans =
-------
0.20000
0.40000
0.00000
info
We can also call the routine without specifying the xij
. In this case the reference domain is from -1 to 1 in 1D. That is, the returned points are in 1D.
x = EquidistanceInPoint_Line( order=1 )
call display( x, "x = " )
x = EquidistanceInPoint_Line( order=2 )
call display( x, "x = " )
x = EquidistanceInPoint_Line( order=3 )
call display( x, "x = " )
See results
results
x =
----
x =
-------
0.00000
x =
--------------------
-0.333333 0.333333
end program main