Skip to content

Commit

Permalink
Merge pull request #162 from vickysharma0812/dev
Browse files Browse the repository at this point in the history
Updates in Fields and FiniteElements
  • Loading branch information
vickysharma0812 authored Sep 26, 2023
2 parents 08dd52e + 4cf208b commit bf37b5f
Show file tree
Hide file tree
Showing 106 changed files with 9,209 additions and 3,788 deletions.
5 changes: 4 additions & 1 deletion install.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3

# This program is a part of EASIFEM library.
# See. www.easifem.com
# Copyright (c) 2020-2021, All right reserved, Vikas Sharma, Ph.D.
Expand Down Expand Up @@ -25,7 +27,8 @@
print("CMAKE DEF : ", cmake_def)
_build0 = os.path.join(os.environ["HOME"], "temp")
build_dir = os.path.join(
os.environ.get("EASIFEM_BUILD_DIR", _build0), "easifem", "classes", "build"
os.environ.get("EASIFEM_BUILD_DIR",
_build0), "easifem", "classes", "build"
)
# build_dir = os.environ["HOME"] + "/temp/easifem-base/build"
os.makedirs(build_dir, exist_ok=True)
Expand Down
128 changes: 104 additions & 24 deletions src/modules/AbstractField/src/AbstractField_Class.F90
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,8 @@ MODULE AbstractField_Class
INTEGER(I4B), PARAMETER, PUBLIC :: FIELD_TYPE_CONSTANT = 2
INTEGER(I4B), PARAMETER, PUBLIC :: FIELD_TYPE_CONSTANT_SPACE = 3
INTEGER(I4B), PARAMETER, PUBLIC :: FIELD_TYPE_CONSTANT_TIME = 4
! CHARACTER( LEN = * ), PARAMETER, PUBLIC :: FIELD_TYPE_NAME( 4 ) = &
! & [ &
! & "NORMAL ", &
! & "CONSTANT ", &
! & "CONSTANT_SPACE", &
! & "CONSTANT_TIME " &
! & ]

CHARACTER(*), PARAMETER :: modName = "AbstractField_Class"
PUBLIC :: AbstractFieldInitiate

!----------------------------------------------------------------------------
! AbstractField_
Expand All @@ -66,19 +59,19 @@ MODULE AbstractField_Class

TYPE, ABSTRACT :: AbstractField_
LOGICAL(LGT) :: isInitiated = .FALSE.
!! It is true if the object is initiated
!! It is true if the object is initiated
INTEGER(I4B) :: fieldType = FIELD_TYPE_NORMAL
!! fieldType can be normal, constant, can vary in space and/ or both.
!! fieldType can be normal, constant, can vary in space and/ or both.
TYPE(String) :: name
!! name of the field
!! name of the field
TYPE(String) :: engine
!! Engine of the field, for example
!! NATIVE_SERIAL
!! NATIVE_OMP,
!! NATIVE_MPI,
!! PETSC,
!! LIS_OMP,
!! LIS_MPI
!! Engine of the field, for example
!! NATIVE_SERIAL
!! NATIVE_OMP,
!! NATIVE_MPI,
!! PETSC,
!! LIS_OMP,
!! LIS_MPI
INTEGER(I4B) :: comm = 0_I4B
!! communication group (MPI)
INTEGER(I4B) :: myRank = 0_I4B
Expand All @@ -97,13 +90,13 @@ MODULE AbstractField_Class
!! lis_ptr is pointer returned by the LIS library
!! It is used when engine is LIS_OMP or LIS_MPI
TYPE(Domain_), POINTER :: domain => NULL()
!! Domain contains the information of the finite element meshes.
!! Domain contains the information of the finite element meshes.
TYPE(DomainPointer_), ALLOCATABLE :: domains(:)
!! Domain for each physical variables
!! The size of `domains` should be equal to the total number of
!! physical variables.
!! It is used in the case of BlockNodeField
!! and BlockMatrixField
!! Domain for each physical variables
!! The size of `domains` should be equal to the total number of
!! physical variables.
!! It is used in the case of BlockNodeField
!! and BlockMatrixField
CONTAINS
PRIVATE
PROCEDURE(aField_checkEssentialParam), DEFERRED, PUBLIC, PASS(obj) :: &
Expand Down Expand Up @@ -131,6 +124,18 @@ MODULE AbstractField_Class
GENERIC, PUBLIC :: WriteData => WriteData_vtk, WriteData_hdf5
PROCEDURE, PASS(obj), NON_OVERRIDABLE, PUBLIC :: GetParam
PROCEDURE, PASS(obj), NON_OVERRIDABLE, PUBLIC :: SetParam
PROCEDURE, PUBLIC, PASS(obj) :: GetSpaceCompo => aField_GetSpaceCompo
!! Return space component
!! INFO: This routine should be implemented by child classes
PROCEDURE, PUBLIC, PASS(obj) :: GetTimeCompo => aField_GetTimeCompo
!! Return time component
!! INFO: This routine should be implemented by child classes
PROCEDURE, PUBLIC, PASS(obj) :: GetStorageFMT => aField_GetStorageFMT
!! Return storage format
!! INFO: This routine should be implemented by child classes
PROCEDURE, PUBLIC, PASS(obj), NON_OVERRIDABLE :: isConstant &
& => aField_isConstant
!! It returns true if the field is constant field
END TYPE AbstractField_

