Программа PlanarRT_X — API-документация

Пакет TMC Suite. Счётное ядро для электродинамического расчёта планарных структур в X-моде во временно́й области. Выходной файл: tmc_rtx.exe. Язык документации: русский. Все сигнатуры приведены по исходникам из src/kernels/PlanarRT_X/ и общим заголовкам из src/Include/.

Примечание про общий код. PlanarRT_X — копия кодовой базы PlanarRT_H с изменённым вычислительным ядром. Описание общих классов — в planar_rt_h.md; здесь — только отличия X-варианта.


1. Назначение программы

PlanarRT_X (tmc_rtx.exe) — счётное ядро пакета TMC Suite, выполняющее электродинамический расчёт планарных структур в X-моде. Алгоритм использует 4 подтакта на каждый временно́й цикл 1T (вместо 2 в H-поляризации) и хранит на каждом узле 8 компонент напряжения и 6 значений проводимости.

Ключевые отличия от H-поляризации:

  • 4 подтакта на цикл 1T (вместо 2);
  • 8 компонент напряжения на узле (вместо 4), поле rUo удалено;
  • массивы напряжений/проводимостей в 3 раза больше (6*nNumNode вместо 2*nNumNode);
  • 6 значений проводимости на узел (вместо 2);
  • в расчёте используются заряд и масса электрона (ELECTRON_Q___, ELECTRON_M___);
  • распознаются дополнительные типы блоков RECT_STAT_Y, CIRCLE_STAT_Y, POLYGON_STAT_Y, FILE_Y;
  • вызовы DistributionIntegrated (накопление для диаграммы направленности) закомментированы;
  • раздел реестра настроек: SetRegistryKey("PlanarRT_X").

Всё остальное (MFC-каркас, диалоги, глобальные функции, форматы файлов) идентично PlanarRT_H (см. planar_rt_h.md).


2. Состав проекта и отличия исходников

Файл проекта называется PlanRT_H.vcxproj (как у H-ядра!), но лежит в папке src/kernels/PlanarRT_X/; имя проекта внутри — <ProjectName>PlanRT_X</ProjectName>, цель — <TargetName>tmc_rtx</TargetName>.

Перечень файлов совпадает с H-проектом (planar_rt_h.md, §2), включая кросс-проектные TmcSMatrix.cpp/TmcTtoS.cpp и тот же список библиотек. Однако файлы не идентичны побайтно. Сравнение копий (по MD5):

Файл Отличие X-копии от H-копии
TmcRTHRectNode.h/.cpp Добавлены методы тактов 2/3 (RunExciteInputs2/3, RunScatteringNode2/3, RunScatteringNode1line2/3, RunBlockNode2/3), 4 подтакта в RunKernel1T, массивы 6*nNumNode+32, комментарии о 6 проводимостях узла
TmcRTHNodeDiel.h/.cpp Структура узла: 8 компонент напряжения, удалено rUo; методы ExciteInputs2/3, RunBlockNode2/3; обработка блоков *_STAT_Y/FILE_Y; объём кода заметно больше (295 КБ против 253 КБ)
PlanRT_H.cpp Единственное отличие: SetRegistryKey("PlanarRT_X")
PlanRT_HView.cpp, TmcDialogStatistics.cpp Только пробельные символы
Остальные .cpp/.h Побайтно идентичны

Отличия реализованы прямо в коде копий, а не через #ifdef: поиск #ifdef ELECTRON_Q___ / #ifdef CTMCRTH_INDANBLCK_* по всем исходникам не находит ни одного вхождения.

2.1. Шесть препроцессорных макросов X-проекта

В PreprocessorDefinitions X-проекта (все 4 конфигурации) дополнительно заданы 6 имён:

ELECTRON_Q___
ELECTRON_M___
CTMCRTH_INDANBLCK_FILEY
CTMCRTH_INDANBLCK_RECTSTATY
CTMCRTH_INDANBLCK_CIRCSTATY
CTMCRTH_INDANBLCK_POLYGSTTY

Правило проекта (см. CLAUDE.md): эти макросы задаются только в свойствах проекта X-моды (C/C++ → Preprocessor → Preprocessor Definitions) и не добавляются в общие заголовки.

