# atzedent/.net-physics architecture

> Architecture diagram of the GitHub repository atzedent/.net-physics, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/atzedent/.net-physics
- Repository: https://github.com/atzedent/.net-physics

## Overview

##### Project type and purpose
- This is an open-source .NET class-library (“IMaverick.Physics”) providing strongly-typed physical values (length, time, temperature, etc.) to the CLR.
- Complementary projects:
- IMaverick.Gallio.Extensions – a plugin to integrate physics tests into the Gallio test runner
- IMaveric.Physics.Tests – C# test suite
- IMaveric.Physics.Tests.FSharp – F# test scripts

##### File structure
- Top-level folders/projects:
- IMaverick.Physics – core library (Dimension, Unit, PhysicalValue, Specification, PredicateBuilder, extension methods)
- IMaverick.Gallio.Extensions – Gallio adapter (Plot.cs, extensions)
- IMaveric.Physics.Tests (C#) & IMaveric.Physics.Tests.FSharp (F#) – test suites and scripts
- Supporting files: IMaverick.Physics.sln, README.textile, LICENSE.textile
- No web front end or database – purely code library + test harness

##### README for additional insights
- Case-study / work-in-progress
- Inspired by F# units-of-measure but implemented as CLR types + extension methods
- Community contributions welcomed

a. Main components
1. Core Library (IMaverick.Physics.dll)
- Packages of types: Dimension, Unit, PhysicalValue, Specification, PredicateBuilder
- Extension methods (length, time, temperature, math, enumerable)
2. Gallio Extensions (IMaverick.Gallio.Extensions.dll)
- Plugins for Gallio test framework (Plot.cs)
3. Test Suites
- C# Tests (IMaveric.Physics.Tests)
- F# Script Tests (IMaveric.Physics.Tests.FSharp)
4. External platforms
- .NET CLR
- Gallio test runner
b. Relationships & interactions
- Test suites reference & invoke the core library’s types and operations
- All libraries are built and loaded on the .NET CLR
c. Architectural patterns
- Specification pattern (Specification.cs, PredicateBuilder.cs) for composing testable predicates
- Extension Methods pattern for augmenting numeric types with unit-specific methods
d. Key technologies & frameworks
- Language: C# (+ F# scripts for functional tests)
- Build/test runner: MSBuild solution (.sln) + Gallio
- Unit test frameworks: MSTest (or Gallio adapter over NUnit/MBUnit)

##### Details to capture
- Extension-method files under one “Extensions” sub-component
- Specification and PredicateBuilder as the internal DSL/predicate engine
- F# Script harness separately to demonstrate cross-language testing

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Core Library (IMaverick.Physics.dll)"
        direction TB
        Core["IMaverick.Physics.dll"]:::core
        Dimension["Dimension.cs"]:::core
        Unit["Unit.cs"]:::core
        PhysicalValue["PhysicalValue.cs"]:::core
        Specification["Specification.cs"]:::core
        PredicateBuilder["PredicateBuilder.cs"]:::core
        subgraph "Extensions"
            direction TB
            LengthExt["DoubleExtensions.Length.cs"]:::core
            TempExt["DoubleExtensions.Temperature.cs"]:::core
            TimeExt["DoubleExtensions.Time.cs"]:::core
            GeneralExt["DoubleExtensions.cs"]:::core
            IEnumExt["IEnumerableExtensions.cs"]:::core
            MathExt["MathExtensions.cs"]:::core
            PhysValExt["PhysicalValueExtensions.cs"]:::core
            TimeExt2["TimeExtensions.cs"]:::core
        end
    end

    subgraph "Gallio Extensions (IMaverick.Gallio.Extensions.dll)"
        direction TB
        Gallio["IMaverick.Gallio.Extensions.dll"]:::ext
        Plot["Plot.cs"]:::ext
    end

    subgraph "Test Suites"
        direction TB
        CSharp["C# Tests (IMaverick.Physics.Tests)"]:::test
        FSharp["F# Script Tests (IMaveric.Physics.Tests.FSharp)"]:::test
    end

    CLR[".NET CLR"]:::external
    Runner["Gallio Runner"]:::external

    CSharp -->|"references"| Core
    FSharp -->|"scripts against"| Core
    Runner -->|"loads plugin"| Gallio
    Gallio -->|"hooks into"| Core
    CLR -->|"hosts"| Core
    CLR -->|"hosts"| Gallio
    CLR -->|"hosts"| CSharp
    CLR -->|"hosts"| FSharp

    click Dimension "https://github.com/atzedent/.net-physics/blob/master/IMaverick.Physics/Dimension.cs"
    click Unit "https://github.com/atzedent/.net-physics/blob/master/IMaverick.Physics/Unit.cs"
    click PhysicalValue "https://github.com/atzedent/.net-physics/blob/master/IMaverick.Physics/PhysicalValue.cs"
    click Specification "https://github.com/atzedent/.net-physics/blob/master/IMaverick.Physics/Specification.cs"
    click PredicateBuilder "https://github.com/atzedent/.net-physics/blob/master/IMaverick.Physics/PredicateBuilder.cs"
    click LengthExt "https://github.com/atzedent/.net-physics/blob/master/IMaverick.Physics/Extensions/DoubleExtensions.Length.cs"
    click TempExt "https://github.com/atzedent/.net-physics/blob/master/IMaverick.Physics/Extensions/DoubleExtensions.Temperature.cs"
    click TimeExt "https://github.com/atzedent/.net-physics/blob/master/IMaverick.Physics/Extensions/DoubleExtensions.Time.cs"
    click GeneralExt "https://github.com/atzedent/.net-physics/blob/master/IMaverick.Physics/Extensions/DoubleExtensions.cs"
    click IEnumExt "https://github.com/atzedent/.net-physics/blob/master/IMaverick.Physics/Extensions/IEnumerableExtensions.cs"
    click MathExt "https://github.com/atzedent/.net-physics/blob/master/IMaverick.Physics/Extensions/MathExtensions.cs"
    click PhysValExt "https://github.com/atzedent/.net-physics/blob/master/IMaverick.Physics/Extensions/PhysicalValueExtensions.cs"
    click TimeExt2 "https://github.com/atzedent/.net-physics/blob/master/IMaverick.Physics/Extensions/TimeExtensions.cs"
    click Gallio "https://github.com/atzedent/.net-physics/blob/master/IMaverick.Gallio.Extensions/IMaverick.Gallio.Extensions.csproj"
    click Plot "https://github.com/atzedent/.net-physics/blob/master/IMaverick.Gallio.Extensions/Plot.cs"
    click CSharp "https://github.com/atzedent/.net-physics/blob/master/IMaverick.Physics.Tests/IMaverick.Physics.Tests.csproj"
    click FSharp "https://github.com/atzedent/.net-physics/blob/master/IMaveric.Physics.Tests.FSharp/IMaveric.Physics.Tests.FSharp.fsproj"

    classDef core fill:#D0E8FF,stroke:#036
    classDef ext fill:#D0FFD0,stroke:#063
    classDef test fill:#FFE0B2,stroke:#F57C00
    classDef external fill:#F0F0F0,stroke:#999
```
