Skip to main content

easifemClasses

The easifemClasses (henceforth, the Classes) library, forms the second level of EASIFEM library. This library contains many useful high-level objects, which are important for implementing FEM. The main programming paradigm of Classes library is object-oriented programming.

Use association

USE easifemClasses

Installation

Before installing the Classes library please install:

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

Step-5: Now, you can install the Classes library by:

easifem install classes
note

You can combine step-3 to step-5 by using:

easifem install extpkgs base classes

CMake

Download the source code:

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

or

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

or

gh repo clone vickysharma0812/easifem-classes

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

cd easifem-classes
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
CMAKE_INSTALL_PREFIXPATH
USE_GMSH_SDKBOOLON, OFF

An example of configuration step is given below:

export EASIFEM_CLASSES=${HOME}/.local/easifem/classes
cmake -G "Ninja" -S ./ -B ./build \
-D USE_OpenMP:BOOL=ON \
-D CMAKE_BUILD_TYPE:STRING=Release \
-D BUILD_SHARED_LIBS:BOOL=ON \
-D CMAKE_INSTALL_PREFIX:PATH=${EASIFEM_CLASSES} \
-D USE_GMSH_SDK:BOOL=ON

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

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

Structure

Similar to the Base library, the Classes library has two directories in the src directory:

  1. modules
  2. submodules

The modules directory mainly contains following items:

  1. Type definition including methods
  2. Header and interface of methods

The 📁submodules directory contains the implementation of the methods that are defined in the modules directory.

  • In addition, each class has its own subdirectory in the modules and submodules directory.
  • For example, the directory of Domain_ class is Domain, the directory of Mesh_ class is Mesh.
  • In this way, modules/Domain will define the Domain_ class and interface of methods, whereas submodules/Domain will include the submodules that implementes the methods defined inside modules.
  • The name of the module which defines Domain_ class is Domain_Classs, and it is included in the file called Domain_Class.F90.
  • The submodule, which defines methods (for example, constructor methods) will be included in Domain_Class@ConstructorMethods.F90, Domain_Class@IOMethods, etc.
info

If you want to implement a class called XXX_, then perform following task:

  1. Make a subdirectory XXX in src/modules and src/submodules
  2. In both XXX make a subdirectory XXX/src
  3. Create a file modules/XXX/src/XXX_Class.F90 and define a module called XXX_Class:
  4. Create submodules in submodule/XXX/src/XXX_Class@CategoryofMethods.F90 and implement the methods.
MODULE XXX_Class
!! Use modules
PRIVATE
!! Define class here
END MODULE XXX_Class

Modules

easifemClasses currently contains following modules:

ModuleCommentCategory
Gmsh_ClassInterface to Gmsh libraryMesh
CommandLine_MethodFortran library for making comand line applications.CLI
ExceptionHandling_ClassFortran library for error handlingUtility
FPL_MethodFortran parameter listFEM
FilesCollection of modules related to File IO.IO
ElementFactoryFinite element factoryFEM
IntList_ClassLinked list of integersContainer
RealList_ClassLinked list of realsContainer
StringList_ClassLinked list of stringsContainer
ElementList_ClassLinked list of finite elementsFEM
ElementPointerVector_ClassDynamic vector of element pointersFEM
Mesh_ClassFinite element mesh classFEM
MeshPointerVector_ClassDynamic vector of mesh pointersFEM
Domain_ClassDomain classFEM
DomainUtilityA module for additional methods on Domain.FEM
DomainConnectivity_ClassDomain connectivity classFEM
MeshSelection_ClassA class for selecting the region of domain.FEM
MSHFile_ClassClass for Gmsh`s msh fileFEM
AbstractVector_ClassAbstract class for vectors.FEM
Vector_ClassConcrete class for vectors.FEM
FieldCollection of modules which defines classes for finite element fields.FEM
FieldFactoryFactory for fieldsFEM
AbstractLinSolver_ClassAbstract class for linear solverFEM
LinSolver_ClassNative linear solver class.FEM
LinSolver_FactoryFactory for linear solvers.FEM
AbstractBC_ClassAbstract class for boundary conditionsFEM
DirichletBC_ClassClass for Dirichlet boundary conditions.FEM
NeumannBC_ClassClass for Neumann boundary conditions.FEM
NitscheBC_ClassClass for Nitsche boundary conditions.FEM
PolynomialFactoryFactory of polynomialsFEM
UserFunction_ClassUser function classFEM
RefElementFactoryFactory of reference elementsFEM
FiniteElementFactoryFactory of finite elements.FEM
Tree3R_ClassTree data structure for 3 term recurrence relation.Math
Plot_MethodCollection of methods for plotting.FEM