Что эти имена означают в текущем коде:

Имя Определение в общих заголовках Использование
ELECTRON_Q___ Typerth.h: константа 1.602176565e-19 — заряд электрона (Кл) TmcRTHRectNode.cpp (X): d_e = ELECTRON_Q___; в расчёте рассеяния
ELECTRON_M___ Typerth.h: константа 9.10938356e-31 — масса электрона (кг) TmcRTHRectNode.cpp (X): d_m = ELECTRON_M___;
CTMCRTH_INDANBLCK_FILEY Tmcgrviw.h: строка "FILE_Y " TmcRTHNodeDiel.cpp (X): распознавание блока в .tpl
CTMCRTH_INDANBLCK_RECTSTATY Tmcgrviw.h: строка "RECT_STAT_Y " то же
CTMCRTH_INDANBLCK_CIRCSTATY Tmcgrviw.h: строка "CIRCLE_STAT_Y " то же
CTMCRTH_INDANBLCK_POLYGSTTY Tmcgrviw.h: строка "POLYGON_STAT_Y " то же

То есть в текущей редакции кода эти 6 имён — не переключатели условной компиляции, а константы (физические константы электрона и строковые ключевые слова типов блоков с суффиксом _Y), уже определённые в общих заголовках. Требование задавать их в настройках проекта — историческое требование сборки X-моды (вероятно, под старую редакцию заголовков)


3. Ключевые типы (X-мода)

3.1. sTmcRTHNodeDielOne — узел (X-мода, 4 такта)

Точное определение из src/kernels/PlanarRT_X/TmcRTHNodeDiel.h:

struct STMCRTH_NODEDIELONE
{
    _ELEM_VAL_RTH rU;       // падающее напряжение (такт 0)
    _ELEM_VAL_RTH rU1;      // падающее напряжение (такт 1)
    _ELEM_VAL_RTH rU2;      // падающее напряжение (такт 2)
    _ELEM_VAL_RTH rU3;      // падающее напряжение (такт 3)
    _ELEM_VAL_RTH rU_Cur;   // текущее напряжение
    _ELEM_VAL_RTH rU_Cur1;  // напряжение такта «текущий+1»
    _ELEM_VAL_RTH rU_Cur2;  // напряжение такта «текущий+2»
    _ELEM_VAL_RTH rU_Cur3;  // напряжение такта «текущий+3»
    _real rY;               // проводимость узла
    int   nNodeGlobal;      // номер узла в глобальной топологии
    int   nType;            // тип узла (как в H, см. planar_rt_h.md §3.3)
};

Отличия от H-варианта: добавлены rU1, rU2, rU3, rU_Cur2, rU_Cur3; поле rUo удалено. Итого 8 компонент напряжения (4 падающих + 4 текущих) против 4 в H (rU, rU_Cur, rU_Cur1, rUo).

3.2. Массивы ядра и 6 проводимостей узла

Глобальные массивы prUNode1/prYNode выделяются размером 6*nNumNode + 32 (в H — 2*nNumNode + 32); запас 32 элемента используется для выравнивания рабочего указателя на 32 байта.

Смысл шести значений prYNode на узел — по комментариям в TmcRTHRectNode.h (X):

// prYNode[0] - value 2/(y1+y2+y3+y4+y5+y+y6*y7/(y6+y7));
// prYNode[1] - value y5;
// prYNode[2] - value y;
// prYNode[3] - value 2*(y6*y7)/(y6+y7);
// prYNode[4] - value 2*(y7-y6)/(y6+y7);
// prYNode[5] - value prYNode[3]*prYNode[4]/4;

Хранение напряжений по тактам — по комментариям там же:

// prUNode1[0] - voltage in takt t   and t-4;
// prUNode1[1] - voltage in takt t-1 and t-5;
// prUNode1[2] - voltage in takt t-2 and t-6;
// prUNode1[3] - voltage in takt t-3 and t-7;

Физический смысл величин y1..y7 в коде не пояснён


4. Класс CTmcRTHRectNode — различия

