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.
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( : )
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 )
set single value
CALL obj%set( globalnode = 10, value= 100.0_dfp )
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.000,
0.000,
0.000,
0.000,
0.000,
0.000,
0.000,
0.000,
0.000,
100.000,
0.000,
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 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.
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( : )
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
CALL obj%set( value= 200.0_DFP )
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 ,
-------,
200.000,
200.000,
200.000,
200.000,
200.000,
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