From 77eebcc6663f7843b2d7552c25e30bbab4e6611e Mon Sep 17 00:00:00 2001 From: Jukka Aho Date: Sat, 15 Nov 2025 18:45:53 +0200 Subject: [PATCH] feat(core): Integrate modular API architecture into main JuliaFEM module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update src/JuliaFEM.jl to include all domain api.jl files: - Include api.jl as documentation guide (no type definitions) - Include formulations/api.jl → export AbstractFormulation, continuum theories - Include fields/api.jl → export Displacement, Temperature, DisplacementRotation - Include materials/api.jl → export AbstractMaterial, compute_stress, elasticity_tensor - Include mesh/api.jl → export AbstractMesh, node-to-elements mapping - Include beams/shells/trusses/api.jl → export structural formulations - Include physics.jl → export Physics, DirichletBC, NeumannBC - Include topology/api.jl → export AbstractTopology{N}, interface functions Proper dependency order enforced: 1. Core (api.jl documentation) 2. Formulations (HOW to discretize) 3. Fields (WHAT to solve) 4. Materials (constitutive laws) 5. Mesh (topology ownership) 6. Structural (beams/shells/trusses) 7. Physics (coupling all components) 8. Topology (element geometry) Export statements organized by domain, immediately after each include. Completes systematic modular API architecture integration. --- src/JuliaFEM.jl | 68 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 49 insertions(+), 19 deletions(-) diff --git a/src/JuliaFEM.jl b/src/JuliaFEM.jl index 8799bef..17cc0c6 100644 --- a/src/JuliaFEM.jl +++ b/src/JuliaFEM.jl @@ -126,26 +126,52 @@ end # This is the Julia equivalent of C/C++ header files. # All abstract types and lightweight structs are defined here. # This MUST be included before any concrete implementations. -include("api.jl") +include("api.jl") # Documentation-only (no type definitions) -# Concrete Physics implementation (uses abstracts from api.jl) -include("physics.jl") +# Formulation domain API (discretization strategies) +include("formulations/api.jl") +export AbstractFormulation, ContinuumFormulation +export AbstractContinuumTheory, FullThreeD, PlaneStress, PlaneStrain, Axisymmetric -# Export core API types -export AbstractMesh, AbstractTopology -export AbstractMaterial, AbstractElasticMaterial, AbstractPlasticMaterial +# Field domain API (field variable types and DOF counting) +include("fields/api.jl") export AbstractField, Displacement, Temperature, DisplacementRotation -export AbstractFormulation, ContinuumFormulation, BeamFormulation, ShellFormulation, TrussFormulation -export FullThreeD, PlaneStress, PlaneStrain, Axisymmetric -export EulerBernoulli, Timoshenko, ReissnerMindlin, KirchhoffLove -export AbstractPhysics, Physics, Constraint -export DirichletBC, NeumannBC - -# Export generic API functions (stubs defined in api.jl, implementations in various files) -export assemble!, assemble_v2!, solve! -export add_dirichlet!, add_neumann! export dofs_per_node +# Material domain API +include("materials/api.jl") +export AbstractMaterial, AbstractElasticMaterial, AbstractPlasticMaterial +export compute_stress, elasticity_tensor + +# Mesh domain API +include("mesh/api.jl") +export AbstractMesh, AbstractRefineStrategy +export nnodes_total, nelements, get_node, connectivity_matrix +export get_elements_for_node, get_element_set, get_node_set +export refine + +# Subdomain API files (define their own abstractions and formulations) +include("beams/api.jl") # AbstractBeamTheory, BeamFormulation{Theory}, EulerBernoulli, Timoshenko +export AbstractBeamTheory, BeamFormulation, EulerBernoulli, Timoshenko + +include("shells/api.jl") # AbstractShellTheory, ShellFormulation{Theory}, ReissnerMindlin, KirchhoffLove +export AbstractShellTheory, ShellFormulation, ReissnerMindlin, KirchhoffLove + +include("trusses/api.jl") # AbstractTrussTheory, TrussFormulation{Theory}, SimpleTruss +export AbstractTrussTheory, TrussFormulation, SimpleTruss + +# Physics domain API (abstract type and interface functions) +include("physics/api.jl") +export AbstractPhysics, assemble!, solve!, add_dirichlet!, add_neumann! + +# Concrete Physics implementation (uses abstractions from physics/api.jl) +include("physics.jl") +export Physics, Constraint, DirichletBC, NeumannBC + +# Export additional assembly functions +export assemble_v2! +export AbstractTopology + # import FEMSparse # Consolidated into src/sparse/ # import FEMQuad # Consolidated into src/quadrature.jl @@ -156,7 +182,12 @@ export dofs_per_node # ============================================================================ # TOPOLOGY: Reference element geometries (NEW - separation of concerns) # ============================================================================ -include("topology/topology.jl") # Abstract topology interface +# Topology domain API (abstract type and interface) +include("topology/api.jl") +export AbstractTopology, nnodes, dim, reference_coordinates, edges, faces + +# Topology implementations (concrete types) +include("topology/topology.jl") # Helper functions (interface in api.jl) # Consolidated topology files (one per shape family) include("topology/segments.jl") # Segment (1D) @@ -177,9 +208,8 @@ export Hexahedron # 3D hex export Pyramid # 3D pyramid export Wedge # 3D prism -# Export deprecated aliases (backward compatibility) -# These resolve to topology types, NOT separate types! -export Seg2, Seg3 # → Segment +# Export aliases. These resolve to topology types, NOT separate types! +export Seg2, Seg3 # → Segment export Tri3, Tri6, Tri7 # → Triangle export Quad4, Quad8, Quad9 # → Quadrilateral export Tet4, Tet10 # → Tetrahedron