Общее описание (поля, публичные методы) — planar_rt_h.md, §5. Отличия X-варианта:

4.1. Дополнительные приватные методы (только в X)

Метод Назначение
void RunExciteInputs2(void) / void RunExciteInputs3(void) Возбуждение входов (подтакты 2, 3)
void RunScatteringNode2(void) / void RunScatteringNode3(void) Рассеяние на узлах (подтакты 2, 3)
near void RunScatteringNode1line2(_ELEM_VAL_RTH *pr_111, _real *prY_111, int nx_111, int nX_111) Рассеяние по строке сетки (подтакт 2); параметры как у RunScatteringNode1line (см. planar_rt_h.md, §5.3)
near void RunScatteringNode1line3(...) То же, подтакт 3
void RunBlockNode2(void) / void RunBlockNode3(void) Обработка блоков (подтакты 2, 3)

4.2. Алгоритм одного цикла 1T (X-мода, 4 подтакта)

Точная последовательность из RunKernel1T() (TmcRTHRectNode.cpp:537, X-копия):

Подтакт 0: RunExciteInputs();  RunScatteringNode();  RunBlockNode();  PutField(0);
           // DistributionIntegrated(0);  — закомментировано
           nTCurrent++;  dTCurrent += dT;
Подтакт 1: RunExciteInputs1(); RunScatteringNode1(); RunBlockNode1(); PutField(1);
           nTCurrent++;  dTCurrent += dT;
Подтакт 2: RunExciteInputs2(); RunScatteringNode2(); RunBlockNode2(); PutField(2);
           nTCurrent++;  dTCurrent += dT;
Подтакт 3: RunExciteInputs3(); RunScatteringNode3(); RunBlockNode3(); PutField(3);
           nTCurrent++;  dTCurrent += dT;

Счётчик nTCurrent растёт на 1 в каждом подтакте (итого +4 за цикл). Главный цикл RunKernel (for(; nTCurrent < nTMax; ...)) по завершении вызывает PutSmatrix() — как в H.

Все четыре вызова DistributionIntegrated(0..3) закомментированы (строки 548, 558, 568, 578) — накопление поля для диаграммы направленности в X-моде не выполняется.


5. Класс CTmcRTHNodeDiel — различия

Общее описание — planar_rt_h.md, §6.

5.1. Дополнительные публичные методы (только в X)

Метод Назначение
void ExciteInputs2(CTmcLibError &cError1, double dWT, double dT, _ELEM_VAL_RTH *pr1, int nX, CTmcRTH_IndanParam &cParam, double dtCurrent) Возбуждение входных узлов, подтакт 2 (сигнатура идентична ExciteInputs)
void ExciteInputs3(...) То же, подтакт 3
void RunBlockNode2(_ELEM_VAL_RTH *prUNode1, _real *prYNode, int nX, int nArraySize) Обновление напряжений узлов блока, подтакт 2
void RunBlockNode3(...) То же, подтакт 3

5.2. Блоки *_STAT_Y и FILE_Y

X-вариант TmcRTHNodeDiel.cpp дополнительно распознаёт в секции TOPOLOGY ключевые слова RECT_STAT_Y, CIRCLE_STAT_Y, POLYGON_STAT_Y, FILE_Y (строковые константы CTMCRTH_INDANBLCK_*Y из Tmcgrviw.h). H-вариант этих блоков не обрабатывает. Назначение суффикса _Y (вероятно, задание блока проводимостью Y)


6. Сводная таблица различий H vs X

Параметр PlanarRT_H PlanarRT_X
Выходной exe tmc_rth.exe tmc_rtx.exe
Имя проекта (ProjectName) PlanRT_H PlanRT_X (файл также PlanRT_H.vcxproj)
Подтактов на цикл 1T 2 4
Приращение nTCurrent за цикл +2 +4
Компоненты напряжения узла 4 (rU, rU_Cur, rU_Cur1, rUo) 8 (rU..rU3, rU_Cur..rU_Cur3), rUo нет
Размер массивов prUNode1/prYNode 2*nNumNode + 32 6*nNumNode + 32
Значений проводимости на узел 2 6 (см. §3.2)
Константы электрона (d_e, d_m) не используются используются в рассеянии
Блоки *_STAT_Y, FILE_Y не распознаются распознаются
DistributionIntegrated вызывается закомментирован
Доп. макросы в .vcxproj нет 6 имён (§2.1)
RunExciteInputs2/3, RunScatteringNode2/3, RunBlockNode2/3, ExciteInputs2/3 нет есть
Раздел реестра PlanarRT_H PlanarRT_X

