diff --git a/docs/docs-api/FEDOF/Copy.md b/docs/docs-api/FEDOF/Copy.md new file mode 100644 index 00000000..1613be19 --- /dev/null +++ b/docs/docs-api/FEDOF/Copy.md @@ -0,0 +1,67 @@ +# Copy + +The `Copy` method copies the contents of one `FEDOF_` object to another. This method is also used by the assignment operator (`=`) for `FEDOF_` objects. + +## Interface + +```fortran +INTERFACE + MODULE SUBROUTINE Copy(obj, obj2) + CLASS(FEDOF_), INTENT(INOUT) :: obj + CLASS(FEDOF_), INTENT(IN) :: obj2 + END SUBROUTINE Copy +END INTERFACE +``` + +## Parameters + +- `obj` - The destination `FEDOF_` object that will receive the copied data +- `obj2` - The source `FEDOF_` object whose data will be copied + +## Implementation Details + +The method performs a shallow copy of most attributes from `obj2` to `obj`: + +1. Copies basic properties: + - `isLagrange` - Flag indicating if the base interpolation is Lagrange + - `tdof` - Total number of degrees of freedom + - `tNodes`, `tEdges`, `tFaces`, `tCells` - Total count of different mesh entities + - `baseContinuity` - Continuity or conformity of basis (e.g., "H1") + - `baseInterpolation` - Type of basis functions (e.g., "LAGR", "HIER") + - `maxCellOrder`, `maxFaceOrder`, `maxEdgeOrder` - Maximum order values + +2. Sets the mesh pointer to point to the same mesh as the source object: + +```fortran +obj%mesh => obj2%mesh +``` + +3. Copies array data when allocated in the source object: + - `cellOrder` - Order of each cell + - `faceOrder` - Order of each face + - `edgeOrder` - Order of each edge + - `edgeIA`, `faceIA`, `cellIA` - Sparsity patterns for different entities + +4. Associates finite element pointers: + +```fortran +DO ii = 1, SIZE(obj2%fe) + isok = ASSOCIATED(obj2%fe(ii)%ptr) + IF (isok) THEN + obj%fe(ii)%ptr => obj2%fe(ii)%ptr + END IF +END DO +``` + +## Notes + +- This is a shallow copy - the mesh and finite element pointers in the destination object point to the same objects as the source. +- Array data is copied only if it exists in the source object. +- The method doesn't allocate new memory for arrays; it assumes the destination arrays either don't exist or are already properly allocated. +- 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. + +## Example + +import EXAMPLE65 from "./examples/_Copy_test_1.md"; + + diff --git a/docs/docs-api/FEDOF/Deallocate.md b/docs/docs-api/FEDOF/Deallocate.md new file mode 100644 index 00000000..d7437a09 --- /dev/null +++ b/docs/docs-api/FEDOF/Deallocate.md @@ -0,0 +1,41 @@ +# Deallocate + +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. + +## Interface + +```fortran +INTERFACE + MODULE SUBROUTINE DEALLOCATE (obj) + CLASS(FEDOF_), INTENT(INOUT) :: obj + END SUBROUTINE DEALLOCATE +END INTERFACE +``` + +## Parameters + +- `obj` - The `FEDOF_` object to be deallocated + +## Notes + +- This method checks if arrays are allocated before attempting to deallocate them, preventing potential runtime errors. +- For each associated finite element pointer, it calls the `DEALLOCATE` method of the finite element object before nullifying the pointer. +- The method does not deallocate the mesh itself, as the `FEDOF_` object only maintains a pointer to the mesh, which might be used elsewhere. +- After calling this method, the `FEDOF_` object is reset to its default state and can be reused for a new initialization. + +## Example Usage + +```fortran +TYPE(FEDOF_) :: dof + +! After using dof... +CALL dof%DEALLOCATE() + +! Now dof can be reused or safely go out of scope +``` + +## Important Considerations + +- This method should be called when the `FEDOF_` object is no longer needed to prevent memory leaks. +- It's particularly important to call this method before reinitializing an existing `FEDOF_` object to avoid memory leaks. +- 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. diff --git a/docs/docs-api/FEDOF/GetBaseInterpolation.md b/docs/docs-api/FEDOF/GetBaseInterpolation.md new file mode 100644 index 00000000..7cf9bab1 --- /dev/null +++ b/docs/docs-api/FEDOF/GetBaseInterpolation.md @@ -0,0 +1,80 @@ +# GetBaseInterpolation + +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. + +## Interface + +The specific interface is defined as: + +```fortran +MODULE FUNCTION obj_GetBaseInterpolation(obj) RESULT(ans) + CLASS(FEDOF_), INTENT(IN) :: obj + CHARACTER(:), ALLOCATABLE :: ans +END FUNCTION obj_GetBaseInterpolation +``` + +## Description + +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. + +### Parameters + +- `obj` - Input, `CLASS(FEDOF_)`, FEDOF object instance +- `ans` - Output, `CHARACTER(:), ALLOCATABLE`, string containing the base interpolation type + +### Implementation Details + +The implementation is straightforward, returning the internal `baseInterpolation` property: + +```fortran +MODULE PROCEDURE obj_GetBaseInterpolation +ans = obj%baseInterpolation +END PROCEDURE obj_GetBaseInterpolation +``` + +### Possible Return Values + +The method returns one of the following interpolation types: + +- `"LAGR"` - Lagrange interpolation +- `"HIER"` - Hierarchical interpolation +- `"ORTHO"` - Orthogonal interpolation +- `"HERM"` - Hermite interpolation +- `"SERE"` - Serendipity interpolation + +## Usage Example + +```fortran +! Example to get the base interpolation type +CHARACTER(:), ALLOCATABLE :: interpType +TYPE(FEDOF_) :: myDOF + +! Get the interpolation type +interpType = myDOF%GetBaseInterpolation() + +! Check interpolation type and take appropriate action +SELECT CASE (interpType) +CASE ("LAGR") + PRINT *, "Using Lagrange interpolation" +CASE ("HIER") + PRINT *, "Using Hierarchical interpolation" +CASE DEFAULT + PRINT *, "Using other interpolation type: ", interpType +END SELECT +``` + +## Important Notes + +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. +2. The `GetCaseName` method combines the base continuity and base interpolation into a single identifier (e.g., "H1LAGR"). +3. Different interpolation types have different mathematical properties and are suitable for different types of problems. + +## Related Methods + +- `GetCaseName` - Returns the combined continuity and interpolation identifier +- `GetLocalElemShapeData` - Uses the interpolation type to determine which shape functions to compute +- `GetLocalElemShapeDataH1Lagrange` - Specialized method for Lagrange interpolation +- `GetLocalElemShapeDataH1Hierarchical` - Specialized method for Hierarchical interpolation + +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. + diff --git a/docs/docs-api/FEDOF/GetCaseName.md b/docs/docs-api/FEDOF/GetCaseName.md new file mode 100644 index 00000000..a092d456 --- /dev/null +++ b/docs/docs-api/FEDOF/GetCaseName.md @@ -0,0 +1,81 @@ +# GetCaseName + +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. + +## Interface + +```fortran +INTERFACE + MODULE FUNCTION GetCaseName(obj) RESULT(ans) + CLASS(FEDOF_), INTENT(IN) :: obj + CHARACTER(6) :: ans + END FUNCTION GetCaseName +END INTERFACE +``` + +## Parameters + +- `obj` - The `FEDOF_` object from which to obtain the case name + +## Return Value + +- `ans` - A 6-character string combining the basis continuity and the interpolation type + +## Implementation Details + +The method is straightforward, concatenating the `baseContinuity` and `baseInterpolation` properties of the `FEDOF_` object: + +```fortran +ans = obj%baseContinuity//obj%baseInterpolation +``` + +## Possible Return Values + +The return value is a combination of the continuity type and interpolation type: + +1. For continuity (`obj%baseContinuity`): + - `"H1"` - Standard $H^{1}$ conforming elements + - `"HC[url]"` - H(curl) conforming elements + - `"HD[iv]"` - H(div) conforming elements + - `"DG"` - Discontinuous Galerkin elements + +2. For interpolation (`obj%baseInterpolation`): + - `"LAGR"` - Lagrange interpolation + - `"HIER"` - Hierarchical interpolation + - `"ORTHO"` - Orthogonal interpolation + - `"HERM"` - Hermite interpolation + - `"SERE"` - Serendipity interpolation + +Common combinations include: + +- `"H1LAGR"` - H¹ conforming elements with Lagrange interpolation +- `"H1HIER"` - H¹ conforming elements with hierarchical interpolation +- `"DGHIER"` - Discontinuous Galerkin with hierarchical interpolation + +## Usage Examples + +The case name is primarily used in conditional branching to select the appropriate algorithms for a given finite element type: + +```fortran +CHARACTER(6) :: casename +casename = fedof%GetCaseName() + +SELECT CASE (casename) +CASE ('H1LAGR') + ! Process H¹ conforming elements with Lagrange interpolation +CASE ('H1HIER') + ! Process H¹ conforming elements with hierarchical interpolation +CASE ('DGHIER') + ! Process Discontinuous Galerkin with hierarchical interpolation +CASE DEFAULT + ! Handle unexpected case +END SELECT +``` + +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. + +## Example + +import EXAMPLE80 from "./examples/_GetCaseName_test_1.md"; + + diff --git a/docs/docs-api/FEDOF/GetCellDOF.md b/docs/docs-api/FEDOF/GetCellDOF.md new file mode 100644 index 00000000..6ceb04e0 --- /dev/null +++ b/docs/docs-api/FEDOF/GetCellDOF.md @@ -0,0 +1,57 @@ +# GetCellDOF + +Get the degrees of freedom associated with a specific cell (element volume) in the finite element mesh. + +## Interface + +```fortran +MODULE SUBROUTINE GetCellDOF(obj, globalCell, ans, tsize, islocal) + CLASS(FEDOF_), INTENT(IN) :: obj + INTEGER(I4B), INTENT(IN) :: globalCell + INTEGER(I4B), INTENT(INOUT) :: ans(:) + INTEGER(I4B), INTENT(OUT) :: tsize + LOGICAL(LGT), INTENT(IN), OPTIONAL :: islocal +END SUBROUTINE GetCellDOF +``` + +## Parameters + +- `obj`: The FEDOF_ object +- `globalCell`: Global cell number to retrieve DOFs for +- `ans`: Integer array to store the retrieved DOFs +- `tsize`: Output parameter containing the total size of data written in ans +- `islocal`: Optional logical flag - if true, globalCell is treated as a local cell number + +## Functionality + +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: + +1. Converts the global cell number to a local cell number if needed +2. Accesses the cell DOF information using the cell index array (`cellIA`) +3. Populates the `ans` array with the DOF indices for the specified cell +4. Sets `tsize` to the number of DOFs associated with the cell + +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. + +## Implementation Details + +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. + +## Usage + +The `GetCellDOF` method is important for finite element implementations where you need to: + +- Assemble matrices based on cell (volume) contributions +- Apply internal conditions on specific cells +- Compute cell-based integrals or other operations +- Access all degrees of freedom associated with a cell for post-processing + +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. + +## Example 1 + +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./examples/_GetCellDOF_test_1.md'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/GetCellOrder.md b/docs/docs-api/FEDOF/GetCellOrder.md new file mode 100644 index 00000000..a5b0fa46 --- /dev/null +++ b/docs/docs-api/FEDOF/GetCellOrder.md @@ -0,0 +1,82 @@ +# GetCellOrder + +The `GetCellOrder` method retrieves the polynomial order of a specified cell element. + +## Interface + +```fortran +MODULE SUBROUTINE obj_GetCellOrder(obj, cellOrder, tCellOrder, globalElement, islocal) + CLASS(FEDOF_), INTENT(IN) :: obj + !! fedof object + INTEGER(I4B), INTENT(INOUT) :: cellOrder(:) + !! cell order + INTEGER(I4B), INTENT(OUT) :: tCellOrder + !! size of data written in cellOrder + INTEGER(I4B), INTENT(IN) :: globalElement + !! global or local element number + LOGICAL(LGT), OPTIONAL, INTENT(IN) :: islocal + !! if true then globalElement is local element +END SUBROUTINE obj_GetCellOrder +``` + +## Description + +The `GetCellOrder` method retrieves the polynomial order of a specified cell element. The polynomial order determines the degree of the basis functions used for approximation within that element, which directly impacts the accuracy and computational cost of the finite element solution. + +### Parameters + +- `obj` - Input, `CLASS(FEDOF_)`, FEDOF object instance +- `cellOrder` - Output, `INTEGER(I4B)(:)`, pre-allocated array to store the cell order +- `tCellOrder` - Output, `INTEGER(I4B)`, total size of data written to the `cellOrder` array (typically 1) +- `globalElement` - Input, `INTEGER(I4B)`, global or local element number +- `islocal` - Optional Input, `LOGICAL(LGT)`, if true, `globalElement` is treated as a local element number + +### Implementation Details + +The implementation converts the global element number to a local element number if needed, then retrieves the cell order from the internal storage: + +```fortran +INTEGER(I4B) :: jj + +jj = obj%mesh%GetLocalElemNumber(globalElement=globalElement, islocal=islocal) + +cellOrder(1) = obj%cellOrder(jj) +tcellOrder = 1 +``` + +## Usage Example + +```fortran +! Example to get the order of a cell +INTEGER(I4B) :: order(1), tOrder +TYPE(FEDOF_) :: myDOF + +! Get order for element #5 +CALL myDOF%GetCellOrder(cellOrder=order, tCellOrder=tOrder, globalElement=5) +PRINT *, "Element 5 has order:", order(1) + +! Get order for element #3 using local numbering +CALL myDOF%GetCellOrder(cellOrder=order, tCellOrder=tOrder, globalElement=3, islocal=.TRUE.) +PRINT *, "Local element 3 has order:", order(1) +``` + +## Important Notes + +1. The `cellOrder` array typically only needs one element as this method returns a single value +2. The `tCellOrder` return value will typically be 1, indicating a single value written to `cellOrder` +3. In p-adaptive finite element methods, different cells may have different polynomial orders + +## Related Methods + +- `GetOrders` - More comprehensive method that returns cell, face, and edge orders along with their orientations +- `SetCellOrder` - Sets the polynomial order for cells +- `GetLocalElemShapeData` - Uses the cell order to determine the appropriate shape functions +- `GetQuadraturePoints` - Often needs the cell order to determine appropriate quadrature rules + +The `GetCellOrder` method is important for finite element implementations that use p-adaptive methods or variable-order elements, where the polynomial degree may vary between elements to optimize computational efficiency. + +## Example + +import EXAMPLE81 from "./examples/_GetCellOrder_test_1.md"; + + diff --git a/docs/docs-api/FEDOF/GetConnectivity.md b/docs/docs-api/FEDOF/GetConnectivity.md new file mode 100644 index 00000000..65d97e22 --- /dev/null +++ b/docs/docs-api/FEDOF/GetConnectivity.md @@ -0,0 +1,70 @@ +# GetConnectivity + +The `GetConnectivity` method returns the global degrees of freedom (DOFs) associated with a specified element in the mesh. This connectivity information is essential for assembling local element matrices and vectors into the global system during finite element analysis. + +## Interface + +```fortran +INTERFACE + MODULE FUNCTION GetConnectivity(obj, opt, globalElement, islocal) RESULT(ans) + CLASS(FEDOF_), INTENT(INOUT) :: obj + CHARACTER(*), INTENT(IN) :: opt + INTEGER(I4B), INTENT(IN) :: globalElement + LOGICAL(LGT), OPTIONAL, INTENT(IN) :: islocal + INTEGER(I4B), ALLOCATABLE :: ans(:) + END FUNCTION GetConnectivity +END INTERFACE +``` + +## Parameters + +- `obj` - The `FEDOF_` object containing degree of freedom information +- `opt` - A string specifying which type of connectivity to retrieve: + - `"Vertex"` - Only vertex DOFs + - `"Edge"` - Only edge DOFs + - `"Face"` - Only face DOFs + - `"Cell"` - Only cell DOFs + - `"All"` - All DOFs (vertices, edges, faces, and cells) +- `globalElement` - The global or local element number, depending on the value of `islocal` +- `islocal` - Optional logical flag. If present and `.TRUE.`, `globalElement` is interpreted as a local element number; otherwise, it's a global element number + +## Return Value + +- `ans` - An allocatable array containing the global DOF numbers associated with the specified element, filtered according to the `opt` parameter + +## Implementation Details + +The function: + +1. Determines the total number of DOFs for the element using `obj%GetTotalDOF` +2. Allocates the return array with the appropriate size +3. Calls the `obj%GetConnectivity_` subroutine to populate the array with the actual connectivity data + +The key steps in the implementation are: + +```fortran +tdof = obj%GetTotalDOF(globalElement=globalElement, isLocal=isLocal) +ALLOCATE (ans(tdof)) +CALL obj%GetConnectivity_(ans=ans, tsize=tdof, opt=opt, +globalElement = globalElement, islocal = islocal) +``` + +The underlying `GetConnectivity_` subroutine performs the actual work of gathering the connectivity data by: + +1. Getting the element's topological entities (vertices, edges, faces, and cells) +2. Retrieving the DOFs for each entity using the appropriate methods (`GetVertexDOF`, `GetEdgeDOF`, etc.) +3. Combining these DOFs into a single connectivity array + +## Notes + +- For Lagrangian elements (`obj%isLagrange` is `.TRUE.`), only vertex DOFs are considered, regardless of the `opt` parameter +- For hierarchical elements, the connectivity includes all specified entity types (vertices, edges, faces, cells) +- The connectivity array contains global DOF numbers that map the local element DOFs to the global system +- The order of DOFs in the returned array follows a hierarchical pattern: vertices first, then edges, faces, and finally cell DOFs +- This method is crucial for element assembly operations in finite element analysis + +## Example + +import EXAMPLE68 from "./examples/_GetConnectivity_test_1.md"; + + diff --git a/docs/docs-api/FEDOF/GetConnectivity_.md b/docs/docs-api/FEDOF/GetConnectivity_.md new file mode 100644 index 00000000..8e57dd14 --- /dev/null +++ b/docs/docs-api/FEDOF/GetConnectivity_.md @@ -0,0 +1,94 @@ +# GetConnectivity_ + +## Interface + +```fortran +MODULE SUBROUTINE obj_GetConnectivity_(obj, ans, tsize, opt, globalElement, islocal) + CLASS(FEDOF_), INTENT(INOUT) :: obj + !! FEDOF object + INTEGER(I4B), INTENT(INOUT) :: ans(:) + !! connectivity of element + INTEGER(I4B), INTENT(OUT) :: tsize + !! total size of data written in con + CHARACTER(*), INTENT(IN) :: opt + !! opt = Vertex + !! opt = Edge + !! opt = Face + !! opt = Cell + !! opt = All + INTEGER(I4B), INTENT(IN) :: globalElement + !! Global element number + LOGICAL(LGT), OPTIONAL, INTENT(IN) :: islocal + !! if islocal true then globalElement is local element number +END SUBROUTINE obj_GetConnectivity_ +``` + +## Description + +The `GetConnectivity_` method retrieves the connectivity (degrees of freedom) of a specified element and writes it into a provided array. This method allows for filtering the types of entities (vertices, edges, faces, cells) to include in the connectivity. + +### Parameters + +- `obj` - Input/Output, `CLASS(FEDOF_)`, FEDOF object instance +- `ans` - Output, `INTEGER(I4B)(:)`, pre-allocated array to store the connectivity information +- `tsize` - Output, `INTEGER(I4B)`, total size of data written to the `ans` array +- `opt` - Input, `CHARACTER(*)`, option specifying which entities to include: + - `"Vertex"` - Include only vertex DOFs + - `"Edge"` - Include only edge DOFs + - `"Face"` - Include only face DOFs + - `"Cell"` - Include only cell DOFs + - `"All"` - Include all DOFs (default) +- `globalElement` - Input, `INTEGER(I4B)`, global or local element number +- `islocal` - Optional Input, `LOGICAL(LGT)`, if true, `globalElement` is treated as a local element number + +### Implementation Details + +The implementation follows these steps: + +1. Converts the global element number to a local element number if needed +2. Gets the total entities (vertices, edges, faces, cells) for the element +3. Retrieves the connectivity from the mesh for the specified element +4. Processes each entity type (vertices, edges, faces, cells) and adds their DOFs to the `ans` array +5. Updates `tsize` with the total number of DOFs added + +```fortran +localElement = obj%mesh%GetLocalElemNumber(globalElement=globalElement, islocal=islocal) +ent = obj%mesh%GetTotalEntities(globalElement=localElement, islocal=yes) +CALL obj%mesh%GetConnectivity_(globalElement=localElement, islocal=yes, opt=opt, tsize=jj, ans=temp) + +! Process vertices, edges, faces, and cells... +! For each entity, call the appropriate GetXXXDOF method and add to ans array + +tsize = jj - 1 +``` + +## Usage Example + +```fortran +! Example to get connectivity for an element +INTEGER(I4B) :: conn(100), totalSize +TYPE(FEDOF_) :: myDOF + +! Get all DOFs for element #5 +CALL myDOF%GetConnectivity_(ans=conn, tsize=totalSize, opt="All", globalElement=5) + +! Get only vertex DOFs for element #8 +CALL myDOF%GetConnectivity_(ans=conn, tsize=totalSize, opt="Vertex", globalElement=8) + +! Get only edge DOFs for element #3, using local numbering +CALL myDOF%GetConnectivity_(ans=conn, tsize=totalSize, opt="Edge", globalElement=3, islocal=.TRUE.) +``` + +## Important Notes + +1. The `ans` array must be pre-allocated with sufficient size to hold all the requested DOFs +2. The `tsize` return value indicates how many values were actually written to `ans` +3. This method is often used internally by the functional variant `GetConnectivity` + +## Related Methods + +- `GetConnectivity` - Function version that allocates and returns the connectivity array +- `GetVertexDOF`, `GetEdgeDOF`, `GetFaceDOF`, `GetCellDOF` - Methods for retrieving specific entity DOFs +- `GetTotalDOF` - Used to determine the required size for connectivity arrays + +The `GetConnectivity_` method provides a lower-level interface for retrieving connectivity information, offering more control over memory allocation compared to the functional `GetConnectivity` method. diff --git a/docs/docs-api/FEDOF/GetEdgeDOF.md b/docs/docs-api/FEDOF/GetEdgeDOF.md new file mode 100644 index 00000000..2ab745c4 --- /dev/null +++ b/docs/docs-api/FEDOF/GetEdgeDOF.md @@ -0,0 +1,76 @@ +# GetEdgeDOF + +The `GetEdgeDOF` is a generic method in the `FEDOF_` class that retrieves degrees of freedom associated with edges. It has two specific implementations: + +| Method | Description | +| ----------- | -------------------------------------------------------------------------------- | +| GetEdgeDOF1 | Gets edge degrees of freedom using the global edge number | +| GetEdgeDOF2 | Gets edge degrees of freedom using a global element number and local edge number | + +## Interface 1 + +```fortran +MODULE SUBROUTINE GetEdgeDOF(obj, globalEdge, ans, tsize, islocal) + CLASS(FEDOF_), INTENT(IN) :: obj + INTEGER(I4B), INTENT(IN) :: globalEdge + INTEGER(I4B), INTENT(INOUT) :: ans(:) + INTEGER(I4B), INTENT(OUT) :: tsize + LOGICAL(LGT), INTENT(IN), OPTIONAL :: islocal +END SUBROUTINE GetEdgeDOF +``` + +### Parameters + +- `obj`: The FEDOF_ object +- `globalEdge`: Global edge number to retrieve DOFs for +- `ans`: Integer array to store the retrieved DOFs +- `tsize`: Output parameter containing the total size of data written in ans +- `islocal`: Optional logical flag - if true, globalEdge is treated as a local edge number + +### Functionality + +This method retrieves all degrees of freedom associated with a specific edge identified by its global edge number. It looks up the edge DOFs in the `edgeIA` array which contains the sparsity pattern for edges. + +## Interface 2 + +```fortran +MODULE SUBROUTINE GetEdgeDOF2(obj, globalElement, localEdgeNumber, & + ans, tsize, islocal) + CLASS(FEDOF_), INTENT(IN) :: obj + INTEGER(I4B), INTENT(IN) :: globalElement + !! global or local cell element number + INTEGER(I4B), INTENT(IN) :: localEdgeNumber + !! local edge number in global element + INTEGER(I4B), INTENT(INOUT) :: ans(:) + !! edge degree of freedom + INTEGER(I4B), INTENT(OUT) :: tsize + !! tota size of data written in ans + LOGICAL(LGT), INTENT(IN), OPTIONAL :: islocal + !! if true then globalElement is local element +END SUBROUTINE GetEdgeDOF2 +``` + +### Parameters + +- `obj`: The FEDOF_ object +- `globalElement`: Global element number containing the edge +- `localEdgeNumber`: Local edge number within the element +- `ans`: Integer array to store the retrieved DOFs +- `tsize`: Output parameter containing the total size of data written in ans +- `islocal`: Optional logical flag - if true, globalElement is treated as a local element number + +### Functionality + +This method first converts the element and local edge information to a global edge number, then calls `GetEdgeDOF` to retrieve the DOFs. It uses the mesh information to determine the global edge number from the element and local edge number. + +## Usage + +This method is important for finite element implementations where you need to: + +- Assemble matrices based on edge contributions +- Apply boundary conditions on specific edges +- Compute edge-based integrals or other operations + +The generic interface allows users to retrieve edge DOFs either by directly specifying the global edge number or by specifying an element and the local edge number within that element, providing flexibility in how edge data is accessed. + +## Example diff --git a/docs/docs-api/FEDOF/GetFaceDOF.md b/docs/docs-api/FEDOF/GetFaceDOF.md new file mode 100644 index 00000000..20d13ffd --- /dev/null +++ b/docs/docs-api/FEDOF/GetFaceDOF.md @@ -0,0 +1,95 @@ +# GetFaceDOF + +The `GetFaceDOF` generic method in the `FEDOF_Class` is used to retrieve the degrees of freedom (DOF) associated with a face in a finite element mesh. This method has two specific implementations with different parameter sets. + +## Method Description + +The `GetFaceDOF` generic method retrieves face degrees of freedom through two different interfaces: + +1. `GetFaceDOF1` - Gets DOFs directly using a global face number +2. `GetFaceDOF2` - Gets DOFs using a global element number and local face number within that element + +## Interface 1 + +```fortran +SUBROUTINE obj_GetFaceDOF1(obj, globalFace, ans, tsize, islocal) +``` + +### Parameters + +- `obj` - Input, `CLASS(FEDOF_)`, FEDOF object instance +- `globalFace` - Input, `INTEGER(I4B)`, global face number +- `ans` - Output, `INTEGER(I4B)(:)`, array to store face degrees of freedom +- `tsize` - Output, `INTEGER(I4B)`, total size of data written to `ans` +- `islocal` - Optional Input, `LOGICAL(LGT)`, if true, `globalFace` is treated as a local face number + +### Implementation Details + +The implementation in `GetMethods` submodule uses the internal face index array structure: + +```fortran +INTEGER(I4B) :: ii +tsize = 0 +DO ii = obj%faceIA(globalface), obj%faceIA(globalface + 1) - 1 + tsize = tsize + 1 + ans(tsize) = ii +END DO +``` + +The method retrieves DOFs from the face sparsity data structure using the compressed sparse row format stored in `faceIA`. + +## Interface 2 + +```fortran +SUBROUTINE obj_GetFaceDOF2(obj, globalElement, localFaceNumber, ans, tsize, islocal) +``` + +### Parameters + +- `obj` - Input, `CLASS(FEDOF_)`, DOF object +- `globalElement` - Input, `INTEGER(I4B)`, global or local element number +- `localFaceNumber` - Input, `INTEGER(I4B)`, local face number in global element +- `ans` - Output, `INTEGER(I4B)(:)`, array to store face degrees of freedom +- `tsize` - Output, `INTEGER(I4B)`, total size of data written to `ans` +- `islocal` - Optional Input, `LOGICAL(LGT)`, if true, `globalElement` is treated as a local element number + +### Implementation Details + +This implementation first converts the element and local face information to a global face number, then calls the first implementation: + +```fortran +INTEGER(I4B) :: globalFace +globalFace = obj%mesh%GetGlobalFaceNumber(globalElement=globalElement, & + islocal=islocal, localFaceNumber=localFaceNumber) +CALL obj%GetFaceDOF(globalFace=globalFace, ans=ans, tsize=tsize, & + islocal=islocal) +``` + +## Usage Example + +```fortran +! Example to get DOFs from a face +INTEGER(I4B) :: faceDOFs(100), totalDOFs +TYPE(FEDOF_) :: myDOF + +! Method 1: Using global face number +CALL myDOF%GetFaceDOF(globalFace=5, ans=faceDOFs, tsize=totalDOFs) + +! Method 2: Using element and local face number +CALL myDOF%GetFaceDOF(globalElement=10, localFaceNumber=2, ans=faceDOFs, tsize=totalDOFs) +``` + +## Related Methods + +- `GetTotalFaceDOF` - Returns the total number of DOFs on a face +- `GetEdgeDOF` - Similar function but for element edges +- `GetCellDOF` - Gets DOFs for volumetric elements +- `GetVertexDOF` - Gets DOFs for element vertices + +Need any additional details about these methods? + +## Example + +import EXAMPLE93 from "./examples/_GetFaceDOF_test_1.md"; + + diff --git a/docs/docs-api/FEDOF/GetGlobalElemShapeData.md b/docs/docs-api/FEDOF/GetGlobalElemShapeData.md new file mode 100644 index 00000000..16a02e9c --- /dev/null +++ b/docs/docs-api/FEDOF/GetGlobalElemShapeData.md @@ -0,0 +1,88 @@ +# GetGlobalElemShapeData + +The `GetGlobalElemShapeData` method computes the global element shape function data (including shape functions, their derivatives, and related information) for a specified element. This method takes the local element shape function data and transforms it to the global coordinate system using the nodal coordinates provided in `xij`. + +## Interface + +```fortran +INTERFACE + MODULE SUBROUTINE GetGlobalElemShapeData(obj, globalElement, elemsd, & + xij, geoElemsd, islocal) + CLASS(FEDOF_), INTENT(INOUT) :: obj + !! Abstract finite element + INTEGER(I4B), INTENT(IN) :: globalElement + !! shape function data + TYPE(ElemshapeData_), INTENT(INOUT) :: elemsd + !! global element shape data + REAL(DFP), INTENT(IN) :: xij(:, :) + !! nodal coordinates of element + !! The number of rows in xij should be same as the spatial dimension + !! The number of columns should be same as the number of nodes + !! present in the reference element in geoElemsd. + TYPE(ElemShapeData_), OPTIONAL, INTENT(INOUT) :: geoElemsd + !! shape function data for geometry which contains local shape function + !! data. If not present then the local shape function in elemsd + !! will be used for geometry. This means we are dealing with + !! isoparametric shape functions. + LOGICAL(LGT), OPTIONAL, INTENT(IN) :: islocal + !! if true then the global element is a local element + END SUBROUTINE GetGlobalElemShapeData +END INTERFACE +``` + +## Parameters + +| Parameter | Type | Intent | Description | +| --------------- | ---------------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `obj` | `CLASS(FEDOF_)` | `INTENT(INOUT)` | The FEDOF object instance | +| `globalElement` | `INTEGER(I4B)` | `INTENT(IN)` | The global element number for which to compute shape function data | +| `elemsd` | `TYPE(ElemshapeData_)` | `INTENT(INOUT)` | Output variable that will contain the global element shape data | +| `xij` | `REAL(DFP)` | `INTENT(IN)` | Nodal coordinates of the element. The number of rows in `xij` should match the spatial dimension, and the number of columns should match the number of nodes in the reference element | +| `geoElemsd` | `TYPE(ElemShapeData_)` | `OPTIONAL, INTENT(INOUT)` | Shape function data for geometry which contains local shape function data. If not present, the local shape function in `elemsd` will be used for geometry (isoparametric case) | +| `islocal` | `LOGICAL(LGT)` | `OPTIONAL, INTENT(IN)` | If true, `globalElement` is treated as a local element number rather than a global element number | + +## Implementation Details + +The method performs the following operations: + +1. Obtains the element topology index for the specified element +2. Performs error checking in debug mode to ensure the element topology index is valid and the finite element pointer is associated +3. Delegates the actual computation to the appropriate finite element object's `GetGlobalElemShapeData` method + +## Usage Example + +```fortran +TYPE(FEDOF_) :: myFEDOF +TYPE(ElemshapeData_) :: elemsd +REAL(DFP), ALLOCATABLE :: xij(:, :) +INTEGER(I4B) :: elemNum + +! Initialize myFEDOF and prepare xij with nodal coordinates +! ... + +! Get the global element shape data +CALL myFEDOF%GetGlobalElemShapeData(globalElement=elemNum, elemsd=elemsd, xij=xij) + +! Now elemsd contains the shape functions and derivatives in the global coordinate system +``` + +## Notes + +- This method is part of the core functionality for finite element computations, as it provides the necessary information for evaluating functions and their derivatives in the global coordinate system. +- The transformation from local to global coordinates is handled internally by the finite element implementation. +- If `geoElemsd` is not provided, the method will use an isoparametric formulation where the same shape functions are used for both the solution field and the geometry. +- Debug mode provides additional error checking to ensure the element topology index is valid and required pointers are associated. + +Would you like additional information or clarification about any aspect of this method? + +## Example 1 + +import EXAMPLE65 from "./examples/_GetLocalElemshapeData_test_1.md"; + + + +## Example 2 + +import EXAMPLE66 from "./examples/_GetLocalElemshapeData_test_2.md"; + + diff --git a/docs/docs-api/FEDOF/GetLocalElemShapeData.md b/docs/docs-api/FEDOF/GetLocalElemShapeData.md new file mode 100644 index 00000000..9821079c --- /dev/null +++ b/docs/docs-api/FEDOF/GetLocalElemShapeData.md @@ -0,0 +1,73 @@ +# GetLocalElemShapeData + +The `GetLocalElemShapeData` method retrieves local element shape function data for a specific element in a finite element mesh. This method acts as a dispatcher that calls the appropriate shape function evaluation method based on the continuity and interpolation type of the finite element space. + +## Syntax + +```fortran +CALL obj%GetLocalElemShapeData(globalElement, elemsd, quad, islocal) +``` + +## Arguments + +| Argument | Intent | Description | +| --------------- | ---------------- | ---------------------------------------------------------------------------- | +| `obj` | `INOUT` | An instance of the `FEDOF_` class | +| `globalElement` | `IN` | Global element number (or local element number if `islocal=.TRUE.`) | +| `elemsd` | `INOUT` | `ElemShapedata_` object to store the shape function data | +| `quad` | `IN` | `QuadraturePoint_` object containing quadrature points | +| `islocal` | `IN`, `OPTIONAL` | Logical flag - if true, `globalElement` is treated as a local element number | + +## Description + +This method determines the appropriate shape function evaluation strategy based on the case name derived from the basis continuity and interpolation type. Currently, it supports: + +- `H1LAGR`: H1-conforming Lagrange interpolation +- `H1HIER`: H1-conforming Hierarchical interpolation + +The method dispatches to the appropriate specialized method: + +- `GetLocalElemShapeDataH1Lagrange` for Lagrange interpolation +- `GetLocalElemShapeDataH1Hierarchical` for Hierarchical interpolation + +## Implementation Details + +The method performs the following steps: + +1. Obtains the case name by calling `obj%GetCaseName()` +2. Uses a SELECT CASE statement to call the appropriate specialized method +3. Raises an error if no matching case is found + +## Example Usage + +```fortran +TYPE(FEDOF_) :: fedof +TYPE(ElemShapedata_) :: elemsd +TYPE(QuadraturePoint_) :: quad +INTEGER :: elemNumber + +! Initialize fedof, elemsd, quad, and elemNumber + +! Get local element shape data +CALL fedof%GetLocalElemShapeData(globalElement=elemNumber, elemsd=elemsd, quad=quad) +``` + +## Notes + +- The method depends on the continuity and interpolation type settings in the FEDOF object +- Error checking is performed in debug mode to ensure the element is valid +- This method serves as a high-level interface to different shape function implementations + +Would you like me to explain any specific part of this method in more detail? + +## Example 1 + +import EXAMPLE65 from "./examples/_GetLocalElemshapeData_test_1.md"; + + + +## Example 2 + +import EXAMPLE66 from "./examples/_GetLocalElemshapeData_test_2.md"; + + diff --git a/docs/docs-api/FEDOF/GetMaxTotalConnectivity.md b/docs/docs-api/FEDOF/GetMaxTotalConnectivity.md new file mode 100644 index 00000000..86cec00b --- /dev/null +++ b/docs/docs-api/FEDOF/GetMaxTotalConnectivity.md @@ -0,0 +1,79 @@ +# GetMaxTotalConnectivity + +## Interface + +```fortran +MODULE FUNCTION obj_GetMaxTotalConnectivity(obj) RESULT(ans) + CLASS(FEDOF_), INTENT(IN) :: obj + INTEGER(I4B) :: ans +END FUNCTION obj_GetMaxTotalConnectivity +``` + +## Description + +The `GetMaxTotalConnectivity` method determines the maximum number of degrees of freedom (DOF) associated with any single element in the mesh. This value represents the largest connectivity array size needed to store all DOFs for any element, which is crucial for pre-allocating arrays in finite element assembly operations. + +### Parameters + +- `obj` - Input, `CLASS(FEDOF_)`, FEDOF object instance +- `ans` - Output, `INTEGER(I4B)`, maximum connectivity size across all elements + +### Implementation Details + +The implementation iterates through all elements in the mesh, calculates the total DOF for each element, and keeps track of the maximum value: + +```fortran +ans = 0 +telems = obj%mesh%GetTotalElements() + +DO ii = 1, telems + tdof = obj%GetTotalDOF(globalElement=ii, isLocal=.TRUE.) + ans = MAX(ans, tdof) +END DO +``` + +This efficient approach ensures that the returned value is large enough to accommodate the connectivity of any element in the mesh. + +## Usage Example + +```fortran +! Example to get the maximum connectivity size +INTEGER(I4B) :: maxConnSize +TYPE(FEDOF_) :: myDOF + +! Get maximum connectivity size +maxConnSize = myDOF%GetMaxTotalConnectivity() + +! Use this value to allocate arrays for element operations +INTEGER(I4B), ALLOCATABLE :: elemDOFs(:) +ALLOCATE (elemDOFs(maxConnSize)) + +! Now elemDOFs is guaranteed to be large enough for any element +! in the mesh, regardless of element type or polynomial order +``` + +## Important Notes + +1. This method is particularly valuable in heterogeneous meshes where different element types or polynomial orders are used +2. The returned value is often cached in the `maxTotalConnectivity` member variable to avoid recalculation +3. This method can be computationally expensive for large meshes as it loops through all elements + +## Related Methods + +- `GetTotalDOF` - Used internally to calculate the DOF count for each element +- `GetConnectivity` - Returns the actual connectivity for a specific element +- `GetConnectivity_` - Lower-level method for retrieving element connectivity + +The `GetMaxTotalConnectivity` method is an important utility function for memory management in finite element codes, ensuring that sufficient memory is allocated for element-wise operations without excessive over-allocation. + +## Example 1 + +import EXAMPLE71 from "./examples/_GetMaxTotalConnectivity_test_1.md"; + + + +## Example 2 + +import EXAMPLE72 from "./examples/_GetMaxTotalConnectivity_test_2.md"; + + diff --git a/docs/docs-api/FEDOF/GetMeshPointer.md b/docs/docs-api/FEDOF/GetMeshPointer.md new file mode 100644 index 00000000..069dec23 --- /dev/null +++ b/docs/docs-api/FEDOF/GetMeshPointer.md @@ -0,0 +1,52 @@ +# GetMeshPointer + +## Interface + +```fortran +MODULE FUNCTION obj_GetMeshPointer(obj) RESULT(ans) + CLASS(FEDOF_), INTENT(IN) :: obj + CLASS(AbstractMesh_), POINTER :: ans +END FUNCTION obj_GetMeshPointer +``` + +## Description + +The `GetMeshPointer` method returns a pointer to the mesh object associated with the FEDOF (Finite Element Degrees of Freedom) instance. This method provides access to the underlying mesh structure without transferring ownership. + +### Parameters + +- `obj` - Input, `CLASS(FEDOF_)`, FEDOF object instance +- `ans` - Output, `CLASS(AbstractMesh_), POINTER`, pointer to the mesh object + +This allows client code to access the mesh for further operations without needing to duplicate the mesh data. + +## Usage Example + +```fortran +! Example to get the mesh pointer +CLASS(AbstractMesh_), POINTER :: meshPtr +TYPE(FEDOF_) :: myDOF + +! Get the mesh pointer +meshPtr => myDOF%GetMeshPointer() + +! Now use the mesh pointer for operations +IF (ASSOCIATED(meshPtr)) THEN + numElements = meshPtr%GetTotalElements() + ! Other mesh operations... +END IF +``` + +## Important Notes + +1. The returned pointer should not be deallocated by the caller, as the FEDOF object maintains ownership of the mesh. +2. The pointer becomes invalid if the parent FEDOF object is deallocated. +3. This is a read-only operation that doesn't modify the FEDOF object (hence the `INTENT(IN)` for `obj`). + +## Related Methods + +- `GetConnectivity` - Uses the mesh to retrieve element connectivity +- `GetTotalDOF` - Often uses mesh information to calculate DOF counts +- `GetOrders` - Requires mesh information to map between local and global entities + +The `GetMeshPointer` method is useful when operations need direct access to the underlying mesh structure for topological or geometric queries that the FEDOF object doesn't directly expose. diff --git a/docs/docs-api/FEDOF/GetOrders.md b/docs/docs-api/FEDOF/GetOrders.md new file mode 100644 index 00000000..1e9fb5e8 --- /dev/null +++ b/docs/docs-api/FEDOF/GetOrders.md @@ -0,0 +1,125 @@ +# GetOrders + +The `GetOrders` method retrieves the cell order, face order, edge order, and their respective orientation information for a specified element in a finite element mesh. This method is part of the `FEDOF_` class which appears to handle Finite Element Degrees of Freedom. + +## Interface + +```fortran +MODULE SUBROUTINE GetOrders(obj, cellOrder, faceOrder, edgeOrder, cellOrient, + faceOrient, edgeOrient, tCellOrder, tFaceOrder, + tEdgeOrder, tCellOrient, tFaceOrient, tEdgeOrient, + globalElement, islocal) +``` + +## Parameters + +### Input Parameters + +- `obj` : `CLASS(FEDOF_), INTENT(IN)` + - The FEDOF object instance containing the finite element discretization information. + +- `globalElement` : `INTEGER(I4B), INTENT(IN)` + - The global or local element number for which order information is requested. + +- `islocal` : `LOGICAL(LGT), OPTIONAL, INTENT(IN)` + - If present and true, indicates that `globalElement` is a local element number. + - If omitted or false, `globalElement` is treated as a global element number. + +### Output/Inout Parameters + +- `cellOrder` : `INTEGER(I4B), INTENT(INOUT)(:)` + - Array to store the cell order information. + - Size should be at least 1. + +- `faceOrder` : `INTEGER(I4B), INTENT(INOUT)(:,:)` + - 2D array to store face order information. + - First dimension (rows) should be 3. + - Second dimension (columns) should be at least equal to the total number of faces in the element. + +- `edgeOrder` : `INTEGER(I4B), INTENT(INOUT)(:)` + - Array to store edge order information. + - Size should be at least equal to the total number of edges in the element. + +- `cellOrient` : `INTEGER(I4B), INTENT(INOUT)(:)` + - Array to store cell orientation information. + - Size should be at least 1. + +- `faceOrient` : `INTEGER(I4B), INTENT(INOUT)(:,:)` + - 2D array to store face orientation flags. + - First dimension (rows) should be 3. + - Second dimension (columns) should be at least equal to the total number of faces. + +- `edgeOrient` : `INTEGER(I4B), INTENT(INOUT)(:)` + - Array to store edge orientation flags. + - Size should be at least equal to the total number of edges. + +- `tCellOrder` : `INTEGER(I4B), INTENT(OUT)` + - Returns the size of data written in `cellOrder`. + +- `tFaceOrder` : `INTEGER(I4B), INTENT(OUT)` + - Returns the size of data written in `faceOrder` (number of faces). + +- `tEdgeOrder` : `INTEGER(I4B), INTENT(OUT)` + - Returns the size of data written in `edgeOrder` (number of edges). + +- `tCellOrient` : `INTEGER(I4B), INTENT(OUT)` + - Returns the size of data written in `cellOrient`. + +- `tFaceOrient` : `INTEGER(I4B), INTENT(OUT)(2)` + - Returns the size of data written in `faceOrient`. + +- `tEdgeOrient` : `INTEGER(I4B), INTENT(OUT)` + - Returns the size of data written in `edgeOrient`. + +## Description + +The `GetOrders` method retrieves polynomial order information and orientation flags for a specified element in the finite element mesh. This includes: + +1. The polynomial order of the cell (element) +2. The polynomial orders of all faces of the element +3. The polynomial orders of all edges of the element +4. The orientation flags for the cell, faces, and edges + +The method first converts the global element number to a local element number if needed, then retrieves the connectivity information of the element from the underlying mesh. This connectivity information is used to index into the stored order and orientation data for the element, faces, and edges. + +For face orders, the method copies the same order value to all three components (rows 1-3) of the corresponding face. + +The orientation information is retrieved separately from the mesh using its `GetOrientation` method. + +## Return Values + +This subroutine does not return a value directly but fills the provided arrays with the requested information and returns the sizes of the filled data through the `tCellOrder`, `tFaceOrder`, `tEdgeOrder`, `tCellOrient`, `tFaceOrient`, and `tEdgeOrient` parameters. + +## Implementation Details + +1. Converts global element number to local if needed +2. Retrieves element connectivity information from the mesh +3. Extracts cell order for the specified element +4. Extracts face orders for all faces of the element +5. Extracts edge orders for all edges of the element +6. Retrieves orientation information for the cell, faces, and edges + +## Usage Example + +```fortran +! Assuming obj is an initialized FEDOF_ object +INTEGER(I4B) :: cellOrder(1), faceOrder(3, 6), edgeOrder(12) +INTEGER(I4B) :: cellOrient(1), faceOrient(3, 6), edgeOrient(12) +INTEGER(I4B) :: tCellOrder, tFaceOrder, tEdgeOrder +INTEGER(I4B) :: tCellOrient, tFaceOrient(2), tEdgeOrient +INTEGER(I4B) :: elemID = 5 +LOGICAL(LGT) :: isLocal = .FALSE. + +! Get orders and orientations for element 5 (global numbering) +CALL obj%GetOrders(cellOrder, faceOrder, edgeOrder, & + cellOrient, faceOrient, edgeOrient, & + tCellOrder, tFaceOrder, tEdgeOrder, & + tCellOrient, tFaceOrient, tEdgeOrient, & + elemID, isLocal) +``` + +## Notes + +- The method assumes that the underlying mesh structure has been properly initialized. +- The arrays passed to this method should be pre-allocated with sufficient size to hold the data. +- Face order is replicated across all three rows of the `faceOrder` array for each face. diff --git a/docs/docs-api/FEDOF/GetPrefix.md b/docs/docs-api/FEDOF/GetPrefix.md new file mode 100644 index 00000000..73ddbdfd --- /dev/null +++ b/docs/docs-api/FEDOF/GetPrefix.md @@ -0,0 +1,14 @@ +# GetPrefix + +Returns the prefix used for setting data in FEDOF. + +## Interface + +```fortran +INTERFACE + MODULE FUNCTION GetPrefix(obj) RESULT(ans) + CLASS(FEDOF_), INTENT(IN) :: obj + CHARACTER(:), ALLOCATABLE :: ans + END FUNCTION GetPrefix +END INTERFACE +``` diff --git a/docs/docs-api/FEDOF/GetQuadraturePoints.md b/docs/docs-api/FEDOF/GetQuadraturePoints.md new file mode 100644 index 00000000..15923de3 --- /dev/null +++ b/docs/docs-api/FEDOF/GetQuadraturePoints.md @@ -0,0 +1,169 @@ +# GetQuadraturePoints + +The `GetQuadraturePoints` method generates quadrature points for numerical integration over a finite element. + +## Interface 1 + +```fortran +MODULE SUBROUTINE obj_GetQuadraturePoints1(obj, quad, globalElement, & + quadratureType, order, alpha, beta, lambda, islocal) + CLASS(FEDOF_), INTENT(INOUT) :: obj + !! fedof object + TYPE(QuadraturePoint_), INTENT(INOUT) :: quad + !! quadrature points + INTEGER(I4B), INTENT(IN) :: globalElement + !! global element number + INTEGER(I4B), INTENT(IN) :: quadratureType + !! Type of quadrature points + !! GaussLegendre ! GaussLegendreLobatto + !! GaussLegendreRadau, GaussLegendreRadauLeft + !! GaussLegendreRadauRight ! GaussChebyshev + !! GaussChebyshevLobatto ! GaussChebyshevRadau, GaussChebyshevRadauLeft + !! GaussChebyshevRadauRight + INTEGER(I4B), INTENT(IN) :: order + !! Order of integrand + !! either the order or the nips should be present + !! Both nips and order should not be present + REAL(DFP), OPTIONAL, INTENT(IN) :: alpha + !! Jacobi parameter + REAL(DFP), OPTIONAL, INTENT(IN) :: beta + !! Jacobi parameter + REAL(DFP), OPTIONAL, INTENT(IN) :: lambda + !! Ultraspherical parameter + LOGICAL(LGT), OPTIONAL, INTENT(IN) :: islocal + !! if true then global element is local element +END SUBROUTINE obj_GetQuadraturePoints1 +``` + +## Interface 2 + +```fortran +MODULE SUBROUTINE obj_GetQuadraturePoints2(obj, quad, globalElement, & + p, q, r, quadratureType1, quadratureType2, quadratureType3, alpha1, & + beta1, lambda1, alpha2, beta2, lambda2, alpha3, beta3, lambda3, islocal) + CLASS(FEDOF_), INTENT(INOUT) :: obj + !! abstract finite element + TYPE(QuadraturePoint_), INTENT(INOUT) :: quad + !! quadrature point + INTEGER(I4B), INTENT(IN) :: globalElement + !! global element number + INTEGER(I4B), INTENT(IN) :: p + !! order of integrand in x + INTEGER(I4B), INTENT(IN) :: q + !! order of integrand in y + INTEGER(I4B), INTENT(IN) :: r + !! order of integrand in z direction + INTEGER(I4B), INTENT(IN) :: quadratureType1 + !! Type of quadrature points ! GaussLegendre ! GaussLegendreLobatto + !! GaussLegendreRadau ! GaussLegendreRadauLeft ! GaussLegendreRadauRight + !! GaussChebyshev ! GaussChebyshevLobatto ! GaussChebyshevRadau + !! GaussChebyshevRadauLeft ! GaussChebyshevRadauRight + INTEGER(I4B), INTENT(IN) :: quadratureType2 + !! Type of quadrature points + INTEGER(I4B), INTENT(IN) :: quadratureType3 + !! Type of quadrature points + REAL(DFP), OPTIONAL, INTENT(IN) :: alpha1, beta1, lambda1 + !! Jacobi parameter and Ultraspherical parameters + REAL(DFP), OPTIONAL, INTENT(IN) :: alpha2, beta2, lambda2 + !! Jacobi parameter and Ultraspherical parameters + REAL(DFP), OPTIONAL, INTENT(IN) :: alpha3, beta3, lambda3 + !! Jacobi parameter and Ultraspherical parameters + LOGICAL(LGT), OPTIONAL, INTENT(IN) :: islocal + !! if true then the global element is local element +END SUBROUTINE obj_GetQuadraturePoints2 +``` + +## Description + +The `GetQuadraturePoints` method generates quadrature points for numerical integration over a finite element. It provides two variants: + +1. `GetQuadraturePoints1` - For isotropic integration (same order in all directions) +2. `GetQuadraturePoints2` - For anisotropic integration (different orders in different directions) + +These quadrature points are essential for accurately evaluating integrals in the finite element formulation. + +### Parameters for GetQuadraturePoints1 (Isotropic) + +- `obj` - Input/Output, `CLASS(FEDOF_)`, FEDOF object instance +- `quad` - Output, `TYPE(QuadraturePoint_)`, quadrature points object +- `globalElement` - Input, `INTEGER(I4B)`, global or local element number +- `quadratureType` - Input, `INTEGER(I4B)`, type of quadrature rule (Gauss-Legendre, Gauss-Chebyshev, etc.) +- `order` - Input, `INTEGER(I4B)`, polynomial order of the integrand +- `alpha`, `beta` - Optional Input, `REAL(DFP)`, Jacobi polynomial parameters +- `lambda` - Optional Input, `REAL(DFP)`, Ultraspherical polynomial parameter +- `islocal` - Optional Input, `LOGICAL(LGT)`, if true, `globalElement` is treated as a local element number + +### Parameters for GetQuadraturePoints2 (Anisotropic) + +- `obj` - Input/Output, `CLASS(FEDOF_)`, FEDOF object instance +- `quad` - Output, `TYPE(QuadraturePoint_)`, quadrature points object +- `globalElement` - Input, `INTEGER(I4B)`, global or local element number +- `p`, `q`, `r` - Input, `INTEGER(I4B)`, polynomial orders in x, y, and z directions +- `quadratureType1`, `quadratureType2`, `quadratureType3` - Input, `INTEGER(I4B)`, quadrature rule types for each direction +- `alpha1`, `beta1`, `lambda1`, etc. - Optional Input, `REAL(DFP)`, polynomial parameters for each direction +- `islocal` - Optional Input, `LOGICAL(LGT)`, if true, `globalElement` is treated as a local element number + +### Implementation Details + +Both methods determine the element topology and delegate to the appropriate finite element object: + +```fortran +ii = obj%mesh%GetElemTopologyIndx(globalElement=globalElement, islocal=islocal) + +CALL obj%fe(ii)%ptr%GetQuadraturePoints(quad=quad, order=order, +quadratureType = quadratureType, alpha = alpha, beta = beta, lambda = lambda) +``` + +For the anisotropic version: + +```fortran +CALL obj%fe(ii)%ptr%GetQuadraturePoints(quad=quad, p=p, q=q, r=r, +quadratureType1 = quadratureType1, quadratureType2 = quadratureType2, +quadratureType3 = quadratureType3, alpha1 = alpha1, beta1 = beta1, +lambda1 = lambda1, alpha2 = alpha2, beta2 = beta2, lambda2 = lambda2, +alpha3 = alpha3, beta3 = beta3, lambda3 = lambda3) +``` + +## Usage Example + +```fortran +! Example to get quadrature points for numerical integration +USE QuadraturePoint_Class +TYPE(QuadraturePoint_) :: myQuad +TYPE(FEDOF_) :: myDOF + +! Isotropic quadrature (same order in all directions) +CALL myDOF%GetQuadraturePoints(quad=myQuad, globalElement=5, & + quadratureType=GaussLegendre, order=4) + +! Anisotropic quadrature (different orders in different directions) +CALL myDOF%GetQuadraturePoints(quad=myQuad, globalElement=5, & + p=4, q=3, r=2, & + quadratureType1=GaussLegendre, & + quadratureType2=GaussLegendre, & + quadratureType3=GaussLegendre) + +! Now use myQuad for numerical integration +! ... +``` + +## Important Notes + +1. The `quadratureType` parameters should use predefined constants for different quadrature rules +2. The order should typically be at least twice the polynomial order of the element for accurate integration +3. Special parameters (alpha, beta, lambda) allow customization of certain quadrature rules +4. Different element types (triangles, tetrahedra, etc.) require appropriate quadrature rule selections + +## Related Methods + +- `GetLocalElemShapeData` - Uses quadrature points to evaluate shape functions +- `GetGlobalElemShapeData` - Maps quadrature points to the global coordinate system +- `GetCellOrder` - Can be used to determine appropriate integration order + +The `GetQuadraturePoints` method is a fundamental component of finite element analysis, providing the integration points and weights necessary for accurately evaluating weak form integrals in the finite element method. + +## Example 1 + +import EXAMPLE163 from "./examples/_GetQuadraturePoints_test_1.md"; + + diff --git a/docs/docs-api/FEDOF/GetTotalCellDOF.md b/docs/docs-api/FEDOF/GetTotalCellDOF.md new file mode 100644 index 00000000..133d47d5 --- /dev/null +++ b/docs/docs-api/FEDOF/GetTotalCellDOF.md @@ -0,0 +1,77 @@ +# GetTotalCellDOF + +The `GetTotalCellDOF` method in the `FEDOF_Class` provides the total number of degrees of freedom (DOF) associated with a cell in a finite element mesh. + +## Interface + +From the `FEDOF_Class.F90` file, the `GetTotalCellDOF` method has the following interface: + +```fortran +PROCEDURE, PUBLIC, PASS(obj) :: GetTotalCellDOF => obj_GetTotalCellDOF +!! Get total cell degrees of freedom +``` + +The specific interface is defined as: + +```fortran +MODULE FUNCTION obj_GetTotalCellDOF(obj, globalCell, islocal) RESULT(ans) + CLASS(FEDOF_), INTENT(IN) :: obj + INTEGER(I4B), INTENT(IN) :: globalCell + LOGICAL(LGT), INTENT(IN), OPTIONAL :: islocal + INTEGER(I4B) :: ans +END FUNCTION obj_GetTotalCellDOF +``` + +## Description + +The `GetTotalCellDOF` method calculates the total number of degrees of freedom associated with a specific cell (volumetric element) in a finite element mesh. + +### Parameters + +- `obj` - Input, `CLASS(FEDOF_)`, FEDOF object instance +- `globalCell` - Input, `INTEGER(I4B)`, global cell number or local cell number (depends on islocal) +- `islocal` - Optional Input, `LOGICAL(LGT)`, if true, `globalCell` is treated as a local cell number +- `ans` - Output, `INTEGER(I4B)`, total number of DOFs on the specified cell + +### Implementation Details + +The implementation uses the internal cell index array structure to calculate the total DOF count: + +```fortran +INTEGER(I4B) :: jj +jj = obj%mesh%GetLocalElemNumber(globalElement=globalCell, islocal=islocal) +ans = obj%cellIA(jj + 1) - obj%cellIA(jj) +``` + +This efficiently computes the number of DOFs by finding the difference between consecutive indices in the compressed sparse row format that stores the cell degrees of freedom. + +## Usage Example + +```fortran +! Example to get total DOFs on a cell +INTEGER(I4B) :: totalDOFs +TYPE(FEDOF_) :: myDOF + +! Get total DOFs on cell #5 +totalDOFs = myDOF%GetTotalCellDOF(globalCell=5) + +! Get total DOFs using local cell numbering +totalDOFs = myDOF%GetTotalCellDOF(globalCell=2, islocal=.TRUE.) +``` + +## Related Methods + +- `GetCellDOF` - Retrieves the actual DOF indices for a cell +- `GetTotalEdgeDOF` - Gets total DOF count for element edges +- `GetTotalFaceDOF` - Gets total DOF count for element faces +- `GetTotalVertexDOF` - Gets total DOF count for vertices +- `GetTotalDOF` - Gets total DOF count for an entire element or the entire mesh + +These methods together provide a complete interface for accessing and counting degrees of freedom in different components of the finite element mesh hierarchy (vertices, edges, faces, cells). + +## Example 1 + +import EXAMPLE74 from "./examples/_GetTotalCellDOF_test_1.md"; + + + diff --git a/docs/docs-api/FEDOF/GetTotalDOF.md b/docs/docs-api/FEDOF/GetTotalDOF.md new file mode 100644 index 00000000..4e729adf --- /dev/null +++ b/docs/docs-api/FEDOF/GetTotalDOF.md @@ -0,0 +1,128 @@ +# GetTotalDOF + +These methods provide a comprehensive interface for querying degree of freedom information at different levels of granularity, from global system-wide counts to element-specific and entity-specific counts. + +| Method | Purpose | +| ---------------- | ------------------------------------------------------------------- | +| **GetTotalDOF1** | Returns the total number of degrees of freedom in the entire domain | +| **GetTotalDOF2** | Returns the total number of DOFs for a specific element | +| **GetTotalDOF3** | Returns filtered DOFs for a specific element based on entity type | + +## Interface 1 + +```fortran +MODULE FUNCTION obj_GetTotalDOF1(obj) RESULT(ans) + CLASS(FEDOF_), INTENT(IN) :: obj + INTEGER(I4B) :: ans +END FUNCTION obj_GetTotalDOF1 +``` + +### Parameters + +- `obj`: The FEDOF_ object +- `ans`: Integer result containing the total number of degrees of freedom + +### Functionality + +This method returns the total number of degrees of freedom in the entire FEDOF object. It simply returns the `tdof` field of the object, which represents the global count of all degrees of freedom across the domain. + +## Interface 2 + +```fortran +MODULE FUNCTION obj_GetTotalDOF2(obj, globalElement, islocal) RESULT(ans) + CLASS(FEDOF_), INTENT(IN) :: obj + INTEGER(I4B), INTENT(IN) :: globalElement + LOGICAL(LGT), OPTIONAL, INTENT(IN) :: islocal + INTEGER(I4B) :: ans +END FUNCTION obj_GetTotalDOF2 +``` + +### Parameters + +- `obj`: The FEDOF_ object +- `globalElement`: Global element number to retrieve the total DOFs for +- `islocal`: Optional logical flag - if true, globalElement is treated as a local element number +- `ans`: Integer result containing the total number of degrees of freedom for the specified element + +### Functionality + +This method returns the total number of degrees of freedom associated with a specific element. It: + +1. Gets the element data pointer for the specified element +2. Retrieves the total entities (points, edges, faces, cells) for the element +3. Counts vertex node DOFs +4. Adds the DOFs from all edges of the element +5. Adds the DOFs from all faces of the element +6. Adds the DOFs from the cell itself +7. Returns the total sum as the result + +## Interface 3 + +```fortran +MODULE FUNCTION obj_GetTotalDOF3(obj, globalElement, opt, islocal) RESULT(ans) + CLASS(FEDOF_), INTENT(IN) :: obj + INTEGER(I4B), INTENT(IN) :: globalElement + !! global or local element number + CHARACTER(*), INTENT(IN) :: opt + !! opt for Vertex, Edge, Face, Cell, and All + !! opt = Vertex + !! opt = Edge + !! opt = Face + !! opt = Cell + !! opt = All + LOGICAL(LGT), OPTIONAL, INTENT(IN) :: islocal + !! if islocal true then globalElement is local element number + INTEGER(I4B) :: ans + !! Total number of dof in the FEDOF with opt filter +END FUNCTION obj_GetTotalDOF3 +``` + +### Parameters + +- `obj`: The FEDOF_ object +- `globalElement`: Global element number to retrieve the total DOFs for +- `opt`: Filter option specifying which type of DOFs to count + - "Vertex" or "V" - Only count vertex DOFs + - "Edge" or "E" - Only count edge DOFs + - "Face" or "F" - Only count face DOFs + - "Cell" or "C" - Only count cell DOFs + - Any other value - Count all DOFs (same as GetTotalDOF2) +- `islocal`: Optional logical flag - if true, globalElement is treated as a local element number +- `ans`: Integer result containing the filtered total of degrees of freedom + +### Functionality + +This method is similar to GetTotalDOF2 but allows filtering the DOF count by entity type. It: + +1. Gets the element data pointer for the specified element +2. Checks the first character of the opt parameter to determine which entity types to include +3. Calls the appropriate internal subroutine(s) to count DOFs for the selected entity types: + - onlyVertex: Counts vertex DOFs + - onlyEdge: Counts edge DOFs + - onlyFace: Counts face DOFs + - onlyCell: Counts cell DOFs +4. Returns the total sum as the result + +## Usage + +The generic `GetTotalDOF` method is fundamental in finite element analysis for: + +- Allocating memory for element matrices and vectors +- Determining the size of local element contributions +- Computing the total size of the global system +- Estimating computational requirements +- Filtering DOFs by entity type for specialized operations + +This flexible interface allows for both global analysis (total DOFs in the system), local element-wise operations (DOFs per element), and entity-specific queries (e.g., only edge DOFs), providing comprehensive flexibility in how degree of freedom information is accessed throughout the finite element code. + +## Example 1 + +import EXAMPLE120 from "./examples/_GetTotalDOF_test_1.md"; + + + +## Example 2 + +import EXAMPLE121 from "./examples/_GetTotalDOF_test_2.md"; + + diff --git a/docs/docs-api/FEDOF/GetTotalEdgeDOF.md b/docs/docs-api/FEDOF/GetTotalEdgeDOF.md new file mode 100644 index 00000000..2e42dd38 --- /dev/null +++ b/docs/docs-api/FEDOF/GetTotalEdgeDOF.md @@ -0,0 +1,93 @@ +# GetTotalEdgeDOF + +The `GetTotalEdgeDOF` generic method in the `FEDOF_Class` provides the total number of degrees of freedom (DOF) associated with an edge in a finite element mesh. + +## Interface + +```fortran +MODULE FUNCTION obj_GetTotalEdgeDOF1(obj, globalEdge, islocal) RESULT(ans) + CLASS(FEDOF_), INTENT(IN) :: obj + INTEGER(I4B), INTENT(IN) :: globalEdge + LOGICAL(LGT), INTENT(IN), OPTIONAL :: islocal + INTEGER(I4B) :: ans +END FUNCTION obj_GetTotalEdgeDOF1 + +MODULE FUNCTION obj_GetTotalEdgeDOF2(obj, globalElement, localEdgeNumber, & + islocal) RESULT(ans) + CLASS(FEDOF_), INTENT(IN) :: obj + INTEGER(I4B), INTENT(IN) :: globalElement + !! global or local cell element number + INTEGER(I4B), INTENT(IN) :: localEdgeNumber + !! local edge number in global element + LOGICAL(LGT), INTENT(IN), OPTIONAL :: islocal + !! if true then globalElement is local element + INTEGER(I4B) :: ans +END FUNCTION obj_GetTotalEdgeDOF2 +``` + +## Description + +The `GetTotalEdgeDOF` generic method provides two implementations to retrieve the total edge DOF count: + +1. `GetTotalEdgeDOF1` - Gets total DOF count directly using a global edge number +2. `GetTotalEdgeDOF2` - Gets total DOF count using a global element number and local edge number within that element + +## Interface 1: GetTotalEdgeDOF1 + +### Parameters + +- `obj` - Input, `CLASS(FEDOF_)`, FEDOF object instance +- `globalEdge` - Input, `INTEGER(I4B)`, global edge number +- `islocal` - Optional Input, `LOGICAL(LGT)`, if true, `globalEdge` is treated as a local edge number +- `ans` - Output, `INTEGER(I4B)`, total number of DOFs on the specified edge + +### Implementation Details + +The implementation uses the internal edge index array structure to calculate the total DOF count: + +```fortran +ans = obj%edgeIA(globalEdge + 1) - obj%edgeIA(globalEdge) +``` + +## Interface 2: GetTotalEdgeDOF2 + +### Parameters + +- `obj` - Input, `CLASS(FEDOF_)`, FEDOF object instance +- `globalElement` - Input, `INTEGER(I4B)`, global or local cell element number +- `localEdgeNumber` - Input, `INTEGER(I4B)`, local edge number in global element +- `islocal` - Optional Input, `LOGICAL(LGT)`, if true, `globalElement` is treated as a local element +- `ans` - Output, `INTEGER(I4B)`, total number of DOFs on the specified edge + +### Implementation Details + +This implementation first converts the element and local edge information to a global edge number, then calls the first implementation: + +```fortran +INTEGER(I4B) :: globalEdge +globalEdge = obj%mesh%GetGlobalEdgeNumber(globalElement=globalElement, & + islocal=islocal, localEdgeNumber=localEdgeNumber) +ans = obj%GetTotalEdgeDOF(globalEdge=globalEdge, islocal=islocal) +``` + +## Usage Example + +```fortran +! Example to get total DOFs on an edge +INTEGER(I4B) :: totalDOFs +TYPE(FEDOF_) :: myDOF + +! Method 1: Using global edge number +totalDOFs = myDOF%GetTotalEdgeDOF(globalEdge=8) + +! Method 2: Using element and local edge number +totalDOFs = myDOF%GetTotalEdgeDOF(globalElement=15, localEdgeNumber=3) +``` + +## Related Methods + +- `GetEdgeDOF` - Retrieves the actual DOF indices for an edge +- `GetTotalFaceDOF` - Similar function but for element faces +- `GetTotalDOF` - Gets total DOF count for an entire element or the entire mesh +- `GetTotalVertexDOF` - Gets total DOF count for vertices + diff --git a/docs/docs-api/FEDOF/GetTotalFaceDOF.md b/docs/docs-api/FEDOF/GetTotalFaceDOF.md new file mode 100644 index 00000000..2a4d66ba --- /dev/null +++ b/docs/docs-api/FEDOF/GetTotalFaceDOF.md @@ -0,0 +1,116 @@ +# GetTotalFaceDOF + +The `GetTotalFaceDOF` generic method in the `FEDOF_Class` provides the total number of degrees of freedom (DOF) associated with a face in a finite element mesh. + +## Interfaces + +From the `FEDOF_Class.F90` file, the `GetTotalFaceDOF` generic method has the following interfaces: + +```fortran +PROCEDURE, PASS(obj) :: GetTotalFaceDOF1 => GetTotalFaceDOF1 +!! Get total face dof +PROCEDURE, PASS(obj) :: GetTotalFaceDOF2 => GetTotalFaceDOF2 +!! Get total face dof from global element and local face number +GENERIC, PUBLIC :: GetTotalFaceDOF => GetTotalFaceDOF1, GetTotalFaceDOF2 +``` + +The specific interfaces are defined as: + +```fortran +MODULE FUNCTION GetTotalFaceDOF1(obj, globalFace, islocal) RESULT(ans) + CLASS(FEDOF_), INTENT(IN) :: obj + INTEGER(I4B), INTENT(IN) :: globalFace + LOGICAL(LGT), INTENT(IN), OPTIONAL :: islocal + INTEGER(I4B) :: ans +END FUNCTION GetTotalFaceDOF1 + +MODULE FUNCTION GetTotalFaceDOF2(obj, globalElement, localFaceNumber, & + islocal) RESULT(ans) + CLASS(FEDOF_), INTENT(IN) :: obj + !! DOF object + INTEGER(I4B), INTENT(IN) :: globalElement + !! global or local element number + INTEGER(I4B), INTENT(IN) :: localFaceNumber + !! local face number in globall element + LOGICAL(LGT), INTENT(IN), OPTIONAL :: islocal + !! if true then globalElement is local element + INTEGER(I4B) :: ans + !! Total number of degree of freedom on face +END FUNCTION GetTotalFaceDOF2 +``` + +## Description + +The `GetTotalFaceDOF` generic method provides two implementations to retrieve the total face DOF count: + +1. `GetTotalFaceDOF1` - Gets total DOF count directly using a global face number +2. `GetTotalFaceDOF2` - Gets total DOF count using a global element number and local face number within that element + +## Interface 1: GetTotalFaceDOF1 + +### Parameters + +- `obj` - Input, `CLASS(FEDOF_)`, FEDOF object instance +- `globalFace` - Input, `INTEGER(I4B)`, global face number +- `islocal` - Optional Input, `LOGICAL(LGT)`, if true, `globalFace` is treated as a local face number +- `ans` - Output, `INTEGER(I4B)`, total number of DOFs on the specified face + +### Implementation Details + +The implementation uses the internal face index array structure to calculate the total DOF count: + +```fortran +ans = obj%faceIA(globalface + 1) - obj%faceIA(globalface) +``` + +This efficiently computes the number of DOFs by finding the difference between consecutive indices in the compressed sparse row format. + +## Interface 2: GetTotalFaceDOF2 + +### Parameters + +- `obj` - Input, `CLASS(FEDOF_)`, DOF object +- `globalElement` - Input, `INTEGER(I4B)`, global or local element number +- `localFaceNumber` - Input, `INTEGER(I4B)`, local face number in global element +- `islocal` - Optional Input, `LOGICAL(LGT)`, if true, `globalElement` is treated as a local element +- `ans` - Output, `INTEGER(I4B)`, total number of degrees of freedom on the specified face + +### Implementation Details + +This implementation first converts the element and local face information to a global face number, then calls the first implementation: + +```fortran +INTEGER(I4B) :: globalFace +globalFace = obj%mesh%GetGlobalFaceNumber(globalElement=globalElement, & + islocal=islocal, localFaceNumber=localFaceNumber) +ans = obj%GetTotalFaceDOF(globalFace=globalFace, islocal=islocal) +``` + +## Usage Example + +```fortran +! Example to get total DOFs on a face +INTEGER(I4B) :: totalDOFs +TYPE(FEDOF_) :: myDOF + +! Method 1: Using global face number +totalDOFs = myDOF%GetTotalFaceDOF(globalFace=3) + +! Method 2: Using element and local face number +totalDOFs = myDOF%GetTotalFaceDOF(globalElement=7, localFaceNumber=2) +``` + +## Related Methods + +- `GetFaceDOF` - Retrieves the actual DOF indices for a face +- `GetTotalEdgeDOF` - Similar function but for element edges +- `GetTotalDOF` - Gets total DOF count for an entire element or the entire mesh +- `GetTotalVertexDOF` - Gets total DOF count for vertices + +These methods are essential for traversing and accessing degrees of freedom in different components of the mesh hierarchy (vertices, edges, faces, cells). + +## Example 1 + +import EXAMPLE115 from "./examples/_GetTotalFaceDOF_test_1.md"; + + diff --git a/docs/docs-api/FEDOF/GetTotalVertexDOF.md b/docs/docs-api/FEDOF/GetTotalVertexDOF.md new file mode 100644 index 00000000..91100e2d --- /dev/null +++ b/docs/docs-api/FEDOF/GetTotalVertexDOF.md @@ -0,0 +1,72 @@ +# GetTotalVertexDOF + +The `GetTotalVertexDOF` method in the `FEDOF_Class` returns the total number of vertex degrees of freedom (DOFs) in a finite element discretization. In the context of EASIFEM (Expandable And Scalable Infrastructure for Finite Element Methods), vertex DOFs represent the degrees of freedom associated with the vertices/nodes of the mesh. + +## Interface + +```fortran +MODULE FUNCTION obj_GetTotalVertexDOF(obj) RESULT(ans) + CLASS(FEDOF_), INTENT(IN) :: obj + INTEGER(I4B) :: ans +END FUNCTION obj_GetTotalVertexDOF +``` + +## Arguments + +| Argument | Intent | Description | +| -------- | ------ | ----------------------------- | +| `obj` | `IN` | An instance of `FEDOF_` class | + +## Returns + +| Type | Description | +| -------------- | ---------------------------------------------------------------------------------------- | +| `INTEGER(I4B)` | The total number of vertex DOFs, which is equal to the total number of nodes in the mesh | + +## Example Usage + +```fortran +PROGRAM demo +USE GlobalData +USE FEDOF_Class +USE AbstractMesh_Class + +TYPE(FEDOF_) :: dof +CLASS(AbstractMesh_), POINTER :: mesh +INTEGER(I4B) :: totalVertexDOF + +! Initialize mesh and dof objects +! ... + +! Get total vertex DOFs +totalVertexDOF = dof%GetTotalVertexDOF() + +PRINT *, "Total vertex DOFs: ", totalVertexDOF +END PROGRAM +``` + +## Implementation Details + +The implementation of `GetTotalVertexDOF` is straightforward. It returns the value of the `tNodes` member variable of the `FEDOF_` object, which represents the total number of nodes in the mesh: + +```fortran +MODULE PROCEDURE obj_GetTotalVertexDOF +ans = obj%tNodes +END PROCEDURE obj_GetTotalVertexDOF +``` + +This method is particularly useful when you need to know the number of nodal degrees of freedom in the mesh, for example, when allocating arrays or initializing data structures that depend on this count. + +## Notes + +- In many finite element applications, each vertex (node) has at least one degree of freedom. +- The method returns the total number of vertex DOFs regardless of the continuity or conformity of the basis functions used. +- For H1-conforming elements, the vertex DOFs are typically scalar values at each node. +- For vector problems (like elasticity), each vertex may have multiple DOFs (e.g., displacement in x, y, and z directions). + +## See Also + +- `GetTotalDOF`: Returns the total number of DOFs (vertex, edge, face, and cell) in the mesh +- `GetVertexDOF`: Gets the specific DOF IDs associated with a given vertex +- `GetConnectivity`: Gets the DOF connectivity for an element + diff --git a/docs/docs-api/FEDOF/GetVertexDOF.md b/docs/docs-api/FEDOF/GetVertexDOF.md new file mode 100644 index 00000000..0ef2e418 --- /dev/null +++ b/docs/docs-api/FEDOF/GetVertexDOF.md @@ -0,0 +1,76 @@ +# GetVertexDOF + +The `GetVertexDOF` method retrieves the degree of freedom (DOF) number associated with a specified vertex (node) in the mesh. In finite element analysis, each vertex in the mesh is typically assigned one or more degrees of freedom, which represent the unknown values to be solved for. + +## Interface + +```fortran +INTERFACE + MODULE SUBROUTINE GetVertexDOF(obj, globalNode, ans, tsize, islocal) + CLASS(FEDOF_), INTENT(IN) :: obj + INTEGER(I4B), INTENT(IN) :: globalNode + INTEGER(I4B), INTENT(INOUT) :: ans(:) + INTEGER(I4B), INTENT(OUT) :: tsize + LOGICAL(LGT), INTENT(IN), OPTIONAL :: islocal + END SUBROUTINE GetVertexDOF +END INTERFACE +``` + +## Parameters + +- `obj` - The `FEDOF_` object containing degree of freedom information +- `globalNode` - The global or local node number, depending on the value of `islocal` +- `ans` - An array that will store the degree of freedom number(s) associated with the specified node +- `tsize` - The number of degrees of freedom written to the `ans` array +- `islocal` - Optional logical flag. If present and `.TRUE.`, `globalNode` is interpreted as a local node number; otherwise, it's a global node number + +## Implementation Details + +The implementation is straightforward for vertex DOFs: + +```fortran +tsize = 1 +ans(1) = obj%mesh%GetLocalNodeNumber(globalNode, islocal=islocal) +``` + +For vertex DOFs in most finite element formulations: + +1. The method sets `tsize` to 1, indicating that one degree of freedom is associated with each vertex +2. It obtains the local node number using the mesh's `GetLocalNodeNumber` method, which converts global node numbers to local ones if necessary +3. The local node number itself is used as the degree of freedom number + +## Notes + +- This method assumes a simple one-to-one mapping between mesh vertices and degrees of freedom, which is typical for scalar problems (e.g., heat conduction, potential flow) +- For vector problems (e.g., elasticity) or higher-order problems, a more complex mapping might be needed, potentially requiring multiple DOFs per vertex +- The implementation reflects that in typical finite element numbering schemes, vertex DOFs are numbered first, followed by edge, face, and cell DOFs +- In the current implementation, the DOF number for a vertex is identical to its local node number in the mesh + +## Example Usage + +This method is typically used when assembling the global system of equations or when mapping local element matrices to the global system: + +```fortran +INTEGER(I4B) :: nodeDOF(1), tsize, nodeNum + +! Get the DOF number for node 5 +nodeNum = 5 +CALL fedof%GetVertexDOF(globalNode=nodeNum, ans=nodeDOF, tsize=tsize) + +! nodeDOF(1) now contains the DOF number for node 5 +! tsize will be 1 +``` + +This method is often called internally by other methods in the `FEDOF_` class, particularly when constructing element connectivity arrays that map local element degrees of freedom to global system degrees of freedom. + +## Example 1 + +import EXAMPLE69 from "./examples/_GetVertexDOF_test_1.md"; + + + +## Example 2 + +import EXAMPLE76 from "./examples/_GetVertexDOF_test_2.md"; + + diff --git a/docs/docs-api/FEDOF/ImportFromToml.md b/docs/docs-api/FEDOF/ImportFromToml.md index d76e3c31..759f43b7 100644 --- a/docs/docs-api/FEDOF/ImportFromToml.md +++ b/docs/docs-api/FEDOF/ImportFromToml.md @@ -4,6 +4,11 @@ title: ImportFromToml This method imports the configuration form a toml file and initiates the FEDOF instance. +The `ImportFromToml` method has two implementations: + +1. `ImportFromToml1` - Imports configuration from a TOML table that's already loaded +2. `ImportFromToml2` - Imports configuration from a TOML file by name + ## Interface 1 In this interface to import the data we specify the toml table and mesh. diff --git a/docs/docs-api/FEDOF/Initiate.md b/docs/docs-api/FEDOF/Initiate.md index a78bf878..4f03888f 100644 --- a/docs/docs-api/FEDOF/Initiate.md +++ b/docs/docs-api/FEDOF/Initiate.md @@ -1,16 +1,17 @@ ---- -sidebar_position: 4 ---- - # Initiate -This method initiates an instance of `FEDOF`. -There are several ways to initiate an instance of `FEDOF`. +This method initiates an instance of `FEDOF`. There are several ways to initiate an instance of `FEDOF`. + +The `Initiate` method has four different implementations: + +1. `Initiate1` - Initializes with homogeneous order for all elements +2. `Initiate2` - Initializes with inhomogeneous orders specified per element +3. `Initiate3` - Initializes from a parameter list +4. `Initiate4` - Initializes from an order vector defined for global elements ## Interface 1 -- Homogeneous order -- In case of `H1` Lagrange `FEDOF`, order is determined from the cell order of each mesh. +This method is for Homogeneous order, that is, all elements in the mesh have the same order. ```fortran INTERFACE @@ -48,29 +49,134 @@ INTERFACE END INTERFACE ``` +### Description + +This subroutine configures a FEDOF object by setting up the basis functions, continuity, and interpolation properties based on a given mesh and order. + +### Parameters + +| Parameter | Type | Intent | Description | +| ------------------- | ---------------------------- | ------ | ----------------------------------------------------------------------- | +| `obj` | CLASS(FEDOF_) | INOUT | The FEDOF object to be initialized. | +| `order` | INTEGER(I4B) | IN | Homogeneous polynomial order for the basis functions. | +| `mesh` | CLASS(AbstractMesh_), TARGET | IN | The computational mesh defining the spatial discretization. | +| `baseContinuity` | CHARACTER(*) | IN | Specifies the continuity of basis functions (regularity or conformity). | +| `baseInterpolation` | CHARACTER(*) | IN | Type of basis function used for interpolation. | + +### Optional Parameters + +| Parameter | Type | Intent | Optional | Description | +| ----------- | ------------ | ------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| `ipType` | INTEGER(I4B) | IN | Yes | Interpolation point type. Used when `baseInterpolation` is set to Lagrange. | +| `basisType` | INTEGER(I4B) | IN | Yes | Array specifying types of basis functions used for constructing Lagrange polynomials. Used when `baseInterpolation` is Lagrange. | +| `alpha` | REAL(DFP) | IN | Yes | Alpha parameters for Jacobi polynomials. Required when `baseInterpolation` is Lagrange and `basisType` is Jacobi. | +| `beta` | REAL(DFP) | IN | Yes | Beta parameters for Jacobi polynomials. Required when `baseInterpolation` is Lagrange and `basisType` is Jacobi. | +| `lambda` | REAL(DFP) | IN | Yes | Lambda parameters for Ultraspherical polynomials. Required when `baseInterpolation` is Lagrange and `basisType` is Ultraspherical. | + +### Usage Example + +```fortran +CALL myFEDOF%Initiate(order=2, mesh=myMesh, baseContinuity="H1", & + baseInterpolation="Lagrange", ipType=GAUSS_LOBATTO) +``` + ## Interface 2 - Here order represents the order of each cell element. -- In case of `H1` Lagrange `FEDOF`, order is determined from the cell order of each mesh. +- `order` is a vector of integers, the length of `order` must be equal to the number of elements in the mesh. +- `order(i)` is the order of local element `i`. ```fortran INTERFACE MODULE SUBROUTINE Initiate(obj, order, mesh, baseContinuity, & - baseInterpolation, ipType, basisType, alpha, lambda, beta) + baseInterpolation, ipType, basisType, alpha, lambda, beta, islocal) CLASS(FEDOF_), INTENT(INOUT) :: obj + !! Finite degree of freedom object INTEGER(I4B), INTENT(IN) :: order(:) + !! Inhomogeneous value of order + !! This is order of each cell element + !! see the note on islocal CLASS(AbstractMesh_), TARGET, INTENT(IN) :: mesh + !! cell mesh CHARACTER(*), INTENT(IN) :: baseContinuity + !! continuity of basis (regularity) CHARACTER(*), INTENT(IN) :: baseInterpolation + !! basis function used for interpolation INTEGER(I4B), OPTIONAL, INTENT(IN) :: ipType + !! interpolation type + !! used when baseInterpolation is Lagrange INTEGER(I4B), OPTIONAL, INTENT(IN) :: basisType(:) + !! type of basis function used for + !! constructing the Lagrange polynomial + !! Used when baseInterpolation is Lagrange REAL(DFP), OPTIONAL, INTENT(IN) :: alpha(:) + !! alpha parameter for jacobian parameter + !! used when baseInterpolation is Lagrange + !! used when basistype is Jacobi REAL(DFP), OPTIONAL, INTENT(IN) :: beta(:) + !! beta parameter for jacobian parameter + !! used when baseInterpolation is Lagrange + !! used when basistype is Jacobi REAL(DFP), OPTIONAL, INTENT(IN) :: lambda(:) + !! lambda parameter for Ultraspherical parameter + !! used when baseInterpolation is Lagrange + !! used when basistype is Ultraspherical + LOGICAL(LGT), OPTIONAL, INTENT(IN) :: islocal + !! islocal denotes whether the order(:) is based on + !! local element or global element number. + !! local element means in order(ii) ii is the local + !! element number, global element means in order(ii) ii is the + !! global element number. Note that getting local element + !! number is difficult for user, so it is better to use + !! global element number. END SUBROUTINE Initiate END INTERFACE ``` +### Description + +This subroutine configures a FEDOF object using inhomogeneous orders across mesh elements, allowing different polynomial orders for different parts of the domain. + +### Parameters + +| Parameter | Type | Intent | Description | +| ------------------- | ---------------------------- | ------ | -------------------------------------------------------------- | +| `obj` | CLASS(FEDOF_) | INOUT | The Finite Element Degree of Freedom object to be initialized. | +| `order` | INTEGER(I4B)(:) | IN | Array of polynomial orders for each cell element. | +| `mesh` | CLASS(AbstractMesh_), TARGET | IN | The computational mesh defining the spatial discretization. | +| `baseContinuity` | CHARACTER(*) | IN | Specifies the continuity of basis functions (regularity). | +| `baseInterpolation` | CHARACTER(*) | IN | Type of basis function used for interpolation. | + +### Optional Parameters + +| Parameter | Type | Intent | Description | +| ----------- | --------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------- | +| `ipType` | INTEGER(I4B) | IN | Interpolation point type. Used when `baseInterpolation` is set to Lagrange. | +| `basisType` | INTEGER(I4B)(:) | IN | Array specifying types of basis functions used for constructing Lagrange polynomials. Used when `baseInterpolation` is Lagrange. | +| `alpha` | REAL(DFP)(:) | IN | Alpha parameters for Jacobi polynomials. Required when `baseInterpolation` is Lagrange and `basisType` is Jacobi. | +| `beta` | REAL(DFP)(:) | IN | Beta parameters for Jacobi polynomials. Required when `baseInterpolation` is Lagrange and `basisType` is Jacobi. | +| `lambda` | REAL(DFP)(:) | IN | Lambda parameters for Ultraspherical polynomials. Required when `baseInterpolation` is Lagrange and `basisType` is Ultraspherical. | +| `islocal` | LOGICAL(LGT) | IN | Specifies whether `order` array references local element numbers (TRUE) or global element numbers (FALSE, default). | + +### Usage Example + +```fortran +! Create an array with different orders for different elements +INTEGER(I4B) :: elementOrders(mesh%getTotalElements()) +elementOrders = [1, 2, 2, 3, 2, 1] ! Example orders + +CALL myFEDOF%Initiate(order=elementOrders, mesh=myMesh, & + baseContinuity="H1", baseInterpolation="Lagrange", & + ipType=GAUSS_LOBATTO, islocal=.FALSE.) +``` + +### Notes + +- The length of the `order` array must match the number of elements in the mesh. +- When `islocal` is not provided or is FALSE, the indices in `order` correspond to global element numbers. +- When `islocal` is TRUE, the indices in `order` correspond to local element numbers, which may be different from global numbering. +- Using global element numbering is generally easier for users to work with. + ## Interface 3 - This method is used to initiate `FEDOF` by using `ParameterList`. @@ -85,17 +191,28 @@ INTERFACE END INTERFACE ``` +:::warning WIP +This interface is still under development and may not be fully functional yet. +::: + ## Interface 4 -This routine is similar to the interface 2, but the order of the element is defined for global element numbers. -`order` is a two-dimensional array. The number of rows in order is equal to 2, the first row contains the global element number the second row contains the order. This routine will make `order0(:)` from `order(:,:)` and call `Initiate2`. +- This routine is similar to the Interface 2, but the order of the element is defined for global element numbers. +- This method is more useful for the user who have no idea about the local element number. +- `order` is a two-dimensional array. + - The number of rows in order is equal to 2 + - The first row contains the global element number + - The second row contains the order. + +:::note +This routine will make `order0(:)` from `order(:,:)` and call `Initiate2` method internally. +::: ```fortran INTERFACE - MODULE SUBROUTINE Initiate(obj, order, mesh, baseContinuity, & + MODULE SUBROUTINE obj_Initiate4(obj, order, mesh, baseContinuity, & baseInterpolation, ipType, basisType, alpha, beta, lambda) CLASS(FEDOF_), INTENT(INOUT) :: obj - !! FEDOF INTEGER(I4B), INTENT(IN) :: order(:, :) !! the number of columns in order is equal to total number of elements !! the number of rows in order is equal to 2 @@ -108,59 +225,91 @@ INTERFACE CHARACTER(*), INTENT(IN) :: baseInterpolation !! interpolation of basis INTEGER(I4B), OPTIONAL, INTENT(IN) :: ipType - !! interpolation point type, needed for Lagrange polynomial + !! interpolation type + !! used when baseInterpolation is Lagrange INTEGER(I4B), OPTIONAL, INTENT(IN) :: basisType(:) - !! basis type, needed for Lagrange polynomial only + !! type of basis function used for + !! constructing the Lagrange polynomial + !! Used when baseInterpolation is Lagrange REAL(DFP), OPTIONAL, INTENT(IN) :: alpha(:) !! alpha parameter for jacobian parameter + !! used when baseInterpolation is Lagrange + !! used when basistype is Jacobi REAL(DFP), OPTIONAL, INTENT(IN) :: beta(:) !! beta parameter for jacobian parameter + !! used when baseInterpolation is Lagrange + !! used when basistype is Jacobi REAL(DFP), OPTIONAL, INTENT(IN) :: lambda(:) - END SUBROUTINE Initiate + !! lambda parameter for Ultraspherical parameter + !! used when baseInterpolation is Lagrange + !! used when basistype is Ultraspherical + END SUBROUTINE obj_Initiate4 END INTERFACE ``` -## Examples +### Parameters - - +| Parameter | Type | Intent | Description | +| ------------------- | ---------------------------- | ------ | ------------------------------------------------------------- | +| `obj` | CLASS(FEDOF_) | INOUT | The FEDOF object to be initialized. | +| `order` | INTEGER(I4B)(:,:) | IN | 2×N array where N is the number of elements to be configured. | +| `mesh` | CLASS(AbstractMesh_), TARGET | IN | The computational mesh defining the spatial discretization. | +| `baseContinuity` | CHARACTER(*) | IN | Specifies the continuity of basis functions (regularity). | +| `baseInterpolation` | CHARACTER(*) | IN | Type of basis function used for interpolation. | -import EXAMPLE129 from "./examples/_Initiate_test_1.md"; +### Optional Parameters - +| Parameter | Type | Intent | Description | +| ----------- | --------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------- | +| `ipType` | INTEGER(I4B) | IN | Interpolation point type. Used when `baseInterpolation` is set to Lagrange. | +| `basisType` | INTEGER(I4B)(:) | IN | Array specifying types of basis functions used for constructing Lagrange polynomials. Used when `baseInterpolation` is Lagrange. | +| `alpha` | REAL(DFP)(:) | IN | Alpha parameters for Jacobi polynomials. Required when `baseInterpolation` is Lagrange and `basisType` is Jacobi. | +| `beta` | REAL(DFP)(:) | IN | Beta parameters for Jacobi polynomials. Required when `baseInterpolation` is Lagrange and `basisType` is Jacobi. | +| `lambda` | REAL(DFP)(:) | IN | Lambda parameters for Ultraspherical polynomials. Required when `baseInterpolation` is Lagrange and `basisType` is Ultraspherical. | - +### Usage Example - - -import EXAMPLE139 from "./examples/_Initiate_test_2.md"; +```fortran +! Create a 2×3 array to specify orders for three specific elements +INTEGER(I4B) :: elementOrders(2, 3) +! First row: global element numbers +elementOrders(1, :) = [1, 5, 10] +! Second row: corresponding polynomial orders +elementOrders(2, :) = [2, 3, 1] + +CALL myFEDOF%Initiate(order=elementOrders, mesh=myMesh, & + baseContinuity="H1", baseInterpolation="Lagrange", & + ipType=GAUSS_LOBATTO) +``` - +### Notes - +- This interface is more user-friendly as it allows specifying orders only for elements of interest using their global numbers. +- Internally, this method constructs a complete order array and calls Interface 2. +- The number of columns in the `order` array can be less than the total number of elements in the mesh - only specified elements will receive custom orders. - +## Example (H1, Hierarchical, Uniform Order) -import EXAMPLE147 from "./examples/_Initiate_test_3.md"; +import EXAMPLE287 from "./examples/_Initiate_test_1.md"; - + - +## Example (H1, Hierarchical, Inhomogeneous Order) - +import EXAMPLE295 from "./examples/_Initiate_test_2.md"; -import EXAMPLE153 from "./examples/_Initiate_test_4.md"; + - +## Example (H1, Hierarchical, Inhomogeneous Order with Local Element Number) - +import EXAMPLE303 from "./examples/_Initiate_test_3.md"; - + -import EXAMPLE162 from "./examples/_Initiate_test_5.md"; +## Example (H1, Lagrange, Uniform Order) - +import EXAMPLE311 from "./examples/_Initiate_test_4.md"; - + - +## Example (H1, Lagrange, Inhomogeneous Order) diff --git a/docs/docs-api/FEDOF/SetSparsity.md b/docs/docs-api/FEDOF/SetSparsity.md new file mode 100644 index 00000000..de07682f --- /dev/null +++ b/docs/docs-api/FEDOF/SetSparsity.md @@ -0,0 +1,118 @@ +# SetSparsity + +The `SetSparsity` method is used to establish the sparsity pattern in a CSR (Compressed Sparse Row) matrix based on finite element degrees of freedom (FEDOF). This is a crucial operation for efficiently assembling and storing finite element matrices. The method offers two implementations to handle different sparsity pattern generation scenarios. + +## Interface 1 + +> Single FEDOF Sparsity Pattern + +```fortran +MODULE SUBROUTINE SetSparsity1(obj, mat) + CLASS(FEDOF_), INTENT(INOUT) :: obj + TYPE(CSRMatrix_), INTENT(INOUT) :: mat +END SUBROUTINE SetSparsity1 +``` + +### Purpose + +Creates a sparsity pattern in a CSR matrix using a single FEDOF object. This implementation is typically used for matrices representing operations within a single finite element space (like mass or stiffness matrices). + +### Parameters + +- `obj`: The FEDOF object that contains degree of freedom information +- `mat`: The CSR matrix where the sparsity pattern will be established + +### Algorithm + +1. Retrieves the mesh pointer from the FEDOF object +2. Allocates connectivity array based on maximum total connectivity +3. For each element in the mesh: + - Gets the connectivity for the element + - For each degree of freedom in the element: + - Sets the sparsity pattern in the matrix for this DOF with respect to all other DOFs in the element +4. Finalizes the sparsity pattern + +## Interface 2 + +> FEDOF to FEDOF Interaction + +```fortran +MODULE SUBROUTINE SetSparsity2(obj, col_fedof, cellToCell, mat, ivar, jvar) + CLASS(FEDOF_), INTENT(INOUT) :: obj + CLASS(FEDOF_), INTENT(INOUT) :: col_fedof + INTEGER(I4B), INTENT(IN) :: cellToCell(:) + TYPE(CSRMatrix_), INTENT(INOUT) :: mat + INTEGER(I4B), INTENT(IN) :: ivar + INTEGER(I4B), INTENT(IN) :: jvar +END SUBROUTINE SetSparsity2 +``` + +### Purpose + +Creates a sparsity pattern in a CSR matrix using two FEDOF objects. This implementation is used for matrices representing operations between different finite element spaces (like coupling or transfer matrices). + +### Parameters + +- `obj`: The row FEDOF object that contains degree of freedom information +- `col_fedof`: The column FEDOF object that contains degree of freedom information +- `cellToCell`: Array mapping element indices from row to column mesh +- `mat`: The CSR matrix where the sparsity pattern will be established +- `ivar`: Physical variable index in row +- `jvar`: Physical variable index in column + +### Algorithm + +1. Retrieves mesh pointers from both FEDOF objects +2. Allocates connectivity arrays for both row and column elements +3. For each element in the row mesh: + - Gets the connectivity for the row element + - Finds the corresponding element in the column mesh using cellToCell + - Gets the connectivity for the column element + - For each DOF in the row element: + - Sets the sparsity pattern in the matrix for this row DOF with respect to all column DOFs + +## Interface 3 + +> Multiple FEDOF Interactions + +```fortran +INTERFACE FEDOFSetSparsity + MODULE SUBROUTINE SetSparsity3(fedofs, mat) + CLASS(FEDOFPointer_), INTENT(INOUT) :: fedofs(:) + TYPE(CSRMatrix_), INTENT(INOUT) :: mat + END SUBROUTINE SetSparsity3 +END INTERFACE FEDOFSetSparsity +``` + +There is also a third implementation (`SetSparsity3`) that handles sparsity pattern generation for multiple FEDOF objects. This is particularly useful for complex coupled problems with multiple physics or domains. + +## Usage Example + +```fortran +! For a single FEDOF (e.g., creating a stiffness matrix) +TYPE(FEDOF_) :: myFEDOF +TYPE(CSRMatrix_) :: stiffnessMatrix + +! Set up the sparsity pattern for the matrix +CALL myFEDOF%SetSparsity(stiffnessMatrix) + +! For FEDOF to FEDOF interaction (e.g., coupling two different fields) +TYPE(FEDOF_) :: velocityFEDOF, pressureFEDOF +TYPE(CSRMatrix_) :: couplingMatrix +INTEGER(I4B), ALLOCATABLE :: cellMap(:) + +! Set up cellMap to map between velocity and pressure elements +! ... + +! Set up the sparsity pattern for the coupling matrix +CALL velocityFEDOF%SetSparsity(pressureFEDOF, cellMap, couplingMatrix, 1, 2) +``` + +## Notes + +- The sparsity pattern defines which entries in the matrix are non-zero, allowing for efficient storage and computation. +- The methods check various conditions in debug mode to ensure validity of the inputs. +- The third variant (`SetSparsity3`) is particularly useful for block matrices with multiple physical variables. +- After setting the sparsity pattern, the matrix can be assembled efficiently by only computing and storing the non-zero entries. + +## Example 1 diff --git a/docs/docs-api/FEDOF/examples/_Copy_test_1.F90 b/docs/docs-api/FEDOF/examples/_Copy_test_1.F90 new file mode 100644 index 00000000..f7e6b2c2 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_Copy_test_1.F90 @@ -0,0 +1,71 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-06 +! summary: This method tests the COPY method for FEDOF class. + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION + +IMPLICIT NONE + +TYPE(FEDOF_) :: obj, obj2 +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri3_mesh.h5", & + baseInterpolation = "Heirarchical", & + baseContinuity = "H1" + +TYPE(HDF5File_) :: meshfile +INTEGER(I4B) :: found, want + +CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.) +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') + +meshptr => dom%GetMeshPointer() + +CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, order=1, mesh=meshptr) +!CALL fedof%Display("FEDOF:") +CALL obj2%copy(obj) + +found = obj2%GetTotalDOF() +want = meshptr%GetTotalNodes() +CALL OK(found == want, "Total DOF (order=1): ") + +CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, order=2, mesh=meshptr) +obj2 = obj +found = obj2%GetTotalDOF() +want = meshptr%GetTotalNodes() + meshptr%GetTotalFaces() +CALL OK(found == want, "Total DOF (order=2): ") + +CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, order=3, mesh=meshptr) +CALL obj2%Copy(obj) + +found = obj2%GetTotalDOF() +want = meshptr%GetTotalNodes() + 2*meshptr%GetTotalFaces() + meshptr%GetTotalCells() +CALL OK(found == want, "Total DOF (order=3): ") + +CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, order=4, mesh=meshptr) +obj2 = obj + +found = obj2%GetTotalDOF() +want = meshptr%GetTotalNodes() + 3*meshptr%GetTotalFaces() + 3*meshptr%GetTotalCells() +CALL OK(found == want, "Total DOF (order=4): ") + +!CALL dom%Display("domain:") +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_Initiate_test_7.md b/docs/docs-api/FEDOF/examples/_Copy_test_1.md similarity index 61% rename from docs/docs-api/FEDOF/examples/_Initiate_test_7.md rename to docs/docs-api/FEDOF/examples/_Copy_test_1.md index 91741de4..ebcca23a 100644 --- a/docs/docs-api/FEDOF/examples/_Initiate_test_7.md +++ b/docs/docs-api/FEDOF/examples/_Copy_test_1.md @@ -1,5 +1,5 @@ import CodeBlock from '@theme/CodeBlock'; -import CodeSnippet from '!!raw-loader!./_Initiate_test_7.F90'; +import CodeSnippet from '!!raw-loader!./_Copy_test_1.F90'; {CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_Copy_test_2.F90 b/docs/docs-api/FEDOF/examples/_Copy_test_2.F90 new file mode 100644 index 00000000..6e36c262 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_Copy_test_2.F90 @@ -0,0 +1,77 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-06 +! summary: This method tests the COPY method for FEDOF class. +! Copy method is same as the assignment opertor. +! Copy method is tested for H1 Lagrange on linear triangular mesh. + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE BaseType, ONLY: TypeQuadratureOpt + +IMPLICIT NONE + +TYPE(FEDOF_) :: obj, obj2 +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() + +TYPE(HDF5File_) :: meshfile +INTEGER(I4B) :: found, want + +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri3_mesh.h5", & + baseInterpolation = "Lagrange", & + baseContinuity = "H1" + +INTEGER(I4B), PARAMETER :: ipType = TypeQuadratureOpt%equidistance + +CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.) +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') + +meshptr => dom%GetMeshPointer() + +CALL obj%Initiate(baseContinuity=baseContinuity, ipType=ipType, & + baseInterpolation=baseInterpolation, order=1, mesh=meshptr) +!CALL fedof%Display("FEDOF:") +CALL obj2%copy(obj) + +found = obj2%GetTotalDOF() +want = meshptr%GetTotalNodes() +CALL OK(found == want, "Total DOF (order=1): ") + +CALL obj%Initiate(baseContinuity=baseContinuity, ipType=ipType, & + baseInterpolation=baseInterpolation, order=2, mesh=meshptr) +obj2 = obj +found = obj2%GetTotalDOF() +want = meshptr%GetTotalNodes() + meshptr%GetTotalFaces() +CALL OK(found == want, "Total DOF (order=2): ") + +CALL obj%Initiate(baseContinuity=baseContinuity, ipType=ipType, & + baseInterpolation=baseInterpolation, order=3, mesh=meshptr) +CALL obj2%Copy(obj) + +found = obj2%GetTotalDOF() +want = meshptr%GetTotalNodes() + 2*meshptr%GetTotalFaces() + meshptr%GetTotalCells() +CALL OK(found == want, "Total DOF (order=3): ") + +CALL obj%Initiate(baseContinuity=baseContinuity, ipType=ipType, & + baseInterpolation=baseInterpolation, order=4, mesh=meshptr) +obj2 = obj + +found = obj2%GetTotalDOF() +want = meshptr%GetTotalNodes() + 3*meshptr%GetTotalFaces() + 3*meshptr%GetTotalCells() +CALL OK(found == want, "Total DOF (order=4): ") + +!CALL dom%Display("domain:") +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_Initiate_test_7.F90 b/docs/docs-api/FEDOF/examples/_GetCaseName_test_1.F90 similarity index 57% rename from docs/docs-api/FEDOF/examples/_Initiate_test_7.F90 rename to docs/docs-api/FEDOF/examples/_GetCaseName_test_1.F90 index e4ad4d15..fa818623 100644 --- a/docs/docs-api/FEDOF/examples/_Initiate_test_7.F90 +++ b/docs/docs-api/FEDOF/examples/_GetCaseName_test_1.F90 @@ -1,6 +1,6 @@ !> author: Vikas Sharma, Ph. D. -! date: 2025-06-01 -! summary: Testing initiate methods for Hierarchical DOF +! date: 2025-06-07 +! summary: Get case name PROGRAM main USE FEDOF_Class @@ -11,6 +11,7 @@ PROGRAM main USE GlobalData USE Test_Method USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE BaseType, ONLY: TypeQuadratureOpt IMPLICIT NONE @@ -20,8 +21,7 @@ PROGRAM main CHARACTER(*), PARAMETER :: filename = & "../../FEMesh/examples/meshdata/small_tri3_mesh.h5" TYPE(HDF5File_) :: meshfile -INTEGER(I4B) :: found, want -CHARACTER(:), ALLOCATABLE :: testname +CHARACTER(6) :: found, want CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.) CALL meshfile%Initiate(filename, mode="READ") @@ -32,9 +32,21 @@ PROGRAM main CALL obj%Initiate(baseContinuity="H1", baseInterpolation="Heirarchical", & order=1, mesh=meshptr) -testname = "H1 Hierarchical order=1" +found = obj%GetCaseName() +want = "H1HEIR" +CALL OK(found == want, "GetCaseName H1HEIR: ") -CALL obj%Display(testname) +CALL obj%Initiate(baseContinuity="H1", baseInterpolation="Hierarchical", & + order=1, mesh=meshptr) +found = obj%GetCaseName() +want = "H1HIER" +CALL OK(found == want, "GetCaseName H1HIER: ") + +CALL obj%Initiate(baseContinuity="H1", baseInterpolation="Lagrange", & + order=1, mesh=meshptr, ipType=TypeQuadratureOpt%equidistance) +found = obj%GetCaseName() +want = "H1LAGR" +CALL OK(found == want, "GetCaseName H1LAGR: ") !CALL dom%Display("domain:") CALL dom%DEALLOCATE() diff --git a/docs/docs-api/FEDOF/examples/_GetCaseName_test_1.md b/docs/docs-api/FEDOF/examples/_GetCaseName_test_1.md new file mode 100644 index 00000000..4d9c7efa --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetCaseName_test_1.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetCaseName_test_1.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetCellDOF_test_1.F90 b/docs/docs-api/FEDOF/examples/_GetCellDOF_test_1.F90 new file mode 100644 index 00000000..0f3e61c0 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetCellDOF_test_1.F90 @@ -0,0 +1,140 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-07 +! summary: Testing GetCellDOF method of FEDOF class +! H1 Heirarchical Second Order Triangular Mesh + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE AppendUtility +USE ArangeUtility +USE ReallocateUtility + +IMPLICIT NONE + +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri3_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Heirarchical", & + testname = baseContinuity//" "//baseInterpolation//" GetCellDOF test" + +TYPE(FEDOF_) :: fedof +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +TYPE(HDF5File_) :: meshfile +INTEGER(I4B) :: order, totalVertexNodes, totalFaces +LOGICAL(LGT) :: isok + +CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.) + +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() +totalVertexNodes = meshptr%GetTotalVertexNodes() +totalFaces = meshptr%GetTotalFaces() + +CALL test1 +CALL test2 +CALL test3 +CALL test4 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 1 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + CALL fedof%GetCellDOF(globalCell=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + isok = tsize .EQ. 0 + CALL OK(isok, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 2 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + CALL fedof%GetCellDOF(globalCell=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + CALL IS(tsize, 0, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 3 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + CALL fedof%GetCellDOF(globalCell=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + CALL IS(tsize, 1, testname//" (order= "//ToString(order)//"): ") + CALL IS(found(1), 63, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test3 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test4 + + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 4 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + CALL fedof%GetCellDOF(globalCell=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + CALL IS(tsize, 3, testname//" (order= "//ToString(order)//"): ") + CALL IS(found(1), 12+25*3+1, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test4 + +!---------------------------------------------------------------------------- +! +!---------------------------------------------------------------------------- + +END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetCellDOF_test_1.md b/docs/docs-api/FEDOF/examples/_GetCellDOF_test_1.md new file mode 100644 index 00000000..1211c367 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetCellDOF_test_1.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetCellDOF_test_1.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetCellDOF_test_2.F90 b/docs/docs-api/FEDOF/examples/_GetCellDOF_test_2.F90 new file mode 100644 index 00000000..ee9682c3 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetCellDOF_test_2.F90 @@ -0,0 +1,140 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-07 +! summary: Testing GetCellDOF method of FEDOF class +! H1 Heirarchical Second Order Triangular Mesh + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE AppendUtility +USE ArangeUtility +USE ReallocateUtility + +IMPLICIT NONE + +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri6_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Heirarchical", & + testname = baseContinuity//" "//baseInterpolation//" GetCellDOF test" + +TYPE(FEDOF_) :: fedof +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +TYPE(HDF5File_) :: meshfile +INTEGER(I4B) :: order, totalVertexNodes, totalFaces +LOGICAL(LGT) :: isok + +CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.) + +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() +totalVertexNodes = meshptr%GetTotalVertexNodes() +totalFaces = meshptr%GetTotalFaces() + +CALL test1 +CALL test2 +CALL test3 +CALL test4 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 1 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + CALL fedof%GetCellDOF(globalCell=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + isok = tsize .EQ. 0 + CALL OK(isok, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 2 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + CALL fedof%GetCellDOF(globalCell=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + CALL IS(tsize, 0, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 3 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + CALL fedof%GetCellDOF(globalCell=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + CALL IS(tsize, 1, testname//" (order= "//ToString(order)//"): ") + CALL IS(found(1), 63, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test3 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test4 + + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 4 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + CALL fedof%GetCellDOF(globalCell=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + CALL IS(tsize, 3, testname//" (order= "//ToString(order)//"): ") + CALL IS(found(1), 12+25*3+1, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test4 + +!---------------------------------------------------------------------------- +! +!---------------------------------------------------------------------------- + +END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetCellDOF_test_2.md b/docs/docs-api/FEDOF/examples/_GetCellDOF_test_2.md new file mode 100644 index 00000000..fe966b7c --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetCellDOF_test_2.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetCellDOF_test_2.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetCellDOF_test_3.F90 b/docs/docs-api/FEDOF/examples/_GetCellDOF_test_3.F90 new file mode 100644 index 00000000..3aefd59a --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetCellDOF_test_3.F90 @@ -0,0 +1,141 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-07 +! summary: Testing GetCellDOF method of FEDOF class +! H1 Heirarchical Second Order Triangular Mesh + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE AppendUtility +USE ArangeUtility +USE ReallocateUtility +USE BaseType, ONLY: TypeQuadratureOpt + +IMPLICIT NONE + +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri3_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Lagrange", & + testname = baseContinuity//" "//baseInterpolation//" GetCellDOF test" + +TYPE(FEDOF_) :: fedof +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +TYPE(HDF5File_) :: meshfile +INTEGER(I4B) :: order, totalVertexNodes, totalFaces +LOGICAL(LGT) :: isok + +CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.) + +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() +totalVertexNodes = meshptr%GetTotalVertexNodes() +totalFaces = meshptr%GetTotalFaces() + +CALL test1 +CALL test2 +CALL test3 +CALL test4 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 1 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, ipType=TypeQuadratureOpt%equidistance) + + CALL fedof%GetCellDOF(globalCell=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + isok = tsize .EQ. 0 + CALL OK(isok, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 2 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, ipType=TypeQuadratureOpt%equidistance) + + CALL fedof%GetCellDOF(globalCell=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + CALL IS(tsize, 0, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 3 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, ipType=TypeQuadratureOpt%equidistance) + + CALL fedof%GetCellDOF(globalCell=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + CALL IS(tsize, 1, testname//" (order= "//ToString(order)//"): ") + CALL IS(found(1), 63, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test3 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test4 + + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 4 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, ipType=TypeQuadratureOpt%equidistance) + + CALL fedof%GetCellDOF(globalCell=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + CALL IS(tsize, 3, testname//" (order= "//ToString(order)//"): ") + CALL IS(found(1), 12+25*3+1, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test4 + +!---------------------------------------------------------------------------- +! +!---------------------------------------------------------------------------- + +END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetCellDOF_test_4.F90 b/docs/docs-api/FEDOF/examples/_GetCellDOF_test_4.F90 new file mode 100644 index 00000000..0b6fc922 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetCellDOF_test_4.F90 @@ -0,0 +1,141 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-07 +! summary: Testing GetCellDOF method of FEDOF class +! H1 Heirarchical Second Order Triangular Mesh + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE AppendUtility +USE ArangeUtility +USE ReallocateUtility +USE BaseType, ONLY: TypeQuadratureOpt + +IMPLICIT NONE + +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri6_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Lagrange", & + testname = baseContinuity//" "//baseInterpolation//" GetCellDOF test" + +TYPE(FEDOF_) :: fedof +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +TYPE(HDF5File_) :: meshfile +INTEGER(I4B) :: order, totalVertexNodes, totalFaces +LOGICAL(LGT) :: isok + +CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.) + +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() +totalVertexNodes = meshptr%GetTotalVertexNodes() +totalFaces = meshptr%GetTotalFaces() + +CALL test1 +CALL test2 +CALL test3 +CALL test4 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 1 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, ipType=TypeQuadratureOpt%equidistance) + + CALL fedof%GetCellDOF(globalCell=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + isok = tsize .EQ. 0 + CALL OK(isok, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 2 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, ipType=TypeQuadratureOpt%equidistance) + + CALL fedof%GetCellDOF(globalCell=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + CALL IS(tsize, 0, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 3 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, ipType=TypeQuadratureOpt%equidistance) + + CALL fedof%GetCellDOF(globalCell=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + CALL IS(tsize, 1, testname//" (order= "//ToString(order)//"): ") + CALL IS(found(1), 63, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test3 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test4 + + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 4 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, ipType=TypeQuadratureOpt%equidistance) + + CALL fedof%GetCellDOF(globalCell=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + CALL IS(tsize, 3, testname//" (order= "//ToString(order)//"): ") + CALL IS(found(1), 12+25*3+1, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test4 + +!---------------------------------------------------------------------------- +! +!---------------------------------------------------------------------------- + +END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetCellOrder_test_1.F90 b/docs/docs-api/FEDOF/examples/_GetCellOrder_test_1.F90 new file mode 100644 index 00000000..64c3f765 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetCellOrder_test_1.F90 @@ -0,0 +1,133 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-07 +! summary: Testing GetCellOrder method of FEDOF class +! H1 Heirarchical Second Order Triangular Mesh + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE AppendUtility +USE ArangeUtility +USE ReallocateUtility + +IMPLICIT NONE + +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri3_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Heirarchical", & + testname = baseContinuity//" "//baseInterpolation//" GetCellDOF test" + +TYPE(FEDOF_) :: fedof +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +TYPE(HDF5File_) :: meshfile +INTEGER(I4B) :: order, totalVertexNodes, totalFaces +LOGICAL(LGT) :: isok + +CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.) + +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() +totalVertexNodes = meshptr%GetTotalVertexNodes() +totalFaces = meshptr%GetTotalFaces() + +CALL test1 +CALL test2 +CALL test3 +CALL test4 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 1 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + CALL fedof%GetCellOrder(globalElement=1, islocal=.TRUE., & + cellOrder=found, tCellOrder=tsize) + + want(1) = 1 + CALL IS(found(1), want(1), testname//" (order= "//ToString(order)//"): ") +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 2 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + CALL fedof%GetCellOrder(globalElement=1, islocal=.TRUE., & + cellOrder=found, tCellOrder=tsize) + + want(1) = 2 + CALL IS(found(1), want(1), testname//" (order= "//ToString(order)//"): ") +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 3 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + CALL fedof%GetCellOrder(globalElement=1, islocal=.TRUE., & + cellOrder=found, tCellOrder=tsize) + + want(1) = 3 + CALL IS(found(1), want(1), testname//" (order= "//ToString(order)//"): ") +END SUBROUTINE test3 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test4 + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 4 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + CALL fedof%GetCellOrder(globalElement=1, islocal=.TRUE., & + cellOrder=found, tCellOrder=tsize) + + want(1) = 4 + CALL IS(found(1), want(1), testname//" (order= "//ToString(order)//"): ") +END SUBROUTINE test4 + +!---------------------------------------------------------------------------- +! +!---------------------------------------------------------------------------- + +END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetCellOrder_test_1.md b/docs/docs-api/FEDOF/examples/_GetCellOrder_test_1.md new file mode 100644 index 00000000..28143e33 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetCellOrder_test_1.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetCellOrder_test_1.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetConnectivity_test_1.F90 b/docs/docs-api/FEDOF/examples/_GetConnectivity_test_1.F90 index a5e38124..e562f2f0 100644 --- a/docs/docs-api/FEDOF/examples/_GetConnectivity_test_1.F90 +++ b/docs/docs-api/FEDOF/examples/_GetConnectivity_test_1.F90 @@ -1,3 +1,8 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-07 +! summary: Testing GetConnectivity method of FEDOF class +! H1 Heirarchical Second Order Triangular Mesh + PROGRAM main USE FEDOF_Class USE FEDomain_Class @@ -12,77 +17,142 @@ PROGRAM main IMPLICIT NONE -CHARACTER(*), PARAMETER :: filename = & - "../../Mesh/examples/meshdata/small_mesh.h5", & - baseContinuity = "H1", & - baseInterpolation = "Heirarchical" +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri3_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Heirarchical", & + testname = baseContinuity // " " // baseInterpolation TYPE(FEDOF_) :: fedof TYPE(FEDomain_) :: dom CLASS(AbstractMesh_), POINTER :: meshptr => NULL() TYPE(HDF5File_) :: meshfile INTEGER(I4B), ALLOCATABLE :: found(:), want(:) +INTEGER(I4B) :: order, totalVertexNodes, totalFaces LOGICAL(LGT) :: isok -INTEGER(I4B) :: order -CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.) +CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.) CALL meshfile%Initiate(filename, mode="READ") CALL meshfile%OPEN() CALL dom%Initiate(meshfile, '') - meshptr => dom%GetMeshPointer() +totalVertexNodes = meshptr%GetTotalVertexNodes() +totalFaces = meshptr%GetTotalFaces() -order = 1 -CALL fedof%Initiate(baseContinuity=baseContinuity, & - baseInterpolation=baseInterpolation, & - order=order, mesh=meshptr) - -found = fedof%GetConnectivity(opt="A", globalElement=1, islocal=.TRUE.) - -want = meshptr%GetLocalNodenumber(globalNode= & - meshptr%GetConnectivity(globalElement=1, islocal=.TRUE.), & - islocal=.FALSE.) -isok = ALL(found == want) -CALL OK(isok, "GetConnectivity (order=1): ") - -order = 2 -CALL fedof%Initiate(baseContinuity=baseContinuity, & - baseInterpolation=baseInterpolation, & - order=order, mesh=meshptr) - -found = fedof%GetConnectivity(opt="A", globalElement=1, islocal=.TRUE.) -want = want .APPEND. arange(meshptr%GetTotalNodes()+1, meshptr%GetTotalNodes()+3) -isok = ALL(found == want) -CALL OK(isok, "GetConnectivity (order=2): ") -IF (.NOT. isok) CALL Display(found.COLCONCAT.want, "found + want") - -order = 3 -CALL fedof%Initiate(baseContinuity=baseContinuity, & - baseInterpolation=baseInterpolation, & - order=order, mesh=meshptr) - -found = fedof%GetConnectivity(opt="A", globalElement=1, islocal=.TRUE.) -want = (meshptr%GetConnectivity(1, .TRUE.) .APPEND. & - arange(meshptr%GetTotalNodes() + 1, meshptr%GetTotalNodes() + 6)) & - .append. [meshptr%GetTotalNodes() + 2 * meshptr%GetTotalFaces() + 1] -isok = ALL(found == want) -CALL OK(isok, "GetConnectivity (order=3): ") -IF (.NOT. isok) CALL Display(found.COLCONCAT.want, "found + want") -!CALL Display(meshptr%GetTotalEntities(), "TotalEntities: ") - -!CALL fedof%Initiate(baseContinuity="H1", baseInterpolation="Heirarchical", & -! order=3, mesh=meshptr) -!found = fedof%GetConnectivity(opt="A", globalElement=1, islocal=.TRUE.) -!want = meshptr%GetConnectivity(1, .TRUE.) .APPEND. & -! arange(meshptr%GetTotalNodes() + 1, meshptr%GetTotalNodes() + 6) & -! .append.arange(meshptr%GetTotalNodes() + 2 * meshptr%GetTotalFaces() + 1, & -! meshptr%GetTotalNodes() + meshptr%GetTotalFaces() * 2 + 1) -!isok = ALL(found == want) -!CALL OK(isok, "GetConnectivity (order=3): ") -!IF (.NOT. isok) CALL Display(found.COLCONCAT.want, "found + want") +CALL test1 +CALL test2 +CALL test3 CALL dom%DEALLOCATE() CALL meshfile%DEALLOCATE() +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + + INTEGER(I4B), ALLOCATABLE :: globalNode(:) + INTEGER(I4B) :: ent(4), tVertices + + order = 1 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + tVertices = meshptr%GetTotalVertexNodes(globalElement=[1], islocal=.TRUE.) + + ent = meshptr%GetTotalEntities(globalElement=1, islocal=.TRUE.) + + ! Get all connectivity for local element 1 + found = fedof%GetConnectivity(opt="A", globalElement=1, islocal=.TRUE.) + + globalNode = meshptr%GetConnectivity(globalElement=1, islocal=.TRUE.) + + want = meshptr%GetLocalNodenumber( & + globalNode=globalNode(1:tVertices), islocal=.FALSE.) + + isok = ALL(found == want) + CALL OK(isok, testname // " GetConnectivity (order= "//ToString(order)//"): ") + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + INTEGER(I4B), ALLOCATABLE :: globalNode(:), temp1(:) + INTEGER(I4B) :: ent(4), a, b, tVertices + + order = 2 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + found = fedof%GetConnectivity(opt="A", globalElement=1, islocal=.TRUE.) + globalNode = meshptr%GetConnectivity(globalElement=1, islocal=.TRUE.) + tVertices = meshptr%GetTotalVertexNodes(globalElement=[1], islocal=.TRUE.) + + want = meshptr%GetLocalNodenumber(globalNode=globalNode(1:tVertices), & + islocal=.FALSE.) + a = meshptr%GetTotalVertexNodes() + 1 + ent = meshptr%GetTotalEntities(globalElement=1, islocal=.TRUE.) + + b = meshptr%GetTotalVertexNodes() + ent(3) * (order - 1) + temp1 = Arange(a, b) + + want = want.APPEND.temp1 + + isok = ALL(found == want) + + CALL OK(isok, testname // " GetConnectivity (order= "//ToString(order)//"): ") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + INTEGER(I4B), ALLOCATABLE :: globalNode(:), temp1(:) + INTEGER(I4B) :: ent(4), a, b, tVertices + + order = 3 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + found = fedof%GetConnectivity(opt="A", globalElement=1, islocal=.TRUE.) + + globalNode = meshptr%GetConnectivity(globalElement=1, islocal=.TRUE.) + + tVertices = meshptr%GetTotalVertexNodes(globalElement=[1], islocal=.TRUE.) + + want = meshptr%GetLocalNodenumber( & + globalNode=globalNode(1:tVertices), islocal=.FALSE.) + + ent = meshptr%GetTotalEntities(globalElement=1, islocal=.TRUE.) + + a = totalVertexNodes + 1 + b = a - 1 + ent(3) * (order - 1) + + temp1 = Arange(a, b) + + want = want.APPEND.temp1 + + a = totalVertexNodes + totalFaces * (order - 1) + 1 + b = a - 1 + ent(4) * (order - 2) * (order - 1) * 0.5 + + temp1 = Arange(a, b) + want = want.APPEND.temp1 + + isok = ALL(found == want) + + CALL OK(isok, testname // " GetConnectivity (order= "//ToString(order)//"): ") +END SUBROUTINE test3 + END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetConnectivity_test_1.md b/docs/docs-api/FEDOF/examples/_GetConnectivity_test_1.md new file mode 100644 index 00000000..e3288ea5 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetConnectivity_test_1.md @@ -0,0 +1,7 @@ + +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetConnectivity_test_1.F90'; + +{CodeSnippet} + diff --git a/docs/docs-api/FEDOF/examples/_GetConnectivity_test_2.F90 b/docs/docs-api/FEDOF/examples/_GetConnectivity_test_2.F90 index 529de684..ffd45f22 100644 --- a/docs/docs-api/FEDOF/examples/_GetConnectivity_test_2.F90 +++ b/docs/docs-api/FEDOF/examples/_GetConnectivity_test_2.F90 @@ -1,3 +1,8 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-07 +! summary: Testing GetConnectivity method of FEDOF class +! H1 Heirarchical Second Order Triangular Mesh + PROGRAM main USE FEDOF_Class USE FEDomain_Class @@ -12,41 +17,145 @@ PROGRAM main IMPLICIT NONE -CHARACTER(*), PARAMETER :: filename = & - "../../Mesh/examples/meshdata/small_mesh.h5", & - baseContinuity = "H1", & - baseInterpolation = "Lagrange" +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri6_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Heirarchical", & + testname = baseContinuity // " " // baseInterpolation TYPE(FEDOF_) :: fedof TYPE(FEDomain_) :: dom CLASS(AbstractMesh_), POINTER :: meshptr => NULL() TYPE(HDF5File_) :: meshfile INTEGER(I4B), ALLOCATABLE :: found(:), want(:) +INTEGER(I4B) :: order, totalVertexNodes, totalFaces LOGICAL(LGT) :: isok -INTEGER(I4B) :: order -CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.) +CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.) CALL meshfile%Initiate(filename, mode="READ") CALL meshfile%OPEN() CALL dom%Initiate(meshfile, '') - meshptr => dom%GetMeshPointer() +totalVertexNodes = meshptr%GetTotalVertexNodes() +totalFaces = meshptr%GetTotalFaces() -order = 1 -CALL fedof%Initiate(baseContinuity=baseContinuity, & - baseInterpolation=baseInterpolation, & - order=order, mesh=meshptr) - -found = fedof%GetConnectivity(opt="A", globalElement=1, islocal=.TRUE.) - -want = meshptr%GetLocalNodenumber(globalNode=meshptr%GetConnectivity( & - globalElement=1, islocal=.TRUE.), & - islocal=.FALSE.) -isok = ALL(found == want) -CALL OK(isok, "GetConnectivity (order=1): ") +CALL test1 +CALL test2 +CALL test3 CALL dom%DEALLOCATE() CALL meshfile%DEALLOCATE() +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + + INTEGER(I4B), ALLOCATABLE :: globalNode(:) + INTEGER(I4B) :: ent(4), tVertices, tdof, localElemNum + + order = 1 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + tVertices = meshptr%GetTotalVertexNodes(globalElement=[1], islocal=.TRUE.) + + ent = meshptr%GetTotalEntities(globalElement=1, islocal=.TRUE.) + + tdof = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE.) + localElemNum = meshptr%GetLocalElemNumber(globalElement=1, islocal=.TRUE.) + + ! Get all connectivity for local element 1 + found = fedof%GetConnectivity(opt="A", globalElement=1, islocal=.TRUE.) + + globalNode = meshptr%GetConnectivity(globalElement=1, islocal=.TRUE.) + + want = meshptr%GetLocalNodenumber( & + globalNode=globalNode(1:tVertices), islocal=.FALSE.) + + isok = ALL(found == want) + CALL OK(isok, testname // " GetConnectivity (order= "//ToString(order)//"): ") + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + INTEGER(I4B), ALLOCATABLE :: globalNode(:), temp1(:) + INTEGER(I4B) :: ent(4), a, b, tVertices + + order = 2 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + found = fedof%GetConnectivity(opt="A", globalElement=1, islocal=.TRUE.) + globalNode = meshptr%GetConnectivity(globalElement=1, islocal=.TRUE.) + tVertices = meshptr%GetTotalVertexNodes(globalElement=[1], islocal=.TRUE.) + + want = meshptr%GetLocalNodenumber(globalNode=globalNode(1:tVertices), & + islocal=.FALSE.) + a = meshptr%GetTotalVertexNodes() + 1 + ent = meshptr%GetTotalEntities(globalElement=1, islocal=.TRUE.) + + b = meshptr%GetTotalVertexNodes() + ent(3) * (order - 1) + temp1 = Arange(a, b) + + want = want.APPEND.temp1 + + isok = ALL(found == want) + + CALL OK(isok, testname // " GetConnectivity (order= "//ToString(order)//"): ") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + INTEGER(I4B), ALLOCATABLE :: globalNode(:), temp1(:) + INTEGER(I4B) :: ent(4), a, b, tVertices + + order = 3 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + found = fedof%GetConnectivity(opt="A", globalElement=1, islocal=.TRUE.) + + globalNode = meshptr%GetConnectivity(globalElement=1, islocal=.TRUE.) + + tVertices = meshptr%GetTotalVertexNodes(globalElement=[1], islocal=.TRUE.) + + want = meshptr%GetLocalNodenumber( & + globalNode=globalNode(1:tVertices), islocal=.FALSE.) + + ent = meshptr%GetTotalEntities(globalElement=1, islocal=.TRUE.) + + a = totalVertexNodes + 1 + b = a - 1 + ent(3) * (order - 1) + + temp1 = Arange(a, b) + + want = want.APPEND.temp1 + + a = totalVertexNodes + totalFaces * (order - 1) + 1 + b = a - 1 + ent(4) * (order - 2) * (order - 1) * 0.5 + + temp1 = Arange(a, b) + want = want.APPEND.temp1 + + isok = ALL(found == want) + + CALL OK(isok, testname // " GetConnectivity (order= "//ToString(order)//"): ") +END SUBROUTINE test3 + END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetConnectivity_test_2.md b/docs/docs-api/FEDOF/examples/_GetConnectivity_test_2.md new file mode 100644 index 00000000..02f4e263 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetConnectivity_test_2.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetConnectivity_test_2.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetConnectivity_test_3.F90 b/docs/docs-api/FEDOF/examples/_GetConnectivity_test_3.F90 index 465c69d3..f1fbf481 100644 --- a/docs/docs-api/FEDOF/examples/_GetConnectivity_test_3.F90 +++ b/docs/docs-api/FEDOF/examples/_GetConnectivity_test_3.F90 @@ -1,3 +1,8 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-07 +! summary: Testing GetConnectivity method of FEDOF class +! H1 Heirarchical Second Order Triangular Mesh + PROGRAM main USE FEDOF_Class USE FEDomain_Class @@ -9,44 +14,146 @@ PROGRAM main USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION USE AppendUtility USE ArangeUtility +USE BaseType, ONLY: TypeQuadratureOpt IMPLICIT NONE -CHARACTER(*), PARAMETER :: filename = & - "../../Mesh/examples/meshdata/small_tri6_mesh.h5", & - baseContinuity = "H1", & - baseInterpolation = "Lagrange", & - test_name = "GetConnectivity (order=2): " +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri3_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Lagrange", & + testname = baseContinuity // " " // baseInterpolation TYPE(FEDOF_) :: fedof TYPE(FEDomain_) :: dom CLASS(AbstractMesh_), POINTER :: meshptr => NULL() TYPE(HDF5File_) :: meshfile INTEGER(I4B), ALLOCATABLE :: found(:), want(:) +INTEGER(I4B) :: order, totalVertexNodes, totalFaces LOGICAL(LGT) :: isok -INTEGER(I4B), PARAMETER :: order = 2 -CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.) +CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.) CALL meshfile%Initiate(filename, mode="READ") CALL meshfile%OPEN() CALL dom%Initiate(meshfile, '') - meshptr => dom%GetMeshPointer() +totalVertexNodes = meshptr%GetTotalVertexNodes() +totalFaces = meshptr%GetTotalFaces() -CALL fedof%Initiate(baseContinuity=baseContinuity, & - baseInterpolation=baseInterpolation, & - order=order, mesh=meshptr) - -found = fedof%GetConnectivity(opt="A", globalElement=1, islocal=.TRUE.) - -want = meshptr%GetLocalNodenumber(globalNode=meshptr%GetConnectivity( & - globalElement=1, islocal=.TRUE.), & - islocal=.FALSE.) -isok = ALL(found == want) -CALL OK(isok, test_name) +CALL test1 +CALL test2 +CALL test3 CALL dom%DEALLOCATE() CALL meshfile%DEALLOCATE() +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + + INTEGER(I4B), ALLOCATABLE :: globalNode(:) + INTEGER(I4B) :: ent(4), tVertices + + order = 1 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, ipType=TypeQuadratureOpt%equidistance) + + tVertices = meshptr%GetTotalVertexNodes(globalElement=[1], islocal=.TRUE.) + + ent = meshptr%GetTotalEntities(globalElement=1, islocal=.TRUE.) + + ! Get all connectivity for local element 1 + found = fedof%GetConnectivity(opt="A", globalElement=1, islocal=.TRUE.) + + globalNode = meshptr%GetConnectivity(globalElement=1, islocal=.TRUE.) + + want = meshptr%GetLocalNodenumber( & + globalNode=globalNode(1:tVertices), islocal=.FALSE.) + + isok = ALL(found == want) + CALL OK(isok, testname // " GetConnectivity (order= "//ToString(order)//"): ") + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + INTEGER(I4B), ALLOCATABLE :: globalNode(:), temp1(:) + INTEGER(I4B) :: ent(4), a, b, tVertices + + order = 2 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, ipType=TypeQuadratureOpt%equidistance) + + found = fedof%GetConnectivity(opt="A", globalElement=1, islocal=.TRUE.) + globalNode = meshptr%GetConnectivity(globalElement=1, islocal=.TRUE.) + tVertices = meshptr%GetTotalVertexNodes(globalElement=[1], islocal=.TRUE.) + + want = meshptr%GetLocalNodenumber(globalNode=globalNode(1:tVertices), & + islocal=.FALSE.) + a = meshptr%GetTotalVertexNodes() + 1 + ent = meshptr%GetTotalEntities(globalElement=1, islocal=.TRUE.) + + b = meshptr%GetTotalVertexNodes() + ent(3) * (order - 1) + temp1 = Arange(a, b) + + want = want.APPEND.temp1 + + isok = ALL(found == want) + + CALL OK(isok, testname // " GetConnectivity (order= "//ToString(order)//"): ") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + INTEGER(I4B), ALLOCATABLE :: globalNode(:), temp1(:) + INTEGER(I4B) :: ent(4), a, b, tVertices + + order = 3 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, ipType=TypeQuadratureOpt%equidistance) + + found = fedof%GetConnectivity(opt="A", globalElement=1, islocal=.TRUE.) + + globalNode = meshptr%GetConnectivity(globalElement=1, islocal=.TRUE.) + + tVertices = meshptr%GetTotalVertexNodes(globalElement=[1], islocal=.TRUE.) + + want = meshptr%GetLocalNodenumber( & + globalNode=globalNode(1:tVertices), islocal=.FALSE.) + + ent = meshptr%GetTotalEntities(globalElement=1, islocal=.TRUE.) + + a = totalVertexNodes + 1 + b = a - 1 + ent(3) * (order - 1) + + temp1 = Arange(a, b) + + want = want.APPEND.temp1 + + a = totalVertexNodes + totalFaces * (order - 1) + 1 + b = a - 1 + ent(4) * (order - 2) * (order - 1) * 0.5 + + temp1 = Arange(a, b) + want = want.APPEND.temp1 + + isok = ALL(found == want) + + CALL OK(isok, testname // " GetConnectivity (order= "//ToString(order)//"): ") +END SUBROUTINE test3 + END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetConnectivity_test_4.F90 b/docs/docs-api/FEDOF/examples/_GetConnectivity_test_4.F90 new file mode 100644 index 00000000..4a9ad77b --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetConnectivity_test_4.F90 @@ -0,0 +1,162 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-07 +! summary: Testing GetConnectivity method of FEDOF class +! H1 Heirarchical Second Order Triangular Mesh + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE BaseType, ONLY: TypeQuadratureOpt +USE AppendUtility +USE ArangeUtility + +IMPLICIT NONE + +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri6_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Lagrange", & + testname = baseContinuity//" "//baseInterpolation + +TYPE(FEDOF_) :: fedof +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +TYPE(HDF5File_) :: meshfile +INTEGER(I4B), ALLOCATABLE :: found(:), want(:) +INTEGER(I4B) :: order, totalVertexNodes, totalFaces +LOGICAL(LGT) :: isok + +CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.) + +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() +totalVertexNodes = meshptr%GetTotalVertexNodes() +totalFaces = meshptr%GetTotalFaces() + +CALL test1 +CALL test2 +CALL test3 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + + INTEGER(I4B), ALLOCATABLE :: globalNode(:) + INTEGER(I4B) :: ent(4), tVertices, tdof, localElemNum + + order = 1 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, ipType=TypeQuadratureOpt%equidistance) + + tVertices = meshptr%GetTotalVertexNodes(globalElement=[1], islocal=.TRUE.) + + ent = meshptr%GetTotalEntities(globalElement=1, islocal=.TRUE.) + + tdof = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE.) + localElemNum = meshptr%GetLocalElemNumber(globalElement=1, islocal=.TRUE.) + + ! Get all connectivity for local element 1 + found = fedof%GetConnectivity(opt="A", globalElement=1, islocal=.TRUE.) + + globalNode = meshptr%GetConnectivity(globalElement=1, islocal=.TRUE.) + + want = meshptr%GetLocalNodenumber( & + globalNode=globalNode(1:tVertices), islocal=.FALSE.) + + isok = ALL(found == want) + CALL OK(isok, testname//" GetConnectivity (order= "//ToString(order)//"): ") + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + INTEGER(I4B), ALLOCATABLE :: globalNode(:), temp1(:) + INTEGER(I4B) :: ent(4), a, b, tVertices + + order = 2 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, ipType=TypeQuadratureOpt%equidistance) + + found = fedof%GetConnectivity(opt="A", globalElement=1, islocal=.TRUE.) + globalNode = meshptr%GetConnectivity(globalElement=1, islocal=.TRUE.) + tVertices = meshptr%GetTotalVertexNodes(globalElement=[1], islocal=.TRUE.) + + want = meshptr%GetLocalNodenumber(globalNode=globalNode(1:tVertices), & + islocal=.FALSE.) + a = meshptr%GetTotalVertexNodes() + 1 + ent = meshptr%GetTotalEntities(globalElement=1, islocal=.TRUE.) + + b = meshptr%GetTotalVertexNodes() + ent(3) * (order - 1) + temp1 = Arange(a, b) + + want = want.APPEND.temp1 + + isok = ALL(found == want) + + CALL OK(isok, testname//" GetConnectivity (order= "//ToString(order)//"): ") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + INTEGER(I4B), ALLOCATABLE :: globalNode(:), temp1(:) + INTEGER(I4B) :: ent(4), a, b, tVertices + + order = 3 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, ipType=TypeQuadratureOpt%equidistance) + + found = fedof%GetConnectivity(opt="A", globalElement=1, islocal=.TRUE.) + + globalNode = meshptr%GetConnectivity(globalElement=1, islocal=.TRUE.) + + tVertices = meshptr%GetTotalVertexNodes(globalElement=[1], islocal=.TRUE.) + + want = meshptr%GetLocalNodenumber( & + globalNode=globalNode(1:tVertices), islocal=.FALSE.) + + ent = meshptr%GetTotalEntities(globalElement=1, islocal=.TRUE.) + + a = totalVertexNodes + 1 + b = a - 1 + ent(3) * (order - 1) + + temp1 = Arange(a, b) + + want = want.APPEND.temp1 + + a = totalVertexNodes + totalFaces * (order - 1) + 1 + b = a - 1 + ent(4) * (order - 2) * (order - 1) * 0.5 + + temp1 = Arange(a, b) + want = want.APPEND.temp1 + + isok = ALL(found == want) + + CALL OK(isok, testname//" GetConnectivity (order= "//ToString(order)//"): ") +END SUBROUTINE test3 + +END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetFaceDOF_test_1.F90 b/docs/docs-api/FEDOF/examples/_GetFaceDOF_test_1.F90 new file mode 100644 index 00000000..220bd713 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetFaceDOF_test_1.F90 @@ -0,0 +1,139 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-07 +! summary: Testing GetFaceDOF method of FEDOF class +! H1 Heirarchical Second Order Triangular Mesh + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE AppendUtility +USE ArangeUtility +USE ReallocateUtility + +IMPLICIT NONE + +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri3_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Heirarchical", & + testname = baseContinuity//" "//baseInterpolation//" GetFaceDOF test" + +TYPE(FEDOF_) :: fedof +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +TYPE(HDF5File_) :: meshfile +INTEGER(I4B) :: order, totalVertexNodes, totalFaces +LOGICAL(LGT) :: isok + +CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.) + +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() +totalVertexNodes = meshptr%GetTotalVertexNodes() +totalFaces = meshptr%GetTotalFaces() + +CALL test1 +CALL test2 +CALL test3 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + + INTEGER(I4B) :: tsize, found(10), want(10) + INTEGER(I4B), ALLOCATABLE :: con(:) + + order = 1 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + con = fedof%GetConnectivity(globalElement=1, islocal=.TRUE., opt="A") + + CALL fedof%GetFaceDOF(globalFace=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + isok = tsize .EQ. 0 + CALL OK(isok, testname//" (order= "//ToString(order)//"): ") + + CALL fedof%GetFaceDOF(globalElement=1, islocal=.TRUE., & + ans=found, tsize=tsize, localFaceNumber=1) + isok = tsize .EQ. 0 + CALL OK(isok, testname//" interface 2 (order= "//ToString(order)//"): ") + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 2 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + CALL fedof%GetFaceDOF(globalFace=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + CALL IS(tsize, 1, testname//" (order= "//ToString(order)//"): ") + CALL IS(found(1), 13, testname//" (order= "//ToString(order)//"): ") + + CALL fedof%GetFaceDOF(globalElement=1, islocal=.TRUE., & + ans=found, tsize=tsize, localFaceNumber=1) + + CALL IS(tsize, 1, testname//" (order= "//ToString(order)//"): ") + CALL IS(found(1), 13, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 3 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + CALL fedof%GetFaceDOF(globalFace=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + CALL IS(tsize, 2, testname//" (order= "//ToString(order)//"): ") + CALL IS(found(1), 13, testname//" (order= "//ToString(order)//"): ") + + CALL fedof%GetFaceDOF(globalElement=1, islocal=.TRUE., & + ans=found, tsize=tsize, localFaceNumber=1) + + CALL IS(tsize, 2, testname//" (order= "//ToString(order)//"): ") + CALL IS(found(1), 13, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test3 + +!---------------------------------------------------------------------------- +! +!---------------------------------------------------------------------------- + +END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetFaceDOF_test_1.md b/docs/docs-api/FEDOF/examples/_GetFaceDOF_test_1.md new file mode 100644 index 00000000..8e322a53 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetFaceDOF_test_1.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetFaceDOF_test_1.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetFaceDOF_test_2.F90 b/docs/docs-api/FEDOF/examples/_GetFaceDOF_test_2.F90 new file mode 100644 index 00000000..27f66326 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetFaceDOF_test_2.F90 @@ -0,0 +1,122 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-07 +! summary: Testing GetFaceDOF method of FEDOF class +! H1 Heirarchical Second Order Triangular Mesh + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE AppendUtility +USE ArangeUtility +USE ReallocateUtility + +IMPLICIT NONE + +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri6_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Heirarchical", & + testname = baseContinuity//" "//baseInterpolation//" GetFaceDOF test" + +TYPE(FEDOF_) :: fedof +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +TYPE(HDF5File_) :: meshfile +INTEGER(I4B) :: order, totalVertexNodes, totalFaces +LOGICAL(LGT) :: isok + +CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.) + +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() +totalVertexNodes = meshptr%GetTotalVertexNodes() +totalFaces = meshptr%GetTotalFaces() + +CALL test1 +CALL test2 +CALL test3 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + + INTEGER(I4B) :: tsize, found(10), want(10) + INTEGER(I4B), ALLOCATABLE :: con(:) + + order = 1 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + con = fedof%GetConnectivity(globalElement=1, islocal=.TRUE., opt="A") + + CALL fedof%GetFaceDOF(globalFace=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + isok = tsize .EQ. 0 + CALL OK(isok, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 2 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + CALL fedof%GetFaceDOF(globalFace=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + CALL IS(tsize, 1, testname//" (order= "//ToString(order)//"): ") + CALL IS(found(1), 13, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 3 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + CALL fedof%GetFaceDOF(globalFace=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + CALL IS(tsize, 2, testname//" (order= "//ToString(order)//"): ") + CALL IS(found(1), 13, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test3 + +!---------------------------------------------------------------------------- +! +!---------------------------------------------------------------------------- + +END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetFaceDOF_test_2.md b/docs/docs-api/FEDOF/examples/_GetFaceDOF_test_2.md new file mode 100644 index 00000000..a00a71b7 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetFaceDOF_test_2.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetFaceDOF_test_2.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetFaceDOF_test_3.F90 b/docs/docs-api/FEDOF/examples/_GetFaceDOF_test_3.F90 new file mode 100644 index 00000000..7025f8c0 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetFaceDOF_test_3.F90 @@ -0,0 +1,123 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-07 +! summary: Testing GetFaceDOF method of FEDOF class +! H1 Heirarchical Second Order Triangular Mesh + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE AppendUtility +USE ArangeUtility +USE ReallocateUtility +USE BaseType, ONLY: TypeQuadratureOpt + +IMPLICIT NONE + +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri3_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Lagrange", & + testname = baseContinuity//" "//baseInterpolation//" GetFaceDOF test" + +TYPE(FEDOF_) :: fedof +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +TYPE(HDF5File_) :: meshfile +INTEGER(I4B) :: order, totalVertexNodes, totalFaces +LOGICAL(LGT) :: isok + +CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.) + +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() +totalVertexNodes = meshptr%GetTotalVertexNodes() +totalFaces = meshptr%GetTotalFaces() + +CALL test1 +CALL test2 +CALL test3 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + + INTEGER(I4B) :: tsize, found(10), want(10) + INTEGER(I4B), ALLOCATABLE :: con(:) + + order = 1 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, ipType=TypeQuadratureOpt%equidistance) + + con = fedof%GetConnectivity(globalElement=1, islocal=.TRUE., opt="A") + + CALL fedof%GetFaceDOF(globalFace=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + isok = tsize .EQ. 0 + CALL OK(isok, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 2 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, ipType=TypeQuadratureOpt%equidistance) + + CALL fedof%GetFaceDOF(globalFace=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + CALL IS(tsize, 1, testname//" (order= "//ToString(order)//"): ") + CALL IS(found(1), 13, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + + INTEGER(I4B) :: tsize, found(10), want(10) + + order = 3 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, ipType=TypeQuadratureOpt%equidistance) + + CALL fedof%GetFaceDOF(globalFace=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + CALL IS(tsize, 2, testname//" (order= "//ToString(order)//"): ") + CALL IS(found(1), 13, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test3 + +!---------------------------------------------------------------------------- +! +!---------------------------------------------------------------------------- + +END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetFaceDOF_test_3.md b/docs/docs-api/FEDOF/examples/_GetFaceDOF_test_3.md new file mode 100644 index 00000000..7a77faa4 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetFaceDOF_test_3.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetFaceDOF_test_3.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_1.F90 b/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_1.F90 index fdb5b66b..2c21ac6d 100644 --- a/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_1.F90 +++ b/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_1.F90 @@ -1,5 +1,7 @@ -! Get quadrature1 tested -!! obj_GetQuadraturePoints1(obj, quad, globalElement, quadratureType, order, alpha, beta, lambda, islocal) +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-09 +! summary: This program tests the GetLocalElemshapeData +! method of the FEDOF class. PROGRAM main USE FEDOF_Class @@ -13,80 +15,234 @@ PROGRAM main USE BaseType, ONLY: QuadraturePoint_, TypeQuadratureOpt, ElemshapeData_ USE QuadraturePoint_Method USE ElemshapeData_Method +USE ApproxUtility IMPLICIT NONE -TYPE(FEDOF_) :: obj +TYPE(FEDOF_) :: obj, geoobj TYPE(FEDomain_) :: dom CLASS(AbstractMesh_), POINTER :: meshptr => NULL() -CHARACTER(*), PARAMETER :: filename = & - "../../Mesh/examples/meshdata/small_mesh.h5" +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri3_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Heirarchical", & + testname = baseContinuity//" "//baseInterpolation//" GetLocalElemshapeData " + TYPE(HDF5File_) :: meshfile + TYPE(QuadraturePoint_) :: quad -TYPE(ElemshapeData_) :: elemsd -CHARACTER(:), ALLOCATABLE :: testname +TYPE(ElemshapeData_) :: elemsd, geoelemsd -INTEGER(I4B) :: globalElement, telements, order, nodecon(100), ii, jj, nsd +INTEGER(I4B) :: globalElement, telements, order, & + nodecon(100), ii, jj, nsd REAL(DFP) :: nodecoord(3, 100) -LOGICAL(LGT) :: islocal +LOGICAL(LGT) :: islocal, isok CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.) CALL meshfile%Initiate(filename, mode="READ") CALL meshfile%OPEN() CALL dom%Initiate(meshfile, '') - meshptr => dom%GetMeshPointer() nsd = meshptr%GetNSD() -CALL obj%Initiate(baseContinuity="H1", baseInterpolation="Heirarchical", & - order=1, mesh=meshptr) -testname = "H1 Hierarchical order=1" +CALL test1 +CALL test2 +CALL test3 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- -! CALL obj%Display(testname) +SUBROUTINE test1 -! telements = meshptr%GetTotalElements() -telements = 1 -globalElement = 1 -order = 1 -islocal = .TRUE. + REAL(DFP) :: found(1), want(1) -! DO globalElement = 1, telements + order = 1 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) -CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & + globalElement = 1; islocal = .TRUE. + CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & quadratureType=TypeQuadratureOpt%GaussLegendre, & - order=order, islocal=islocal) + order=order, islocal=islocal) -CALL obj%GetLocalElemshapeData(quad=quad, elemsd=elemsd, & - globalElement=globalElement, islocal=islocal) + CALL obj%GetLocalElemshapeData(quad=quad, elemsd=elemsd, & + globalElement=globalElement, islocal=islocal) -CALL meshptr%GetNodeCoord(nodecoord=nodecoord, nrow=ii, ncol=jj, & - globalElement=globalElement, islocal=islocal) + CALL meshptr%GetNodeCoord(nodecoord=nodecoord, nrow=ii, ncol=jj, & + globalElement=globalElement, islocal=islocal) -CALL Display(nodecoord(1:nsd, 1:jj), "nodecoord: ") + CALL obj%GetGlobalElemshapeData(elemsd=elemsd, xij=nodecoord(1:nsd, 1:jj), & + globalElement=globalElement, islocal=islocal) -CALL obj%GetGlobalElemshapeData(elemsd=elemsd, xij=nodecoord(1:nsd, 1:jj), & - globalElement=globalElement, islocal=islocal) -! CALL Display(cellorder(1:tcellorder), "cellorder: ") -! CALL Display(faceorder(1:3, 1:tfaceorder), "faceorder: ") -! CALL Display(edgeorder(1:tedgeorder), "edgeOrder: ") -! CALL Display(cellOrient(1:tcellorient), "cellOrient: ") -CALL Display(globalelement, "globalelements: ") -CALL Display(order, "order: ") -! CALL Display(quad, "quad:") -! CALL Display(elemsd, "elemsd:") + found = SUM(elemsd%N, dim=1) + want = 1.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname) -CALL Display(elemsd%N, "N:") -CALL Display(elemsd%dNdXi, "dNdXi:") -CALL Display(elemsd%dNdXt, "dNdXt:") + found(1) = SUM(elemsd%dNdXi(:, 1, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname) -! END DO + found(1) = SUM(elemsd%dNdXi(:, 2, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname) -!CALL dom%Display("domain:") -CALL dom%DEALLOCATE() -CALL meshfile%DEALLOCATE() + found(1) = SUM(elemsd%dNdXt(:, 1, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname) + + found(1) = SUM(elemsd%dNdXt(:, 2, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname) + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + + REAL(DFP) :: found(1), want(1) + + order = 2 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + CALL geoobj%Initiate(baseContinuity="H1", & + baseInterpolation="Lagrange", & + order=1, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + globalElement = 1; islocal = .TRUE. + CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & + quadratureType=TypeQuadratureOpt%GaussLegendre, & + order=1, islocal=islocal) + + CALL obj%GetLocalElemshapeData(quad=quad, elemsd=elemsd, & + globalElement=globalElement, islocal=islocal) + + CALL geoobj%GetLocalElemshapeData(quad=quad, elemsd=geoelemsd, & + globalElement=globalElement, islocal=islocal) + + CALL meshptr%GetNodeCoord(nodecoord=nodecoord, nrow=ii, ncol=jj, & + globalElement=globalElement, islocal=islocal) + + CALL obj%GetGlobalElemshapeData(elemsd=elemsd, xij=nodecoord(1:nsd, 1:jj), & + globalElement=globalElement, islocal=islocal, & + geoelemsd=geoelemsd) + + found = SUM(elemsd%N(1:3, :), dim=1) + want = 1.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test2 elemsd%N") + + found(1) = SUM(elemsd%dNdXi(:, 1, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test2 elemsd%dNdXi") + + found(1) = SUM(elemsd%dNdXi(:, 2, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test2 elemsd%dNdXi") + + found(1) = SUM(elemsd%dNdXt(:, 1, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test2 elemsd%dNdXt") + + found(1) = SUM(elemsd%dNdXt(:, 2, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test2 elemsd%dNdXt") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + + REAL(DFP) :: found(1), want(1) + + order = 3 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + CALL geoobj%Initiate(baseContinuity="H1", & + baseInterpolation="Lagrange", & + order=1, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + globalElement = 1; islocal = .TRUE. + CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & + quadratureType=TypeQuadratureOpt%GaussLegendre, & + order=1, islocal=islocal) + + CALL obj%GetLocalElemshapeData(quad=quad, elemsd=elemsd, & + globalElement=globalElement, islocal=islocal) + + CALL geoobj%GetLocalElemshapeData(quad=quad, elemsd=geoelemsd, & + globalElement=globalElement, islocal=islocal) + + CALL meshptr%GetNodeCoord(nodecoord=nodecoord, nrow=ii, ncol=jj, & + globalElement=globalElement, islocal=islocal) + + CALL obj%GetGlobalElemshapeData(elemsd=elemsd, xij=nodecoord(1:nsd, 1:jj), & + globalElement=globalElement, islocal=islocal, & + geoelemsd=geoelemsd) + + found = SUM(elemsd%N(1:3, :), dim=1) + want = 1.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test3 elemsd%N") + + found(1) = SUM(elemsd%dNdXi(:, 1, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test3 elemsd%dNdXi") + + found(1) = SUM(elemsd%dNdXi(:, 2, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test3 elemsd%dNdXi") + + found(1) = SUM(elemsd%dNdXt(:, 1, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test3 elemsd%dNdXt") + + found(1) = SUM(elemsd%dNdXt(:, 2, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test3 elemsd%dNdXt") + +END SUBROUTINE test3 + +!---------------------------------------------------------------------------- +! +!---------------------------------------------------------------------------- END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_1.md b/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_1.md new file mode 100644 index 00000000..97523313 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_1.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetLocalElemshapeData_test_1.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_2.F90 b/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_2.F90 new file mode 100644 index 00000000..7ce923ad --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_2.F90 @@ -0,0 +1,252 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-09 +! summary: This program tests the GetLocalElemshapeData +! method of the FEDOF class. + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE BaseType, ONLY: QuadraturePoint_, TypeQuadratureOpt, ElemshapeData_ +USE QuadraturePoint_Method +USE ElemshapeData_Method +USE ApproxUtility + +IMPLICIT NONE + +TYPE(FEDOF_) :: obj, geoobj +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri6_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Heirarchical", & + testname = baseContinuity//" "//baseInterpolation//" GetLocalElemshapeData " + +TYPE(HDF5File_) :: meshfile + +TYPE(QuadraturePoint_) :: quad + +TYPE(ElemshapeData_) :: elemsd, geoelemsd + +INTEGER(I4B) :: globalElement, telements, order, & + nodecon(100), ii, jj, nsd + +REAL(DFP) :: nodecoord(3, 100) + +LOGICAL(LGT) :: islocal, isok + +CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.) +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() +nsd = meshptr%GetNSD() + +CALL test1 +CALL test2 +CALL test3 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + + REAL(DFP) :: found(1), want(1) + + order = 1 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + globalElement = 1; islocal = .TRUE. + CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & + quadratureType=TypeQuadratureOpt%GaussLegendre, & + order=order, islocal=islocal) + + CALL obj%GetLocalElemshapeData(quad=quad, elemsd=elemsd, & + globalElement=globalElement, islocal=islocal) + + CALL meshptr%GetNodeCoord(nodecoord=nodecoord, nrow=ii, ncol=jj, & + globalElement=globalElement, islocal=islocal) + + CALL obj%GetGlobalElemshapeData(elemsd=elemsd, xij=nodecoord(1:nsd, 1:jj), & + globalElement=globalElement, islocal=islocal) + + found = SUM(elemsd%N, dim=1) + want = 1.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname) + + found(1) = SUM(elemsd%dNdXi(:, 1, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname) + + found(1) = SUM(elemsd%dNdXi(:, 2, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname) + + found(1) = SUM(elemsd%dNdXt(:, 1, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname) + + found(1) = SUM(elemsd%dNdXt(:, 2, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname) + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + + REAL(DFP) :: found(1), want(1) + + order = 2 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + CALL geoobj%Initiate(baseContinuity="H1", & + baseInterpolation="Lagrange", & + order=1, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + globalElement = 1; islocal = .TRUE. + CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & + quadratureType=TypeQuadratureOpt%GaussLegendre, & + order=1, islocal=islocal) + + CALL obj%GetLocalElemshapeData(quad=quad, elemsd=elemsd, & + globalElement=globalElement, islocal=islocal) + + CALL geoobj%GetLocalElemshapeData(quad=quad, elemsd=geoelemsd, & + globalElement=globalElement, islocal=islocal) + + CALL meshptr%GetNodeCoord(nodecoord=nodecoord, nrow=ii, ncol=jj, & + globalElement=globalElement, islocal=islocal) + + CALL obj%GetGlobalElemshapeData(elemsd=elemsd, xij=nodecoord(1:nsd, 1:jj), & + globalElement=globalElement, islocal=islocal, & + geoelemsd=geoelemsd) + + found = SUM(elemsd%N(1:3, :), dim=1) + want = 1.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test2 elemsd%N") + + found(1) = SUM(elemsd%dNdXi(:, 1, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test2 elemsd%dNdXi") + + found(1) = SUM(elemsd%dNdXi(:, 2, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test2 elemsd%dNdXi") + + found(1) = SUM(elemsd%dNdXt(:, 1, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test2 elemsd%dNdXt") + + found(1) = SUM(elemsd%dNdXt(:, 2, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test2 elemsd%dNdXt") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + + REAL(DFP) :: found(1), want(1) + + order = 3 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + CALL geoobj%Initiate(baseContinuity="H1", & + baseInterpolation="Lagrange", & + order=1, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + globalElement = 1; islocal = .TRUE. + CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & + quadratureType=TypeQuadratureOpt%GaussLegendre, & + order=1, islocal=islocal) + + CALL obj%GetLocalElemshapeData(quad=quad, elemsd=elemsd, & + globalElement=globalElement, islocal=islocal) + + CALL geoobj%GetLocalElemshapeData(quad=quad, elemsd=geoelemsd, & + globalElement=globalElement, islocal=islocal) + + CALL meshptr%GetNodeCoord(nodecoord=nodecoord, nrow=ii, ncol=jj, & + globalElement=globalElement, islocal=islocal) + + CALL obj%GetGlobalElemshapeData(elemsd=elemsd, xij=nodecoord(1:nsd, 1:jj), & + globalElement=globalElement, islocal=islocal, & + geoelemsd=geoelemsd) + + found = SUM(elemsd%N(1:3, :), dim=1) + want = 1.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test3 elemsd%N") + + found(1) = SUM(elemsd%dNdXi(:, 1, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test3 elemsd%dNdXi") + + found(1) = SUM(elemsd%dNdXi(:, 2, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test3 elemsd%dNdXi") + + found(1) = SUM(elemsd%dNdXt(:, 1, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test3 elemsd%dNdXt") + + found(1) = SUM(elemsd%dNdXt(:, 2, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test3 elemsd%dNdXt") + +END SUBROUTINE test3 + +!---------------------------------------------------------------------------- +! +!---------------------------------------------------------------------------- + +END PROGRAM main + +! total nodes = 25 +! total elements = 16 +! total faces = 40 +! total edges = 0 diff --git a/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_2.md b/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_2.md new file mode 100644 index 00000000..c5f0b4d6 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_2.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetLocalElemshapeData_test_2.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_3.F90 b/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_3.F90 new file mode 100644 index 00000000..e2e76b12 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_3.F90 @@ -0,0 +1,252 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-09 +! summary: This program tests the GetLocalElemshapeData +! method of the FEDOF class. + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE BaseType, ONLY: QuadraturePoint_, TypeQuadratureOpt, ElemshapeData_ +USE QuadraturePoint_Method +USE ElemshapeData_Method +USE ApproxUtility + +IMPLICIT NONE + +TYPE(FEDOF_) :: obj, geoobj +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri3_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Lagrange", & + testname = baseContinuity//" "//baseInterpolation//" GetLocalElemshapeData " + +TYPE(HDF5File_) :: meshfile + +TYPE(QuadraturePoint_) :: quad + +TYPE(ElemshapeData_) :: elemsd, geoelemsd + +INTEGER(I4B) :: globalElement, telements, order, & + nodecon(100), ii, jj, nsd + +REAL(DFP) :: nodecoord(3, 100) + +LOGICAL(LGT) :: islocal, isok + +CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.) +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() +nsd = meshptr%GetNSD() + +CALL test1 +CALL test2 +CALL test3 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + + REAL(DFP) :: found(1), want(1) + + order = 1 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + globalElement = 1; islocal = .TRUE. + CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & + quadratureType=TypeQuadratureOpt%GaussLegendre, & + order=order, islocal=islocal) + + CALL obj%GetLocalElemshapeData(quad=quad, elemsd=elemsd, & + globalElement=globalElement, islocal=islocal) + + CALL meshptr%GetNodeCoord(nodecoord=nodecoord, nrow=ii, ncol=jj, & + globalElement=globalElement, islocal=islocal) + + CALL obj%GetGlobalElemshapeData(elemsd=elemsd, xij=nodecoord(1:nsd, 1:jj), & + globalElement=globalElement, islocal=islocal) + + found = SUM(elemsd%N, dim=1) + want = 1.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname) + + found(1) = SUM(elemsd%dNdXi(:, 1, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname) + + found(1) = SUM(elemsd%dNdXi(:, 2, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname) + + found(1) = SUM(elemsd%dNdXt(:, 1, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname) + + found(1) = SUM(elemsd%dNdXt(:, 2, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname) + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + + REAL(DFP) :: found(1), want(1) + + order = 2 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + CALL geoobj%Initiate(baseContinuity="H1", & + baseInterpolation="Lagrange", & + order=1, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + globalElement = 1; islocal = .TRUE. + CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & + quadratureType=TypeQuadratureOpt%GaussLegendre, & + order=1, islocal=islocal) + + CALL obj%GetLocalElemshapeData(quad=quad, elemsd=elemsd, & + globalElement=globalElement, islocal=islocal) + + CALL geoobj%GetLocalElemshapeData(quad=quad, elemsd=geoelemsd, & + globalElement=globalElement, islocal=islocal) + + CALL meshptr%GetNodeCoord(nodecoord=nodecoord, nrow=ii, ncol=jj, & + globalElement=globalElement, islocal=islocal) + + CALL obj%GetGlobalElemshapeData(elemsd=elemsd, xij=nodecoord(1:nsd, 1:jj), & + globalElement=globalElement, islocal=islocal, & + geoelemsd=geoelemsd) + + found = SUM(elemsd%N(:, :), dim=1) + want = 1.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test2 elemsd%N") + + found(1) = SUM(elemsd%dNdXi(:, 1, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test2 elemsd%dNdXi") + + found(1) = SUM(elemsd%dNdXi(:, 2, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test2 elemsd%dNdXi") + + found(1) = SUM(elemsd%dNdXt(:, 1, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test2 elemsd%dNdXt") + + found(1) = SUM(elemsd%dNdXt(:, 2, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test2 elemsd%dNdXt") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + + REAL(DFP) :: found(1), want(1) + + order = 3 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + CALL geoobj%Initiate(baseContinuity="H1", & + baseInterpolation="Lagrange", & + order=1, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + globalElement = 1; islocal = .TRUE. + CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & + quadratureType=TypeQuadratureOpt%GaussLegendre, & + order=1, islocal=islocal) + + CALL obj%GetLocalElemshapeData(quad=quad, elemsd=elemsd, & + globalElement=globalElement, islocal=islocal) + + CALL geoobj%GetLocalElemshapeData(quad=quad, elemsd=geoelemsd, & + globalElement=globalElement, islocal=islocal) + + CALL meshptr%GetNodeCoord(nodecoord=nodecoord, nrow=ii, ncol=jj, & + globalElement=globalElement, islocal=islocal) + + CALL obj%GetGlobalElemshapeData(elemsd=elemsd, xij=nodecoord(1:nsd, 1:jj), & + globalElement=globalElement, islocal=islocal, & + geoelemsd=geoelemsd) + + found = SUM(elemsd%N(:, :), dim=1) + want = 1.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test3 elemsd%N") + + found(1) = SUM(elemsd%dNdXi(:, 1, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test3 elemsd%dNdXi") + + found(1) = SUM(elemsd%dNdXi(:, 2, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test3 elemsd%dNdXi") + + found(1) = SUM(elemsd%dNdXt(:, 1, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test3 elemsd%dNdXt") + + found(1) = SUM(elemsd%dNdXt(:, 2, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test3 elemsd%dNdXt") + +END SUBROUTINE test3 + +!---------------------------------------------------------------------------- +! +!---------------------------------------------------------------------------- + +END PROGRAM main + +! total nodes = 25 +! total elements = 16 +! total faces = 40 +! total edges = 0 diff --git a/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_3.md b/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_3.md new file mode 100644 index 00000000..89d8ec04 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_3.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetLocalElemshapeData_test_3.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_4.F90 b/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_4.F90 new file mode 100644 index 00000000..3be6c349 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_4.F90 @@ -0,0 +1,252 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-09 +! summary: This program tests the GetLocalElemshapeData +! method of the FEDOF class. + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE BaseType, ONLY: QuadraturePoint_, TypeQuadratureOpt, ElemshapeData_ +USE QuadraturePoint_Method +USE ElemshapeData_Method +USE ApproxUtility + +IMPLICIT NONE + +TYPE(FEDOF_) :: obj, geoobj +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri6_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Lagrange", & + testname = baseContinuity//" "//baseInterpolation//" GetLocalElemshapeData " + +TYPE(HDF5File_) :: meshfile + +TYPE(QuadraturePoint_) :: quad + +TYPE(ElemshapeData_) :: elemsd, geoelemsd + +INTEGER(I4B) :: globalElement, telements, order, & + nodecon(100), ii, jj, nsd + +REAL(DFP) :: nodecoord(3, 100) + +LOGICAL(LGT) :: islocal, isok + +CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.) +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() +nsd = meshptr%GetNSD() + +CALL test1 +CALL test2 +CALL test3 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + + REAL(DFP) :: found(1), want(1) + + order = 1 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + globalElement = 1; islocal = .TRUE. + CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & + quadratureType=TypeQuadratureOpt%GaussLegendre, & + order=order, islocal=islocal) + + CALL obj%GetLocalElemshapeData(quad=quad, elemsd=elemsd, & + globalElement=globalElement, islocal=islocal) + + CALL meshptr%GetNodeCoord(nodecoord=nodecoord, nrow=ii, ncol=jj, & + globalElement=globalElement, islocal=islocal) + + CALL obj%GetGlobalElemshapeData(elemsd=elemsd, xij=nodecoord(1:nsd, 1:jj), & + globalElement=globalElement, islocal=islocal) + + found = SUM(elemsd%N, dim=1) + want = 1.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname) + + found(1) = SUM(elemsd%dNdXi(:, 1, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname) + + found(1) = SUM(elemsd%dNdXi(:, 2, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname) + + found(1) = SUM(elemsd%dNdXt(:, 1, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname) + + found(1) = SUM(elemsd%dNdXt(:, 2, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname) + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + + REAL(DFP) :: found(1), want(1) + + order = 2 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + CALL geoobj%Initiate(baseContinuity="H1", & + baseInterpolation="Lagrange", & + order=1, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + globalElement = 1; islocal = .TRUE. + CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & + quadratureType=TypeQuadratureOpt%GaussLegendre, & + order=1, islocal=islocal) + + CALL obj%GetLocalElemshapeData(quad=quad, elemsd=elemsd, & + globalElement=globalElement, islocal=islocal) + + CALL geoobj%GetLocalElemshapeData(quad=quad, elemsd=geoelemsd, & + globalElement=globalElement, islocal=islocal) + + CALL meshptr%GetNodeCoord(nodecoord=nodecoord, nrow=ii, ncol=jj, & + globalElement=globalElement, islocal=islocal) + + CALL obj%GetGlobalElemshapeData(elemsd=elemsd, xij=nodecoord(1:nsd, 1:jj), & + globalElement=globalElement, islocal=islocal, & + geoelemsd=geoelemsd) + + found = SUM(elemsd%N(:, :), dim=1) + want = 1.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test2 elemsd%N") + + found(1) = SUM(elemsd%dNdXi(:, 1, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test2 elemsd%dNdXi") + + found(1) = SUM(elemsd%dNdXi(:, 2, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test2 elemsd%dNdXi") + + found(1) = SUM(elemsd%dNdXt(:, 1, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test2 elemsd%dNdXt") + + found(1) = SUM(elemsd%dNdXt(:, 2, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test2 elemsd%dNdXt") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + + REAL(DFP) :: found(1), want(1) + + order = 3 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + CALL geoobj%Initiate(baseContinuity="H1", & + baseInterpolation="Lagrange", & + order=1, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + globalElement = 1; islocal = .TRUE. + CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & + quadratureType=TypeQuadratureOpt%GaussLegendre, & + order=1, islocal=islocal) + + CALL obj%GetLocalElemshapeData(quad=quad, elemsd=elemsd, & + globalElement=globalElement, islocal=islocal) + + CALL geoobj%GetLocalElemshapeData(quad=quad, elemsd=geoelemsd, & + globalElement=globalElement, islocal=islocal) + + CALL meshptr%GetNodeCoord(nodecoord=nodecoord, nrow=ii, ncol=jj, & + globalElement=globalElement, islocal=islocal) + + CALL obj%GetGlobalElemshapeData(elemsd=elemsd, xij=nodecoord(1:nsd, 1:jj), & + globalElement=globalElement, islocal=islocal, & + geoelemsd=geoelemsd) + + found = SUM(elemsd%N(:, :), dim=1) + want = 1.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test3 elemsd%N") + + found(1) = SUM(elemsd%dNdXi(:, 1, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test3 elemsd%dNdXi") + + found(1) = SUM(elemsd%dNdXi(:, 2, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test3 elemsd%dNdXi") + + found(1) = SUM(elemsd%dNdXt(:, 1, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test3 elemsd%dNdXt") + + found(1) = SUM(elemsd%dNdXt(:, 2, 1), dim=1) + want(1) = 0.0_DFP + isok = found(1) .approxeq.want(1) + CALL OK(isok, testname//" test3 elemsd%dNdXt") + +END SUBROUTINE test3 + +!---------------------------------------------------------------------------- +! +!---------------------------------------------------------------------------- + +END PROGRAM main + +! total nodes = 25 +! total elements = 16 +! total faces = 40 +! total edges = 0 diff --git a/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_4.md b/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_4.md new file mode 100644 index 00000000..39ab3ef1 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetLocalElemshapeData_test_4.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetLocalElemshapeData_test_4.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_1.F90 b/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_1.F90 index 106f574d..c86fcb3d 100644 --- a/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_1.F90 +++ b/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_1.F90 @@ -1,4 +1,9 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-08 +! summary: Testing GetMaxTotalConnectivity method of FEDOF class + PROGRAM main +USE BaseType, ONLY: TypeQuadratureOpt USE FEDOF_Class USE FEDomain_Class USE AbstractMesh_Class @@ -13,39 +18,80 @@ PROGRAM main TYPE(FEDOF_) :: obj TYPE(FEDomain_) :: dom CLASS(AbstractMesh_), POINTER :: meshptr => NULL() -CHARACTER(*), PARAMETER :: filename = & - "../../Mesh/examples/meshdata/small_mesh.h5", & - baseContinuity = "H1", & - baseInterpolation = "Heirarchical" -INTEGER(I4B), PARAMETER :: order = 1 +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri3_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Heirarchical", & + testname = baseContinuity//" "//baseInterpolation// & + " GetMaxTotalConnectivity test" + +INTEGER(I4B) :: order = 1 TYPE(HDF5File_) :: meshfile -INTEGER(I4B) :: found, want LOGICAL(LGT) :: isok CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.) CALL meshfile%Initiate(filename, mode="READ") CALL meshfile%OPEN() CALL dom%Initiate(meshfile, '') - meshptr => dom%GetMeshPointer() -CALL obj%Initiate(baseContinuity=baseContinuity, & - baseInterpolation=baseInterpolation, & - order=order, mesh=meshptr) -!CALL fedof%Display("FEDOF:") -found = obj%GetMaxTotalConnectivity() -want = 3 -isok = found == want - -CALL OK(isok, "GetMaxTotalConnectivity") -IF (.NOT. isok) THEN - CALL Display(found, "found: ") - CALL Display(want, "want: ") -END IF - -!CALL dom%Display("domain:") +CALL test1 +CALL test2 +CALL test3 + CALL dom%DEALLOCATE() CALL meshfile%DEALLOCATE() +CONTAINS + +SUBROUTINE test1 + INTEGER(I4B) :: found, want + + order = 1 + + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + found = obj%GetMaxTotalConnectivity() + want = 3 + isok = found .EQ. want + + CALL IS(found, want, testname//" test 1") +END SUBROUTINE test1 + +SUBROUTINE test2 + INTEGER(I4B) :: found, want + + order = 2 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + found = obj%GetMaxTotalConnectivity() + want = 6 + isok = found .EQ. want + + CALL IS(found, want, testname//" test 2") +END SUBROUTINE test2 + +SUBROUTINE test3 + INTEGER(I4B) :: found, want + + order = 3 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + found = obj%GetMaxTotalConnectivity() + want = 10 + isok = found .EQ. want + + CALL IS(found, want, testname//" test 3") +END SUBROUTINE test3 + END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_1.md b/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_1.md new file mode 100644 index 00000000..c817c3bf --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_1.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetMaxTotalConnectivity_test_1.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_2.F90 b/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_2.F90 index 9d85434c..6538744b 100644 --- a/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_2.F90 +++ b/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_2.F90 @@ -1,6 +1,12 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-08 +! summary: Testing GetMaxTotalConnectivity method of FEDOF class + PROGRAM main +USE BaseType, ONLY: TypeQuadratureOpt USE FEDOF_Class -USE FEMesh_Class +USE FEDomain_Class +USE AbstractMesh_Class USE HDF5File_Class USE Display_Method USE GlobalData @@ -10,39 +16,82 @@ PROGRAM main IMPLICIT NONE TYPE(FEDOF_) :: obj -TYPE(FEMesh_) :: mesh -CHARACTER(*), PARAMETER :: filename = & - "../../Mesh/examples/meshdata/small_mesh.h5", & - baseContinuity = "H1", & - baseInterpolation = "Heirarchical" -INTEGER(I4B), PARAMETER :: order = 1, nsd = 2 +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri6_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Heirarchical", & + testname = baseContinuity//" "//baseInterpolation// & + " GetMaxTotalConnectivity test" + +INTEGER(I4B) :: order = 1 TYPE(HDF5File_) :: meshfile -INTEGER(I4B) :: found, want LOGICAL(LGT) :: isok -CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.) +CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.) CALL meshfile%Initiate(filename, mode="READ") CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() -CALL mesh%Initiate(hdf5=meshfile, dim=nsd) +CALL test1 +CALL test2 +CALL test3 -CALL obj%Initiate(baseContinuity=baseContinuity, & - baseInterpolation=baseInterpolation, & - order=order, mesh=mesh) -!CALL fedof%Display("FEDOF:") -found = obj%GetMaxTotalConnectivity() -want = 3 -isok = found == want +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() -CALL OK(isok, "GetMaxTotalConnectivity") -IF (.NOT. isok) THEN - CALL Display(found, "found: ") - CALL Display(want, "want: ") -END IF +CONTAINS -!CALL dom%Display("domain:") -CALL mesh%DEALLOCATE() -CALL meshfile%DEALLOCATE() +SUBROUTINE test1 + INTEGER(I4B) :: found, want + + order = 1 + + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + found = obj%GetMaxTotalConnectivity() + want = 3 + isok = found .EQ. want + + CALL IS(found, want, testname//" test 1") +END SUBROUTINE test1 + +SUBROUTINE test2 + INTEGER(I4B) :: found, want + + order = 2 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + found = obj%GetMaxTotalConnectivity() + want = 6 + isok = found .EQ. want + + CALL IS(found, want, testname//" test 2") +END SUBROUTINE test2 + +SUBROUTINE test3 + INTEGER(I4B) :: found, want + + order = 3 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + found = obj%GetMaxTotalConnectivity() + want = 10 + isok = found .EQ. want + + CALL IS(found, want, testname//" test 3") +END SUBROUTINE test3 END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_2.md b/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_2.md new file mode 100644 index 00000000..29a1329e --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_2.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetMaxTotalConnectivity_test_2.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_3.F90 b/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_3.F90 new file mode 100644 index 00000000..e8aacb22 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_3.F90 @@ -0,0 +1,97 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-08 +! summary: Testing GetMaxTotalConnectivity method of FEDOF class + +PROGRAM main +USE BaseType, ONLY: TypeQuadratureOpt +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION + +IMPLICIT NONE + +TYPE(FEDOF_) :: obj +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri3_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Lagrange", & + testname = baseContinuity//" "//baseInterpolation// & + " GetMaxTotalConnectivity test" + +INTEGER(I4B) :: order = 1 + +TYPE(HDF5File_) :: meshfile +LOGICAL(LGT) :: isok + +CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.) +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() + +CALL test1 +CALL test2 +CALL test3 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +SUBROUTINE test1 + INTEGER(I4B) :: found, want + + order = 1 + + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + found = obj%GetMaxTotalConnectivity() + want = 3 + isok = found .EQ. want + + CALL IS(found, want, testname//" test 1") +END SUBROUTINE test1 + +SUBROUTINE test2 + INTEGER(I4B) :: found, want + + order = 2 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + found = obj%GetMaxTotalConnectivity() + want = 6 + isok = found .EQ. want + + CALL IS(found, want, testname//" test 2") +END SUBROUTINE test2 + +SUBROUTINE test3 + INTEGER(I4B) :: found, want + + order = 3 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + found = obj%GetMaxTotalConnectivity() + want = 10 + isok = found .EQ. want + + CALL IS(found, want, testname//" test 3") +END SUBROUTINE test3 + +END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_3.md b/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_3.md new file mode 100644 index 00000000..7f2de94b --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_3.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetMaxTotalConnectivity_test_3.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_4.F90 b/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_4.F90 new file mode 100644 index 00000000..6a1eeba9 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_4.F90 @@ -0,0 +1,97 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-08 +! summary: Testing GetMaxTotalConnectivity method of FEDOF class + +PROGRAM main +USE BaseType, ONLY: TypeQuadratureOpt +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION + +IMPLICIT NONE + +TYPE(FEDOF_) :: obj +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri6_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Lagrange", & + testname = baseContinuity//" "//baseInterpolation// & + " GetMaxTotalConnectivity test" + +INTEGER(I4B) :: order = 1 + +TYPE(HDF5File_) :: meshfile +LOGICAL(LGT) :: isok + +CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.) +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() + +CALL test1 +CALL test2 +CALL test3 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +SUBROUTINE test1 + INTEGER(I4B) :: found, want + + order = 1 + + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + found = obj%GetMaxTotalConnectivity() + want = 3 + isok = found .EQ. want + + CALL IS(found, want, testname//" test 1") +END SUBROUTINE test1 + +SUBROUTINE test2 + INTEGER(I4B) :: found, want + + order = 2 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + found = obj%GetMaxTotalConnectivity() + want = 6 + isok = found .EQ. want + + CALL IS(found, want, testname//" test 2") +END SUBROUTINE test2 + +SUBROUTINE test3 + INTEGER(I4B) :: found, want + + order = 3 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + found = obj%GetMaxTotalConnectivity() + want = 10 + isok = found .EQ. want + + CALL IS(found, want, testname//" test 3") +END SUBROUTINE test3 + +END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_4.md b/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_4.md new file mode 100644 index 00000000..51e10035 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetMaxTotalConnectivity_test_4.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetMaxTotalConnectivity_test_4.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetQuadraturePoints_test_1.F90 b/docs/docs-api/FEDOF/examples/_GetQuadraturePoints_test_1.F90 new file mode 100644 index 00000000..35cf2ce1 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetQuadraturePoints_test_1.F90 @@ -0,0 +1,129 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-08 +! summary: Testing GetQuadraturePoints method of FEDOF class +! obj_GetQuadraturePoints1(obj, quad, globalElement, quadratureType, & +! order, alpha, beta, lambda, islocal) + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE BaseType, ONLY: QuadraturePoint_, TypeQuadratureOpt +USE QuadraturePoint_Method + +IMPLICIT NONE + +TYPE(FEDOF_) :: obj +TYPE(FEDomain_) :: dom + +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() + +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri3_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Hierarchical", & + testname = baseContinuity//" "//baseInterpolation// " GetQuadraturePoints test:" + +TYPE(HDF5File_) :: meshfile +TYPE(QuadraturePoint_) :: quad + +INTEGER(I4B) :: globalElement, telements, order + +CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.) +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() + +CALL test1 +CALL test2 +CALL test3 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + + order = 1 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + telements = 1 + globalElement = 1 + order = 2 + + CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & + quadratureType=TypeQuadratureOpt%GaussLegendre, & + order=order, islocal=.TRUE.) + + CALL Display(quad, testname//" quad: ") + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + + order = 2 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + telements = 1 + globalElement = 1 + order = 2 + + CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & + quadratureType=TypeQuadratureOpt%GaussLegendre, & + order=order, islocal=.TRUE.) + + CALL Display(quad, testname//" quad: ") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + + order = 2 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + telements = 1 + globalElement = 1 + order = 2 + + CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & + quadratureType=TypeQuadratureOpt%GaussLegendre, & + order=order, islocal=.TRUE.) + + CALL Display(quad, testname //" quad: ") + +END SUBROUTINE test3 + +END PROGRAM main + +! total nodes = 25 +! total elements = 16 +! total faces = 40 +! total edges = 0 diff --git a/docs/docs-api/FEDOF/examples/_GetQuadraturePoints_test_1.md b/docs/docs-api/FEDOF/examples/_GetQuadraturePoints_test_1.md new file mode 100644 index 00000000..b43cafd9 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetQuadraturePoints_test_1.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetQuadraturePoints_test_1.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetQuadraturePoints_test_2.F90 b/docs/docs-api/FEDOF/examples/_GetQuadraturePoints_test_2.F90 new file mode 100644 index 00000000..7b1302e8 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetQuadraturePoints_test_2.F90 @@ -0,0 +1,129 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-08 +! summary: Testing GetQuadraturePoints method of FEDOF class +! obj_GetQuadraturePoints1(obj, quad, globalElement, quadratureType, & +! order, alpha, beta, lambda, islocal) + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE BaseType, ONLY: QuadraturePoint_, TypeQuadratureOpt +USE QuadraturePoint_Method + +IMPLICIT NONE + +TYPE(FEDOF_) :: obj +TYPE(FEDomain_) :: dom + +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() + +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri6_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Hierarchical", & + testname = baseContinuity//" "//baseInterpolation// " GetQuadraturePoints test:" + +TYPE(HDF5File_) :: meshfile +TYPE(QuadraturePoint_) :: quad + +INTEGER(I4B) :: globalElement, telements, order + +CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.) +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() + +CALL test1 +CALL test2 +CALL test3 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + + order = 1 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + telements = 1 + globalElement = 1 + order = 2 + + CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & + quadratureType=TypeQuadratureOpt%GaussLegendre, & + order=order, islocal=.TRUE.) + + CALL Display(quad, testname//" quad: ") + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + + order = 2 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + telements = 1 + globalElement = 1 + order = 2 + + CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & + quadratureType=TypeQuadratureOpt%GaussLegendre, & + order=order, islocal=.TRUE.) + + CALL Display(quad, testname//" quad: ") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + + order = 2 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + telements = 1 + globalElement = 1 + order = 2 + + CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & + quadratureType=TypeQuadratureOpt%GaussLegendre, & + order=order, islocal=.TRUE.) + + CALL Display(quad, testname //" quad: ") + +END SUBROUTINE test3 + +END PROGRAM main + +! total nodes = 25 +! total elements = 16 +! total faces = 40 +! total edges = 0 diff --git a/docs/docs-api/FEDOF/examples/_GetQuadraturePoints_test_2.md b/docs/docs-api/FEDOF/examples/_GetQuadraturePoints_test_2.md new file mode 100644 index 00000000..bc9acd58 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetQuadraturePoints_test_2.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetQuadraturePoints_test_2.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetQuadraturePoints_test_3.F90 b/docs/docs-api/FEDOF/examples/_GetQuadraturePoints_test_3.F90 new file mode 100644 index 00000000..4d14e785 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetQuadraturePoints_test_3.F90 @@ -0,0 +1,129 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-08 +! summary: Testing GetQuadraturePoints method of FEDOF class +! obj_GetQuadraturePoints1(obj, quad, globalElement, quadratureType, & +! order, alpha, beta, lambda, islocal) + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE BaseType, ONLY: QuadraturePoint_, TypeQuadratureOpt +USE QuadraturePoint_Method + +IMPLICIT NONE + +TYPE(FEDOF_) :: obj +TYPE(FEDomain_) :: dom + +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() + +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri3_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Lagrange", & + testname = baseContinuity//" "//baseInterpolation// " GetQuadraturePoints test:" + +TYPE(HDF5File_) :: meshfile +TYPE(QuadraturePoint_) :: quad + +INTEGER(I4B) :: globalElement, telements, order + +CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.) +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() + +CALL test1 +CALL test2 +CALL test3 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + + order = 1 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + telements = 1 + globalElement = 1 + order = 2 + + CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & + quadratureType=TypeQuadratureOpt%GaussLegendre, & + order=order, islocal=.TRUE.) + + CALL Display(quad, testname//" quad: ") + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + + order = 2 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + telements = 1 + globalElement = 1 + order = 2 + + CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & + quadratureType=TypeQuadratureOpt%GaussLegendre, & + order=order, islocal=.TRUE.) + + CALL Display(quad, testname//" quad: ") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + + order = 2 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + telements = 1 + globalElement = 1 + order = 2 + + CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & + quadratureType=TypeQuadratureOpt%GaussLegendre, & + order=order, islocal=.TRUE.) + + CALL Display(quad, testname //" quad: ") + +END SUBROUTINE test3 + +END PROGRAM main + +! total nodes = 25 +! total elements = 16 +! total faces = 40 +! total edges = 0 diff --git a/docs/docs-api/FEDOF/examples/_GetQuadraturePoints_test_3.md b/docs/docs-api/FEDOF/examples/_GetQuadraturePoints_test_3.md new file mode 100644 index 00000000..db585212 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetQuadraturePoints_test_3.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetQuadraturePoints_test_3.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetQuadraturePoints_test_4.F90 b/docs/docs-api/FEDOF/examples/_GetQuadraturePoints_test_4.F90 new file mode 100644 index 00000000..17f31dfa --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetQuadraturePoints_test_4.F90 @@ -0,0 +1,130 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-08 +! summary: Testing GetQuadraturePoints method of FEDOF class +! obj_GetQuadraturePoints1(obj, quad, globalElement, quadratureType, & +! order, alpha, beta, lambda, islocal) + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE BaseType, ONLY: QuadraturePoint_, TypeQuadratureOpt +USE QuadraturePoint_Method + +IMPLICIT NONE + +TYPE(FEDOF_) :: obj +TYPE(FEDomain_) :: dom + +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() + +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri6_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Lagrange", & + testname = baseContinuity//" "//baseInterpolation// & + " GetQuadraturePoints test:" + +TYPE(HDF5File_) :: meshfile +TYPE(QuadraturePoint_) :: quad + +INTEGER(I4B) :: globalElement, telements, order + +CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.) +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() + +CALL test1 +CALL test2 +CALL test3 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + + order = 1 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + telements = 1 + globalElement = 1 + order = 2 + + CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & + quadratureType=TypeQuadratureOpt%GaussLegendre, & + order=order, islocal=.TRUE.) + + CALL Display(quad, testname//" quad: ") + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + + order = 2 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + telements = 1 + globalElement = 1 + order = 2 + + CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & + quadratureType=TypeQuadratureOpt%GaussLegendre, & + order=order, islocal=.TRUE.) + + CALL Display(quad, testname//" quad: ") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + + order = 2 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, & + ipType=TypeQuadratureOpt%equidistance) + + telements = 1 + globalElement = 1 + order = 2 + + CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & + quadratureType=TypeQuadratureOpt%GaussLegendre, & + order=order, islocal=.TRUE.) + + CALL Display(quad, testname//" quad: ") + +END SUBROUTINE test3 + +END PROGRAM main + +! total nodes = 25 +! total elements = 16 +! total faces = 40 +! total edges = 0 diff --git a/docs/docs-api/FEDOF/examples/_GetQuadraturePoints_test_4.md b/docs/docs-api/FEDOF/examples/_GetQuadraturePoints_test_4.md new file mode 100644 index 00000000..cb7dc0fc --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetQuadraturePoints_test_4.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetQuadraturePoints_test_4.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetQuadrature_test_1.F90 b/docs/docs-api/FEDOF/examples/_GetQuadrature_test_1.F90 deleted file mode 100644 index ca4dc704..00000000 --- a/docs/docs-api/FEDOF/examples/_GetQuadrature_test_1.F90 +++ /dev/null @@ -1,74 +0,0 @@ -! Get quadrature1 tested -!! obj_GetQuadraturePoints1(obj, quad, globalElement, quadratureType, order, alpha, beta, lambda, islocal) - -PROGRAM main -USE FEDOF_Class -USE FEDomain_Class -USE AbstractMesh_Class -USE HDF5File_Class -USE Display_Method -USE GlobalData -USE Test_Method -USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION -USE BaseType, ONLY: QuadraturePoint_, TypeQuadratureOpt -USE QuadraturePoint_Method - -IMPLICIT NONE - -TYPE(FEDOF_) :: obj -TYPE(FEDomain_) :: dom -CLASS(AbstractMesh_), POINTER :: meshptr => NULL() -CHARACTER(*), PARAMETER :: filename = & - "../../Mesh/examples/meshdata/small_mesh.h5" -TYPE(HDF5File_) :: meshfile -TYPE(QuadraturePoint_) :: quad - -CHARACTER(:), ALLOCATABLE :: testname - -INTEGER(I4B) :: globalElement, telements, order - -CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.) -CALL meshfile%Initiate(filename, mode="READ") -CALL meshfile%OPEN() -CALL dom%Initiate(meshfile, '') - -meshptr => dom%GetMeshPointer() - -CALL obj%Initiate(baseContinuity="H1", baseInterpolation="Hierarchical", & - order=1, mesh=meshptr) -testname = "H1 Hierarchical order=1" - -! CALL obj%Display(testname) - -! telements = meshptr%GetTotalElements() -telements = 1 -globalElement = 1 -order = 2 - -! DO globalElement = 1, telements - -CALL obj%GetQuadraturePoints(quad=quad, globalElement=globalElement, & - quadratureType=TypeQuadratureOpt%GaussLegendre, & - order=order, islocal=.TRUE.) - -! CALL Display(cellorder(1:tcellorder), "cellorder: ") -! CALL Display(faceorder(1:3, 1:tfaceorder), "faceorder: ") -! CALL Display(edgeorder(1:tedgeorder), "edgeOrder: ") -! CALL Display(cellOrient(1:tcellorient), "cellOrient: ") - -CALL Display(globalelement, "globalelements: ") -CALL Display(order, "order: ") -CALL Display(quad, "quad:") - -! END DO - -!CALL dom%Display("domain:") -CALL dom%DEALLOCATE() -CALL meshfile%DEALLOCATE() - -END PROGRAM main - -! total nodes = 25 -! total elements = 16 -! total faces = 40 -! total edges = 0 diff --git a/docs/docs-api/FEDOF/examples/_GetTotalCellDOF_test_1.F90 b/docs/docs-api/FEDOF/examples/_GetTotalCellDOF_test_1.F90 new file mode 100644 index 00000000..a2ff6467 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetTotalCellDOF_test_1.F90 @@ -0,0 +1,137 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-07 +! summary: Testing GetTotalCellDOF method of FEDOF class +! H1 Heirarchical Second Order Triangular Mesh + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE AppendUtility +USE ArangeUtility +USE ReallocateUtility + +IMPLICIT NONE + +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri3_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Heirarchical", & + testname = baseContinuity//" "//baseInterpolation//" GetTotalCellDOF test" + +TYPE(FEDOF_) :: fedof +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +TYPE(HDF5File_) :: meshfile +INTEGER(I4B) :: order, totalVertexNodes, totalFaces +LOGICAL(LGT) :: isok + +CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.) + +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() +totalVertexNodes = meshptr%GetTotalVertexNodes() +totalFaces = meshptr%GetTotalFaces() + +CALL test1 +CALL test2 +CALL test3 +CALL test4 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + + INTEGER(I4B) :: tsize, want, found + + order = 1 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + found = fedof%GetTotalCellDOF(globalCell=1, islocal=.TRUE.) + want = 0 + + CALL IS(found, want, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + + INTEGER(I4B) :: tsize, want, found + + order = 2 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + found = fedof%GetTotalCellDOF(globalCell=1, islocal=.TRUE.) + want = 0 + + CALL IS(found, want, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + + INTEGER(I4B) :: tsize, want, found + + order = 3 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + found = fedof%GetTotalCellDOF(globalCell=1, islocal=.TRUE.) + want = 1 + + CALL IS(found, want, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test3 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test4 + + INTEGER(I4B) :: tsize, want, found + + order = 4 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + found = fedof%GetTotalCellDOF(globalCell=1, islocal=.TRUE.) + want = 3 + + CALL IS(found, want, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test4 + +!---------------------------------------------------------------------------- +! +!---------------------------------------------------------------------------- + +END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetTotalCellDOF_test_1.md b/docs/docs-api/FEDOF/examples/_GetTotalCellDOF_test_1.md new file mode 100644 index 00000000..60dfe858 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetTotalCellDOF_test_1.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetTotalCellDOF_test_1.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetTotalDOF_test_1.F90 b/docs/docs-api/FEDOF/examples/_GetTotalDOF_test_1.F90 index 148be274..7ccb88d7 100644 --- a/docs/docs-api/FEDOF/examples/_GetTotalDOF_test_1.F90 +++ b/docs/docs-api/FEDOF/examples/_GetTotalDOF_test_1.F90 @@ -1,3 +1,7 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-08 +! summary: Testing GetTotalDOF method of FEDOF class + PROGRAM main USE FEDOF_Class USE FEDomain_Class @@ -6,42 +10,179 @@ PROGRAM main USE Display_Method USE GlobalData USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE AppendUtility +USE ArangeUtility +USE ReallocateUtility + IMPLICIT NONE +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri3_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Heirarchical", & + testname = baseContinuity//" "//baseInterpolation//" GetTotalDOF" + TYPE(FEDOF_) :: fedof TYPE(FEDomain_) :: dom CLASS(AbstractMesh_), POINTER :: meshptr => NULL() -CHARACTER(*), PARAMETER :: filename = & - & "../../Mesh/examples/meshdata/small_mesh.h5" TYPE(HDF5File_) :: meshfile -INTEGER(I4B) :: found, want +INTEGER(I4B) :: order, totalVertexNodes, totalFaces +LOGICAL(LGT) :: isok + +CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.) CALL meshfile%Initiate(filename, mode="READ") CALL meshfile%OPEN() CALL dom%Initiate(meshfile, '') - meshptr => dom%GetMeshPointer() +totalVertexNodes = meshptr%GetTotalVertexNodes() +totalFaces = meshptr%GetTotalFaces() + +CALL test1 +CALL test2 +CALL test3 -CALL fedof%Initiate(baseContinuity="H1", baseInterpolation="Heirarchical", & - order=1, mesh=meshptr) -found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE.) -want = meshptr%GetNNE(globalElement=1, islocal=.TRUE.) -CALL OK(found == want, "GetTotalDOF (order=1): ") - -CALL fedof%Initiate(baseContinuity="H1", baseInterpolation="Heirarchical", & - order=2, mesh=meshptr) -found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE.) -want = meshptr%GetNNE(globalElement=1, islocal=.TRUE.) + 3 -CALL OK(found == want, "GetTotalDOF (order=2): ") - -CALL fedof%Initiate(baseContinuity="H1", baseInterpolation="Heirarchical", & - order=3, mesh=meshptr) -found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE.) -want = meshptr%GetNNE(globalElement=1, islocal=.TRUE.) + 6 + 1 -CALL OK(found == want, "GetTotalDOF (order=3): ") - -!CALL dom%Display("domain:") CALL dom%DEALLOCATE() CALL meshfile%DEALLOCATE() +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + INTEGER(I4B) :: tsize, found, want + + order = 1 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + found = fedof%GetTotalDOF() + want = meshptr%GetTotalVertexNodes() + CALL IS(found, want, testname//" interface 1 (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE.) + want = meshptr%GetTotalVertexNodes(globalElement=1, islocal=.TRUE.) + CALL IS(found, want, testname//" interface 2 (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="A") + want = meshptr%GetTotalVertexNodes(globalElement=1, islocal=.TRUE.) + CALL IS(found, want, testname//" interface 3 a (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="E") + want = 0 + CALL IS(found, want, testname//" interface 3 e (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="F") + want = 0 + CALL IS(found, want, testname//" interface 3 f (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="c") + want = 0 + CALL IS(found, want, testname//" interface 3 c (order= "// & + ToString(order)//"): ") + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + INTEGER(I4B) :: tsize, found, want + + order = 2 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + found = fedof%GetTotalDOF() + want = meshptr%GetTotalVertexNodes() + meshptr%GetTotalFaces() * (order - 1) + CALL IS(found, want, testname//" interface 1 (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE.) + want = 6 + CALL IS(found, want, testname//" interface 2 (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="A") + want = 6 + CALL IS(found, want, testname//" interface 3 a (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="E") + want = 0 + CALL IS(found, want, testname//" interface 3 e (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="F") + want = 3 + CALL IS(found, want, testname//" interface 3 f (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="c") + want = 0 + CALL IS(found, want, testname//" interface 3 c (order= "// & + ToString(order)//"): ") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + INTEGER(I4B) :: tsize, found, want + + order = 3 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + found = fedof%GetTotalDOF() + want = meshptr%GetTotalVertexNodes() + meshptr%GetTotalFaces() * (order - 1) & + + meshptr%GetTotalCells() * (order - 2) * (order - 1) * 0.5 + CALL IS(found, want, testname//" interface 1 (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE.) + want = 10 + CALL IS(found, want, testname//" interface 2 (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="A") + want = 10 + CALL IS(found, want, testname//" interface 3 a (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="E") + want = 0 + CALL IS(found, want, testname//" interface 3 e (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="F") + want = 6 + CALL IS(found, want, testname//" interface 3 f (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="c") + want = 1 + CALL IS(found, want, testname//" interface 3 c (order= "// & + ToString(order)//"): ") + +END SUBROUTINE test3 + +!---------------------------------------------------------------------------- +! +!---------------------------------------------------------------------------- + END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetTotalDOF_test_1.md b/docs/docs-api/FEDOF/examples/_GetTotalDOF_test_1.md new file mode 100644 index 00000000..25f1bb0e --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetTotalDOF_test_1.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetTotalDOF_test_1.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetTotalDOF_test_2.F90 b/docs/docs-api/FEDOF/examples/_GetTotalDOF_test_2.F90 new file mode 100644 index 00000000..43d46801 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetTotalDOF_test_2.F90 @@ -0,0 +1,188 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-08 +! summary: Testing GetTotalDOF method of FEDOF class + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE AppendUtility +USE ArangeUtility +USE ReallocateUtility + +IMPLICIT NONE + +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri6_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Heirarchical", & + testname = baseContinuity//" "//baseInterpolation//" GetTotalDOF" + +TYPE(FEDOF_) :: fedof +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +TYPE(HDF5File_) :: meshfile +INTEGER(I4B) :: order, totalVertexNodes, totalFaces +LOGICAL(LGT) :: isok + +CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.) + +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() +totalVertexNodes = meshptr%GetTotalVertexNodes() +totalFaces = meshptr%GetTotalFaces() + +CALL test1 +CALL test2 +CALL test3 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + INTEGER(I4B) :: tsize, found, want + + order = 1 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + found = fedof%GetTotalDOF() + want = meshptr%GetTotalVertexNodes() + CALL IS(found, want, testname//" interface 1 (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE.) + want = meshptr%GetTotalVertexNodes(globalElement=1, islocal=.TRUE.) + CALL IS(found, want, testname//" interface 2 (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="A") + want = meshptr%GetTotalVertexNodes(globalElement=1, islocal=.TRUE.) + CALL IS(found, want, testname//" interface 3 a (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="E") + want = 0 + CALL IS(found, want, testname//" interface 3 e (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="F") + want = 0 + CALL IS(found, want, testname//" interface 3 f (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="c") + want = 0 + CALL IS(found, want, testname//" interface 3 c (order= "// & + ToString(order)//"): ") + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + INTEGER(I4B) :: tsize, found, want + + order = 2 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + found = fedof%GetTotalDOF() + want = meshptr%GetTotalVertexNodes() + meshptr%GetTotalFaces() * (order - 1) + CALL IS(found, want, testname//" interface 1 (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE.) + want = 6 + CALL IS(found, want, testname//" interface 2 (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="A") + want = 6 + CALL IS(found, want, testname//" interface 3 a (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="E") + want = 0 + CALL IS(found, want, testname//" interface 3 e (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="F") + want = 3 + CALL IS(found, want, testname//" interface 3 f (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="c") + want = 0 + CALL IS(found, want, testname//" interface 3 c (order= "// & + ToString(order)//"): ") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + INTEGER(I4B) :: tsize, found, want + + order = 3 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + found = fedof%GetTotalDOF() + want = meshptr%GetTotalVertexNodes() + meshptr%GetTotalFaces() * (order - 1) & + + meshptr%GetTotalCells() * (order - 2) * (order - 1) * 0.5 + CALL IS(found, want, testname//" interface 1 (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE.) + want = 10 + CALL IS(found, want, testname//" interface 2 (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="A") + want = 10 + CALL IS(found, want, testname//" interface 3 a (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="E") + want = 0 + CALL IS(found, want, testname//" interface 3 e (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="F") + want = 6 + CALL IS(found, want, testname//" interface 3 f (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="c") + want = 1 + CALL IS(found, want, testname//" interface 3 c (order= "// & + ToString(order)//"): ") + +END SUBROUTINE test3 + +!---------------------------------------------------------------------------- +! +!---------------------------------------------------------------------------- + +END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetTotalDOF_test_2.md b/docs/docs-api/FEDOF/examples/_GetTotalDOF_test_2.md new file mode 100644 index 00000000..cfcd0ff3 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetTotalDOF_test_2.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetTotalDOF_test_2.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetTotalDOF_test_3.F90 b/docs/docs-api/FEDOF/examples/_GetTotalDOF_test_3.F90 new file mode 100644 index 00000000..236b6582 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetTotalDOF_test_3.F90 @@ -0,0 +1,188 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-08 +! summary: Testing GetTotalDOF method of FEDOF class + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE AppendUtility +USE ArangeUtility +USE ReallocateUtility +USE BaseType, ONLY: TypeQuadratureOpt + +IMPLICIT NONE + +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri3_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Lagrange", & + testname = baseContinuity//" "//baseInterpolation//" GetTotalDOF" + +TYPE(FEDOF_) :: fedof +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +TYPE(HDF5File_) :: meshfile +INTEGER(I4B) :: order, totalVertexNodes, totalFaces +LOGICAL(LGT) :: isok + +CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.) + +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() +totalVertexNodes = meshptr%GetTotalVertexNodes() +totalFaces = meshptr%GetTotalFaces() + +CALL test1 +CALL test2 +CALL test3 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + INTEGER(I4B) :: tsize, found, want + + order = 1 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, order=order, & + mesh=meshptr, ipType=TypeQuadratureOpt%equidistance) + + found = fedof%GetTotalDOF() + want = meshptr%GetTotalVertexNodes() + CALL IS(found, want, testname//" interface 1 (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE.) + want = meshptr%GetTotalVertexNodes(globalElement=1, islocal=.TRUE.) + CALL IS(found, want, testname//" interface 2 (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="A") + want = meshptr%GetTotalVertexNodes(globalElement=1, islocal=.TRUE.) + CALL IS(found, want, testname//" interface 3 a (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="E") + want = 0 + CALL IS(found, want, testname//" interface 3 e (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="F") + want = 0 + CALL IS(found, want, testname//" interface 3 f (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="c") + want = 0 + CALL IS(found, want, testname//" interface 3 c (order= "// & + ToString(order)//"): ") + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + INTEGER(I4B) :: tsize, found, want + + order = 2 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, ipType=TypeQuadratureOpt%equidistance) + + found = fedof%GetTotalDOF() + want = meshptr%GetTotalVertexNodes() + meshptr%GetTotalFaces() * (order - 1) + CALL IS(found, want, testname//" interface 1 (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE.) + want = 6 + CALL IS(found, want, testname//" interface 2 (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="A") + want = 6 + CALL IS(found, want, testname//" interface 3 a (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="E") + want = 0 + CALL IS(found, want, testname//" interface 3 e (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="F") + want = 3 + CALL IS(found, want, testname//" interface 3 f (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="c") + want = 0 + CALL IS(found, want, testname//" interface 3 c (order= "// & + ToString(order)//"): ") +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + INTEGER(I4B) :: tsize, found, want + + order = 3 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, order=order, & + mesh=meshptr, ipType=TypeQuadratureOpt%equidistance) + + found = fedof%GetTotalDOF() + want = meshptr%GetTotalVertexNodes() & + + meshptr%GetTotalFaces() * (order - 1) & + + meshptr%GetTotalCells() * (order - 2) * (order - 1) * 0.5 + CALL IS(found, want, testname//" interface 1 (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE.) + want = 10 + CALL IS(found, want, testname//" interface 2 (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="A") + want = 10 + CALL IS(found, want, testname//" interface 3 a (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="E") + want = 0 + CALL IS(found, want, testname//" interface 3 e (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="F") + want = 6 + CALL IS(found, want, testname//" interface 3 f (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="c") + want = 1 + CALL IS(found, want, testname//" interface 3 c (order= "// & + ToString(order)//"): ") +END SUBROUTINE test3 + +!---------------------------------------------------------------------------- +! +!---------------------------------------------------------------------------- + +END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetTotalDOF_test_4.F90 b/docs/docs-api/FEDOF/examples/_GetTotalDOF_test_4.F90 new file mode 100644 index 00000000..a545d59e --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetTotalDOF_test_4.F90 @@ -0,0 +1,188 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-08 +! summary: Testing GetTotalDOF method of FEDOF class + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE AppendUtility +USE ArangeUtility +USE ReallocateUtility +USE BaseType, ONLY: TypeQuadratureOpt + +IMPLICIT NONE + +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri6_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Lagrange", & + testname = baseContinuity//" "//baseInterpolation//" GetTotalDOF" + +TYPE(FEDOF_) :: fedof +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +TYPE(HDF5File_) :: meshfile +INTEGER(I4B) :: order, totalVertexNodes, totalFaces +LOGICAL(LGT) :: isok + +CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.) + +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() +totalVertexNodes = meshptr%GetTotalVertexNodes() +totalFaces = meshptr%GetTotalFaces() + +CALL test1 +CALL test2 +CALL test3 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + INTEGER(I4B) :: tsize, found, want + + order = 1 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, order=order, & + mesh=meshptr, ipType=TypeQuadratureOpt%equidistance) + + found = fedof%GetTotalDOF() + want = meshptr%GetTotalVertexNodes() + CALL IS(found, want, testname//" interface 1 (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE.) + want = meshptr%GetTotalVertexNodes(globalElement=1, islocal=.TRUE.) + CALL IS(found, want, testname//" interface 2 (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="A") + want = meshptr%GetTotalVertexNodes(globalElement=1, islocal=.TRUE.) + CALL IS(found, want, testname//" interface 3 a (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="E") + want = 0 + CALL IS(found, want, testname//" interface 3 e (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="F") + want = 0 + CALL IS(found, want, testname//" interface 3 f (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="c") + want = 0 + CALL IS(found, want, testname//" interface 3 c (order= "// & + ToString(order)//"): ") + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + INTEGER(I4B) :: tsize, found, want + + order = 2 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr, ipType=TypeQuadratureOpt%equidistance) + + found = fedof%GetTotalDOF() + want = meshptr%GetTotalVertexNodes() + meshptr%GetTotalFaces() * (order - 1) + CALL IS(found, want, testname//" interface 1 (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE.) + want = 6 + CALL IS(found, want, testname//" interface 2 (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="A") + want = 6 + CALL IS(found, want, testname//" interface 3 a (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="E") + want = 0 + CALL IS(found, want, testname//" interface 3 e (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="F") + want = 3 + CALL IS(found, want, testname//" interface 3 f (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="c") + want = 0 + CALL IS(found, want, testname//" interface 3 c (order= "// & + ToString(order)//"): ") +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + INTEGER(I4B) :: tsize, found, want + + order = 3 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, order=order, & + mesh=meshptr, ipType=TypeQuadratureOpt%equidistance) + + found = fedof%GetTotalDOF() + want = meshptr%GetTotalVertexNodes() & + + meshptr%GetTotalFaces() * (order - 1) & + + meshptr%GetTotalCells() * (order - 2) * (order - 1) * 0.5 + CALL IS(found, want, testname//" interface 1 (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE.) + want = 10 + CALL IS(found, want, testname//" interface 2 (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="A") + want = 10 + CALL IS(found, want, testname//" interface 3 a (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="E") + want = 0 + CALL IS(found, want, testname//" interface 3 e (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="F") + want = 6 + CALL IS(found, want, testname//" interface 3 f (order= "// & + ToString(order)//"): ") + + found = fedof%GetTotalDOF(globalElement=1, islocal=.TRUE., opt="c") + want = 1 + CALL IS(found, want, testname//" interface 3 c (order= "// & + ToString(order)//"): ") +END SUBROUTINE test3 + +!---------------------------------------------------------------------------- +! +!---------------------------------------------------------------------------- + +END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetTotalFaceDOF_test_1.F90 b/docs/docs-api/FEDOF/examples/_GetTotalFaceDOF_test_1.F90 new file mode 100644 index 00000000..5da937b7 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetTotalFaceDOF_test_1.F90 @@ -0,0 +1,130 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-07 +! summary: Testing GetTotalFaceDOF method of FEDOF class +! H1 Heirarchical Second Order Triangular Mesh + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE AppendUtility +USE ArangeUtility +USE ReallocateUtility + +IMPLICIT NONE + +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri3_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Heirarchical", & + testname = baseContinuity//" "//baseInterpolation//" GetTotalFaceDOF test" + +TYPE(FEDOF_) :: fedof +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +TYPE(HDF5File_) :: meshfile +INTEGER(I4B) :: order, totalVertexNodes, totalFaces +LOGICAL(LGT) :: isok + +CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.) + +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() +totalVertexNodes = meshptr%GetTotalVertexNodes() +totalFaces = meshptr%GetTotalFaces() + +CALL test1 +CALL test2 +CALL test3 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + + INTEGER(I4B) :: tsize, found, want + INTEGER(I4B), ALLOCATABLE :: con(:) + + order = 1 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + found = fedof%GetTotalFaceDOF(globalFace=1, islocal=.TRUE.) + want = 0 + + CALL IS(found, want, testname//" (order= "//ToString(order)//"): ") + + found = fedof%GetTotalFaceDOF(globalElement=1, islocal=.TRUE., & + localFaceNumber=1) + + CALL IS(found, want, testname//" interface 2 (order= "//ToString(order)//"): ") + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + INTEGER(I4B) :: tsize, found, want + + order = 2 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + found = fedof%GetTotalFaceDOF(globalFace=1, islocal=.TRUE.) + want = 1 + + CALL IS(found, want, testname//" (order= "//ToString(order)//"): ") + + found = fedof%GetTotalFaceDOF(globalElement=1, islocal=.TRUE., & + localFaceNumber=1) + + CALL IS(found, want, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + INTEGER(I4B) :: tsize, found, want + + order = 3 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + found = fedof%GetTotalFaceDOF(globalFace=1, islocal=.TRUE.) + want = 2 + + CALL IS(found, want, testname//" (order= "//ToString(order)//"): ") + + found = fedof%GetTotalFaceDOF(globalElement=1, islocal=.TRUE., & + localFaceNumber=1) + + CALL IS(found, want, testname//" (order= "//ToString(order)//"): ") + +END SUBROUTINE test3 + +!---------------------------------------------------------------------------- +! +!---------------------------------------------------------------------------- + +END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetTotalFaceDOF_test_1.md b/docs/docs-api/FEDOF/examples/_GetTotalFaceDOF_test_1.md new file mode 100644 index 00000000..367c4bbf --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetTotalFaceDOF_test_1.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetTotalFaceDOF_test_1.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetVertexDOF_test_1.F90 b/docs/docs-api/FEDOF/examples/_GetVertexDOF_test_1.F90 new file mode 100644 index 00000000..78de482e --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetVertexDOF_test_1.F90 @@ -0,0 +1,129 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-07 +! summary: Testing GetVertexDOF method of FEDOF class +! H1 Heirarchical Second Order Triangular Mesh + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE AppendUtility +USE ArangeUtility +use ReallocateUtility + +IMPLICIT NONE + +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri3_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Heirarchical", & + testname = baseContinuity//" "//baseInterpolation + +TYPE(FEDOF_) :: fedof +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +TYPE(HDF5File_) :: meshfile +INTEGER(I4B), ALLOCATABLE :: found(:), want(:) +INTEGER(I4B) :: order, totalVertexNodes, totalFaces +LOGICAL(LGT) :: isok + +CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.) + +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() +totalVertexNodes = meshptr%GetTotalVertexNodes() +totalFaces = meshptr%GetTotalFaces() + +CALL test1 +CALL test2 +CALL test3 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + + INTEGER(I4B) :: tsize + + order = 1 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + CALL Reallocate(found, 2, want, 2) + CALL fedof%GetVertexDOF(globalNode=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + want(1) = 1 + + isok = ALL(found == want) + CALL OK(isok, testname//" GetVertexDOF (order= "//ToString(order)//"): ") + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + + INTEGER(I4B) :: tsize + + order = 2 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + CALL Reallocate(found, 2, want, 2) + CALL fedof%GetVertexDOF(globalNode=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + want(1) = 1 + + isok = ALL(found == want) + CALL OK(isok, testname//" GetVertexDOF (order= "//ToString(order)//"): ") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + + INTEGER(I4B) :: tsize + + order = 3 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + CALL Reallocate(found, 2, want, 2) + CALL fedof%GetVertexDOF(globalNode=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + want(1) = 1 + + isok = ALL(found == want) + CALL OK(isok, testname//" GetVertexDOF (order= "//ToString(order)//"): ") + +END SUBROUTINE test3 + +!---------------------------------------------------------------------------- +! +!---------------------------------------------------------------------------- + +END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetVertexDOF_test_1.md b/docs/docs-api/FEDOF/examples/_GetVertexDOF_test_1.md new file mode 100644 index 00000000..7d1735f5 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetVertexDOF_test_1.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetVertexDOF_test_1.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_GetVertexDOF_test_2.F90 b/docs/docs-api/FEDOF/examples/_GetVertexDOF_test_2.F90 new file mode 100644 index 00000000..8987ee1d --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetVertexDOF_test_2.F90 @@ -0,0 +1,129 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-07 +! summary: Testing GetVertexDOF method of FEDOF class +! H1 Heirarchical Second Order Triangular Mesh + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE AppendUtility +USE ArangeUtility +USE ReallocateUtility + +IMPLICIT NONE + +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri6_mesh.h5", & + baseContinuity = "H1", & + baseInterpolation = "Heirarchical", & + testname = baseContinuity//" "//baseInterpolation + +TYPE(FEDOF_) :: fedof +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +TYPE(HDF5File_) :: meshfile +INTEGER(I4B), ALLOCATABLE :: found(:), want(:) +INTEGER(I4B) :: order, totalVertexNodes, totalFaces +LOGICAL(LGT) :: isok + +CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.) + +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') +meshptr => dom%GetMeshPointer() +totalVertexNodes = meshptr%GetTotalVertexNodes() +totalFaces = meshptr%GetTotalFaces() + +CALL test1 +CALL test2 +CALL test3 + +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +!---------------------------------------------------------------------------- +! test1 +!---------------------------------------------------------------------------- + +SUBROUTINE test1 + + INTEGER(I4B) :: tsize + + order = 1 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + CALL Reallocate(found, 2, want, 2) + CALL fedof%GetVertexDOF(globalNode=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + want(1) = 1 + + isok = ALL(found == want) + CALL OK(isok, testname//" GetVertexDOF "//ToString(order)//"): ") + +END SUBROUTINE test1 + +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- + +SUBROUTINE test2 + + INTEGER(I4B) :: tsize + + order = 2 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + CALL Reallocate(found, 2, want, 2) + CALL fedof%GetVertexDOF(globalNode=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + want(1) = 1 + + isok = ALL(found == want) + CALL OK(isok, testname//" GetVertexDOF (order= "//ToString(order)//"): ") + +END SUBROUTINE test2 + +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- + +SUBROUTINE test3 + + INTEGER(I4B) :: tsize + + order = 3 + CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=meshptr) + + CALL Reallocate(found, 2, want, 2) + CALL fedof%GetVertexDOF(globalNode=1, islocal=.TRUE., & + ans=found, tsize=tsize) + + want(1) = 1 + + isok = ALL(found == want) + CALL OK(isok, testname//" GetVertexDOF (order= "//ToString(order)//"): ") + +END SUBROUTINE test3 + +!---------------------------------------------------------------------------- +! +!---------------------------------------------------------------------------- + +END PROGRAM main diff --git a/docs/docs-api/FEDOF/examples/_GetVertexDOF_test_2.md b/docs/docs-api/FEDOF/examples/_GetVertexDOF_test_2.md new file mode 100644 index 00000000..7beb0839 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_GetVertexDOF_test_2.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_GetVertexDOF_test_2.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/FEDOF/examples/_Initiate_test_1.F90 b/docs/docs-api/FEDOF/examples/_Initiate_test_1.F90 index c8120380..70e141cb 100644 --- a/docs/docs-api/FEDOF/examples/_Initiate_test_1.F90 +++ b/docs/docs-api/FEDOF/examples/_Initiate_test_1.F90 @@ -1,3 +1,8 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-06 +! summary: Test the intitiate method for H1, Heirarchical basis, +! for different orders. + PROGRAM main USE FEDOF_Class USE FEDomain_Class @@ -14,7 +19,7 @@ PROGRAM main TYPE(FEDomain_) :: dom CLASS(AbstractMesh_), POINTER :: meshptr => NULL() CHARACTER(*), PARAMETER :: filename = & - "../../Mesh/examples/meshdata/small_mesh.h5" + "../../FEMesh/examples/meshdata/small_tri3_mesh.h5" TYPE(HDF5File_) :: meshfile INTEGER(I4B) :: found, want diff --git a/docs/docs-api/FEDOF/examples/_Initiate_test_2.F90 b/docs/docs-api/FEDOF/examples/_Initiate_test_2.F90 index 7ed3c42c..b7b3b2e7 100644 --- a/docs/docs-api/FEDOF/examples/_Initiate_test_2.F90 +++ b/docs/docs-api/FEDOF/examples/_Initiate_test_2.F90 @@ -18,45 +18,56 @@ PROGRAM main TYPE(FEDOF_) :: fedof TYPE(FEDomain_) :: dom CLASS(AbstractMesh_), POINTER :: meshptr => NULL() -CHARACTER(*), PARAMETER :: filename = & - "../../FEMesh/examples/meshdata/small_tri3_mesh.h5" +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri3_mesh.h5", & + baseInterpolation = "Hierarchical", & + baseContinuity = "H1" + TYPE(HDF5File_) :: meshfile INTEGER(I4B) :: found, want INTEGER(I4B), ALLOCATABLE :: cellOrder(:) -CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.) +CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.) CALL meshfile%Initiate(filename, mode="READ") CALL meshfile%OPEN() CALL dom%Initiate(meshfile, '') meshptr => dom%GetMeshPointer() +! CALL meshptr%DisplayMeshInfo("Mesh Info:") + CALL Reallocate(cellOrder, meshptr%GetTotalCells()) cellOrder = 1 -CALL fedof%Initiate(baseContinuity="H1", baseInterpolation="Heirarchical", & - order=cellOrder, mesh=meshptr) -!CALL fedof%Display("FEDOF:") +CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=cellOrder, mesh=meshptr, islocal=.TRUE.) +! CALL fedof%Display("FEDOF:") found = fedof%GetTotalDOF() want = meshptr%GetTotalNodes() CALL IS(found, want, "Total DOF (order=1): ") cellOrder = 2 -CALL fedof%Initiate(baseContinuity="H1", baseInterpolation="Heirarchical", & - order=cellOrder, mesh=meshptr) +CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=cellOrder, mesh=meshptr, islocal=.TRUE.) + found = fedof%GetTotalDOF() want = meshptr%GetTotalNodes() + meshptr%GetTotalFaces() CALL IS(found, want, "Total DOF (order=2): ") cellOrder = 3 -CALL fedof%Initiate(baseContinuity="H1", baseInterpolation="Heirarchical", & - order=cellOrder, mesh=meshptr) +CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=cellOrder, mesh=meshptr, islocal=.TRUE.) + found = fedof%GetTotalDOF() want = meshptr%GetTotalNodes() + 2*meshptr%GetTotalFaces() + meshptr%GetTotalCells() CALL IS(found, want, "Total DOF (order=3): ") cellOrder = 4 -CALL fedof%Initiate(baseContinuity="H1", baseInterpolation="Heirarchical", & - order=cellOrder, mesh=meshptr) +CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=cellOrder, mesh=meshptr, islocal=.TRUE.) found = fedof%GetTotalDOF() want = meshptr%GetTotalNodes() + 3*meshptr%GetTotalFaces() + 3*meshptr%GetTotalCells() CALL IS(found, want, "Total DOF (order=4): ") diff --git a/docs/docs-api/FEDOF/examples/_Initiate_test_3.F90 b/docs/docs-api/FEDOF/examples/_Initiate_test_3.F90 index 1a486add..d5155f29 100644 --- a/docs/docs-api/FEDOF/examples/_Initiate_test_3.F90 +++ b/docs/docs-api/FEDOF/examples/_Initiate_test_3.F90 @@ -1,5 +1,5 @@ !> author: Vikas Sharma, Ph. D. -! date: +! date: 2025-06-06 ! summary: Initiate fedof with H1 and Heirarchical bases, order is a vector. PROGRAM main @@ -18,8 +18,10 @@ PROGRAM main TYPE(FEDOF_) :: fedof TYPE(FEDomain_) :: dom CLASS(AbstractMesh_), POINTER :: meshptr => NULL() -CHARACTER(*), PARAMETER :: filename = & - "../../FEMesh/examples/meshdata/small_tri3_mesh.h5" +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri3_mesh.h5", & + baseInterpolation = "Hierarchical", & + baseContinuity = "H1" TYPE(HDF5File_) :: meshfile LOGICAL(LGT) :: isok INTEGER(I4B) :: found, want, order, ii, iel @@ -63,17 +65,15 @@ PROGRAM main cellOrder(ii) = order END DO -CALL fedof%Initiate(baseContinuity="H1", baseInterpolation="Heirarchical", & - order=cellOrder, mesh=meshptr) +CALL fedof%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=cellOrder, mesh=meshptr, islocal=.TRUE.) found = fedof%GetTotalDOF() want = 39 isok = found == want CALL OK(isok, "Total DOF ") IF (.NOT. isok) CALL Display([found, want], "found, want: ") -CALL Display(fedof%GetConnectivity(globalElement=13, islocal=.FALSE., opt="A"), & - "connectivity of global element 13", full=.TRUE.) - CALL dom%DEALLOCATE() CALL meshfile%DEALLOCATE() diff --git a/docs/docs-api/FEDOF/examples/_Initiate_test_5.F90 b/docs/docs-api/FEDOF/examples/_Initiate_test_5.F90 index ae0b32f0..0a561c59 100644 --- a/docs/docs-api/FEDOF/examples/_Initiate_test_5.F90 +++ b/docs/docs-api/FEDOF/examples/_Initiate_test_5.F90 @@ -18,8 +18,8 @@ PROGRAM main TYPE(FEDOF_) :: fedof TYPE(FEDomain_) :: dom CLASS(AbstractMesh_), POINTER :: meshptr => NULL() -CHARACTER(*), PARAMETER :: filename = & - "../../FEMesh/examples/meshdata/small_tri6_mesh.h5" +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri6_mesh.h5" TYPE(HDF5File_) :: meshfile INTEGER(I4B) :: found, want INTEGER(I4B), PARAMETER :: order = 2, ipType = poly%monomial @@ -35,8 +35,8 @@ PROGRAM main CALL fedof%Initiate(baseContinuity=baseContinuity, ipType=ipType, & baseInterpolation=baseInterpolation, & - order=order, & - mesh=meshptr) + order=order, mesh=meshptr) + !CALL fedof%Display("FEDOF:") found = fedof%GetTotalDOF() want = meshptr%GetTotalNodes() diff --git a/docs/docs-api/FEDOF/examples/_Initiate_test_6.F90 b/docs/docs-api/FEDOF/examples/_Initiate_test_6.F90 index 493fd8dc..1ea685c0 100644 --- a/docs/docs-api/FEDOF/examples/_Initiate_test_6.F90 +++ b/docs/docs-api/FEDOF/examples/_Initiate_test_6.F90 @@ -18,8 +18,8 @@ PROGRAM main TYPE(FEDOF_) :: fedof TYPE(FEDomain_) :: dom CLASS(AbstractMesh_), POINTER :: meshptr => NULL() -CHARACTER(*), PARAMETER :: filename = & - "../../FEMesh/examples/meshdata/small_tri3_mesh.h5" +CHARACTER(*), PARAMETER :: & + filename = "../../FEMesh/examples/meshdata/small_tri3_mesh.h5" TYPE(HDF5File_) :: meshfile LOGICAL(LGT) :: isok INTEGER(I4B) :: found, want, order, ii, iel @@ -53,8 +53,8 @@ PROGRAM main CALL fedof%Initiate(baseContinuity=baseContinuity, & baseInterpolation=baseInterpolation, & - order=cellOrder, & - mesh=meshptr) + order=cellOrder, mesh=meshptr) + found = fedof%GetTotalDOF() want = 39 isok = found == want diff --git a/docs/docs-api/FEDOF/examples/_Lagrange_test_1.F90 b/docs/docs-api/FEDOF/examples/_Lagrange_test_1.F90 index 7b29e29b..71226b5f 100644 --- a/docs/docs-api/FEDOF/examples/_Lagrange_test_1.F90 +++ b/docs/docs-api/FEDOF/examples/_Lagrange_test_1.F90 @@ -1,4 +1,4 @@ -!> author: Vikas Sharma, Ph. D. +!f author: Vikas Sharma, Ph. D. ! date: 2024-05-24 ! summary: Lagrange polynomial is tested in this example @@ -11,7 +11,7 @@ PROGRAM main USE GlobalData USE Test_Method USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION -use BaseType, only: poly=>TypePolynomialOpt +USE BaseType, ONLY: poly => TypePolynomialOpt IMPLICIT NONE @@ -22,8 +22,8 @@ PROGRAM main "../../FEMesh/examples/meshdata/small_tri3_mesh.h5" TYPE(HDF5File_) :: meshfile -INTEGER(I4B) :: found, want -INTEGER(I4B), PARAMETER :: order = 2, ipType = poly%monomial +INTEGER(I4B) :: found, want, entities(4), totalVertexNodes +INTEGER(I4B), PARAMETER :: order = 1, ipType = poly%monomial CHARACTER(*), PARAMETER :: baseContinuity = "H1" CHARACTER(*), PARAMETER :: baseInterpolation = "Lagrange" @@ -35,14 +35,35 @@ PROGRAM main meshptr => dom%GetMeshPointer() CALL fedof%Initiate(baseContinuity=baseContinuity, ipType=ipType, & - baseInterpolation=baseInterpolation, order=order, mesh=meshptr) -CALL fedof%Display("FEDOF:") + baseInterpolation=baseInterpolation, order=order, & + mesh=meshptr) + +! CALL fedof%Display("FEDOF:") +entities = meshptr%GetTotalEntities() +CALL Display(entities, "Total entities in mesh: ") + found = fedof%GetTotalDOF() -want = meshptr%GetTotalNodes() -CALL IS(found, want, "Total DOF (order=2): ") + +IF (order .EQ. 1) THEN + + want = meshptr%GetTotalVertexNodes() + +ELSE + + want = meshptr%GetTotalVertexNodes() + & + entities(3) * (order - 1) + & + entities(4) * (order - 2) * (order - 1) / 2 + +END IF + +CALL IS(found, want, "Total DOF (order= "//tostring(order)//"): ") !CALL dom%Display("domain:") CALL dom%DEALLOCATE() CALL meshfile%DEALLOCATE() END PROGRAM main + +! Total vertex = 12 +! Total edges = 25 +! Total elements = 14 diff --git a/docs/docs-api/FEDOF/examples/_Lagrange_test_2.F90 b/docs/docs-api/FEDOF/examples/_Lagrange_test_2.F90 new file mode 100644 index 00000000..559f4d53 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_Lagrange_test_2.F90 @@ -0,0 +1,69 @@ +!f author: Vikas Sharma, Ph. D. +! date: 2024-05-24 +! summary: Lagrange polynomial is tested in this example + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE BaseType, ONLY: poly => TypePolynomialOpt + +IMPLICIT NONE + +TYPE(FEDOF_) :: fedof +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +CHARACTER(*), PARAMETER :: filename = & + "../../FEMesh/examples/meshdata/small_tri3_mesh.h5" + +TYPE(HDF5File_) :: meshfile +INTEGER(I4B) :: found, want, entities(4), totalVertexNodes +INTEGER(I4B), PARAMETER :: order = 2, ipType = poly%monomial +CHARACTER(*), PARAMETER :: baseContinuity = "H1" +CHARACTER(*), PARAMETER :: baseInterpolation = "Lagrange" + +CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.) +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') + +meshptr => dom%GetMeshPointer() + +CALL fedof%Initiate(baseContinuity=baseContinuity, ipType=ipType, & + baseInterpolation=baseInterpolation, order=order, & + mesh=meshptr) + +! CALL fedof%Display("FEDOF:") +entities = meshptr%GetTotalEntities() +CALL Display(entities, "Total entities in mesh: ") + +found = fedof%GetTotalDOF() + +IF (order .EQ. 1) THEN + + want = meshptr%GetTotalVertexNodes() + +ELSE + + want = meshptr%GetTotalVertexNodes() + & + entities(3) * (order - 1) + & + entities(4) * (order - 2) * (order - 1) / 2 + +END IF + +CALL IS(found, want, "Total DOF (order= "//tostring(order)//"): ") + +!CALL dom%Display("domain:") +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +END PROGRAM main + +! Total vertex = 12 +! Total edges = 25 +! Total elements = 14 diff --git a/docs/docs-api/FEDOF/examples/_Lagrange_test_3.F90 b/docs/docs-api/FEDOF/examples/_Lagrange_test_3.F90 new file mode 100644 index 00000000..f3e98ad1 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_Lagrange_test_3.F90 @@ -0,0 +1,69 @@ +!f author: Vikas Sharma, Ph. D. +! date: 2024-05-24 +! summary: Lagrange polynomial is tested in this example + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE BaseType, ONLY: poly => TypePolynomialOpt + +IMPLICIT NONE + +TYPE(FEDOF_) :: fedof +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +CHARACTER(*), PARAMETER :: filename = & + "../../FEMesh/examples/meshdata/small_tri3_mesh.h5" + +TYPE(HDF5File_) :: meshfile +INTEGER(I4B) :: found, want, entities(4), totalVertexNodes +INTEGER(I4B), PARAMETER :: order = 3, ipType = poly%monomial +CHARACTER(*), PARAMETER :: baseContinuity = "H1" +CHARACTER(*), PARAMETER :: baseInterpolation = "Lagrange" + +CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.) +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') + +meshptr => dom%GetMeshPointer() + +CALL fedof%Initiate(baseContinuity=baseContinuity, ipType=ipType, & + baseInterpolation=baseInterpolation, order=order, & + mesh=meshptr) + +! CALL fedof%Display("FEDOF:") +entities = meshptr%GetTotalEntities() +CALL Display(entities, "Total entities in mesh: ") + +found = fedof%GetTotalDOF() + +IF (order .EQ. 1) THEN + + want = meshptr%GetTotalVertexNodes() + +ELSE + + want = meshptr%GetTotalVertexNodes() + & + entities(3) * (order - 1) + & + entities(4) * (order - 2) * (order - 1) / 2 + +END IF + +CALL IS(found, want, "Total DOF (order= "//tostring(order)//"): ") + +!CALL dom%Display("domain:") +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +END PROGRAM main + +! Total vertex = 12 +! Total edges = 25 +! Total elements = 14 diff --git a/docs/docs-api/FEDOF/examples/_Lagrange_test_4.F90 b/docs/docs-api/FEDOF/examples/_Lagrange_test_4.F90 new file mode 100644 index 00000000..f78f8855 --- /dev/null +++ b/docs/docs-api/FEDOF/examples/_Lagrange_test_4.F90 @@ -0,0 +1,71 @@ +!f author: Vikas Sharma, Ph. D. +! date: 2024-05-24 +! summary: Lagrange polynomial is tested in this example +! I am checking the totalDOF for a fedof of order 4 on +! a linear mesh. + +PROGRAM main +USE FEDOF_Class +USE FEDomain_Class +USE AbstractMesh_Class +USE HDF5File_Class +USE Display_Method +USE GlobalData +USE Test_Method +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION +USE BaseType, ONLY: poly => TypePolynomialOpt + +IMPLICIT NONE + +TYPE(FEDOF_) :: fedof +TYPE(FEDomain_) :: dom +CLASS(AbstractMesh_), POINTER :: meshptr => NULL() +CHARACTER(*), PARAMETER :: filename = & + "../../FEMesh/examples/meshdata/small_tri3_mesh.h5" + +TYPE(HDF5File_) :: meshfile +INTEGER(I4B) :: found, want, entities(4), totalVertexNodes +INTEGER(I4B), PARAMETER :: order = 4, ipType = poly%monomial +CHARACTER(*), PARAMETER :: baseContinuity = "H1" +CHARACTER(*), PARAMETER :: baseInterpolation = "Lagrange" + +CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.) +CALL meshfile%Initiate(filename, mode="READ") +CALL meshfile%OPEN() +CALL dom%Initiate(meshfile, '') + +meshptr => dom%GetMeshPointer() + +CALL fedof%Initiate(baseContinuity=baseContinuity, ipType=ipType, & + baseInterpolation=baseInterpolation, order=order, & + mesh=meshptr) + +! CALL fedof%Display("FEDOF:") +entities = meshptr%GetTotalEntities() +CALL Display(entities, "Total entities in mesh: ") + +found = fedof%GetTotalDOF() + +IF (order .EQ. 1) THEN + + want = meshptr%GetTotalVertexNodes() + +ELSE + + want = meshptr%GetTotalVertexNodes() + & + entities(3) * (order - 1) + & + entities(4) * (order - 2) * (order - 1) / 2 + +END IF + +CALL IS(found, want, "Total DOF (order= "//tostring(order)//"): ") + +!CALL dom%Display("domain:") +CALL dom%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +END PROGRAM main + +! Total vertex = 12 +! Total edges = 25 +! Total elements = 14 diff --git a/docs/docs-api/FEDOF/examples/_SetSparsity_test_1.F90 b/docs/docs-api/FEDOF/examples/_SetSparsity_test_1.F90 index 3e49a8df..1ce46a9b 100644 --- a/docs/docs-api/FEDOF/examples/_SetSparsity_test_1.F90 +++ b/docs/docs-api/FEDOF/examples/_SetSparsity_test_1.F90 @@ -1,3 +1,7 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-10 +! summary: Testing SetSparsity method of FEDOF class. + PROGRAM main USE FEDOF_Class USE FEMesh_Class @@ -6,7 +10,7 @@ PROGRAM main USE Display_Method USE GlobalData USE Test_Method -USE ExceptionHandler_Class +USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION USE BaseType USE DOF_Method USE CSRMatrix_Method @@ -15,14 +19,15 @@ PROGRAM main IMPLICIT NONE CHARACTER(*), PARAMETER :: filename = & - "../../Mesh/examples/meshdata/very_small_quad4_mesh.h5" + "../../FEMesh/examples/meshdata/very_small_quad4_mesh.h5" CHARACTER(*), PARAMETER :: baseContinuity = "H1", & - baseInterpolation = "Heirarchical" + baseInterpolation = "Heirarchical", & + testname = baseContinuity//" "//baseInterpolation//" SetSparsity " -INTEGER(I4B), PARAMETER :: order = 1, nsd = 2 +INTEGER(I4B), PARAMETER :: nsd = 2 -INTEGER(I4B) :: ii, jj +INTEGER(I4B) :: ii, jj, order TYPE(CSRMatrix_) :: mat TYPE(DOF_) :: dofobj @@ -32,60 +37,145 @@ PROGRAM main REAL(DFP), ALLOCATABLE :: found(:, :), want(:, :) LOGICAL(LGT) :: isok +CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.) + CALL meshfile%Initiate(filename, mode="READ") CALL meshfile%OPEN() - CALL mesh%Initiate(meshfile, dim=nsd) -CALL mesh%DisplayMeshInfo("mesh info:") +CALL test1 +CALL test2 + +!CALL mesh%Display("domain:") +CALL mesh%DEALLOCATE() +CALL meshfile%DEALLOCATE() + +CONTAINS + +SUBROUTINE test1 + + order = 1 + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=mesh) + + CALL Initiate(obj=dofobj, tNodes=[obj%GetTotalDOF()], & + names=['K'], spaceCompo=[1], timeCompo=[1], & + storageFMT=NODES_FMT) + + CALL Initiate(mat, ncol=SIZE(dofobj), nrow=SIZE(dofobj), & + idof=dofobj, jdof=dofobj) + + CALL obj%SetSparsity(mat=mat) + + !! setting all entries to 1.0 + mat = 1.0_DFP + + !! converting sparse matrix to dense matrix + !! for testing + found = mat + + ALLOCATE (want(9, 9)) + want = 0.0_DFP + + want(1, [1, 5, 7, 9]) = 1.0_DFP + want(2, [2, 5, 8, 9]) = 1.0_DFP + want(3, [3, 6, 7, 9]) = 1.0_DFP + want(4, [4, 6, 8, 9]) = 1.0_DFP + want(5, [5, 1, 2, 7, 8, 9]) = 1.0_DFP + want(6, [6, 3, 4, 7, 8, 9]) = 1.0_DFP + want(7, [7, 1, 3, 5, 6, 9]) = 1.0_DFP + want(8, [8, 2, 4, 5, 6, 9]) = 1.0_DFP + want(9, [9, 1, 2, 3, 4, 5, 6, 7, 8]) = 1.0_DFP + + do_jj: DO jj = 1, SIZE(want, 2) + DO ii = 1, SIZE(want, 1) + isok = found(ii, jj) .EQ. want(ii, jj) + IF (.NOT. isok) THEN + CALL Display([ii, jj], "ii, jj: ") + EXIT do_jj + + END IF + END DO + END DO do_jj -CALL obj%Initiate(baseContinuity=baseContinuity, & - baseInterpolation=baseInterpolation, & - order=order, mesh=mesh) + CALL OK(isok, testname//" test1") -CALL Initiate(obj=dofobj, tNodes=[obj%GetTotalDOF()], & - names=['K'], spaceCompo=[1], timeCompo=[1], & - storageFMT=NODES_FMT) +END SUBROUTINE test1 -CALL Initiate(mat, ncol=SIZE(dofobj), nrow=SIZE(dofobj), & - idof=dofobj, jdof=dofobj) +!---------------------------------------------------------------------------- +! test2 +!---------------------------------------------------------------------------- -CALL obj%SetSparsity(mat=mat) +SUBROUTINE test2 -mat = 1.0_DFP + order = 2 -found = mat + CALL obj%Initiate(baseContinuity=baseContinuity, & + baseInterpolation=baseInterpolation, & + order=order, mesh=mesh) -ALLOCATE (want(9, 9)) -want = 0.0_DFP + CALL Initiate(obj=dofobj, tNodes=[obj%GetTotalDOF()], & + names=['K'], spaceCompo=[1], timeCompo=[1], & + storageFMT=NODES_FMT) -want(1, [1, 5, 7, 9]) = 1.0_DFP -want(2, [2, 5, 8, 9]) = 1.0_DFP -want(3, [3, 6, 7, 9]) = 1.0_DFP -want(4, [4, 6, 8, 9]) = 1.0_DFP -want(5, [5, 1, 2, 7, 8, 9]) = 1.0_DFP -want(6, [6, 3, 4, 7, 8, 9]) = 1.0_DFP -want(7, [7, 1, 3, 5, 6, 9]) = 1.0_DFP -want(8, [8, 2, 4, 5, 6, 9]) = 1.0_DFP -want(9, [9, 1, 2, 3, 4, 5, 6, 7, 8]) = 1.0_DFP + CALL Initiate(mat, ncol=SIZE(dofobj), nrow=SIZE(dofobj), & + idof=dofobj, jdof=dofobj) -do_jj: DO jj = 1, SIZE(want, 2) - DO ii = 1, SIZE(want, 1) + CALL obj%SetSparsity(mat=mat) + + mat = 1.0_DFP + + found = mat + + want = found + want = 0.0_DFP + + want(1, [1, 5, 7, 9, 10, 11, 12, 13, 22]) = 1.0_DFP + ii = 1 + DO jj = 1, SIZE(want, 2) isok = found(ii, jj) .EQ. want(ii, jj) IF (.NOT. isok) THEN CALL Display([ii, jj], "ii, jj: ") - EXIT do_jj + EXIT + END IF + END DO + + CALL OK(isok, testname//" test2") + want(5, [5, 1, 2, 7, 8, 9, 10, 11, 12, 13, 22, 17, 18, 19, 24]) = 1.0_DFP + ii = 5 + DO jj = 1, SIZE(want, 2) + isok = found(ii, jj) .EQ. want(ii, jj) + IF (.NOT. isok) THEN + CALL Display([ii, jj], "ii, jj: ") + EXIT END IF END DO -END DO do_jj + CALL OK(isok, testname//" test2") -CALL OK(isok, "CSRMatrix_Method: SetSparsity") + want(11, [11, 1, 2, 5, 7, 8, 9, 10, 12, 13, 22, 17, 18, 19, 24]) = 1.0_DFP + ii = 11 + DO jj = 1, SIZE(want, 2) + isok = found(ii, jj) .EQ. want(ii, jj) + IF (.NOT. isok) THEN + CALL Display([ii, jj], "ii, jj: ") + EXIT + END IF + END DO + CALL OK(isok, testname//" test2") -! CALL Display(mat, "sparse matrix:") +END SUBROUTINE test2 -!CALL mesh%Display("domain:") -CALL mesh%DEALLOCATE() -CALL meshfile%DEALLOCATE() +!---------------------------------------------------------------------------- +! test3 +!---------------------------------------------------------------------------- END PROGRAM main + +! mesh info: +! ============================== +! total nodes: 9 +! total elements: 4 +! tEdges: 0 +! tFaces: 12 diff --git a/docs/docs-api/FEDOF/examples/_SetSparsity_test_2.F90 b/docs/docs-api/FEDOF/examples/_SetSparsity_test_2.F90 index 76fc4229..2c75318b 100644 --- a/docs/docs-api/FEDOF/examples/_SetSparsity_test_2.F90 +++ b/docs/docs-api/FEDOF/examples/_SetSparsity_test_2.F90 @@ -1,3 +1,7 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-10 +! summary: This subroutine tests the SetSparsity method of the FEDOF class. + PROGRAM main USE FEDOF_Class USE FEMesh_Class @@ -15,7 +19,7 @@ PROGRAM main IMPLICIT NONE CHARACTER(*), PARAMETER :: filename = & - "../../Mesh/examples/meshdata/very_small_quad4_mesh.h5" + "../../FEMesh/examples/meshdata/very_small_quad4_mesh.h5" CHARACTER(*), PARAMETER :: baseContinuity = "H1", & baseInterpolation = "Heirarchical" diff --git a/docs/docs-api/FEDOF/index.md b/docs/docs-api/FEDOF/index.md index a72a4541..6ffab69f 100644 --- a/docs/docs-api/FEDOF/index.md +++ b/docs/docs-api/FEDOF/index.md @@ -28,25 +28,15 @@ The basic steps of using this data type is given below. ### Constructor methods -There are several ways to initiate an instance of `FEDOF`. +Although, there are several ways to initiate an instance of `FEDOF`. The most common way is to call the [`Initiate`](./Initiate.md) method. ```fortran -CALL obj%Initiate(order, mesh, baseContinuity, baseInterpolation, ipType, basisType, alpha, beta, lambda) +CALL obj%Initiate(order, mesh, baseContinuity, baseInterpolation, ipType, basisType, alpha, beta, lambda, islocal) ``` -- Here `order` represents the order of each element. It can be a scalar, vector, or a two dimensional matrix of integers. [The method with scalar order is given here.](./Initiate.md#interface-1) - -:::tip Order is a vector -When `order` is a vector of integer then it represents the order of each cell element. [This method is discussed here](./Initiate.md#interface-2). In this case, the length of `order` must be equal to the number of elements in the mesh. -::: - -:::tip Order is a matrix -When order is a matrix of integer then the first row represents the global number of cell element, and the second row represents the order of cell element. [This method is given here](./Initiate.md#interface-4) -::: - -:::info -Read more about [Initiate](./Initiate.md) method. -::: +- Here `order` represents the order of each element. It can be a scalar, vector, or a two dimensional matrix of integers. [The method with scalar order is given here.](./Initiate.md) + - When `order` is a vector of integer then it represents the order of each cell element. In this case, the length of `order` must be equal to the number of elements in the mesh. + - When `order` is a matrix of integer then the first row represents the global number of cell element, and the second row represents the order of cell element. You can also initiate an instance of `FEDOF` using [ParameterList](/docs/docs-api/ParameterList/index.md). The process is given below. @@ -57,47 +47,60 @@ You can also initiate an instance of `FEDOF` using [ParameterList](/docs/docs-ap CALL obj%Initiate(param, mesh) ``` -### Get methods - -#### Get the upper bound for connectivity matrix - -```fortran -ans = obj%GetMaxTotalConnectivty() -``` - -#### Get order of cell element - -```fortran -CALL obj%GetCellOrder(cellOrder, tCellOrder) -``` - -#### Get quadrature points - -```fortran -CALL obj%GetQuadraturePoints(quad, globalElement, islocal, quadratureType, order) -``` - -#### Getting the shape data - -Getting the local element shape data. - -```fortran -CALL obj%GetLocalElemShapeData(globalElement, isLocal, quad, elemsd) -``` - -Getting the global element shape data. - -```fortran -CALL obj%GetGlobalElemShapeData(globalElement, isLocal, xij, elemsd) -``` +| Method | Description | +| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| [`Initiate`](./Initiate.md) | Initializes a FEDOF (Finite Element Degrees of Freedom) object with various options for element order specification | +| [`SetFEDOFParam`](./SetFEDOFParam.md) | Sets essential parameters for constructing a FEDOF object in a parameter list | +| [`Copy` / `ASSIGNMENT(=)`](./Copy.md) | Copies the contents of one FEDOF object to another | +| [`DEALLOCATE`](./Copy.md) | Deallocates all data and resources used by a FEDOF object | -#### Getting the connectivity +These constructor methods handle the creation, initialization, and cleanup of FEDOF objects, which represent the degrees of freedom for finite element calculations. -Getting the local element connectivity. +### Get methods -```fortran -CALL obj%GetConnectivity_(globalElement, isLocal, ans, tsize, opt) -``` +The following table provides an overview of all methods defined in the GetMethods submodule of the FEDOF_Class. + +| Method Name | Purpose | +| --------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| [`GetCaseName`](./GetCaseName.md) | Gets the case name of FEDOF (combines baseContinuity and baseInterpolation) | +| [`GetVertexDOF`](./GetVertexDOF.md) | Retrieves the degrees of freedom associated with a vertex/node | +| [`GetEdgeDOF`](./GetEdgeDOF.md) | Retrieves the degrees of freedom associated with an edge | +| [`GetTotalEdgeDOF`](./GetTotalEdgeDOF.md) | Returns the total number of degrees of freedom on an edge | +| [`GetFaceDOF`](./GetFaceDOF.md) | Retrieves the degrees of freedom associated with a face | +| [`GetTotalFaceDOF`](./GetTotalFaceDOF.md) | Returns the total number of degrees of freedom on a face | +| [`GetCellDOF`](./GetCellDOF.md) | Retrieves the degrees of freedom associated with a cell | +| [`GetTotalCellDOF`](./GetTotalCellDOF.md) | Returns the total number of degrees of freedom on a cell | +| [`GetTotalVertexDOF`](./GetTotalVertexDOF.md) | Returns the total number of vertex degrees of freedom | +| [`GetTotalDOF`](./GetTotalDOF.md) | Returns the total number of degrees of freedom (in the entire mesh, an element, or filtered by type) | +| [`GetConnectivity`](./GetConnectivity.md) | Returns the connectivity array for an element | +| [`GetConnectivity_`](./GetConnectivity_.md) | Internal method for writing connectivity information into a provided array | +| [`GetPrefix`](./GetPrefix.md) | Returns the prefix used for setting data ("FEDOF") | +| [`GetMeshPointer`](./GetMeshPointer.md) | Returns a pointer to the associated mesh object | +| [`GetBaseInterpolation`](./GetBaseInterpolation.md) | Returns the base interpolation type used | +| [`GetCellOrder`](./GetCellOrder.md) | Retrieves the polynomial order of a cell | +| [`GetOrders`](./GetOrders.md) | Gets the cell, face, and edge orders and their orientations | +| [`GetMaxTotalConnectivity`](./GetMaxTotalConnectivity.md) | Returns the maximum size of connectivity across all elements | +| [`GetQuadraturePoints`](./GetQuadraturePoints.md) | Creates quadrature points for numerical integration | +| [`GetLocalElemShapeData`](./GetLocalElemShapeData.md) | Retrieves local element shape functions data | +| [`GetGlobalElemShapeData`](./GetGlobalElemShapeData.md) | Maps local shape functions to the global coordinate system | + +### IO Methods + +| Method | Description | +| --------------------------------------- | ------------------------------------------------------------------------------------------------------- | +| `Display` | Displays the content of a FEDOF object including configuration, mesh information, and allocation status | +| `DisplayCellOrder` | Displays information about the cell order array and its contents | +| [`ImportFromToml`](./ImportFromToml.md) | Imports FEDOF configuration from a TOML file or table | + +These IO methods provide functionality for: + +- Displaying the state and configuration of a FEDOF object for debugging and information purposes +- Reading configuration from standardized TOML format files or tables +- Visualizing specific aspects of the FEDOF configuration like cell orders + +## Setting sparsity + +The sparsity of the FEDOF object can be set using the [`SetSparsity`](./SetSparsity.md) method. This method allows you to define how the degrees of freedom are organized and accessed, which can optimize performance for specific applications. ## Methods diff --git a/docs/docs-api/FEMesh/GetTotalNodes.md b/docs/docs-api/FEMesh/GetTotalNodes.md index c204d085..ee75470e 100644 --- a/docs/docs-api/FEMesh/GetTotalNodes.md +++ b/docs/docs-api/FEMesh/GetTotalNodes.md @@ -9,3 +9,21 @@ This method is inherited from the [AbstractMesh](../AbstractMesh/AbstractMesh_.m import EXAMPLE5 from "../AbstractMesh/GetTotalNodes.md"; + +## Example 1 + +import EXAMPLE15 from "./examples/_GetTotalNodes_test_1.md"; + + + +## Example 2 + +import EXAMPLE25 from "./examples/_GetTotalNodes_test_2.md"; + + + +## Example 3 + +import EXAMPLE35 from "./examples/_GetTotalNodes_test_3.md"; + + diff --git a/docs/docs-api/FEMesh/MeshUsedInExamples.md b/docs/docs-api/FEMesh/MeshUsedInExamples.md new file mode 100644 index 00000000..cb201aeb --- /dev/null +++ b/docs/docs-api/FEMesh/MeshUsedInExamples.md @@ -0,0 +1,38 @@ +--- +sidebar_position: 2 +--- + +# Meshes used in examples + +## Small Tri3 Mesh + +| filename | `small_tri3_mesh` | +| -------------- | ----------------- | +| total Nodes | 12 | +| Total Elements | 14 | +| Total Edges | NA | +| Total Faces | 25 | + +![Small Tri3 Mesh](/img/blog/small_tri3_mesh.svg) + +## Small Tri6 Mesh + +| filename | `small_tri6_mesh` | +| -------------- | ----------------- | +| total Nodes | 37 | +| Total Elements | 14 | +| Total Edges | NA | +| Total Faces | 25 | + +![Small Tri6 Mesh](/img/blog/small_tri6_mesh.svg) + +## Very Small Quad4 Mesh + +| filename | `very_small_quad4_mesh` | +| -------------- | ----------------------- | +| total Nodes | 37 | +| Total Elements | 14 | +| Total Edges | NA | +| Total Faces | 25 | + +![Small Tri6 Mesh](/img/blog/very_small_quad4_mesh.svg) diff --git a/docs/docs-api/FEMesh/SetSparsity.md b/docs/docs-api/FEMesh/SetSparsity.md index e95d840d..b22c0d20 100644 --- a/docs/docs-api/FEMesh/SetSparsity.md +++ b/docs/docs-api/FEMesh/SetSparsity.md @@ -9,3 +9,9 @@ This method is inherited from the [AbstractMesh](../AbstractMesh/AbstractMesh_.m import EXAMPLE5 from "../AbstractMesh/SetSparsity.md"; + +## Example 1 + +import EXAMPLE15 from "./examples/_SetSparsity_test_1.md"; + + diff --git a/docs/docs-api/FEMesh/examples/_GetTotalEntities_test_1.F90 b/docs/docs-api/FEMesh/examples/_GetTotalEntities_test_1.F90 index 1901b07d..c410b3aa 100644 --- a/docs/docs-api/FEMesh/examples/_GetTotalEntities_test_1.F90 +++ b/docs/docs-api/FEMesh/examples/_GetTotalEntities_test_1.F90 @@ -1,3 +1,7 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-05 +! summary: Test the `GetTotalEntities` method of `FEMesh_` class. + PROGRAM main USE FEMesh_Class, ONLY: FEMesh_ USE HDF5File_Class, ONLY: HDF5File_ @@ -10,7 +14,7 @@ PROGRAM main TYPE(FEMesh_) :: obj TYPE(HDF5File_) :: meshfile -CHARACTER(LEN=*), PARAMETER :: filename = "../../Mesh/examples/meshdata/small_quad4_mesh.h5" +CHARACTER(LEN=*), PARAMETER :: filename = "./meshdata/small_tri3_mesh.h5" INTEGER(I4B), PARAMETER :: nsd = 2 INTEGER(I4B) :: ans(4) LOGICAL(LGT) :: isok @@ -46,13 +50,13 @@ PROGRAM main ans = obj%GetTotalEntities(globalElement=1, islocal=.TRUE.) CALL Display("Total entities in local element 1:") -isok = ans(1) .EQ. 4 +isok = ans(1) .EQ. 3 CALL OK(isok, "Total nodes: ") isok = ans(2) .EQ. 0 CALL OK(isok, "Total edges: ") -isok = ans(3) .EQ. 4 +isok = ans(3) .EQ. 3 CALL OK(isok, "Total faces: ") isok = ans(4) .EQ. 1 @@ -67,7 +71,3 @@ PROGRAM main CALL obj%DEALLOCATE() END PROGRAM main -! total nodes = 25 -! total elements = 16 -! total faces = 40 -! total edges = 0 diff --git a/docs/docs-api/FEMesh/examples/_GetTotalNodes_test_1.F90 b/docs/docs-api/FEMesh/examples/_GetTotalNodes_test_1.F90 index 70b4536e..613f7ee8 100644 --- a/docs/docs-api/FEMesh/examples/_GetTotalNodes_test_1.F90 +++ b/docs/docs-api/FEMesh/examples/_GetTotalNodes_test_1.F90 @@ -1,3 +1,7 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-05 +! summary: Test for `GetTotalNodes` method of `FEMesh_` class. + PROGRAM main USE FEMesh_Class, ONLY: FEMesh_ USE HDF5File_Class, ONLY: HDF5File_ @@ -10,7 +14,7 @@ PROGRAM main TYPE(FEMesh_) :: obj TYPE(HDF5File_) :: meshfile -CHARACTER(LEN=*), PARAMETER :: filename = "../../Mesh/examples/meshdata/small_quad4_mesh.h5" +CHARACTER(LEN=*), PARAMETER :: filename = "./meshdata/very_small_quad4_mesh.h5" INTEGER(I4B), PARAMETER :: nsd = 2 INTEGER(I4B) :: found(8), want(8) LOGICAL(LGT) :: isok @@ -18,17 +22,21 @@ PROGRAM main ! Initiate and open the mesh file which is in `HDF5File_` format. CALL meshfile%Initiate(FileName=filename, MODE="READ") + ! Open the mesh file CALL meshfile%OPEN() + ! Initiate an instance of `Mesh_` CALL obj%Initiate(hdf5=meshfile, dim=nsd) +CALL obj%DisplayMeshInfo("Mesh Info") + CALL meshfile%DEALLOCATE() found(1) = obj%GetTotalNodes() found(2) = obj%GetTotalNodes(meshid=1) -want(1) = 25 -want(2) = 25 +want(1) = 9 +want(2) = 9 isok = found(1) .EQ. want(1) CALL ok(isok, testname) @@ -39,7 +47,10 @@ PROGRAM main CALL obj%DEALLOCATE() END PROGRAM main -! total nodes = 25 -! total elements = 16 -! total faces = 40 -! total edges = 0 +! Mesh Info +! ============================== +! total nodes: 9 +! total elements: 4 +! tEdges: 0 +! tFaces: 12 +! ============================== diff --git a/docs/docs-api/FEMesh/examples/_GetTotalNodes_test_1.md b/docs/docs-api/FEMesh/examples/_GetTotalNodes_test_1.md new file mode 100644 index 00000000..3467fd37 --- /dev/null +++ b/docs/docs-api/FEMesh/examples/_GetTotalNodes_test_1.md @@ -0,0 +1,4 @@ +import CodeBlock from '@theme/CodeBlock'; +import MyCode from '!!raw-loader!./_GetTotalNodes_test_1.F90'; + +{MyCode} diff --git a/docs/docs-api/FEMesh/examples/_GetTotalNodes_test_2.F90 b/docs/docs-api/FEMesh/examples/_GetTotalNodes_test_2.F90 new file mode 100644 index 00000000..7b816d34 --- /dev/null +++ b/docs/docs-api/FEMesh/examples/_GetTotalNodes_test_2.F90 @@ -0,0 +1,56 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-05 +! summary: Test for `GetTotalNodes` method of `FEMesh_` class. + +PROGRAM main +USE FEMesh_Class, ONLY: FEMesh_ +USE HDF5File_Class, ONLY: HDF5File_ +USE GlobalData, ONLY: I4B, LGT, Quadrangle +USE ReallocateUtility, ONLY: Reallocate +USE Display_Method, ONLY: Display +USE Test_Method + +IMPLICIT NONE + +TYPE(FEMesh_) :: obj +TYPE(HDF5File_) :: meshfile +CHARACTER(LEN=*), PARAMETER :: filename = "./meshdata/small_tri3_mesh.h5" +INTEGER(I4B), PARAMETER :: nsd = 2 +INTEGER(I4B) :: found(8), want(8) +LOGICAL(LGT) :: isok +CHARACTER(*), PARAMETER :: testname = "GetTotalNodes" + +! Initiate and open the mesh file which is in `HDF5File_` format. +CALL meshfile%Initiate(FileName=filename, MODE="READ") + +! Open the mesh file +CALL meshfile%OPEN() + +! Initiate an instance of `Mesh_` +CALL obj%Initiate(hdf5=meshfile, dim=nsd) +CALL obj%DisplayMeshInfo("Mesh Info") + +CALL meshfile%DEALLOCATE() + +found(1) = obj%GetTotalNodes() +found(2) = obj%GetTotalNodes(meshid=1) + +want(1) = 12 +want(2) = 12 + +isok = found(1) .EQ. want(1) +CALL ok(isok, testname) + +isok = found(2) .EQ. want(2) +CALL ok(isok, testname) + +CALL obj%DEALLOCATE() +END PROGRAM main + +! Mesh Info +! ============================== +! total nodes: 12 +! total elements: 14 +! tEdges: 0 +! tFaces: 25 +! ============================== diff --git a/docs/docs-api/FEMesh/examples/_GetTotalNodes_test_2.md b/docs/docs-api/FEMesh/examples/_GetTotalNodes_test_2.md new file mode 100644 index 00000000..d47c20ef --- /dev/null +++ b/docs/docs-api/FEMesh/examples/_GetTotalNodes_test_2.md @@ -0,0 +1,4 @@ +import CodeBlock from '@theme/CodeBlock'; +import MyCode from '!!raw-loader!./_GetTotalNodes_test_2.F90'; + +{MyCode} diff --git a/docs/docs-api/FEMesh/examples/_GetTotalNodes_test_3.F90 b/docs/docs-api/FEMesh/examples/_GetTotalNodes_test_3.F90 new file mode 100644 index 00000000..a698fe98 --- /dev/null +++ b/docs/docs-api/FEMesh/examples/_GetTotalNodes_test_3.F90 @@ -0,0 +1,56 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-05 +! summary: Test for `GetTotalNodes` method of `FEMesh_` class. + +PROGRAM main +USE FEMesh_Class, ONLY: FEMesh_ +USE HDF5File_Class, ONLY: HDF5File_ +USE GlobalData, ONLY: I4B, LGT, Quadrangle +USE ReallocateUtility, ONLY: Reallocate +USE Display_Method, ONLY: Display +USE Test_Method + +IMPLICIT NONE + +TYPE(FEMesh_) :: obj +TYPE(HDF5File_) :: meshfile +CHARACTER(LEN=*), PARAMETER :: filename = "./meshdata/small_tri6_mesh.h5" +INTEGER(I4B), PARAMETER :: nsd = 2 +INTEGER(I4B) :: found(8), want(8) +LOGICAL(LGT) :: isok +CHARACTER(*), PARAMETER :: testname = "GetTotalNodes" + +! Initiate and open the mesh file which is in `HDF5File_` format. +CALL meshfile%Initiate(FileName=filename, MODE="READ") + +! Open the mesh file +CALL meshfile%OPEN() + +! Initiate an instance of `Mesh_` +CALL obj%Initiate(hdf5=meshfile, dim=nsd) +CALL obj%DisplayMeshInfo("Mesh Info") + +CALL meshfile%DEALLOCATE() + +found(1) = obj%GetTotalNodes() +found(2) = obj%GetTotalNodes(meshid=1) + +want(1) = 37 +want(2) = 37 + +isok = found(1) .EQ. want(1) +CALL ok(isok, testname) + +isok = found(2) .EQ. want(2) +CALL ok(isok, testname) + +CALL obj%DEALLOCATE() +END PROGRAM main + +! Mesh Info +! ============================== +! total nodes: 37 +! total elements: 14 +! tEdges: 0 +! tFaces: 25 +! ============================== diff --git a/docs/docs-api/FEMesh/examples/_GetTotalNodes_test_3.md b/docs/docs-api/FEMesh/examples/_GetTotalNodes_test_3.md new file mode 100644 index 00000000..35f3a893 --- /dev/null +++ b/docs/docs-api/FEMesh/examples/_GetTotalNodes_test_3.md @@ -0,0 +1,4 @@ +import CodeBlock from '@theme/CodeBlock'; +import MyCode from '!!raw-loader!./_GetTotalNodes_test_3.F90'; + +{MyCode} diff --git a/docs/docs-api/FEMesh/examples/_GetTotalVertexNodes_test_1.F90 b/docs/docs-api/FEMesh/examples/_GetTotalVertexNodes_test_1.F90 new file mode 100644 index 00000000..f953b252 --- /dev/null +++ b/docs/docs-api/FEMesh/examples/_GetTotalVertexNodes_test_1.F90 @@ -0,0 +1,56 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-05 +! summary: Test for `GetTotalVertexNodes` method of `FEMesh_` class. + +PROGRAM main +USE FEMesh_Class, ONLY: FEMesh_ +USE HDF5File_Class, ONLY: HDF5File_ +USE GlobalData, ONLY: I4B, LGT, Quadrangle +USE ReallocateUtility, ONLY: Reallocate +USE Display_Method, ONLY: Display +USE Test_Method + +IMPLICIT NONE + +TYPE(FEMesh_) :: obj +TYPE(HDF5File_) :: meshfile +CHARACTER(LEN=*), PARAMETER :: filename = "./meshdata/small_tri3_mesh.h5" +INTEGER(I4B), PARAMETER :: nsd = 2 +INTEGER(I4B) :: found(8), want(8) +LOGICAL(LGT) :: isok +CHARACTER(*), PARAMETER :: testname = "GetTotalVertexNodes" + +! Initiate and open the mesh file which is in `HDF5File_` format. +CALL meshfile%Initiate(FileName=filename, MODE="READ") + +! Open the mesh file +CALL meshfile%OPEN() + +! Initiate an instance of `Mesh_` +CALL obj%Initiate(hdf5=meshfile, dim=nsd) +CALL obj%DisplayMeshInfo("Mesh Info") + +CALL meshfile%DEALLOCATE() + +found(1) = obj%GetTotalVertexNodes() +want(1) = 12 + +found(2) = obj%GetTotalVertexNodes(meshid=1) +want(2) = 12 + +isok = found(1) .EQ. want(1) +CALL ok(isok, testname) + +isok = found(2) .EQ. want(2) +CALL ok(isok, testname) + +CALL obj%DEALLOCATE() +END PROGRAM main + +! Mesh Info +! ============================== +! total nodes: 12 +! total elements: 14 +! tEdges: 0 +! tFaces: 25 +! ============================== diff --git a/docs/docs-api/FEMesh/examples/_GetTotalVertexNodes_test_2.F90 b/docs/docs-api/FEMesh/examples/_GetTotalVertexNodes_test_2.F90 new file mode 100644 index 00000000..827c0f0b --- /dev/null +++ b/docs/docs-api/FEMesh/examples/_GetTotalVertexNodes_test_2.F90 @@ -0,0 +1,56 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-05 +! summary: Test for `GetTotalVertexNodes` method of `FEMesh_` class. + +PROGRAM main +USE FEMesh_Class, ONLY: FEMesh_ +USE HDF5File_Class, ONLY: HDF5File_ +USE GlobalData, ONLY: I4B, LGT, Quadrangle +USE ReallocateUtility, ONLY: Reallocate +USE Display_Method, ONLY: Display +USE Test_Method + +IMPLICIT NONE + +TYPE(FEMesh_) :: obj +TYPE(HDF5File_) :: meshfile +CHARACTER(LEN=*), PARAMETER :: filename = "./meshdata/small_tri6_mesh.h5" +INTEGER(I4B), PARAMETER :: nsd = 2 +INTEGER(I4B) :: found(8), want(8) +LOGICAL(LGT) :: isok +CHARACTER(*), PARAMETER :: testname = "GetTotalVertexNodes" + +! Initiate and open the mesh file which is in `HDF5File_` format. +CALL meshfile%Initiate(FileName=filename, MODE="READ") + +! Open the mesh file +CALL meshfile%OPEN() + +! Initiate an instance of `Mesh_` +CALL obj%Initiate(hdf5=meshfile, dim=nsd) +CALL obj%DisplayMeshInfo("Mesh Info") + +CALL meshfile%DEALLOCATE() + +found(1) = obj%GetTotalVertexNodes() +want(1) = 12 + +found(2) = obj%GetTotalVertexNodes(meshid=1) +want(2) = 12 + +isok = found(1) .EQ. want(1) +CALL ok(isok, testname) + +isok = found(2) .EQ. want(2) +CALL ok(isok, testname) + +CALL obj%DEALLOCATE() +END PROGRAM main + +! Mesh Info +! ============================== +! total nodes: 12 +! total elements: 14 +! tEdges: 0 +! tFaces: 25 +! ============================== diff --git a/docs/docs-api/FEMesh/examples/_SetSparsity_test_1.F90 b/docs/docs-api/FEMesh/examples/_SetSparsity_test_1.F90 index 260a456b..0dc1b17c 100644 --- a/docs/docs-api/FEMesh/examples/_SetSparsity_test_1.F90 +++ b/docs/docs-api/FEMesh/examples/_SetSparsity_test_1.F90 @@ -1,15 +1,29 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-05 +! summary: Test for SetSparsity method of FEMesh class + PROGRAM main -USE easifemBase -USE easifemClasses +USE GlobalData +USE FEMesh_Class +USE HDF5File_Class +USE BaseType, ONLY: DOF_, CSRMatrix_ +USE DOF_Method +USE CSRMatrix_Method IMPLICIT NONE TYPE(FEMesh_) :: obj TYPE(HDF5File_) :: meshfile TYPE(DOF_) :: dofobj TYPE(CSRMatrix_) :: mat +INTEGER(I4B) :: tNodes(1) + +INTEGER(I4B), PARAMETER :: spaceCompo(1) = [1], & + timeCompo(1) = [1], & + storageFMT = NODES_FMT +CHARACTER(1), PARAMETER :: names(1) = ["K"] CHARACTER(LEN=*), PARAMETER :: filename = & - & "../../Mesh/examples/meshdata/small_mesh.h5" + "./meshdata/small_tri3_mesh.h5" CALL meshfile%Initiate(FileName=filename, MODE="READ") @@ -17,14 +31,15 @@ PROGRAM main CALL obj%Initiate(hdf5=meshfile, dim=2) -CALL Initiate(obj=dofobj, tNodes=[obj%GetTotalNodes()], names=['K'], & - & spaceCompo=[1], timeCompo=[1], storageFMT=NODES_FMT) +tNodes = obj%GetTotalNodes() +CALL Initiate(obj=dofobj, tNodes=tNodes, & + spaceCompo=spaceCompo, timeCompo=timeCompo, & + names=names, storageFMT=storageFMT) CALL Initiate(mat, ncol=SIZE(dofobj), nrow=SIZE(dofobj), & idof=dofobj, jdof=dofobj) -CALL obj%SetSparsity(mat=mat, localNodeNumber=obj%local_Nptrs, & - lbound=1, ubound=obj%GetMaxNodeNumber()) +CALL obj%SetSparsity(mat=mat) CALL obj%DEALLOCATE() CALL meshfile%DEALLOCATE() diff --git a/docs/docs-api/FEMesh/examples/_SetSparsity_test_1.md b/docs/docs-api/FEMesh/examples/_SetSparsity_test_1.md new file mode 100644 index 00000000..f4a0ce0a --- /dev/null +++ b/docs/docs-api/FEMesh/examples/_SetSparsity_test_1.md @@ -0,0 +1,5 @@ +import CodeBlock from '@theme/CodeBlock'; + +import CodeSnippet from '!!raw-loader!./_SetSparsity_test_1.F90'; + +{CodeSnippet} diff --git a/docs/docs-api/InputUtility/examples/_Input_test_1.F90 b/docs/docs-api/InputUtility/examples/_Input_test_1.F90 new file mode 100644 index 00000000..930dbbc7 --- /dev/null +++ b/docs/docs-api/InputUtility/examples/_Input_test_1.F90 @@ -0,0 +1,25 @@ +!> author: Vikas Sharma, Ph. D. +! date: 2025-06-07 +! summary: Testing input utility for reading a mesh file + +PROGRAM main +USE InputUtility +USE GlobalData +USE Test_Method + +CALL test1 + +CONTAINS + +SUBROUTINE test1 + + LOGICAL(LGT) :: isok, aval + + aval = .TRUE. + isok = Input(default=.TRUE., option=aval) + + CALL OK(isok, "InputUtility") + +END SUBROUTINE test1 + +END PROGRAM main diff --git a/docs/docs-api/InputUtility/examples/runner.toml b/docs/docs-api/InputUtility/examples/runner.toml new file mode 100644 index 00000000..9d176154 --- /dev/null +++ b/docs/docs-api/InputUtility/examples/runner.toml @@ -0,0 +1,3 @@ +BuildDir = "/tmp/easifem-tests/InputUtility" +Buildtype = "Debug" +TargetLibs = ["easifemClasses"] diff --git a/docs/docs-api/MassMatrix/examples/MassMatrix_test_3.F90 b/docs/docs-api/MassMatrix/examples/MassMatrix_test_3.F90 index 9209ed7a..beb4390b 100644 --- a/docs/docs-api/MassMatrix/examples/MassMatrix_test_3.F90 +++ b/docs/docs-api/MassMatrix/examples/MassMatrix_test_3.F90 @@ -14,6 +14,7 @@ PROGRAM main ! Now we create an instance of [[ReferenceLine_]]. simplexElem = referenceline(nsd=1) + CALL simplexElem%LagrangeElement(order=orderForTest, highOrderObj=refElemForTest) CALL simplexElem%LagrangeElement(order=orderForTrial, highOrderObj=refElemForTrial) diff --git a/docs/docs-api/MassMatrix/examples/MassMatrix_test_3.md b/docs/docs-api/MassMatrix/examples/MassMatrix_test_3.md index 46292e44..d3daa624 100644 --- a/docs/docs-api/MassMatrix/examples/MassMatrix_test_3.md +++ b/docs/docs-api/MassMatrix/examples/MassMatrix_test_3.md @@ -1,6 +1,6 @@ This example shows how to USE the SUBROUTINE called `MassMatrix` to create a mass matrix in space domain. -Here, we want to DO the following. +Here, we want to DO the following. $$ \int_{\Omega } N^{I}\rho N^{J}d\Omega @@ -15,4 +15,3 @@ $$ $$ This TYPE of mass matrix is useful when $rho$ is a constant. - diff --git a/docs/docs-api/MassMatrix/examples/MassMatrix_test_4.md b/docs/docs-api/MassMatrix/examples/MassMatrix_test_4.md index f9a97f09..d3daa624 100644 --- a/docs/docs-api/MassMatrix/examples/MassMatrix_test_4.md +++ b/docs/docs-api/MassMatrix/examples/MassMatrix_test_4.md @@ -1,6 +1,6 @@ This example shows how to USE the SUBROUTINE called `MassMatrix` to create a mass matrix in space domain. -Here, we want to DO the following. +Here, we want to DO the following. $$ \int_{\Omega } N^{I}\rho N^{J}d\Omega @@ -8,11 +8,10 @@ $$ `rho` can be a constant, or a FUNCTION of spatial coordinates, or some nonlinear FUNCTION. -In this example, following mass matrix is formed for ReferenceLine element, QuadraturePoint are `GaussLegendre`. +In this example, following mass matrix is formed for ReferenceLine element, QuadraturePoint are `GaussLegendre`. $$ \int_{\Omega } N^{I} N^{J}d\Omega $$ This TYPE of mass matrix is useful when $rho$ is a constant. - diff --git a/docs/docs-api/MassMatrix/examples/_MassMatrix_test_1.F90 b/docs/docs-api/MassMatrix/examples/_MassMatrix_test_1.F90 index b2987532..7433817e 100644 --- a/docs/docs-api/MassMatrix/examples/_MassMatrix_test_1.F90 +++ b/docs/docs-api/MassMatrix/examples/_MassMatrix_test_1.F90 @@ -33,8 +33,8 @@ PROGRAM main nns = order + 1 INTEGER(I4B), PARAMETER :: elemType = elem%line INTEGER(I4B), PARAMETER :: quadratureType = quadType%GaussLegendre -INTEGER( I4B ), PARAMETER :: interpolationType = iptype%GaussLegendreLobatto -INTEGER( I4B ), PARAMETER :: basisType = polyType%Monomial +INTEGER(I4B), PARAMETER :: interpolationType = iptype%GaussLegendreLobatto +INTEGER(I4B), PARAMETER :: basisType = polyType%Monomial REAL(DFP), PARAMETER :: refElemCoord(1, 2) = RESHAPE([-1.0_DFP, 1.0_DFP], [1, 2]) REAL(DFP), PARAMETER :: xij(1, 2) = RESHAPE([-1.0_DFP, 1.0_DFP], [1, 2]) diff --git a/docs/docs-api/MassMatrix/examples/_MassMatrix_test_1.md b/docs/docs-api/MassMatrix/examples/_MassMatrix_test_1.md index c276616f..4e03d0fd 100644 --- a/docs/docs-api/MassMatrix/examples/_MassMatrix_test_1.md +++ b/docs/docs-api/MassMatrix/examples/_MassMatrix_test_1.md @@ -1,7 +1,5 @@ - import CodeBlock from '@theme/CodeBlock'; import CodeSnippet from '!!raw-loader!./_MassMatrix_test_1.F90'; {CodeSnippet} - diff --git a/docs/docs-api/MassMatrix/examples/_MassMatrix_test_2.F90 b/docs/docs-api/MassMatrix/examples/_MassMatrix_test_2.F90 index f12ae90a..4ad28b2f 100644 --- a/docs/docs-api/MassMatrix/examples/_MassMatrix_test_2.F90 +++ b/docs/docs-api/MassMatrix/examples/_MassMatrix_test_2.F90 @@ -1,7 +1,3 @@ -<<<<<<< HEAD -PROGRAM main -USE easifemBase - PROGRAM main USE easifemBase diff --git a/docs/docs-api/TomlUtility/GetValue.md b/docs/docs-api/TomlUtility/GetValue.md index 1e5810f0..2ec8244e 100644 --- a/docs/docs-api/TomlUtility/GetValue.md +++ b/docs/docs-api/TomlUtility/GetValue.md @@ -8,14 +8,14 @@ title: GetValue ```fortran INTERFACE GetValue MODULE SUBROUTINE GetValue(table, key, VALUE, default_value, & - origin, stat, isFound) + origin, stat, isFound) TYPE(toml_table), INTENT(INOUT) :: table !! Toml table CHARACTER(*), INTENT(IN) :: key !! key - {DATA_TYPE}, INTENT(INOUT) :: VALUE + DataType, INTENT(INOUT) :: VALUE !! value in string - {DATA_TYPE}, INTENT(IN) :: default_value + DataType, INTENT(IN) :: default_value !! default value INTEGER(I4B), OPTIONAL, INTENT(INOUT) :: origin !! origin, necessary for debugging @@ -27,7 +27,7 @@ INTERFACE GetValue END INTERFACE GetValue ``` -Following data types are supported. +Following DataTypes are supported. - String - INTEGER(Int8 | Int16 | Int32 | Int64) @@ -44,10 +44,10 @@ The generic interface for getting the vector values is as follows: ```fortran INTERFACE GetValue MODULE SUBROUTINE GetValue(table, key, VALUE, origin, stat, & - isFound) + isFound) TYPE(toml_table), INTENT(INOUT) :: table CHARACTER(*), INTENT(IN) :: key - DATA_TYPE, ALLOCATABLE, INTENT(INOUT) :: VALUE(:) + DataType, ALLOCATABLE, INTENT(INOUT) :: VALUE(:) INTEGER(I4B), OPTIONAL, INTENT(INOUT) :: origin INTEGER(I4B), OPTIONAL, INTENT(INOUT) :: stat LOGICAL(LGT), OPTIONAL, INTENT(INOUT) :: isFound @@ -60,10 +60,10 @@ The above method will allocate the value. If you want to avoid the allocation, t ```fortran INTERFACE GetValue_ MODULE SUBROUTINE GetValue_(table, key, VALUE, tsize, origin, stat, & - isFound) + isFound) TYPE(toml_table), INTENT(INOUT) :: table CHARACTER(*), INTENT(IN) :: key - DATA_TYPE, ALLOCATABLE, INTENT(INOUT) :: VALUE(:) + DataType, ALLOCATABLE, INTENT(INOUT) :: VALUE(:) INTEGER(I4B), INTENT(OUT) :: tsize INTEGER(I4B), OPTIONAL, INTENT(INOUT) :: origin INTEGER(I4B), OPTIONAL, INTENT(INOUT) :: stat @@ -86,10 +86,10 @@ The generic interface for getting the matrix values is as follows: ```fortran INTERFACE GetValue MODULE SUBROUTINE GetValue(table, key, VALUE, origin, stat, & - isFound) + isFound) TYPE(toml_table), INTENT(INOUT) :: table CHARACTER(*), INTENT(IN) :: key - DATA_TYPE, ALLOCATABLE, INTENT(INOUT) :: VALUE(:, :) + DataType, ALLOCATABLE, INTENT(INOUT) :: VALUE(:, :) INTEGER(I4B), OPTIONAL, INTENT(INOUT) :: origin INTEGER(I4B), OPTIONAL, INTENT(INOUT) :: stat LOGICAL(LGT), OPTIONAL, INTENT(INOUT) :: isFound @@ -102,7 +102,7 @@ The above method will allocate the value. If you want to avoid the allocation, t ```fortran INTERFACE GetValue_ MODULE SUBROUTINE GetValue_(table, key, VALUE, origin, stat, & - isFound, nrow, ncol) + isFound, nrow, ncol) TYPE(toml_table), INTENT(INOUT) :: table CHARACTER(*), INTENT(IN) :: key INTEGER(INT8), INTENT(INOUT) :: VALUE(:, :) diff --git a/docs/partials/_product-section.mdx b/docs/partials/_product-section.mdx index 4755d33f..a6c9a482 100644 --- a/docs/partials/_product-section.mdx +++ b/docs/partials/_product-section.mdx @@ -1,9 +1,9 @@ import { - FlashRegular, - ArrowDownloadRegular, - CodeRegular, - CodeTextEditRegular, -} from '@fluentui/react-icons'; + Zap, + Download, + Code, + Edit +} from 'react-feather'; } + icon={} to="/guides/getting-started/" description="Getting started with easifem, quickly install and run a hello world program!" /> } + icon={} to="/guides/install" description="Get detailed information about installation, configuration, dependencies of easifem" /> } + icon={} to="/guides/using-easifem" description="Learn how to build and link applications with easifem." /> } + icon={} to="/guides/ide" description="Learn how to configure language server for development with easifem in VSCode and Neovim" /> diff --git a/docusaurus.config.js b/docusaurus.config.js index f52d1877..fd584abb 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -157,6 +157,7 @@ const config = { docs: { sidebar: { hideable: true, + autoCollapseCategories: true, }, }, navbar: { diff --git a/package.json b/package.json index 876a7d89..78960009 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,8 @@ "@docusaurus/plugin-css-cascade-layers": "^3.8.0", "@docusaurus/preset-classic": "^3.8.0", "@docusaurus/theme-common": "^3.8.0", - "@fluentui/react-icons": "^2.0.271", "@mdx-js/react": "^3.1.0", - "@tanstack/react-table": "latest", + "@tanstack/react-table": "^8.21.3", "@types/react": "^18.2.0", "clsx": "^2.1.1", "docusaurus-plugin-drawio": "^0.4.0", @@ -37,26 +36,27 @@ "prism-react-renderer": "^2.3.1", "prismjs": "^1.29.0", "raw-loader": "^4.0.2", - "react": "^18.2.0", - "react-dom": "^18.2.0", + "react": "^19.0.0", + "react-dom": "^19.0.0", "react-feather": "^2.0.10", "react-loadable": "^5.5.0", "rehype-katex": "^7.0.0", "remark-math": "^6.0.0", - "search-insights": "^2.8.0" + "search-insights": "^2.8.0", + "webpack": "^5.95.0" }, "devDependencies": { "@docusaurus/tsconfig": "^3.8.0", "@docusaurus/types": "^3.8.0", "@radix-ui/react-select": "^2.1.1", - "@typescript-eslint/eslint-plugin": "^5.62.0", - "@typescript-eslint/parser": "^5.62.0", + "@typescript-eslint/eslint-plugin": "^7.3.1", + "@typescript-eslint/parser": "^7.3.1", "autoprefixer": "^10.4.19", "buffer": "^6.0.3", "docusaurus-plugin-typedoc": "^0.18.0", "eslint": "^8.57.0", - "eslint-config-prettier": "^8.10.0", - "eslint-plugin-prettier": "^4.2.1", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-prettier": "^5.1.3", "js-yaml": "^4.1.0", "pascal-case": "^3.1.2", "path-browserify": "^1.0.1", @@ -90,15 +90,5 @@ "prettier": { "singleQuote": true, "tabWidth": 2 - }, - "config": { - "commitizen": { - "path": "./node_modules/cz-conventional-changelog" - } - }, - "commitlint": { - "extends": [ - "@commitlint/config-conventional" - ] } } diff --git a/src/components/homepage/GuidesAndSamples.tsx b/src/components/homepage/GuidesAndSamples.tsx index f66517de..3d063a08 100644 --- a/src/components/homepage/GuidesAndSamples.tsx +++ b/src/components/homepage/GuidesAndSamples.tsx @@ -1,18 +1,15 @@ import Link from "@docusaurus/Link"; import { - AppsAddInRegular, - ArrowRightFilled, - CodeCircleRegular, - CubeRegular, - DesktopRegular, - DeveloperBoardRegular, - DocumentRegular, - OpenRegular, - RecordRegular, -} from "@fluentui/react-icons"; + ChevronRight, + Code, + Monitor, + Cpu, + FileText, + ExternalLink, + GitHub, +} from "react-feather"; import clsx from "clsx"; import React from "react"; -import { ChevronRight, GitHub } from "react-feather"; interface Guide { title: string; @@ -24,19 +21,19 @@ interface Guide { const guides: Guide[] = [ { title: "Getting started with easifemBase and easifemClasses", - icon: CodeCircleRegular, + icon: Code, text: "Quick installation of easifemBase, easifemClasses, and run some sample programs.", link: "/guides/getting-started", }, { title: "A simple 💫 Hello World 🚀 program", - icon: DesktopRegular, + icon: Monitor, text: "Run a hello world program by using easifem.", link: "guides/learn-by-examples/hello-world", }, { title: "Getting started with strings", - icon: DeveloperBoardRegular, + icon: Cpu, text: "Strings in easifem", link: "/guides/programming-basics/string", }, @@ -105,13 +102,13 @@ function Sample({ title, platform, blog, source, demo }: Sample) {
{blog && ( - + )} {demo && ( - + )} @@ -137,7 +134,7 @@ export default function GuidesAndSamples() {

Getting started guides 📚

- View more guides + View more guides
@@ -161,7 +158,7 @@ export default function GuidesAndSamples() { to="https://github.com/vickysharma0812" className="font-jakarta text-sm font-semibold" > - All apps + All apps diff --git a/src/components/homepage/HeroSection.tsx b/src/components/homepage/HeroSection.tsx index cb79cfdd..cf49bb57 100644 --- a/src/components/homepage/HeroSection.tsx +++ b/src/components/homepage/HeroSection.tsx @@ -1,14 +1,14 @@ import Link from "@docusaurus/Link"; import { - AppFolderRegular, - BlurRegular, - BoardRegular, - BoxRegular, - ChatMultipleRegular, - LiveRegular, - MicRegular, - VideoRegular, -} from "@fluentui/react-icons"; + Folder, + EyeOff, + Layout, + Package, + MessageCircle, + Radio, + Mic, + Video, +} from "react-feather"; import { DiscordIcon, EasifemIcon } from "@site/src/icons"; import ThemedImage from "@theme/ThemedImage"; import clsx from "clsx"; @@ -18,7 +18,7 @@ const PRODUCTS = [ { title: "easifemBase", link: "/about/easifemBase", - icon: AppFolderRegular, + icon: Folder, lightImage: "/static/landing-page/hero/easifemBase-light.svg", darkImage: "/static/landing-page/hero/easifemBase-dark.svg", text: "Base library for easifem.", @@ -26,7 +26,7 @@ const PRODUCTS = [ { title: "easifemClasses", link: "/about/easifemClasses", - icon: BlurRegular, + icon: EyeOff, lightImage: "/static/landing-page/hero/easifemClasses-light.svg", darkImage: "/static/landing-page/hero/easifemClasses-dark.svg", text: "High level classes and objects for numerical methods and algorithms.", diff --git a/src/components/homepage/Install.tsx b/src/components/homepage/Install.tsx index 141a471c..c36bcf65 100644 --- a/src/components/homepage/Install.tsx +++ b/src/components/homepage/Install.tsx @@ -1,13 +1,26 @@ import Link from "@docusaurus/Link"; import React from "react"; +import { Monitor, Server, Award, Cpu, HardDrive } from "react-feather"; -function SDK({ icon, to, name }: { icon: string; name: string; to?: string }) { +// Map of distro names to react-feather icons +const iconMap = { + 'Ubuntu': Server, + 'Archlinux': Cpu, + 'Fedora': Server, + 'Debian': Server, + 'M1/M2 chip(ARM64)': Monitor, + 'Intel chip(AMD64, x86)': HardDrive +}; + +function SDK({ name, to }: { name: string; to?: string }) { + const IconComponent = iconMap[name] || Award; + return ( - + {name} ); @@ -33,22 +46,18 @@ export default function Install() { @@ -64,12 +73,10 @@ export default function Install() { diff --git a/src/components/homepage/ResourcesSection.tsx b/src/components/homepage/ResourcesSection.tsx index 6f64f751..d42537f2 100644 --- a/src/components/homepage/ResourcesSection.tsx +++ b/src/components/homepage/ResourcesSection.tsx @@ -1,5 +1,5 @@ import Link from "@docusaurus/Link"; -import { ArrowRightFilled, ChevronLeftRegular, ChevronRightRegular } from "@fluentui/react-icons"; +import { ChevronRight, ChevronLeft } from "react-feather"; import clsx from "clsx"; import React, { useState } from "react"; @@ -131,7 +131,7 @@ export default function ResourcesSection() { to="https://dyte.io/blog" className="font-jakarta text-sm font-semibold text-primary" > - All Blogs + All Blogs @@ -180,14 +180,14 @@ export default function ResourcesSection() { onClick={prevPage} className="top-1/2 -left-14 rounded-lg bg-transparent p-1 hover:bg-secondary-800 md:absolute md:-translate-y-1/2" > - + diff --git a/src/css/custom.css b/src/css/custom.css index fa14a9b6..6f157521 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -141,12 +141,13 @@ html[data-theme='dark'] { /* Background colors */ --docs-color-background: var(--cat-base); - --docs-color-background-100: var(--cat-mantle); - --docs-color-background-200: var(--cat-crust); - --docs-color-background-300: var(--cat-surface0); - --ifm-background-surface-color: var(--cat-base); --ifm-background-color: var(--cat-base); - --ifm-footer-background-color: var(--cat-surface0); + --docs-color-background-100: var(--cat-base); + --docs-color-background-200: var(--cat-mantle); + --docs-color-background-300: var(--cat-crust); + --ifm-background-surface-color: var(--cat-surface0); + --ifm-footer-background-color: var(--cat-crust); + --ifm-navbar-background-color: var(--cat-base); /* Border and text colors */ --docs-color-border: var(--cat-surface1); @@ -219,6 +220,34 @@ html[data-theme='dark'] { .homepage section * { @apply box-border; } + +h1 { + color: var(--ifm-color-primary); +} + +h2 { + color: var(--cat-lavender); +} + +h3 { + color: var(--cat-blue); +} + +h4 { + color: var(--cat-text); +} + +} + +html[data-theme='dark'] { + /* Add these lines to override background colors for dark mode */ + --docs-color-background: var(--cat-base); + --ifm-background-color: var(--cat-base); + --docs-color-background-100: var(--cat-base); + --docs-color-background-200: var(--cat-mantle); + --docs-color-background-300: var(--cat-crust); + --ifm-background-surface-color: var(--cat-surface0); + --ifm-navbar-background-color: var(--cat-base); } /* Components */ @@ -252,12 +281,33 @@ pre, code { } /* Navigation and UI Components */ -nav.navbar { - border-bottom: 0.5px solid var(--ifm-toc-border-color); +/* nav.navbar { */ +/* border-bottom: 0.5px solid var(--ifm-toc-border-color); */ +/* } */ + +/* pre.prism-code { */ +/* border: 0.5px solid var(--code-border-color); */ +/* } */ + +/* Making code block scrollable */ +pre { + max-height: 400px; + overflow-y: auto; +} + +pre code { + display: block; + white-space: pre; } -pre.prism-code { - border: 0.5px solid var(--code-border-color); +pre.prism-code, +.theme-code-block pre, +:not(pre) > code { + border: none !important; + /* border-left: 0.5px solid var(--code-border-color) !important; */ + /* border-right: 0.5px solid var(--code-border-color) !important; */ + /* border-top: 0 !important; */ + /* border-bottom: 0 !important; */ } .navbar__item, @@ -336,13 +386,14 @@ nav.menu { display: inline-block; padding: 0.25rem 1.5rem; border-radius: 4px; - background-color: var(--ifm-color-primary); - color: var(--ifm-text-color); + background-color: var(--cat-mauve); + color: var(--ifm-background-color); text-decoration: none; + font-weight: 600; } .footer__cta a:hover { - background-color: var(--ifm-color-primary-darker); + background-color: var(--cat-mauve); /* color: var(--ifm-color-primary); */ } @@ -356,7 +407,7 @@ nav.menu { .footer__title { font-size: 14px; - font-weight: normal; + font-weight: bold; @apply mb-2 text-text-400; } @@ -436,6 +487,7 @@ nav.menu { aside.theme-doc-sidebar-container { position: relative; clip-path: inset(0px -140px); + border-right: none !important; } .theme-doc-sidebar-container button[title='Collapse sidebar'], diff --git a/src/icons/index.tsx b/src/icons/index.tsx index 00745408..259d3534 100644 --- a/src/icons/index.tsx +++ b/src/icons/index.tsx @@ -86,63 +86,63 @@ export function EasifemIcon(props: ComponentProps<"svg">) { @@ -624,8 +624,8 @@ export function CodepenIcon(props: ComponentProps<"svg">) { export function ArchLinuxIcon(props: ComponentProps<"svg">) { return (