Commit Graph

1521 Commits

Author SHA1 Message Date
Jukka Aho 73fdcae019 refactor(assemblers): remove NodeCache and simplify integration points API
Remove unused NodeCache code and simplify integration points call in
element cache creation.

- Remove NodeCache struct and create_node_cache function
- Simplify integration_points call to use auto-selected quadrature
- Remove integration_scheme parameter from create_element_cache
2025-12-12 23:29:29 +02:00
Jukka Aho 9ee84e7480 refactor(assemblers): migrate to AssemblyMaterialWorkspace and add GlobalMaterialCache API
Refactor element-based COO assembler to use new material workspace API
and add support for GlobalMaterialCache alongside legacy API.

- Add new assemble_element! overload using GlobalMaterialCache (NEW API)
- Add new assemble! overload using GlobalMaterialCache (NEW API)
- Update legacy assemble_element! to use material_workspace and
  𝔻_vec_buffer parameter
- Update legacy assemble! to use material_workspace and 𝔻_vec_buffer
- Change counter from Ref{Int} to Int for zero-allocation access
- Use extract_tangent! with pre-allocated buffer for zero-allocation
  tangent extraction
- Add imports for GlobalMaterialCache and tangent extraction functions
- Update all function signatures and docstrings to reflect new API
2025-12-12 23:29:02 +02:00
Jukka Aho 94a88721a5 refactor(assemblers): update COOCache for new material workspace API
Refactor COOCache to use AssemblyMaterialWorkspace and improve
zero-allocation performance.

- Add FieldType and StateType type parameters to COOCache struct
- Change material_cache to material_workspace field name
- Change counter from Ref{Int} to Int for zero-allocation access
- Add 𝔻_vec_buffer for pre-allocated tangent vector extraction
- Update constructor to infer FieldType and StateType from workspace
- Update reset! and extract_system to use direct counter access
- Add Tensors import and AssemblyMaterialWorkspace import
2025-12-12 23:28:33 +02:00
Jukka Aho c5a1202c1d chore(assemblers): comment out missing nodal_cache.jl include
Comment out include for nodal_cache.jl as the file does not exist yet.

- Comment out include("nodal_cache.jl") with TODO note
2025-12-12 23:27:50 +02:00
Jukka Aho 259276a06e feature(assemblers): add DOFBasedCOOAssembler and refactor material cache
Add new DOF-by-DOF assembler and refactor material state cache type
parameters for better flexibility.

- Add DOFBasedCOOAssembler struct with comprehensive documentation
- Change AbstractMaterialStateCache from M<:AbstractMaterialState to
  FieldType, StateType parameters
- Update material cache docstring to reflect new type structure
- Clarify purpose as per-element workspace vs persistent storage
2025-12-12 23:27:28 +02:00
Jukka Aho c9dfcddd8d chore(api): remove include for deleted topology.jl
Remove include statement for topology.jl which was deleted after
its content was moved to topology/api.jl.

- Remove include("topology/topology.jl") line
2025-12-12 23:26:55 +02:00
Jukka Aho 3f36111bba chore: remove Manifest.toml from repository
Remove Manifest.toml from version control as it is a generated file
that should not be tracked.

- Remove Manifest.toml from git tracking
2025-12-12 23:26:31 +02:00
Jukka Aho 2d1ba0a0a1 refactor(quadrature): simplify documentation and remove legacy code
Major cleanup of quadrature module: simplify docstrings to minimal
code-focused style, remove all legacy symbol-based API, and fix Vec
constructor syntax throughout.

Documentation simplification:
- Remove all examples from docstrings
- Simplify file-level docstrings to one-line descriptions
- Remove verbose explanations, accuracy details, references, and
  "See also" sections
- Keep only essential information about types and functions

Legacy code removal:
- Remove all legacy symbol-based API (Val{:GLTRI*}, Val{:GLTET*},
  Val{:GLPYR*}, Val{:GLWED*}, Val{:GLSEG*}, Val{:GLQUAD*},
  Val{:GLHEX*})
- Remove get_order() functions for legacy symbols
- Remove _legacy_tensor_product helper function
- Remove legacy symbol generation code from gl_tensor_product.jl

gauss.jl refactoring:
- Remove old Gauss{N} type and AbstractIntegration hierarchy
- Remove get_rule_name() function and all rule name mappings
  (hundreds of lines for segments, triangles, quads, tets, hexes,
  wedges, pyramids)
- Remove IntegrationPointNEW alias
- Replace with simple integration_points() function using new API
- Change npoints() signature to take only topology parameter

api.jl improvements:
- Uncomment and fix _infer_basis_order implementations
- Add proper type constraints (<:) for all topology types
- Add Triangle{10} case for cubic triangles
- Add _quadrature_topology_type mapping functions for all topologies
- Enable topology-only dispatch for default_quadrature