The PlanarRT_X program — API documentation

TMC Suite package. A compute kernel for the electrodynamic computation of planar structures in the X-mode in the time domain. Output file: tmc_rtx.exe. All signatures are taken from the sources in src/kernels/PlanarRT_X/ and the shared headers from src/Include/.

A note on the shared code. PlanarRT_X is a copy of the PlanarRT_H codebase with a modified computation core. The description of the common classes is in planar_rt_h.md; here — only the differences of the X variant.


1. Purpose of the program

PlanarRT_X (tmc_rtx.exe) is a compute kernel of the TMC Suite package that performs the electrodynamic computation of planar structures in the X-mode. The algorithm uses 4 sub-steps for each 1T time cycle (instead of 2 in H-polarization) and stores 8 voltage components and 6 conductance values at each node.

Key differences from H-polarization:

  • 4 sub-steps per 1T cycle (instead of 2);
  • 8 voltage components per node (instead of 4), the field rUo removed;
  • the voltage/conductance arrays are 3 times larger (6*nNumNode instead of 2*nNumNode);
  • 6 conductance values per node (instead of 2);
  • the electron charge and mass are used in the computation (ELECTRON_Q___, ELECTRON_M___);
  • additional block types RECT_STAT_Y, CIRCLE_STAT_Y, POLYGON_STAT_Y, FILE_Y are recognized;
  • the DistributionIntegrated calls (accumulation for the radiation pattern) are commented out;
  • the settings registry key: SetRegistryKey("PlanarRT_X").

Everything else (the MFC framework, the dialogs, the global functions, the file formats) is identical to PlanarRT_H (see planar_rt_h.md).


2. Project composition and source differences

The project file is named PlanRT_H.vcxproj (like the H kernel!), but lies in the folder src/kernels/PlanarRT_X/; the project name inside is <ProjectName>PlanRT_X</ProjectName>, the target is <TargetName>tmc_rtx</TargetName>.

The list of files coincides with the H project (planar_rt_h.md, §2), including the cross-project TmcSMatrix.cpp/TmcTtoS.cpp and the same list of libraries. However, the files are not byte-for-byte identical. A comparison of the copies (by MD5):

File Difference of the X copy from the H copy
TmcRTHRectNode.h/.cpp The step 2/3 methods added (RunExciteInputs2/3, RunScatteringNode2/3, RunScatteringNode1line2/3, RunBlockNode2/3), 4 sub-steps in RunKernel1T, the arrays 6*nNumNode+32, comments about the 6 node conductances
TmcRTHNodeDiel.h/.cpp The node structure: 8 voltage components, rUo removed; the methods ExciteInputs2/3, RunBlockNode2/3; handling of the *_STAT_Y/FILE_Y blocks; the code volume is noticeably larger (295 KB vs. 253 KB)
PlanRT_H.cpp The only difference: SetRegistryKey("PlanarRT_X")
PlanRT_HView.cpp, TmcDialogStatistics.cpp Only whitespace
The other .cpp/.h Byte-for-byte identical

The differences are implemented directly in the code of the copies, not through #ifdef: a search for #ifdef ELECTRON_Q___ / #ifdef CTMCRTH_INDANBLCK_* across all the sources finds no occurrences.

2.1. The six preprocessor macros of the X project

In the PreprocessorDefinitions of the X project (all 4 configurations) 6 names are additionally set:

ELECTRON_Q___
ELECTRON_M___
CTMCRTH_INDANBLCK_FILEY
CTMCRTH_INDANBLCK_RECTSTATY
CTMCRTH_INDANBLCK_CIRCSTATY
CTMCRTH_INDANBLCK_POLYGSTTY

