Зависимости
Раздел архитектурной документации TMC Suite. Граф зависимостей компонентов: что с чем линкуется, внешние зависимости, зависимости по данным.
В TMC Suite существуют два рода зависимостей:
- Зависимости линковки — какая программа связывается с какими
.lib(статическая связь на этапе сборки). - Зависимости по данным — какая программа читает файлы, созданные другой (связь на этапе исполнения). Они описаны в разделе Поток данных.
Этот раздел посвящён зависимостям линковки и внешним зависимостям.
1. Зависимости линковки
| Группа программ | Линкуется с библиотеками |
|---|---|
| Вьюверы (TMCGROUT, TMCROS, TMC_DN) | sfile95, complex, exprint |
| Счётные ядра (PlanarRT_H, PlanarRT_X) | sfile95, prepr, exprint, TMCIndan, TMCLibError |
| FieldView | sfile95, prepr, exprint, TMCIndan, TMCLibError + OpenGL (opengl32, glu32) |
Следствие для порядка сборки: все 6 библиотек должны быть готовы до сборки любой программы. Между собой библиотеки независимы и собираются в любом порядке. См. Архитектура сборки.
2. Граф зависимостей (линковка)
┌───────────┐
│ sfile95 │◄──────────────┐
└───────────┘ │
┌───────────┐ │
│ exprint │◄──────────────┤
└───────────┘ │
Вьюверы ──────────────┤ │
(TMCGROUT, ┌───────────┐ │
TMCROS, │ complex │◄── вьюверы │
TMC_DN) └───────────┘ │
│
Счётные ядра ─────────┐ │
(PlanarRT_H, ├──► sfile95, exprint ◄─────┘
PlanarRT_X) ├──► prepr
├──► TMCIndan
└──► TMCLibError
FieldView ────────────┤ (те же, что у ядер)
└──► + opengl32, glu32
Пояснения:
sfile95иexprint— общие для всех программ (и вьюверов, и ядер).complex— только у вьюверов (счётным ядрам комплексная арифметика поступает транзитивно через заголовки/вьюверный слой, отдельной линковкой ядра сcomplexне связываются).prepr,TMCIndan,TMCLibError— только у ядер и FieldView.- OpenGL (
opengl32,glu32) — только у FieldView.
3. Внешние зависимости
| Зависимость | Кто использует | Назначение |
|---|---|---|
| MFC (Microsoft Foundation Classes) | Все программы (GUI) | Окна, диалоги, документ/представление |
OpenGL (opengl32.lib, glu32.lib) |
FieldView | 3D-визуализация полей |
| CRT / Win32 API | Все компоненты | Стандартная библиотека C/C++, системные вызовы |
| Visual Studio toolset v145 | Все проекты | Компилятор и линкер (VS 2022) |
У библиотек внешних зависимостей за пределами CRT/Win32 нет — это «чистый» переиспользуемый код.
4. Зависимости между библиотеками
Библиотеки спроектированы как независимые друг от друга единицы компиляции:
каждая .lib собирается отдельно, и порядок их сборки не важен. Совместное
использование происходит на уровне программы-потребителя, которая линкуется с
нужным набором библиотек, а не на уровне взаимной линковки самих библиотек.
Общая «склейка» библиотек идёт через общие заголовки в src/Include/
(типы _complex, _real и др.), которые подключают и библиотеки, и программы.
Именно поэтому общие заголовки не правятся ради отдельных конфигураций — изменение
заголовка затронуло бы сразу все зависящие от него компоненты.
Dependencies
Architecture documentation section of TMC Suite. The component dependency graph: what links against what, external dependencies, data dependencies.
TMC Suite has two kinds of dependencies:
- Link dependencies — which program links against which
.lib(static coupling at build time). - Data dependencies — which program reads files created by another (coupling at run time). These are described in Data flow.
This section covers the link and external dependencies.
1. Link dependencies
| Program group | Links against libraries |
|---|---|
| Viewers (TMCGROUT, TMCROS, TMC_DN) | sfile95, complex, exprint |
| Compute kernels (PlanarRT_H, PlanarRT_X) | sfile95, prepr, exprint, TMCIndan, TMCLibError |
| FieldView | sfile95, prepr, exprint, TMCIndan, TMCLibError + OpenGL (opengl32, glu32) |
Consequence for the build order: all 6 libraries must be ready before building any program. The libraries themselves are independent and can be built in any order. See Build architecture.
2. Dependency graph (linking)
┌───────────┐
│ sfile95 │◄──────────────┐
└───────────┘ │
┌───────────┐ │
│ exprint │◄──────────────┤
└───────────┘ │
Viewers ──────────────┤ │
(TMCGROUT, ┌───────────┐ │
TMCROS, │ complex │◄── viewers │
TMC_DN) └───────────┘ │
│
Compute kernels ──────┐ │
(PlanarRT_H, ├──► sfile95, exprint ◄─────┘
PlanarRT_X) ├──► prepr
├──► TMCIndan
└──► TMCLibError
FieldView ────────────┤ (same as the kernels)
└──► + opengl32, glu32
Notes:
sfile95andexprintare shared by all programs (both viewers and kernels).complexis only for the viewers (the kernels receive complex arithmetic transitively through the headers/viewer layer; the kernels do not link againstcomplexseparately).prepr,TMCIndan,TMCLibErrorare only for the kernels and FieldView.- OpenGL (
opengl32,glu32) is only for FieldView.
3. External dependencies
| Dependency | Who uses it | Purpose |
|---|---|---|
| MFC (Microsoft Foundation Classes) | All programs (GUI) | Windows, dialogs, document/view |
OpenGL (opengl32.lib, glu32.lib) |
FieldView | 3D field visualization |
| CRT / Win32 API | All components | The standard C/C++ library, system calls |
| Visual Studio toolset v145 | All projects | Compiler and linker (VS 2022) |
The libraries have no external dependencies beyond CRT/Win32 — they are "clean" reusable code.
4. Dependencies between libraries
The libraries are designed as independent compilation units: each .lib is
built separately, and the order in which they are built does not matter. Sharing
happens at the level of the consuming program, which links against the
required set of libraries, rather than at the level of the libraries linking
against one another.
The libraries are "glued" together through the shared headers in
src/Include/ (types _complex, _real, etc.), which are included by both the
libraries and the programs. That is exactly why the shared headers are not
edited for individual configurations — changing a header would affect all
components that depend on it at once.