Skip to main content

easifemBase

As the name suggests easifemBase (henceforth, read as Base) library is the lowest (or, base) level component in easifem. It contains a lot of valuable routines and derived types. In Base library, we do not use object-oriented programming concepts and mainly use multiple dispatch approach. This approach improves the flexibility and speed of easifemBase. All user-defined datatypes are declared in the BaseType module, and all methods are exposed through `BaseMethods modules.

info

In the Base library string_class is the only exception, wherein Object-oriented paradigm has been used.

note

Currently, easifemBase has interface with BLAS95, Lapack95, Sparsekit, Metis, PlPlot, SuperLU, ARPACK, etc.

Use association

USE easifemBase

or

USE BaseType
USE BaseMethods

Installation

Before installing the Base library please install the requirements and external pkgs.

Step-1: Install the easifem command line application by using:

python3 -m pip install --upgrade easifem

Step-2: Set the environment variables by specifying the src, build, and install directory as shown below:

easifem setenv --install <install directory> --build <build directory> --source <source directory>
source ~/.config/easifem/easifemvar.sh

You can find detailed information here.

Step-3: If you have not installed the extpkgs, then you can install them by running:

easifem install extpkgs

Step-4: Now, you can install the Base library by:

easifem install base

CMake

Download the source code:

git clone https://github.com/vickysharma0812/easifem-base.git

or

git clone git@github.com:vickysharma0812/easifem-base.git

or

gh repo clone vickysharma0812/easifem-base

After downloading the source code, enter the source directory, and make a build directory.

cd easifem-base
mkdir ./build

EASIFEM uses CMake build system. You can install the Base library from CMake by using following steps

  1. Configuration
  2. Build
  3. Install

To configure the Base library you can define following variables:

VariableTypeOptions
USE_OpenMPBOOLON, OFF
CMAKE_BUILD_TYPESTRINGRelease, Debug
BUILD_SHARED_LIBSBOOLON, OFF
USE_PLPLOTBOOLON, OFF
CMAKE_INSTALL_PREFIXPATH
USE_BLAS95BOOLON, OFF
USE_LAPACK95BOOLON, OFF
USE_FFTWBOOLON, OFF
USE_GTKBOOLON, OFF
USE_ARPACKBOOLON, OFF
USE_SUPERLUBOOLON, OFF
USE_LISBOOLON, OFF
USE_PARPACKBOOLON, OFF
USE_METISBOOLON, OFF
USE_Int32BOOLON, OFF
USE_Real64BOOLON, OFF

An example of configuration step is given below:

export EASIFEM_BASE=${HOME}/.local/easifem/base
cmake -G "Ninja" -S ./ -B ./build \
-D USE_OpenMP:BOOL=ON \
-D CMAKE_BUILD_TYPE:STRING=Release \
-D BUILD_SHARED_LIBS:BOOL=ON \
-D USE_PLPLOT:BOOL=ON \
-D CMAKE_INSTALL_PREFIX:PATH=${EASIFEM_BASE} \
-D USE_BLAS95:BOOL=ON \
-D USE_LAPACK95:BOOL=ON \
-D USE_FFTW:BOOL=ON \
-D USE_GTK:BOOL=ON \
-D USE_ARPACK:BOOL=ON \
-D USE_PARPACK:BOOL=ON \
-D USE_METIS:BOOL=ON \
-D USE_Int32:BOOL=ON \
-D USE_Real64:BOOL=ON

After configuration, you can build and install the library by using:

cmake --build ./build --target --install

Structure

The Base library consists two components:

  1. BaseType BaseType.F90, which contains the user-defined data-type
  2. BaseMethods BaseMethods.F90, contains the modules (each module defines the routines for data-types defined in BaseType.F90.)

The source directory is shown in figure given below. The source directory has two directories

  1. 📁 modules
  2. 📁 submodules

The modules directory mainly contains header and interface of methods. The implementation is given in submodules directory.

info

Both BaseType.F90 and BaseMethods.F90 are included in modules directory.

Let us understand the structure of the Base library by an example of CSRSparsity_ data type.

  1. First, we define CSRSparsity_ in BaseType.F90 as
  1. Then we create a directory called CSRSparsity in both modules and submodules directory.
  2. In modules/CSRSparsity we create CSRSparsity_Method.F90 file.
  3. In modules/CSRSparsity/CSRSparsity_Method.F90 we define a module CSRSparsity_Method (same name as file).
  4. In CSRSparsity_Method module, we only define interface of methods. In this way, this file can be considered as header file. See, the example given below:
  5. In submodules/CSRSparsity, we create CSRSparsity_Method@ConstructorMethods.F90, which contains the contruction related routines.
  6. Also, we create CSRSparsity_Method@IOMethods.F90, which include methods related to input and output.

BaseType

BaseType contains user-define data type.

Data-typeSummaryCategory
Math_Contains mathematical constants.Math
BoundingBox_Data type for bounding box.FEM
RealMatrix_Extension for Fortran two-d arrayMatrix
IntVector_Vector of integers.Vector
RealVector_Vector of realsVector
Vector3D_3D VectorVector
IndexValue_Key (integer) and value (real), useful for defining nodal boundary conditionsFEM
DOF_Degree of freedom object typeFEM
SparseMatixReOrdering_Sparse matrix reordering schemeLinearAlgebra
CSRSparisty_Datatype for handling sparsity patternLinearAlgebra
SuperLU_SuperLU data structure.LinearAlgebra
CSRMatrix_Compressed sparse row matrixLinearAlgebra
IterationData_Datatype for storing iteration dataFEM
VoigtRank2Tensor_Rank2 tensorTensor
DeformationGradient_Deformation Gradient tensorTensor
LeftCauchyGreen_Left Cauchy Green tensorTensor
RightCauchyGreen_Right Cauchy Green tensorTensor
Strain_Strain tensorTensor
AlmansiStrain_Almansi strainTensor
GreenStrain_Green strain tensorTensor
SmallStrain_Small strain tensor.Tensor
ReferenceTopology_Data type for handling reference element in FEMFEM
ReferenceElement_Data type for reference element in FEMFEM
ReferencePoint_Data type for reference point in FEMFEM
ReferenceLine_Data type for reference line in FEMFEM
ReferenceTriangle_Data type for reference triangle in FEMFEM
ReferenceQuadrangle_Data type for reference quadrangle in FEMFEM
ReferenceTetrahedron_Data type for reference tetrahedron in FEMFEM
ReferenceHexahedron_Data type for reference hexahedron in FEMFEM
ReferencePrism_Data type for reference prism in FEMFEM
ReferencePyramid_Data type for reference pyramid in FEMFEM
KeyValue_Poor man's implementation of dic.Container
FEVariable_Data type for finite element variables.FEM
FEVariableConstant_Constant finite element variableFEM
FEVariableSpace_Spatially variable finite element variableFEM
FEVariableTime_Time variable finite element variableFEM
FEVariableSpaceTime_Spatially and temporally changing finite element variableFEM
FEVariableScalar_Scalar finite element variableFEM
FEVariableVector_Vector finite element variableFEM
FEVariableMatrix_Matrix finite element variableFEM
QuadraturePoint_Quadrature pointsFEM
BaseInterpolation_Data type for basis interpolationFEM
LagrangeInterpolation_Lagrange interpolationFEM
HermitInterpolation_Hermit interpolationFEM
SerendipityInterpolation_Serendipity interpolationFEM
HierarchyInterpolation_Hierarchical interpolationFEM
BaseContinuity_Continuity type of basis functions.FEM
H1_H1 finite element basisFEM
H1DIV_H1(Div) finite element basisFEM
H1Curl_H1(Curl) finite element basisFEM
DG_Discontinuous Galerkin finite element basisFEM
ElementData_Data necessary for creating finite element.FEM
ShapeData_Storage for shape dataFEM
STShapeData_Space-time shape function dataFEM
ElemshapeData_Element shape function dataFEM
STElemShapeData_Space-time element shape data.FEM
QualityMeasure_Datatype for mesh quality measureFEM
Random_Data type for random variablesFEM
OpenMP_Data type for OpenMP parallel environmentFEM
MultiIndices_Data type for multi indicesFEM

BaseMethods

BaseMethods library contains the modules which defines and implements methods (routines) for data types defined in BaseType.

At present BaseMethods contains following modules.

ModuleCommentCategory
String_ClassDefines String class and methods.String
String_MethodAdditional methods for handling strings.String
PENFFor portability.OS
BeFoR64For portability.OS
FACEColorful console printing.IO
FPLFortran parameter listUtility
System_MethodInterface to C system libray.OS
CInterfaceUtility for C-Fortran interface building.OS
OpenMP_MethodMethods which uses OpenMP for acceleration.Misc
GlobalDataGlobalData for easifem libraryMisc
Hashing32Hash functions.Utility, Crypto
OGPFGnuplot libraryPlot
Test_MethodUnit testing libraryTest
MdEncode_MethodEncoding text into markdown.IO
DispModulePretty printing on terminal.IO
Display_MethodPretty printing on terminal.IO
ErrorHandlingException handling.ExceptionHandling
UtilityUtility module.Utility
PolynomialUtilityCollection of useful routine for polynomial interpolation.Basis
BaseTypeCollection of user define data types.Core
MultiIndices_MethodMethods for MultiIndices_.Math
Random_MethodMethods for Random_ data type.Math
BoundingBox_MethodMethods for BoundingBox_ data typeMath
IntVector_MethodMethods for IntVector_ data typeVector
IndexValue_MethodMethods for IndexValue_ data typeFEM
IterationData_MethodMethods for IterationData_ data type.FEM
Vector3D_MethodMethods for Vector3D_ data type.Vector
RealVector_MethodMethods for RealVector_ data typeVector
DOF_MethodMethods for DOF_ data typeFEM
Geometry_MethodGeometry realted methods.Math
QuadraturePoint_MethodMethods for QuadraturePoint_ data type.FEM
FEVariable_MethodMethods for FEVariable_ data typeFEM
ElemshapeData_MethodMethods for ElemshapeData_ data type.FEM
RealMatrix_MethodMethods for RealMatrix_ data type.Matrix
FEMatrix_MethodMethods for FEMatrix_ data type.FEM
FEVector_MethodMethods for FEVector_ data type.FEM
Rank2Tensor_MethodMethods for Rank2Tensor_ data type.Tensor
VoigtRank2Tensor_MethodMethods for VoigtRank2Tensor_ data type.Tensor
CSRSparisty_MethodMethods for CSRSparisty_ data type.Matrix
CSRMatrix_MethodMethods for CSRMatrix_ data type.Matrix
SuperLUInterfaceFortran interface to SuperLU libLinearSolver
LISInterfaceFortran interface to LIS libLinearSolver
F77_BLASF77 interface to BLAS.LinearAlgebra
F95_BLASFortran 95 interface to BLAS lib.LinearAlgebra
F77_LAPACKFortran interface to Lapack.LinearAlgebra
F95_LAPACKFortran 95 interface to Lapack lib.LinearAlgebra
Lapack_MethodMethods for linear algebra by using Lapack.LinearAlgebra
EASIFEM_ARPACKFortran interface to ARPACK.LinearAlgebra
FFTW3Fast fourer tranform libraryLinearAlgebra
MetisInterfaceFortran interface to Metis library.LinearAlgebra