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:
- requirements
- external pkgs
- base library.
EASIFEM cli (recommended method)
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
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
- Configuration
- Build
- Install
To configure the Base
library you can define following variables:
Variable | Type | Options |
---|---|---|
USE_OpenMP | BOOL | ON , OFF |
CMAKE_BUILD_TYPE | STRING | Release , Debug |
BUILD_SHARED_LIBS | BOOL | ON , OFF |
CMAKE_INSTALL_PREFIX | PATH | |
USE_GMSH_SDK | BOOL | ON , 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:
- modules
- submodules
The modules
directory mainly contains following items:
- Type definition including methods
- 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
andsubmodules
directory. - For example, the directory of
Domain_
class isDomain
, the directory ofMesh_
class isMesh
. - In this way,
modules/Domain
will define theDomain_
class and interface of methods, whereassubmodules/Domain
will include the submodules that implementes the methods defined inside modules. - The name of the module which defines
Domain_
class isDomain_Classs
, and it is included in the file calledDomain_Class.F90
. - The submodule, which defines methods (for example, constructor methods) will be included in
Domain_Class@ConstructorMethods.F90
,Domain_Class@IOMethods
, etc.
If you want to implement a class called XXX_
, then perform following task:
- Make a subdirectory
XXX
insrc/modules
andsrc/submodules
- In both
XXX
make a subdirectoryXXX/src
- Create a file
modules/XXX/src/XXX_Class.F90
and define a module calledXXX_Class
: - 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:
Module | Comment | Category |
---|---|---|
Gmsh_Class | Interface to Gmsh library | Mesh |
CommandLine_Method | Fortran library for making comand line applications. | CLI |
ExceptionHandling_Class | Fortran library for error handling | Utility |
FPL_Method | Fortran parameter list | FEM |
Files | Collection of modules related to File IO. | IO |
ElementFactory | Finite element factory | FEM |
IntList_Class | Linked list of integers | Container |
RealList_Class | Linked list of reals | Container |
StringList_Class | Linked list of strings | Container |
ElementList_Class | Linked list of finite elements | FEM |
ElementPointerVector_Class | Dynamic vector of element pointers | FEM |
Mesh_Class | Finite element mesh class | FEM |
MeshPointerVector_Class | Dynamic vector of mesh pointers | FEM |
Domain_Class | Domain class | FEM |
DomainUtility | A module for additional methods on Domain. | FEM |
DomainConnectivity_Class | Domain connectivity class | FEM |
MeshSelection_Class | A class for selecting the region of domain. | FEM |
MSHFile_Class | Class for Gmsh`s msh file | FEM |
AbstractVector_Class | Abstract class for vectors. | FEM |
Vector_Class | Concrete class for vectors. | FEM |
Field | Collection of modules which defines classes for finite element fields. | FEM |
FieldFactory | Factory for fields | FEM |
AbstractLinSolver_Class | Abstract class for linear solver | FEM |
LinSolver_Class | Native linear solver class. | FEM |
LinSolver_Factory | Factory for linear solvers. | FEM |
AbstractBC_Class | Abstract class for boundary conditions | FEM |
DirichletBC_Class | Class for Dirichlet boundary conditions. | FEM |
NeumannBC_Class | Class for Neumann boundary conditions. | FEM |
NitscheBC_Class | Class for Nitsche boundary conditions. | FEM |
PolynomialFactory | Factory of polynomials | FEM |
UserFunction_Class | User function class | FEM |
RefElementFactory | Factory of reference elements | FEM |
FiniteElementFactory | Factory of finite elements. | FEM |
Tree3R_Class | Tree data structure for 3 term recurrence relation. | Math |
Plot_Method | Collection of methods for plotting. | FEM |