PUBLIC :: AbstractField_
Expand Down Expand Up @@ -168,6 +173,23 @@ SUBROUTINE aField_Initiate1(obj, param, dom)
END SUBROUTINE aField_Initiate1
END INTERFACE

!----------------------------------------------------------------------------
! Initiate
!----------------------------------------------------------------------------

!> authors: Vikas Sharma, Ph. D.
! date: 2023-09-22
! summary: Initiate the field by reading param and given domain

INTERFACE
MODULE SUBROUTINE AbstractFieldInitiate(obj, param, dom, prefix)
CLASS(AbstractField_), INTENT(INOUT) :: obj
TYPE(ParameterList_), INTENT(IN) :: param
TYPE(Domain_), TARGET, INTENT(IN) :: dom
CHARACTER(*), INTENT(IN) :: prefix
END SUBROUTINE AbstractFieldInitiate
END INTERFACE

!----------------------------------------------------------------------------
! InitiateByCopy
!----------------------------------------------------------------------------
Expand Down Expand Up @@ -424,4 +446,62 @@ MODULE SUBROUTINE GetParam(obj, &
END SUBROUTINE GetParam
END INTERFACE

!----------------------------------------------------------------------------
! GetSpaceCompo
!----------------------------------------------------------------------------

!> author: Vikas Sharma, Ph. D.
! date: 2023-09-22
! summary: Returns space components

INTERFACE
MODULE FUNCTION aField_GetSpaceCompo(obj) RESULT(ans)
CLASS(AbstractField_), INTENT(IN) :: obj
INTEGER(I4B), ALLOCATABLE :: ans(:)
END FUNCTION aField_GetSpaceCompo
END INTERFACE

!----------------------------------------------------------------------------
! GetTimeCompo
!----------------------------------------------------------------------------

!> author: Vikas Sharma, Ph. D.
! date: 2023-09-22
! summary: Returns Time components

INTERFACE
MODULE FUNCTION aField_GetTimeCompo(obj) RESULT(ans)
CLASS(AbstractField_), INTENT(IN) :: obj
INTEGER(I4B), ALLOCATABLE :: ans(:)
END FUNCTION aField_GetTimeCompo
END INTERFACE

!----------------------------------------------------------------------------
! GetStorageFMT
!----------------------------------------------------------------------------

!> author: Vikas Sharma, Ph. D.
! date: 2023-09-22
! summary: Returns storage format

INTERFACE
MODULE FUNCTION aField_GetStorageFMT(obj) RESULT(ans)
CLASS(AbstractField_), INTENT(IN) :: obj
INTEGER(I4B) :: ans
END FUNCTION aField_GetStorageFMT
END INTERFACE

!----------------------------------------------------------------------------
! isConstant
!----------------------------------------------------------------------------

!> author: Vikas Sharma, Ph. D.
! date: 2023-09-22
! summary: Returns true if the field is constant
INTERFACE
MODULE FUNCTION aField_isConstant(obj) RESULT(ans)
CLASS(AbstractField_), INTENT(IN) :: obj
LOGICAL(LGT) :: ans
END FUNCTION aField_isConstant
END INTERFACE
END MODULE AbstractField_Class
47 changes: 28 additions & 19 deletions src/modules/AbstractMeshField/src/AbstractMeshField_Class.F90
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

MODULE AbstractMeshField_Class
USE GlobalData
USE BaseType
USE BaSetype
USE String_Class, ONLY: String
USE FPL, ONLY: ParameterList_
USE Mesh_Class, ONLY: Mesh_
Expand All @@ -27,6 +27,13 @@ MODULE AbstractMeshField_Class
IMPLICIT NONE
PRIVATE
CHARACTER(*), PARAMETER :: modName = "AbstractMeshField_Class"
PUBLIC :: AbstractMeshField_
PUBLIC :: AbstractMeshFieldPointer_
PUBLIC :: SetAbstractMeshFieldParam
PUBLIC :: AbstractFieldCheckEssentialParam
PUBLIC :: AbstractMeshFieldDeallocate
PUBLIC :: AbstractMeshFieldInitiate
PUBLIC :: DEALLOCATE

!----------------------------------------------------------------------------
! AbstractMeshField_
Expand Down Expand Up @@ -96,7 +103,7 @@ MODULE AbstractMeshField_Class
!! Export data in vtkFile
PROCEDURE, PUBLIC, PASS(obj) :: DEALLOCATE => aField_Deallocate
!! Deallocate the field
PROCEDURE, PUBLIC, PASS(obj) :: getPointer => aField_getPointer
PROCEDURE, PUBLIC, PASS(obj) :: GetPointer => aField_getPointer
!! Return pointer to val
PROCEDURE, PUBLIC, PASS(obj) :: Size => aField_Size
!! Returns size
Expand All @@ -110,8 +117,6 @@ MODULE AbstractMeshField_Class
!! Getting the value
END TYPE AbstractMeshField_

PUBLIC :: AbstractMeshField_

!----------------------------------------------------------------------------
!
!----------------------------------------------------------------------------
Expand All @@ -120,18 +125,16 @@ MODULE AbstractMeshField_Class
CLASS(AbstractMeshField_), POINTER :: ptr => NULL()
END TYPE AbstractMeshFieldPointer_

PUBLIC :: AbstractMeshFieldPointer_

!----------------------------------------------------------------------------
! setAbstractMeshFieldParam@ConstructorMethods
! SetAbstractMeshFieldParam@ConstructorMethods
!----------------------------------------------------------------------------

!> authors: Vikas Sharma, Ph. D.
! date: 17 Feb 2022
! summary: This routine check the essential parameters in param.

INTERFACE
MODULE SUBROUTINE setAbstractMeshFieldParam(param, prefix, name, &
MODULE SUBROUTINE SetAbstractMeshFieldParam(param, prefix, name, &
& fieldType, engine, defineOn, varType, rank, s)
TYPE(ParameterList_), INTENT(INOUT) :: param
CHARACTER(*), INTENT(IN) :: prefix
Expand All @@ -142,11 +145,9 @@ MODULE SUBROUTINE setAbstractMeshFieldParam(param, prefix, name, &
INTEGER(I4B), INTENT(IN) :: varType
INTEGER(I4B), INTENT(IN) :: rank
INTEGER(I4B), INTENT(IN) :: s(:)
END SUBROUTINE setAbstractMeshFieldParam
END SUBROUTINE SetAbstractMeshFieldParam
END INTERFACE

PUBLIC :: setAbstractMeshFieldParam

!----------------------------------------------------------------------------
! checkEssentialParam@ConstructorMethods
!----------------------------------------------------------------------------
Expand Down Expand Up @@ -178,8 +179,6 @@ MODULE SUBROUTINE AbstractFieldCheckEssentialParam(obj, prefix, param)
END SUBROUTINE AbstractFieldCheckEssentialParam
END INTERFACE

PUBLIC :: AbstractFieldCheckEssentialParam

!----------------------------------------------------------------------------
! Deallocate@ConstructorMethods
!----------------------------------------------------------------------------
Expand All @@ -198,7 +197,19 @@ END SUBROUTINE aField_Deallocate
MODULE PROCEDURE aField_Deallocate
END INTERFACE AbstractMeshFieldDeallocate

PUBLIC :: AbstractMeshFieldDeallocate
!----------------------------------------------------------------------------
! Deallocate@ConstructorMethods
!----------------------------------------------------------------------------

!> author: Vikas Sharma, Ph. D.
! date: 2023-09-12
! summary: Deallocate the vector of NeumannBC_

INTERFACE DEALLOCATE
MODULE SUBROUTINE aField_Deallocate_Ptr_Vector(obj)
TYPE(AbstractMeshFieldPointer_), ALLOCATABLE :: obj(:)
END SUBROUTINE aField_Deallocate_Ptr_Vector
END INTERFACE DEALLOCATE

!----------------------------------------------------------------------------
! Initiate@ConstructorMethods
Expand Down Expand Up @@ -233,8 +244,6 @@ MODULE SUBROUTINE AbstractMeshFieldInitiate(obj, prefix, param, mesh)
END SUBROUTINE AbstractMeshFieldInitiate
END INTERFACE

PUBLIC :: AbstractMeshFieldInitiate

!----------------------------------------------------------------------------
! Initiate@ConstructorMethods
!----------------------------------------------------------------------------
Expand All @@ -255,18 +264,18 @@ END SUBROUTINE aField_Initiate2
END INTERFACE

!----------------------------------------------------------------------------
! getPointer@ConstructorMethods
! GetPointer@ConstructorMethods
!----------------------------------------------------------------------------

!> authors: Vikas Sharma, Ph. D.
! date: 17 Feb 2022
! summary: Returns the pointer to a fortran real vector stored inside realVec

INTERFACE
MODULE FUNCTION aField_getPointer(obj) RESULT(ans)
MODULE FUNCTION aField_GetPointer(obj) RESULT(ans)
CLASS(AbstractMeshField_), TARGET, INTENT(IN) :: obj
REAL(DFP), POINTER :: ans(:, :)
END FUNCTION aField_getPointer
END FUNCTION aField_GetPointer
END INTERFACE

!----------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit bf37b5f

Please sign in to comment.