Set
Set entries in STScalarField
.
Calling example:
Set single entry CLASS(STScalarFieldLis_), INTENT(INOUT) :: obj
INTEGER(I4B):: globalNode
REAL(DFP):: VALUE(:)
REAL(DFP):: scale
LOGICAL(LGT):: addContribution
CLASS(STScalarFieldLis_):: obj
REAL(DFP):: VALUE(:)
REAL(DFP):: scale
LOGICAL(LGT):: addContribution
CLASS(STScalarFieldLis_):: obj
REAL(DFP):: VALUE
INTEGER(I4B):: timeCompo
REAL(DFP):: scale
LOGICAL(LGT):: addContribution
REAL(DFP):: VALUE(:, :)
REAL(DFP):: scale
LOGICAL(LGT):: addContribution
CLASS(STScalarFieldLis_):: obj
REAL(DFP):: VALUE(:)
INTEGER(I4B):: timeCompo
REAL(DFP):: scale
LOGICAL(LGT):: addContribution
CLASS(STScalarFieldLis_):: obj
TYPE(ScalarField_):: VALUE
INTEGER(I4B):: timeCompo
REAL(DFP):: scale
LOGICAL(LGT):: addContribution
CLASS(STScalarFieldLis_):: obj
INTEGER(I4B):: globalNode(:)
REAL(DFP):: VALUE(:)
REAL(DFP):: scale
LOGICAL(LGT):: addContribution
CLASS(STScalarFieldLis_):: obj
INTEGER(I4B):: globalNode(:)
REAL(DFP):: VALUE(:, :)
REAL(DFP):: scale
LOGICAL(LGT):: addContribution
CLASS(STScalarFieldLis_):: obj
REAL(DFP):: VALUE(:)
INTEGER(I4B):: globalNode(:)
INTEGER(I4B):: timeCompo
REAL(DFP):: scale
LOGICAL(LGT):: addContribution
CLASS(STScalarFieldLis_):: obj
REAL(DFP):: VALUE
INTEGER(I4B):: globalNode
INTEGER(I4B):: timeCompo
REAL(DFP):: scale
LOGICAL(LGT):: addContribution
CLASS(STScalarFieldLis_):: obj
INTEGER(I4B):: istart
INTEGER(I4B):: iend
INTEGER(I4B):: stride
REAL(DFP):: VALUE(:)
REAL(DFP):: scale
LOGICAL(LGT):: addContribution
CLASS(STScalarFieldLis_):: obj
REAL(DFP):: VALUE(:, :)
INTEGER(I4B):: istart
INTEGER(I4B):: iend
INTEGER(I4B):: stride
REAL(DFP):: scale
LOGICAL(LGT):: addContribution
CLASS(STScalarFieldLis_):: obj
TYPE(FEVariable_):: VALUE
INTEGER(I4B):: globalNode(:)
REAL(DFP):: scale
LOGICAL(LGT):: addContribution
CLASS(STScalarFieldLis_):: obj
REAL(DFP):: VALUE
REAL(DFP):: scale
LOGICAL(LGT):: addContribution
Interface 1
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE Set1(obj, globalNode, VALUE, scale, &
& addContribution)
CLASS(STScalarFieldLis_), 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
- This routine sets the single entry of the STScalarField.
- Here,
value
should be a space-time scalar representing the components of a STScalar. - The size of
value
should be same asobj%timeCompo
.
In simple words it does following.
STScalar( :, globalNode ) = value( : )
In this example we test Set method.
In this example we set the space-time value at a single 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"
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 )
!> set a single entry
call obj%set( &
& value=linspace(1.0_DFP, 10.0_DFP, timeCompo), &
& globalNode=1 )
!> set a single entry
call obj%set( &
& value=linspace(10.0_DFP, 20.0_DFP, timeCompo), &
& globalNode=3 )
call obj%display( "obj = ")
call obj%Deallocate()
call dom%Deallocate()
call param%Deallocate()
call FPL_FINALIZE()
end program main
#obj =
# isInitiated : TRUE
# name :U
# fieldType : NORMAL
# engine :LIS_OMP
# comm: 0
# myRank: 0
# numProcs: 1
# global_n: 62
# local_n: 62
# is: 1
# ie: 63
# lis_ptr: 94918120762096
# domain : ASSOCIATED
# domains : NOT ALLOCATED
# tSize : 62
# # DOF data :
# Total Physical Variables :1
# Name : U
# Space Components : 1
# Time Components : 2
# Total Nodes : 31
# Storage Format : Nodes
# Value Map :
--------------
1
32
63
# VAR :U
DOF-1 , DOF-2 ,
-------, -------,
1.0000, 10.0000,
0.0000, 0.0000,
10.0000, 20.0000,
Interface 2
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE Set2(obj, VALUE, scale, addContribution)
CLASS(STScalarFieldLis_), TARGET, 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
This routine work as follows.
- The size of
value
should be same asobj%timeCompo
, then this value is set for all the nodal values.
STScalar( 1:timeCompo, i ) = value( 1:timeCompo ), for i = 1, tNodes
In this example we test Set method.
In this example we set the space-time value at all spatial nodes.
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"
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 )
!> set all entries
call obj%set( &
& value=linspace(1.0_DFP, 10.0_DFP, timeCompo) )
call obj%display( "obj = ")
call obj%Deallocate()
call dom%Deallocate()
call param%Deallocate()
call FPL_FINALIZE()
end program main
#obj =
# isInitiated : TRUE
# name :U
# fieldType : NORMAL
# engine :LIS_OMP
# comm: 0
# myRank: 0
# numProcs: 1
# global_n: 62
# local_n: 62
# is: 1
# ie: 63
# lis_ptr: 94813641005808
# domain : ASSOCIATED
# domains : NOT ALLOCATED
# tSize : 62
# # DOF data :
# Total Physical Variables :1
# Name : U
# Space Components : 1
# Time Components : 2
# Total Nodes : 31
# Storage Format : Nodes
# Value Map :
--------------
1
32
63
# VAR :U
DOF-1 , DOF-2 ,
-------, -------,
1.00000, 10.0000,
1.00000, 10.0000,
1.00000, 10.0000,
1.00000, 10.0000,
1.00000, 10.0000,
1.00000, 10.0000,
Interface 3
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE Set3(obj, VALUE, timeCompo, scale, &
& addContribution)
CLASS(STScalarFieldLis_), INTENT(INOUT) :: obj
REAL(DFP), INTENT(IN) :: VALUE
INTEGER(I4B), INTENT(IN) :: timeCompo
REAL(DFP), OPTIONAL, INTENT(IN) :: scale
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: addContribution
END SUBROUTINE Set3
END INTERFACE
- This routine sets all values of
timeCompo
component of the STScalarField to given scalar valuevalue
STScalar( timeCompo, i ) = value, for i = 1, tNodes
In this example we test Set method.
In this example we set the space-time value at all spatial nodes of a given timeCompo.
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"
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 )
!> set all entries
call obj%set( value=1.0_DFP, timeCompo=1_I4B )
call obj%set( value=2.0_DFP, timeCompo=2_I4B )
call obj%display( "obj = ")
call obj%Deallocate()
call dom%Deallocate()
call param%Deallocate()
call FPL_FINALIZE()
end program main
#obj =
# isInitiated : TRUE
# name :U
# fieldType : NORMAL
# engine :LIS_OMP
# comm: 0
# myRank: 0
# numProcs: 1
# global_n: 62
# local_n: 62
# is: 1
# ie: 63
# lis_ptr: 94207752727280
# domain : ASSOCIATED
# domains : NOT ALLOCATED
# tSize : 62
# # DOF data :
# Total Physical Variables :1
# Name : U
# Space Components : 1
# Time Components : 2
# Total Nodes : 31
# Storage Format : Nodes
# Value Map :
--------------
1
32
63
# VAR :U
DOF-1 , DOF-2 ,
-------, -------,
1.00000, 2.00000,
1.00000, 2.00000,
1.00000, 2.00000,
1.00000, 2.00000,
1.00000, 2.00000,
1.00000, 2.00000,
1.00000, 2.00000,
Interface 4
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE Set4(obj, VALUE, scale, addContribution)
CLASS(STScalarFieldLis_), INTENT(INOUT) :: obj
REAL(DFP), INTENT(IN) :: VALUE(:, :)
REAL(DFP), OPTIONAL, INTENT(IN) :: scale
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: addContribution
END SUBROUTINE Set4
END INTERFACE
- This routine sets all entries of STScalar field to a given
STScalarFieldLis_
- Here, shape of
value
should bevalue(1:timeCompo, tNodes)
. - Rows of
value
denotes the time components - Columns of
value
represents the spatial nodes.
STScalar( :, : ) = value( :, : )
In this example we test Set method.
In this example we set the all values by using a space-time vector.
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"
REAL( DFP ), ALLOCATABLE :: value(:, :)
INTEGER( I4B ) ::tNodes
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 )
!> set all entries
tNodes = dom%getTotalNodes()
CALL Reallocate(value, timeCompo, tNodes)
CALL RANDOM_NUMBER(value)
CALL obj%set(value)
CALL display(value(:, 1:5), "value(:, 1:5) = " )
call obj%display( "obj = ")
call obj%Deallocate()
call dom%Deallocate()
call param%Deallocate()
call FPL_FINALIZE()
end program main
value(:, 1:5) =
------------------------------------------------
0.926851 0.727974 0.267881 0.823990 0.764518
0.616465 0.360218 0.996750 0.639337 0.011806
#obj =
# isInitiated : TRUE
# name :U
# fieldType : NORMAL
# engine :LIS_OMP
# comm: 0
# myRank: 0
# numProcs: 1
# global_n: 62
# local_n: 62
# is: 1
# ie: 63
# lis_ptr: 93988982946544
# domain : ASSOCIATED
# domains : NOT ALLOCATED
# tSize : 62
# # DOF data :
# Total Physical Variables :1
# Name : U
# Space Components : 1
# Time Components : 2
# Total Nodes : 31
# Storage Format : Nodes
# Value Map :
--------------
1
32
63
# VAR :U
DOF-1 , DOF-2 ,
--------, --------,
0.926851, 0.616465,
0.727974, 0.360218,
0.267881, 0.996750,
0.823990, 0.639337,
0.764518, 0.011806,
Interface 5
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE Set5(obj, VALUE, timeCompo, scale, &
& addContribution)
CLASS(STScalarFieldLis_), INTENT(INOUT) :: obj
REAL(DFP), INTENT(IN) :: VALUE(:)
INTEGER(I4B), INTENT(IN) :: timeCompo
REAL(DFP), OPTIONAL, INTENT(IN) :: scale
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: addContribution
END SUBROUTINE Set5
END INTERFACE
- This routine sets all entries of the component
timeCompo
of STScalarField tovalue
STScalar( timeCompo, 1:tNodes ) = value( 1:tNodes )
The size of value
should be equal to the total number of spatial nodes.
In this example we test Set method.
In this example we set the all values of a timeCompo by using a vector of real.
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"
REAL( DFP ), ALLOCATABLE :: value(:, :)
INTEGER( I4B ) ::tNodes
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 )
!> set all entries
tNodes = dom%getTotalNodes()
CALL Reallocate(value, timeCompo, tNodes)
CALL RANDOM_NUMBER(value)
CALL obj%set( value=value(1,:), timeCompo=1 )
CALL obj%set( value=value(2,:), timeCompo=2 )
CALL display(value(:, 1:5), "value(:, 1:5) = " )
call obj%display( "obj = ")
call obj%Deallocate()
call dom%Deallocate()
call param%Deallocate()
call FPL_FINALIZE()
end program main
value(:, 1:5) =
------------------------------------------------
0.092312 0.463958 0.375566 0.521316 0.103649
0.835652 0.507362 0.215718 0.664761 0.815387
#obj =
# isInitiated : TRUE
# name :U
# fieldType : NORMAL
# engine :LIS_OMP
# comm: 0
# myRank: 0
# numProcs: 1
# global_n: 62
# local_n: 62
# is: 1
# ie: 63
# lis_ptr: 94384562440944
# domain : ASSOCIATED
# domains : NOT ALLOCATED
# tSize : 62
# # DOF data :
# Total Physical Variables :1
# Name : U
# Space Components : 1
# Time Components : 2
# Total Nodes : 31
# Storage Format : Nodes
# Value Map :
--------------
1
32
63
# VAR :U
DOF-1 , DOF-2 ,
--------, --------,
0.092312, 0.835652,
0.463958, 0.507362,
0.375566, 0.215718,
0.521316, 0.664761,
0.103649, 0.815387,
Interface 6
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE Set6(obj, VALUE, timeCompo, scale, &
& addContribution)
CLASS(STScalarFieldLis_), INTENT(INOUT) :: obj
TYPE(ScalarField_), INTENT(IN) :: VALUE
INTEGER(I4B), INTENT(IN) :: timeCompo
REAL(DFP), OPTIONAL, INTENT(IN) :: scale
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: addContribution
END SUBROUTINE Set6
END INTERFACE
- This routine sets all entries of the component
timeCompo
of STScalarField to given ScalarFieldvalue
STScalar( timeCompo, 1:tNodes ) = value(1:tNodes)
- The size of value should be same as the total number of nodes in
obj
.
In this example we test Set method.
program main
use easifemBase
use easifemClasses
implicit none
type( domain_ ) :: dom
type( STScalarFieldLis_ ) :: obj
type( ScalarFieldLis_ ) :: obj2
TYPE( HDF5File_ ) :: meshfile
type( ParameterList_ ) :: param
integer( i4b ) :: ierr
INTEGER( I4B ), Parameter :: timeCompo=2
CHARACTER( LEN = * ), Parameter :: engine="LIS_OMP"
REAL( DFP ), ALLOCATABLE :: value(:, :)
INTEGER( I4B ) ::tNodes
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 )
CALL SetScalarFieldParam( &
& param=param, &
& name="U", &
& fieldType=FIELD_TYPE_NORMAL, &
& engine=engine)
call obj2%initiate( param, dom )
!> set all entries
tNodes = dom%getTotalNodes()
CALL Reallocate(value, timeCompo, tNodes)
CALL RANDOM_NUMBER(value)
CALL obj2%set(value=value(1,:))
CALL obj%set( value=obj2, timeCompo=1 )
CALL obj2%set(value=value(2,:))
CALL obj%set( value=obj2, timeCompo=2 )
CALL display(value(:, 1:5), "value(:, 1:5) = " )
CALL obj%display( "obj = ")
call obj%Deallocate()
call obj2%Deallocate()
call dom%Deallocate()
call param%Deallocate()
call FPL_FINALIZE()
end program main
value(:, 1:5) =
------------------------------------------------
0.040207 0.491438 0.943856 0.172155 0.719283
0.183957 0.697048 0.376879 0.552362 0.539996
#obj =
# isInitiated : TRUE
# name :U
# fieldType : NORMAL
# engine :LIS_OMP
# comm: 0
# myRank: 0
# numProcs: 1
# global_n: 62
# local_n: 62
# is: 1
# ie: 63
# lis_ptr: 94380060994288
# domain : ASSOCIATED
# domains : NOT ALLOCATED
# tSize : 62
# # DOF data :
# Total Physical Variables :1
# Name : U
# Space Components : 1
# Time Components : 2
# Total Nodes : 31
# Storage Format : Nodes
# Value Map :
--------------
1
32
63
# VAR :U
DOF-1 , DOF-2 ,
--------, --------,
0.040207, 0.183957,
0.491438, 0.697048,
0.943856, 0.376879,
0.172155, 0.552362,
0.719283, 0.539996,
Interface 7
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE Set7(obj, VALUE, globalNode, scale, &
& addContribution)
CLASS(STScalarFieldLis_), 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 Set7
END INTERFACE
This method sets the selected enties of a STScalarField to value( : )
Effectively it does the following:
STScalar( 1:timeCompo, globalNode ) = value( 1:timeCompo ), for entries in global nodes
size of value
should be equal to the obj%timeCompo
In this example we test Set method.
In this example we set multiple entries.
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"
REAL( DFP ), ALLOCATABLE :: value(:, :)
INTEGER( I4B ) ::tNodes
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 )
!> set multiple entries
CALL Reallocate(value, timeCompo, 1)
CALL RANDOM_NUMBER(value)
CALL obj%set( value=value(:,1), globalNode=arange(1,10,2) )
CALL display( value(:, 1), "value(:, 1) = " )
CALL obj%display( "obj = ")
call obj%Deallocate()
call dom%Deallocate()
call param%Deallocate()
call FPL_FINALIZE()
end program main
value(:, 1) =
--------------
0.662859
0.512173
#obj =
# isInitiated : TRUE
# name :U
# fieldType : NORMAL
# engine :LIS_OMP
# comm: 0
# myRank: 0
# numProcs: 1
# global_n: 62
# local_n: 62
# is: 1
# ie: 63
# lis_ptr: 93919708392176
# domain : ASSOCIATED
# domains : NOT ALLOCATED
# tSize : 62
# # DOF data :
# Total Physical Variables :1
# Name : U
# Space Components : 1
# Time Components : 2
# Total Nodes : 31
# Storage Format : Nodes
# Value Map :
--------------
1
32
63
# VAR :U
DOF-1 , DOF-2 ,
-------, -------,
0.66286, 0.51217,
0.00000, 0.00000,
0.66286, 0.51217,
0.00000, 0.00000,
0.66286, 0.51217,
0.00000, 0.00000,
0.66286, 0.51217,
0.00000, 0.00000,
0.66286, 0.51217,
Interface 8
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE Set8(obj, globalNode, VALUE, scale, &
& addContribution)
CLASS(STScalarFieldLis_), 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 Set8
END INTERFACE
- This routine sets selected entries of STScalarField.
STScalar( 1:timeCompo, globalNode ) = value( 1:timeCompo, 1:size(globalNode) )
SIZE(value, 1)
should be equal toobj%timeCompo
SIZE(value, 2)
should be equal toSIZE(globalNode)
In this example we test Set method.
In this example we set multiple entries.
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"
REAL( DFP ), ALLOCATABLE :: value(:, :)
INTEGER( I4B ) ::tNodes
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 )
!> set multiple entries
CALL Reallocate(value, timeCompo, 5)
CALL RANDOM_NUMBER(value)
CALL obj%set( value=value, globalNode=arange(1,10,2) )
CALL display(transpose(value(:, 1:5)), "value(:, 1:10) = " )
CALL obj%display( "obj = ")
call obj%Deallocate()
call dom%Deallocate()
call param%Deallocate()
call FPL_FINALIZE()
end program main
value(:, 1:10) =
------------------
0.342982 0.188825
0.445002 0.148488
0.201990 0.782645
0.099369 0.353710
0.248980 0.880695
#obj =
# isInitiated : TRUE
# name :U
# fieldType : NORMAL
# engine :LIS_OMP
# comm: 0
# myRank: 0
# numProcs: 1
# global_n: 62
# local_n: 62
# is: 1
# ie: 63
# lis_ptr: 94584136927984
# domain : ASSOCIATED
# domains : NOT ALLOCATED
# tSize : 62
# # DOF data :
# Total Physical Variables :1
# Name : U
# Space Components : 1
# Time Components : 2
# Total Nodes : 31
# Storage Format : Nodes
# Value Map :
--------------
1
32
63
# VAR :U
DOF-1 , DOF-2 ,
-------, -------,
0.34298, 0.18882,
0.00000, 0.00000,
0.44500, 0.14849,
0.00000, 0.00000,
0.20199, 0.78265,
0.00000, 0.00000,
0.09937, 0.35371,
0.00000, 0.00000,
0.24898, 0.88070,
Interface 9
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE Set9(obj, VALUE, globalNode, timeCompo, scale, &
& addContribution)
CLASS(STScalarFieldLis_), INTENT(INOUT) :: obj
REAL(DFP), INTENT(IN) :: VALUE(:)
INTEGER(I4B), INTENT(IN) :: globalNode(:)
INTEGER(I4B), INTENT(IN) :: timeCompo
REAL(DFP), OPTIONAL, INTENT(IN) :: scale
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: addContribution
END SUBROUTINE Set9
END INTERFACE
This routine sets the selected components of selected nodes to given value.
STScalar( timeCompo, globalNode ) = value( 1:SIZE(globalNode) )
size of globalNode should be equal to the size of value.
In this example we test Set method.
In this example we set multiple entries.
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"
REAL( DFP ), ALLOCATABLE :: value(:, :)
INTEGER( I4B ) ::tNodes
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 )
!> set multiple entries
CALL Reallocate(value, timeCompo, 5)
CALL RANDOM_NUMBER(value)
CALL obj%set( value=value(1,:), globalNode=arange(1,10,2), timeCompo=1 )
CALL obj%set( value=value(2,:), globalNode=arange(1,10,2), timeCompo=2 )
CALL display(transpose(value(:, 1:5)), "value = " )
CALL obj%display( "obj = ")
call obj%Deallocate()
call dom%Deallocate()
call param%Deallocate()
call FPL_FINALIZE()
end program main
value =
------------------
0.292455 0.677448
0.968783 0.509839
0.287100 0.279204
0.225393 0.909298
0.249951 0.347530
#obj =
# isInitiated : TRUE
# name :U
# fieldType : NORMAL
# engine :LIS_OMP
# comm: 0
# myRank: 0
# numProcs: 1
# global_n: 62
# local_n: 62
# is: 1
# ie: 63
# lis_ptr: 94207269784304
# domain : ASSOCIATED
# domains : NOT ALLOCATED
# tSize : 62
# # DOF data :
# Total Physical Variables :1
# Name : U
# Space Components : 1
# Time Components : 2
# Total Nodes : 31
# Storage Format : Nodes
# Value Map :
--------------
1
32
63
# VAR :U
DOF-1 , DOF-2 ,
-------, -------,
0.29245, 0.67745,
0.00000, 0.00000,
0.96878, 0.50984,
0.00000, 0.00000,
0.28710, 0.27920,
0.00000, 0.00000,
0.22539, 0.90930,
0.00000, 0.00000,
0.24995, 0.34753,
Interface 10
INTERFACE
MODULE SUBROUTINE Set10(obj, VALUE, globalNode, timeCompo, scale, &
& addContribution)
CLASS(STScalarFieldLis_), INTENT(INOUT) :: obj
REAL(DFP), INTENT(IN) :: VALUE
INTEGER(I4B), INTENT(IN) :: globalNode
INTEGER(I4B), INTENT(IN) :: timeCompo
REAL(DFP), OPTIONAL, INTENT(IN) :: scale
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: addContribution
END SUBROUTINE Set10
END INTERFACE
- This routine sets the single entry of a given time components.
Interface 11
INTERFACE
MODULE SUBROUTINE Set11(obj, VALUE, istart, iend, stride, scale, &
& addContribution)
CLASS(STScalarFieldLis_), 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 Set11
END INTERFACE
- Set multiple entries using triad
The size of value should be equal to obj%timeCompo
Interface 12
INTERFACE
MODULE SUBROUTINE Set12(obj, VALUE, istart, iend, stride, scale, &
& addContribution)
CLASS(STScalarFieldLis_), INTENT(INOUT) :: obj
REAL(DFP), INTENT(IN) :: VALUE(:, :)
INTEGER(I4B), INTENT(IN) :: istart
INTEGER(I4B), INTENT(IN) :: iend
INTEGER(I4B), INTENT(IN) :: stride
REAL(DFP), OPTIONAL, INTENT(IN) :: scale
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: addContribution
END SUBROUTINE Set12
END INTERFACE
- Set multiple entries using triad
The number of rows in value should be equal to obj%timeCompo
The number of cols in value should be equal to size of istart:iend:stride
Interface 13
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE Set13(obj, VALUE, globalNode, scale, &
& addContribution)
CLASS(STScalarFieldLis_), INTENT(INOUT) :: obj
TYPE(FEVariable_), INTENT(IN) :: VALUE
INTEGER(I4B), INTENT(IN) :: globalNode(:)
REAL(DFP), OPTIONAL, INTENT(IN) :: scale
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: addContribution
END SUBROUTINE Set13
END INTERFACE
- Set the value by using FEVariable
In this example we test Set method.
In this example we set multiple entries by using FEVariable
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"
TYPE(FEVariable_) :: fevar
REAL( DFP ), ALLOCATABLE :: value(:, :)
INTEGER( I4B ) ::tNodes
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 )
!> set multiple entries
CALL Reallocate(value, timeCompo, 5)
CALL RANDOM_NUMBER(value)
fevar = NodalVariable(value, TypeFEVariableScalar, TypeFEVariableSpaceTime)
CALL obj%set( value=fevar, globalNode=arange(1,10,2) )
CALL Display(fevar, "fevar = ")
CALL obj%display( "obj = ")
call obj%Deallocate()
call dom%Deallocate()
call param%Deallocate()
call FPL_FINALIZE()
CALL Deallocate(fevar)
end program main
fevar =
# RANK :: 0 (SCALAR)
# VarType: SPACE & TIME
# VALUE:
------------------------------------------------
0.364310 0.982040 0.642988 0.875825 0.827356
0.736854 0.852561 0.825102 0.919856 0.946324
#obj =
# isInitiated : TRUE
# name :U
# fieldType : NORMAL
# engine :LIS_OMP
# comm: 0
# myRank: 0
# numProcs: 1
# global_n: 62
# local_n: 62
# is: 1
# ie: 63
# lis_ptr: 93943052417776
# domain : ASSOCIATED
# domains : NOT ALLOCATED
# tSize : 62
# # DOF data :
# Total Physical Variables :1
# Name : U
# Space Components : 1
# Time Components : 2
# Total Nodes : 31
# Storage Format : Nodes
# Value Map :
--------------
1
32
63
# VAR :U
DOF-1 , DOF-2 ,
-------, -------,
0.36431, 0.73685,
0.00000, 0.00000,
0.98204, 0.85256,
0.00000, 0.00000,
0.64299, 0.82510,
0.00000, 0.00000,
0.87583, 0.91986,
0.00000, 0.00000,
0.82736, 0.94632,
Interface 14
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE Set14(obj, VALUE, scale, addContribution)
CLASS(STScalarFieldLis_), INTENT(INOUT) :: obj
REAL(DFP), INTENT(IN) :: VALUE
REAL(DFP), OPTIONAL, INTENT(IN) :: scale
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: addContribution
END SUBROUTINE Set14
END INTERFACE
- Set all the values of STScalarField to a scalar value
Value
In this example we test Set method.
In this example we set all entries.
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
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 )
call obj%set(value=2.0_DFP)
CALL obj%display( "obj = ")
call obj%Deallocate()
call dom%Deallocate()
call param%Deallocate()
call FPL_FINALIZE()
end program main
#obj =
# isInitiated : TRUE
# name :U
# fieldType : NORMAL
# engine :LIS_OMP
# comm: 0
# myRank: 0
# numProcs: 1
# global_n: 62
# local_n: 62
# is: 1
# ie: 63
# lis_ptr: 93898635594480
# domain : ASSOCIATED
# domains : NOT ALLOCATED
# tSize : 62
# # DOF data :
# Total Physical Variables :1
# Name : U
# Space Components : 1
# Time Components : 2
# Total Nodes : 31
# Storage Format : Nodes
# Value Map :
--------------
1
32
63
# VAR :U
DOF-1 , DOF-2 ,
-------, -------,
2.00000, 2.00000,
2.00000, 2.00000,
2.00000, 2.00000,
2.00000, 2.00000,
2.00000, 2.00000,