Get
Get the entries from scalar field.
Calling examples:
Interface 1
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE get1(obj, VALUE, globalNode)
CLASS(ScalarField_), 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.
PROGRAM main
USE easifemBase
USE easifemClasses
TYPE( Domain_ ) :: dom
TYPE( ScalarField_ ) :: obj
TYPE( HDF5File_ ) :: meshfile, resultFile
TYPE( ParameterList_ ) :: param
INTEGER( I4B ) :: ierr
REAL( DFP ), ALLOCATABLE :: realVec( : )
REAL( DFP ) :: avar
CHARACTER( LEN = * ), PARAMETER :: engine = "NATIVE_SERIAL"
Open file for import
CALL FPL_INIT()
CALL param%initiate()
CALL resultFile%initiate( filename="./result.h5", mode="READ" )
CALL resultFile%open()
read domain
!> start creating domain
CALL meshfile%initiate( filename="./mesh.h5", mode="READ" )
CALL meshfile%open()
CALL dom%initiate( hdf5=meshfile, group="" )
!> end creating domain
initiate scalar field
CALL SetScalarFieldParam( param=param, &
& fieldType=FIELD_TYPE_NORMAL, &
& name="U", &
& engine=engine)
CALL obj%initiate( param, dom )
setting all values using vector
CALL reallocate( realVec, dom%getTotalNodes() )
CALL RANDOM_NUMBER( realVec )
CALL obj%set(realVec)
CALL obj%display( "scalar field = ")
results
#scalar field =
# isInitiated : TRUE
# name :U
# fieldType : NORMAL
# engine :NATIVE_SERIAL
# comm: 0
# myRank: 0
# numProcs: 1
# global_n: 0
# local_n: 0
# 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.725701,
0.634809,
0.398595,
0.418203,
0.195654,
0.874868,
CALL obj%get( value=avar, globalNode=2)
CALL Display(avar, "avar = ")
results
avar = 0.634809
Cleanup
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(ScalarField_), 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.
PROGRAM main
USE easifemBase
USE easifemClasses
TYPE( Domain_ ) :: dom
TYPE( ScalarField_ ) :: obj
TYPE( HDF5File_ ) :: meshfile, resultFile
TYPE( ParameterList_ ) :: param
INTEGER( I4B ) :: ierr
REAL( DFP ), ALLOCATABLE :: realVec( : )
REAL( DFP ) :: avar
CHARACTER( LEN = * ), PARAMETER :: engine = "NATIVE_SERIAL"
Open file for import
CALL FPL_INIT()
CALL param%initiate()
CALL resultFile%initiate( filename="./result.h5", mode="READ" )
CALL resultFile%open()
read domain
!> start creating domain
CALL meshfile%initiate( filename="./mesh.h5", mode="READ" )
CALL meshfile%open()
CALL dom%initiate( hdf5=meshfile, group="" )
!> end creating domain
initiate scalar field
CALL SetScalarFieldParam( param=param, &
& fieldType=FIELD_TYPE_NORMAL, &
& name="U", &
& engine=engine)
CALL obj%initiate( param, dom )
setting all values using vector
CALL reallocate( realVec, dom%getTotalNodes() )
CALL RANDOM_NUMBER( realVec )
CALL obj%set(realVec)
CALL obj%display( "scalar field = ")
results
#scalar field =
# isInitiated : TRUE
# name :U
# fieldType : NORMAL
# engine :NATIVE_SERIAL
# comm: 0
# myRank: 0
# numProcs: 1
# global_n: 0
# local_n: 0
# 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.829034,
0.103488,
0.686197,
0.979929,
0.115532,
0.829484,
0.007732,
Get all entries
CALL obj%get( value=realVec)
CALL Display(realVec(1:5), "realVec(1:5) = ")
results
realVec(1:5) =
---------------
0.829034
0.103488
0.686197
0.979929
0.115532
Cleanup
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(ScalarField_), INTENT(IN) :: obj
REAL(DFP), ALLOCATABLE, INTENT(INOUT) :: VALUE(:)
INTEGER(I4B), INTENT(IN) :: globalNode(:)
END SUBROUTINE get3
END INTERFACE
Get all multiple entries.
In this example we test Get method.
PROGRAM main
USE easifemBase
USE easifemClasses
TYPE( Domain_ ) :: dom
TYPE( ScalarField_ ) :: obj
TYPE( HDF5File_ ) :: meshfile, resultFile
TYPE( ParameterList_ ) :: param
INTEGER( I4B ) :: ierr
REAL( DFP ), ALLOCATABLE :: realVec( : )
REAL( DFP ) :: avar
CHARACTER( LEN = * ), PARAMETER :: engine = "NATIVE_SERIAL"
Open file for import
CALL FPL_INIT()
CALL param%initiate()
CALL resultFile%initiate( filename="./result.h5", mode="READ" )
CALL resultFile%open()
read domain
!> start creating domain
CALL meshfile%initiate( filename="./mesh.h5", mode="READ" )
CALL meshfile%open()
CALL dom%initiate( hdf5=meshfile, group="" )
!> end creating domain
initiate scalar field
CALL SetScalarFieldParam( param=param, &
& fieldType=FIELD_TYPE_NORMAL, &
& name="U", &
& engine=engine)
CALL obj%initiate( param, dom )
setting all values using vector
CALL reallocate( realVec, dom%getTotalNodes() )
CALL RANDOM_NUMBER( realVec )
CALL obj%set(realVec)
CALL obj%display( "scalar field = ")
results
#scalar field =
# isInitiated : TRUE
# name :U
# fieldType : NORMAL
# engine :NATIVE_SERIAL
# comm: 0
# myRank: 0
# numProcs: 1
# global_n: 0
# local_n: 0
# 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.832033,
0.745878,
0.844285,
0.691231,
0.996872,
0.347315,
0.827425,
0.263551,
Get multiple entries
CALL obj%get( value=realVec, globalNode=[1,2,3,4,5])
CALL Display(realVec(1:5), "realVec(1:5) = ")
results
realVec(1:5) =
---------------
0.832033
0.745878
0.844285
0.691231
0.996872
Cleanup
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(ScalarField_), 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.
PROGRAM main
USE easifemBase
USE easifemClasses
TYPE( Domain_ ) :: dom
TYPE( ScalarField_ ) :: obj
TYPE( HDF5File_ ) :: meshfile, resultFile
TYPE( ParameterList_ ) :: param
INTEGER( I4B ) :: ierr
REAL( DFP ), ALLOCATABLE :: realVec( : )
REAL( DFP ) :: avar
CHARACTER( LEN = * ), PARAMETER :: engine = "NATIVE_SERIAL"
Open file for import
CALL FPL_INIT()
CALL param%initiate()
CALL resultFile%initiate( filename="./result.h5", mode="READ" )
CALL resultFile%open()
read domain
!> start creating domain
CALL meshfile%initiate( filename="./mesh.h5", mode="READ" )
CALL meshfile%open()
CALL dom%initiate( hdf5=meshfile, group="" )
!> end creating domain
initiate scalar field
CALL SetScalarFieldParam( param=param, &
& fieldType=FIELD_TYPE_NORMAL, &
& name="U", &
& engine=engine)
CALL obj%initiate( param, dom )
setting all values using vector
CALL reallocate( realVec, dom%getTotalNodes() )
CALL RANDOM_NUMBER( realVec )
CALL obj%set(realVec)
CALL obj%display( "scalar field = ")
results
#scalar field =
# isInitiated : TRUE
# name :U
# fieldType : NORMAL
# engine :NATIVE_SERIAL
# comm: 0
# myRank: 0
# numProcs: 1
# global_n: 0
# local_n: 0
# 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.965852,
0.106486,
0.227661,
0.278568,
0.979695,
0.156565,
0.007468,
Get multiple entries
CALL obj%get( value=realVec, istart=1, iend=5, stride=1)
CALL Display(realVec(1:5), "realVec(1:5) = ")
results
realVec(1:5) =
---------------
0.965852
0.106486
0.227661
0.278568
0.979695
Cleanup
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(ScalarField_), 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.
PROGRAM main
USE easifemBase
USE easifemClasses
TYPE( Domain_ ) :: dom
TYPE( ScalarField_ ) :: obj
TYPE( HDF5File_ ) :: meshfile, resultFile
TYPE( ParameterList_ ) :: param
INTEGER( I4B ) :: ierr
REAL( DFP ), ALLOCATABLE :: realVec( : )
REAL( DFP ) :: avar
CHARACTER( LEN = * ), PARAMETER :: engine = "NATIVE_SERIAL"
TYPE(FEVariable_) :: fevar
Open file for import
CALL FPL_INIT()
CALL param%initiate()
CALL resultFile%initiate( filename="./result.h5", mode="READ" )
CALL resultFile%open()
read domain
!> start creating domain
CALL meshfile%initiate( filename="./mesh.h5", mode="READ" )
CALL meshfile%open()
CALL dom%initiate( hdf5=meshfile, group="" )
!> end creating domain
initiate scalar field
CALL SetScalarFieldParam( param=param, &
& fieldType=FIELD_TYPE_NORMAL, &
& name="U", &
& engine=engine)
CALL obj%initiate( param, dom )
setting all values using vector
CALL reallocate( realVec, dom%getTotalNodes() )
CALL RANDOM_NUMBER( realVec )
CALL obj%set(realVec)
CALL obj%display( "scalar field = ")
results
#scalar field =
# isInitiated : TRUE
# name :U
# fieldType : NORMAL
# engine :NATIVE_SERIAL
# comm: 0
# myRank: 0
# numProcs: 1
# global_n: 0
# local_n: 0
# 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.623683,
0.370695,
0.967630,
0.835710,
0.821063,
0.613570,
Get multiple entries
CALL obj%get( value=fevar, globalNode=arange(1,5,1) )
CALL Display(fevar, "fevar = ")
results
fevar =
# RANK :: 0 (SCALAR)
# VarType: SPACE
# VALUE:
---------
0.623683
0.370695
0.967630
0.835710
0.821063
Cleanup
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
MODULE SUBROUTINE get6(obj, VALUE)
CLASS(ScalarField_), INTENT(IN) :: obj
CLASS(ScalarField_), INTENT(INOUT) :: VALUE
END SUBROUTINE get6
END INTERFACE
Get a scalarfield in an instance of scalar field.