The project rule (see CLAUDE.md): these macros are set only in the X-mode project properties (C/C++ → Preprocessor → Preprocessor Definitions) and are not added to the shared headers.

What these names mean in the current code:

Name Definition in the shared headers Usage
ELECTRON_Q___ Typerth.h: the constant 1.602176565e-19 — the electron charge (C) TmcRTHRectNode.cpp (X): d_e = ELECTRON_Q___; in the scattering computation
ELECTRON_M___ Typerth.h: the constant 9.10938356e-31 — the electron mass (kg) TmcRTHRectNode.cpp (X): d_m = ELECTRON_M___;
CTMCRTH_INDANBLCK_FILEY Tmcgrviw.h: the string "FILE_Y " TmcRTHNodeDiel.cpp (X): recognition of the block in the .tpl
CTMCRTH_INDANBLCK_RECTSTATY Tmcgrviw.h: the string "RECT_STAT_Y " the same
CTMCRTH_INDANBLCK_CIRCSTATY Tmcgrviw.h: the string "CIRCLE_STAT_Y " the same
CTMCRTH_INDANBLCK_POLYGSTTY Tmcgrviw.h: the string "POLYGON_STAT_Y " the same

That is, in the current revision of the code these 6 names are not conditional-compilation switches but constants (the electron physical constants and the string keywords of the _Y-suffixed block types), already defined in the shared headers. The requirement to set them in the project settings is a historical requirement of the X-mode build (likely for an older revision of the headers).


3. Key types (X-mode)

3.1. sTmcRTHNodeDielOne — a node (X-mode, 4 tacts)

The exact definition from src/kernels/PlanarRT_X/TmcRTHNodeDiel.h:

struct STMCRTH_NODEDIELONE
{
    _ELEM_VAL_RTH rU;       // the incident voltage (tact 0)
    _ELEM_VAL_RTH rU1;      // the incident voltage (tact 1)
    _ELEM_VAL_RTH rU2;      // the incident voltage (tact 2)
    _ELEM_VAL_RTH rU3;      // the incident voltage (tact 3)
    _ELEM_VAL_RTH rU_Cur;   // the current voltage
    _ELEM_VAL_RTH rU_Cur1;  // the "current+1" tact voltage
    _ELEM_VAL_RTH rU_Cur2;  // the "current+2" tact voltage
    _ELEM_VAL_RTH rU_Cur3;  // the "current+3" tact voltage
    _real rY;               // the node conductance
    int   nNodeGlobal;      // the node number in the global topology
    int   nType;            // the node type (as in H, see planar_rt_h.md §3.3)
};

Differences from the H variant: rU1, rU2, rU3, rU_Cur2, rU_Cur3 are added; the field rUo is removed. In total 8 voltage components (4 incident + 4 current) versus 4 in H (rU, rU_Cur, rU_Cur1, rUo).

3.2. The kernel arrays and the 6 node conductances

The global arrays prUNode1/prYNode are allocated with the size 6*nNumNode + 32 (in H — 2*nNumNode + 32); the reserve of 32 elements is used to align the working pointer to 32 bytes.

The meaning of the six prYNode values per node — by the comments in TmcRTHRectNode.h (X):

// prYNode[0] - value 2/(y1+y2+y3+y4+y5+y+y6*y7/(y6+y7));
// prYNode[1] - value y5;
// prYNode[2] - value y;
// prYNode[3] - value 2*(y6*y7)/(y6+y7);
// prYNode[4] - value 2*(y7-y6)/(y6+y7);
// prYNode[5] - value prYNode[3]*prYNode[4]/4;

The storage of the voltages by tact — by the comments in the same place:

// prUNode1[0] - voltage in takt t   and t-4;
// prUNode1[1] - voltage in takt t-1 and t-5;
// prUNode1[2] - voltage in takt t-2 and t-6;
// prUNode1[3] - voltage in takt t-3 and t-7;

4. The CTmcRTHRectNode class — differences

The general description (the fields, the public methods) — planar_rt_h.md, §5. The differences of the X variant:

4.1. Additional private methods (only in X)