Vec constructor fixes:
- Fix all Vec{D} constructor calls to use tuple syntax
- Change Vec{2}(x, y) to Vec{2}((x, y))
- Change Vec{3}(x, y, z) to Vec{3}((x, y, z))
- Applied consistently across all quadrature rule files
2025-12-12 23:22:29 +02:00
Jukka Aho 02b41db2e4 chore(docs): add .gitignore for docs directory
Add .gitignore to ignore Manifest.toml in docs directory

- Ignore Manifest.toml (generated file, should not be committed)
2025-12-12 23:05:47 +02:00
Jukka Aho 2b24cbadba docs(index): update documentation landing page
Modernize index page with comprehensive overview and quick start
guide. Replace simple contents page with informative landing page.

- Add overview section describing JuliaFEM.jl
- Add key features section highlighting capabilities
- Add installation instructions
- Add quick start example code
- Update contributing section with GitHub link
- Add license information
- Remove old contents listing
2025-12-12 23:04:39 +02:00
Jukka Aho 108c881687 docs(api): reorganize API documentation structure
Reorganize API documentation with organized sections for better
navigation and discoverability.

- Add structured sections: Elements, Physics, Fields, Formulations,
  Materials, Mesh, Topology, Basis Functions, DOF System, Solvers
- Include key types and functions in each section
- Change title from "API documentation" to "API Reference"
- Keep index at the end for complete reference
2025-12-12 23:04:14 +02:00
Jukka Aho 7125a617f8 refactor(docs): simplify make.jl to modern Documenter.jl build
Simplify documentation build script to generate API docs only.
Remove legacy code for generating examples, packages, and guides.

- Replace complex build system with simple Documenter.jl setup
- Generate markdown output for Quarto integration
- Build directly to juliafem.github.io/api/ directory
- Remove functions: copy_docs, add_page!, generate_* functions
- Use DocumenterMarkdown format instead of HTML
2025-12-12 23:03:50 +02:00
Jukka Aho c7b0283822 chore(docs): add JuliaFEM dependency to Project.toml
Add JuliaFEM package as dependency for documentation build

- Add JuliaFEM to [deps] section
- Add relative path source for JuliaFEM in [sources]
2025-12-12 23:03:21 +02:00
Jukka Aho 038222ce98 chore: remove docs files moved to website repository
Remove documentation files from docs/ directory as they have
been moved to juliafem.github.io/ according to the website
structure. Manual documentation now lives in the website
repository directly.

Removed files:
- docs/book/adr-004-integration-points-api.md
- docs/book/adr-005-element-integration-point-indices.md
- docs/book/deformation_gradient_implementation.md
- docs/book/design/backend_transparent_architecture.md
- docs/book/design/gmres_algorithm_gpu.md
- docs/book/design/matrix_free_dirichlet_bc.md
- docs/book/element_assembly_implementation.md
- docs/book/linear_elastic_implementation.md
- docs/book/migration-guide-basis-api.md
- docs/book/neo_hookean_implementation.md
- docs/book/perfect_plasticity_implementation.md
2025-12-12 22:59:15 +02:00
Jukka Aho ff3c26d2c3 chore: remove obsolete and legacy files
Major cleanup: remove obsolete files that have been replaced or
moved to new locations. Files removed include legacy assembly
implementations, old API files, and deprecated test files.

Removed files:

Assemblers and assembly:
- src/assemblers/nodal_based.jl
- src/assemblers/nodal_cache.jl
- src/assemblers/node_based_coo.jl
- src/assembly/assembly.jl
- src/assembly/element_structures.jl
- src/assembly/framework.jl
- src/assembly/nodal_structures.jl
- src/assembly/problems.jl
- src/element_assembly_structures.jl
- src/nodal_assembly_structures.jl

Legacy API and structure files:
- src/beams/api.jl
- src/formulations/api.jl
- src/gpu_elasticity.jl
- src/io.jl
- src/materials_plasticity.jl
- src/postprocess_utils.jl
- src/preprocess.jl
- src/quadrature.jl
- src/readers.jl
- src/shells/api.jl
- src/trusses/api.jl

Elements and domains:
- src/domains/continuum/assemble_v2.jl
- src/elements/integrate.jl

Quadrature legacy files:
- src/quadrature/gauss_points.jl
- src/quadrature/integration.jl

Test files:
- test/runtests_new.jl
- test/runtests.jl.old
- test/test_problems_elasticity_assemble_3d_seg3.jl
2025-12-12 22:45:49 +02:00
Jukka Aho cba8d19c1c chore: remove src/readers directory
Remove src/readers directory as files have been moved to src/io/

Removed files:
- src/readers/abaqus_download.jl
- src/readers/AbaqusReader.jl
- src/readers/AsterReader.jl
- src/readers/create_surface_elements.jl
- src/readers/keyword_register.jl
- src/readers/parse_mesh.jl
- src/readers/parse_model.jl
- src/readers/read_aster_mesh.jl
- src/readers/read_aster_results.jl
2025-12-12 22:41:39 +02:00
Jukka Aho b9fafd4e09 refactor(topology): consolidate files and simplify documentation
Consolidate topology module by merging topology.jl into api.jl and
significantly simplify documentation across all topology files. Remove
verbose docstrings, examples, and design notes in favor of minimal,
code-focused documentation.

Major changes:
- Merge topology.jl into api.jl (delete topology.jl)
- Simplify docstrings in api.jl, triangles.jl, and tetrahedra.jl
- Remove verbose documentation from type aliases and functions
- Remove topology type parameter from entity types (Vertex, Edge, Face, Cell)
- Update all entity constructors to remove topology parameter
- Add entities dispatcher and helper functions to api.jl

File changes:
- api.jl: Simplified AbstractTopology docstring, added topological entities
  and helpers from topology.jl, added entities dispatcher
- triangles.jl: Removed verbose documentation
- tetrahedra.jl: Removed verbose documentation
- hexahedra.jl, pyramids.jl, quadrilaterals.jl, segments.jl, wedges.jl:
  Updated entity constructors to remove topology type parameter
- topology.jl: Deleted (content moved to api.jl)

Documentation philosophy:
- Keep docstrings minimal and code-focused
- Remove examples unless function use is unclear
- Move comprehensive documentation to website/docs, not in code
- Maintain essential type information and interface requirements
2025-12-12 22:27:09 +02:00
Jukka Aho b1292a0ee6 chore: removed files from examples
Removed files from examples directory:

- examples/2d_hertz_contact.jl
- examples/2d_hertz_contact/hertz_2d_full.med
- examples/2d_hertz_contact/model.png
- examples/2d_hertz_contact/results_displacement.png
- examples/3d_frame.jl
- examples/3d_frame/model.med
- examples/3d_frame/model.png
- examples/3d_frame/natfreq.png
- examples/academic_matrix_extraction/academic_example.jl
- examples/academic_matrix_extraction/README.md
- examples/generate_stiffness_matrices.jl
- examples/gmsh_heat_equation/gmsh_heat_equation.jl
- examples/gmsh_heat_equation/QUICK_START.md
- examples/gmsh_heat_equation/README.md
- examples/gmsh_heat_equation/unit_square.geo
- examples/linear_static.jl
- examples/linear_static/freecad.png
- examples/linear_static/JuliaFEMSMP18.med
- examples/linear_static/paraview.png
2025-12-12 22:04:04 +02:00
Jukka Aho f0353699b0 chore: removed files from docs
Removed files from docs directory:

- docs/badges.jl
- docs/book/nodal_assembly_concept.md
- docs/build_api.jl
- docs/build_doctests.jl
- docs/build_lint.jl
- docs/build_notebooks.jl
- docs/build_unittests.jl
- docs/src/contributor/coding_standards.md
- docs/src/contributor/guides/gpu_elasticity_quickstart.md
- docs/src/contributor/guides/gpu_nodal_assembly_quickstart.md
- docs/src/contributor/guides/quick_reference_gpu.md
- docs/src/contributor/README.md
- docs/src/contributor/status.md
- docs/src/contributor/test_fixes_needed.md
- docs/src/contributor/testing_philosophy.md
- docs/src/examples.md
- docs/src/features.md
- docs/src/links.md
- docs/src/user/elasticity_quickstart.md
- docs/src/user/README.md
- docs/src/user/system_architecture.md
2025-12-12 22:01:57 +02:00
Jukka Aho 9c5229bf4a chore: removed files from demos
Removed files from demos directory:

- demos/assembly_comparison_simple.jl
- demos/cantilever_beam_demo.jl
- demos/cantilever_beam_simple.jl
- demos/cantilever_cpu_comparison.jl
- demos/cantilever_gmsh_gpu.jl
- demos/cantilever_physics_gpu.jl
- demos/gpu_assembly_poc_tensors.jl
- demos/gpu_assembly_poc.jl
- demos/gpu_assembly_tet10.jl
- demos/gpu_elementset_demo.jl
- demos/GPU_KERNEL_PLAN.md
- demos/gpu_mpi_demo.jl
- demos/gpu_mpi_mock.jl
- demos/gpu_nodal_assembly_demo.jl
- demos/gpu_only_demo.jl
- demos/krylov_mpi_gpu_demo.jl
- demos/newton_krylov_anderson_cpu.jl
- demos/nodal_assembly_cpu.jl
- demos/nodal_assembly_gpu.jl
- demos/README_GPU_MPI.md
- demos/README_GPU_POC.md
- demos/README_KRYLOV_DEMO.md
- demos/README_TENSORS_CORRECTION.md
- demos/test_tet10_cpu.jl
2025-12-12 22:00:41 +02:00
Jukka Aho cee336a476 chore: remove docs/src/book directory
Remove docs/src/book directory as it has been moved to another
repository

- Remove docs/src/book/ directory and all contents
- 40 files removed including documentation and design docs
2025-12-12 21:44:34 +02:00
Jukka Aho c4745e8cd1 chore: remove benchmarks directory
Remove benchmarks directory as it has been moved to another
repository

- Remove benchmarks/ directory and all contents
- 37 files removed including benchmark scripts and results
2025-12-12 21:41:48 +02:00
Jukka Aho 1cbc236f89 chore(license): update copyright year
Add 2025 copyright notice to LICENSE file

- Add Copyright (c) 2025 Jukka Aho line
2025-12-12 21:34:59 +02:00
Jukka Aho 50575db902 chore(.gitignore): Update ignore rules to exclude .trash directory and prototypes 2025-11-26 22:18:12 +02:00
Jukka Aho 09eb3928db feat(topology): Add comprehensive typed entity system
- Define TopologicalEntity{D, Topo} abstract type hierarchy
- Add concrete entity types: Vertex{T}, Edge{T}, Face{T}, Cell{T}
- Implement type-based entity queries: entities(Edge{Tet4})
- Add entity dimension query: dim(::Type{<:TopologicalEntity})
- Add topology extraction: topology_type(::Type{<:TopologicalEntity})
- Add entity count helper: nentities(::Type{<:TopologicalEntity})
- Comprehensive documentation explaining entity philosophy
- Examples showing DOF system integration patterns
- Zero-allocation design: position in vector IS entity ID
2025-11-23 18:22:01 +02:00
Jukka Aho 3ab0ca3f2f refactor(topology): Modernize wedge topology implementation
- Apply Vec constructor broadcasting to both Wedge6 and Wedge15
- Convert edges() to return SVector of typed Edge{T} entities (9 edges)
- Convert faces() to return SVector of typed Face{T} entities (5 faces: 2 triangles + 3 quads)
- Add vertices() returning six Vertex{T} instances
- Add cells() returning single Cell{T} instance
- Add entity count methods: nvertices(), nedges(), nfaces()
- Clean syntax with consistent formatting
2025-11-23 18:21:05 +02:00
Jukka Aho b9a92bb364 refactor(topology): Modernize pyramid topology implementation
- Apply Vec constructor broadcasting to Pyr5
- Convert edges() to return SVector of typed Edge{T} entities (8 edges)
- Convert faces() to return SVector of typed Face{T} entities (5 faces: 1 quad base + 4 triangles)
- Add vertices() returning five Vertex{T} instances
- Add cells() returning single Cell{T} instance
- Add entity count methods: nvertices(), nedges(), nfaces()
- Clean syntax with consistent formatting
2025-11-23 18:20:47 +02:00
Jukka Aho 0e4ffb96d0 refactor(topology): Modernize hexahedron topology implementation
- Apply Vec constructor broadcasting to all 3 hexahedron types (Hex8, Hex20, Hex27)
- Convert edges() to return SVector of typed Edge{T} entities (12 edges)
- Convert faces() to return SVector of typed Face{T} entities (6 quad faces)
- Add vertices() returning eight Vertex{T} instances
- Add cells() returning single Cell{T} instance
- Add entity count methods: nvertices(), nedges(), nfaces()
- Cleaner formatting with consistent indentation
2025-11-23 18:20:26 +02:00
Jukka Aho 2f8612ee8e refactor(topology): Modernize tetrahedron topology implementation
- Apply Vec constructor broadcasting to both Tet4 and Tet10
- Convert edges() to return SVector of typed Edge{T} entities
- Convert faces() to return SVector of typed Face{T} entities
- Add vertices() returning four Vertex{T} instances
- Add cells() returning single Cell{T} instance
- Add entity count methods: nvertices(), nedges(), nfaces()
- Expand documentation with typed entity examples and DOF integration patterns
- Update all docstrings to explain typed entity system
2025-11-23 18:20:09 +02:00
Jukka Aho 3145ab1c9c refactor(topology): Modernize quadrilateral topology implementation
- Apply Vec constructor broadcasting to all 3 quadrilateral types (Quad4, Quad8, Quad9)
- Convert edges() to return SVector of typed Edge{T} entities
- Convert faces() to return SVector of typed Face{T} entity
- Add vertices() returning four Vertex{T} instances
- Add cells() returning single Cell{T} instance
- Add entity count methods: nvertices(), nedges(), nfaces()
- Consistent formatting with cleaner syntax
2025-11-23 18:19:44 +02:00
Jukka Aho 9168f2b6cf refactor(topology): Modernize triangle topology implementation
- Apply Vec constructor broadcasting to all 4 triangle types (Tri3, Tri6, Tri7, Tri10)
- Convert edges() to return SVector of typed Edge{T} entities
- Convert faces() to return SVector of typed Face{T} entity
- Add vertices() returning three Vertex{T} instances
- Add cells() returning single Cell{T} instance
- Add entity count methods: nvertices(), nedges(), nfaces()
- Update documentation to reflect typed entity returns
2025-11-23 18:19:18 +02:00
Jukka Aho 404ea66f11 refactor(topology): Modernize segment topology implementation
- Apply Vec constructor broadcasting: Vec{1,Float64}.((...))
- Convert edges() to return typed Edge{T} in SVector
- Convert faces() to return typed Vertex{T} (endpoints in 1D)
- Add vertices() method returning two Vertex{T} instances
- Add cells() method returning single Cell{T}
- Add entity count methods: nvertices(), nedges(), nfaces()
- Clean up syntax with consistent formatting
2025-11-23 18:18:52 +02:00
Jukka Aho e8c8c04075 feat(topology): Add type-level nnodes() method
- Add nnodes(::Type{<:AbstractTopology{N}}) method for type queries
- Enables compile-time node count without instantiation
- Example: nnodes(Triangle{3}) returns 3
- Complements existing instance method for dispatch consistency
2025-11-23 18:18:24 +02:00
Jukka Aho 8ae5981c09 docs(basis): Add comprehensive README for basis module
Add extensive documentation for the basis module covering:

1. Architecture and design philosophy
   - Separation of topology and basis
   - Zero-cost abstraction principles
   - SVector return types and dual-vector design

2. API overview and usage examples
   - get_basis_functions() and get_basis_derivatives()
   - nbasis() for compile-time basis function count
   - Integration with topology and quadrature modules

3. Code generation system
   - Vandermonde approach explained
   - Symbolic differentiation and simplification
   - Why offline generation vs runtime symbolic math

4. Extension guide
   - Adding higher-order elements (step-by-step)
   - Hierarchical and specialized bases
   - When to use generator vs direct implementation

5. Performance characteristics
   - Benchmarks: 100-1000× speedup over v0.5.1
   - Zero allocations, subnanosecond evaluations
   - Scaling with element order

6. Advanced topics
   - Numerical precision and ill-conditioned Vandermonde
   - Jacobian and physical derivatives
   - Partition of unity and reproduction
   - Integration accuracy requirements

Total: ~1800 lines of documentation with complete examples,
mathematical foundations, and practical guidance.
2025-11-22 14:14:55 +02:00
Jukka Aho 4f2d59965a chore(basis): Regenerate basis functions with nbasis and canonical names
Regenerate all 14 basis families with updated generator:

1. Added nbasis() functions for compile-time basis function count:
   @inline nbasis(::Segment{2}, ::Lagrange{1}) = 2
   @inline nbasis(::Triangle{3}, ::Lagrange{1}) = 3
   @inline nbasis(::Quadrilateral{9}, ::Lagrange{2}) = 9
   etc.

2. Switched from type aliases to canonical topology names:
   - Seg2 → Segment{2}
   - Tri3 → Triangle{3}
   - Quad9 → Quadrilateral{9}
   - Tet10 → Tetrahedron{10}
   - Hex8 → Hexahedron{8}

3. Instance-based dispatch throughout:
   get_basis_functions(::Triangle{3}, ::Lagrange{1}, xi)
   get_basis_derivatives(::Triangle{3}, ::Lagrange{1}, xi)
   nbasis(::Triangle{3}, ::Lagrange{1})

All functions remain zero-cost (compile to single constant/inline code).
Verified with @code_llvm showing direct constant returns.
2025-11-22 12:07:50 +02:00
Jukka Aho 9a67fa6386 feat(basis): Generate nbasis functions with canonical type names
Extend basis_generator.jl to automatically emit nbasis() functions alongside
get_basis_functions() and get_basis_derivatives():

1. Add canonical_type_name() helper to convert type aliases to full forms
   (Quad9 → Quadrilateral{9}, Tri3 → Triangle{3})

2. Generate @inline nbasis(::Topology, ::Basis) = N for each basis family
   This provides zero-cost compile-time basis function count

3. Use instance-based dispatch (::Triangle{3}, not ::Type{Triangle{3}})
   for consistency with get_basis_* functions

4. Enhanced pretty-printer to handle both function definitions and simple
   assignments, properly unwrapping begin...end blocks

Generated code now uses canonical topology names throughout, avoiding
historical type aliases for better clarity and API consistency.
2025-11-22 12:07:11 +02:00
Jukka Aho c6f18d040f feat(basis): Add basis_descriptions.jl catalog for code generation
Create centralized catalog of 14 basis element descriptions for automatic
code generation. Each description specifies:
- Topology type (Segment, Triangle, Quadrilateral, Tetrahedron, Hexahedron, etc.)
- Basis family (Lagrange{order}, Serendipity{order})
- Polynomial ansatz for Vandermonde system

Covers standard finite elements:
- 1D: Seg2, Seg3
- 2D: Tri3, Tri6, Quad4, Quad8, Quad9
- 3D: Tet4, Tet10, Hex8, Hex20, Hex27, Pyr5, Wedge6

Uses canonical topology types (Triangle{3}, Quadrilateral{9}) instead of
legacy aliases (Tri3, Quad9) for clarity and consistency.
2025-11-22 12:06:40 +02:00
Jukka Aho df449f23df feat(basis): Add nbasis() function for compile-time basis function count
Add zero-cost nbasis(topology, basis) -> Int function that returns the number
of basis functions at compile time. This is essential for validating Ciarlet
triplet (K, P, Σ) consistency and enables type-stable pre-allocations.

Key features:
- Zero-cost: compiles to single constant return (ret i64 N)
- Instance-based dispatch: nbasis(Triangle{3}(), Lagrange{1}())
- Comprehensive documentation with compile-time verification examples
- Replaces removed ndofs() function with clearer semantics

The function is generated automatically by basis_generator.jl alongside
basis function implementations, ensuring consistency.
2025-11-22 12:06:20 +02:00
Jukka Aho 6ad8c43e7e refactor(quadrature): Rename glwed.jl → gl_wedges.jl with modern API
- Deleted: src/quadrature/glwed.jl (93 lines, old zip-based API)
- Created: src/quadrature/gl_wedges.jl (142 lines, modern type-based API)

Key improvements:
- QuadraturePoint{3} with Vec{3} coordinates (not tuples)
- SVector return types (zero allocation)
- @inline directives for performance
- Two 6-point variants (default + :B)
- Comprehensive documentation explaining tensor product structure
- Three rules: 6-point (2 variants) and 21-point

Implemented rules:
  - GaussLegendre{2}(): 6 points (degree 1, default variant)
    → 3 triangle points × 2 segment points
  - GaussLegendre{2,:B}(): 6 points (degree 1, alternative triangle distribution)
  - GaussLegendre{5}(): 21 points (degree 5, high accuracy)
    → 7 triangle points × 3 segment points

Technical details:
  - Wedge is tensor product of triangle (ξ,η) and segment (ζ)
  - Reference wedge: triangular cross-section extruded in z-direction
  - 6-point rules: 2D triangle rule × 2-point 1D Gauss
  - 21-point rule: 7-point triangle × 3-point 1D Gauss
  - Legacy Val{:GLWED*} compatibility maintained

Net: +49 lines (added detailed documentation and modern type infrastructure)
2025-11-21 00:39:54 +02:00
Jukka Aho 4cf1cda237 refactor(quadrature): Rename gltet.jl → gl_tetrahedra.jl with modern API
- Deleted: src/quadrature/gltet.jl (67 lines, old zip-based API)
- Created: src/quadrature/gl_tetrahedra.jl (160 lines, modern type-based API)

Key improvements:
- QuadraturePoint{3} with Vec{3} coordinates (not tuples)
- SVector return types (zero allocation)
- @inline directives for performance
- Comprehensive documentation with warnings
- Four rules from 1-point to 15-point (degrees 1-4)

Implemented rules:
  - GaussLegendre{1}(): 1 point (centroid, degree 1)
  - GaussLegendre{2}(): 4 points (degree 2, symmetric placement)
  - GaussLegendre{4}(): 15 points (degree 4, all weights positive)

Technical details:
  - Reference tetrahedron: vertices at (0,0,0), (1,0,0), (0,1,0), (0,0,1)
  - All weights sum to 1/6 (volume of reference tetrahedron)
  - Parametric domain constraint: ξ + η + ζ ≤ 1
  - Legacy Val{:GLTET*} compatibility maintained

Warning documented:
  - GaussLegendre{3}() has negative weight at centroid (-2/15)
  - May cause numerical issues, GaussLegendre{2}() or {4}() recommended

Net: +93 lines (added extensive documentation, modern types, and safety warnings)
2025-11-21 00:39:27 +02:00
Jukka Aho 8c443a98fb refactor(quadrature): Rename gltri.jl → gl_triangles.jl with modern API
- Deleted: src/quadrature/gltri.jl (131 lines, old zip-based API)
- Created: src/quadrature/gl_triangles.jl (245 lines, modern type-based API)

Key improvements:
- QuadraturePoint{2} with Vec{2} coordinates (not tuples)
- SVector return types (zero allocation)
- @inline directives for performance
- Two variants for order 2 and 3 (default + :B)
- Comprehensive documentation with warnings about negative weights
- All rules 1-point through 12-point (degrees 1-6)

Implemented rules:
  - GaussLegendre{1}(): 1 point (centroid, degree 1)
  - GaussLegendre{2}(): 3 points (degree 2, default variant)
  - GaussLegendre{2,:B}(): 3 points (edge midpoints variant)
  - GaussLegendre{3}(): 4 points (degree 3, default variant, all weights positive)
  - GaussLegendre{4}(): 6 points (degree 4)
  - GaussLegendre{5}(): 7 points (degree 5, includes centroid)
  - GaussLegendre{6}(): 12 points (degree 6)

Technical details:
  - Reference triangle: vertices at (0,0), (1,0), (0,1)
  - All weights sum to 0.5 (area of reference triangle)
  - Parametric domain: [0,1]² with constraint ξ + η ≤ 1
  - Legacy Val{:GLTRI*} compatibility maintained

Warning documented:
  - GaussLegendre{3,:B}() has negative weight at centroid
  - May cause numerical issues, default variant recommended

Net: +114 lines (added extensive documentation, modern types, and variant support)
2025-11-21 00:38:58 +02:00
Jukka Aho 7f7077ee60 refactor(quadrature): Rename glquad.jl → gl_tensor_product.jl with modern API
- Deleted: src/quadrature/glquad.jl (40 lines, programmatic generation only)
- Created: src/quadrature/gl_tensor_product.jl (344 lines, complete implementations)

Key improvements:
- Explicit implementations for Segment, Quadrilateral, Hexahedron
- All rules GaussLegendre{1} through GaussLegendre{5}
- QuadraturePoint{D} with Vec{D} coordinates (not tuples)
- SVector return types for zero allocation
- @inline directives for performance
- Comprehensive documentation per function

Implemented rules:
Segments (1D):
  - GaussLegendre{1}(): 1 point (exact degree 1)
  - GaussLegendre{2}(): 2 points (exact degree 3)
  - GaussLegendre{3}(): 3 points (exact degree 5)
  - GaussLegendre{4}(): 4 points (exact degree 7)
  - GaussLegendre{5}(): 5 points (exact degree 9)

Quadrilaterals (2D tensor products):
  - GaussLegendre{1}(): 1×1 = 1 point
  - GaussLegendre{2}(): 2×2 = 4 points (standard Quad4)
  - GaussLegendre{3}(): 3×3 = 9 points (standard Quad9)
  - GaussLegendre{4}(): 4×4 = 16 points
  - GaussLegendre{5}(): 5×5 = 25 points

Hexahedra (3D tensor products):
  - GaussLegendre{1}(): 1×1×1 = 1 point
  - GaussLegendre{2}(): 2×2×2 = 8 points (standard Hex8)
  - GaussLegendre{3}(): 3×3×3 = 27 points (standard Hex27)
  - GaussLegendre{4}(): 4×4×4 = 64 points
  - GaussLegendre{5}(): 5×5×5 = 125 points

Legacy compatibility:
  - Old Val{:GLSEG*}, Val{:GLQUAD*}, Val{:GLHEX*} symbols still work
  - Uses _legacy_tensor_product() helper (kept old zip-based API)

Technical details:
  - Rules 1-3: Hardcoded for optimal performance
  - Rules 4-5: Generated from QUAD_DATA using ntuple for zero allocation
  - All reference domains: [-1,1]^D

Net: +304 lines (programmatic generation → explicit implementations + docs)
2025-11-21 00:38:28 +02:00
Jukka Aho 0b2195c7c2 refactor(quadrature): Rename glpyr.jl → gl_pyramids.jl with modern API
- Deleted: src/quadrature/glpyr.jl (45 lines, old zip-based API)
- Created: src/quadrature/gl_pyramids.jl (86 lines, modern type-based API)

Key improvements:
- Two pyramid rule variants: GaussLegendre{2}() (default) and GaussLegendre{2,:B}()
- QuadraturePoint{3} with Vec{3} coordinates (not tuples)
- SVector return type (zero allocation)
- Comprehensive documentation explaining pyramid singularity at apex
- Inline functions for performance
- Legacy Val{:GLPYR5} compatibility maintained

Technical details:
- Default variant: 4 base points + 1 elevated, non-uniform weights
- Variant B: 5 points with uniform weights (a = 2/15)
- Both exact for degree 1 polynomials
- Pyramid: quad base at z=0, apex at (0,0,1)

Net: +41 lines (added extensive documentation and modern types)
2025-11-21 00:37:54 +02:00
Jukka Aho 9f242df9db refactor(quadrature): Replace FEMQuad module with streamlined api.jl
- Deleted: src/quadrature/FEMQuad.jl (48 lines, old module wrapper)
- Created: src/quadrature/api.jl (365 lines, comprehensive quadrature API)

Key improvements:
- AbstractQuadratureRule type hierarchy (GaussLegendre, GaussLobatto)
- QuadraturePoint{D,T} struct with Vec{D} coordinates and Float64 weight
- Zero-allocation get_quadrature_points() returning SVector
- Multi-level default_quadrature() dispatch (4 levels: order → topology+order → topology+basis → topology only)
- Comprehensive documentation with examples and performance notes
- Integration with Tensors.jl (Vec) and StaticArrays (SVector)

Replaced:
- Old Val{:symbol} dispatch → Modern type parameters
- Old integrate_1d/2d/3d functions → Removed (not used in codebase)
- Module wrapper → Direct include (quadrature rules now in separate files)

Net: +317 lines (FEMQuad was minimal wrapper, api.jl is complete interface)
2025-11-21 00:37:27 +02:00
Jukka Aho e0d81543f6 refactor(basis): Rename and rewrite lagrange_* files to basis_* with new API
Deleted files:
- src/basis/lagrange_generated.jl (451 lines) - Old generated basis implementations
- src/basis/lagrange_generator.jl (904 lines) - Old generator with complex dispatch

New files:
- src/basis/basis_generated.jl (461 lines) - New generated implementations using get_basis_functions/derivatives API
- src/basis/basis_generator.jl (622 lines) - Simplified generator with VandermondeBasisDescription

Key changes:
- Generator: Simplified from 904 → 622 lines, removed complex dispatch logic
- Generated: New API using get_basis_functions(topology, Lagrange{P}, xi) instead of eval_basis!(Lagrange{T,P}, xi)
- Return types: NTuple → SVector for type stability and StaticArrays compatibility
- Numerical filtering: Added round_coefficient for clean fractions (1/2, 1/3, 1/18, etc.)
- Basis descriptions: Uses VandermondeBasisDescription for element metadata

Net result: 1355 lines removed, 1083 lines added (272 line reduction with cleaner design)
2025-11-21 00:35:33 +02:00
Jukka Aho c4d732a060 refactor(basis): Consolidate abstract.jl and basis_api.jl into single api.jl
Deleted files:
- src/basis/abstract.jl (374 lines) - Old abstract type definitions
- src/basis/basis_api.jl (210 lines) - Old API documentation

New file:
- src/basis/api.jl (164 lines) - Consolidated basis API

Changes:
- Merged AbstractBasis type definition from abstract.jl
- Merged basis evaluation API (get_basis_functions, get_basis_derivatives) from basis_api.jl
- Added AbstractBasisDescription and VandermondeBasisDescription types
- Removed old Lagrange{T,P} (topology in type parameter) - now Lagrange{P} only
- Removed old nnodes formulas (now live in topology module)
- Simplified to clean separation: topology passed separately, not in basis type
- Kept deprecation stubs for eval_basis! and eval_dbasis! for backward compatibility

Net result: 584 lines removed, 164 lines added (420 line reduction)
2025-11-21 00:34:40 +02:00
Jukka Aho 447edd5694 chore: Update Manifest.toml with JuliaFormatter dependencies
Machine-generated lockfile update for:
- Added JuliaFormatter v2.2.0 and its dependencies
- Added CommonMark v0.9.1 (required by JuliaFormatter)
- Added JuliaSyntax v0.4.10 (required by JuliaFormatter)
2025-11-21 00:32:41 +02:00
Jukka Aho 1f97dc4314 deps: Add JuliaFormatter as project dependency
- Added JuliaFormatter = 98e50ef6-434e-11e9-1051-2b60c6c9e899
- Added version constraint: JuliaFormatter = 2.2.0
2025-11-21 00:32:20 +02:00
Jukka Aho 7e3f9bddc1 refactor(topology): Update 3D element reference_coordinates to SVector of Vec
Hexahedron changes:
- Hex8: tuple of tuples → SVector of Vec{3,Float64} (8 corners)
- Added Hex20: SVector with 8 corners + 12 edge midpoints
- Added Hex27: SVector with 8 corners + 12 edge midpoints + 6 face centers + 1 volume center

Pyramid changes:
- Pyr5: tuple of tuples → SVector of Vec{3,Float64} (4 base corners + 1 apex)

Wedge changes:
- Wedge6: tuple of tuples → SVector of Vec{3,Float64} (2 triangular faces)
- Added Wedge15: SVector with 6 corners + 9 edge midpoints
2025-11-21 00:32:06 +02:00
Jukka Aho 342990ce55 refactor(topology): Update Tetrahedron reference_coordinates to SVector of Vec
- Changed Tet4 and Tet10 return types in docstrings: NTuple → SVector{N, Vec{3,Float64}}
- Changed implementations: tuple of tuples → SVector of Vec{3,Float64}
- Updated reference_coordinates for Tet4 (4 nodes) and Tet10 (10 nodes)
2025-11-21 00:31:28 +02:00