Set
Set the entries in the ScalarField.
Calling example:
Set a single entry
CALL Set(
CLASS(ScalarField_):: obj
INTEGER(I4B):: globalNode
REAL(DFP):: VALUE
REAL(DFP):: scale
LOGICAL(LGT):: addContribution
)
Set all entries to a single scalar value
CALL Set(
CLASS(ScalarField_):: obj
REAL(DFP):: VALUE
REAL(DFP):: scale
LOGICAL(LGT):: addContribution
)
Set all entries of scalar field to a given vector.
CALL Set(
CLASS(ScalarField_):: obj
REAL(DFP):: VALUE(:)
REAL(DFP):: scale
LOGICAL(LGT):: addContribution
)
Set selected entries to a single value.
CALL Set(
CLASS(ScalarField_):: obj
INTEGER(I4B):: globalNode(:)
REAL(DFP):: VALUE
REAL(DFP):: scale
LOGICAL(LGT):: addContribution
)
Set multiple entries to different values.
CALL Set(
CLASS(ScalarField_):: obj
INTEGER(I4B):: globalNode(:)
REAL(DFP):: VALUE(:)
REAL(DFP):: scale
LOGICAL(LGT):: addContribution
)
Select multiple enties using triads.
CALL Set(
CLASS(ScalarField_):: obj
INTEGER(I4B):: istart
INTEGER(I4B):: iend
INTEGER(I4B):: stride
REAL(DFP):: VALUE
REAL(DFP):: scale
LOGICAL(LGT):: addContribution
)
Select multiple enties using triads.
CALL Set(
CLASS(ScalarField_):: obj
INTEGER(I4B):: istart
INTEGER(I4B):: iend
INTEGER(I4B):: stride
REAL(DFP):: VALUE(:)
REAL(DFP):: scale
LOGICAL(LGT):: addContribution
)
Copy obj2 in obj.
CALL Set(
CLASS(ScalarField_):: obj
CLASS(ScalarField_):: obj2
)
Select multiple values using FEVariable.
CALL Set(
CLASS(ScalarField_):: obj
INTEGER(I4B):: globalNode(:)
TYPE(FEVariable_):: VALUE
REAL(DFP):: scale
LOGICAL(LGT):: addContribution
)
Copy obj2 into obj like AXPY.
CALL Set(
CLASS(ScalarField_):: obj
CLASS(ScalarField_):: obj2
REAL(DFP):: scale
LOGICAL(LGT):: addContribution
)
Interface 1
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE set1(obj, globalNode, VALUE, scale, &
& addContribution)
CLASS(ScalarField_), INTENT(INOUT) :: obj
INTEGER(I4B), INTENT(IN) :: globalNode
REAL(DFP), INTENT(IN) :: VALUE
REAL(DFP), OPTIONAL, INTENT(IN) :: scale
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: addContribution
END SUBROUTINE set1
END INTERFACE
- Set single entry.
In this example we test Set method.
We set single entry in ScalarField.
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( : )
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 obj%set( globalnode = 10, value= 100.0_dfp )
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: 94737506115424
# 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.000,
0.000,
0.000,
0.000,
0.000,
0.000,
0.000,
0.000,
0.000,
100.000,
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 set2(obj, VALUE, scale, addContribution)
CLASS(ScalarField_), INTENT(INOUT) :: obj
REAL(DFP), INTENT(IN) :: VALUE
REAL(DFP), OPTIONAL, INTENT(IN) :: scale
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: addContribution
END SUBROUTINE set2
END INTERFACE
- Set all values of scalar field to a given scalar.
In this example we test Set method.
In this example we set all values of ScalarField.
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( : )
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 obj%set( value= 200.0_DFP )
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: 94373790752608
# 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 ,
-------,
200.000,
200.000,
200.000,
200.000,
200.000,
200.000,
200.000,
200.000,
200.000,
200.000,
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 set3(obj, VALUE, scale, addContribution)
CLASS(ScalarField_), INTENT(INOUT) :: obj
REAL(DFP), INTENT(IN) :: VALUE(:)
REAL(DFP), OPTIONAL, INTENT(IN) :: scale
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: addContribution
END SUBROUTINE set3
END INTERFACE
- Set all values of scalarfield using a vector of reals.
- The size of value should be same as the size of scalar field.
In this example we test Set method.
In this example we set all values of ScalarField using 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( : )
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 = ")
#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: 94018677690208
# 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.609126,
0.877070,
0.462140,
0.474488,
0.743044,
0.471275,
0.085154,
0.671168,
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 set4(obj, globalNode, VALUE, scale, addContribution)
CLASS(ScalarField_), INTENT(INOUT) :: obj
INTEGER(I4B), INTENT(IN) :: globalNode(:)
REAL(DFP), INTENT(IN) :: VALUE
REAL(DFP), OPTIONAL, INTENT(IN) :: scale
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: addContribution
END SUBROUTINE set4
END INTERFACE
Set multiple values to a scalar value.
In this example we test Set method.
Setting multiple values in ScalarField.
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( : )
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 obj%set(globalNode=[1,2,5], value=1.0_DFP )
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: 93864323497824
# 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 ,
-------,
1.00000,
1.00000,
0.00000,
0.00000,
1.00000,
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 set5(obj, globalNode, VALUE, scale, addContribution)
CLASS(ScalarField_), INTENT(INOUT) :: obj
INTEGER(I4B), INTENT(IN) :: globalNode(:)
REAL(DFP), INTENT(IN) :: VALUE(:)
REAL(DFP), OPTIONAL, INTENT(IN) :: scale
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: addContribution
END SUBROUTINE set5
END INTERFACE
Set multiple values of scalar field.
In this example we test Set method.
Setting multiple values.
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( : )
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 )
realVec = [1.0, 2.0, 3.0]
CALL obj%set(globalNode=[1,2,5], value=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: 94289762668384
# 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 ,
-------,
1.00000,
2.00000,
0.00000,
0.00000,
3.00000,
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
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE set6(obj, istart, iend, stride, VALUE, &
& scale, addContribution)
CLASS(ScalarField_), INTENT(INOUT) :: obj
INTEGER(I4B), INTENT(IN) :: istart
INTEGER(I4B), INTENT(IN) :: iend
INTEGER(I4B), INTENT(IN) :: stride
REAL(DFP), INTENT(IN) :: VALUE
REAL(DFP), OPTIONAL, INTENT(IN) :: scale
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: addContribution
END SUBROUTINE set6
END INTERFACE
Set multiple values by using triplets istart:iend:stride
In this example we test Set method.
Setting 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( : )
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 obj%set(istart=1, iend=5, stride=2, value=10.0_DFP )
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: 94209227312992
# 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 ,
-------,
10.0000,
0.0000,
10.0000,
0.0000,
10.0000,
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 7
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE set7(obj, istart, iend, stride, VALUE, &
& scale, addContribution)
CLASS(ScalarField_), INTENT(INOUT) :: obj
INTEGER(I4B), INTENT(IN) :: istart
INTEGER(I4B), INTENT(IN) :: iend
INTEGER(I4B), INTENT(IN) :: stride
REAL(DFP), INTENT(IN) :: VALUE(:)
REAL(DFP), OPTIONAL, INTENT(IN) :: scale
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: addContribution
END SUBROUTINE set7
END INTERFACE
Set multiple values using triplets.
In this example we test Set method.
Setting 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( : )
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 )
realVec = [1.0, 3.0, 5.0]
CALL obj%set(istart=1, iend=5, stride=2, value=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: 94391377026912
# 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 ,
-------,
1.00000,
0.00000,
3.00000,
0.00000,
5.00000,
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 8
- ܀ Interface
- ️܀ Example 1
- ️܀ Example 2
- ↢
INTERFACE
MODULE SUBROUTINE set8(obj, obj2)
CLASS(ScalarField_), INTENT(INOUT) :: obj
CLASS(ScalarField_), INTENT(IN) :: obj2
END SUBROUTINE set8
END INTERFACE
In this example we test Set method.
Setting multiple values using triplets.
We also test:
Obj2 =obj
Here obj2
and obj
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( : )
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 SetScalarFieldParam( param=param, &
& fieldType=FIELD_TYPE_NORMAL, &
& name="U2", &
& engine=engine)
CALL obj2%initiate( param, dom )
realVec = [1.0, 3.0, 5.0]
CALL obj%set(istart=1, iend=5, stride=2, value=realVec )
CALL obj2%set(obj)
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: 94340755750608
# 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 ,
-------,
1.00000,
0.00000,
3.00000,
0.00000,
5.00000,
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 Set method.
Setting multiple values using triplets.
We also test:
obj2=obj
Here obj
is an instance of ScalarField_
, and obj2
is an instance of ScalarFieldLis_
PROGRAM main
USE easifemBase
USE easifemClasses
TYPE( Domain_ ) :: dom
TYPE( ScalarField_ ) :: obj
TYPE( ScalarFieldLis_ ) :: obj2
TYPE( HDF5File_ ) :: meshfile, resultFile
TYPE( ParameterList_ ) :: param
INTEGER( I4B ) :: ierr
REAL( DFP ), ALLOCATABLE :: realVec( : )
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="NATIVE_SERIAL")
CALL obj%initiate( param, dom )
CALL SetScalarFieldParam( param=param, &
& fieldType=FIELD_TYPE_NORMAL, &
& name="U2", &
& engine=engine)
CALL obj2%initiate( param, dom )
realVec = [1.0, 3.0, 5.0]
CALL obj%set(istart=1, iend=5, stride=2, value=realVec )
CALL obj2%set(obj)
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: 94164546445152
# 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 ,
-------,
1.00000,
0.00000,
3.00000,
0.00000,
5.00000,
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 9
INTERFACE
MODULE SUBROUTINE set9(obj, globalNode, VALUE, scale, addContribution)
CLASS(ScalarField_), INTENT(INOUT) :: obj
INTEGER(I4B), INTENT(IN) :: globalNode(:)
TYPE(FEVariable_), INTENT(IN) :: VALUE
!! Scalar, Nodal, FEVariable (Space or Constant)
REAL(DFP), OPTIONAL, INTENT(IN) :: scale
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: addContribution
END SUBROUTINE set9
END INTERFACE
Interface 10
- ܀ Interface
- ️܀ Example 1
- ️܀ Example 2
- ↢
INTERFACE
MODULE SUBROUTINE set10(obj, obj2, scale, addContribution)
CLASS(ScalarField_), INTENT(INOUT) :: obj
CLASS(ScalarField_), INTENT(IN) :: obj2
REAL(DFP), INTENT(IN) :: scale
LOGICAL(LGT), INTENT(IN) :: addContribution
END SUBROUTINE set10
END INTERFACE
In this example we test Set method.
Setting multiple values using triplets.
We also test:
obj=obj+scale*obj2
Here 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( : )
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 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(value=realVec)
CALL obj%Display("obj = ")
0.122526,
0.004512,
0.338894,
0.634983,
0.530011,
0.772392,
0.907221,
CALL RANDOM_NUMBER(realVec)
CALL obj2%set(value=realVec)
CALL obj2%Display("obj2 = ")
0.370250,
0.898448,
0.029706,
0.299606,
0.505284,
0.072251,
0.943977,
CALL obj%set(obj2=obj2, scale=1.0_DFP, addContribution=.TRUE.)
CALL obj%Display("obj =")
0.49278,
0.90296,
0.36860,
0.93459,
1.03529,
0.84464,
1.85120,
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 Set method.
Setting multiple values using triplets.
We also test:
obj=obj+scale*obj2
Here obj
is an instance of ScalarFieldLis_
, and obj2
is an instance of ScalarField_
.
PROGRAM main
USE easifemBase
USE easifemClasses
TYPE( Domain_ ) :: dom
TYPE( ScalarField_ ) :: obj
TYPE( ScalarFieldLis_ ) :: obj2
TYPE( HDF5File_ ) :: meshfile, resultFile
TYPE( ParameterList_ ) :: param
INTEGER( I4B ) :: ierr
REAL( DFP ), ALLOCATABLE :: realVec( : )
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="NATIVE_SERIAL")
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(value=realVec)
CALL obj%Display("obj = ")
0.444226,
0.622197,
0.553742,
0.453327,
0.252453,
0.436322,
0.371526,
0.956193,
0.684259,
0.335780,
CALL RANDOM_NUMBER(realVec)
CALL obj2%set(value=realVec)
CALL obj2%Display("obj2 = ")
0.117251,
0.699120,
0.400569,
0.126309,
0.097650,
0.653376,
0.497695,
0.054821,
0.674551,
0.935478,
CALL obj%set(obj2=obj2, scale=1.0_DFP, addContribution=.TRUE.)
CALL obj%Display("obj =")
0.56148,
1.32132,
0.95431,
0.57964,
0.35010,
1.08970,
0.86922,
1.01101,
1.35881,
1.27126,
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