Get
Get entries of field.
Calling example:
Interface 1
- ܀ See Interface
- ܀ Example 1
- ↢
INTERFACE
MODULE SUBROUTINE get1(obj, VALUE, globalNode, timeCompo)
CLASS(STScalarField_), INTENT(IN) :: obj
REAL(DFP), ALLOCATABLE, INTENT(INOUT) :: VALUE(:)
INTEGER(I4B), OPTIONAL, INTENT(IN) :: globalNode
INTEGER(I4B), OPTIONAL, INTENT(IN) :: timeCompo
END SUBROUTINE get1
END INTERFACE
note
Both globalNode
and timeCompo
cannot be present.
- If
globalNode
is present then temporal value are returned - If
timeCompo
is present then spatial values are returned
In this example we test Get method.
In this example we get all temporal values of a given space node.
program main
use easifemBase
use easifemClasses
implicit none
type( domain_ ) :: dom
type( STScalarFieldLis_ ) :: obj
TYPE( HDF5File_ ) :: meshfile
type( ParameterList_ ) :: param
integer( i4b ) :: ierr
INTEGER( I4B ), Parameter :: timeCompo=2
CHARACTER( LEN = * ), Parameter :: engine="LIS_OMP"
INTEGER( I4B ) ::tNodes
REAL( DFP ), ALLOCATABLE :: val2(:)
REAL( DFP ), ALLOCATABLE :: val1(:,:)
call meshfile%initiate( filename="./mesh.h5", mode="READ" )
call meshfile%open()
call dom%initiate( meshfile, "" )
call meshfile%Deallocate()
CALL FPL_INIT()
CALL param%initiate()
CALL SetSTScalarFieldParam( &
& param=param, &
& name="U", &
& fieldType=FIELD_TYPE_NORMAL, &
& engine=engine, &
& timeCompo=timeCompo)
call obj%initiate( param, dom )
tNodes = dom%getTotalNodes()
call reallocate(val1, timeCompo, tNodes)
call random_number(val1)
call obj%set(value=val1)
call obj%get(value=val2, globalNode=1)
call Display(val1(:,1:5), "val1 = " )
call Display(val2, "val2 node 1 = " )
call obj%get(value=val2, globalNode=5)
call Display(val2, "val2 node 5 = " )
call obj%Deallocate()
call dom%Deallocate()
call param%Deallocate()
call FPL_FINALIZE()
end program main
results
val1 =
------------------------------------------------
0.985725 0.712300 0.838596 0.656728 0.490376
0.674099 0.196048 0.327113 0.386112 0.450990
val2 node 1 =
--------------
0.985725
0.674099
val2 node 5 =
--------------
0.490376
0.450990
Interface 2
- ܀ See Interface
- Example 1
- ↢
INTERFACE
MODULE SUBROUTINE get2(obj, VALUE)
CLASS(STScalarField_), INTENT(IN) :: obj
REAL(DFP), ALLOCATABLE, INTENT(INOUT) :: VALUE(:, :)
END SUBROUTINE get2
END INTERFACE
Get all the values.
- Number of rows in value is equal to the
obj%timecompo
- Number of col in value is equal to the
obj%domain%tNodes
In this example we test Get method.
program main
use easifemBase
use easifemClasses
implicit none
type( domain_ ) :: dom
type( STScalarFieldLis_ ) :: obj
TYPE( HDF5File_ ) :: meshfile
type( ParameterList_ ) :: param
integer( i4b ) :: ierr
INTEGER( I4B ), Parameter :: timeCompo=2
CHARACTER( LEN = * ), Parameter :: engine="LIS_OMP"
INTEGER( I4B ) ::tNodes
REAL( DFP ), ALLOCATABLE :: val2(:, :)
REAL( DFP ), ALLOCATABLE :: val1(:,:)
call meshfile%initiate( filename="./mesh.h5", mode="READ" )
call meshfile%open()
call dom%initiate( meshfile, "" )
call meshfile%Deallocate()
CALL FPL_INIT()
CALL param%initiate()
CALL SetSTScalarFieldParam( &
& param=param, &
& name="U", &
& fieldType=FIELD_TYPE_NORMAL, &
& engine=engine, &
& timeCompo=timeCompo)
call obj%initiate( param, dom )
tNodes = dom%getTotalNodes()
call reallocate(val1, timeCompo, tNodes)
call random_number(val1)
call Display(val1(:, 1:5), "val1 = " )
call obj%set(value=val1)
call obj%get(value=val2)
call Display(val2(:, 1:5), "val2 = " )
call obj%Deallocate()
call dom%Deallocate()
call param%Deallocate()
call FPL_FINALIZE()
end program main
results
val1 =
------------------------------------------------
0.422617 0.429280 0.529915 0.503016 0.776664
0.408958 0.078687 0.172171 0.790472 0.069847
val2 =
------------------------------------------------
0.422617 0.429280 0.529915 0.503016 0.776664
0.408958 0.078687 0.172171 0.790472 0.069847
Interface 3
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE stsField_get3(obj, VALUE, globalNode)
CLASS(STScalarField_), INTENT(IN) :: obj
REAL(DFP), ALLOCATABLE, INTENT(INOUT) :: VALUE(:, :)
INTEGER(I4B), INTENT(IN) :: globalNode(:)
END SUBROUTINE stsField_get3
END INTERFACE
Get multiple values.
- Total number of rows in value is
obj%timeCompo
- Total number of columns in value are
obj%domain%tnodes
In this example we test Get method.
program main
use easifemBase
use easifemClasses
implicit none
type( domain_ ) :: dom
type( STScalarFieldLis_ ) :: obj
TYPE( HDF5File_ ) :: meshfile
type( ParameterList_ ) :: param
integer( i4b ) :: ierr
INTEGER( I4B ), Parameter :: timeCompo=2
CHARACTER( LEN = * ), Parameter :: engine="LIS_OMP"
INTEGER( I4B ) ::tNodes
REAL( DFP ), ALLOCATABLE :: val2(:, :)
REAL( DFP ), ALLOCATABLE :: val1(:,:)
call meshfile%initiate( filename="./mesh.h5", mode="READ" )
call meshfile%open()
call dom%initiate( meshfile, "" )
call meshfile%Deallocate()
CALL FPL_INIT()
CALL param%initiate()
CALL SetSTScalarFieldParam( &
& param=param, &
& name="U", &
& fieldType=FIELD_TYPE_NORMAL, &
& engine=engine, &
& timeCompo=timeCompo)
call obj%initiate( param, dom )
tNodes = dom%getTotalNodes()
call reallocate(val1, timeCompo, tNodes)
call random_number(val1)
call Display(val1(:, 1:5), "val1 = " )
call obj%set(value=val1)
call obj%get(value=val2, globalNode=arange(1,5) )
call Display(val2(:, 1:5), "val2 = " )
call obj%Deallocate()
call dom%Deallocate()
call param%Deallocate()
call FPL_FINALIZE()
end program main
results
val1 =
------------------------------------------------
0.450271 0.195486 0.123940 0.445466 0.178457
0.779424 0.951806 0.209786 0.867207 0.345955
val2 =
------------------------------------------------
0.450271 0.195486 0.123940 0.445466 0.178457
0.779424 0.951806 0.209786 0.867207 0.345955
Interface 4
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE stsField_get4(obj, VALUE, globalNode, timeCompo)
CLASS(STScalarField_), INTENT(IN) :: obj
REAL(DFP), ALLOCATABLE, INTENT(INOUT) :: VALUE(:)
INTEGER(I4B), INTENT(IN) :: globalNode(:)
INTEGER(I4B), INTENT(IN) :: timeCompo
END SUBROUTINE stsField_get4
END INTERFACE
Get multiple values of timeCompo.
- size of value is equal to the size of globalNode
In this example we test Get method.
program main
use easifemBase
use easifemClasses
implicit none
type( domain_ ) :: dom
type( STScalarFieldLis_ ) :: obj
TYPE( HDF5File_ ) :: meshfile
type( ParameterList_ ) :: param
integer( i4b ) :: ierr
INTEGER( I4B ), Parameter :: timeCompo=2
CHARACTER( LEN = * ), Parameter :: engine="LIS_OMP"
INTEGER( I4B ) ::tNodes
REAL( DFP ), ALLOCATABLE :: val2(:)
REAL( DFP ), ALLOCATABLE :: val1(:,:)
call meshfile%initiate( filename="./mesh.h5", mode="READ" )
call meshfile%open()
call dom%initiate( meshfile, "" )
call meshfile%Deallocate()
CALL FPL_INIT()
CALL param%initiate()
CALL SetSTScalarFieldParam( &
& param=param, &
& name="U", &
& fieldType=FIELD_TYPE_NORMAL, &
& engine=engine, &
& timeCompo=timeCompo)
call obj%initiate( param, dom )
tNodes = dom%getTotalNodes()
call reallocate(val1, timeCompo, tNodes)
call random_number(val1)
call Display(val1(:, 1:5), "val1 = " )
call obj%set(value=val1)
call obj%get(value=val2, globalNode=arange(1,5), timeCompo=1 )
call Display(val2(1:5), "val2 = " )
call obj%get(value=val2, globalNode=arange(1,5), timeCompo=2 )
call Display(val2(1:5), "val2 = " )
call obj%Deallocate()
call dom%Deallocate()
call param%Deallocate()
call FPL_FINALIZE()
end program main
results
val1 =
------------------------------------------------
0.767915 0.962912 0.574328 0.331982 0.284842
0.891933 0.684328 0.359778 0.220547 0.346818
val2 =
--------
0.767915
0.962912
0.574328
0.331982
0.284842
val2 =
--------
0.891933
0.684328
0.359778
0.220547
0.346818
Interface 5
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE stsField_get5(obj, VALUE, globalNode, timeCompo)
CLASS(STScalarField_), INTENT(IN) :: obj
REAL(DFP), INTENT(INOUT) :: VALUE
INTEGER(I4B), INTENT(IN) :: globalNode
INTEGER(I4B), INTENT(IN) :: timeCompo
END SUBROUTINE stsField_get5
END INTERFACE
Get the single value of timeCompo.
In this example we test Get method.
program main
use easifemBase
use easifemClasses
implicit none
type( domain_ ) :: dom
type( STScalarFieldLis_ ) :: obj
TYPE( HDF5File_ ) :: meshfile
type( ParameterList_ ) :: param
integer( i4b ) :: ierr
INTEGER( I4B ), Parameter :: timeCompo=2
CHARACTER( LEN = * ), Parameter :: engine="LIS_OMP"
INTEGER( I4B ) ::tNodes
REAL( DFP ) :: val2
REAL( DFP ), ALLOCATABLE :: val1(:,:)
call meshfile%initiate( filename="./mesh.h5", mode="READ" )
call meshfile%open()
call dom%initiate( meshfile, "" )
call meshfile%Deallocate()
CALL FPL_INIT()
CALL param%initiate()
CALL SetSTScalarFieldParam( &
& param=param, &
& name="U", &
& fieldType=FIELD_TYPE_NORMAL, &
& engine=engine, &
& timeCompo=timeCompo)
call obj%initiate( param, dom )
tNodes = dom%getTotalNodes()
call reallocate(val1, timeCompo, tNodes)
call random_number(val1)
call Display(val1(:, 1:5), "val1 = " )
call obj%set(value=val1)
call obj%get(value=val2, globalNode=1, timeCompo=1 )
call Display(val2, "val2 = " )
call obj%get(value=val2, globalNode=2, timeCompo=1 )
call Display(val2, "val2 = " )
call obj%get(value=val2, globalNode=1, timeCompo=2 )
call Display(val2, "val2 = " )
call obj%get(value=val2, globalNode=2, timeCompo=2 )
call Display(val2, "val2 = " )
call obj%Deallocate()
call dom%Deallocate()
call param%Deallocate()
call FPL_FINALIZE()
end program main
results
val1 =
------------------------------------------------
0.603828 0.756928 0.863545 0.512535 0.914640
0.214214 0.073219 0.731039 0.124185 0.871294
val2 = 0.603828
val2 = 0.756928
val2 = 0.214214
val2 = 7.32189E-2
Interface 6
INTERFACE
MODULE SUBROUTINE stsField_get6(obj, VALUE, istart, iend, stride)
CLASS(STScalarField_), INTENT(IN) :: obj
REAL(DFP), ALLOCATABLE, INTENT(INOUT) :: VALUE(:, :)
INTEGER(I4B), INTENT(IN) :: istart
INTEGER(I4B), INTENT(IN) :: iend
INTEGER(I4B), INTENT(IN) :: stride
END SUBROUTINE stsField_get6
END INTERFACE
Get multiple values using triplets.
Interface 7
INTERFACE
MODULE SUBROUTINE stsField_get7(obj, VALUE, istart, iend, stride, timeCompo)
CLASS(STScalarField_), INTENT(IN) :: obj
REAL(DFP), ALLOCATABLE, INTENT(INOUT) :: VALUE(:)
INTEGER(I4B), INTENT(IN) :: istart
INTEGER(I4B), INTENT(IN) :: iend
INTEGER(I4B), INTENT(IN) :: stride
INTEGER(I4B), INTENT(IN) :: timeCompo
END SUBROUTINE stsField_get7
END INTERFACE
Get multiple values using triplets
Interface 8
INTERFACE
MODULE SUBROUTINE stsField_get8(obj, VALUE, globalNode)
CLASS(STScalarField_), INTENT(IN) :: obj
TYPE(FEVariable_), INTENT(INOUT) :: VALUE
!! Nodal, Vector, SpaceTime
INTEGER(I4B), INTENT(IN) :: globalNode(:)
END SUBROUTINE stsField_get8
END INTERFACE
Get multiple values in FEVariable.
Interface 9
INTERFACE
MODULE SUBROUTINE stsField_get9(obj, VALUE, timeCompo)
CLASS(STScalarField_), INTENT(IN) :: obj
CLASS(ScalarField_), INTENT(INOUT) :: VALUE
INTEGER(I4B), INTENT(IN) :: timeCompo
END SUBROUTINE stsField_get9
END INTERFACE
Get STScalarField_
in an instance of ScalarField_
.