Method Purpose
void RunExciteInputs2(void) / void RunExciteInputs3(void) Excitation of the inputs (sub-steps 2, 3)
void RunScatteringNode2(void) / void RunScatteringNode3(void) Scattering at the nodes (sub-steps 2, 3)
near void RunScatteringNode1line2(_ELEM_VAL_RTH *pr_111, _real *prY_111, int nx_111, int nX_111) Scattering along a grid row (sub-step 2); the parameters as in RunScatteringNode1line (see planar_rt_h.md, §5.3)
near void RunScatteringNode1line3(...) The same, sub-step 3
void RunBlockNode2(void) / void RunBlockNode3(void) Block handling (sub-steps 2, 3)

4.2. The algorithm of one 1T cycle (X-mode, 4 sub-steps)

The exact sequence from RunKernel1T() (TmcRTHRectNode.cpp:537, the X copy):

Sub-step 0: RunExciteInputs();  RunScatteringNode();  RunBlockNode();  PutField(0);
            // DistributionIntegrated(0);  — commented out
            nTCurrent++;  dTCurrent += dT;
Sub-step 1: RunExciteInputs1(); RunScatteringNode1(); RunBlockNode1(); PutField(1);
            nTCurrent++;  dTCurrent += dT;
Sub-step 2: RunExciteInputs2(); RunScatteringNode2(); RunBlockNode2(); PutField(2);
            nTCurrent++;  dTCurrent += dT;
Sub-step 3: RunExciteInputs3(); RunScatteringNode3(); RunBlockNode3(); PutField(3);
            nTCurrent++;  dTCurrent += dT;

The counter nTCurrent grows by 1 in each sub-step (i.e. +4 per cycle). The main loop RunKernel (for(; nTCurrent < nTMax; ...)) calls PutSmatrix() on completion — as in H.

All four DistributionIntegrated(0..3) calls are commented out (lines 548, 558, 568, 578) — the accumulation of the field for the radiation pattern is not performed in the X-mode.


5. The CTmcRTHNodeDiel class — differences

The general description — planar_rt_h.md, §6.

5.1. Additional public methods (only in X)

Method Purpose
void ExciteInputs2(CTmcLibError &cError1, double dWT, double dT, _ELEM_VAL_RTH *pr1, int nX, CTmcRTH_IndanParam &cParam, double dtCurrent) Excitation of the input nodes, sub-step 2 (identical signature to ExciteInputs)
void ExciteInputs3(...) The same, sub-step 3
void RunBlockNode2(_ELEM_VAL_RTH *prUNode1, _real *prYNode, int nX, int nArraySize) Updating the block-node voltages, sub-step 2
void RunBlockNode3(...) The same, sub-step 3

5.2. The *_STAT_Y and FILE_Y blocks

The X variant of TmcRTHNodeDiel.cpp additionally recognizes in the TOPOLOGY section the keywords RECT_STAT_Y, CIRCLE_STAT_Y, POLYGON_STAT_Y, FILE_Y (the string constants CTMCRTH_INDANBLCK_*Y from Tmcgrviw.h). The H variant does not handle these blocks.


6. Summary table of H vs X differences

Parameter PlanarRT_H PlanarRT_X
Output exe tmc_rth.exe tmc_rtx.exe
Project name (ProjectName) PlanRT_H PlanRT_X (the file is also PlanRT_H.vcxproj)
Sub-steps per 1T cycle 2 4
nTCurrent increment per cycle +2 +4
Node voltage components 4 (rU, rU_Cur, rU_Cur1, rUo) 8 (rU..rU3, rU_Cur..rU_Cur3), no rUo
Size of the prUNode1/prYNode arrays 2*nNumNode + 32 6*nNumNode + 32
Conductance values per node 2 6 (see §3.2)
Electron constants (d_e, d_m) not used used in scattering
The *_STAT_Y, FILE_Y blocks not recognized recognized
DistributionIntegrated called commented out
Additional macros in the .vcxproj none 6 names (§2.1)
RunExciteInputs2/3, RunScatteringNode2/3, RunBlockNode2/3, ExciteInputs2/3 none present
Registry key PlanarRT_H PlanarRT_X