Skip to content

Refactoring load_mesh function into a Mesh class with support for multiple providers and global numeration #1

@boorlakov

Description

@boorlakov

Issue Description

Currently, codebase includes a load_mesh function responsible for loading meshes, but it lacks extensibility and flexibility. To improve maintainability and add support for multiple mesh provider options (such as GMSH, NETGEN, etc.), as well as to make the default numeration global and move numeration localization into the FETI class because of FEMProblem, we need to refactor this function into a Mesh class.

Proposed Changes

Proposed API example

mesh = Mesh.load(
    # The path to the geometry file
    "dipole2d.geo", # Or "dipole2d.msh"
    # How many times to refine the mesh by half (0 means no refinement)
    refine_k=3,
    # How many partitions to make (0 means no partitions)
    num_part=0
)
domains = [FemDomain(domain) for domain in mesh]
problem = FemProblem(domains)

or

mesh = Mesh.load(
    # The path to the geometry file
    "dipole2d.geo", # Or "dipole2d.msh"
    # How many times to refine the mesh by half (0 means no refinement)
    refine_k=3,
    # How many partitions to make (0 means no partitions)
    num_part=0
)
mesh.localize_numaration()
domains = [FemDomain(domain) for domain in mesh]
problem = FetiProblem(domains)

Expected Benefits

  • Improved code organization and maintainability by encapsulating mesh loading functionality into a dedicated class.
  • Enhanced flexibility to support multiple mesh provider options without modifying existing code extensively.
  • Global default numeration allows for consistent behavior (FEMProblem) across the application.
  • Localization of numeration within the FETI class ensures separation of concerns and better modularization.

Additional Considerations

  • Write comprehensive unit tests to validate the functionality of the Mesh class and its methods.
  • Document the usage of the Mesh class and any changes in numeration handling for developers' reference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions