From 2c1701e6a59298791e0a46c0be14d08fc61bd599 Mon Sep 17 00:00:00 2001 From: Jukka Aho Date: Mon, 15 Dec 2025 06:08:09 +0200 Subject: [PATCH] feat(dofs): add DOF system main entry point New 40-line main entry point for DOF system: - Includes api.jl (DOF{T,E} abstract type) - Includes fields.jl (field specification system) - Documents multi-field philosophy (single-field is special case) - Defines module structure and dependencies - Already integrated in JuliaFEM.jl (line 313) Provides unified type-level field specification system for finite elements. --- src/dofs/dofs.jl | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/dofs/dofs.jl diff --git a/src/dofs/dofs.jl b/src/dofs/dofs.jl new file mode 100644 index 0000000..0a3d967 --- /dev/null +++ b/src/dofs/dofs.jl @@ -0,0 +1,40 @@ +# This file is a part of JuliaFEM. +# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE + +""" +DOF System - Type-Level Field Specifications + +Main entry point for the DOF system. + +# Philosophy (November 2025) + +**Multi-field is fundamental! Single-field is just a special case with one key.** + +Field specifications are `DOFSet` types (currently implemented as NamedTuples), used purely at the type level: + +```julia +# Clean syntax using abstract DOF{T,E} types: +(T = DOF{Float64, Vertex}, u = DOF{Vec{3,Float64}, Vertex}) + +# Using DOFSet macro (preferred): +S = @DOFSet{T::DOF{Temperature, Vertex}, u::DOF{Displacement{3}, Vertex}} + +# Used in Element type parameter: +Element{Tetrahedron{4}, Lagrange{1}, S} +``` + +**Note**: `@NamedTuple` also works (since `DOFSet = NamedTuple`), but `@DOFSet` is preferred for future compatibility. + +# Module Structure +- `api.jl`: DOF{T,E} abstract type + dof_size() utility +- `fields.jl`: Field specification system (@DOFSet, ndofs, etc.) +""" + +# DOF{T,E} abstract type (type-level specification only) +include("api.jl") + +# Field specification system (@DOFSet macro, ndofs, etc.) +include("fields.jl") + +# Note: dof_connectivity.jl is included later in JuliaFEM.jl after Element is defined +# Note: dof_manager.jl is included later in JuliaFEM.jl after Mesh is defined