Get
Get the entries from scalar field.
Calling examples:
Getting single entryCALL Get(
CLASS(ScalarFieldLis_):: obj
REAL(DFP):: VALUE
INTEGER(I4B):: globalNode
)
CALL Get(
CLASS(ScalarFieldLis_):: obj
REAL(DFP):: VALUE(:)
)
CALL Get(
CLASS(ScalarFieldLis_):: obj
REAL(DFP):: VALUE(:)
INTEGER(I4B):: globalNode(:)
)
CALL Get(
CLASS(ScalarFieldLis_):: obj
REAL(DFP):: VALUE(:)
INTEGER(I4B):: istart
INTEGER(I4B):: iend
INTEGER(I4B):: stride
)
CALL Get(
CLASS(ScalarFieldLis_):: obj
TYPE(FEVariable_):: VALUE
INTEGER(I4B):: globalNode(:)
)
CALL Get(
CLASS(ScalarFieldLis_):: obj
CLASS(ScalarField_):: VALUE
)
Interface 1
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE get1(obj, VALUE, globalNode)
CLASS(ScalarFieldLis_), INTENT(IN) :: obj
REAL(DFP), INTENT(INOUT) :: VALUE
INTEGER(I4B), INTENT(IN) :: globalNode
END SUBROUTINE get1
END INTERFACE
Get a single entry.
In this example we test Get method.
Get single entry.
PROGRAM main
USE easifemBase
USE easifemClasses
TYPE( Domain_ ) :: dom
TYPE( ScalarFieldLis_ ) :: obj
TYPE( HDF5File_ ) :: meshfile, resultFile
TYPE( ParameterList_ ) :: param
INTEGER( I4B ) :: ierr
REAL( DFP ), ALLOCATABLE :: realVec( : )
REAL( DFP ) :: avar
CHARACTER( LEN = * ), PARAMETER :: engine = "LIS_OMP"
CALL FPL_INIT()
CALL param%initiate()
CALL resultFile%initiate( filename="./result.h5", mode="READ" )
CALL resultFile%open()
!> start creating domain
CALL meshfile%initiate( filename="./mesh.h5", mode="READ" )
CALL meshfile%open()
CALL dom%initiate( hdf5=meshfile, group="" )
!> end creating domain
CALL SetScalarFieldParam( param=param, &
& fieldType=FIELD_TYPE_NORMAL, &
& name="U", &
& engine=engine)
CALL obj%initiate( param, dom )
CALL reallocate( realVec, dom%getTotalNodes() )
CALL RANDOM_NUMBER( realVec )
CALL obj%set(realVec)
CALL obj%display( "scalar field = ")
0.525588,
0.106782,
0.665122,
0.108642,
0.482753,
0.356140,
0.737333,
0.739410,
0.286026,
CALL obj%get( value=avar, globalNode=2)
CALL Display(avar, "avar = ")
avar = 0.106782
CALL obj%Deallocate(); CALL dom%Deallocate()
CALL meshfile%Deallocate()
CALL resultFile%Deallocate()
CALL param%Deallocate(); CALL FPL_FINALIZE()
IF(allocated(realVec) ) deallocate(realVec)
END PROGRAM main
Interface 2
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE get2(obj, VALUE)
CLASS(ScalarFieldLis_), INTENT(IN) :: obj
REAL(DFP), ALLOCATABLE, INTENT(INOUT) :: VALUE(:)
END SUBROUTINE get2
END INTERFACE
Get all entries in a vector of reals.
In this example we test Get method.
Get all entries in a vector of reals.
PROGRAM main
USE easifemBase
USE easifemClasses
TYPE( Domain_ ) :: dom
TYPE( ScalarFieldLis_ ) :: obj
TYPE( HDF5File_ ) :: meshfile, resultFile
TYPE( ParameterList_ ) :: param
INTEGER( I4B ) :: ierr
REAL( DFP ), ALLOCATABLE :: realVec( : )
REAL( DFP ) :: avar
CHARACTER( LEN = * ), PARAMETER :: engine = "LIS_OMP"
CALL FPL_INIT()
CALL param%initiate()
CALL resultFile%initiate( filename="./result.h5", mode="READ" )
CALL resultFile%open()
!> start creating domain
CALL meshfile%initiate( filename="./mesh.h5", mode="READ" )
CALL meshfile%open()
CALL dom%initiate( hdf5=meshfile, group="" )
!> end creating domain
CALL SetScalarFieldParam( param=param, &
& fieldType=FIELD_TYPE_NORMAL, &
& name="U", &
& engine=engine)
CALL obj%initiate( param, dom )
CALL reallocate( realVec, dom%getTotalNodes() )
CALL RANDOM_NUMBER( realVec )
CALL obj%set(realVec)
CALL obj%display( "scalar field = ")
0.132029,
0.489434,
0.690163,
0.424993,
0.313813,
0.833015,
0.369671,
0.252695,
0.327842,
0.649937,
CALL obj%get( value=realVec)
CALL Display(realVec(1:5), "realVec(1:5) = ")
0.132029
0.489434
0.690163
0.424993
0.313813
CALL obj%Deallocate(); CALL dom%Deallocate()
CALL meshfile%Deallocate()
CALL resultFile%Deallocate()
CALL param%Deallocate(); CALL FPL_FINALIZE()
if(allocated(realVec) ) deallocate(realVec)
END PROGRAM main
Interface 3
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE get3(obj, VALUE, globalNode)
CLASS(ScalarFieldLis_), INTENT(IN) :: obj
REAL(DFP), ALLOCATABLE, INTENT(INOUT) :: VALUE(:)
INTEGER(I4B), INTENT(IN) :: globalNode(:)
END SUBROUTINE get3
END INTERFACE
Get multiple entries.
In this example we test Get method.
Get multiple entries.
PROGRAM main
USE easifemBase
USE easifemClasses
TYPE( Domain_ ) :: dom
TYPE( ScalarFieldLis_ ) :: obj
TYPE( HDF5File_ ) :: meshfile, resultFile
TYPE( ParameterList_ ) :: param
INTEGER( I4B ) :: ierr
REAL( DFP ), ALLOCATABLE :: realVec( : )
REAL( DFP ) :: avar
CHARACTER( LEN = * ), PARAMETER :: engine = "LIS_OMP"
CALL FPL_INIT()
CALL param%initiate()
CALL resultFile%initiate( filename="./result.h5", mode="READ" )
CALL resultFile%open()
!> start creating domain
CALL meshfile%initiate( filename="./mesh.h5", mode="READ" )
CALL meshfile%open()
CALL dom%initiate( hdf5=meshfile, group="" )
!> end creating domain
CALL SetScalarFieldParam( param=param, &
& fieldType=FIELD_TYPE_NORMAL, &
& name="U", &
& engine=engine)
CALL obj%initiate( param, dom )
CALL reallocate( realVec, dom%getTotalNodes() )
CALL RANDOM_NUMBER( realVec )
CALL obj%set(realVec)
CALL obj%display( "scalar field = ")
0.335789,
0.222078,
0.384477,
0.360936,
0.522693,
0.260172,
0.219712,
0.416958,
0.313375,
0.566592,
0.783093,
0.844735,
CALL obj%get( value=realVec, globalNode=[1,2,3,4,5])
CALL Display(realVec(1:5), "realVec(1:5) = ")
realVec(1:5) =
---------------
0.335789
0.222078
0.384477
0.360936
0.522693
CALL obj%Deallocate(); CALL dom%Deallocate()
CALL meshfile%Deallocate()
CALL resultFile%Deallocate()
CALL param%Deallocate(); CALL FPL_FINALIZE()
if(allocated(realVec) ) deallocate(realVec)
END PROGRAM main
Interface 4
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE get4(obj, VALUE, istart, iend, stride)
CLASS(ScalarFieldLis_), 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 get4
END INTERFACE
Get multiple entries by using triplets.
In this example we test Get method.
Get multiple values using triplets.
PROGRAM main
USE easifemBase
USE easifemClasses
TYPE( Domain_ ) :: dom
TYPE( ScalarFieldLis_ ) :: obj
TYPE( HDF5File_ ) :: meshfile, resultFile
TYPE( ParameterList_ ) :: param
INTEGER( I4B ) :: ierr
REAL( DFP ), ALLOCATABLE :: realVec( : )
REAL( DFP ) :: avar
CHARACTER( LEN = * ), PARAMETER :: engine = "LIS_OMP"
CALL FPL_INIT()
CALL param%initiate()
CALL resultFile%initiate( filename="./result.h5", mode="READ" )
CALL resultFile%open()
!> start creating domain
CALL meshfile%initiate( filename="./mesh.h5", mode="READ" )
CALL meshfile%open()
CALL dom%initiate( hdf5=meshfile, group="" )
!> end creating domain
CALL SetScalarFieldParam( param=param, &
& fieldType=FIELD_TYPE_NORMAL, &
& name="U", &
& engine=engine)
CALL obj%initiate( param, dom )
CALL reallocate( realVec, dom%getTotalNodes() )
CALL RANDOM_NUMBER( realVec )
CALL obj%set(realVec)
CALL obj%display( "scalar field = ")
0.622789,
0.905349,
0.707204,
0.759759,
0.867313,
0.557912,
0.618558,
0.111490,
0.447643,
0.582593,
CALL obj%get( value=realVec, istart=1, iend=5, stride=1)
CALL Display(realVec(1:5), "realVec(1:5) = ")
realVec(1:5) =
---------------
0.622789
0.905349
0.707204
0.759759
0.867313
CALL obj%Deallocate(); CALL dom%Deallocate()
CALL meshfile%Deallocate()
CALL resultFile%Deallocate()
CALL param%Deallocate(); CALL FPL_FINALIZE()
if(allocated(realVec) ) deallocate(realVec)
END PROGRAM main
Interface 5
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE get5(obj, VALUE, globalNode)
CLASS(ScalarFieldLis_), INTENT(IN) :: obj
TYPE(FEVariable_), INTENT(INOUT) :: VALUE
!! Scalar Nodal FEVariable
INTEGER(I4B), INTENT(IN) :: globalNode(:)
END SUBROUTINE get5
END INTERFACE
Get multiple entries in FEVariable
In this example we test Get method.
Get multiple entries in FEVariable.
PROGRAM main
USE easifemBase
USE easifemClasses
TYPE( Domain_ ) :: dom
TYPE( ScalarFieldLis_ ) :: obj
TYPE( HDF5File_ ) :: meshfile, resultFile
TYPE( ParameterList_ ) :: param
INTEGER( I4B ) :: ierr
REAL( DFP ), ALLOCATABLE :: realVec( : )
REAL( DFP ) :: avar
CHARACTER( LEN = * ), PARAMETER :: engine = "LIS_OMP"
TYPE(FEVariable_) :: fevar
CALL FPL_INIT()
CALL param%initiate()
CALL resultFile%initiate( filename="./result.h5", mode="READ" )
CALL resultFile%open()
!> start creating domain
CALL meshfile%initiate( filename="./mesh.h5", mode="READ" )
CALL meshfile%open()
CALL dom%initiate( hdf5=meshfile, group="" )
!> end creating domain
CALL SetScalarFieldParam( param=param, &
& fieldType=FIELD_TYPE_NORMAL, &
& name="U", &
& engine=engine)
CALL obj%initiate( param, dom )
CALL reallocate( realVec, dom%getTotalNodes() )
CALL RANDOM_NUMBER( realVec )
CALL obj%set(realVec)
CALL obj%display( "scalar field = ")
0.476675,
0.721996,
0.808386,
0.022536,
0.843059,
0.107551,
0.443036,
0.104665,
0.759430,
0.853888,
CALL obj%get( value=fevar, globalNode=arange(1,5,1) )
CALL Display(fevar, "fevar = ")
fevar =
# RANK :: 0 (SCALAR)
# VarType: SPACE
# VALUE:
---------
0.476675
0.721996
0.808386
0.022536
0.843059
CALL obj%Deallocate(); CALL dom%Deallocate()
CALL meshfile%Deallocate()
CALL resultFile%Deallocate()
CALL param%Deallocate(); CALL FPL_FINALIZE()
if(allocated(realVec) ) deallocate(realVec)
END PROGRAM main
Interface 6
- ܀ Interface
- ️܀ Example 1
- ️܀ Example 2
- ↢
INTERFACE
MODULE SUBROUTINE get6(obj, VALUE)
CLASS(ScalarFieldLis_), INTENT(IN) :: obj
CLASS(ScalarField_), INTENT(INOUT) :: VALUE
END SUBROUTINE get6
END INTERFACE
Get a scalarfield in an instance of scalar field.
In this example we test Get method.
Get all entry in obj2, where obj2 is an instance of ScalarFieldLis_
obj2 = obj
Both obj
and obj2
are instances of ScalarFieldLis_
PROGRAM main
USE easifemBase
USE easifemClasses
TYPE( Domain_ ) :: dom
TYPE( ScalarFieldLis_ ) :: obj
TYPE( ScalarFieldLis_ ) :: obj2
TYPE( HDF5File_ ) :: meshfile, resultFile
TYPE( ParameterList_ ) :: param
INTEGER( I4B ) :: ierr
REAL( DFP ), ALLOCATABLE :: realVec( : )
REAL( DFP ) :: avar
CHARACTER( LEN = * ), PARAMETER :: engine = "LIS_OMP"
TYPE(FEVariable_) :: fevar
CALL FPL_INIT()
CALL param%initiate()
CALL resultFile%initiate( filename="./result.h5", mode="READ" )
CALL resultFile%open()
!> start creating domain
CALL meshfile%initiate( filename="./mesh.h5", mode="READ" )
CALL meshfile%open()
CALL dom%initiate( hdf5=meshfile, group="" )
!> end creating domain
CALL SetScalarFieldParam( param=param, &
& fieldType=FIELD_TYPE_NORMAL, &
& name="U", &
& engine=engine)
CALL obj%initiate( param, dom )
CALL SetScalarFieldParam( param=param, &
& fieldType=FIELD_TYPE_NORMAL, &
& name="U2", &
& engine=engine)
CALL obj2%initiate( param, dom )
CALL reallocate( realVec, dom%getTotalNodes() )
CALL RANDOM_NUMBER( realVec )
CALL obj%set(realVec)
CALL obj%display( "scalar field = ")
#scalar field =
# isInitiated : TRUE
# name :U
# fieldType : NORMAL
# engine :LIS_OMP
# comm: 0
# myRank: 0
# numProcs: 1
# global_n: 102
# local_n: 102
# is: 1
# ie: 103
# lis_ptr: 94642949263200
# domain : ASSOCIATED
# domains : NOT ALLOCATED
# tSize : 102
# # DOF data :
# Total Physical Variables :1
# Name : U
# Space Components : 1
# Time Components : 1
# Total Nodes : 102
# Storage Format : Nodes
# Value Map :
--------------
1
103
# VAR :U
DOF-1 ,
--------,
0.677787,
0.648929,
0.876577,
0.929737,
0.746531,
0.655029,
0.956440,
0.892157,
0.563374,
0.149392,
0.217981,
0.207189,
0.355624,
0.396910,
0.559421,
0.589930,
0.713219,
0.625906,
0.838845,
0.960102,
CALL obj%get( value=obj2 )
CALL obj2%Display("obj2")
#obj2
# isInitiated : TRUE
# name :U2
# fieldType : NORMAL
# engine :LIS_OMP
# comm: 0
# myRank: 0
# numProcs: 1
# global_n: 102
# local_n: 102
# is: 1
# ie: 103
# lis_ptr: 94642948865744
# domain : ASSOCIATED
# domains : NOT ALLOCATED
# tSize : 102
# # DOF data :
# Total Physical Variables :1
# Name : U
# Space Components : 1
# Time Components : 1
# Total Nodes : 102
# Storage Format : Nodes
# Value Map :
--------------
1
103
# VAR :U
DOF-1 ,
--------,
0.677787,
0.648929,
0.876577,
0.929737,
0.746531,
0.655029,
0.956440,
0.892157,
0.563374,
0.149392,
0.217981,
0.207189,
0.355624,
0.396910,
0.559421,
0.589930,
0.713219,
0.625906,
0.838845,
0.960102,
CALL obj%Deallocate(); CALL dom%Deallocate()
CALL meshfile%Deallocate()
CALL resultFile%Deallocate()
CALL param%Deallocate(); CALL FPL_FINALIZE()
if(allocated(realVec) ) deallocate(realVec)
END PROGRAM main
In this example we test Get method.
Get all entry in obj2, where obj2 is an instance of ScalarField_
obj2 = obj
Both obj
and obj2
are instances of ScalarFieldLis_
and ScalarField_
, respectively.
PROGRAM main
USE easifemBase
USE easifemClasses
TYPE( Domain_ ) :: dom
TYPE( ScalarFieldLis_ ) :: obj
TYPE( ScalarField_ ) :: obj2
TYPE( HDF5File_ ) :: meshfile, resultFile
TYPE( ParameterList_ ) :: param
INTEGER( I4B ) :: ierr
REAL( DFP ), ALLOCATABLE :: realVec( : )
REAL( DFP ) :: avar
CHARACTER( LEN = * ), PARAMETER :: engine = "LIS_OMP"
TYPE(FEVariable_) :: fevar
CALL FPL_INIT()
CALL param%initiate()
CALL resultFile%initiate( filename="./result.h5", mode="READ" )
CALL resultFile%open()
!> start creating domain
CALL meshfile%initiate( filename="./mesh.h5", mode="READ" )
CALL meshfile%open()
CALL dom%initiate( hdf5=meshfile, group="" )
!> end creating domain
CALL SetScalarFieldParam( param=param, &
& fieldType=FIELD_TYPE_NORMAL, &
& name="U", &
& engine=engine)
CALL obj%initiate( param, dom )
CALL SetScalarFieldParam( param=param, &
& fieldType=FIELD_TYPE_NORMAL, &
& name="U2", &
& engine="NATIVE_SERIAL")
CALL obj2%initiate( param, dom )
CALL reallocate( realVec, dom%getTotalNodes() )
CALL RANDOM_NUMBER( realVec )
CALL obj%set(realVec)
CALL obj%display( "scalar field = ")
#scalar field =
# isInitiated : TRUE
# name :U
# fieldType : NORMAL
# engine :LIS_OMP
# comm: 0
# myRank: 0
# numProcs: 1
# global_n: 102
# local_n: 102
# is: 1
# ie: 103
# lis_ptr: 94778893242208
# domain : ASSOCIATED
# domains : NOT ALLOCATED
# tSize : 102
# # DOF data :
# Total Physical Variables :1
# Name : U
# Space Components : 1
# Time Components : 1
# Total Nodes : 102
# Storage Format : Nodes
# Value Map :
--------------
1
103
# VAR :U
DOF-1 ,
--------,
0.976837,
0.483390,
0.581184,
0.147984,
0.724879,
0.299203,
0.940301,
0.663552,
0.240904,
0.941748,
0.447914,
0.202338,
0.454285,
0.881168,
0.323755,
0.373271,
0.530906,
0.802271,
0.433111,
0.472424,
0.749044,
CALL obj%get( value=obj2 )
CALL obj2%Display("obj2")
#obj2
# isInitiated : TRUE
# name :U2
# fieldType : NORMAL
# engine :NATIVE_SERIAL
# comm: 0
# myRank: 0
# numProcs: 1
# global_n: 102
# local_n: 102
# is: 0
# ie: 0
# lis_ptr: 0
# domain : ASSOCIATED
# domains : NOT ALLOCATED
# tSize : 102
# # DOF data :
# Total Physical Variables :1
# Name : U
# Space Components : 1
# Time Components : 1
# Total Nodes : 102
# Storage Format : Nodes
# Value Map :
--------------
1
103
# VAR :U
DOF-1 ,
--------,
0.976837,
0.483390,
0.581184,
0.147984,
0.724879,
0.299203,
0.940301,
0.663552,
0.240904,
0.941748,
0.447914,
0.202338,
0.454285,
0.881168,
0.323755,
0.373271,
0.530906,
0.802271,
0.433111,
0.472424,
0.749044,
CALL obj%Deallocate(); CALL dom%Deallocate()
CALL meshfile%Deallocate()
CALL resultFile%Deallocate()
CALL param%Deallocate(); CALL FPL_FINALIZE()
if(allocated(realVec) ) deallocate(realVec)
END PROGRAM main