Skip to content

Commit 54c2cc0

Browse files
Merge pull request #21 from easifem/vikas-dev
Vikas dev
2 parents 7440b84 + 80d61e6 commit 54c2cc0

File tree

138 files changed

+8574
-918
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+8574
-918
lines changed

docs/docs-api/FEDOF/Copy.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Copy
2+
3+
The `Copy` method copies the contents of one `FEDOF_` object to another. This method is also used by the assignment operator (`=`) for `FEDOF_` objects.
4+
5+
## Interface
6+
7+
```fortran
8+
INTERFACE
9+
MODULE SUBROUTINE Copy(obj, obj2)
10+
CLASS(FEDOF_), INTENT(INOUT) :: obj
11+
CLASS(FEDOF_), INTENT(IN) :: obj2
12+
END SUBROUTINE Copy
13+
END INTERFACE
14+
```
15+
16+
## Parameters
17+
18+
- `obj` - The destination `FEDOF_` object that will receive the copied data
19+
- `obj2` - The source `FEDOF_` object whose data will be copied
20+
21+
## Implementation Details
22+
23+
The method performs a shallow copy of most attributes from `obj2` to `obj`:
24+
25+
1. Copies basic properties:
26+
- `isLagrange` - Flag indicating if the base interpolation is Lagrange
27+
- `tdof` - Total number of degrees of freedom
28+
- `tNodes`, `tEdges`, `tFaces`, `tCells` - Total count of different mesh entities
29+
- `baseContinuity` - Continuity or conformity of basis (e.g., "H1")
30+
- `baseInterpolation` - Type of basis functions (e.g., "LAGR", "HIER")
31+
- `maxCellOrder`, `maxFaceOrder`, `maxEdgeOrder` - Maximum order values
32+
33+
2. Sets the mesh pointer to point to the same mesh as the source object:
34+
35+
```fortran
36+
obj%mesh => obj2%mesh
37+
```
38+
39+
3. Copies array data when allocated in the source object:
40+
- `cellOrder` - Order of each cell
41+
- `faceOrder` - Order of each face
42+
- `edgeOrder` - Order of each edge
43+
- `edgeIA`, `faceIA`, `cellIA` - Sparsity patterns for different entities
44+
45+
4. Associates finite element pointers:
46+
47+
```fortran
48+
DO ii = 1, SIZE(obj2%fe)
49+
isok = ASSOCIATED(obj2%fe(ii)%ptr)
50+
IF (isok) THEN
51+
obj%fe(ii)%ptr => obj2%fe(ii)%ptr
52+
END IF
53+
END DO
54+
```
55+
56+
## Notes
57+
58+
- This is a shallow copy - the mesh and finite element pointers in the destination object point to the same objects as the source.
59+
- Array data is copied only if it exists in the source object.
60+
- The method doesn't allocate new memory for arrays; it assumes the destination arrays either don't exist or are already properly allocated.
61+
- This method is particularly useful when you need to create a duplicate of a `FEDOF_` object without creating new underlying mesh or finite element instances.
62+
63+
## Example
64+
65+
import EXAMPLE65 from "./examples/_Copy_test_1.md";
66+
67+
<EXAMPLE65 />

