Skip to content

Commit a1f8410

Browse files
refactor(cable-builder): replace tag field with cmp in cable part structures
1 parent 685afeb commit a1f8410

1 file changed

Lines changed: 25 additions & 25 deletions

File tree

docs/src/cable-builder.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ Two built-in roles exist:
3131

3232
```julia
3333
struct ConductorPart{L,T,S<:AbstractShape{L,T}} <: AbstractCablePart
34-
tag::Symbol
34+
cmp::Symbol
3535
shape::S
3636
material::Material{T}
3737
end
3838

3939
struct InsulatorPart{L,T,S<:AbstractShape{L,T}} <: AbstractCablePart
40-
tag::Symbol
40+
cmp::Symbol
4141
shape::S
4242
material::Material{T}
4343
end
@@ -46,7 +46,7 @@ end
4646
Both rely on identical promotion logic:
4747

4848
```julia
49-
function ConductorPart(tag::Symbol,
49+
function ConductorPart(cmp::Symbol,
5050
shape::AbstractShape{L,Tshape},
5151
mat::Material{Tmat}) where {L,Tshape<:Real,Tmat<:Real}
5252

@@ -55,7 +55,7 @@ function ConductorPart(tag::Symbol,
5555
s = convert(AbstractShape{L,T}, shape)
5656
m = convert(Material{T}, mat)
5757

58-
ConductorPart{L,T,typeof(s)}(tag,s,m)
58+
ConductorPart{L,T,typeof(s)}(cmp,s,m)
5959
end
6060
```
6161

@@ -65,7 +65,7 @@ Identical pattern applies to `InsulatorPart`.
6565

6666
A valid cable part requires:
6767

68-
* `tag::Symbol`
68+
* `cmp::Symbol`
6969
* `shape <: AbstractShape`
7070
* `material::Material`
7171

@@ -103,7 +103,7 @@ r_in(shape)
103103
r_ex(shape)
104104
```
105105

106-
These accessors are **mandatory**.
106+
or fallback to the global default. These accessors are **mandatory**.
107107

108108
All geometry logic in downstream physics relies on them.
109109

@@ -166,7 +166,7 @@ end
166166
@inline r_ex(s::SolidCore) = s.r_ex
167167
```
168168

169-
These must always exist.
169+
These must always exist, and are defined globally. Cases non-conformal to the typical `r_in` / `r_ex` pattern must specify custom accessors, e.g. `SolidCore`, `Enclosure`.
170170

171171
Never access fields directly outside the shape file.
172172

@@ -186,7 +186,7 @@ They receive the current stacking radius.
186186

187187
```julia
188188
struct SolidCoreBuilder{P,Tgeom<:Real,Tmat<:Real}
189-
tag::Symbol
189+
cmp::Symbol
190190
r_ex::Tgeom
191191
mat::Material{Tmat}
192192
end
@@ -195,11 +195,11 @@ end
195195
Constructor:
196196

197197
```julia
198-
@inline function SolidCoreBuilder{P}(tag::Symbol,
198+
@inline function SolidCoreBuilder{P}(cmp::Symbol,
199199
r_ex::Tgeom,
200200
mat::Material{Tmat}) where {P,Tgeom,Tmat}
201201

202-
SolidCoreBuilder{P,Tgeom,Tmat}(tag,r_ex,mat)
202+
SolidCoreBuilder{P,Tgeom,Tmat}(cmp,r_ex,mat)
203203
end
204204
```
205205

@@ -211,7 +211,7 @@ Materialization:
211211
current_r != zero(T) &&
212212
error("Topological violation: Solid core must be at r=0.")
213213

214-
P(b.tag, SolidCore{Concentric}(b.r_ex), b.mat)
214+
P(b.cmp, SolidCore{Concentric}(b.r_ex), b.mat)
215215
end
216216
```
217217

@@ -221,7 +221,7 @@ end
221221

222222
```julia
223223
struct TubularBuilder{P,Tgeom<:Real,Tmat<:Real}
224-
tag::Symbol
224+
cmp::Symbol
225225
t::Tgeom
226226
mat::Material{Tmat}
227227
end
@@ -234,7 +234,7 @@ Materialization:
234234

235235
r_ex = current_r + b.t
236236

237-
P(b.tag,
237+
P(b.cmp,
238238
TubularShape{Concentric}(current_r,r_ex),
239239
b.mat)
240240
end
@@ -259,10 +259,10 @@ abstract type AbstractSpec{Target} end
259259
## SolidCoreSpec
260260

261261
```julia
262-
struct SolidCoreSpec{P,Ttag,Tr,M<:AbstractSpec{Material}} <:
262+
struct SolidCoreSpec{P,Tcmp,Tr,M<:AbstractSpec{Material}} <:
263263
AbstractSpec{SolidCoreBuilder{P}}
264264

265-
tag::Ttag
265+
cmp::Tcmp
266266
r_ex::Tr
267267
mat::M
268268
end
@@ -272,20 +272,20 @@ Constructor:
272272

273273
```julia
274274
SolidCoreSpec(::Type{P},
275-
tag::Ttag,
275+
cmp::Tcmp,
276276
r_ex::Tr,
277-
mat::M) where {P,Ttag,Tr,M<:AbstractSpec{Material}}
277+
mat::M) where {P,Tcmp,Tr,M<:AbstractSpec{Material}}
278278
```
279279

280280
---
281281

282282
## TubularPartSpec
283283

284284
```julia
285-
struct TubularPartSpec{P,Ttag,Tt,M<:AbstractSpec{Material}} <:
285+
struct TubularPartSpec{P,Tcmp,Tt,M<:AbstractSpec{Material}} <:
286286
AbstractSpec{TubularBuilder{P}}
287287

288-
tag::Ttag
288+
cmp::Tcmp
289289
t::Tt
290290
mat::M
291291
end
@@ -295,7 +295,7 @@ Constructor:
295295

296296
```julia
297297
TubularPartSpec(::Type{P},
298-
tag::Ttag,
298+
cmp::Tcmp,
299299
t::Tt,
300300
mat::M)
301301
```
@@ -353,8 +353,8 @@ User-facing constructors exist in DSL modules:
353353
Example:
354354

355355
```julia
356-
Conductor.Solid(tag,material;r)
357-
Conductor.Tubular(tag,material;t)
356+
Conductor.Solid(cmp,material;r)
357+
Conductor.Tubular(cmp,material;t)
358358
```
359359

360360
They construct specs:
@@ -431,7 +431,7 @@ Functor:
431431
Must return:
432432

433433
```
434-
P(tag, NewShape(...), material)
434+
P(cmp, NewShape(...), material)
435435
```
436436

437437
---
@@ -452,7 +452,7 @@ NewShapeSpec(::Type{P}, ...)
452452

453453
# Step 4 — Define Grid Arguments
454454

455-
If parameters are gridable, ensure they propagate through `grid_args`.
455+
If parameters are gridable, ensure they propagate through the global `grid_args` or specialize if necessary.
456456

457457
---
458458

@@ -461,7 +461,7 @@ If parameters are gridable, ensure they propagate through `grid_args`.
461461
Example:
462462

463463
```julia
464-
function Conductor.NewShape(tag::Symbol, mat; parameters...)
464+
function Conductor.NewShape(cmp::Symbol, mat; parameters...)
465465
```
466466

467467
Must return:

0 commit comments

Comments
 (0)