docs/docs-api/FEDOF/Deallocate.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Deallocate
2+
3+
The `Deallocate` method releases all allocated memory and nullifies pointers in a `FEDOF_` object, returning it to an uninitialized state. This method is essential for proper memory management to prevent memory leaks.
4+
5+
## Interface
6+
7+
```fortran
8+
INTERFACE
9+
MODULE SUBROUTINE DEALLOCATE (obj)
10+
CLASS(FEDOF_), INTENT(INOUT) :: obj
11+
END SUBROUTINE DEALLOCATE
12+
END INTERFACE
13+
```
14+
15+
## Parameters
16+
17+
- `obj` - The `FEDOF_` object to be deallocated
18+
19+
## Notes
20+
21+
- This method checks if arrays are allocated before attempting to deallocate them, preventing potential runtime errors.
22+
- For each associated finite element pointer, it calls the `DEALLOCATE` method of the finite element object before nullifying the pointer.
23+
- The method does not deallocate the mesh itself, as the `FEDOF_` object only maintains a pointer to the mesh, which might be used elsewhere.
24+
- After calling this method, the `FEDOF_` object is reset to its default state and can be reused for a new initialization.
25+
26+
## Example Usage
27+
28+
```fortran
29+
TYPE(FEDOF_) :: dof
30+
31+
! After using dof...
32+
CALL dof%DEALLOCATE()
33+
34+
! Now dof can be reused or safely go out of scope
35+
```
36+
37+
## Important Considerations
38+
39+
- This method should be called when the `FEDOF_` object is no longer needed to prevent memory leaks.
40+
- It's particularly important to call this method before reinitializing an existing `FEDOF_` object to avoid memory leaks.
41+
- The method only deallocates resources directly owned by the `FEDOF_` object; it does not deallocate the mesh or other external resources that might be referenced by pointers.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# GetBaseInterpolation
2+
3+
The `GetBaseInterpolation` method returns the type of basis functions used for interpolation on the reference element in the FEDOF (Finite Element Degrees of Freedom) instance.
4+
5+
## Interface
6+
7+
The specific interface is defined as:
8+
9+
```fortran
10+
MODULE FUNCTION obj_GetBaseInterpolation(obj) RESULT(ans)
11+
CLASS(FEDOF_), INTENT(IN) :: obj
12+
CHARACTER(:), ALLOCATABLE :: ans
13+
END FUNCTION obj_GetBaseInterpolation
14+
```
15+
16+
## Description
17+
18+
The `GetBaseInterpolation` method returns the type of basis functions used for interpolation on the reference element in the FEDOF (Finite Element Degrees of Freedom) instance. This information is crucial for understanding how the finite element approximation is constructed.
19+
20+
### Parameters
21+
22+
- `obj` - Input, `CLASS(FEDOF_)`, FEDOF object instance
23+
- `ans` - Output, `CHARACTER(:), ALLOCATABLE`, string containing the base interpolation type
24+
25+
### Implementation Details
26+
27+
The implementation is straightforward, returning the internal `baseInterpolation` property:
28+
29+
```fortran
30+
MODULE PROCEDURE obj_GetBaseInterpolation
31+
ans = obj%baseInterpolation
32+
END PROCEDURE obj_GetBaseInterpolation
33+
```
34+
35+
### Possible Return Values
36+
37+
The method returns one of the following interpolation types:
38+
39+
- `"LAGR"` - Lagrange interpolation
40+
- `"HIER"` - Hierarchical interpolation
41+
- `"ORTHO"` - Orthogonal interpolation
42+
- `"HERM"` - Hermite interpolation
43+
- `"SERE"` - Serendipity interpolation
44+
45+
## Usage Example
46+
47+
```fortran
48+
! Example to get the base interpolation type
49+
CHARACTER(:), ALLOCATABLE :: interpType
50+
TYPE(FEDOF_) :: myDOF
51+
52+
! Get the interpolation type
53+
interpType = myDOF%GetBaseInterpolation()
54+
55+
! Check interpolation type and take appropriate action
56+
SELECT CASE (interpType)
57+
CASE ("LAGR")
58+
PRINT *, "Using Lagrange interpolation"
59+
CASE ("HIER")
60+
PRINT *, "Using Hierarchical interpolation"
61+
CASE DEFAULT
62+
PRINT *, "Using other interpolation type: ", interpType
63+
END SELECT
64+
```
65+
66+
## Important Notes
67+
68+
1. The base interpolation type works in conjunction with the base continuity (e.g., "H1", "HCurl", "HDiv", "DG") to determine the complete function space used.
69+
2. The `GetCaseName` method combines the base continuity and base interpolation into a single identifier (e.g., "H1LAGR").
70+
3. Different interpolation types have different mathematical properties and are suitable for different types of problems.
71+
72+
## Related Methods
73+
74+
- `GetCaseName` - Returns the combined continuity and interpolation identifier
75+
- `GetLocalElemShapeData` - Uses the interpolation type to determine which shape functions to compute
76+
- `GetLocalElemShapeDataH1Lagrange` - Specialized method for Lagrange interpolation
77+
- `GetLocalElemShapeDataH1Hierarchical` - Specialized method for Hierarchical interpolation
78+
79+
The `GetBaseInterpolation` method is important for understanding the mathematical basis of the finite element approximation and is often used to determine which specialized algorithms should be applied for shape function evaluation and element matrix assembly.
80+

docs/docs-api/FEDOF/GetCaseName.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# GetCaseName
2+
3+
The `GetCaseName` method returns a string that identifies the combination of continuity and interpolation type used in the finite element degree of freedom object. This case name is used internally to determine which algorithms to apply when processing the finite element data.
4+
5+
## Interface
6+
7+
```fortran
8+
INTERFACE
9+
MODULE FUNCTION GetCaseName(obj) RESULT(ans)
10+
CLASS(FEDOF_), INTENT(IN) :: obj
11+
CHARACTER(6) :: ans
12+
END FUNCTION GetCaseName
13+
END INTERFACE
14+
```
15+
16+
## Parameters
17+
18+
- `obj` - The `FEDOF_` object from which to obtain the case name
19+
20+
## Return Value
21+
22+
- `ans` - A 6-character string combining the basis continuity and the interpolation type
23+
24+
## Implementation Details
25+
26+
The method is straightforward, concatenating the `baseContinuity` and `baseInterpolation` properties of the `FEDOF_` object:
27+
28+
```fortran
29+
ans = obj%baseContinuity//obj%baseInterpolation
30+
```
31+
32+
## Possible Return Values
33+
34+
The return value is a combination of the continuity type and interpolation type:
35+
36+
1. For continuity (`obj%baseContinuity`):
37+
- `"H1"` - Standard $H^{1}$ conforming elements
38+
- `"HC[url]"` - H(curl) conforming elements
39+
- `"HD[iv]"` - H(div) conforming elements
40+
- `"DG"` - Discontinuous Galerkin elements
41+
42+
2. For interpolation (`obj%baseInterpolation`):
43+
- `"LAGR"` - Lagrange interpolation
44+
- `"HIER"` - Hierarchical interpolation
45+
- `"ORTHO"` - Orthogonal interpolation
46+
- `"HERM"` - Hermite interpolation
47+
- `"SERE"` - Serendipity interpolation
48+
49+
Common combinations include:
50+
51+
- `"H1LAGR"` - H¹ conforming elements with Lagrange interpolation
52+
- `"H1HIER"` - H¹ conforming elements with hierarchical interpolation
53+
- `"DGHIER"` - Discontinuous Galerkin with hierarchical interpolation
54+
55+
## Usage Examples
56+
57+
The case name is primarily used in conditional branching to select the appropriate algorithms for a given finite element type:
58+
59+
```fortran
60+
CHARACTER(6) :: casename
61+
casename = fedof%GetCaseName()
62+
63+
SELECT CASE (casename)
64+
CASE ('H1LAGR')
65+
! Process H¹ conforming elements with Lagrange interpolation
66+
CASE ('H1HIER')
67+
! Process H¹ conforming elements with hierarchical interpolation
68+
CASE ('DGHIER')
69+
! Process Discontinuous Galerkin with hierarchical interpolation
70+
CASE DEFAULT
71+
! Handle unexpected case
72+
END SELECT
73+
```
74+
75+
This method is used extensively within the `FEDOF_` class to determine the appropriate algorithms for shape function calculation, connectivity generation, and other operations that depend on the specific type of finite element formulation.
76+
77+
## Example
78+
79+
import EXAMPLE80 from "./examples/_GetCaseName_test_1.md";
80+
81+
<EXAMPLE80 />

docs/docs-api/FEDOF/GetCellDOF.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# GetCellDOF
2+
3+
Get the degrees of freedom associated with a specific cell (element volume) in the finite element mesh.
4+
5+
## Interface
6+
7+
```fortran
8+
MODULE SUBROUTINE GetCellDOF(obj, globalCell, ans, tsize, islocal)
9+
CLASS(FEDOF_), INTENT(IN) :: obj
10+
INTEGER(I4B), INTENT(IN) :: globalCell
11+
INTEGER(I4B), INTENT(INOUT) :: ans(:)
12+
INTEGER(I4B), INTENT(OUT) :: tsize
13+
LOGICAL(LGT), INTENT(IN), OPTIONAL :: islocal
14+
END SUBROUTINE GetCellDOF
15+
```
16+
17+
## Parameters
18+
19+
- `obj`: The FEDOF_ object
20+
- `globalCell`: Global cell number to retrieve DOFs for
21+
- `ans`: Integer array to store the retrieved DOFs
22+
- `tsize`: Output parameter containing the total size of data written in ans
23+
- `islocal`: Optional logical flag - if true, globalCell is treated as a local cell number
24+
25+
## Functionality
26+
27+
This method retrieves all degrees of freedom associated with a specific cell (element volume) identified by its global cell number. It performs the following operations:
28+
29+
1. Converts the global cell number to a local cell number if needed
30+
2. Accesses the cell DOF information using the cell index array (`cellIA`)
31+
3. Populates the `ans` array with the DOF indices for the specified cell
32+
4. Sets `tsize` to the number of DOFs associated with the cell
33+
34+
The implementation leverages the cell sparsity pattern stored in the `cellIA` array, which provides the start and end indices for each cell's DOF information.
35+
36+
## Implementation Details
37+
38+
The method first converts the global cell number to a local cell number using the mesh's `GetLocalElemNumber` method. It then iterates through the DOF indices stored for this cell, copying each one into the `ans` array and incrementing the `tsize` counter.
39+
40+
## Usage
41+
42+
The `GetCellDOF` method is important for finite element implementations where you need to:
43+
44+
- Assemble matrices based on cell (volume) contributions
45+
- Apply internal conditions on specific cells
46+
- Compute cell-based integrals or other operations
47+
- Access all degrees of freedom associated with a cell for post-processing
48+
49+
Unlike vertex, edge, or face DOFs which are typically shared between elements, cell DOFs are internal to a specific element, making them important for capturing high-order behavior within elements.
50+
51+
## Example 1
52+
53+
import CodeBlock from '@theme/CodeBlock';
54+
55+
import CodeSnippet from '!!raw-loader!./examples/_GetCellDOF_test_1.md';
56+
57+
<CodeBlock language="fortran">{CodeSnippet}</CodeBlock>

0 commit comments

Comments
 (0)